Skip to content

Commit

Permalink
Switching to the other validatorjs package
Browse files Browse the repository at this point in the history
  • Loading branch information
josechirivella committed Jan 12, 2024
1 parent 726eb5a commit 31811e9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
18 changes: 12 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"src"
],
"dependencies": {
"@chantouchsek/validatorjs": "1.2.3",
"@tinymce/tinymce-vue": "2.0.0",
"bootstrap": "^4.5.3",
"bootstrap-vue": "^2.23.1",
Expand All @@ -40,7 +41,6 @@
"moment-timezone": "^0.5.26",
"popper.js": "^1.14.4",
"tinymce": "5.10.0",
"validatorjs": "^3.22.1",
"vue": "^2.6.12",
"vue-date-pick": "^1.5.1",
"vue-uniq-ids": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { getUserDateFormat, getUserDateTimeFormat, getTimezone } from "../dateUt
import "vue-date-pick/dist/vueDatePick.css";
import RequiredAsterisk from './common/RequiredAsterisk';
import * as Validator from "validatorjs";
import Validator from "@chantouchsek/validatorjs";
const uniqIdsMixin = createUniqIdsMixin();
const checkFormats = ["YYYY-MM-DD", "MM/DD/YYYY", moment.ISO_8601];
Expand Down
6 changes: 3 additions & 3 deletions src/components/mixins/DataFormat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Validator from "validatorjs";
import Validator from "@chantouchsek/validatorjs";
import moment from 'moment-timezone';
import { getUserDateFormat, getUserDateTimeFormat } from '../../dateUtils';

Expand All @@ -7,7 +7,7 @@ let globalObject = typeof window === 'undefined'
? global
: window;

if (globalObject.ProcessMaker && globalObject.ProcessMaker.user && globalObject.ProcessMaker.user.lang) {
if (globalObject.ProcessMaker?.user?.lang) {
Validator.useLang(globalObject.ProcessMaker.user.lang);
}

Expand Down Expand Up @@ -89,7 +89,7 @@ export default {
return true;
}

this.dataTypeValidator = new Validator( {[this.name]: value}, {[this.name]: rules[this.dataFormat]}, null);
this.dataTypeValidator = new Validator( {[this.name]: value}, {[this.name]: rules[this.dataFormat]});
return this.dataTypeValidator.passes();
},
formatFloatValue() {
Expand Down
6 changes: 4 additions & 2 deletions src/components/mixins/validation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Validator from "validatorjs";
import Validator from "@chantouchsek/validatorjs";
import moment from "moment-timezone";
import ProxyData from "./ProxyData";
import { get, has } from "lodash";
Expand Down Expand Up @@ -137,7 +137,9 @@ export default {
[fieldName]: validationRules
};
this.registerCustomRules(data);
this.validator = new Validator(data, rules, this.validationMessages ? this.validationMessages : null);
this.validator = new Validator(data, rules, {
validationMessages: this.validationMessages ? this.validationMessages : null
});
this.validator.setAttributeNames({ [fieldName]: this.label });
this.validator.errors.first(this.name);
// Validation will not run until you call passes/fails on it
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import VueI18Next from '@panter/vue-i18next';
import { BootstrapVue, IconsPlugin } from "bootstrap-vue";
import "bootstrap/dist/css/bootstrap.css";
import "bootstrap-vue/dist/bootstrap-vue.css";
import Multiselect from '@processmaker/vue-multiselect/src/Multiselect';
import { Multiselect } from "@processmaker/vue-multiselect";

import 'bootstrap/dist/css/bootstrap.css'

Expand All @@ -24,4 +24,4 @@ Vue.component('Multiselect', Multiselect);
new Vue({
el: '#app',
render: h => h(DemoApp)
})
})
5 changes: 1 addition & 4 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export default defineConfig({
plugins: [vue(), commonjs()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
validatorjs: "validatorjs/dist/validator.js"
"@": fileURLToPath(new URL("./src", import.meta.url))
},
extensions: [".js", ".mjs", ".vue", ".json"]
},
Expand All @@ -31,7 +30,6 @@ export default defineConfig({
"vue",
"moment",
"moment-timezone",
"validatorjs",
"@processmaker/vue-multiselect"
],
output: {
Expand All @@ -43,7 +41,6 @@ export default defineConfig({
vue: "Vue",
moment: "moment",
"moment-timezone": "moment-timezone",
validatorjs: "Validator",
"@processmaker/vue-multiselect": "VueMultiselect"
}
}
Expand Down

0 comments on commit 31811e9

Please sign in to comment.