ui-soxo-bootstrap-core 2.6.1-dev.3 → 2.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/.github/workflows/npm-publish.yml +19 -49
- package/core/components/external-window/DEVELOPER_GUIDE.md +705 -0
- package/core/components/menu-template-api/menu-template-api.js +2 -2
- package/core/lib/elements/basic/country-phone-input/country-phone-input.js +57 -26
- package/core/lib/elements/basic/country-phone-input/phone-input.scss +0 -14
- package/core/lib/models/forms/components/form-creator/form-creator.js +502 -468
- package/core/lib/pages/change-password/change-password.scss +45 -48
- package/core/lib/pages/login/login.js +4 -28
- package/core/lib/utils/api/api.utils.js +39 -50
- package/core/lib/utils/common/common.utils.js +0 -24
- package/core/lib/utils/index.js +28 -22
- package/core/models/roles/roles.js +0 -9
- package/core/models/users/components/user-add/user-add.js +2 -2
- package/core/models/users/users.js +7 -18
- package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +24 -55
- package/core/modules/steps/action-buttons.js +1 -5
- package/package.json +2 -2
|
@@ -6,48 +6,79 @@
|
|
|
6
6
|
* Ensure to follow a minimal standard
|
|
7
7
|
*/
|
|
8
8
|
import React, { useState, useEffect, useRef } from 'react';
|
|
9
|
+
|
|
9
10
|
import PhoneInput from 'react-phone-input-2';
|
|
11
|
+
|
|
10
12
|
import 'react-phone-input-2/lib/style.css';
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
import PropTypes from "prop-types";
|
|
15
|
+
|
|
12
16
|
import './phone-input.scss';
|
|
13
17
|
|
|
14
|
-
export default function CountryPhoneInput({ value, onChange, disabled, disableCountryCode, required, defaultCountryCode, onBlur,className }) {
|
|
15
|
-
const inputRef = useRef();
|
|
16
|
-
const hasInitializedRef = useRef(false); // IMPORTANT
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
export default function CountryPhoneInput({ value, onChange, disabled, disableCountryCode, required, defaultCountryCode, onBlur }) {
|
|
20
|
+
|
|
21
|
+
let inputRef = useRef();
|
|
22
|
+
|
|
23
|
+
const [phone, setPhone] = useState();
|
|
19
24
|
|
|
20
|
-
/**
|
|
21
|
-
* run ONLY ONCE when initial value has dial code
|
|
22
|
-
*/
|
|
23
25
|
useEffect(() => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
value?.code?.dialCode &&
|
|
27
|
-
value?.value
|
|
28
|
-
) {
|
|
26
|
+
if (value && value.code && value.code.dialCode !== null) {
|
|
27
|
+
// To prepopulate phone number ,concat dialCode and phone number
|
|
29
28
|
setPhone(value.code.dialCode + value.value);
|
|
30
|
-
|
|
29
|
+
|
|
30
|
+
// In case of update , to identify the country code that is getting selected
|
|
31
|
+
// We are setting a timeout
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
// Using the reference , we get the internal state of the library component
|
|
34
|
+
let selectedCountry = null;
|
|
35
|
+
|
|
36
|
+
let selectedCode = null;
|
|
37
|
+
|
|
38
|
+
if (
|
|
39
|
+
inputRef.current &&
|
|
40
|
+
inputRef.current.state &&
|
|
41
|
+
inputRef.current.state.selectedCountry
|
|
42
|
+
) {
|
|
43
|
+
selectedCountry = inputRef.current.state.selectedCountry;
|
|
44
|
+
|
|
45
|
+
// Once we get the selected country ,we format it to the form that is received for normal onChange
|
|
46
|
+
selectedCode = {
|
|
47
|
+
countryCode: selectedCountry.iso2,
|
|
48
|
+
dialCode: selectedCountry.dialCode,
|
|
49
|
+
name: selectedCountry.name,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Below being the format expected , we trigger the onChange to manually update the form
|
|
54
|
+
let updatedValue = {
|
|
55
|
+
value: value.code.dialCode + value.value,
|
|
56
|
+
code: selectedCode,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
onChange(updatedValue);
|
|
60
|
+
}, 0);
|
|
31
61
|
}
|
|
32
|
-
}, [
|
|
62
|
+
}, []);
|
|
33
63
|
|
|
34
64
|
/**
|
|
35
|
-
*
|
|
65
|
+
* To get value in parent component
|
|
66
|
+
* @param {*} value
|
|
36
67
|
*/
|
|
37
|
-
function handleInput(
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
value: phoneNumber,
|
|
68
|
+
function handleInput(value, code) {
|
|
69
|
+
if (code.dialCode) {
|
|
70
|
+
value = value.substring(code.dialCode.length);
|
|
71
|
+
}
|
|
72
|
+
// To get country code with phone number in parent component
|
|
73
|
+
value = {
|
|
74
|
+
value,
|
|
45
75
|
code,
|
|
46
|
-
}
|
|
76
|
+
};
|
|
77
|
+
onChange(value);
|
|
47
78
|
}
|
|
48
79
|
|
|
49
80
|
return (
|
|
50
|
-
<div className=
|
|
81
|
+
<div className="phone-input">
|
|
51
82
|
<PhoneInput
|
|
52
83
|
ref={inputRef}
|
|
53
84
|
country={defaultCountryCode || 'in'}
|
|
@@ -12,20 +12,6 @@
|
|
|
12
12
|
// }
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.autofilled-field {
|
|
16
|
-
.react-tel-input {
|
|
17
|
-
.form-control {
|
|
18
|
-
border-color: #fa8c16 !important; // AntD warning orange
|
|
19
|
-
background-color: #fff7e6;
|
|
20
|
-
box-shadow: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.flag-dropdown {
|
|
24
|
-
border-color: #fa8c16 !important;
|
|
25
|
-
background-color: #fff7e6;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
15
|
// /* For tablets and smaller screens (max-width: 1024px) */
|
|
30
16
|
// @media (max-width: 1024px) {
|
|
31
17
|
// .phone-input {
|