@djb25/digit-ui-module-vendor 1.0.29 → 1.0.30
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/index.js.map +1 -1
- package/dist/index.modern.js +32 -8
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -604,7 +604,7 @@ const VendorConfig = (t, disabled = false) => {
|
|
|
604
604
|
name: "vendorName",
|
|
605
605
|
validation: {
|
|
606
606
|
required: true,
|
|
607
|
-
pattern: /^[A-Za-z\s]+$/
|
|
607
|
+
pattern: /^[A-Za-z\s.,/]+$/
|
|
608
608
|
},
|
|
609
609
|
error: t("FSM_REGISTRY_INVALID_NAME"),
|
|
610
610
|
defaultValue: "",
|
|
@@ -10914,7 +10914,7 @@ const VehicleConfig = (t, disabled = false) => {
|
|
|
10914
10914
|
name: "registrationNumber",
|
|
10915
10915
|
ValidationRequired: true,
|
|
10916
10916
|
validation: {
|
|
10917
|
-
pattern: `^[A-Z]{2}-[0-9]{2}-[A-Z]{1,2}-[0-9]{4}$`,
|
|
10917
|
+
pattern: `^[A-Z]{2}-[0-9]{1,2}[A-Z]{0,2}-(?:[A-Z]{1,2}-)?[0-9]{1,4}$`,
|
|
10918
10918
|
title: t("ES_FSM_VEHICLE_FORMAT_TIP")
|
|
10919
10919
|
},
|
|
10920
10920
|
error: t("FSM_REGISTRY_INVALID_REGISTRATION_NUMBER"),
|
|
@@ -11016,7 +11016,7 @@ const VehicleConfig = (t, disabled = false) => {
|
|
|
11016
11016
|
validation: {
|
|
11017
11017
|
required: true,
|
|
11018
11018
|
pattern: {
|
|
11019
|
-
value: /^[A-Za-z\s]+$/,
|
|
11019
|
+
value: /^[A-Za-z\s.,/]+$/,
|
|
11020
11020
|
message: t("FSM_REGISTRY_INVALID_NAME")
|
|
11021
11021
|
}
|
|
11022
11022
|
},
|
|
@@ -11126,11 +11126,11 @@ const AddVehicle = ({
|
|
|
11126
11126
|
}, /*#__PURE__*/React.createElement(InfoIcon, null), /*#__PURE__*/React.createElement("span", {
|
|
11127
11127
|
className: "tooltiptext",
|
|
11128
11128
|
style: {
|
|
11129
|
-
width: "
|
|
11129
|
+
width: "320px",
|
|
11130
11130
|
left: "230%",
|
|
11131
11131
|
fontSize: "14px"
|
|
11132
11132
|
}
|
|
11133
|
-
},
|
|
11133
|
+
}, item.populators.validation.title));
|
|
11134
11134
|
}
|
|
11135
11135
|
});
|
|
11136
11136
|
const [canSubmit, setSubmitValve] = useState(false);
|
|
@@ -11146,12 +11146,36 @@ const AddVehicle = ({
|
|
|
11146
11146
|
amount: null
|
|
11147
11147
|
}
|
|
11148
11148
|
};
|
|
11149
|
+
const formatVehicleNumber = input => {
|
|
11150
|
+
const cleaned = input.toUpperCase().replace(/[^A-Z0-9]/g, "");
|
|
11151
|
+
if (cleaned.length <= 2) return cleaned;
|
|
11152
|
+
const state = cleaned.slice(0, 2);
|
|
11153
|
+
const rest = cleaned.slice(2);
|
|
11154
|
+
if (!rest) return state;
|
|
11155
|
+
const rtoMatch = rest.match(/^(\d{1,2})/);
|
|
11156
|
+
if (!rtoMatch) return state + "-" + rest;
|
|
11157
|
+
const rtoDigits = rtoMatch[1];
|
|
11158
|
+
const afterRto = rest.slice(rtoDigits.length);
|
|
11159
|
+
const lettersMatch = afterRto.match(/^([A-Z]*)/);
|
|
11160
|
+
const middleLetters = lettersMatch ? lettersMatch[1] : "";
|
|
11161
|
+
const number = afterRto.slice(middleLetters.length);
|
|
11162
|
+
if (!number) {
|
|
11163
|
+
return state + "-" + rtoDigits + middleLetters;
|
|
11164
|
+
}
|
|
11165
|
+
if (middleLetters.length >= 3) {
|
|
11166
|
+
const splitAt = middleLetters.length <= 3 ? 1 : 2;
|
|
11167
|
+
const series = middleLetters.slice(0, splitAt);
|
|
11168
|
+
const subSeries = middleLetters.slice(splitAt);
|
|
11169
|
+
return state + "-" + rtoDigits + series + "-" + subSeries + "-" + number.slice(0, 4);
|
|
11170
|
+
}
|
|
11171
|
+
return state + "-" + rtoDigits + middleLetters + "-" + number.slice(0, 4);
|
|
11172
|
+
};
|
|
11149
11173
|
const onFormValueChange = (setValue, formData) => {
|
|
11150
11174
|
var _formData$vehicle, _formData$vehicle2;
|
|
11151
11175
|
if (formData !== null && formData !== void 0 && formData.registrationNumber) {
|
|
11152
|
-
let updatedRegNo = formData.registrationNumber
|
|
11153
|
-
if (updatedRegNo.length >
|
|
11154
|
-
updatedRegNo = updatedRegNo.slice(0,
|
|
11176
|
+
let updatedRegNo = formatVehicleNumber(formData.registrationNumber);
|
|
11177
|
+
if (updatedRegNo.length > 15) {
|
|
11178
|
+
updatedRegNo = updatedRegNo.slice(0, 15);
|
|
11155
11179
|
}
|
|
11156
11180
|
if (updatedRegNo !== formData.registrationNumber) {
|
|
11157
11181
|
setValue("registrationNumber", updatedRegNo);
|