Skip to content

Commit

Permalink
#112 Get rid of Vue dependency in the code.
Browse files Browse the repository at this point in the history
Use moment.min to reduce build size
  • Loading branch information
cristian.jora committed Feb 13, 2017
1 parent afe5e74 commit 01fa81b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 26 deletions.
27 changes: 10 additions & 17 deletions dist/vue-form-generator.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/fields/fieldDateTimePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script>
/* global $ */
import abstractField from "./abstractField";
import moment from "moment";
import moment from "moment/min/moment.min";
import { defaults } from "lodash";
let inputFormat = "YYYY-MM-DD HH:mm:ss";
Expand Down
2 changes: 1 addition & 1 deletion src/fields/fieldInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<script>
import abstractField from "./abstractField";
import moment from "moment";
import moment from "moment/min/moment.min";
export default {
mixins: [ abstractField ],
Expand Down
2 changes: 1 addition & 1 deletion src/fields/fieldPikaday.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
import abstractField from "./abstractField";
import moment from "moment";
import moment from "moment/min/moment.min";
import { defaults } from "lodash";
let inputFormat = "YYYY-MM-DD";
Expand Down
7 changes: 2 additions & 5 deletions src/fields/fieldVueMultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
)
</template>
<script>
import Vue from "vue";
import abstractField from "./abstractField";
export default {
Expand Down Expand Up @@ -96,10 +95,8 @@
}
},
created() {
// Check if the component is loaded
if (window.VueMultiselect) {
Vue.component("multiselect", window.VueMultiselect.default ? window.VueMultiselect.default : window.VueMultiselect);
} else {
// Check if the component is loaded globally
if (!this.$root.$options.components["multiselect"]) {
console.error("'vue-multiselect' is missing. Please download from https://github.com/monterail/vue-multiselect and load the script in the HTML head section!");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/validators.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isNil, isNumber, isString, isArray } from "lodash";
import moment from "moment";
import moment from "moment/min/moment.min";

function checkEmpty(value, required) {
if (isNil(value) || value === "") {
Expand Down
2 changes: 2 additions & 0 deletions test/unit/specs/fields/fieldVueMultiSelect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { createVueField, trigger } from "../util";

import Vue from "vue";
import fieldVueMultiSelect from "src/fields/fieldVueMultiSelect.vue";
import VueMultiSelect from "vue-multiselect";

Vue.component("fieldVueMultiSelect", fieldVueMultiSelect);
Vue.component("multiselect", VueMultiSelect);

// eslint-disable-next-line
let el, vm, field;
Expand Down

0 comments on commit 01fa81b

Please sign in to comment.