mftsccs-browser 1.1.34-beta → 1.1.36-beta
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/main.bundle.js +49 -32
- package/dist/main.bundle.js.map +1 -1
- package/dist/serviceWorker.bundle.js +49 -32
- package/dist/serviceWorker.bundle.js.map +1 -1
- package/dist/types/DataStructures/Search/FreeschemaQuery.d.ts +1 -0
- package/dist/types/Validator/interface.d.ts +3 -1
- package/dist/types/Validator/validator.d.ts +4 -2
- package/dist/types/Widgets/StatefulWidget.d.ts +1 -1
- package/package.json +1 -1
package/dist/main.bundle.js
CHANGED
|
@@ -7827,8 +7827,8 @@ class LocalSyncData {
|
|
|
7827
7827
|
else {
|
|
7828
7828
|
console.warn('Syncing this way has been Depreceted in service worker.');
|
|
7829
7829
|
console.info('Only if serive worker is not running');
|
|
7830
|
-
conceptsArray = this.conceptsSyncArray.slice();
|
|
7831
|
-
connectionsArray = this.connectionSyncArray.slice();
|
|
7830
|
+
conceptsArray = this.conceptsSyncArray.slice() || [];
|
|
7831
|
+
connectionsArray = this.connectionSyncArray.slice() || [];
|
|
7832
7832
|
// return []
|
|
7833
7833
|
}
|
|
7834
7834
|
this.connectionSyncArray = [];
|
|
@@ -8906,6 +8906,7 @@ class FreeschemaQuery {
|
|
|
8906
8906
|
this.outputFormat = _Constants_FormatConstants__WEBPACK_IMPORTED_MODULE_0__.NORMAL;
|
|
8907
8907
|
this.name = "";
|
|
8908
8908
|
this.reverse = false;
|
|
8909
|
+
this.includeInFilter = false;
|
|
8909
8910
|
}
|
|
8910
8911
|
}
|
|
8911
8912
|
|
|
@@ -17863,6 +17864,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17863
17864
|
* @returns - An object containing the field's value and constraints (type, maxLength, etc.).
|
|
17864
17865
|
*/
|
|
17865
17866
|
const createFormFieldData = (fieldName) => {
|
|
17867
|
+
var _a;
|
|
17866
17868
|
const inputElements = document.getElementsByName(fieldName);
|
|
17867
17869
|
const inputElement = inputElements[0];
|
|
17868
17870
|
// Check if the element exists
|
|
@@ -17870,13 +17872,16 @@ const createFormFieldData = (fieldName) => {
|
|
|
17870
17872
|
console.warn(`Element with NAME "${fieldName}" not found.`);
|
|
17871
17873
|
return {
|
|
17872
17874
|
value: null,
|
|
17875
|
+
fieldType: null,
|
|
17873
17876
|
dataType: null,
|
|
17877
|
+
pattern: null,
|
|
17874
17878
|
conceptType: null,
|
|
17875
17879
|
maxLength: null,
|
|
17876
17880
|
minLength: null,
|
|
17877
17881
|
minValue: null,
|
|
17878
17882
|
maxValue: null,
|
|
17879
17883
|
accept: null,
|
|
17884
|
+
file: null,
|
|
17880
17885
|
required: false,
|
|
17881
17886
|
isUnique: true
|
|
17882
17887
|
};
|
|
@@ -17887,13 +17892,16 @@ const createFormFieldData = (fieldName) => {
|
|
|
17887
17892
|
// Proceed to gather data if the element exists
|
|
17888
17893
|
const data = {
|
|
17889
17894
|
value: inputElement.value,
|
|
17895
|
+
fieldType: inputElement.type,
|
|
17890
17896
|
dataType: inputElement.getAttribute('data-type'),
|
|
17897
|
+
pattern: inputElement.getAttribute('data-pattern'),
|
|
17891
17898
|
conceptType: inputElement.getAttribute('concept-type'),
|
|
17892
17899
|
maxLength: inputElement.getAttribute('data-maxlength') ? parseInt(inputElement.getAttribute('data-maxlength')) : null,
|
|
17893
17900
|
minLength: inputElement.getAttribute('data-minlength') ? parseInt(inputElement.getAttribute('data-minlength')) : null,
|
|
17894
17901
|
minValue: inputElement.getAttribute('data-min') ? parseInt(inputElement.getAttribute('data-min')) : null,
|
|
17895
17902
|
maxValue: inputElement.getAttribute('data-max') ? parseInt(inputElement.getAttribute('data-max')) : null,
|
|
17896
17903
|
accept: inputElement.getAttribute('accept') || null,
|
|
17904
|
+
file: inputElement.type === 'file' ? ((_a = inputElement.files) === null || _a === void 0 ? void 0 : _a[0]) || null : null,
|
|
17897
17905
|
required: required,
|
|
17898
17906
|
isUnique: isUnique
|
|
17899
17907
|
};
|
|
@@ -17967,55 +17975,63 @@ class Validator {
|
|
|
17967
17975
|
* @param file - The file input (if any), used for file type validation.
|
|
17968
17976
|
* @param required - Whether the field is required.
|
|
17969
17977
|
* @param isUnique - Whether the field value should be unique.
|
|
17970
|
-
* @returns An
|
|
17978
|
+
* @returns An object of error messages if validation fails
|
|
17971
17979
|
*/
|
|
17972
|
-
validateField(fieldName_1, dataType_1, value_1, conceptType_1, maxLength_1, minLength_1, minValue_1, maxValue_1, accept_1, file_1, required_1) {
|
|
17973
|
-
return __awaiter(this, arguments, void 0, function* (fieldName, dataType, value, conceptType, maxLength, minLength, minValue, maxValue, accept, file, required, isUnique = false
|
|
17974
|
-
) {
|
|
17980
|
+
validateField(fieldName_1, fieldType_1, dataType_1, value_1, pattern_1, conceptType_1, maxLength_1, minLength_1, minValue_1, maxValue_1, accept_1, file_1, required_1) {
|
|
17981
|
+
return __awaiter(this, arguments, void 0, function* (fieldName, fieldType, dataType, value, pattern, conceptType, maxLength, minLength, minValue, maxValue, accept, file, required, isUnique = false) {
|
|
17975
17982
|
var _a;
|
|
17976
|
-
const errors =
|
|
17983
|
+
const errors = {};
|
|
17977
17984
|
// 1. Validate required field (must not be empty)
|
|
17978
17985
|
if (required && (value === null || value === '')) {
|
|
17979
|
-
errors
|
|
17986
|
+
errors['required'] = `this is required field`;
|
|
17980
17987
|
}
|
|
17981
17988
|
// 2. Validate using regex pattern for the data type
|
|
17982
17989
|
if (dataType && value) {
|
|
17983
|
-
|
|
17990
|
+
console.log(`Comment on Data Type ${dataType} and Value ${value}`);
|
|
17991
|
+
let pattern = _constant__WEBPACK_IMPORTED_MODULE_1__.DATA_TYPES_RULES[dataType];
|
|
17992
|
+
console.log("Find Pattern : ", pattern);
|
|
17984
17993
|
if (pattern && value !== '' && !pattern.test(value)) {
|
|
17985
|
-
errors
|
|
17994
|
+
errors['dataType'] = `Invalid format for ${dataType} in ${fieldName}`;
|
|
17986
17995
|
}
|
|
17987
17996
|
}
|
|
17988
|
-
// 3.
|
|
17997
|
+
// 3. Check if the provided pattern match with the value or not
|
|
17998
|
+
if (pattern && value) {
|
|
17999
|
+
const regex = typeof pattern === 'string' ? new RegExp(pattern) : pattern;
|
|
18000
|
+
if (value !== '' && !regex.test(value)) {
|
|
18001
|
+
errors['pattern'] = `Pattern doesn't match with data`;
|
|
18002
|
+
}
|
|
18003
|
+
}
|
|
18004
|
+
// 4. Validate maxLength
|
|
17989
18005
|
if (value && maxLength !== null && value.length > maxLength) {
|
|
17990
|
-
errors
|
|
18006
|
+
errors['maxLength'] = `length exceeds the maximum length of ${maxLength}`;
|
|
17991
18007
|
}
|
|
17992
|
-
//
|
|
18008
|
+
// 5. Validate minLength
|
|
17993
18009
|
if (value && minLength !== null && value.length < minLength) {
|
|
17994
|
-
errors
|
|
18010
|
+
errors['minLength'] = `length must be at least ${minLength} characters long`;
|
|
17995
18011
|
}
|
|
17996
|
-
//
|
|
18012
|
+
// 6. Validate minValue (only for numeric fields)
|
|
17997
18013
|
if (minValue !== null && value && !isNaN(Number(value)) && Number(value) < minValue) {
|
|
17998
|
-
errors
|
|
18014
|
+
errors['minValue'] = `value must be greater than or equal to ${minValue}`;
|
|
17999
18015
|
}
|
|
18000
|
-
//
|
|
18016
|
+
// 7. Validate maxValue (only for numeric fields)
|
|
18001
18017
|
if (maxValue !== null && value && !isNaN(Number(value)) && Number(value) > maxValue) {
|
|
18002
|
-
errors
|
|
18018
|
+
errors['maxValue'] = `value must be less than or equal to ${maxValue}`;
|
|
18003
18019
|
}
|
|
18004
|
-
//
|
|
18005
|
-
if (
|
|
18006
|
-
if (accept) {
|
|
18020
|
+
// 8. File validation: Check if this is a file input
|
|
18021
|
+
if (file) {
|
|
18022
|
+
if (fieldType && accept) {
|
|
18007
18023
|
const acceptedTypes = accept.split(',').map(type => type.trim().toLowerCase());
|
|
18008
18024
|
const fileExtension = (_a = file.name.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
18009
18025
|
if (fileExtension && !acceptedTypes.includes(fileExtension)) {
|
|
18010
|
-
errors
|
|
18026
|
+
errors['accept'] = `file must be a valid file type: ${acceptedTypes.join(', ')}`;
|
|
18011
18027
|
}
|
|
18012
18028
|
}
|
|
18013
18029
|
}
|
|
18014
|
-
//
|
|
18030
|
+
// 9. Check if the field needs to be unique and perform uniqueness validation
|
|
18015
18031
|
if (conceptType && isUnique && value) {
|
|
18016
18032
|
const isUniqueValue = yield this.checkUniqueness(conceptType, value);
|
|
18017
18033
|
if (!isUniqueValue) {
|
|
18018
|
-
errors
|
|
18034
|
+
errors['unique'] = `value is not unique`;
|
|
18019
18035
|
}
|
|
18020
18036
|
}
|
|
18021
18037
|
return errors;
|
|
@@ -18036,13 +18052,11 @@ class Validator {
|
|
|
18036
18052
|
const validationErrors = {};
|
|
18037
18053
|
// Iterate through the fields in the form data
|
|
18038
18054
|
for (const fieldName in formData) {
|
|
18039
|
-
const { value, dataType, conceptType, maxLength = null, minLength = null, minValue = null, maxValue = null, accept = null, file = null, required, isUnique } = formData[fieldName];
|
|
18055
|
+
const { value, fieldType, dataType, pattern, conceptType, maxLength = null, minLength = null, minValue = null, maxValue = null, accept = null, file = null, required, isUnique } = formData[fieldName];
|
|
18040
18056
|
// Call the validateField function to validate each field
|
|
18041
|
-
const fieldErrors = yield this.validateField(fieldName, dataType, value, conceptType, maxLength, minLength, minValue, maxValue, accept, file, required, isUnique);
|
|
18042
|
-
|
|
18043
|
-
if (fieldErrors.length > 0) {
|
|
18057
|
+
const fieldErrors = yield this.validateField(fieldName, fieldType, dataType, value, pattern, conceptType, maxLength, minLength, minValue, maxValue, accept, file, required, isUnique);
|
|
18058
|
+
if (Object.keys(fieldErrors).length > 0)
|
|
18044
18059
|
validationErrors[fieldName] = fieldErrors;
|
|
18045
|
-
}
|
|
18046
18060
|
}
|
|
18047
18061
|
return validationErrors;
|
|
18048
18062
|
});
|
|
@@ -18248,7 +18262,7 @@ class BuilderStatefulWidget extends _StatefulWidget__WEBPACK_IMPORTED_MODULE_0__
|
|
|
18248
18262
|
// subscribers: any = [];
|
|
18249
18263
|
this.element = null;
|
|
18250
18264
|
this.phonebooks = [];
|
|
18251
|
-
this.childrenData =
|
|
18265
|
+
this.childrenData = {};
|
|
18252
18266
|
this.html = "";
|
|
18253
18267
|
this.childWidgets = [];
|
|
18254
18268
|
this.typeValueList = [];
|
|
@@ -18303,6 +18317,11 @@ class BuilderStatefulWidget extends _StatefulWidget__WEBPACK_IMPORTED_MODULE_0__
|
|
|
18303
18317
|
}));
|
|
18304
18318
|
});
|
|
18305
18319
|
}
|
|
18320
|
+
// async CreateConceptConnections(){
|
|
18321
|
+
// let mainConcept = await
|
|
18322
|
+
// for(let i=0; i<this.childrenData.length; i++){
|
|
18323
|
+
// }
|
|
18324
|
+
// }
|
|
18306
18325
|
getUserId() {
|
|
18307
18326
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18308
18327
|
const profileData = yield new Promise((resolve) => {
|
|
@@ -18670,8 +18689,6 @@ class StatefulWidget extends _BaseWidget__WEBPACK_IMPORTED_MODULE_0__.BaseWidget
|
|
|
18670
18689
|
* This is the function that needs to be called.
|
|
18671
18690
|
*/
|
|
18672
18691
|
mountChildWidgets() {
|
|
18673
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18674
|
-
});
|
|
18675
18692
|
}
|
|
18676
18693
|
/**
|
|
18677
18694
|
*
|