@oniti/quasar-ui-vlank-collection-crud 3.7.42 → 3.7.44

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/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @oniti/quasar-ui-vlank-collection-crud v3.5.2
3
- * (c) 2022 Oniti
2
+ * @oniti/quasar-ui-vlank-collection-crud v3.7.42
3
+ * (c) 2024 Oniti
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -77,7 +77,8 @@
77
77
  }, props.props.modalDeleteOptions.dialog, {
78
78
  "transition-show": __props.isMobile ? 'slide-up' : 'fade',
79
79
  "transition-hide": __props.isMobile ? 'slide-down' : 'fade',
80
- position: __props.isMobile ? 'bottom' : 'standard',
80
+ "transition-duration": "150",
81
+ position: "standard",
81
82
  "full-width": __props.isMobile
82
83
  }), {
83
84
  default: vue.withCtx(function () { return [
@@ -153,7 +154,7 @@
153
154
  }, 16 /* FULL_PROPS */)
154
155
  ]; }),
155
156
  _: 3 /* FORWARDED */
156
- }, 16 /* FULL_PROPS */, ["modelValue", "transition-show", "transition-hide", "position", "full-width"]))
157
+ }, 16 /* FULL_PROPS */, ["modelValue", "transition-show", "transition-hide", "full-width"]))
157
158
  }
158
159
  }
159
160
 
@@ -165,7 +166,6 @@
165
166
  var _hoisted_2$3 = /*#__PURE__*/vue.createTextVNode("Modification");
166
167
 
167
168
 
168
-
169
169
  var script$4 = {
170
170
  __name: 'VlankEditModal',
171
171
  props: {
@@ -174,12 +174,15 @@
174
174
  modalEditOptions: Object,
175
175
  collection: String,
176
176
  extraRequestParams: Object,
177
+ useSendFiles: Boolean,
177
178
  storeKey: String,
178
179
  isMobile: Boolean,
180
+ closeModalAfterValidation: Boolean,
181
+ propsLibelleTitle: String,
179
182
  },
180
183
  emits: ['close'],
181
- setup: function setup(__props, ref) {
182
- var $emit = ref.emit;
184
+ setup: function setup(__props, ref$1) {
185
+ var $emit = ref$1.emit;
183
186
 
184
187
 
185
188
  var props = __props;
@@ -210,31 +213,75 @@
210
213
 
211
214
  function onConfirmeEditAdd() {
212
215
  var action = props.localDetail.uuid ? "update" : "create";
216
+ var message_notification = props.localDetail.uuid
217
+ ? "Modification effectuée"
218
+ : "Création effectuée";
213
219
  var extraParams =
214
220
  action === "update"
215
221
  ? Object.assign({}, props.extraRequestParams.update)
216
222
  : Object.assign({}, props.extraRequestParams.store);
217
- $collectionCrud
218
- .collectionAction({
219
- collectionName: props.collection,
220
- action: action,
221
- params: Object.assign({}, props.localDetail, extraParams),
222
- list_field: props.storeKey
223
- })
224
- .then(function (obj) {
225
- close(obj, action);
226
- });
223
+
224
+ if (props.useSendFiles) {
225
+ $collectionCrud
226
+ .collectionAction({
227
+ collectionName: props.collection,
228
+ action: "send-file",
229
+ params: Object.assign({}, props.localDetail, extraParams),
230
+ list_field: props.storeKey,
231
+ axios_options: {
232
+ oniti_success_notification_message: message_notification,
233
+ },
234
+ })
235
+ .then(function (obj) {
236
+ if (props.closeModalAfterValidation) {
237
+ close(obj, action);
238
+ }
239
+ });
240
+ } else {
241
+ $collectionCrud
242
+ .collectionAction({
243
+ collectionName: props.collection,
244
+ action: action,
245
+ params: Object.assign({}, props.localDetail, extraParams),
246
+ list_field: props.storeKey
247
+ })
248
+ .then(function (obj) {
249
+ if (props.closeModalAfterValidation) {
250
+ close(obj, action);
251
+ }
252
+ });
253
+ }
227
254
  }
228
255
 
229
256
  function close(obj, action) {
230
257
  $emit("close", { obj: obj, action: action });
231
258
  }
232
259
 
260
+ var modalContent = vue.ref(null);
261
+ var modalContentDetail = vue.ref(null);
262
+
263
+ var observer = new ResizeObserver(function (entries) {
264
+ entries.forEach(function (entry) {
265
+ scrollAreaStyle.value.height = props.isMobile ? '100vh' : entry.contentRect.height < 800 ? entry.contentRect.height + 'px' : '80vh';
266
+ });
267
+ });
268
+
269
+ var scrollAreaStyle = vue.ref({
270
+ height: props.isMobile ? '100vh' : modalContent.value ? modalContent.value.clientHeight < 800 ? modalContent.value.clientHeight + 'px' : '80vh' : '80vh'
271
+ });
272
+
273
+ vue.watch(modalContent, function (value) {
274
+ scrollAreaStyle.value.height = props.isMobile ? '100vh' : value ? value.clientHeight < 800 ? value.clientHeight + 'px' : '80vh' : '80vh';
275
+ if(modalContent.value){
276
+ observer.observe(modalContent.value);
277
+ }
278
+ }, { immediate: true, deep: true });
279
+
233
280
  return function (_ctx, _cache) {
234
281
  var _directive_close_popup = vue.resolveDirective("close-popup");
235
282
 
236
283
  return (vue.openBlock(), vue.createBlock(vue.unref(quasar.QDialog), vue.mergeProps({
237
- class: {'mobile-modal': __props.isMobile},
284
+ class: { 'mobile-modal': __props.isMobile },
238
285
  modelValue: vue.unref(editModalLocal),
239
286
  "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { return (vue.isRef(editModalLocal) ? (editModalLocal).value = $event : null); })
240
287
  }, props.modalEditOptions.dialog, {
@@ -247,7 +294,7 @@
247
294
  vue.createVNode(vue.unref(quasar.QCard), vue.mergeProps({ style: {"width":"700px","max-width":"80vw"} }, props.modalEditOptions.card), {
248
295
  default: vue.withCtx(function () { return [
249
296
  vue.createVNode(vue.unref(quasar.QToolbar), vue.mergeProps({
250
- class: "bg-primary",
297
+ class: __props.isMobile ?'mobile-toolbar bg-primary' : 'bg-primary',
251
298
  style: {"color":"#fff"}
252
299
  }, props.modalEditOptions.toolbar), {
253
300
  default: vue.withCtx(function () { return [
@@ -282,14 +329,17 @@
282
329
  _: 1 /* STABLE */
283
330
  }))
284
331
  : (
285
- props.propsLibelleTitle && props.localDetail[props.propsLibelleTitle]
286
- )
287
- ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QToolbarTitle), { key: 3 }, {
332
+ props.propsLibelleTitle && props.localDetail[props.propsLibelleTitle]
333
+ )
334
+ ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QToolbarTitle), {
335
+ key: 3,
336
+ class: vue.normalizeClass({ 'toolbar-title': __props.isMobile })
337
+ }, {
288
338
  default: vue.withCtx(function () { return [
289
- vue.createTextVNode(" Modification : " + vue.toDisplayString(props.localDetail[props.propsLibelleTitle]), 1 /* TEXT */)
339
+ vue.createTextVNode(vue.toDisplayString(!__props.isMobile ? 'Modification' : null) + " " + vue.toDisplayString(props.localDetail[props.propsLibelleTitle]), 1 /* TEXT */)
290
340
  ]; }),
291
341
  _: 1 /* STABLE */
292
- }))
342
+ }, 8 /* PROPS */, ["class"]))
293
343
  : (vue.openBlock(), vue.createBlock(vue.unref(quasar.QToolbarTitle), { key: 4 }, {
294
344
  default: vue.withCtx(function () { return [
295
345
  _hoisted_2$3
@@ -325,14 +375,30 @@
325
375
  ])
326
376
  ]; }),
327
377
  _: 3 /* FORWARDED */
328
- }, 16 /* FULL_PROPS */),
329
- vue.renderSlot(_ctx.$slots, "create-edit-modal-content", {
330
- data: props.localDetail
331
- }),
378
+ }, 16 /* FULL_PROPS */, ["class"]),
379
+ vue.createVNode(vue.unref(quasar.QScrollArea), {
380
+ style: vue.normalizeStyle(scrollAreaStyle.value)
381
+ }, {
382
+ default: vue.withCtx(function () { return [
383
+ vue.createElementVNode("div", {
384
+ class: vue.normalizeClass({'mobile-content': __props.isMobile }),
385
+ ref_key: "modalContent",
386
+ ref: modalContent
387
+ }, [
388
+ vue.renderSlot(_ctx.$slots, "create-edit-modal-content", {
389
+ data: props.localDetail,
390
+ ref_key: "modalContentDetail",
391
+ ref: modalContentDetail
392
+ })
393
+ ], 2 /* CLASS */)
394
+ ]; }),
395
+ _: 3 /* FORWARDED */
396
+ }, 8 /* PROPS */, ["style"]),
332
397
  (!__props.isMobile)
333
398
  ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QCardActions), {
334
399
  key: 0,
335
- align: "right"
400
+ align: "right",
401
+ class: "scroll"
336
402
  }, {
337
403
  default: vue.withCtx(function () { return [
338
404
  vue.renderSlot(_ctx.$slots, "create-edit-modal-custom-actions", {
@@ -400,7 +466,7 @@
400
466
  }
401
467
  }
402
468
 
403
- var css_248z$3 = ".mobile-modal .q-dialog__inner {\n padding: 0px !important;\n}";
469
+ var css_248z$3 = ".mobile-modal .q-dialog__inner {\n padding: 0px !important;\n}\n.mobile-modal .toolbar-title {\n font-size: 0.9rem;\n max-width: 19rem;\n}\n\n.mobile-toolbar {\n position: fixed;\n top: 0;\n z-index: 999;\n}\n\n.mobile-content {\n padding-top: 4rem;\n}";
404
470
  styleInject(css_248z$3);
405
471
 
406
472
  script$4.__file = "src/components/VlankEditModal.vue";
@@ -410,9 +476,11 @@
410
476
  props: {
411
477
  data: Object,
412
478
  colOptions: Object,
413
- props: Object
479
+ props: Object,
480
+ rowIndex: Number,
481
+ cellIndex: Number,
414
482
  },
415
- emits: ['update'],
483
+ emits: ['update', 'onEditCellHandler', 'onClickTabHandler'],
416
484
  setup: function setup(__props, ref$1) {
417
485
  var $emit = ref$1.emit;
418
486
 
@@ -428,9 +496,7 @@
428
496
 
429
497
  var getRawValue = vue.computed({
430
498
  get: function () {
431
- if (props.colOptions.format)
432
- { return props.colOptions.format(localDetail.value[props.colOptions.name]); }
433
- else { return localDetail.value[props.colOptions.name]; }
499
+ return localDetail.value[props.colOptions.name];
434
500
  },
435
501
  set: function (newValue) {
436
502
  localDetail.value[props.colOptions.name] = newValue;
@@ -463,13 +529,22 @@
463
529
  list_field: props.props.storeKey
464
530
  })
465
531
  .then(function (obj) {
466
- $emit("update", { obj: obj, action: "update" });
532
+ $emit("update", { obj: obj, action: "update", callback: function () {
533
+ $emit("onClickTabHandler", props.rowIndex, props.cellIndex);
534
+ }});
467
535
  });
468
536
  }
469
537
 
470
- return function (_ctx, _cache) {
471
- var _component_q_input = vue.resolveComponent("q-input");
538
+ function onEditCellHandler(field, value) {
539
+ $emit("onEditCellHandler", field, value);
540
+ }
472
541
 
542
+ function onClickTabHandler(event) {
543
+ var newValue = event.target.value;
544
+ $emit("onClickTabHandler", props.rowIndex, props.cellIndex, newValue != localValue.value);
545
+ }
546
+
547
+ return function (_ctx, _cache) {
473
548
  return (vue.openBlock(), vue.createElementBlock("td", null, [
474
549
  (localDetail.value[props.colOptions.name] && props.colOptions.type === 'boolean')
475
550
  ? vue.renderSlot(_ctx.$slots, getScopedSlotName('boolean-check', props.colOptions.name), { key: 0 }, function () { return [
@@ -487,18 +562,21 @@
487
562
  modelValue: localValue.value,
488
563
  "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { return ((localValue).value = $event); }),
489
564
  "auto-save": "",
490
- onSave: onSave
565
+ onSave: onSave,
566
+ onKeydown: vue.withKeys(vue.withModifiers(onClickTabHandler, ["prevent","stop"]), ["tab"])
491
567
  }, {
492
568
  default: vue.withCtx(function (scope) { return [
493
- vue.createVNode(_component_q_input, {
569
+ vue.createVNode(vue.unref(quasar.QInput), vue.mergeProps(props.colOptions.inputOptions, {
570
+ autofocus: "",
571
+ "emit-value": "",
494
572
  modelValue: scope.value,
495
- "onUpdate:modelValue": function ($event) { return ((scope.value) = $event); },
573
+ "onUpdate:modelValue": [function ($event) { return ((scope.value) = $event); }, function ($event) { return (onEditCellHandler(props.colOptions.field, scope.value)); }],
496
574
  label: props.colOptions.label,
497
575
  onKeyup: vue.withKeys(scope.set, ["enter"])
498
- }, null, 8 /* PROPS */, ["modelValue", "onUpdate:modelValue", "label", "onKeyup"])
576
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "onUpdate:modelValue", "label", "onKeyup"])
499
577
  ]; }),
500
578
  _: 1 /* STABLE */
501
- }, 8 /* PROPS */, ["modelValue"])
579
+ }, 8 /* PROPS */, ["modelValue", "onKeydown"])
502
580
  ]))
503
581
  }
504
582
  }
@@ -515,6 +593,7 @@
515
593
  collection: null,
516
594
  showBtnDelete: false,
517
595
  showBtnEdit: false,
596
+ showSlideLeft: false,
518
597
  showInputSearch: true,
519
598
  showBtnCreate: false,
520
599
  lazy: false,
@@ -541,6 +620,7 @@
541
620
  table: {
542
621
  title: "Titre Non défini",
543
622
  },
623
+ useSendFiles: false,
544
624
  extraRequestParams: {
545
625
  index: {},
546
626
  show: {},
@@ -567,10 +647,12 @@
567
647
  props.modalEditOptions);
568
648
  props.modalEditOptions.showBtn = Object.assign({}, defaultOptions.modalEditOptions.showBtn,
569
649
  props.modalEditOptions.showBtn);
650
+ var extraRequestParamsTemp = {};
570
651
  Object.keys(defaultOptions.extraRequestParams).forEach(function (key) {
571
- props.extraRequestParams[key] = Object.assign({}, defaultOptions.extraRequestParams[key],
652
+ extraRequestParamsTemp[key] = Object.assign({}, defaultOptions.extraRequestParams[key],
572
653
  props.extraRequestParams[key]);
573
654
  });
655
+ props.extraRequestParams = extraRequestParamsTemp;
574
656
  return props;
575
657
  });
576
658
 
@@ -676,7 +758,9 @@
676
758
  align: "left",
677
759
  sortable: true,
678
760
  type: "string",
761
+ classes: props.value.getRowCellClass,
679
762
  };
763
+
680
764
  // Option de la table par défaut
681
765
  var defautOptionsTable = {
682
766
  loading: $collectionCrud.getFromCollection(
@@ -688,7 +772,8 @@
688
772
  "row-key": function (row) { return config.columns
689
773
  .filter(function (c) { return c.name !== undefined || c.field !== undefined; })
690
774
  .map(function (c) { return row[c.name ? c.name : c.field]; })
691
- .join(); },
775
+ .join() +
776
+ row[$collectionCrud.getRouteParameterName(props.value.collection)]; },
692
777
  "rows-per-page-options": [20, 50, 100],
693
778
  };
694
779
 
@@ -784,7 +869,7 @@
784
869
  /**
785
870
  * Renvoie le nom de la route pour les liens de type A pour les édition en page
786
871
  */
787
- var collectionCreateNamedRoute = vue.computed(function () {
872
+ var collectionCreateNamedRoute = vue.computed(function () {
788
873
  return props.value.collection + "-store";
789
874
  });
790
875
 
@@ -797,6 +882,10 @@
797
882
  return typeof options.to === "function";
798
883
  }
799
884
 
885
+ function getAdditionalClassActionBtns(row) {
886
+ return props.value.getRowCellClass ? ' '+props.value.getRowCellClass(row) : "";
887
+ }
888
+
800
889
  return {
801
890
  customFields: customFields,
802
891
  table: table,
@@ -805,6 +894,7 @@
805
894
  collectionEditNamedRoute: collectionEditNamedRoute,
806
895
  collectionCreateNamedRoute: collectionCreateNamedRoute,
807
896
  isTdClickable: isTdClickable,
897
+ getAdditionalClassActionBtns: getAdditionalClassActionBtns,
808
898
  };
809
899
  }
810
900
 
@@ -1075,6 +1165,7 @@
1075
1165
  var rowsPerPage = ref.rowsPerPage;
1076
1166
  var sortBy = ref.sortBy;
1077
1167
  var descending = ref.descending;
1168
+
1078
1169
  var filter = options.filter;
1079
1170
  asyncProps.value = options;
1080
1171
 
@@ -1167,6 +1258,7 @@
1167
1258
  stringlifyAndCheck(newValue.index, extraRequestParamsIndexStringlify)
1168
1259
  ) {
1169
1260
  getList(true);
1261
+ extraRequestParamsIndexStringlify.value = JSON.stringify(newValue.index);
1170
1262
  }
1171
1263
  }
1172
1264
  });
@@ -1193,13 +1285,30 @@
1193
1285
  }
1194
1286
  }
1195
1287
 
1288
+ function useSelection(props)
1289
+ {
1290
+ var selectedData = vue.ref([]);
1291
+ var selectionMode = vue.ref(props.value.table.selection ? props.value.table.selection : 'none');
1292
+
1293
+ vue.watch(selectedData,function(){
1294
+ props.value.table.selected = selectedData.value;
1295
+ });
1296
+
1297
+ return {
1298
+ selectedData: selectedData,
1299
+ selectionMode: selectionMode,
1300
+ }
1301
+ }
1302
+
1196
1303
  var _hoisted_1$2 = { class: "col" };
1197
- var _hoisted_2$2 = ["props", "onClick"];
1198
- var _hoisted_3$2 = ["props", "onClick"];
1199
- var _hoisted_4$2 = { class: "top-right-content" };
1200
- var _hoisted_5$2 = { id: "search-slot" };
1201
- var _hoisted_6 = { id: "top-right-under-add" };
1202
- var _hoisted_7 = ["props"];
1304
+ var _hoisted_2$2 = { key: 1 };
1305
+ var _hoisted_3$2 = { key: 2 };
1306
+ var _hoisted_4$2 = ["props", "onClick"];
1307
+ var _hoisted_5$1 = ["props", "onClick"];
1308
+ var _hoisted_6 = { class: "top-right-content" };
1309
+ var _hoisted_7 = { id: "search-slot" };
1310
+ var _hoisted_8 = { id: "top-right-under-add" };
1311
+ var _hoisted_9 = ["props"];
1203
1312
 
1204
1313
 
1205
1314
  var script$2 = {
@@ -1210,7 +1319,12 @@
1210
1319
  propsLibelleTitle: String,
1211
1320
  showBtnDelete: Boolean,
1212
1321
  showBtnEdit: Boolean,
1322
+ showSlideLeft: Boolean,
1213
1323
  showBtnCreate: Boolean,
1324
+ showBtnCreateTooltip:{
1325
+ type: Boolean,
1326
+ default: false
1327
+ },
1214
1328
  storeKey: {
1215
1329
  type: String,
1216
1330
  default: 'list'
@@ -1245,6 +1359,7 @@
1245
1359
  type: Object,
1246
1360
  default: vue.ref({})
1247
1361
  },
1362
+ useSendFiles: Boolean,
1248
1363
  modalDeleteOptions: Object,
1249
1364
  modalEditOptions: Object,
1250
1365
  persistTableOptions: Object,
@@ -1254,11 +1369,22 @@
1254
1369
  type: Function,
1255
1370
  default: function (row, type) { return true; }
1256
1371
  },
1372
+ closeModalAfterValidation: {
1373
+ type: Boolean,
1374
+ default: true
1375
+ },
1376
+ getRowCellClass: {
1377
+ type: Function,
1378
+ default: null
1379
+ },
1257
1380
  },
1258
1381
  emits: [
1259
1382
  "detailChange",
1260
1383
  "modalOpenCreateUpdate",
1261
- "actionsCallback" ],
1384
+ "actionsCallback",
1385
+ "actionsSlideLeft",
1386
+ "onEditCellHandler"
1387
+ ],
1262
1388
  setup: function setup(__props, ref$1) {
1263
1389
  var $emit = ref$1.emit;
1264
1390
 
@@ -1272,8 +1398,20 @@
1272
1398
  var ccrudTable = vue.ref(null);
1273
1399
 
1274
1400
  var $q = quasar.useQuasar();
1401
+
1402
+ var mobileColumn = vue.computed(function () {
1403
+ if ($attrs.table.columns.filter(function (column) { return column.displayMobile; }).length > 1) {
1404
+ throw new Error("Merci de ne saisir qu'une seule colonne en displayMobile.");
1405
+ }
1406
+ return $attrs.table.columns.filter(function (column) { return column.displayMobile; })[0]
1407
+ });
1408
+
1275
1409
  var isMobile = vue.computed(function () {
1276
- return $q.screen.lt.md
1410
+ if ($q.config.collectionCrudOptions && $q.config.collectionCrudOptions.maximalMobileScreenSize) {
1411
+ return !!$q.screen.lt[$q.config.collectionCrudOptions.maximalMobileScreenSize]
1412
+ } else {
1413
+ return $q.screen.lt.md
1414
+ }
1277
1415
  });
1278
1416
 
1279
1417
  var $collectionCrud = vue.inject('vlank-ccrud');
@@ -1307,18 +1445,19 @@
1307
1445
  var collectionEditNamedRoute = ref$4.collectionEditNamedRoute;
1308
1446
  var collectionCreateNamedRoute = ref$4.collectionCreateNamedRoute;
1309
1447
  var isTdClickable = ref$4.isTdClickable;
1448
+ var getAdditionalClassActionBtns = ref$4.getAdditionalClassActionBtns;
1310
1449
 
1311
1450
  var ref$5 = usePagination(props);
1312
1451
  var pagination = ref$5.pagination;
1313
1452
 
1314
1453
  useSaveAndExportTable(props, pagination, filter);
1315
1454
 
1316
- function getlocalDetailValue(){
1317
- if($attrs.defaultValues instanceof Object){
1455
+ function getlocalDetailValue() {
1456
+ if ($attrs.defaultValues instanceof Object) {
1318
1457
  return $attrs.defaultValues
1319
- }else if($collectionCrud.getFromCollection(props.value.collection, 'detail')){
1458
+ } else if ($collectionCrud.getFromCollection(props.value.collection, 'detail')) {
1320
1459
  return $collectionCrud.getFromCollection(props.value.collection, 'detail')
1321
- }else {
1460
+ } else {
1322
1461
  return {}
1323
1462
  }
1324
1463
  }
@@ -1338,6 +1477,10 @@
1338
1477
  var onCloseEditModal = ref$7.onCloseEditModal;
1339
1478
  var onCloseDeleteModal = ref$7.onCloseDeleteModal;
1340
1479
 
1480
+ var ref$8 = useSelection(props);
1481
+ var selectedData = ref$8.selectedData;
1482
+ var selectionMode = ref$8.selectionMode;
1483
+
1341
1484
 
1342
1485
  useWatchs($attrs, getList, pagination, ccrudTable);
1343
1486
 
@@ -1346,8 +1489,101 @@
1346
1489
  return baseSlotName + "-" + field;
1347
1490
  }
1348
1491
 
1492
+ // Partie sliderItem pour Mobile
1493
+ var timer;
1494
+ var mobileSlideItem = vue.ref(null);
1495
+ function finalize(reset) {
1496
+ clearTimeout(timer);
1497
+ timer = setTimeout(function () {
1498
+ reset();
1499
+ }, 50);
1500
+ }
1501
+ vue.onBeforeUnmount(function () {
1502
+ clearTimeout(timer);
1503
+ });
1504
+ function onClickRow(row) {
1505
+ onClickEdit(row);
1506
+ }
1507
+ function onSlideLeft(details, row) {
1508
+ $emit("actionsSlideLeft", details, row);
1509
+ finalize(details.reset);
1510
+ resetSlideItemsVisibility('q-slide-item__left');
1511
+ }
1512
+ function onSlideRight(ref, row) {
1513
+ var reset = ref.reset;
1514
+
1515
+ onClickDelete(row);
1516
+ finalize(reset);
1517
+ resetSlideItemsVisibility('q-slide-item__right');
1518
+ }
1519
+ function onSlide(ref) {
1520
+ ref.side;
1521
+ ref.ratio;
1522
+ var isReset = ref.isReset;
1523
+
1524
+ clearTimeout(timer);
1525
+ if (isReset) {
1526
+ resetSlideItemsVisibility('q-slide-item__left');
1527
+ resetSlideItemsVisibility('q-slide-item__right');
1528
+ }
1529
+ }
1530
+ function resetSlideItemsVisibility(slideItemClass) {
1531
+ for (var index = 0; index < document.getElementsByClassName(slideItemClass).length; index++) {
1532
+ document.getElementsByClassName(slideItemClass)[index].style.visibility = 'hidden';
1533
+ }
1534
+ }
1535
+
1536
+ function onEditCellHandler(field, value) {
1537
+ $emit("onEditCellHandler", field, value);
1538
+ }
1539
+
1540
+ // Gestion de la tabulation dans le tableau
1541
+ var popupCells = vue.ref([]);
1542
+
1543
+ var delayNextTabOption = vue.ref(null);
1544
+ vue.watch(rows, function (newValue, oldValue) {
1545
+ if (delayNextTabOption.value) {
1546
+ setTimeout(function () {
1547
+ if (delayNextTabOption.value) {
1548
+ onClickTabHandler(delayNextTabOption.value.rowIndex, delayNextTabOption.value.cellIndex, false, false);
1549
+ }
1550
+ }, 400);
1551
+ }
1552
+ }, { deep: true });
1553
+
1554
+ function onClickTabHandler(rowIndex, cellIndex, updated, openPrevious) {
1555
+ if ( updated === void 0 ) updated = false;
1556
+ if ( openPrevious === void 0 ) openPrevious = true;
1557
+
1558
+ if (openPrevious) {
1559
+ popupCells.value[rowIndex + '_' + cellIndex].$el.click();
1560
+ }
1561
+ if (updated) {
1562
+ delayNextTabOption.value = {
1563
+ rowIndex: rowIndex,
1564
+ cellIndex: cellIndex
1565
+ };
1566
+ } else {
1567
+ delayNextTabOption.value = null;
1568
+ popupCells.value[getNextCellIndex(rowIndex, cellIndex)].$el.click();
1569
+ }
1570
+ }
1571
+ function getRowIndex(row) {
1572
+ return rows.value.indexOf(row);
1573
+ }function getNextCellIndex(rowIndex, cellIndex) {
1574
+ if (getEditablesTd.value.length > parseInt(cellIndex) + 1) {
1575
+ return rowIndex + '_' + (parseInt(cellIndex) + 1)
1576
+ } else {
1577
+ return (parseInt(rowIndex) + 1) + '_' + 0
1578
+ }
1579
+ }
1580
+ function onClearSearchHandler() {
1581
+ filter.value = "";
1582
+ }
1349
1583
 
1350
1584
  return function (_ctx, _cache) {
1585
+ var _component_q_tooltip = vue.resolveComponent("q-tooltip");
1586
+
1351
1587
  return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
1352
1588
  vue.createVNode(vue.unref(quasar.QTable), vue.mergeProps({
1353
1589
  flat: "",
@@ -1355,10 +1591,13 @@
1355
1591
  }, vue.unref(table), {
1356
1592
  filter: filter.value,
1357
1593
  onRequest: vue.unref(asyncRequest),
1594
+ ref_key: "ccrudTable",
1595
+ ref: ccrudTable,
1358
1596
  pagination: vue.unref(pagination),
1359
1597
  "onUpdate:pagination": _cache[1] || (_cache[1] = function ($event) { return (vue.isRef(pagination) ? (pagination).value = $event : null); }),
1360
- ref_key: "ccrudTable",
1361
- ref: ccrudTable
1598
+ selection: vue.unref(selectionMode),
1599
+ selected: vue.unref(selectedData),
1600
+ "onUpdate:selected": _cache[2] || (_cache[2] = function ($event) { return (vue.isRef(selectedData) ? (selectedData).value = $event : null); })
1362
1601
  }), vue.createSlots({
1363
1602
  "top-left": vue.withCtx(function () { return [
1364
1603
  vue.createElementVNode("div", null, [
@@ -1366,8 +1605,8 @@
1366
1605
  ])
1367
1606
  ]; }),
1368
1607
  "top-right": vue.withCtx(function () { return [
1369
- vue.createElementVNode("div", _hoisted_4$2, [
1370
- vue.createElementVNode("div", _hoisted_5$2, [
1608
+ vue.createElementVNode("div", _hoisted_6, [
1609
+ vue.createElementVNode("div", _hoisted_7, [
1371
1610
  (vue.unref(showInputSearch))
1372
1611
  ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QInput), {
1373
1612
  key: 0,
@@ -1376,16 +1615,27 @@
1376
1615
  modelValue: filter.value,
1377
1616
  "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { return ((filter).value = $event); }),
1378
1617
  placeholder: "Recherche",
1379
- filled: "",
1380
- "bg-color": "grey-2",
1381
- square: "",
1618
+ outlined: "",
1619
+ rounded: vue.unref(isMobile),
1382
1620
  style: {"width":"180px"}
1383
1621
  }, {
1384
1622
  append: vue.withCtx(function () { return [
1385
- vue.createVNode(vue.unref(quasar.QIcon), { name: "search" })
1623
+ (filter.value)
1624
+ ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QBtn), {
1625
+ key: 0,
1626
+ dense: "",
1627
+ flat: "",
1628
+ round: "",
1629
+ icon: "mdi-close",
1630
+ onClick: onClearSearchHandler
1631
+ }))
1632
+ : (vue.openBlock(), vue.createBlock(vue.unref(quasar.QIcon), {
1633
+ key: 1,
1634
+ name: "search"
1635
+ }))
1386
1636
  ]; }),
1387
1637
  _: 1 /* STABLE */
1388
- }, 8 /* PROPS */, ["modelValue"]))
1638
+ }, 8 /* PROPS */, ["modelValue", "rounded"]))
1389
1639
  : vue.createCommentVNode("v-if", true),
1390
1640
  (vue.unref(showBtnCreatePage))
1391
1641
  ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QBtn), {
@@ -1397,7 +1647,19 @@
1397
1647
  color: "primary",
1398
1648
  style: {"margin-left":"1em"},
1399
1649
  square: ""
1400
- }, null, 8 /* PROPS */, ["to", "label"]))
1650
+ }, {
1651
+ default: vue.withCtx(function () { return [
1652
+ (__props.showBtnCreateTooltip)
1653
+ ? (vue.openBlock(), vue.createBlock(_component_q_tooltip, { key: 0 }, {
1654
+ default: vue.withCtx(function () { return [
1655
+ vue.renderSlot(_ctx.$slots, "create-btn-tooltip")
1656
+ ]; }),
1657
+ _: 3 /* FORWARDED */
1658
+ }))
1659
+ : vue.createCommentVNode("v-if", true)
1660
+ ]; }),
1661
+ _: 3 /* FORWARDED */
1662
+ }, 8 /* PROPS */, ["to", "label"]))
1401
1663
  : (vue.unref(showBtnCreate))
1402
1664
  ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QBtn), {
1403
1665
  key: 2,
@@ -1407,11 +1669,23 @@
1407
1669
  style: {"margin-left":"1em"},
1408
1670
  onClick: vue.unref(onClickAdd),
1409
1671
  square: ""
1410
- }, null, 8 /* PROPS */, ["label", "onClick"]))
1672
+ }, {
1673
+ default: vue.withCtx(function () { return [
1674
+ (__props.showBtnCreateTooltip)
1675
+ ? (vue.openBlock(), vue.createBlock(_component_q_tooltip, { key: 0 }, {
1676
+ default: vue.withCtx(function () { return [
1677
+ vue.renderSlot(_ctx.$slots, "create-btn-tooltip")
1678
+ ]; }),
1679
+ _: 3 /* FORWARDED */
1680
+ }))
1681
+ : vue.createCommentVNode("v-if", true)
1682
+ ]; }),
1683
+ _: 3 /* FORWARDED */
1684
+ }, 8 /* PROPS */, ["label", "onClick"]))
1411
1685
  : vue.createCommentVNode("v-if", true),
1412
1686
  vue.renderSlot(_ctx.$slots, "top-right-after-add")
1413
1687
  ]),
1414
- vue.createElementVNode("div", _hoisted_6, [
1688
+ vue.createElementVNode("div", _hoisted_8, [
1415
1689
  vue.renderSlot(_ctx.$slots, "top-right-under-add")
1416
1690
  ])
1417
1691
  ])
@@ -1422,7 +1696,7 @@
1422
1696
  return [
1423
1697
  vue.createElementVNode("td", {
1424
1698
  props: props,
1425
- class: "action-buttons"
1699
+ class: vue.normalizeClass('action-buttons' + vue.unref(getAdditionalClassActionBtns)(props.row))
1426
1700
  }, [
1427
1701
  vue.renderSlot(_ctx.$slots, "row-action-before-controllers", {
1428
1702
  key: 0,
@@ -1442,24 +1716,18 @@
1442
1716
  ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QBtn), {
1443
1717
  key: 2,
1444
1718
  type: "a",
1445
- to: {
1446
- name: vue.unref(collectionEditNamedRoute),
1447
- params: ( obj = {}, obj[vue.unref(route_parameter_name)] = props.row[vue.unref(route_parameter_name)], obj ),
1448
- },
1719
+ to: { name: vue.unref(collectionEditNamedRoute), params: ( obj = {}, obj[vue.unref(route_parameter_name)] = props.row[vue.unref(route_parameter_name)], obj ) },
1449
1720
  color: "primary",
1450
1721
  icon: "edit",
1451
1722
  flat: "",
1452
1723
  round: vue.unref(isMobile)
1453
1724
  }, null, 8 /* PROPS */, ["to", "round"]))
1454
1725
  : vue.createCommentVNode("v-if", true),
1455
- (!__props.editablePage && __props.displayActionCallback(props.row, 'show'))
1726
+ (!__props.editablePage && vue.unref(showBtnEditPage) && __props.displayActionCallback(props.row, 'show'))
1456
1727
  ? (vue.openBlock(), vue.createBlock(vue.unref(quasar.QBtn), {
1457
1728
  key: 3,
1458
1729
  type: "a",
1459
- to: {
1460
- name: vue.unref(collectionEditNamedRoute),
1461
- params: ( obj$1 = {}, obj$1[vue.unref(route_parameter_name)] = props.row[vue.unref(route_parameter_name)], obj$1 ),
1462
- },
1730
+ to: { name: vue.unref(collectionEditNamedRoute), params: ( obj$1 = {}, obj$1[vue.unref(route_parameter_name)] = props.row[vue.unref(route_parameter_name)], obj$1 ) },
1463
1731
  color: "primary",
1464
1732
  icon: "mdi-magnify-plus-outline",
1465
1733
  flat: ""
@@ -1478,11 +1746,98 @@
1478
1746
  vue.renderSlot(_ctx.$slots, "row-action-after-controllers", {
1479
1747
  data: props.row
1480
1748
  })
1481
- ], 8 /* PROPS */, _hoisted_7)
1749
+ ], 10 /* CLASS, PROPS */, _hoisted_9)
1482
1750
  ];
1483
1751
  }),
1484
1752
  _: 2 /* DYNAMIC */
1485
1753
  }, [
1754
+ (vue.unref(isMobile))
1755
+ ? {
1756
+ name: "header",
1757
+ fn: vue.withCtx(function (props) { return []; })
1758
+ }
1759
+ : undefined,
1760
+ (vue.unref(isMobile))
1761
+ ? {
1762
+ name: "body",
1763
+ fn: vue.withCtx(function (props) { return [
1764
+ vue.createVNode(vue.unref(quasar.QSlideItem), {
1765
+ ref_key: "mobileSlideItem",
1766
+ ref: mobileSlideItem,
1767
+ onLeft: function (element) { return onSlideLeft(element, props.row); },
1768
+ onRight: function (element) { return onSlideRight(element, props.row); },
1769
+ onSlide: onSlide,
1770
+ reset: "",
1771
+ "right-color": "negative",
1772
+ "left-color": "accent"
1773
+ }, vue.createSlots({
1774
+ default: vue.withCtx(function () { return [
1775
+ vue.createVNode(vue.unref(quasar.QItem), {
1776
+ style: {"align-items":"center"},
1777
+ class: vue.normalizeClass('mobile-item' + vue.unref(getAdditionalClassActionBtns)(props.row))
1778
+ }, {
1779
+ default: vue.withCtx(function () { return [
1780
+ vue.createCommentVNode(" On affiche la première colonne seulement et on garde celle des actions "),
1781
+ vue.createVNode(vue.unref(quasar.QItemSection), {
1782
+ class: "mobile-item-content",
1783
+ onClick: function ($event) { return (vue.unref(showBtnEdit) ? onClickRow(props.row) : ''); }
1784
+ }, {
1785
+ default: vue.withCtx(function () { return [
1786
+ (vue.unref($slots)['body-cell-mobile'])
1787
+ ? vue.renderSlot(_ctx.$slots, "body-cell-mobile", {
1788
+ key: 0,
1789
+ data: props.row,
1790
+ class: "body-cell-mobile"
1791
+ })
1792
+ : (vue.unref(mobileColumn))
1793
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$2, vue.toDisplayString(props.cols.filter(function (col) { return col.name === vue.unref(mobileColumn).name; })[0].value), 1 /* TEXT */))
1794
+ : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$2, vue.toDisplayString(props.cols[0].value), 1 /* TEXT */))
1795
+ ]; }),
1796
+ _: 2 /* DYNAMIC */
1797
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onClick"]),
1798
+ vue.createVNode(vue.unref(quasar.QItemSection), {
1799
+ style: {"display":"flex","flex-direction":"row","align-items":"center"},
1800
+ side: ""
1801
+ }, {
1802
+ default: vue.withCtx(function () { return [
1803
+ vue.renderSlot(_ctx.$slots, "row-action-before-controllers", {
1804
+ key: 0,
1805
+ data: props.row
1806
+ })
1807
+
1808
+ ]; }),
1809
+ _: 2 /* DYNAMIC */
1810
+ }, 1024 /* DYNAMIC_SLOTS */)
1811
+ ]; }),
1812
+ _: 2 /* DYNAMIC */
1813
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class"])
1814
+ ]; }),
1815
+ _: 2 /* DYNAMIC */
1816
+ }, [
1817
+ (__props.showSlideLeft)
1818
+ ? {
1819
+ name: "left",
1820
+ fn: vue.withCtx(function () { return [
1821
+ vue.renderSlot(_ctx.$slots, "content-slider-left", {
1822
+ data: props.row
1823
+ }, function () { return [
1824
+ vue.createVNode(vue.unref(quasar.QIcon), { name: "mdi-pencil" })
1825
+ ]; })
1826
+ ]; })
1827
+ }
1828
+ : undefined,
1829
+ (vue.unref(showBtnDelete))
1830
+ ? {
1831
+ name: "right",
1832
+ fn: vue.withCtx(function () { return [
1833
+ vue.createVNode(vue.unref(quasar.QIcon), { name: "mdi-delete" })
1834
+ ]; })
1835
+ }
1836
+ : undefined
1837
+ ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["onLeft", "onRight"])
1838
+ ]; })
1839
+ }
1840
+ : undefined,
1486
1841
  vue.renderList(vue.unref(customFields), function (options) {
1487
1842
  return {
1488
1843
  name: options.slotName,
@@ -1491,7 +1846,7 @@
1491
1846
  ? (vue.openBlock(), vue.createElementBlock("td", {
1492
1847
  props: props,
1493
1848
  key: options.slotName,
1494
- class: vue.normalizeClass(vue.unref(isTdClickable)(options) ? 'cursor-pointer' : ''),
1849
+ class: vue.normalizeClass((vue.unref(isTdClickable)(options) ? 'cursor-pointer' : '') + vue.unref(getAdditionalClassActionBtns)(props.row)),
1495
1850
  onClick: function ($event) { return (vue.unref(isTdClickable)(options) ? options.to(props.row) : null); }
1496
1851
  }, [
1497
1852
  (props.row[options.field])
@@ -1509,15 +1864,15 @@
1509
1864
  key: 1,
1510
1865
  data: props.row
1511
1866
  })
1512
- ], 10 /* CLASS, PROPS */, _hoisted_2$2))
1867
+ ], 10 /* CLASS, PROPS */, _hoisted_4$2))
1513
1868
  : (vue.openBlock(), vue.createElementBlock("td", {
1514
1869
  props: props,
1515
1870
  key: options.slotName + '-else',
1516
- class: "cursor-pointer",
1871
+ class: vue.normalizeClass('cursor-pointer' + vue.unref(getAdditionalClassActionBtns)(props.row)),
1517
1872
  onClick: function ($event) { return (options.to(props.row)); }
1518
1873
  }, vue.toDisplayString(options.format
1519
1874
  ? options.format(props.row)
1520
- : props.row[options.field]), 9 /* TEXT, PROPS */, _hoisted_3$2))
1875
+ : props.row[options.field]), 11 /* TEXT, CLASS, PROPS */, _hoisted_5$1))
1521
1876
  ]; })
1522
1877
  }
1523
1878
  }),
@@ -1529,17 +1884,22 @@
1529
1884
  ]; })
1530
1885
  }
1531
1886
  }),
1532
- vue.renderList(vue.unref(getEditablesTd), function (config) {
1887
+ vue.renderList(vue.unref(getEditablesTd), function (config, index) {
1533
1888
  return {
1534
1889
  name: config.slotName,
1535
1890
  fn: vue.withCtx(function (slotProps) { return [
1536
1891
  (vue.unref(editOnTable))
1537
1892
  ? (vue.openBlock(), vue.createBlock(script$3, {
1893
+ ref: function (el) { popupCells.value[getRowIndex(slotProps.row) + '_' + index] = el; },
1538
1894
  key: config.slotName,
1895
+ rowIndex: getRowIndex(slotProps.row),
1896
+ cellIndex: index,
1539
1897
  data: slotProps.row,
1540
1898
  props: vue.unref(props),
1541
1899
  colOptions: config.options,
1542
- onUpdate: vue.unref(onUpdateTd)
1900
+ onUpdate: vue.unref(onUpdateTd),
1901
+ onOnEditCellHandler: onEditCellHandler,
1902
+ onOnClickTabHandler: onClickTabHandler
1543
1903
  }, vue.createSlots({ _: 2 /* DYNAMIC */ }, [
1544
1904
  vue.renderList(vue.unref($slots), function (_, slot) {
1545
1905
  return {
@@ -1549,12 +1909,12 @@
1549
1909
  ]; })
1550
1910
  }
1551
1911
  })
1552
- ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["data", "props", "colOptions", "onUpdate"]))
1912
+ ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["rowIndex", "cellIndex", "data", "props", "colOptions", "onUpdate"]))
1553
1913
  : vue.createCommentVNode("v-if", true)
1554
1914
  ]; })
1555
1915
  }
1556
1916
  })
1557
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["rows", "filter", "onRequest", "pagination"]),
1917
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["rows", "filter", "onRequest", "pagination", "selection", "selected"]),
1558
1918
  vue.createCommentVNode(" Modal de Confirmation Suppression "),
1559
1919
  vue.createVNode(script$5, {
1560
1920
  localDetail: localDetail.value,
@@ -1581,45 +1941,59 @@
1581
1941
  vue.createVNode(script$4, vue.mergeProps({ localDetail: localDetail.value }, vue.unref(props), {
1582
1942
  editModal: editModal.value,
1583
1943
  onClose: vue.unref(onCloseEditModal),
1584
- isMobile: vue.unref(isMobile)
1944
+ isMobile: vue.unref(isMobile),
1945
+ closeModalAfterValidation: __props.closeModalAfterValidation,
1946
+ propsLibelleTitle: __props.propsLibelleTitle
1585
1947
  }), vue.createSlots({ _: 2 /* DYNAMIC */ }, [
1586
1948
  vue.renderList(vue.unref($slots), function (_, slot) {
1587
1949
  return {
1588
1950
  name: slot,
1589
1951
  fn: vue.withCtx(function (scope) { return [
1590
1952
  (vue.openBlock(), vue.createElementBlock("div", {
1591
- class: "modal-content",
1953
+ class: vue.normalizeClass(vue.unref(isMobile) ? 'mobile-content modal-content' : 'modal-content'),
1592
1954
  key: slot
1593
1955
  }, [
1594
1956
  vue.renderSlot(_ctx.$slots, slot, vue.normalizeProps(vue.guardReactiveProps(scope)))
1595
- ]))
1957
+ ], 2 /* CLASS */))
1596
1958
  ]; })
1597
1959
  }
1598
1960
  })
1599
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["localDetail", "editModal", "onClose", "isMobile"])
1961
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["localDetail", "editModal", "onClose", "isMobile", "closeModalAfterValidation", "propsLibelleTitle"])
1600
1962
  ]))
1601
1963
  }
1602
1964
  }
1603
1965
 
1604
1966
  };
1605
1967
 
1606
- var css_248z$2 = "\n.action-buttons[data-v-60881ef8] {\n text-align: end;\n}\n.modal-content[data-v-60881ef8] {\n padding: 15px;\n}\n.q-table-control[data-v-60881ef8] {\n flex: 0 1 55%;\n}\n#search-slot[data-v-60881ef8] {\n display: flex;\n}\n#top-right-under-add[data-v-60881ef8] {\n margin-top: 20px;\n display: flex;\n flex-direction: column;\n}\n";
1968
+ var css_248z$2 = "\n.action-buttons[data-v-60881ef8] {\n text-align: end;\n}\n.modal-content[data-v-60881ef8] {\n padding: 15px;\n}\n.q-table-control[data-v-60881ef8] {\n flex: 0 1 55%;\n}\n#search-slot[data-v-60881ef8] {\n display: flex;\n align-items: center;\n}\n#top-right-under-add[data-v-60881ef8] {\n margin-top: 20px;\n display: flex;\n flex-direction: column;\n}\n.mobile-item[data-v-60881ef8] {\n min-height: 8.5vh;\n border-bottom: solid 1px lightgrey;\n}\n.mobile-item-content>span[data-v-60881ef8] {\n word-break: break-all;\n}\n.body-cell-mobile[data-v-60881ef8] {\n word-break: break-all;\n}\n";
1607
1969
  styleInject(css_248z$2);
1608
1970
 
1609
1971
  script$2.__scopeId = "data-v-60881ef8";
1610
1972
  script$2.__file = "src/components/VlankCollectionCrud.vue";
1611
1973
 
1612
- var _hoisted_1$1 = {
1613
- key: 0,
1614
- class: "edit-page-header"
1615
- };
1616
- var _hoisted_2$1 = { style: {"display":"flex","align-items":"center"} };
1617
- var _hoisted_3$1 = { key: 0 };
1618
- var _hoisted_4$1 = {
1974
+ function onClickBack(route, router) {
1975
+ if(!route || !route.meta) {
1976
+ router.go(-1);
1977
+ return;
1978
+ }
1979
+ var localStorageRoute = localStorage.getItem(route.meta.goBackRoute);
1980
+ if (localStorageRoute) {
1981
+ router.push(localStorageRoute);
1982
+ localStorage.removeItem(route.meta.goBackRoute);
1983
+ } else if (route.meta.mainParentRoutePath) {
1984
+ router.push(route.meta.mainParentRoutePath);
1985
+ } else {
1986
+ router.go(-1);
1987
+ }
1988
+ }
1989
+
1990
+ var _hoisted_1$1 = { style: {"display":"flex","align-items":"center"} };
1991
+ var _hoisted_2$1 = { key: 0 };
1992
+ var _hoisted_3$1 = {
1619
1993
  key: 1,
1620
1994
  class: "edit-page-body"
1621
1995
  };
1622
- var _hoisted_5$1 = {
1996
+ var _hoisted_4$1 = {
1623
1997
  key: 2,
1624
1998
  class: "edit-page-body"
1625
1999
  };
@@ -1633,12 +2007,17 @@
1633
2007
  var $emit = ref$1.emit;
1634
2008
 
1635
2009
 
1636
- var router = vueRouter.useRouter();
1637
2010
  var route = vueRouter.useRoute();
2011
+ var router = vueRouter.useRouter();
1638
2012
  var store = vuex.useStore();
1639
2013
  var collectionCrud = vue.inject('vlank-ccrud');
1640
2014
 
1641
2015
 
2016
+ function onClickBackTemplate(){
2017
+ onClickBack(route, router);
2018
+ }
2019
+
2020
+
1642
2021
 
1643
2022
  var localDetail = vue.ref(null);
1644
2023
  var containerMode = vue.ref(route.meta.containerMode);
@@ -1666,13 +2045,6 @@
1666
2045
  : { label: "Valider", icon: "mdi-check" };
1667
2046
  });
1668
2047
 
1669
- var onClickBack = function () {
1670
- if (route.meta.mainParentRoutePath) {
1671
- router.push(route.meta.mainParentRoutePath);
1672
- } else {
1673
- router.go(-1);
1674
- }
1675
- };
1676
2048
  var onCustomTitle = function (title) {
1677
2049
  customTitle.value = title;
1678
2050
  };
@@ -1689,20 +2061,48 @@
1689
2061
  var onExtraRequestParams = function (extraRequestParamsValue) {
1690
2062
  if (extraRequestParamsValue) { extraRequestParams.value = extraRequestParamsValue; }
1691
2063
  };
2064
+
2065
+ var submitLoading = vue.ref(false);
1692
2066
  var onClickSubmit = function () {
1693
- collectionCrud
2067
+ submitLoading.value = true;
2068
+ if (route.meta.useSendFiles) {
2069
+ collectionCrud
2070
+ .collectionAction({
2071
+ collectionName: route.meta.collection,
2072
+ action: "send-file",
2073
+ params: Object.assign({}, localDetail.value, extraRequestParams.value),
2074
+ axios_options: {
2075
+ oniti_success_notification_message: 'Modification effectuée'
2076
+ },
2077
+ })
2078
+ .then(function (obj) {
2079
+ submitCallback(obj);
2080
+ }).finally(function () {
2081
+ submitLoading.value = false;
2082
+ });
2083
+ } else {
2084
+ collectionCrud
1694
2085
  .collectionAction({
1695
2086
  collectionName: route.meta.collection,
1696
2087
  action: "update",
1697
2088
  params: Object.assign({}, localDetail.value, extraRequestParams.value),
1698
2089
  })
1699
2090
  .then(function (obj) {
1700
- if (route.meta.goBackAfterValidation) {
1701
- onClickBack();
1702
- }
1703
- localDetail.value = obj;
2091
+ submitCallback(obj);
2092
+ }).finally(function () {
2093
+ submitLoading.value = false;
1704
2094
  });
2095
+ }
1705
2096
  };
2097
+
2098
+ function submitCallback(obj) {
2099
+ if (route.meta.goBackAfterValidation) {
2100
+ onClickBack(route, router);
2101
+ }
2102
+ localDetail.value = JSON.parse(JSON.stringify(obj));
2103
+ previousLocalDetail.value = JSON.parse(JSON.stringify(obj));
2104
+ }
2105
+
1706
2106
  var onSubscribe = function (mutation, state) {
1707
2107
 
1708
2108
  if (
@@ -1714,15 +2114,27 @@
1714
2114
  }
1715
2115
  };
1716
2116
 
1717
- vue.onMounted(function () {
2117
+ var route_parameter_name = collectionCrud.getRouteParameterName(route.meta.collection);
2118
+ var actual_route = route;
2119
+ var actual_collection = vue.ref(route.meta.collection);
2120
+ vue.watch(router.currentRoute,function (new_current_route, old_current_route ) {
2121
+ if(new_current_route.meta.collection){
2122
+ actual_route = new_current_route;
2123
+ route_parameter_name = collectionCrud.getRouteParameterName(new_current_route.meta.collection);
2124
+ propsLibelleTitle.value = new_current_route.meta.propsLibelleTitle;
2125
+ actual_collection.value = new_current_route.meta.collection;
2126
+ fetchDetail();
2127
+ }
2128
+ },{deep:true});
2129
+
2130
+ function fetchDetail(){
1718
2131
  var obj;
1719
2132
 
1720
2133
  if (!containerMode.value) {
1721
- var parameter_route_value = route.params[route_parameter_name];
1722
-
2134
+ var parameter_route_value = actual_route.params[route_parameter_name];
1723
2135
  collectionCrud
1724
2136
  .collectionAction({
1725
- collectionName: route.meta.collection,
2137
+ collectionName: actual_route.meta.collection,
1726
2138
  action: "detail",
1727
2139
  lazy: true,
1728
2140
  params: ( obj = {}, obj[route_parameter_name] = parameter_route_value, obj ),
@@ -1731,7 +2143,24 @@
1731
2143
  localDetail.value = Object.assign({}, obj);
1732
2144
  $emit("collectionCrudUpdateLocalDetail", localDetail.value);
1733
2145
  });
2146
+ }else {
2147
+ localDetail.value = null;
1734
2148
  }
2149
+ }
2150
+
2151
+ var isLocalDetailUpdated = vue.ref(false);
2152
+ var previousLocalDetail = vue.ref(null);
2153
+
2154
+ vue.watch(localDetail, function (newVal) {
2155
+ if (newVal && !previousLocalDetail.value) {
2156
+ previousLocalDetail.value = JSON.parse(JSON.stringify(newVal));
2157
+ } else {
2158
+ isLocalDetailUpdated.value = JSON.stringify(newVal) !== JSON.stringify(previousLocalDetail.value);
2159
+ }
2160
+ }, {deep:true});
2161
+
2162
+ vue.onMounted(function () {
2163
+ fetchDetail();
1735
2164
  unsubscribe = store.subscribe(onSubscribe);
1736
2165
  });
1737
2166
 
@@ -1741,41 +2170,46 @@
1741
2170
  }
1742
2171
  });
1743
2172
 
1744
- var route_parameter_name = collectionCrud.getRouteParameterName(route.meta.collection);
1745
2173
 
1746
2174
  return function (_ctx, _cache) {
1747
2175
  return (vue.openBlock(), vue.createBlock(vue.unref(quasar.QPage), null, {
1748
2176
  default: vue.withCtx(function () { return [
1749
2177
  (!containerMode.value)
1750
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
1751
- vue.createElementVNode("div", _hoisted_2$1, [
2178
+ ? (vue.openBlock(), vue.createElementBlock("div", {
2179
+ class: "edit-page-header",
2180
+ key: actual_collection.value
2181
+ }, [
2182
+ vue.createElementVNode("div", _hoisted_1$1, [
1752
2183
  vue.createVNode(vue.unref(quasar.QBtn), {
1753
- onClick: onClickBack,
2184
+ onClick: onClickBackTemplate,
1754
2185
  color: "primary",
1755
2186
  icon: "arrow_back"
1756
2187
  }),
1757
2188
  vue.createElementVNode("h2", null, vue.toDisplayString(vue.unref(getTitle)), 1 /* TEXT */)
1758
2189
  ]),
1759
2190
  (!containerMode.value && editablePage.value)
1760
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
2191
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
1761
2192
  vue.createVNode(vue.unref(quasar.QBtn), {
1762
- color: "primary",
1763
2193
  icon: vue.unref(getSubmitBtn).icon,
1764
- onClick: onClickSubmit
2194
+ onClick: onClickSubmit,
2195
+ disable: !isLocalDetailUpdated.value,
2196
+ color: isLocalDetailUpdated.value ? 'primary' : 'grey-5',
2197
+ loading: submitLoading.value
1765
2198
  }, {
1766
2199
  default: vue.withCtx(function () { return [
1767
2200
  vue.createTextVNode(vue.toDisplayString(vue.unref(getSubmitBtn).label), 1 /* TEXT */)
1768
2201
  ]; }),
1769
2202
  _: 1 /* STABLE */
1770
- }, 8 /* PROPS */, ["icon"])
2203
+ }, 8 /* PROPS */, ["icon", "disable", "color", "loading"])
1771
2204
  ]))
1772
2205
  : vue.createCommentVNode("v-if", true)
1773
2206
  ]))
1774
2207
  : vue.createCommentVNode("v-if", true),
1775
2208
  (localDetail.value)
1776
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [
2209
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
1777
2210
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(Components__default["default"])[vue.unref(formComponent)]), {
1778
2211
  data: localDetail.value,
2212
+ key: localDetail.value[vue.unref(route_parameter_name)],
1779
2213
  onExtraRequestParams: onExtraRequestParams,
1780
2214
  onCustomTitle: onCustomTitle,
1781
2215
  onCustomSubmitBtn: onCustomSubmitBtn,
@@ -1783,7 +2217,7 @@
1783
2217
  onEditablePage: onEditablePage
1784
2218
  }, null, 40 /* PROPS, HYDRATE_EVENTS */, ["data"]))
1785
2219
  ]))
1786
- : (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
2220
+ : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [
1787
2221
  vue.createVNode(vue.unref(quasar.QSpinner), {
1788
2222
  class: "loader",
1789
2223
  color: "accent"
@@ -1827,10 +2261,15 @@
1827
2261
  var $emit = ref$1.emit;
1828
2262
 
1829
2263
 
1830
- var router = vueRouter.useRouter();
1831
2264
  var route = vueRouter.useRoute();
2265
+ var router = vueRouter.useRouter();
1832
2266
  var collectionCrud = vue.inject('vlank-ccrud');
1833
2267
 
2268
+ function onClickBackTemplate(){
2269
+ onClickBack(route, router);
2270
+ }
2271
+
2272
+
1834
2273
 
1835
2274
 
1836
2275
  var localDetail = vue.ref(null);
@@ -1857,14 +2296,6 @@
1857
2296
  : { label: "Valider", icon: "mdi-check" };
1858
2297
  });
1859
2298
 
1860
- var onClickBack = function () {
1861
- if (route.meta.mainParentRoutePath) {
1862
- router.push(route.meta.mainParentRoutePath);
1863
- } else {
1864
- router.go(-1);
1865
- }
1866
- };
1867
-
1868
2299
  var onCustomSubmitBtn = function (button) {
1869
2300
  customSubmitBtn.value.label = button.label;
1870
2301
  customSubmitBtn.value.icon = button.icon;
@@ -1876,8 +2307,27 @@
1876
2307
  var onExtraRequestParams = function (extraRequestParamsValue) {
1877
2308
  if (extraRequestParamsValue) { extraRequestParams.value = extraRequestParamsValue; }
1878
2309
  };
2310
+
2311
+ var submitLoading = vue.ref(false);
1879
2312
  var onClickSubmit = function () {
1880
- collectionCrud
2313
+ submitLoading.value = true;
2314
+ if (route.meta.useSendFiles) {
2315
+ collectionCrud
2316
+ .collectionAction({
2317
+ collectionName: route.meta.collection,
2318
+ action: "send-file",
2319
+ params: Object.assign({}, localDetail.value, extraRequestParams.value),
2320
+ })
2321
+ .then(function (obj) {
2322
+ if (route.meta.goBackAfterValidation) {
2323
+ onClickBack(route, router);
2324
+ }
2325
+ localDetail.value = obj;
2326
+ }).finally(function () {
2327
+ submitLoading.value = false;
2328
+ });
2329
+ } else {
2330
+ collectionCrud
1881
2331
  .collectionAction({
1882
2332
  collectionName: route.meta.collection,
1883
2333
  action: "create",
@@ -1885,10 +2335,14 @@
1885
2335
  })
1886
2336
  .then(function (obj) {
1887
2337
  if (route.meta.goBackAfterValidation) {
1888
- onClickBack();
2338
+ onClickBack(route, router);
1889
2339
  }
1890
2340
  localDetail.value = obj;
2341
+ }).finally(function () {
2342
+ submitLoading.value = false;
1891
2343
  });
2344
+ }
2345
+
1892
2346
  };
1893
2347
  vue.onMounted(function () {
1894
2348
  collectionCrud
@@ -1911,7 +2365,7 @@
1911
2365
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
1912
2366
  vue.createElementVNode("div", _hoisted_2, [
1913
2367
  vue.createVNode(vue.unref(quasar.QBtn), {
1914
- onClick: onClickBack,
2368
+ onClick: onClickBackTemplate,
1915
2369
  color: "primary",
1916
2370
  icon: "arrow_back"
1917
2371
  }),
@@ -1922,13 +2376,14 @@
1922
2376
  vue.createVNode(vue.unref(quasar.QBtn), {
1923
2377
  color: "primary",
1924
2378
  icon: vue.unref(getSubmitBtn).icon,
1925
- onClick: onClickSubmit
2379
+ onClick: onClickSubmit,
2380
+ loading: submitLoading.value
1926
2381
  }, {
1927
2382
  default: vue.withCtx(function () { return [
1928
2383
  vue.createTextVNode(vue.toDisplayString(vue.unref(getSubmitBtn).label), 1 /* TEXT */)
1929
2384
  ]; }),
1930
2385
  _: 1 /* STABLE */
1931
- }, 8 /* PROPS */, ["icon"])
2386
+ }, 8 /* PROPS */, ["icon", "loading"])
1932
2387
  ]))
1933
2388
  : vue.createCommentVNode("v-if", true)
1934
2389
  ]))
@@ -1962,7 +2417,7 @@
1962
2417
  script.__scopeId = "data-v-29e3989a";
1963
2418
  script.__file = "src/components/VlankCreatePage.vue";
1964
2419
 
1965
- var version = '3.5.2';
2420
+ var version = '3.7.42';
1966
2421
 
1967
2422
  function install (app) {
1968
2423
  app.component(script$2.name, script$2);