@cashub/ui 0.5.0 → 0.6.1
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/Tab/TabList.js +1 -1
- package/Tab/TabPanel.js +3 -3
- package/animate/Collapse.js +1 -1
- package/animate/NumberCounter.js +1 -1
- package/backdrop/index.js +31 -0
- package/badge/BadgeFill.js +3 -3
- package/billing/BarChart.js +3 -3
- package/billing/Grid.js +10 -10
- package/breadcrumb/Breadcrumb.js +11 -6
- package/button/IconButton.js +1 -1
- package/chart/BarChart.js +4 -4
- package/chart/DoughnutChart.js +1 -1
- package/chart/LineChart.js +6 -6
- package/chart/SingleBarChart.js +2 -2
- package/cropper/Cropper.js +1 -1
- package/datetimePicker/Accordion.js +13 -13
- package/datetimePicker/CustomTimeInput.js +9 -9
- package/datetimePicker/DatePicker.js +24 -12
- package/datetimePicker/DatePickerV2.js +95 -71
- package/datetimePicker/DatetimePicker.js +6 -6
- package/datetimePicker/DatetimePickerV2.js +94 -54
- package/datetimePicker/TimePicker.js +15 -15
- package/datetimePicker/accordion/Month.js +20 -18
- package/datetimePicker/accordion/Year.js +7 -7
- package/datetimePicker/hooks/useChangeNumber.js +1 -1
- package/datetimePicker/hooks/useDecrease.js +1 -1
- package/datetimePicker/hooks/useIncrease.js +1 -1
- package/datetimePicker/utils/GMTDate.js +23 -0
- package/divider/Divider.js +4 -1
- package/dropdown/DropdownContent.js +1 -1
- package/dropdown/DropdownItem.js +2 -2
- package/dropzone/FileDropzone.js +24 -24
- package/dropzone/ImageDropzone.js +33 -33
- package/form/Label.js +1 -1
- package/form/Searchbox.js +4 -4
- package/geolocation/MapInteractor.js +4 -4
- package/heading/Heading1.js +2 -2
- package/heading/Heading2.js +3 -3
- package/heading/Heading3.js +10 -7
- package/icon/IconFigure.js +2 -2
- package/iconbox/ApplicationIconBox.js +8 -8
- package/iconbox/IconBoxFigure.js +6 -6
- package/iconbox/IconBoxImage.js +2 -2
- package/iconbox/IconBoxV2.js +4 -4
- package/image/UploadImage.js +2 -2
- package/index.js +13 -0
- package/jsoneditor/JsonEditor.js +1 -1
- package/layout/Backdrop.js +1 -1
- package/layout/MenuIcon.js +1 -1
- package/link/LinkSpan.js +4 -4
- package/map/LeafletMap.js +4 -4
- package/modal/StateModal.js +2 -2
- package/modal/TitleModal.js +4 -4
- package/package.json +1 -1
- package/paginate/Paginate.js +1 -1
- package/popover/Popover.js +3 -3
- package/ribbon/Ribbon.js +1 -1
- package/section/Section.js +27 -24
- package/section/SectionBody.js +1 -1
- package/section/SectionHeader.js +3 -3
- package/select/SearchBox.js +2 -2
- package/select/Select.js +59 -54
- package/table/Logo.js +1 -1
- package/table/PermissionTable.js +5 -5
- package/table/Table.js +31 -31
- package/table/TableHeadCell.js +3 -3
- package/table/hooks/useLimitChange.js +3 -3
- package/table/hooks/usePageChange.js +3 -3
- package/table/hooks/useSortChange.js +1 -1
- package/text/Paragraph.js +8 -5
- package/timeline/Timeline.js +4 -4
- package/toast/CustomToastContainer.js +1 -1
- package/tooltip/Tooltip.js +7 -7
- package/utils/array/generateRange.js +2 -2
- package/utils/chart/customTooltip.js +18 -18
- package/utils/chart/padEmptyChartBar.js +8 -8
- package/utils/dataURLtoFile.js +23 -6
- package/utils/format/datetimeFormat.js +7 -8
- package/utils/format/formatDate.js +7 -7
- package/utils/format/formatSize.js +1 -1
- package/utils/getBase64.js +2 -5
- package/utils/hooks/useCustomPopper.js +3 -4
- package/utils/image/resize.js +7 -7
- package/utils/react/setRef.js +1 -1
- package/wizard/Wizard.js +5 -12
- package/module/geolocation/api.js +0 -51
- package/module/message/index.js +0 -59
- package/services/api/index.js +0 -73
|
@@ -9,12 +9,12 @@ var customTooltip = function customTooltip(theme) {
|
|
|
9
9
|
// optimize: render in react way
|
|
10
10
|
return function (context) {
|
|
11
11
|
// Tooltip Element
|
|
12
|
-
var tooltipEl = document.getElementById(
|
|
12
|
+
var tooltipEl = document.getElementById('chartjs-tooltip'); // Create element on first render
|
|
13
13
|
|
|
14
14
|
if (!tooltipEl) {
|
|
15
|
-
tooltipEl = document.createElement(
|
|
16
|
-
tooltipEl.id =
|
|
17
|
-
tooltipEl.innerHTML =
|
|
15
|
+
tooltipEl = document.createElement('div');
|
|
16
|
+
tooltipEl.id = 'chartjs-tooltip';
|
|
17
|
+
tooltipEl.innerHTML = '<table></table>';
|
|
18
18
|
document.body.appendChild(tooltipEl);
|
|
19
19
|
} // Hide tooltip, if no tooltip or no data
|
|
20
20
|
|
|
@@ -22,17 +22,17 @@ var customTooltip = function customTooltip(theme) {
|
|
|
22
22
|
var tooltipModel = context.tooltip;
|
|
23
23
|
|
|
24
24
|
if (!tooltipModel || !tooltipModel.dataPoints || !tooltipModel.dataPoints[0] || tooltipModel.opacity === 0) {
|
|
25
|
-
tooltipEl.style.display =
|
|
25
|
+
tooltipEl.style.display = 'none';
|
|
26
26
|
return;
|
|
27
27
|
} // Set caret Position
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
tooltipEl.classList.remove(
|
|
30
|
+
tooltipEl.classList.remove('above', 'below', 'no-transform');
|
|
31
31
|
|
|
32
32
|
if (tooltipModel.yAlign) {
|
|
33
33
|
tooltipEl.classList.add(tooltipModel.yAlign);
|
|
34
34
|
} else {
|
|
35
|
-
tooltipEl.classList.add(
|
|
35
|
+
tooltipEl.classList.add('no-transform');
|
|
36
36
|
} // Set Text
|
|
37
37
|
|
|
38
38
|
|
|
@@ -41,16 +41,16 @@ var customTooltip = function customTooltip(theme) {
|
|
|
41
41
|
var bodyLines = tooltipModel.body.map(function (bodyItem) {
|
|
42
42
|
return bodyItem.lines;
|
|
43
43
|
});
|
|
44
|
-
var innerHtml =
|
|
44
|
+
var innerHtml = '<thead>';
|
|
45
45
|
titleLines.forEach(function (title) {
|
|
46
|
-
innerHtml += "<tr><th>"
|
|
46
|
+
innerHtml += "<tr><th>".concat(title, "</th></tr>");
|
|
47
47
|
});
|
|
48
|
-
innerHtml +=
|
|
48
|
+
innerHtml += '</thead><tbody>';
|
|
49
49
|
bodyLines.forEach(function (body) {
|
|
50
|
-
innerHtml += "<tr><td>"
|
|
50
|
+
innerHtml += "<tr><td>".concat(body, "</td></tr>");
|
|
51
51
|
});
|
|
52
|
-
innerHtml +=
|
|
53
|
-
var tableRoot = tooltipEl.querySelector(
|
|
52
|
+
innerHtml += '</tbody>';
|
|
53
|
+
var tableRoot = tooltipEl.querySelector('table');
|
|
54
54
|
tableRoot.innerHTML = innerHtml;
|
|
55
55
|
} // `this` will be the overall tooltip
|
|
56
56
|
|
|
@@ -59,14 +59,14 @@ var customTooltip = function customTooltip(theme) {
|
|
|
59
59
|
|
|
60
60
|
tooltipEl.style.fontFamily = theme.fontFamily;
|
|
61
61
|
tooltipEl.style.fontSize = theme.fontBody1;
|
|
62
|
-
tooltipEl.style.display =
|
|
63
|
-
tooltipEl.style.position =
|
|
62
|
+
tooltipEl.style.display = 'block';
|
|
63
|
+
tooltipEl.style.position = 'absolute';
|
|
64
64
|
tooltipEl.style.color = tooltipModel.labelTextColors[0];
|
|
65
65
|
tooltipEl.style.background = tooltipModel.labelColors[0].backgroundColor;
|
|
66
66
|
tooltipEl.style.borderRadius = theme.borderRadius;
|
|
67
|
-
tooltipEl.style.textAlign =
|
|
67
|
+
tooltipEl.style.textAlign = 'center';
|
|
68
68
|
tooltipEl.style.padding = "".concat(theme.spacerXS, " ").concat(theme.spacerS);
|
|
69
|
-
tooltipEl.style.pointerEvents =
|
|
69
|
+
tooltipEl.style.pointerEvents = 'none'; // determine position is left or right
|
|
70
70
|
|
|
71
71
|
if (tooltipModel.caretX + tooltipEl.offsetWidth <= this._chart.width) {
|
|
72
72
|
tooltipEl.style.borderTopLeftRadius = 0;
|
|
@@ -78,7 +78,7 @@ var customTooltip = function customTooltip(theme) {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
if (tooltipModel.caretY + tooltipEl.offsetHeight <= this._chart.height) {
|
|
81
|
-
tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.caretY + 8
|
|
81
|
+
tooltipEl.style.top = "".concat(position.top + window.pageYOffset + tooltipModel.caretY + 8, "px");
|
|
82
82
|
} else {
|
|
83
83
|
tooltipEl.style.top = "".concat(position.top + window.pageYOffset + tooltipModel.caretY - tooltipModel.width - 16 * 2, "px");
|
|
84
84
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
// make chart bar seem like align left by pad empty bar at the end
|
|
8
8
|
var padEmptyChartBar = {
|
|
9
|
-
id:
|
|
9
|
+
id: 'padEmptyChartBar',
|
|
10
10
|
length: -1,
|
|
11
11
|
// pad empty chart bar when data less than max bar number
|
|
12
12
|
beforeUpdate: function beforeUpdate(chart) {
|
|
@@ -19,10 +19,10 @@ var padEmptyChartBar = {
|
|
|
19
19
|
});
|
|
20
20
|
var maxBarNumber = options.plugins.padEmptyChartBar.maxBarNumber;
|
|
21
21
|
|
|
22
|
-
for (var
|
|
23
|
-
this.length = this.length === -1 ?
|
|
24
|
-
data.labels[
|
|
25
|
-
data.datasets[0].data[
|
|
22
|
+
for (var index = validLabels.length; index < maxBarNumber; index += 1) {
|
|
23
|
+
this.length = this.length === -1 ? index : this.length;
|
|
24
|
+
data.labels[index] = null;
|
|
25
|
+
data.datasets[0].data[index] = 0;
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
// prevent padded empty chart bar to be drawn
|
|
@@ -34,12 +34,12 @@ var padEmptyChartBar = {
|
|
|
34
34
|
|
|
35
35
|
if (this.length === -1) {
|
|
36
36
|
// restore draw function
|
|
37
|
-
for (var
|
|
37
|
+
for (var index = 0; index < maxBarNumber; index += 1) {// delete data.datasets[0]._meta[data.index].data[i].draw;
|
|
38
38
|
}
|
|
39
39
|
} else {
|
|
40
40
|
// prevents new charts to be drawn
|
|
41
|
-
for (var
|
|
42
|
-
data.datasets[0]._meta[data.index].data[
|
|
41
|
+
for (var _index = this.length; _index < data.maxBarNumber; _index += 1) {
|
|
42
|
+
data.datasets[0]._meta[data.index].data[_index].draw = function () {};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
package/utils/dataURLtoFile.js
CHANGED
|
@@ -5,15 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
10
|
+
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."); }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
+
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
|
|
8
20
|
var dataURLtoFile = function dataURLtoFile(dataurl, filename) {
|
|
9
|
-
var arr = dataurl.split(
|
|
10
|
-
|
|
21
|
+
var arr = dataurl.split(',');
|
|
22
|
+
|
|
23
|
+
var _arr$0$match = arr[0].match(/:(.*?);/),
|
|
24
|
+
_arr$0$match2 = _slicedToArray(_arr$0$match, 2),
|
|
25
|
+
mime = _arr$0$match2[1];
|
|
26
|
+
|
|
11
27
|
var bstr = atob(arr[1]);
|
|
12
|
-
var
|
|
13
|
-
var u8arr = new Uint8Array(
|
|
28
|
+
var index = bstr.length;
|
|
29
|
+
var u8arr = new Uint8Array(index);
|
|
14
30
|
|
|
15
|
-
while (
|
|
16
|
-
u8arr[
|
|
31
|
+
while (index > 0) {
|
|
32
|
+
u8arr[index] = bstr.charCodeAt(index);
|
|
33
|
+
index -= 1;
|
|
17
34
|
}
|
|
18
35
|
|
|
19
36
|
return new File([u8arr], filename, {
|
|
@@ -18,8 +18,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
|
|
20
20
|
var datetimeTFormat = function datetimeTFormat(timestamp) {
|
|
21
|
-
var d = new Date(timestamp);
|
|
22
|
-
|
|
23
21
|
if (typeof timestamp === 'string') {
|
|
24
22
|
var _timestamp$split = timestamp.split('-'),
|
|
25
23
|
_timestamp$split2 = _slicedToArray(_timestamp$split, 3),
|
|
@@ -50,12 +48,13 @@ var datetimeTFormat = function datetimeTFormat(timestamp) {
|
|
|
50
48
|
return "".concat(_year, "-").concat(_month, "-").concat(_day, "T").concat(_hour, ":").concat(_minutes, ":").concat(_second);
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
51
|
+
var date = new Date(timestamp);
|
|
52
|
+
var second = "".concat(date.getSeconds());
|
|
53
|
+
var minutes = "".concat(date.getMinutes());
|
|
54
|
+
var hour = "".concat(date.getHours());
|
|
55
|
+
var month = "".concat(date.getMonth() + 1);
|
|
56
|
+
var day = "".concat(date.getDate());
|
|
57
|
+
var year = "".concat(date.getFullYear());
|
|
59
58
|
if (year.length === 1) year = "000".concat(year);
|
|
60
59
|
if (year.length === 2) year = "00".concat(year);
|
|
61
60
|
if (year.length === 3) year = "0".concat(year);
|
|
@@ -15,13 +15,13 @@ exports.default = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
var formatDate = function formatDate(timestamp) {
|
|
17
17
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
18
|
-
var
|
|
19
|
-
var second = "".concat(
|
|
20
|
-
var minutes = "".concat(
|
|
21
|
-
var hour = "".concat(
|
|
22
|
-
var month = "".concat(
|
|
23
|
-
var day = "".concat(
|
|
24
|
-
var year = "".concat(
|
|
18
|
+
var date = new Date(timestamp);
|
|
19
|
+
var second = "".concat(date.getSeconds());
|
|
20
|
+
var minutes = "".concat(date.getMinutes());
|
|
21
|
+
var hour = "".concat(date.getHours());
|
|
22
|
+
var month = "".concat(date.getMonth() + 1);
|
|
23
|
+
var day = "".concat(date.getDate());
|
|
24
|
+
var year = "".concat(date.getFullYear());
|
|
25
25
|
if (year.length === 1) year = "000".concat(year);
|
|
26
26
|
if (year.length === 2) year = "00".concat(year);
|
|
27
27
|
if (month.length < 2) month = "0".concat(month);
|
package/utils/getBase64.js
CHANGED
|
@@ -6,14 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var getBase64 = function getBase64(file, callback) {
|
|
9
|
-
|
|
10
|
-
var reader = new FileReader(); //讀取'成功'時執行
|
|
9
|
+
var reader = new FileReader();
|
|
11
10
|
|
|
12
11
|
reader.onload = function () {
|
|
13
|
-
//result返回文件的內容
|
|
14
12
|
callback(reader.result);
|
|
15
|
-
};
|
|
16
|
-
|
|
13
|
+
};
|
|
17
14
|
|
|
18
15
|
reader.readAsDataURL(file);
|
|
19
16
|
};
|
|
@@ -17,11 +17,10 @@ var useCustomPopper = function useCustomPopper(targetElement, popperElement) {
|
|
|
17
17
|
boundary = _ref$boundary === void 0 ? 'clippingParents' : _ref$boundary;
|
|
18
18
|
|
|
19
19
|
return (0, _reactPopper.usePopper)(targetElement, popperElement, {
|
|
20
|
-
placement: 'bottom',
|
|
21
20
|
strategy: strategy,
|
|
21
|
+
placement: 'bottom',
|
|
22
22
|
modifiers: [{
|
|
23
23
|
name: 'flip',
|
|
24
|
-
//當reference元素將超出邊界時,定位popper元素
|
|
25
24
|
enabled: true,
|
|
26
25
|
options: {
|
|
27
26
|
padding: 8
|
|
@@ -29,8 +28,8 @@ var useCustomPopper = function useCustomPopper(targetElement, popperElement) {
|
|
|
29
28
|
}, {
|
|
30
29
|
name: 'preventOverflow',
|
|
31
30
|
options: {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
boundary: boundary,
|
|
32
|
+
padding: 8
|
|
34
33
|
}
|
|
35
34
|
}, {
|
|
36
35
|
name: 'offset',
|
package/utils/image/resize.js
CHANGED
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var resizeImage = function resizeImage(url, mime, size, mode, callback) {
|
|
9
|
-
var canvas = document.createElement(
|
|
10
|
-
var ctx = canvas.getContext(
|
|
9
|
+
var canvas = document.createElement('canvas');
|
|
10
|
+
var ctx = canvas.getContext('2d');
|
|
11
11
|
var img = new Image();
|
|
12
|
-
img.crossOrigin =
|
|
12
|
+
img.crossOrigin = 'Anonymous';
|
|
13
13
|
|
|
14
14
|
img.onload = function () {
|
|
15
|
-
var height = img.height
|
|
16
|
-
|
|
15
|
+
var height = img.height,
|
|
16
|
+
width = img.width;
|
|
17
17
|
|
|
18
|
-
if (mode ===
|
|
18
|
+
if (mode === 'contain') {
|
|
19
19
|
if (height > width) {
|
|
20
20
|
width = width * (size / height);
|
|
21
21
|
height = size;
|
|
@@ -25,7 +25,7 @@ var resizeImage = function resizeImage(url, mime, size, mode, callback) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
if (mode ===
|
|
28
|
+
if (mode === 'cover') {
|
|
29
29
|
if (height > width) {
|
|
30
30
|
height = height * (size / width);
|
|
31
31
|
width = size;
|
package/utils/react/setRef.js
CHANGED
package/wizard/Wizard.js
CHANGED
|
@@ -102,20 +102,15 @@ var Wizard = function Wizard(props) {
|
|
|
102
102
|
};
|
|
103
103
|
}(), [currentStep, beforeNext, beforePrevious]);
|
|
104
104
|
var nextStep = (0, _react.useCallback)(function () {
|
|
105
|
-
console.log("next");
|
|
106
105
|
var next = currentStep + 1;
|
|
107
106
|
|
|
108
107
|
if (next > navNames.length) {
|
|
109
108
|
next = navNames.length;
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
console.log("1");
|
|
113
|
-
|
|
114
111
|
if (!beforeNext) {
|
|
115
|
-
console.log("2");
|
|
116
112
|
setCurrentStep(next);
|
|
117
113
|
} else {
|
|
118
|
-
console.log("3");
|
|
119
114
|
beforeNext({
|
|
120
115
|
current: currentStep
|
|
121
116
|
}).then(function () {
|
|
@@ -144,7 +139,6 @@ var Wizard = function Wizard(props) {
|
|
|
144
139
|
return currentStep === navNames.length;
|
|
145
140
|
}, [currentStep, navNames.length]);
|
|
146
141
|
var api = (0, _react.useMemo)(function () {
|
|
147
|
-
console.log("api");
|
|
148
142
|
return {
|
|
149
143
|
goToStep: goToStep,
|
|
150
144
|
nextStep: nextStep,
|
|
@@ -157,9 +151,8 @@ var Wizard = function Wizard(props) {
|
|
|
157
151
|
return !!child;
|
|
158
152
|
});
|
|
159
153
|
return _react.Children.map(validChildren, function (child, index) {
|
|
160
|
-
console.log("isReactComponent(child)", (0, _isReactComponent.default)(child));
|
|
161
154
|
if (!child) return null;
|
|
162
|
-
var className = index + 1 === currentStep &&
|
|
155
|
+
var className = index + 1 === currentStep && 'active';
|
|
163
156
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Step, {
|
|
164
157
|
className: className,
|
|
165
158
|
children: (0, _isReactComponent.default)(child) ? /*#__PURE__*/(0, _react.cloneElement)(child, api) : child
|
|
@@ -173,13 +166,13 @@ var Wizard = function Wizard(props) {
|
|
|
173
166
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Nav, {
|
|
174
167
|
children: navNames.map(function (name, index, arr) {
|
|
175
168
|
var step = index + 1;
|
|
176
|
-
var arrow = step === currentStep && step !== arr.length ?
|
|
177
|
-
var className =
|
|
169
|
+
var arrow = step === currentStep && step !== arr.length ? 'arrow' : undefined;
|
|
170
|
+
var className = '';
|
|
178
171
|
|
|
179
172
|
if (step === currentStep) {
|
|
180
|
-
className +=
|
|
173
|
+
className += 'current';
|
|
181
174
|
} else if (step < currentStep) {
|
|
182
|
-
className +=
|
|
175
|
+
className += 'done';
|
|
183
176
|
}
|
|
184
177
|
|
|
185
178
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(NavItem, {
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getReverseGeolocation = exports.getGeolocationByAddress = void 0;
|
|
7
|
-
|
|
8
|
-
var _api = require("../../services/api");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* call osm nominatim reverse geolocation service
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} coordinates The coordinates to convert
|
|
14
|
-
* @param {Object.latitude}
|
|
15
|
-
* @param {Object.longitude}
|
|
16
|
-
*
|
|
17
|
-
* @fires cashub.reverse.geo.done
|
|
18
|
-
*/
|
|
19
|
-
var getReverseGeolocation = function getReverseGeolocation(coordinates) {
|
|
20
|
-
return _api.callApi.get('https://nominatim.openstreetmap.org/reverse', {
|
|
21
|
-
params: {
|
|
22
|
-
lat: coordinates.lat,
|
|
23
|
-
lon: coordinates.lng,
|
|
24
|
-
format: 'json',
|
|
25
|
-
'accept-language': window.navigator.language || window.navigator.languages[0]
|
|
26
|
-
},
|
|
27
|
-
external: true
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* call osm nominatim search geolocation service
|
|
32
|
-
*
|
|
33
|
-
* @param {String} address The address to convert
|
|
34
|
-
*
|
|
35
|
-
* @fires cashub.reverse.geo.done
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
exports.getReverseGeolocation = getReverseGeolocation;
|
|
40
|
-
|
|
41
|
-
var getGeolocationByAddress = function getGeolocationByAddress(address) {
|
|
42
|
-
return _api.callApi.get('https://nominatim.openstreetmap.org/search', {
|
|
43
|
-
params: {
|
|
44
|
-
q: address,
|
|
45
|
-
format: 'json'
|
|
46
|
-
},
|
|
47
|
-
external: true
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
exports.getGeolocationByAddress = getGeolocationByAddress;
|
package/module/message/index.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.warning = exports.success = exports.error = void 0;
|
|
7
|
-
|
|
8
|
-
var _reactToastify = require("react-toastify");
|
|
9
|
-
|
|
10
|
-
var _MessageContainer = _interopRequireDefault(require("../../toast/MessageContainer"));
|
|
11
|
-
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
var success = function success(_ref) {
|
|
17
|
-
var title = _ref.title,
|
|
18
|
-
message = _ref.message,
|
|
19
|
-
_ref$containHTML = _ref.containHTML,
|
|
20
|
-
containHTML = _ref$containHTML === void 0 ? false : _ref$containHTML;
|
|
21
|
-
|
|
22
|
-
_reactToastify.toast.success( /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageContainer.default, {
|
|
23
|
-
title: title,
|
|
24
|
-
message: message,
|
|
25
|
-
containHTML: containHTML
|
|
26
|
-
}));
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.success = success;
|
|
30
|
-
|
|
31
|
-
var error = function error(_ref2) {
|
|
32
|
-
var title = _ref2.title,
|
|
33
|
-
message = _ref2.message,
|
|
34
|
-
_ref2$containHTML = _ref2.containHTML,
|
|
35
|
-
containHTML = _ref2$containHTML === void 0 ? false : _ref2$containHTML;
|
|
36
|
-
|
|
37
|
-
_reactToastify.toast.error( /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageContainer.default, {
|
|
38
|
-
title: title,
|
|
39
|
-
message: message,
|
|
40
|
-
containHTML: containHTML
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
exports.error = error;
|
|
45
|
-
|
|
46
|
-
var warning = function warning(_ref3) {
|
|
47
|
-
var title = _ref3.title,
|
|
48
|
-
message = _ref3.message,
|
|
49
|
-
_ref3$containHTML = _ref3.containHTML,
|
|
50
|
-
containHTML = _ref3$containHTML === void 0 ? false : _ref3$containHTML;
|
|
51
|
-
|
|
52
|
-
_reactToastify.toast.warning( /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageContainer.default, {
|
|
53
|
-
title: title,
|
|
54
|
-
message: message,
|
|
55
|
-
containHTML: containHTML
|
|
56
|
-
}));
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
exports.warning = warning;
|
package/services/api/index.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.callApi = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var _axios = _interopRequireDefault(require("axios"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
// Create axios instance for set default config
|
|
15
|
-
var numberOfAjaxCallPending = 0;
|
|
16
|
-
|
|
17
|
-
var callApi = _axios.default.create({
|
|
18
|
-
baseURL: '/api'
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
exports.callApi = callApi;
|
|
22
|
-
|
|
23
|
-
var AxiosInterceptor = function AxiosInterceptor(_ref) {
|
|
24
|
-
var onBeforeSend = _ref.onBeforeSend,
|
|
25
|
-
onDone = _ref.onDone,
|
|
26
|
-
onAllDone = _ref.onAllDone;
|
|
27
|
-
var countAjaxCall = (0, _react.useCallback)(function () {
|
|
28
|
-
if (numberOfAjaxCallPending > 0) {
|
|
29
|
-
numberOfAjaxCallPending--;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (numberOfAjaxCallPending === 0) {
|
|
33
|
-
onAllDone();
|
|
34
|
-
}
|
|
35
|
-
}, [onAllDone]);
|
|
36
|
-
(0, _react.useEffect)(function () {
|
|
37
|
-
var requestInterceptor = callApi.interceptors.request.use(function (config) {
|
|
38
|
-
if (config.global !== false) {
|
|
39
|
-
numberOfAjaxCallPending++;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (typeof onBeforeSend === 'function') {
|
|
43
|
-
return onBeforeSend(config);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return config;
|
|
47
|
-
}, function (error) {
|
|
48
|
-
countAjaxCall();
|
|
49
|
-
return Promise.reject(error);
|
|
50
|
-
});
|
|
51
|
-
var responseInterceptor = callApi.interceptors.response.use(function (response) {
|
|
52
|
-
if (!response) return response;
|
|
53
|
-
countAjaxCall();
|
|
54
|
-
|
|
55
|
-
if (typeof onDone === 'function') {
|
|
56
|
-
return onDone(response);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return response;
|
|
60
|
-
}, function (error) {
|
|
61
|
-
countAjaxCall();
|
|
62
|
-
return Promise.reject(error);
|
|
63
|
-
});
|
|
64
|
-
return function () {
|
|
65
|
-
callApi.interceptors.request.eject(requestInterceptor);
|
|
66
|
-
callApi.interceptors.response.eject(responseInterceptor);
|
|
67
|
-
};
|
|
68
|
-
}, [onBeforeSend, onDone, countAjaxCall]);
|
|
69
|
-
return null;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
var _default = AxiosInterceptor;
|
|
73
|
-
exports.default = _default;
|