vue-laravel-crud 1.4.16 → 1.4.18

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.
@@ -17305,7 +17305,7 @@ var moment$1 = {
17305
17305
  })));
17306
17306
  } (moment$1));
17307
17307
 
17308
- var moment = momentExports;var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}var css = "tr td[data-v-09914f57]:last-child,\ntr td[data-v-09914f57]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-09914f57] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-09914f57] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-09914f57] .crud-title[data-v-09914f57] {\n margin: 0; }\n .crud-header[data-v-09914f57] .crud-search[data-v-09914f57] {\n max-width: 15rem; }\n .crud-header[data-v-09914f57] .crud-search[data-v-09914f57] .btn[data-v-09914f57] {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 0.375rem;\n border-bottom-right-radius: 0.375rem; }\n .crud-header[data-v-09914f57] .crud-search[data-v-09914f57] .btn[data-v-09914f57].open[data-v-09914f57] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-09914f57] .table-options[data-v-09914f57] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-09914f57] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-09914f57] {\n table-layout: auto; }\n .table[data-v-09914f57] tbody[data-v-09914f57] td[data-v-09914f57] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-09914f57] tbody[data-v-09914f57] td[data-v-09914f57]::-webkit-scrollbar {\n display: none; } }\n";
17308
+ var moment = momentExports;var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}var css = "tr td[data-v-98011f56]:last-child,\ntr td[data-v-98011f56]:first-child {\n width: 1%;\n white-space: nowrap; }\n\n.crud-pagination[data-v-98011f56] {\n display: flex;\n justify-content: center; }\n\n.crud-header[data-v-98011f56] {\n display: flex;\n justify-content: space-between;\n max-height: 3rem; }\n .crud-header[data-v-98011f56] .crud-title[data-v-98011f56] {\n margin: 0; }\n .crud-header[data-v-98011f56] .crud-search[data-v-98011f56] {\n max-width: 15rem; }\n .crud-header[data-v-98011f56] .crud-search[data-v-98011f56] .btn[data-v-98011f56] {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 0.375rem;\n border-bottom-right-radius: 0.375rem; }\n .crud-header[data-v-98011f56] .crud-search[data-v-98011f56] .btn[data-v-98011f56].open[data-v-98011f56] {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n .crud-header[data-v-98011f56] .table-options[data-v-98011f56] {\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: flex-end; }\n\n.custom-control[data-v-98011f56] {\n position: relative;\n top: -15px; }\n\n@media (min-width: 992px) {\n .table[data-v-98011f56] {\n table-layout: auto; }\n .table[data-v-98011f56] tbody[data-v-98011f56] td[data-v-98011f56] {\n overflow: scroll;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */ }\n .table[data-v-98011f56] tbody[data-v-98011f56] td[data-v-98011f56]::-webkit-scrollbar {\n display: none; } }\n";
17309
17309
  n(css, {});function normalizeComponent (
17310
17310
  scriptExports,
17311
17311
  render,
@@ -18025,6 +18025,7 @@ n(css, {});function normalizeComponent (
18025
18025
  axios.delete(this.apiUrl + "/" + this.modelName + "/" + id).then(function (response) {
18026
18026
  _this11.items.splice(index, 1);
18027
18027
  _this11.toastSuccess("Elemento eliminado.");
18028
+ _this11.$emit("itemDeleted", {});
18028
18029
  _this11.loading = false;
18029
18030
  }).catch(function (error) {
18030
18031
  _this11.toastError(error);
@@ -18209,6 +18210,12 @@ n(css, {});function normalizeComponent (
18209
18210
  _this15.loading = false;
18210
18211
  if (_this15.refreshAfterSave) _this15.refresh();
18211
18212
  _this15.toastSuccess("Elemento Modificado");
18213
+ _this15.$emit("itemSaved", {
18214
+ item: _this15.item
18215
+ });
18216
+ _this15.$emit("itemUpdated", {
18217
+ item: _this15.item
18218
+ });
18212
18219
  }).catch(function (error) {
18213
18220
  _this15.toastError(error);
18214
18221
  _this15.loading = false;
@@ -18240,6 +18247,12 @@ n(css, {});function normalizeComponent (
18240
18247
  _this15.item = itemSv;
18241
18248
  if (_this15.refreshAfterSave) _this15.refresh();
18242
18249
  _this15.toastSuccess("Elemento Creado");
18250
+ _this15.$emit("itemSaved", {
18251
+ item: _this15.item
18252
+ });
18253
+ _this15.$emit("itemCreated", {
18254
+ item: _this15.item
18255
+ });
18243
18256
  }).catch(function (error) {
18244
18257
  _this15.toastError(error);
18245
18258
  _this15.loading = false;
@@ -18261,6 +18274,12 @@ n(css, {});function normalizeComponent (
18261
18274
  _this15.item = itemSv;
18262
18275
  if (_this15.refreshAfterSave) _this15.refresh();
18263
18276
  _this15.toastSuccess("Elemento Creado");
18277
+ _this15.$emit("itemSaved", {
18278
+ item: _this15.item
18279
+ });
18280
+ _this15.$emit("itemCreated", {
18281
+ item: _this15.item
18282
+ });
18264
18283
  }).catch(function (error) {
18265
18284
  _this15.toastError(error);
18266
18285
  _this15.loading = false;
@@ -18660,7 +18679,9 @@ var _sfc_render = function render() {
18660
18679
  "scope": "col"
18661
18680
  }
18662
18681
  }, [_vm.enableFilters && _vm.filtersVisible && _vm.isColumnHasFilter(column) && _vm.internalFilterByProp(column.prop) ? _vm._t('filter-' + column.prop, function () {
18663
- return [column.type == 'boolean' ? _c('select', {
18682
+ return [_c('div', {
18683
+ staticClass: "form-group"
18684
+ }, [column.type == 'boolean' ? _c('select', {
18664
18685
  directives: [{
18665
18686
  name: "model",
18666
18687
  rawName: "v-model",
@@ -18709,7 +18730,7 @@ var _sfc_render = function render() {
18709
18730
  callback: function callback($$v) {
18710
18731
  _vm.$set(_vm.internalFilterByProp(column.prop + '_from'), "value", $$v);
18711
18732
  },
18712
- expression: "\n internalFilterByProp(column.prop + '_from').value\n "
18733
+ expression: "\n internalFilterByProp(column.prop + '_from').value\n "
18713
18734
  }
18714
18735
  })], 1), _c('div', {
18715
18736
  staticClass: "col-6"
@@ -18725,7 +18746,7 @@ var _sfc_render = function render() {
18725
18746
  callback: function callback($$v) {
18726
18747
  _vm.$set(_vm.internalFilterByProp(column.prop + '_to'), "value", $$v);
18727
18748
  },
18728
- expression: "\n internalFilterByProp(column.prop + '_to').value\n "
18749
+ expression: "\n internalFilterByProp(column.prop + '_to').value\n "
18729
18750
  }
18730
18751
  })], 1)]) : column.type == 'state' ? _c('select', {
18731
18752
  directives: [{
@@ -18823,7 +18844,7 @@ var _sfc_render = function render() {
18823
18844
  _vm.$set(_vm.internalFilterByProp(column.prop), "value", $event.target.value);
18824
18845
  }
18825
18846
  }
18826
- })];
18847
+ })], 1)];
18827
18848
  }, {
18828
18849
  "column": column,
18829
18850
  "filter": _vm.filter,
@@ -19112,7 +19133,7 @@ var _sfc_render = function render() {
19112
19133
  on: {
19113
19134
  "submit": _vm.saveItem
19114
19135
  }
19115
- }, [_vm._t("form", function () {
19136
+ }, [_vm.item ? _vm._t("form", function () {
19116
19137
  return [_c('b-form-group', {
19117
19138
  attrs: {
19118
19139
  "label": "Nombre:",
@@ -19134,7 +19155,7 @@ var _sfc_render = function render() {
19134
19155
  })], 1)];
19135
19156
  }, {
19136
19157
  "item": _vm.item
19137
- }), _c('b-button', {
19158
+ }) : _vm._e(), _c('b-button', {
19138
19159
  attrs: {
19139
19160
  "block": "",
19140
19161
  "type": "submit",
@@ -19145,29 +19166,30 @@ var _sfc_render = function render() {
19145
19166
  attrs: {
19146
19167
  "small": ""
19147
19168
  }
19148
- }) : _vm._e(), _vm._v(_vm._s(_vm.messageSave) + " ")], 1)], 2)] : _vm._e(), !_vm.validate ? [_vm._t("form", function () {
19149
- return [_c('b-form-group', {
19150
- attrs: {
19151
- "label": "Nombre:",
19152
- "description": "Nombre "
19153
- }
19154
- }, [_c('b-form-input', {
19155
- attrs: {
19156
- "type": "text",
19157
- "required": "",
19158
- "placeholder": "Nombre"
19159
- },
19160
- model: {
19161
- value: _vm.item.title,
19162
- callback: function callback($$v) {
19163
- _vm.$set(_vm.item, "title", $$v);
19169
+ }) : _vm._e(), _vm._v(_vm._s(_vm.messageSave) + " ")], 1)], 2)] : _vm._e(), !_vm.validate ? [_vm.item ? _vm._t("form", function () {
19170
+ return _vm._l(_vm.item, function (value, key) {
19171
+ return _c('b-form-group', {
19172
+ key: key,
19173
+ attrs: {
19174
+ "label": key
19175
+ }
19176
+ }, [_c('b-form-input', {
19177
+ attrs: {
19178
+ "type": "text",
19179
+ "required": ""
19164
19180
  },
19165
- expression: "item.title"
19166
- }
19167
- })], 1)];
19181
+ model: {
19182
+ value: _vm.item[key],
19183
+ callback: function callback($$v) {
19184
+ _vm.$set(_vm.item, key, $$v);
19185
+ },
19186
+ expression: "item[key]"
19187
+ }
19188
+ })], 1);
19189
+ });
19168
19190
  }, {
19169
19191
  "item": _vm.item
19170
- }), _c('b-button', {
19192
+ }) : _vm._e(), _c('b-button', {
19171
19193
  attrs: {
19172
19194
  "block": "",
19173
19195
  "type": "submit",
@@ -19191,16 +19213,27 @@ var _sfc_render = function render() {
19191
19213
  "title": _vm.title,
19192
19214
  "no-close-on-backdrop": ""
19193
19215
  }
19194
- }, [_vm._t("show", function () {
19195
- return [_c('p', {
19196
- staticClass: "my-4"
19197
- }, [_vm._v("Show")])];
19216
+ }, [_vm.item ? _vm._t("show", function () {
19217
+ return [_c('b-list-group', _vm._l(_vm.item, function (value, key) {
19218
+ return _c('b-list-group-item', {
19219
+ key: key
19220
+ }, [_c('b-row', [_c('b-col', {
19221
+ staticClass: "font-weight-bold",
19222
+ attrs: {
19223
+ "cols": "4"
19224
+ }
19225
+ }, [_vm._v(_vm._s(key))]), _c('b-col', {
19226
+ attrs: {
19227
+ "cols": "8"
19228
+ }
19229
+ }, [_vm._v(_vm._s(JSON.stringify(value)))])], 1)], 1);
19230
+ }), 1)];
19198
19231
  }, {
19199
19232
  "item": _vm.item
19200
- })], 2)], 1);
19233
+ }) : _vm._e()], 2)], 1);
19201
19234
  };
19202
19235
  var _sfc_staticRenderFns = [];
19203
- var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "09914f57", null, null);
19236
+ var __component__ = /*#__PURE__*/normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "98011f56", null, null);
19204
19237
  var component$1 = __component__.exports;// Import vue component
19205
19238
 
19206
19239
  // Default export is installable instance of component.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-laravel-crud",
3
- "version": "1.4.16",
3
+ "version": "1.4.18",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/clonixdev/vue-laravel-crud",
6
6
  "main": "dist/vue-laravel-crud.ssr.js",
@@ -32,6 +32,7 @@ export default /*#__PURE__*/ {
32
32
  filterSidebarOpen: false,
33
33
  internalFilters: [],
34
34
  forceRecomputeCounter: 0,
35
+
35
36
  displayModes: {
36
37
  MODE_TABLE: 1,
37
38
  MODE_CARDS: 2,
@@ -636,6 +637,7 @@ export default /*#__PURE__*/ {
636
637
  .then((response) => {
637
638
  this.items.splice(index, 1);
638
639
  this.toastSuccess("Elemento eliminado.");
640
+ this.$emit("itemDeleted", {});
639
641
  this.loading = false;
640
642
  })
641
643
  .catch((error) => {
@@ -783,6 +785,8 @@ export default /*#__PURE__*/ {
783
785
  this.loading = false;
784
786
  if (this.refreshAfterSave) this.refresh();
785
787
  this.toastSuccess("Elemento Modificado");
788
+ this.$emit("itemSaved", {item: this.item});
789
+ this.$emit("itemUpdated", {item: this.item});
786
790
  })
787
791
  .catch((error) => {
788
792
  this.toastError(error);
@@ -822,6 +826,8 @@ export default /*#__PURE__*/ {
822
826
  this.item = itemSv;
823
827
  if (this.refreshAfterSave) this.refresh();
824
828
  this.toastSuccess("Elemento Creado");
829
+ this.$emit("itemSaved", {item: this.item});
830
+ this.$emit("itemCreated", {item: this.item});
825
831
  })
826
832
  .catch((error) => {
827
833
  this.toastError(error);
@@ -847,6 +853,8 @@ export default /*#__PURE__*/ {
847
853
  this.item = itemSv;
848
854
  if (this.refreshAfterSave) this.refresh();
849
855
  this.toastSuccess("Elemento Creado");
856
+ this.$emit("itemSaved", {item: this.item});
857
+ this.$emit("itemCreated", {item: this.item});
850
858
  })
851
859
  .catch((error) => {
852
860
  this.toastError(error);
@@ -1073,58 +1081,62 @@ export default /*#__PURE__*/ {
1073
1081
  isColumnHasFilter(column) &&
1074
1082
  internalFilterByProp(column.prop)
1075
1083
  ">
1076
- <select v-if="column.type == 'boolean'" class="form-control"
1077
- v-model="internalFilterByProp(column.prop).value" @change="onChangeFilter($event)">
1078
- <option value="">{{ column.label }}</option>
1079
- <option value="1">Sí</option>
1080
- <option value="0">No</option>
1081
- </select>
1082
1084
 
1083
- <div class="row" v-else-if="column.type == 'date'">
1084
- <div class="col-6">
1085
- <b-form-datepicker v-model="
1086
- internalFilterByProp(column.prop + '_from').value
1087
- " today-button reset-button close-button locale="es"></b-form-datepicker>
1088
- </div>
1089
- <div class="col-6">
1090
- <b-form-datepicker v-model="
1091
- internalFilterByProp(column.prop + '_to').value
1092
- " today-button reset-button close-button locale="es"></b-form-datepicker>
1085
+ <div class="form-group">
1086
+ <select v-if="column.type == 'boolean'" class="form-control"
1087
+ v-model="internalFilterByProp(column.prop).value" @change="onChangeFilter($event)">
1088
+ <option value="">{{ column.label }}</option>
1089
+ <option value="1">Sí</option>
1090
+ <option value="0">No</option>
1091
+ </select>
1092
+
1093
+ <div class="row" v-else-if="column.type == 'date'">
1094
+ <div class="col-6">
1095
+ <b-form-datepicker v-model="
1096
+ internalFilterByProp(column.prop + '_from').value
1097
+ " today-button reset-button close-button locale="es"></b-form-datepicker>
1098
+ </div>
1099
+ <div class="col-6">
1100
+ <b-form-datepicker v-model="
1101
+ internalFilterByProp(column.prop + '_to').value
1102
+ " today-button reset-button close-button locale="es"></b-form-datepicker>
1103
+ </div>
1093
1104
  </div>
1094
- </div>
1095
1105
 
1096
- <select v-else-if="column.type == 'state'" class="form-control"
1097
- v-model="internalFilterByProp(column.prop).value" @change="onChangeFilter($event)">
1098
- <option value="">{{ column.label }}</option>
1099
- <option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
1100
- {{
1101
- option.text
1102
- ? option.text
1103
- : option.label
1104
- ? option.label
1105
- : ""
1106
- }}
1107
- </option>
1108
- </select>
1106
+ <select v-else-if="column.type == 'state'" class="form-control"
1107
+ v-model="internalFilterByProp(column.prop).value" @change="onChangeFilter($event)">
1108
+ <option value="">{{ column.label }}</option>
1109
+ <option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
1110
+ {{
1111
+ option.text
1112
+ ? option.text
1113
+ : option.label
1114
+ ? option.label
1115
+ : ""
1116
+ }}
1117
+ </option>
1118
+ </select>
1109
1119
 
1110
- <select v-else-if="column.type == 'array'" class="form-control"
1111
- v-model="internalFilterByProp(column.prop).value" @change="onChangeFilter($event)">
1112
- <option value="">{{ column.label }}</option>
1113
- <option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
1114
- {{
1115
- option.text
1116
- ? option.text
1117
- : option.label
1118
- ? option.label
1119
- : ""
1120
- }}
1121
- </option>
1122
- </select>
1120
+ <select v-else-if="column.type == 'array'" class="form-control"
1121
+ v-model="internalFilterByProp(column.prop).value" @change="onChangeFilter($event)">
1122
+ <option value="">{{ column.label }}</option>
1123
+ <option :value="option.id" v-for="(option, indexo) in column.options" :key="indexo">
1124
+ {{
1125
+ option.text
1126
+ ? option.text
1127
+ : option.label
1128
+ ? option.label
1129
+ : ""
1130
+ }}
1131
+ </option>
1132
+ </select>
1133
+
1134
+ <b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all" @change="toggleAll()">
1135
+ </b-form-checkbox>
1136
+ <input v-else class="form-control" v-model="internalFilterByProp(column.prop).value"
1137
+ :placeholder="column.label" @change="onChangeFilter($event)" />
1123
1138
 
1124
- <b-form-checkbox v-else-if="column.type == 'checkbox'" name="select-all" @change="toggleAll()">
1125
- </b-form-checkbox>
1126
- <input v-else class="form-control" v-model="internalFilterByProp(column.prop).value"
1127
- :placeholder="column.label" @change="onChangeFilter($event)" />
1139
+ </div>
1128
1140
  </slot>
1129
1141
 
1130
1142
  <span v-else>{{ column.label }}</span>
@@ -1315,7 +1327,7 @@ export default /*#__PURE__*/ {
1315
1327
  <b-overlay :show="loading" rounded="sm">
1316
1328
  <template v-if="validate">
1317
1329
  <form @submit="saveItem">
1318
- <slot name="form" v-bind:item="item">
1330
+ <slot name="form" v-bind:item="item" v-if="item">
1319
1331
  <b-form-group label="Nombre:" description="Nombre ">
1320
1332
  <b-form-input v-model="item.title" type="text" required placeholder="Nombre"></b-form-input>
1321
1333
  </b-form-group>
@@ -1326,9 +1338,9 @@ export default /*#__PURE__*/ {
1326
1338
  </form>
1327
1339
  </template>
1328
1340
  <template v-if="!validate">
1329
- <slot name="form" v-bind:item="item">
1330
- <b-form-group label="Nombre:" description="Nombre ">
1331
- <b-form-input v-model="item.title" type="text" required placeholder="Nombre"></b-form-input>
1341
+ <slot name="form" v-bind:item="item" v-if="item">
1342
+ <b-form-group :label="key" v-for="(value, key) in item" :key="key">
1343
+ <b-form-input v-model="item[key]" type="text" required></b-form-input>
1332
1344
  </b-form-group>
1333
1345
  </slot>
1334
1346
  <b-button block type="submit" variant="success" :disabled="loading" @click="saveItem()">
@@ -1338,8 +1350,15 @@ export default /*#__PURE__*/ {
1338
1350
  </b-overlay>
1339
1351
  </b-modal>
1340
1352
  <b-modal :id="'modal-show-item-' + modelName" hide-footer size="xl" :title="title" no-close-on-backdrop>
1341
- <slot name="show" v-bind:item="item">
1342
- <p class="my-4">Show</p>
1353
+ <slot name="show" v-bind:item="item" v-if="item">
1354
+ <b-list-group>
1355
+ <b-list-group-item v-for="(value, key) in item" :key="key">
1356
+ <b-row>
1357
+ <b-col cols="4" class="font-weight-bold">{{ key }}</b-col>
1358
+ <b-col cols="8">{{ JSON.stringify(value) }}</b-col>
1359
+ </b-row>
1360
+ </b-list-group-item>
1361
+ </b-list-group>
1343
1362
  </slot>
1344
1363
  </b-modal>
1345
1364
  </div>