mgv-backoffice 1.44.0 → 1.46.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 +2048 -2000
- package/dist/components/BaseGroupedChecklist.vue.d.ts +26 -0
- package/dist/components/Pagination.vue.d.ts +9 -0
- package/dist/composables/useDirtyState.d.ts +24 -0
- package/dist/composables/useLatestRequest.d.ts +51 -0
- package/dist/index.d.ts +6 -1
- package/dist/types/checklist.d.ts +6 -0
- package/dist/ui-lib.css +1 -1
- package/dist/ui-lib.js +1033 -899
- package/dist/ui-lib.umd.cjs +1 -1
- package/dist/utils/format.d.ts +8 -0
- package/package.json +1 -1
- package/src/components/BaseGroupedChecklist.test.ts +73 -0
- package/src/components/BaseGroupedChecklist.vue +122 -0
- package/src/components/Pagination.test.ts +39 -0
- package/src/components/Pagination.vue +102 -87
- package/src/composables/useDirtyState.test.ts +38 -0
- package/src/composables/useDirtyState.ts +44 -0
- package/src/composables/useLatestRequest.test.ts +61 -0
- package/src/composables/useLatestRequest.ts +81 -0
- package/src/index.ts +6 -0
- package/src/types/checklist.ts +6 -0
- package/src/utils/format.test.ts +26 -0
- package/src/utils/format.ts +25 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ChecklistGroup } from '../types/checklist';
|
|
2
|
+
interface Props {
|
|
3
|
+
groups: ChecklistGroup[];
|
|
4
|
+
modelValue: string[];
|
|
5
|
+
/** Text of the master checkbox; group checkboxes read "<allLabel> <group>". */
|
|
6
|
+
allLabel?: string;
|
|
7
|
+
allAriaLabel?: string;
|
|
8
|
+
/** Accessible name per item checkbox (defaults to the item itself). */
|
|
9
|
+
itemAriaLabel?: (item: string) => string;
|
|
10
|
+
/** Render item labels in a monospace font (tickers, ids). */
|
|
11
|
+
mono?: boolean;
|
|
12
|
+
maxHeightClass?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const __VLS_export: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
15
|
+
"update:modelValue": (value: string[]) => any;
|
|
16
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
maxHeightClass: string;
|
|
20
|
+
mono: boolean;
|
|
21
|
+
allLabel: string;
|
|
22
|
+
allAriaLabel: string;
|
|
23
|
+
itemAriaLabel: (item: string) => string;
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -7,6 +7,10 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
7
7
|
type: NumberConstructor;
|
|
8
8
|
default: number;
|
|
9
9
|
};
|
|
10
|
+
page: {
|
|
11
|
+
type: NumberConstructor;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
10
14
|
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
15
|
"page-changed": (...args: any[]) => void;
|
|
12
16
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -18,9 +22,14 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
18
22
|
type: NumberConstructor;
|
|
19
23
|
default: number;
|
|
20
24
|
};
|
|
25
|
+
page: {
|
|
26
|
+
type: NumberConstructor;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
21
29
|
}>> & Readonly<{
|
|
22
30
|
"onPage-changed"?: ((...args: any[]) => any) | undefined;
|
|
23
31
|
}>, {
|
|
32
|
+
page: number;
|
|
24
33
|
itemsPerPage: number;
|
|
25
34
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
26
35
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* JSON-serialise a value with object keys sorted at every depth, so two
|
|
4
|
+
* structurally equal values always produce the same string regardless of
|
|
5
|
+
* key insertion order (arrays keep their order).
|
|
6
|
+
*/
|
|
7
|
+
export declare function stableStringify(value: unknown): string;
|
|
8
|
+
/**
|
|
9
|
+
* Unsaved-changes tracking for an edit form. `snapshot` returns the form's
|
|
10
|
+
* current state (read reactively); `dirty` is true whenever it differs from
|
|
11
|
+
* the last clean baseline. Call `markClean()` after loading or saving to make
|
|
12
|
+
* the current state the new baseline. Comparison is structural (key order is
|
|
13
|
+
* ignored), so a server echo that reorders keys never reads as an edit.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const form = reactive({ name: '', params: {} })
|
|
17
|
+
* const { dirty, markClean } = useDirtyState(() => form)
|
|
18
|
+
* // …load → assign form → markClean(); Save enabled while dirty.value
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useDirtyState(snapshot: () => unknown): {
|
|
22
|
+
dirty: ComputedRef<boolean>;
|
|
23
|
+
markClean: () => void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** One begun request: its abort signal and whether it is still the latest. */
|
|
2
|
+
export interface LatestRequestToken {
|
|
3
|
+
/** Pass to fetch(); aborted as soon as a newer request begins (or on cancel). */
|
|
4
|
+
signal: AbortSignal;
|
|
5
|
+
/**
|
|
6
|
+
* True while no newer begin() / cancel() has happened. Check it after every
|
|
7
|
+
* await before writing state, so a superseded response can never clobber
|
|
8
|
+
* the newer one's — and only the latest call clears its loading flag.
|
|
9
|
+
*/
|
|
10
|
+
isLatest: () => boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* "Latest request wins" guard for views that refetch on every filter change,
|
|
14
|
+
* poll, or Refresh click. Each `begin()` aborts the previous in-flight request
|
|
15
|
+
* on the wire and hands back a fresh AbortSignal plus an `isLatest()` check
|
|
16
|
+
* (a monotonic request id), so a slow, stale response that still lands can be
|
|
17
|
+
* dropped instead of racing the fresh one.
|
|
18
|
+
*
|
|
19
|
+
* `cancel()` aborts the in-flight request and invalidates it without starting
|
|
20
|
+
* a new one (e.g. the selection was cleared). When called inside a component
|
|
21
|
+
* setup / effect scope, the in-flight request is cancelled automatically on
|
|
22
|
+
* unmount.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const latest = useLatestRequest()
|
|
26
|
+
* async function load() {
|
|
27
|
+
* const req = latest.begin()
|
|
28
|
+
* loading.value = true
|
|
29
|
+
* try {
|
|
30
|
+
* const res = await fetchThings(req.signal)
|
|
31
|
+
* if (!req.isLatest()) return
|
|
32
|
+
* rows.value = res
|
|
33
|
+
* } catch (e) {
|
|
34
|
+
* if (!req.isLatest() || isAbortError(e)) return
|
|
35
|
+
* error.value = String(e)
|
|
36
|
+
* } finally {
|
|
37
|
+
* if (req.isLatest()) loading.value = false
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function useLatestRequest(): {
|
|
43
|
+
begin: () => LatestRequestToken;
|
|
44
|
+
cancel: () => void;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* True for the rejection an aborted fetch() produces (a DOMException — or, in
|
|
48
|
+
* some runtimes, a plain Error — named "AbortError"). Superseded / cancelled
|
|
49
|
+
* requests should be swallowed silently rather than shown as an error.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isAbortError(e: unknown): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export { default as BaseFilterChip } from './components/BaseFilterChip.vue';
|
|
|
44
44
|
export { default as BaseCredentialsForm } from './components/BaseCredentialsForm.vue';
|
|
45
45
|
export { default as BasePillPickerModal } from './components/BasePillPickerModal.vue';
|
|
46
46
|
export { default as BaseBarDistribution } from './components/BaseBarDistribution.vue';
|
|
47
|
+
export { default as BaseGroupedChecklist } from './components/BaseGroupedChecklist.vue';
|
|
47
48
|
export type { CredentialsView, CredentialsUpdate } from './components/BaseCredentialsForm.vue';
|
|
48
49
|
export { default as BaseDateTimePicker } from './components/BaseDateTimePicker.vue';
|
|
49
50
|
export type { DateTimePickerMode } from './components/BaseDateTimePicker.vue';
|
|
@@ -74,6 +75,9 @@ export { useFieldClasses } from './composables/useFieldClasses';
|
|
|
74
75
|
export type { FieldClasses } from './composables/useFieldClasses';
|
|
75
76
|
export { usePolling } from './composables/usePolling';
|
|
76
77
|
export type { UsePollingOptions } from './composables/usePolling';
|
|
78
|
+
export { useLatestRequest, isAbortError } from './composables/useLatestRequest';
|
|
79
|
+
export { useDirtyState, stableStringify } from './composables/useDirtyState';
|
|
80
|
+
export type { LatestRequestToken } from './composables/useLatestRequest';
|
|
77
81
|
export { AlertEnum } from './enums/AlertEnum';
|
|
78
82
|
export { BaseBadgeEnum } from './enums/BaseBadgeEnum';
|
|
79
83
|
export { BaseButtonEnum } from './enums/BaseButtonEnum';
|
|
@@ -96,12 +100,13 @@ export type { SpecField, SpecFieldType, SpecFieldValue } from './types/specField
|
|
|
96
100
|
export type { StatBreakdownItem } from './types/statBreakdown';
|
|
97
101
|
export type { PillPickerItem } from './types/pillPicker';
|
|
98
102
|
export type { DistributionBar } from './types/distribution';
|
|
103
|
+
export type { ChecklistGroup } from './types/checklist';
|
|
99
104
|
export { getBaseColor, getBaseColorOf } from './utils/util';
|
|
100
105
|
export { methodBadgeSolid, methodBadgeBright, methodBadgeTinted, statusBadgeSolid, statusBadgeTinted, statusBadgeSoft, } from './utils/httpColors';
|
|
101
106
|
export { rowKeyMissing, rowValueMissing } from './utils/kvRows';
|
|
102
107
|
export type { KeyValueRowLike } from './utils/kvRows';
|
|
103
108
|
export { sanitizeHtml, isSafeHref } from './utils/sanitizeHtml';
|
|
104
|
-
export { fmtNumber, fmtDate, fmtDateTime, fmtDateTimeMs, fmtDateShort, fmtCalendarDate, fmtCalendarDateTime, fmtMsAsSeconds, fmtBytes, fmtPrice, fmtPct, fmtUsd, fmtDuration, formatJson, stringifyValue, } from './utils/format';
|
|
109
|
+
export { fmtNumber, fmtDate, fmtDateTime, fmtDateTimeMs, fmtDateShort, fmtCalendarDate, fmtCalendarDateTime, fmtMsAsSeconds, fmtBytes, fmtPrice, fmtPct, fmtUsd, fmtMoney, fmtDuration, formatJson, stringifyValue, } from './utils/format';
|
|
105
110
|
export { isValidAbsoluteUrl, isValidJson, isValidXml, isValidBase64, } from './utils/validate';
|
|
106
111
|
export { buildSpecParams, firstInvalidNumericSpec } from './utils/specForm';
|
|
107
112
|
export { humanizeEnum, humanizeTextVNodes } from './utils/humanize';
|