mgv-backoffice 1.48.0 → 1.49.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 (39) hide show
  1. package/README.md +17 -0
  2. package/dist/components/BaseBooleanIcon.vue.d.ts +14 -0
  3. package/dist/components/BaseDetailList.vue.d.ts +13 -1
  4. package/dist/components/BasePhotoViewer.vue.d.ts +24 -0
  5. package/dist/components/BaseRating.vue.d.ts +9 -0
  6. package/dist/components/BaseRowButton.vue.d.ts +18 -0
  7. package/dist/components/BaseSelect.vue.d.ts +15 -3
  8. package/dist/components/BaseSidebarUser.vue.d.ts +3 -0
  9. package/dist/components/BaseStatCard.vue.d.ts +6 -4
  10. package/dist/components/BaseTextarea.vue.d.ts +12 -0
  11. package/dist/composables/useRefreshOnReturn.d.ts +7 -0
  12. package/dist/index.d.ts +8 -1
  13. package/dist/types/photoViewer.d.ts +6 -0
  14. package/dist/ui-lib.css +1 -1
  15. package/dist/ui-lib.js +1018 -819
  16. package/dist/ui-lib.umd.cjs +1 -1
  17. package/dist/utils/format.d.ts +9 -0
  18. package/package.json +1 -1
  19. package/src/components/BaseBadge.vue +7 -7
  20. package/src/components/BaseBooleanIcon.vue +22 -0
  21. package/src/components/BaseDetailList.vue +50 -47
  22. package/src/components/BaseField.label.test.ts +30 -0
  23. package/src/components/BaseField.vue +19 -3
  24. package/src/components/BasePhotoViewer.test.ts +22 -0
  25. package/src/components/BasePhotoViewer.vue +93 -0
  26. package/src/components/BaseRating.test.ts +19 -0
  27. package/src/components/BaseRating.vue +21 -0
  28. package/src/components/BaseRowButton.vue +24 -0
  29. package/src/components/BaseSelect.vue +4 -2
  30. package/src/components/BaseSidebarUser.vue +85 -75
  31. package/src/components/BaseStatCard.vue +11 -3
  32. package/src/components/BaseTextarea.test.ts +17 -0
  33. package/src/components/BaseTextarea.vue +24 -0
  34. package/src/composables/useRefreshOnReturn.test.ts +47 -0
  35. package/src/composables/useRefreshOnReturn.ts +24 -0
  36. package/src/index.ts +10 -0
  37. package/src/types/photoViewer.ts +6 -0
  38. package/src/utils/format.test.ts +342 -322
  39. package/src/utils/format.ts +23 -0
package/README.md CHANGED
@@ -2051,6 +2051,23 @@ first paint:
2051
2051
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
2052
2052
  ```
2053
2053
 
2054
+ ## Added in 1.49.0
2055
+
2056
+ | Export | Purpose |
2057
+ | --- | --- |
2058
+ | `BaseTextarea` | Multi-line input with BaseInput's skin. |
2059
+ | `BaseRating` | Read-only star rating: `rating`, optional `count`. |
2060
+ | `BaseRowButton` | Compact table-row action: `variant` `outline` / `primary` / `danger`. |
2061
+ | `BaseBooleanIcon` | Icon-only yes/no flag; label in the tooltip. |
2062
+ | `BasePhotoViewer` | Full-screen viewer: `photos`, `v-model` index, `@close`; `closeLabel`, `previousLabel`, `nextLabel`. |
2063
+ | `useRefreshOnReturn(fn, afterMs?)` | Re-runs `fn` when the tab returns after being hidden (default 30s). |
2064
+ | `fmtTime`, `toLocalInput`, `fromLocalInput` | Backend time and `datetime-local` helpers. |
2065
+
2066
+ Existing components gained: `BaseSelect` `icon` slot and numeric `modelValue`,
2067
+ `BaseStatCard` `value` slot and `violet` accent, `BaseDetailList` scoped `value`
2068
+ slot, `BaseSidebarUser` `avatarUrl`, dark-mode colours on `BaseBadge`. `BaseField`
2069
+ links its label to the slotted control automatically when `labelFor` is not set.
2070
+
2054
2071
  ## Design system
2055
2072
 
2056
2073
  `dist/style.css` ships the shared "Night Terminal" look, so importing it is all a
@@ -0,0 +1,14 @@
1
+ type __VLS_Props = {
2
+ value?: boolean | null;
3
+ trueLabel?: string;
4
+ falseLabel?: string;
5
+ emptyText?: string;
6
+ };
7
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ value: boolean | null;
9
+ emptyText: string;
10
+ trueLabel: string;
11
+ falseLabel: string;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -5,9 +5,21 @@ interface Props {
5
5
  columns?: 1 | 2 | 3;
6
6
  emptyText?: string;
7
7
  }
8
- declare const __VLS_export: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
8
+ declare var __VLS_1: {
9
+ item: DetailItem;
10
+ };
11
+ type __VLS_Slots = {} & {
12
+ value?: (props: typeof __VLS_1) => any;
13
+ };
14
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
9
15
  emptyText: string;
10
16
  columns: 1 | 2 | 3;
11
17
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
19
  declare const _default: typeof __VLS_export;
13
20
  export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,24 @@
1
+ import { ViewerPhoto } from '../types/photoViewer';
2
+ type __VLS_Props = {
3
+ photos: ViewerPhoto[];
4
+ closeLabel?: string;
5
+ previousLabel?: string;
6
+ nextLabel?: string;
7
+ };
8
+ type __VLS_ModelProps = {
9
+ modelValue: number;
10
+ };
11
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
13
+ close: () => any;
14
+ "update:modelValue": (value: number) => any;
15
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
+ onClose?: (() => any) | undefined;
17
+ "onUpdate:modelValue"?: ((value: number) => any) | undefined;
18
+ }>, {
19
+ closeLabel: string;
20
+ previousLabel: string;
21
+ nextLabel: string;
22
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ rating: number;
3
+ count?: number | null;
4
+ };
5
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ count: number | null;
7
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,18 @@
1
+ type __VLS_Props = {
2
+ variant?: 'outline' | 'primary' | 'danger';
3
+ };
4
+ declare var __VLS_1: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ };
8
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
+ variant: "outline" | "primary" | "danger";
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -1,5 +1,5 @@
1
1
  interface Props {
2
- modelValue?: string | null;
2
+ modelValue?: string | number | null;
3
3
  /** 'sm' = px-2 py-1.5 (default, the usual select height); 'md' = px-3 py-2. */
4
4
  size?: 'sm' | 'md';
5
5
  /** Full-width (w-full). Set false for inline selects. */
@@ -7,15 +7,27 @@ interface Props {
7
7
  /** Render underscores in option text as spaces (BLUE_SKY → BLUE SKY). Values are untouched. */
8
8
  humanize?: boolean;
9
9
  }
10
- declare const __VLS_export: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
10
+ declare var __VLS_6: {
11
+ iconClass: string;
12
+ };
13
+ type __VLS_Slots = {} & {
14
+ icon?: (props: typeof __VLS_6) => any;
15
+ };
16
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
11
17
  "update:modelValue": (value: any) => any;
12
18
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
13
19
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
14
20
  }>, {
15
21
  size: "sm" | "md";
16
22
  block: boolean;
17
- modelValue: string | null;
23
+ modelValue: string | number | null;
18
24
  humanize: boolean;
19
25
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
26
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
27
  declare const _default: typeof __VLS_export;
21
28
  export default _default;
29
+ type __VLS_WithSlots<T, S> = T & {
30
+ new (): {
31
+ $slots: S;
32
+ };
33
+ };
@@ -2,6 +2,8 @@ import { RouteLocationRaw } from 'vue-router';
2
2
  interface Props {
3
3
  name: string;
4
4
  email?: string;
5
+ /** Photo shown instead of the initials. */
6
+ avatarUrl?: string | null;
5
7
  /** Profile route; makes the name/email block a link. */
6
8
  to?: RouteLocationRaw;
7
9
  showLogout?: boolean;
@@ -15,6 +17,7 @@ declare const __VLS_export: import('vue').DefineComponent<Props, {}, {}, {}, {},
15
17
  }>, {
16
18
  email: string;
17
19
  to: RouteLocationRaw;
20
+ avatarUrl: string | null;
18
21
  showLogout: boolean;
19
22
  logoutLabel: string;
20
23
  profileLabel: string;
@@ -1,5 +1,5 @@
1
1
  import { RouteLocationRaw } from 'vue-router';
2
- type Accent = 'emerald' | 'sky' | 'amber' | 'red' | 'slate';
2
+ type Accent = 'emerald' | 'sky' | 'amber' | 'violet' | 'red' | 'slate';
3
3
  interface Props {
4
4
  title: string;
5
5
  value?: string | number;
@@ -9,13 +9,15 @@ interface Props {
9
9
  /** Makes the card a router link. */
10
10
  to?: RouteLocationRaw;
11
11
  }
12
- declare var __VLS_8: {}, __VLS_10: {
12
+ declare var __VLS_8: {}, __VLS_10: {}, __VLS_12: {
13
13
  iconClass: string;
14
14
  };
15
15
  type __VLS_Slots = {} & {
16
- default?: (props: typeof __VLS_8) => any;
16
+ value?: (props: typeof __VLS_8) => any;
17
17
  } & {
18
- icon?: (props: typeof __VLS_10) => any;
18
+ default?: (props: typeof __VLS_10) => any;
19
+ } & {
20
+ icon?: (props: typeof __VLS_12) => any;
19
21
  };
20
22
  declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
21
23
  to: RouteLocationRaw;
@@ -0,0 +1,12 @@
1
+ interface Props {
2
+ modelValue?: string | null;
3
+ }
4
+ declare const __VLS_export: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
5
+ "update:modelValue": (value: string) => any;
6
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
7
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
8
+ }>, {
9
+ modelValue: string | null;
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /** How long the tab must be hidden before coming back reloads the page's data; quick switches keep it. */
2
+ export declare const REFRESH_AFTER_AWAY_MS = 30000;
3
+ /**
4
+ * Calls `refresh` when the browser tab becomes visible again after `afterMs` or more hidden, since server data
5
+ * changes while the user is elsewhere. The first load is left to the component.
6
+ */
7
+ export declare function useRefreshOnReturn(refresh: () => unknown, afterMs?: number): void;
package/dist/index.d.ts CHANGED
@@ -59,6 +59,13 @@ export { default as BaseSidebarUser } from './components/BaseSidebarUser.vue';
59
59
  export { default as BaseAuthLayout } from './components/BaseAuthLayout.vue';
60
60
  export { default as BaseBooleanBadge } from './components/BaseBooleanBadge.vue';
61
61
  export { default as BaseDetailList } from './components/BaseDetailList.vue';
62
+ export { default as BaseTextarea } from './components/BaseTextarea.vue';
63
+ export { default as BaseRating } from './components/BaseRating.vue';
64
+ export { default as BaseRowButton } from './components/BaseRowButton.vue';
65
+ export { default as BaseBooleanIcon } from './components/BaseBooleanIcon.vue';
66
+ export { default as BasePhotoViewer } from './components/BasePhotoViewer.vue';
67
+ export type { ViewerPhoto } from './types/photoViewer';
68
+ export { useRefreshOnReturn, REFRESH_AFTER_AWAY_MS } from './composables/useRefreshOnReturn';
62
69
  export type { DetailItem } from './types/detail';
63
70
  export { useTheme, initTheme } from './composables/useTheme';
64
71
  export type { UseThemeOptions } from './composables/useTheme';
@@ -107,7 +114,7 @@ export { methodBadgeSolid, methodBadgeBright, methodBadgeTinted, statusBadgeSoli
107
114
  export { rowKeyMissing, rowValueMissing } from './utils/kvRows';
108
115
  export type { KeyValueRowLike } from './utils/kvRows';
109
116
  export { sanitizeHtml, isSafeHref } from './utils/sanitizeHtml';
110
- export { fmtNumber, fmtDate, fmtDateTime, fmtDateTimeMs, fmtDateShort, fmtCalendarDate, fmtCalendarDateTime, fmtMsAsSeconds, fmtBytes, fmtPrice, fmtPct, fmtUsd, fmtMoney, currencySymbol, fmtCurrencyAmount, fmtDuration, formatJson, stringifyValue, } from './utils/format';
117
+ export { fmtNumber, fmtDate, fmtDateTime, fmtDateTimeMs, fmtDateShort, fmtCalendarDate, fmtCalendarDateTime, fmtMsAsSeconds, fmtBytes, fmtPrice, fmtPct, fmtUsd, fmtMoney, currencySymbol, fmtCurrencyAmount, fmtDuration, formatJson, fmtTime, toLocalInput, fromLocalInput, stringifyValue, } from './utils/format';
111
118
  export { isValidAbsoluteUrl, isValidJson, isValidXml, isValidBase64, } from './utils/validate';
112
119
  export { buildSpecParams, firstInvalidNumericSpec } from './utils/specForm';
113
120
  export { humanizeEnum, humanizeTextVNodes } from './utils/humanize';
@@ -0,0 +1,6 @@
1
+ /** One photo in a BasePhotoViewer. */
2
+ export interface ViewerPhoto {
3
+ src: string;
4
+ label: string;
5
+ caption?: string | null;
6
+ }