mgv-backoffice 1.40.0 → 1.42.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.
- package/README.md +34 -4
- package/dist/components/BaseCheckbox.vue.d.ts +28 -0
- package/dist/components/BaseSelect.vue.d.ts +4 -11
- package/dist/components/BaseSidebarUser.vue.d.ts +23 -0
- package/dist/index.d.ts +3 -0
- package/dist/ui-lib.css +1 -1
- package/dist/ui-lib.js +1105 -995
- package/dist/ui-lib.umd.cjs +1 -1
- package/dist/utils/humanize.d.ts +10 -0
- package/package.json +1 -1
- package/src/components/BaseAuthLayout.test.ts +48 -48
- package/src/components/BaseBadge.vue +3 -7
- package/src/components/BaseBooleanBadge.vue +32 -33
- package/src/components/BaseCheckbox.test.ts +30 -0
- package/src/components/BaseCheckbox.vue +51 -0
- package/src/components/BaseSelect.test.ts +20 -0
- package/src/components/BaseSelect.vue +16 -3
- package/src/components/BaseSidebarUser.test.ts +26 -0
- package/src/components/BaseSidebarUser.vue +75 -0
- package/src/components/BaseSpinner.vue +76 -76
- package/src/index.ts +3 -0
- package/src/style.css +71 -0
- package/src/utils/humanize.test.ts +35 -0
- package/src/utils/humanize.ts +35 -0
package/README.md
CHANGED
|
@@ -348,9 +348,9 @@ Animated loading spinner — a neutral ring with a coloured leading arc.
|
|
|
348
348
|
| Prop | Type | Default | Description |
|
|
349
349
|
|---------|----------------------------------------------------------------------------|----------|-------------------------------------------------------------|
|
|
350
350
|
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'sm'` | Diameter + ring thickness — 16 / 24 / 32 / 48px. |
|
|
351
|
-
| `color` | `'blue' \| 'emerald' \| 'sky' \| 'indigo' \| 'teal' \| 'purple' \| 'red' \| 'amber'` | `'
|
|
351
|
+
| `color` | `'blue' \| 'emerald' \| 'sky' \| 'indigo' \| 'teal' \| 'purple' \| 'red' \| 'amber'` | `'emerald'` | Colour of the spinning arc. The track stays neutral gray. |
|
|
352
352
|
|
|
353
|
-
With no props it renders
|
|
353
|
+
With no props it renders a 16px emerald spinner. For page loaders use `size="xl"` centered, e.g. `<div class="flex justify-center py-12"><BaseSpinner size="xl" /></div>`.
|
|
354
354
|
|
|
355
355
|
**Example:**
|
|
356
356
|
|
|
@@ -901,6 +901,24 @@ interface NavSection {
|
|
|
901
901
|
|
|
902
902
|
---
|
|
903
903
|
|
|
904
|
+
### BaseSidebarUser
|
|
905
|
+
|
|
906
|
+
Signed-in user block for the `BaseSidebar` `footer` slot: initials avatar,
|
|
907
|
+
name and email (a link to the profile page when `to` is set) and a Logout
|
|
908
|
+
button that emits `logout`.
|
|
909
|
+
|
|
910
|
+
**Props:** `name` (required), `email`, `to` (profile route), `showLogout` (`true`),
|
|
911
|
+
`logoutLabel` (`'Logout'`), `profileLabel` (`'View profile'`, tooltip).
|
|
912
|
+
**Emits:** `logout`.
|
|
913
|
+
|
|
914
|
+
```vue
|
|
915
|
+
<BaseSidebar :sections="nav">
|
|
916
|
+
<template #footer>
|
|
917
|
+
<BaseSidebarUser :name="me.username" :email="me.email" :to="{ name: 'Profile' }" @logout="logOut" />
|
|
918
|
+
</template>
|
|
919
|
+
</BaseSidebar>
|
|
920
|
+
```
|
|
921
|
+
|
|
904
922
|
### BaseNotificationPanel
|
|
905
923
|
|
|
906
924
|
Left-anchored notification drawer (teleported to `<body>`, slides in from
|
|
@@ -1834,6 +1852,19 @@ title, big value) for any value — counts, labels, pre-formatted numbers.
|
|
|
1834
1852
|
</BaseStatCard>
|
|
1835
1853
|
```
|
|
1836
1854
|
|
|
1855
|
+
### BaseCheckbox
|
|
1856
|
+
|
|
1857
|
+
Rounded checkbox, emerald when checked (works with or without a forms plugin).
|
|
1858
|
+
`v-model` is the boolean; `change` fires with the new value; attrs (`id`, `name`)
|
|
1859
|
+
go to the `<input>`.
|
|
1860
|
+
|
|
1861
|
+
**Props:** `modelValue`, `label`, `disabled`. **Slots:** `default` (rich label).
|
|
1862
|
+
**Emits:** `update:modelValue(value)`, `change(value)`.
|
|
1863
|
+
|
|
1864
|
+
```vue
|
|
1865
|
+
<BaseCheckbox v-model="remember" id="remember" label="Remember me" />
|
|
1866
|
+
```
|
|
1867
|
+
|
|
1837
1868
|
### BaseToggle
|
|
1838
1869
|
|
|
1839
1870
|
On/off switch (`role="switch"`). `v-model` is the boolean; `change` fires after
|
|
@@ -1867,8 +1898,7 @@ content and an optional footer.
|
|
|
1867
1898
|
|
|
1868
1899
|
### BaseBooleanBadge
|
|
1869
1900
|
|
|
1870
|
-
Yes/no pill for boolean columns: green check when true,
|
|
1871
|
-
false (so `false` reads as a state, not an error).
|
|
1901
|
+
Yes/no pill for boolean columns: green check when true, red cross when false.
|
|
1872
1902
|
|
|
1873
1903
|
**Props:** `value` (`boolean | null`), `trueLabel` (`'Yes'`), `falseLabel` (`'No'`).
|
|
1874
1904
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
modelValue?: boolean;
|
|
3
|
+
label?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare var __VLS_1: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_1) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
11
|
+
change: (value: boolean) => any;
|
|
12
|
+
"update:modelValue": (value: boolean) => any;
|
|
13
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
14
|
+
onChange?: ((value: boolean) => any) | undefined;
|
|
15
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
label: string;
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
modelValue: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -4,12 +4,10 @@ interface Props {
|
|
|
4
4
|
size?: 'sm' | 'md';
|
|
5
5
|
/** Full-width (w-full). Set false for inline selects. */
|
|
6
6
|
block?: boolean;
|
|
7
|
+
/** Render underscores in option text as spaces (BLUE_SKY → BLUE SKY). Values are untouched. */
|
|
8
|
+
humanize?: boolean;
|
|
7
9
|
}
|
|
8
|
-
declare
|
|
9
|
-
type __VLS_Slots = {} & {
|
|
10
|
-
default?: (props: typeof __VLS_1) => any;
|
|
11
|
-
};
|
|
12
|
-
declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
10
|
+
declare const __VLS_export: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
13
11
|
"update:modelValue": (value: any) => any;
|
|
14
12
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
15
13
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
@@ -17,12 +15,7 @@ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, i
|
|
|
17
15
|
size: "sm" | "md";
|
|
18
16
|
block: boolean;
|
|
19
17
|
modelValue: string | null;
|
|
18
|
+
humanize: boolean;
|
|
20
19
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
20
|
declare const _default: typeof __VLS_export;
|
|
23
21
|
export default _default;
|
|
24
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
-
new (): {
|
|
26
|
-
$slots: S;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
2
|
+
interface Props {
|
|
3
|
+
name: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
/** Profile route; makes the name/email block a link. */
|
|
6
|
+
to?: RouteLocationRaw;
|
|
7
|
+
showLogout?: boolean;
|
|
8
|
+
logoutLabel?: string;
|
|
9
|
+
profileLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const __VLS_export: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
12
|
+
logout: () => any;
|
|
13
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
14
|
+
onLogout?: (() => any) | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
email: string;
|
|
17
|
+
to: RouteLocationRaw;
|
|
18
|
+
showLogout: boolean;
|
|
19
|
+
logoutLabel: string;
|
|
20
|
+
profileLabel: string;
|
|
21
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export { default as BaseCard } from './components/BaseCard.vue';
|
|
|
52
52
|
export { default as BaseField } from './components/BaseField.vue';
|
|
53
53
|
export { default as BaseStatCard } from './components/BaseStatCard.vue';
|
|
54
54
|
export { default as BaseToggle } from './components/BaseToggle.vue';
|
|
55
|
+
export { default as BaseCheckbox } from './components/BaseCheckbox.vue';
|
|
56
|
+
export { default as BaseSidebarUser } from './components/BaseSidebarUser.vue';
|
|
55
57
|
export { default as BaseAuthLayout } from './components/BaseAuthLayout.vue';
|
|
56
58
|
export { default as BaseBooleanBadge } from './components/BaseBooleanBadge.vue';
|
|
57
59
|
export { default as BaseDetailList } from './components/BaseDetailList.vue';
|
|
@@ -102,5 +104,6 @@ export { sanitizeHtml, isSafeHref } from './utils/sanitizeHtml';
|
|
|
102
104
|
export { fmtNumber, fmtDate, fmtDateTime, fmtDateTimeMs, fmtDateShort, fmtCalendarDate, fmtCalendarDateTime, fmtMsAsSeconds, fmtBytes, fmtPrice, fmtPct, fmtUsd, fmtDuration, formatJson, stringifyValue, } from './utils/format';
|
|
103
105
|
export { isValidAbsoluteUrl, isValidJson, isValidXml, isValidBase64, } from './utils/validate';
|
|
104
106
|
export { buildSpecParams, firstInvalidNumericSpec } from './utils/specForm';
|
|
107
|
+
export { humanizeEnum, humanizeTextVNodes } from './utils/humanize';
|
|
105
108
|
export { computePnL } from './utils/pnl';
|
|
106
109
|
export type { PnL, PnLInputs } from './utils/pnl';
|