vue-laravel-crud 1.4.7 → 1.4.9
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/vue-laravel-crud.esm.js +3201 -53
- package/dist/vue-laravel-crud.min.js +3 -3
- package/dist/vue-laravel-crud.ssr.js +3212 -54
- package/package.json +7 -4
- package/src/vue-laravel-crud.vue +27 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-laravel-crud",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/clonixdev/vue-laravel-crud",
|
|
6
6
|
"main": "dist/vue-laravel-crud.ssr.js",
|
|
@@ -44,11 +44,14 @@
|
|
|
44
44
|
"rollup-plugin-polyfill-node": "^0.12.0",
|
|
45
45
|
"rollup-plugin-styles": "^4.0.0",
|
|
46
46
|
"rollup-plugin-terser": "^7.0.2",
|
|
47
|
-
"vue": "^2.7.
|
|
48
|
-
"vue-template-compiler": "^2.7.
|
|
47
|
+
"vue": "^2.7.14",
|
|
48
|
+
"vue-template-compiler": "^2.7.14",
|
|
49
|
+
"vuex": "^3.6.2",
|
|
50
|
+
"@vuex-orm/core": "^0.36.4",
|
|
51
|
+
"@vuex-orm/plugin-axios": "^0.9.4"
|
|
49
52
|
},
|
|
50
53
|
"peerDependencies": {
|
|
51
|
-
"vue": "^2.7.
|
|
54
|
+
"vue": "^2.7.14"
|
|
52
55
|
},
|
|
53
56
|
"engines": {
|
|
54
57
|
"node": ">=14"
|
package/src/vue-laravel-crud.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import draggable from "vuedraggable";
|
|
3
3
|
import axios from "axios";
|
|
4
4
|
import moment from "moment";
|
|
5
|
-
|
|
5
|
+
import { Model } from '@vuex-orm/core';
|
|
6
6
|
|
|
7
7
|
export default /*#__PURE__*/ {
|
|
8
8
|
name: "VueLaravelCrud",
|
|
@@ -38,8 +38,8 @@ export default /*#__PURE__*/ {
|
|
|
38
38
|
MODE_CARDS: 2,
|
|
39
39
|
MODE_CUSTOM: 3,
|
|
40
40
|
},
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
useVuexORM: false,
|
|
42
|
+
|
|
43
43
|
};
|
|
44
44
|
},
|
|
45
45
|
watch: {
|
|
@@ -56,9 +56,14 @@ export default /*#__PURE__*/ {
|
|
|
56
56
|
},
|
|
57
57
|
props: {
|
|
58
58
|
modelName: String,
|
|
59
|
-
model: Object,
|
|
60
|
-
title: String,
|
|
61
59
|
|
|
60
|
+
title: String,
|
|
61
|
+
model: {
|
|
62
|
+
type: Object | Model,
|
|
63
|
+
default() {
|
|
64
|
+
return { id: 0 };
|
|
65
|
+
},
|
|
66
|
+
},
|
|
62
67
|
models: {
|
|
63
68
|
type: Array,
|
|
64
69
|
default() {
|
|
@@ -262,13 +267,12 @@ export default /*#__PURE__*/ {
|
|
|
262
267
|
|
|
263
268
|
mounted() {
|
|
264
269
|
|
|
265
|
-
|
|
266
|
-
this.
|
|
267
|
-
|
|
268
|
-
} else {*/
|
|
270
|
+
if (this.model instanceof Model) {
|
|
271
|
+
this.useVuexORM = true;
|
|
272
|
+
} else {
|
|
269
273
|
this.item = this.model;
|
|
270
274
|
this.itemDefault = JSON.parse(JSON.stringify(this.item));
|
|
271
|
-
|
|
275
|
+
}
|
|
272
276
|
|
|
273
277
|
this.internalFilters = [];
|
|
274
278
|
this.setupFilters();
|
|
@@ -320,7 +324,12 @@ export default /*#__PURE__*/ {
|
|
|
320
324
|
},*/
|
|
321
325
|
|
|
322
326
|
finalFilters() {
|
|
323
|
-
|
|
327
|
+
|
|
328
|
+
return [
|
|
329
|
+
...this.filters,
|
|
330
|
+
...this.filter,
|
|
331
|
+
...this.internalFilter
|
|
332
|
+
];
|
|
324
333
|
},
|
|
325
334
|
|
|
326
335
|
internalFilter() {
|
|
@@ -524,25 +533,20 @@ export default /*#__PURE__*/ {
|
|
|
524
533
|
}, 1);
|
|
525
534
|
},
|
|
526
535
|
|
|
527
|
-
|
|
536
|
+
fetchItemsVuex(page = 1) {
|
|
528
537
|
this.loading = true;
|
|
529
538
|
this.$emit("beforeFetch", {});
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}).catch((error) => {
|
|
535
|
-
this.toastError(error);
|
|
536
|
-
this.loading = false;
|
|
537
|
-
});
|
|
538
|
-
},*/
|
|
539
|
+
console.debug("fetch page vuex ", page, response, this.collection);
|
|
540
|
+
this.collection = this.model.api().query().offset(page).limit(this.pagination.perPage).get();
|
|
541
|
+
this.loading = false;
|
|
542
|
+
},
|
|
539
543
|
fetchItems(page = 1) {
|
|
540
544
|
if (!this.ajax) {
|
|
541
545
|
return;
|
|
542
546
|
}
|
|
543
547
|
this.$emit("beforeFetch", {});
|
|
544
|
-
if (this.
|
|
545
|
-
|
|
548
|
+
if (this.useVuexORM) {
|
|
549
|
+
return this.fetchItemsVuex(page);
|
|
546
550
|
}
|
|
547
551
|
this.loading = true;
|
|
548
552
|
axios
|