@omnitend/dashboard-for-laravel 0.40.0 → 0.41.0

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.
Files changed (108) hide show
  1. package/dist/charts.d.ts +19 -0
  2. package/dist/components/base/DAccordion.vue.d.ts +12 -0
  3. package/dist/components/base/DAccordionItem.vue.d.ts +12 -0
  4. package/dist/components/base/DAlert.vue.d.ts +17 -0
  5. package/dist/components/base/DAspect.vue.d.ts +12 -0
  6. package/dist/components/base/DAutocomplete.vue.d.ts +32 -0
  7. package/dist/components/base/DAvatar.vue.d.ts +12 -0
  8. package/dist/components/base/DBadge.vue.d.ts +12 -0
  9. package/dist/components/base/DBreadcrumb.vue.d.ts +12 -0
  10. package/dist/components/base/DButton.vue.d.ts +88 -0
  11. package/dist/components/base/DButtonGroup.vue.d.ts +12 -0
  12. package/dist/components/base/DButtonToolbar.vue.d.ts +12 -0
  13. package/dist/components/base/DCard.vue.d.ts +12 -0
  14. package/dist/components/base/DCol.vue.d.ts +12 -0
  15. package/dist/components/base/DCollapse.vue.d.ts +12 -0
  16. package/dist/components/base/DContainer.vue.d.ts +12 -0
  17. package/dist/components/base/DDropdown.vue.d.ts +12 -0
  18. package/dist/components/base/DDropdownDivider.vue.d.ts +2 -0
  19. package/dist/components/base/DDropdownItem.vue.d.ts +12 -0
  20. package/dist/components/base/DForm.vue.d.ts +12 -0
  21. package/dist/components/base/DFormCheckbox.vue.d.ts +12 -0
  22. package/dist/components/base/DFormCheckboxGroup.vue.d.ts +12 -0
  23. package/dist/components/base/DFormGroup.vue.d.ts +12 -0
  24. package/dist/components/base/DFormInput.vue.d.ts +2 -0
  25. package/dist/components/base/DFormInvalidFeedback.vue.d.ts +12 -0
  26. package/dist/components/base/DFormOtp.vue.d.ts +12 -0
  27. package/dist/components/base/DFormRadio.vue.d.ts +12 -0
  28. package/dist/components/base/DFormRadioGroup.vue.d.ts +12 -0
  29. package/dist/components/base/DFormSelect.vue.d.ts +27 -0
  30. package/dist/components/base/DFormSpinbutton.vue.d.ts +12 -0
  31. package/dist/components/base/DFormTags.vue.d.ts +12 -0
  32. package/dist/components/base/DFormText.vue.d.ts +12 -0
  33. package/dist/components/base/DFormTextarea.vue.d.ts +2 -0
  34. package/dist/components/base/DImage.vue.d.ts +12 -0
  35. package/dist/components/base/DInputGroup.vue.d.ts +12 -0
  36. package/dist/components/base/DLink.vue.d.ts +12 -0
  37. package/dist/components/base/DListGroup.vue.d.ts +12 -0
  38. package/dist/components/base/DListGroupItem.vue.d.ts +12 -0
  39. package/dist/components/base/DModal.vue.d.ts +12 -0
  40. package/dist/components/base/DNav.vue.d.ts +12 -0
  41. package/dist/components/base/DNavItem.vue.d.ts +12 -0
  42. package/dist/components/base/DNavbar.vue.d.ts +12 -0
  43. package/dist/components/base/DNavbarBrand.vue.d.ts +12 -0
  44. package/dist/components/base/DNavbarNav.vue.d.ts +12 -0
  45. package/dist/components/base/DNavbarToggle.vue.d.ts +12 -0
  46. package/dist/components/base/DOffcanvas.vue.d.ts +12 -0
  47. package/dist/components/base/DOverlay.vue.d.ts +12 -0
  48. package/dist/components/base/DPagination.vue.d.ts +2 -0
  49. package/dist/components/base/DPlaceholder.vue.d.ts +12 -0
  50. package/dist/components/base/DPopover.vue.d.ts +12 -0
  51. package/dist/components/base/DProgress.vue.d.ts +12 -0
  52. package/dist/components/base/DRow.vue.d.ts +12 -0
  53. package/dist/components/base/DSpinner.vue.d.ts +2 -0
  54. package/dist/components/base/DTable.vue.d.ts +34 -0
  55. package/dist/components/base/DTabs.vue.d.ts +12 -0
  56. package/dist/components/base/DToast.vue.d.ts +12 -0
  57. package/dist/components/base/DToaster.vue.d.ts +12 -0
  58. package/dist/components/base/DTooltip.vue.d.ts +12 -0
  59. package/dist/components/charts/DXBarChart.vue.d.ts +7 -0
  60. package/dist/components/charts/DXDoughnutChart.vue.d.ts +24 -0
  61. package/dist/components/charts/DXLineChart.vue.d.ts +7 -0
  62. package/dist/components/charts/chartTheme.d.ts +59 -0
  63. package/dist/components/charts/useThemedChart.d.ts +40 -0
  64. package/dist/components/extended/DXBasicForm.vue.d.ts +10 -0
  65. package/dist/components/extended/DXChoiceField.vue.d.ts +26 -0
  66. package/dist/components/extended/DXCurrencyInput.vue.d.ts +42 -0
  67. package/dist/components/extended/DXDashboard.vue.d.ts +105 -0
  68. package/dist/components/extended/DXDashboardNavbar.vue.d.ts +86 -0
  69. package/dist/components/extended/DXDashboardSidebar.vue.d.ts +61 -0
  70. package/dist/components/extended/DXField.vue.d.ts +86 -0
  71. package/dist/components/extended/DXFieldLabel.vue.d.ts +18 -0
  72. package/dist/components/extended/DXFieldShell.vue.d.ts +73 -0
  73. package/dist/components/extended/DXForm.vue.d.ts +112 -0
  74. package/dist/components/extended/DXFormField.vue.d.ts +41 -0
  75. package/dist/components/extended/DXNumericField.vue.d.ts +23 -0
  76. package/dist/components/extended/DXRepeater.vue.d.ts +46 -0
  77. package/dist/components/extended/DXRepeaterCards.vue.d.ts +45 -0
  78. package/dist/components/extended/DXStatCard.vue.d.ts +56 -0
  79. package/dist/components/extended/DXSwitch.vue.d.ts +47 -0
  80. package/dist/components/extended/DXTable.vue.d.ts +493 -0
  81. package/dist/components/extended/DXTableEditorModal.vue.d.ts +100 -0
  82. package/dist/components/extended/DXTablePagination.vue.d.ts +50 -0
  83. package/dist/components/extended/DXTableShell.vue.d.ts +24 -0
  84. package/dist/components/extended/DXUserAvatar.vue.d.ts +40 -0
  85. package/dist/components/extended/dxFieldContext.d.ts +11 -0
  86. package/dist/composables/defineForm.d.ts +41 -0
  87. package/dist/composables/useAsyncOptions.d.ts +20 -0
  88. package/dist/composables/useContainerWidth.d.ts +96 -0
  89. package/dist/composables/useForm.d.ts +46 -0
  90. package/dist/composables/useResourceEditor.d.ts +77 -0
  91. package/dist/composables/useToast.d.ts +2 -0
  92. package/dist/dashboard-for-laravel.js +2855 -2848
  93. package/dist/dashboard-for-laravel.js.map +1 -1
  94. package/dist/dashboard-for-laravel.umd.cjs +5 -5
  95. package/dist/dashboard-for-laravel.umd.cjs.map +1 -1
  96. package/dist/index.d.ts +93 -0
  97. package/dist/style.css +1 -1
  98. package/dist/types/index.d.ts +477 -0
  99. package/dist/types/navigation.d.ts +43 -0
  100. package/dist/utils/api.d.ts +30 -0
  101. package/dist/utils/formSchema.d.ts +59 -0
  102. package/dist/utils/objectPath.d.ts +18 -0
  103. package/docs/public/api-reference.json +3 -3
  104. package/docs/public/docs-map.md +1 -1
  105. package/package.json +1 -1
  106. package/resources/js/components/extended/DXDashboardSidebar.vue +9 -5
  107. package/resources/js/components/extended/DXTable.vue +3 -0
  108. package/resources/js/composables/useResourceEditor.ts +41 -1
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
  </div>
37
37
 
38
- <nav ref="navRef" class="sidebar-nav p-3">
38
+ <nav ref="navRef" class="sidebar-nav px-3 pb-3 pt-2">
39
39
  <template v-for="(group, groupIndex) in navigation" :key="groupIndex">
40
40
  <div
41
41
  v-if="group.visible !== false"
@@ -426,11 +426,15 @@ watch(activeGroupIndex, () => {
426
426
  overflow-x: hidden;
427
427
  }
428
428
 
429
- /* Dense rhythm (#95): values proven in a production dashboard, adopted as the default —
430
- natural-case headers at 0.875rem (no uppercase/letter-spacing), tight group
431
- spacing. */
429
+ /* Rhythm: natural-case headers at 0.875rem (no uppercase/letter-spacing, #95),
430
+ with a full 1rem between groups so each section reads as its own block.
431
+ The 0.25rem gap #95 shipped with left a group label 4px under the previous
432
+ group's last item — closer to that item than to its own — and the eye
433
+ attached the label to the wrong group. The nav's top padding is reduced to
434
+ match (pt-2), so the first item sits nearer the header than the groups sit
435
+ to each other. */
432
436
  .nav-group {
433
- margin-bottom: 0.25rem;
437
+ margin-bottom: 1rem;
434
438
  }
435
439
 
436
440
  .nav-group-label {
@@ -752,6 +752,9 @@ export interface Props<TItem = any> {
752
752
  * `edit-value` slot's binding); `data` is the live form data. Aborting
753
753
  * leaves the modal open with the user's edits intact. A guard that throws
754
754
  * also aborts, surfacing its message.
755
+ *
756
+ * Dismissing the modal while the guard is still pending — by any route —
757
+ * abandons the save; nothing is written for a record the user has closed.
755
758
  */
756
759
  saveGuard?: (
757
760
  item: TItem | null,
@@ -1,4 +1,4 @@
1
- import { computed, ref, type Ref } from "vue";
1
+ import { computed, ref, watch, type Ref } from "vue";
2
2
  import { api } from "../utils/api";
3
3
  import { useForm } from "./useForm";
4
4
  import { useToast } from "./useToast";
@@ -102,6 +102,30 @@ export function useResourceEditor<T = any>(
102
102
  // True while the edit modal is fetching the full record via `showUrl`.
103
103
  const editLoading = ref(false);
104
104
 
105
+ // Bumped every time the modal closes. An action that AWAITS something —
106
+ // a save or delete guard — re-reads this before committing, so work begun
107
+ // in one modal session can never land after that session has ended (#174).
108
+ //
109
+ // A counter rather than a boolean because the modal reopens: by the time a
110
+ // slow guard resolves the user may already be editing a different row, and
111
+ // "is it open?" answers yes for the WRONG record. The generation only
112
+ // matches if this is still the same session that started the action.
113
+ //
114
+ // Watched rather than folded into `cancel()` because `cancel()` is not the
115
+ // only way out: the Cancel button and the slot's `close` binding route
116
+ // through it, but the header X, Escape and a backdrop click reach BModal
117
+ // directly and merely flip `show`. Watching the flag itself catches every
118
+ // route, including any added later. `flush: 'sync'` so the bump lands in
119
+ // the same tick as the dismissal, leaving no window of its own.
120
+ const editGeneration = ref(0);
121
+ watch(
122
+ showEditModal,
123
+ (isOpen) => {
124
+ if (!isOpen) editGeneration.value++;
125
+ },
126
+ { flush: 'sync' },
127
+ );
128
+
105
129
  // Monotonic token so a slow fetch for a previously-opened row can't overwrite
106
130
  // the form after the user has since opened a different row.
107
131
  let editFetchToken = 0;
@@ -324,8 +348,17 @@ export function useResourceEditor<T = any>(
324
348
  if (pendingAction.value) return;
325
349
 
326
350
  pendingAction.value = 'save';
351
+ const generation = editGeneration.value;
327
352
  try {
328
353
  if (!(await passesSaveGuard())) return;
354
+
355
+ // Dismissed while the guard was pending. Saving now would write a
356
+ // record the user watched themselves close — the same silent
357
+ // outliving-of-intent the guard exists to prevent, reached by a
358
+ // different route (#174). The check sits HERE rather than inside
359
+ // performSave so it covers the whole class, not one call site.
360
+ if (editGeneration.value !== generation) return;
361
+
329
362
  await performSave();
330
363
  } finally {
331
364
  pendingAction.value = null;
@@ -532,6 +565,7 @@ export function useResourceEditor<T = any>(
532
565
  if (pendingAction.value) return;
533
566
 
534
567
  pendingAction.value = 'delete';
568
+ const generation = editGeneration.value;
535
569
  try {
536
570
  // Delete guard: a non-null message means this item can't be deleted —
537
571
  // show it immediately and skip the confirm and the request entirely.
@@ -543,6 +577,12 @@ export function useResourceEditor<T = any>(
543
577
 
544
578
  if (!confirmed) return;
545
579
 
580
+ // Same window as `save`, opened by awaiting the guard: the modal can
581
+ // be dismissed underneath a pending delete (#174). Checked after the
582
+ // confirm as well as the guard, though `window.confirm` blocks the
583
+ // event loop, so nothing can slip in during it.
584
+ if (editGeneration.value !== generation) return;
585
+
546
586
  const itemId = (selectedItem.value as any).id;
547
587
  const url = props.deleteUrl.replace(':id', itemId);
548
588