funda-ui 1.0.272
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/BackToTop/index.css +34 -0
- package/BackToTop/index.d.ts +11 -0
- package/BackToTop/index.js +458 -0
- package/CascadingSelect/index.css +159 -0
- package/CascadingSelect/index.d.ts +56 -0
- package/CascadingSelect/index.js +958 -0
- package/CascadingSelectE2E/index.css +159 -0
- package/CascadingSelectE2E/index.d.ts +60 -0
- package/CascadingSelectE2E/index.js +1126 -0
- package/Checkbox/index.d.ts +30 -0
- package/Checkbox/index.js +226 -0
- package/ColorPicker/index.css +38 -0
- package/ColorPicker/index.d.ts +27 -0
- package/ColorPicker/index.js +246 -0
- package/DigitalClock/index.d.ts +7 -0
- package/DigitalClock/index.js +208 -0
- package/DropdownMenu/index.css +127 -0
- package/DropdownMenu/index.d.ts +37 -0
- package/DropdownMenu/index.js +237 -0
- package/DynamicFields/index.d.ts +26 -0
- package/DynamicFields/index.js +412 -0
- package/File/index.d.ts +36 -0
- package/File/index.js +473 -0
- package/Input/index.d.ts +42 -0
- package/Input/index.js +286 -0
- package/LiveSearch/index.d.ts +37 -0
- package/LiveSearch/index.js +1195 -0
- package/ModalDialog/index.d.ts +60 -0
- package/ModalDialog/index.js +725 -0
- package/ModeSwitch/index.d.ts +17 -0
- package/ModeSwitch/index.js +202 -0
- package/MultiFuncSelect/index.css +178 -0
- package/MultiFuncSelect/index.d.ts +67 -0
- package/MultiFuncSelect/index.js +1826 -0
- package/MultilevelDropdownMenu/index.css +35 -0
- package/MultilevelDropdownMenu/index.d.ts +25 -0
- package/MultilevelDropdownMenu/index.js +464 -0
- package/Pagination/index.d.ts +49 -0
- package/Pagination/index.js +341 -0
- package/README.md +108 -0
- package/Radio/index.d.ts +31 -0
- package/Radio/index.js +246 -0
- package/RangeSlider/index.css +149 -0
- package/RangeSlider/index.d.ts +21 -0
- package/RangeSlider/index.js +730 -0
- package/ScrollReveal/index.css +23 -0
- package/ScrollReveal/index.d.ts +21 -0
- package/ScrollReveal/index.js +216 -0
- package/Scrollbar/index.css +168 -0
- package/Scrollbar/index.d.ts +15 -0
- package/Scrollbar/index.js +605 -0
- package/SearchBar/index.d.ts +32 -0
- package/SearchBar/index.js +246 -0
- package/Select/index.d.ts +34 -0
- package/Select/index.js +331 -0
- package/ShowMoreLess/index.css +23 -0
- package/ShowMoreLess/index.d.ts +30 -0
- package/ShowMoreLess/index.js +202 -0
- package/Switch/index.d.ts +29 -0
- package/Switch/index.js +211 -0
- package/Table/index.css +533 -0
- package/Table/index.d.ts +25 -0
- package/Table/index.js +2113 -0
- package/Tabs/index.d.ts +3 -0
- package/Tabs/index.js +323 -0
- package/TagInput/index.css +90 -0
- package/TagInput/index.d.ts +28 -0
- package/TagInput/index.js +370 -0
- package/Textarea/index.d.ts +30 -0
- package/Textarea/index.js +242 -0
- package/Toast/index.css +95 -0
- package/Toast/index.d.ts +35 -0
- package/Toast/index.js +340 -0
- package/Tooltip/index.css +240 -0
- package/Tooltip/index.d.ts +19 -0
- package/Tooltip/index.js +200 -0
- package/Tree/index.css +225 -0
- package/Tree/index.d.ts +37 -0
- package/Tree/index.js +1406 -0
- package/all.d.ts +33 -0
- package/all.js +35 -0
- package/lib/cjs/BackToTop/index.d.ts +11 -0
- package/lib/cjs/BackToTop/index.js +458 -0
- package/lib/cjs/CascadingSelect/index.d.ts +56 -0
- package/lib/cjs/CascadingSelect/index.js +958 -0
- package/lib/cjs/CascadingSelectE2E/index.d.ts +60 -0
- package/lib/cjs/CascadingSelectE2E/index.js +1126 -0
- package/lib/cjs/Checkbox/index.d.ts +30 -0
- package/lib/cjs/Checkbox/index.js +226 -0
- package/lib/cjs/ColorPicker/index.d.ts +27 -0
- package/lib/cjs/ColorPicker/index.js +246 -0
- package/lib/cjs/DigitalClock/index.d.ts +7 -0
- package/lib/cjs/DigitalClock/index.js +208 -0
- package/lib/cjs/DropdownMenu/index.d.ts +37 -0
- package/lib/cjs/DropdownMenu/index.js +237 -0
- package/lib/cjs/DynamicFields/index.d.ts +26 -0
- package/lib/cjs/DynamicFields/index.js +412 -0
- package/lib/cjs/File/index.d.ts +36 -0
- package/lib/cjs/File/index.js +473 -0
- package/lib/cjs/Input/index.d.ts +42 -0
- package/lib/cjs/Input/index.js +286 -0
- package/lib/cjs/LiveSearch/index.d.ts +37 -0
- package/lib/cjs/LiveSearch/index.js +1195 -0
- package/lib/cjs/ModalDialog/index.d.ts +60 -0
- package/lib/cjs/ModalDialog/index.js +725 -0
- package/lib/cjs/ModeSwitch/index.d.ts +17 -0
- package/lib/cjs/ModeSwitch/index.js +202 -0
- package/lib/cjs/MultiFuncSelect/index.d.ts +67 -0
- package/lib/cjs/MultiFuncSelect/index.js +1826 -0
- package/lib/cjs/MultilevelDropdownMenu/index.d.ts +25 -0
- package/lib/cjs/MultilevelDropdownMenu/index.js +464 -0
- package/lib/cjs/Pagination/index.d.ts +49 -0
- package/lib/cjs/Pagination/index.js +341 -0
- package/lib/cjs/Radio/index.d.ts +31 -0
- package/lib/cjs/Radio/index.js +246 -0
- package/lib/cjs/RangeSlider/index.d.ts +21 -0
- package/lib/cjs/RangeSlider/index.js +730 -0
- package/lib/cjs/ScrollReveal/index.d.ts +21 -0
- package/lib/cjs/ScrollReveal/index.js +216 -0
- package/lib/cjs/Scrollbar/index.d.ts +15 -0
- package/lib/cjs/Scrollbar/index.js +605 -0
- package/lib/cjs/SearchBar/index.d.ts +32 -0
- package/lib/cjs/SearchBar/index.js +246 -0
- package/lib/cjs/Select/index.d.ts +34 -0
- package/lib/cjs/Select/index.js +331 -0
- package/lib/cjs/ShowMoreLess/index.d.ts +30 -0
- package/lib/cjs/ShowMoreLess/index.js +202 -0
- package/lib/cjs/Switch/index.d.ts +29 -0
- package/lib/cjs/Switch/index.js +211 -0
- package/lib/cjs/Table/index.d.ts +25 -0
- package/lib/cjs/Table/index.js +2113 -0
- package/lib/cjs/Tabs/index.d.ts +3 -0
- package/lib/cjs/Tabs/index.js +323 -0
- package/lib/cjs/TagInput/index.d.ts +28 -0
- package/lib/cjs/TagInput/index.js +370 -0
- package/lib/cjs/Textarea/index.d.ts +30 -0
- package/lib/cjs/Textarea/index.js +242 -0
- package/lib/cjs/Toast/index.d.ts +35 -0
- package/lib/cjs/Toast/index.js +340 -0
- package/lib/cjs/Tooltip/index.d.ts +19 -0
- package/lib/cjs/Tooltip/index.js +200 -0
- package/lib/cjs/Tree/index.d.ts +37 -0
- package/lib/cjs/Tree/index.js +1406 -0
- package/lib/cjs/index.d.ts +33 -0
- package/lib/cjs/index.js +35 -0
- package/lib/css/BackToTop/index.css +34 -0
- package/lib/css/CascadingSelect/index.css +159 -0
- package/lib/css/CascadingSelectE2E/index.css +159 -0
- package/lib/css/ColorPicker/index.css +38 -0
- package/lib/css/DropdownMenu/index.css +127 -0
- package/lib/css/MultiFuncSelect/index.css +178 -0
- package/lib/css/MultilevelDropdownMenu/index.css +35 -0
- package/lib/css/RangeSlider/index.css +149 -0
- package/lib/css/ScrollReveal/index.css +23 -0
- package/lib/css/Scrollbar/index.css +168 -0
- package/lib/css/ShowMoreLess/index.css +23 -0
- package/lib/css/Table/index.css +533 -0
- package/lib/css/TagInput/index.css +90 -0
- package/lib/css/Toast/index.css +95 -0
- package/lib/css/Tooltip/index.css +240 -0
- package/lib/css/Tree/index.css +225 -0
- package/lib/esm/BackToTop/index.scss +47 -0
- package/lib/esm/BackToTop/index.tsx +182 -0
- package/lib/esm/BackToTop/utils/easing.js +200 -0
- package/lib/esm/BackToTop/utils/performance.js +52 -0
- package/lib/esm/CascadingSelect/Group.tsx +39 -0
- package/lib/esm/CascadingSelect/index.scss +214 -0
- package/lib/esm/CascadingSelect/index.tsx +922 -0
- package/lib/esm/CascadingSelect/utils/performance.js +52 -0
- package/lib/esm/CascadingSelectE2E/Group.tsx +39 -0
- package/lib/esm/CascadingSelectE2E/index.scss +214 -0
- package/lib/esm/CascadingSelectE2E/index.tsx +1091 -0
- package/lib/esm/CascadingSelectE2E/utils/performance.js +52 -0
- package/lib/esm/Checkbox/index.tsx +160 -0
- package/lib/esm/ColorPicker/index.scss +48 -0
- package/lib/esm/ColorPicker/index.tsx +187 -0
- package/lib/esm/DigitalClock/index.tsx +72 -0
- package/lib/esm/DigitalClock/utils/useInterval.js +43 -0
- package/lib/esm/DropdownMenu/Option.tsx +27 -0
- package/lib/esm/DropdownMenu/index.scss +180 -0
- package/lib/esm/DropdownMenu/index.tsx +148 -0
- package/lib/esm/DynamicFields/index.tsx +386 -0
- package/lib/esm/File/index.tsx +302 -0
- package/lib/esm/Input/index.tsx +233 -0
- package/lib/esm/LiveSearch/index.tsx +582 -0
- package/lib/esm/LiveSearch/utils/performance.js +52 -0
- package/lib/esm/LiveSearch/utils/useThrottle.js +36 -0
- package/lib/esm/ModalDialog/index.tsx +479 -0
- package/lib/esm/ModalDialog/plugins/BSL/bodyScrollLock.es6.js +262 -0
- package/lib/esm/ModalDialog/plugins/BSL/index.ts +2 -0
- package/lib/esm/ModeSwitch/index.tsx +82 -0
- package/lib/esm/MultiFuncSelect/index.scss +269 -0
- package/lib/esm/MultiFuncSelect/index.tsx +1597 -0
- package/lib/esm/MultiFuncSelect/utils/performance.js +52 -0
- package/lib/esm/MultiFuncSelect/utils/tree.js +103 -0
- package/lib/esm/MultiFuncSelect/utils/useThrottle.js +36 -0
- package/lib/esm/MultilevelDropdownMenu/MenuList.tsx +230 -0
- package/lib/esm/MultilevelDropdownMenu/index.scss +75 -0
- package/lib/esm/MultilevelDropdownMenu/index.tsx +71 -0
- package/lib/esm/MultilevelDropdownMenu/utils/dom.js +81 -0
- package/lib/esm/Pagination/index.tsx +230 -0
- package/lib/esm/Pagination/pagination-navigators.tsx +60 -0
- package/lib/esm/Radio/index.tsx +201 -0
- package/lib/esm/RangeSlider/index.scss +184 -0
- package/lib/esm/RangeSlider/index.tsx +223 -0
- package/lib/esm/ScrollReveal/index.scss +27 -0
- package/lib/esm/ScrollReveal/index.tsx +146 -0
- package/lib/esm/Scrollbar/index.scss +217 -0
- package/lib/esm/Scrollbar/index.tsx +497 -0
- package/lib/esm/Scrollbar/utils/performance.js +52 -0
- package/lib/esm/SearchBar/index.tsx +181 -0
- package/lib/esm/Select/index.tsx +276 -0
- package/lib/esm/ShowMoreLess/index.scss +27 -0
- package/lib/esm/ShowMoreLess/index.tsx +144 -0
- package/lib/esm/Switch/index.tsx +143 -0
- package/lib/esm/Table/TableColgroup.tsx +29 -0
- package/lib/esm/Table/TableField.tsx +40 -0
- package/lib/esm/Table/TableFieldRow.tsx +212 -0
- package/lib/esm/Table/TableHeaders.tsx +146 -0
- package/lib/esm/Table/TableRow.tsx +127 -0
- package/lib/esm/Table/TableSummaries.tsx +36 -0
- package/lib/esm/Table/index.scss +364 -0
- package/lib/esm/Table/index.tsx +576 -0
- package/lib/esm/Table/table-utils.ts +65 -0
- package/lib/esm/Table/utils/dom.js +81 -0
- package/lib/esm/Table/utils/performance.js +52 -0
- package/lib/esm/Tabs/TabList.tsx +42 -0
- package/lib/esm/Tabs/TabPanel.tsx +34 -0
- package/lib/esm/Tabs/Tabs.tsx +232 -0
- package/lib/esm/Tabs/index.tsx +3 -0
- package/lib/esm/TagInput/index.scss +125 -0
- package/lib/esm/TagInput/index.tsx +314 -0
- package/lib/esm/Textarea/index.tsx +178 -0
- package/lib/esm/Toast/Item.tsx +75 -0
- package/lib/esm/Toast/index.scss +120 -0
- package/lib/esm/Toast/index.tsx +249 -0
- package/lib/esm/Tooltip/index.scss +327 -0
- package/lib/esm/Tooltip/index.tsx +142 -0
- package/lib/esm/Tree/TreeList.tsx +503 -0
- package/lib/esm/Tree/index.scss +375 -0
- package/lib/esm/Tree/index.tsx +301 -0
- package/lib/esm/Tree/init-height.tsx +27 -0
- package/lib/esm/Tree/utils/convert-tree.js +29 -0
- package/lib/esm/Tree/utils/dom.js +81 -0
- package/lib/esm/index.js +31 -0
- package/package.json +40 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory(require("react"));
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define(["react"], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["RPB"] = factory(require("react"));
|
|
8
|
+
else
|
|
9
|
+
root["RPB"] = factory(root["React"]);
|
|
10
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ 787:
|
|
16
|
+
/***/ ((module) => {
|
|
17
|
+
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
19
|
+
|
|
20
|
+
/***/ })
|
|
21
|
+
|
|
22
|
+
/******/ });
|
|
23
|
+
/************************************************************************/
|
|
24
|
+
/******/ // The module cache
|
|
25
|
+
/******/ var __webpack_module_cache__ = {};
|
|
26
|
+
/******/
|
|
27
|
+
/******/ // The require function
|
|
28
|
+
/******/ function __webpack_require__(moduleId) {
|
|
29
|
+
/******/ // Check if module is in cache
|
|
30
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
31
|
+
/******/ if (cachedModule !== undefined) {
|
|
32
|
+
/******/ return cachedModule.exports;
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ // Create a new module (and put it into the cache)
|
|
35
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
36
|
+
/******/ // no module.id needed
|
|
37
|
+
/******/ // no module.loaded needed
|
|
38
|
+
/******/ exports: {}
|
|
39
|
+
/******/ };
|
|
40
|
+
/******/
|
|
41
|
+
/******/ // Execute the module function
|
|
42
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // Return the exports of the module
|
|
45
|
+
/******/ return module.exports;
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/
|
|
48
|
+
/************************************************************************/
|
|
49
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
50
|
+
/******/ (() => {
|
|
51
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
52
|
+
/******/ __webpack_require__.n = (module) => {
|
|
53
|
+
/******/ var getter = module && module.__esModule ?
|
|
54
|
+
/******/ () => (module['default']) :
|
|
55
|
+
/******/ () => (module);
|
|
56
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
57
|
+
/******/ return getter;
|
|
58
|
+
/******/ };
|
|
59
|
+
/******/ })();
|
|
60
|
+
/******/
|
|
61
|
+
/******/ /* webpack/runtime/define property getters */
|
|
62
|
+
/******/ (() => {
|
|
63
|
+
/******/ // define getter functions for harmony exports
|
|
64
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
65
|
+
/******/ for(var key in definition) {
|
|
66
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
67
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
68
|
+
/******/ }
|
|
69
|
+
/******/ }
|
|
70
|
+
/******/ };
|
|
71
|
+
/******/ })();
|
|
72
|
+
/******/
|
|
73
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
74
|
+
/******/ (() => {
|
|
75
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
76
|
+
/******/ })();
|
|
77
|
+
/******/
|
|
78
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
79
|
+
/******/ (() => {
|
|
80
|
+
/******/ // define __esModule on exports
|
|
81
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
82
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
83
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
84
|
+
/******/ }
|
|
85
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
86
|
+
/******/ };
|
|
87
|
+
/******/ })();
|
|
88
|
+
/******/
|
|
89
|
+
/************************************************************************/
|
|
90
|
+
var __webpack_exports__ = {};
|
|
91
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
92
|
+
(() => {
|
|
93
|
+
// ESM COMPAT FLAG
|
|
94
|
+
__webpack_require__.r(__webpack_exports__);
|
|
95
|
+
|
|
96
|
+
// EXPORTS
|
|
97
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
98
|
+
"default": () => (/* binding */ src)
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
102
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
|
|
103
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
104
|
+
;// CONCATENATED MODULE: ./src/pagination-navigators.tsx
|
|
105
|
+
/*
|
|
106
|
+
* Generate page navigators
|
|
107
|
+
*
|
|
108
|
+
* @param {Number} visibleNavigators - The range of pages displayed.
|
|
109
|
+
* @param {Number} totalPages - The total number of pages.
|
|
110
|
+
* @param {Number} activePage - The currently selected page number.
|
|
111
|
+
* @param {Boolean} adjustmentEnabled - Whether to complete the page number range.
|
|
112
|
+
* @param {Boolean} symmetry - The activation button is symmetrical on the left and right sides.
|
|
113
|
+
* @return {Array} - Return an array.
|
|
114
|
+
*/
|
|
115
|
+
function paginationNavigators(visibleNavigators, totalPages, activePage) {
|
|
116
|
+
var adjustmentEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
117
|
+
var symmetry = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
118
|
+
// Generate a sequence of numbers
|
|
119
|
+
// Since the array is initialized with `undefined` on each position,
|
|
120
|
+
// the value of `v` below will be `undefined`
|
|
121
|
+
|
|
122
|
+
var result = [];
|
|
123
|
+
if (activePage + visibleNavigators - 1 < totalPages) {
|
|
124
|
+
result = Array.from({
|
|
125
|
+
length: visibleNavigators
|
|
126
|
+
}, function (v, k) {
|
|
127
|
+
return k + activePage;
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
var diff = totalPages - activePage;
|
|
131
|
+
if (diff >= 0) {
|
|
132
|
+
result = Array.from({
|
|
133
|
+
length: diff + 1
|
|
134
|
+
}, function (v, k) {
|
|
135
|
+
return k + activePage;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//Shift the elements forward to complete the display range
|
|
141
|
+
var adjustmentResult = function adjustmentResult(arr) {
|
|
142
|
+
if (arr.length < totalPages) {
|
|
143
|
+
var adjustment = visibleNavigators - arr.length;
|
|
144
|
+
for (var i = 1; i <= adjustment; i++) {
|
|
145
|
+
arr.unshift(activePage - i);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return arr;
|
|
149
|
+
};
|
|
150
|
+
if (adjustmentEnabled) result = adjustmentResult(result);
|
|
151
|
+
|
|
152
|
+
// symmetrical on the left and right sides
|
|
153
|
+
if (symmetry) {
|
|
154
|
+
if (totalPages > activePage) {
|
|
155
|
+
var totalDisplayedPages = visibleNavigators + (visibleNavigators - 1);
|
|
156
|
+
var activedPageIndex = result.indexOf(activePage);
|
|
157
|
+
var leftSideTotal = visibleNavigators - 1 - activedPageIndex;
|
|
158
|
+
for (var i = 1; i <= leftSideTotal; i++) {
|
|
159
|
+
result.unshift(activePage - i - activedPageIndex);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
/* harmony default export */ const pagination_navigators = ((/* unused pure expression or super */ null && (paginationNavigators)));
|
|
166
|
+
;// CONCATENATED MODULE: ./src/index.tsx
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
var Pagination = function Pagination(props) {
|
|
170
|
+
var wrapperClassName = props.wrapperClassName,
|
|
171
|
+
navClassName = props.navClassName,
|
|
172
|
+
apiUrl = props.apiUrl,
|
|
173
|
+
pageRangeDisplayed = props.pageRangeDisplayed,
|
|
174
|
+
activePage = props.activePage,
|
|
175
|
+
totalPages = props.totalPages,
|
|
176
|
+
previousLabel = props.previousLabel,
|
|
177
|
+
nextLabel = props.nextLabel,
|
|
178
|
+
firstLabel = props.firstLabel,
|
|
179
|
+
lastLabel = props.lastLabel,
|
|
180
|
+
breakLabel = props.breakLabel,
|
|
181
|
+
align = props.align,
|
|
182
|
+
onlyPrevNext = props.onlyPrevNext,
|
|
183
|
+
activeClass = props.activeClass,
|
|
184
|
+
previousClass = props.previousClass,
|
|
185
|
+
nextClass = props.nextClass,
|
|
186
|
+
firstClass = props.firstClass,
|
|
187
|
+
lastClass = props.lastClass,
|
|
188
|
+
disabledClass = props.disabledClass,
|
|
189
|
+
symmetry = props.symmetry,
|
|
190
|
+
style = props.style,
|
|
191
|
+
onChange = props.onChange;
|
|
192
|
+
function handleClick(parameter) {
|
|
193
|
+
switch (parameter) {
|
|
194
|
+
case "prev":
|
|
195
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(activePage - 1);
|
|
196
|
+
break;
|
|
197
|
+
case "next":
|
|
198
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(activePage + 1);
|
|
199
|
+
break;
|
|
200
|
+
case "first":
|
|
201
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(1);
|
|
202
|
+
break;
|
|
203
|
+
case "last":
|
|
204
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(totalPages);
|
|
205
|
+
break;
|
|
206
|
+
default:
|
|
207
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(1);
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
var visibleNavigators = pageRangeDisplayed ? pageRangeDisplayed : 3;
|
|
212
|
+
var alignClassName = '';
|
|
213
|
+
switch (align) {
|
|
214
|
+
case 'left':
|
|
215
|
+
alignClassName = ' justify-content-start';
|
|
216
|
+
break;
|
|
217
|
+
case 'right':
|
|
218
|
+
alignClassName = ' justify-content-end';
|
|
219
|
+
break;
|
|
220
|
+
case 'center':
|
|
221
|
+
alignClassName = ' justify-content-center';
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
var _activeClassName = activeClass ? activeClass : 'active',
|
|
225
|
+
_previousClassName = previousClass ? previousClass : 'prev',
|
|
226
|
+
_nextClassName = nextClass ? nextClass : 'next',
|
|
227
|
+
_firstClassName = firstClass ? firstClass : 'first',
|
|
228
|
+
_lastClassName = lastClass ? lastClass : 'last',
|
|
229
|
+
_disabledClassName = disabledClass ? disabledClass : 'disabled',
|
|
230
|
+
_onlyPrevNextButtons = typeof onlyPrevNext === 'undefined' ? false : onlyPrevNext,
|
|
231
|
+
_symmetry = typeof symmetry === 'undefined' ? false : symmetry;
|
|
232
|
+
|
|
233
|
+
//get navigation array
|
|
234
|
+
//------------------------------------------
|
|
235
|
+
var navArr = paginationNavigators(visibleNavigators, totalPages, activePage, true, _symmetry);
|
|
236
|
+
|
|
237
|
+
// Use ellipsis to extend page numbers
|
|
238
|
+
//------------------------------------------
|
|
239
|
+
var _ellipsis = breakLabel ? breakLabel : '';
|
|
240
|
+
var _ellipsisArr = [];
|
|
241
|
+
var _ellipsisEnabled = false;
|
|
242
|
+
if (_ellipsis !== '') _ellipsisArr = [totalPages - 1, totalPages];
|
|
243
|
+
if (activePage + 2 >= totalPages) {
|
|
244
|
+
_ellipsisArr = [];
|
|
245
|
+
_ellipsis = '';
|
|
246
|
+
}
|
|
247
|
+
var _ellipsisElements = _ellipsisArr.map(function (item, i) {
|
|
248
|
+
if (item > 0 && item <= totalPages && !_onlyPrevNextButtons) {
|
|
249
|
+
//Delete values whose display range is more than the total
|
|
250
|
+
if (navArr.indexOf(item) === -1) {
|
|
251
|
+
_ellipsisEnabled = true;
|
|
252
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
253
|
+
key: i,
|
|
254
|
+
className: activePage === item ? "page-item ".concat(_activeClassName) : "page-item"
|
|
255
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
256
|
+
className: "page-link",
|
|
257
|
+
href: apiUrl.replace('{page}', item),
|
|
258
|
+
onClick: function onClick(e) {
|
|
259
|
+
e.preventDefault();
|
|
260
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(item);
|
|
261
|
+
}
|
|
262
|
+
}, item));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("nav", {
|
|
267
|
+
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
|
268
|
+
style: style
|
|
269
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
|
|
270
|
+
className: navClassName ? "".concat(navClassName, " ").concat(alignClassName) : "pagination ".concat(alignClassName)
|
|
271
|
+
}, firstLabel ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
272
|
+
className: activePage > 1 ? "page-item ".concat(_firstClassName) : "page-item ".concat(_firstClassName, " ").concat(_disabledClassName)
|
|
273
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
274
|
+
tabIndex: activePage > 1 ? 0 : -1,
|
|
275
|
+
"aria-disabled": activePage > 1 ? 'false' : 'true',
|
|
276
|
+
className: "page-link",
|
|
277
|
+
href: apiUrl.replace('{page}', '1'),
|
|
278
|
+
onClick: function onClick(e) {
|
|
279
|
+
e.preventDefault();
|
|
280
|
+
handleClick('first');
|
|
281
|
+
}
|
|
282
|
+
}, firstLabel || null)) : '', previousLabel ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
283
|
+
className: activePage > 1 ? "page-item ".concat(_previousClassName) : "page-item ".concat(_previousClassName, " ").concat(_disabledClassName)
|
|
284
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
285
|
+
tabIndex: activePage > 1 ? 0 : -1,
|
|
286
|
+
"aria-disabled": activePage > 1 ? 'false' : 'true',
|
|
287
|
+
className: "page-link",
|
|
288
|
+
href: apiUrl.replace('{page}', activePage - 1),
|
|
289
|
+
onClick: function onClick(e) {
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
handleClick('prev');
|
|
292
|
+
}
|
|
293
|
+
}, previousLabel || null)) : '', navArr.map(function (item, i) {
|
|
294
|
+
if (item > 0 && item <= totalPages && !_onlyPrevNextButtons) {
|
|
295
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
296
|
+
key: i,
|
|
297
|
+
className: activePage === item ? "page-item ".concat(_activeClassName) : "page-item"
|
|
298
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
299
|
+
className: "page-link",
|
|
300
|
+
href: apiUrl.replace('{page}', item),
|
|
301
|
+
onClick: function onClick(e) {
|
|
302
|
+
e.preventDefault();
|
|
303
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(item);
|
|
304
|
+
}
|
|
305
|
+
}, item));
|
|
306
|
+
}
|
|
307
|
+
}), _ellipsis !== '' && _ellipsisEnabled ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
308
|
+
className: "page-item"
|
|
309
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
310
|
+
className: "page-link"
|
|
311
|
+
}, _ellipsis))) : '', _ellipsisElements, nextLabel ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
312
|
+
className: activePage < totalPages ? "page-item ".concat(_nextClassName) : "page-item ".concat(_nextClassName, " ").concat(_disabledClassName)
|
|
313
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
314
|
+
tabIndex: activePage < totalPages ? 0 : -1,
|
|
315
|
+
"aria-disabled": activePage < totalPages ? 'false' : 'true',
|
|
316
|
+
className: "page-link",
|
|
317
|
+
href: apiUrl.replace('{page}', activePage + 1),
|
|
318
|
+
onClick: function onClick(e) {
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
handleClick('next');
|
|
321
|
+
}
|
|
322
|
+
}, nextLabel || null)) : '', lastLabel ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
323
|
+
className: activePage < totalPages ? "page-item ".concat(_lastClassName) : "page-item ".concat(_lastClassName, " ").concat(_disabledClassName)
|
|
324
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
325
|
+
tabIndex: activePage < totalPages ? 0 : -1,
|
|
326
|
+
"aria-disabled": activePage < totalPages ? 'false' : 'true',
|
|
327
|
+
className: "page-link",
|
|
328
|
+
href: apiUrl.replace('{page}', totalPages),
|
|
329
|
+
onClick: function onClick(e) {
|
|
330
|
+
e.preventDefault();
|
|
331
|
+
handleClick('last');
|
|
332
|
+
}
|
|
333
|
+
}, lastLabel || null)) : '')));
|
|
334
|
+
};
|
|
335
|
+
/* harmony default export */ const src = (Pagination);
|
|
336
|
+
})();
|
|
337
|
+
|
|
338
|
+
/******/ return __webpack_exports__;
|
|
339
|
+
/******/ })()
|
|
340
|
+
;
|
|
341
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare module 'react' {
|
|
3
|
+
interface ReactI18NextChildren<T> {
|
|
4
|
+
children?: any;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare type RadioOptionChangeFnType = (arg1: any, arg2: any) => void;
|
|
8
|
+
declare type RadioProps = {
|
|
9
|
+
wrapperClassName?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
label?: React.ReactNode | string;
|
|
12
|
+
name?: string;
|
|
13
|
+
disabled?: any;
|
|
14
|
+
required?: any;
|
|
15
|
+
options: string;
|
|
16
|
+
inline?: boolean;
|
|
17
|
+
/** -- */
|
|
18
|
+
id?: string;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
tabIndex?: number;
|
|
21
|
+
[key: `data-${string}`]: string | undefined;
|
|
22
|
+
/** This function is called whenever the data is updated.
|
|
23
|
+
* Exposes the JSON format data about the option as an argument.
|
|
24
|
+
*/
|
|
25
|
+
onClick?: RadioOptionChangeFnType | null;
|
|
26
|
+
onChange?: RadioOptionChangeFnType | null;
|
|
27
|
+
onBlur?: (e: any) => void;
|
|
28
|
+
onFocus?: (e: any) => void;
|
|
29
|
+
};
|
|
30
|
+
declare const Radio: (props: RadioProps) => JSX.Element;
|
|
31
|
+
export default Radio;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory(require("react"));
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define(["react"], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["RPB"] = factory(require("react"));
|
|
8
|
+
else
|
|
9
|
+
root["RPB"] = factory(root["React"]);
|
|
10
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ 787:
|
|
16
|
+
/***/ ((module) => {
|
|
17
|
+
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
19
|
+
|
|
20
|
+
/***/ })
|
|
21
|
+
|
|
22
|
+
/******/ });
|
|
23
|
+
/************************************************************************/
|
|
24
|
+
/******/ // The module cache
|
|
25
|
+
/******/ var __webpack_module_cache__ = {};
|
|
26
|
+
/******/
|
|
27
|
+
/******/ // The require function
|
|
28
|
+
/******/ function __webpack_require__(moduleId) {
|
|
29
|
+
/******/ // Check if module is in cache
|
|
30
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
31
|
+
/******/ if (cachedModule !== undefined) {
|
|
32
|
+
/******/ return cachedModule.exports;
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ // Create a new module (and put it into the cache)
|
|
35
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
36
|
+
/******/ // no module.id needed
|
|
37
|
+
/******/ // no module.loaded needed
|
|
38
|
+
/******/ exports: {}
|
|
39
|
+
/******/ };
|
|
40
|
+
/******/
|
|
41
|
+
/******/ // Execute the module function
|
|
42
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // Return the exports of the module
|
|
45
|
+
/******/ return module.exports;
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/
|
|
48
|
+
/************************************************************************/
|
|
49
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
50
|
+
/******/ (() => {
|
|
51
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
52
|
+
/******/ __webpack_require__.n = (module) => {
|
|
53
|
+
/******/ var getter = module && module.__esModule ?
|
|
54
|
+
/******/ () => (module['default']) :
|
|
55
|
+
/******/ () => (module);
|
|
56
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
57
|
+
/******/ return getter;
|
|
58
|
+
/******/ };
|
|
59
|
+
/******/ })();
|
|
60
|
+
/******/
|
|
61
|
+
/******/ /* webpack/runtime/define property getters */
|
|
62
|
+
/******/ (() => {
|
|
63
|
+
/******/ // define getter functions for harmony exports
|
|
64
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
65
|
+
/******/ for(var key in definition) {
|
|
66
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
67
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
68
|
+
/******/ }
|
|
69
|
+
/******/ }
|
|
70
|
+
/******/ };
|
|
71
|
+
/******/ })();
|
|
72
|
+
/******/
|
|
73
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
74
|
+
/******/ (() => {
|
|
75
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
76
|
+
/******/ })();
|
|
77
|
+
/******/
|
|
78
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
79
|
+
/******/ (() => {
|
|
80
|
+
/******/ // define __esModule on exports
|
|
81
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
82
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
83
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
84
|
+
/******/ }
|
|
85
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
86
|
+
/******/ };
|
|
87
|
+
/******/ })();
|
|
88
|
+
/******/
|
|
89
|
+
/************************************************************************/
|
|
90
|
+
var __webpack_exports__ = {};
|
|
91
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
92
|
+
(() => {
|
|
93
|
+
__webpack_require__.r(__webpack_exports__);
|
|
94
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
95
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
96
|
+
/* harmony export */ });
|
|
97
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
|
|
98
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
99
|
+
var _excluded = ["wrapperClassName", "disabled", "required", "value", "label", "name", "id", "options", "inline", "style", "tabIndex", "onClick", "onChange", "onBlur", "onFocus"];
|
|
100
|
+
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); }
|
|
101
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
102
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
103
|
+
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."); }
|
|
104
|
+
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); }
|
|
105
|
+
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; }
|
|
106
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
107
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
108
|
+
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; }
|
|
109
|
+
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; }
|
|
110
|
+
|
|
111
|
+
var Radio = function Radio(props) {
|
|
112
|
+
var wrapperClassName = props.wrapperClassName,
|
|
113
|
+
disabled = props.disabled,
|
|
114
|
+
required = props.required,
|
|
115
|
+
value = props.value,
|
|
116
|
+
label = props.label,
|
|
117
|
+
name = props.name,
|
|
118
|
+
id = props.id,
|
|
119
|
+
options = props.options,
|
|
120
|
+
inline = props.inline,
|
|
121
|
+
style = props.style,
|
|
122
|
+
tabIndex = props.tabIndex,
|
|
123
|
+
onClick = props.onClick,
|
|
124
|
+
onChange = props.onChange,
|
|
125
|
+
onBlur = props.onBlur,
|
|
126
|
+
onFocus = props.onFocus,
|
|
127
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
128
|
+
var uniqueID = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)();
|
|
129
|
+
var idRes = id || uniqueID;
|
|
130
|
+
var rootRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
131
|
+
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
|
|
132
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
133
|
+
val = _useState2[0],
|
|
134
|
+
setVal = _useState2[1];
|
|
135
|
+
|
|
136
|
+
// Determine whether it is in JSON format
|
|
137
|
+
function isJSON(str) {
|
|
138
|
+
if (typeof str === 'string' && str.length > 0) {
|
|
139
|
+
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
140
|
+
return false;
|
|
141
|
+
} else {
|
|
142
|
+
if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
143
|
+
return true;
|
|
144
|
+
} else {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
|
|
150
|
+
return true;
|
|
151
|
+
} else {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function handleFocus(event) {
|
|
157
|
+
event.target.parentElement.classList.add('focus');
|
|
158
|
+
|
|
159
|
+
//
|
|
160
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
161
|
+
}
|
|
162
|
+
function handleChange(event) {
|
|
163
|
+
var _val = event.target.value;
|
|
164
|
+
setVal(_val);
|
|
165
|
+
|
|
166
|
+
//----
|
|
167
|
+
//remove focus style
|
|
168
|
+
[].slice.call(rootRef.current.querySelectorAll('.form-check-input')).forEach(function (el) {
|
|
169
|
+
var _el$parentElement;
|
|
170
|
+
(_el$parentElement = el.parentElement) === null || _el$parentElement === void 0 ? void 0 : _el$parentElement.classList.remove('focus');
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
//
|
|
174
|
+
if (typeof onChange === 'function') {
|
|
175
|
+
onChange(event, _val);
|
|
176
|
+
}
|
|
177
|
+
if (typeof onClick === 'function') {
|
|
178
|
+
onClick(event, _val);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function handleBlur(event) {
|
|
182
|
+
//----
|
|
183
|
+
//remove focus style
|
|
184
|
+
event.target.parentElement.classList.remove('focus');
|
|
185
|
+
|
|
186
|
+
//
|
|
187
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Get all options from option prop
|
|
191
|
+
var selectOptions = isJSON(options) ? JSON.parse(options) : null;
|
|
192
|
+
var optionKeys = selectOptions === null ? [] : Object.keys(selectOptions);
|
|
193
|
+
var optionValues = selectOptions === null ? [] : Object.values(selectOptions).map(function (item) {
|
|
194
|
+
return item.toString();
|
|
195
|
+
});
|
|
196
|
+
var radioOptionsList = optionKeys.map(function (radioOption, index) {
|
|
197
|
+
var requiredVal = index === 0 ? required || null : null;
|
|
198
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
199
|
+
key: index,
|
|
200
|
+
className: inline ? "form-check form-check-inline" : "form-check"
|
|
201
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
202
|
+
tabIndex: tabIndex || 0,
|
|
203
|
+
type: "radio",
|
|
204
|
+
className: "form-check-input",
|
|
205
|
+
id: "field-".concat(uniqueID, "-").concat(index),
|
|
206
|
+
name: name,
|
|
207
|
+
value: optionValues[index],
|
|
208
|
+
required: requiredVal,
|
|
209
|
+
disabled: disabled || null,
|
|
210
|
+
onChange: handleChange,
|
|
211
|
+
onClick: typeof onClick === 'function' ? handleChange : function () {
|
|
212
|
+
return void 0;
|
|
213
|
+
},
|
|
214
|
+
onFocus: handleFocus,
|
|
215
|
+
onBlur: handleBlur,
|
|
216
|
+
checked: val == optionValues[index] // component status will not change if defaultChecked is used
|
|
217
|
+
,
|
|
218
|
+
style: style
|
|
219
|
+
}, attributes)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
|
|
220
|
+
className: "form-check-label",
|
|
221
|
+
htmlFor: "field-".concat(uniqueID, "-").concat(index),
|
|
222
|
+
dangerouslySetInnerHTML: {
|
|
223
|
+
__html: radioOption
|
|
224
|
+
}
|
|
225
|
+
}));
|
|
226
|
+
});
|
|
227
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
228
|
+
setVal(value);
|
|
229
|
+
}, [value, options]);
|
|
230
|
+
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", {
|
|
231
|
+
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
|
232
|
+
ref: rootRef
|
|
233
|
+
}, label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
|
|
234
|
+
htmlFor: idRes,
|
|
235
|
+
className: "form-label"
|
|
236
|
+
}, label)) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
237
|
+
id: idRes
|
|
238
|
+
}, radioOptionsList)));
|
|
239
|
+
};
|
|
240
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Radio);
|
|
241
|
+
})();
|
|
242
|
+
|
|
243
|
+
/******/ return __webpack_exports__;
|
|
244
|
+
/******/ })()
|
|
245
|
+
;
|
|
246
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type RangeSliderProps = {
|
|
3
|
+
wrapperClassName?: string;
|
|
4
|
+
controlClassName?: string;
|
|
5
|
+
value?: any;
|
|
6
|
+
label?: React.ReactNode | string;
|
|
7
|
+
minName?: string;
|
|
8
|
+
maxName?: string;
|
|
9
|
+
onlyOne?: boolean;
|
|
10
|
+
step: number;
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
disabled?: any;
|
|
14
|
+
required?: any;
|
|
15
|
+
/** -- */
|
|
16
|
+
id?: string;
|
|
17
|
+
tabIndex?: number;
|
|
18
|
+
onChange?: (e: any, param: any) => void;
|
|
19
|
+
};
|
|
20
|
+
declare const RangeSlider: (props: RangeSliderProps) => JSX.Element;
|
|
21
|
+
export default RangeSlider;
|