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.
- package/README.md +17 -0
- package/dist/components/BaseBooleanIcon.vue.d.ts +14 -0
- package/dist/components/BaseDetailList.vue.d.ts +13 -1
- package/dist/components/BasePhotoViewer.vue.d.ts +24 -0
- package/dist/components/BaseRating.vue.d.ts +9 -0
- package/dist/components/BaseRowButton.vue.d.ts +18 -0
- package/dist/components/BaseSelect.vue.d.ts +15 -3
- package/dist/components/BaseSidebarUser.vue.d.ts +3 -0
- package/dist/components/BaseStatCard.vue.d.ts +6 -4
- package/dist/components/BaseTextarea.vue.d.ts +12 -0
- package/dist/composables/useRefreshOnReturn.d.ts +7 -0
- package/dist/index.d.ts +8 -1
- package/dist/types/photoViewer.d.ts +6 -0
- package/dist/ui-lib.css +1 -1
- package/dist/ui-lib.js +1018 -819
- package/dist/ui-lib.umd.cjs +1 -1
- package/dist/utils/format.d.ts +9 -0
- package/package.json +1 -1
- package/src/components/BaseBadge.vue +7 -7
- package/src/components/BaseBooleanIcon.vue +22 -0
- package/src/components/BaseDetailList.vue +50 -47
- package/src/components/BaseField.label.test.ts +30 -0
- package/src/components/BaseField.vue +19 -3
- package/src/components/BasePhotoViewer.test.ts +22 -0
- package/src/components/BasePhotoViewer.vue +93 -0
- package/src/components/BaseRating.test.ts +19 -0
- package/src/components/BaseRating.vue +21 -0
- package/src/components/BaseRowButton.vue +24 -0
- package/src/components/BaseSelect.vue +4 -2
- package/src/components/BaseSidebarUser.vue +85 -75
- package/src/components/BaseStatCard.vue +11 -3
- package/src/components/BaseTextarea.test.ts +17 -0
- package/src/components/BaseTextarea.vue +24 -0
- package/src/composables/useRefreshOnReturn.test.ts +47 -0
- package/src/composables/useRefreshOnReturn.ts +24 -0
- package/src/index.ts +10 -0
- package/src/types/photoViewer.ts +6 -0
- package/src/utils/format.test.ts +342 -322
- package/src/utils/format.ts +23 -0
package/src/utils/format.ts
CHANGED
|
@@ -281,3 +281,26 @@ export function fmtDuration(ms: number | null | undefined, maxUnits = 2): string
|
|
|
281
281
|
parts.push(`${mins}m`)
|
|
282
282
|
return parts.slice(0, maxUnits).join(' ')
|
|
283
283
|
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Normalize a backend time string for display: "11:00:00" → "11:00".
|
|
287
|
+
* Leaves already-short ("11:00") or unexpected values untouched.
|
|
288
|
+
*/
|
|
289
|
+
export function fmtTime(time?: string | null): string {
|
|
290
|
+
if (!time) return '—'
|
|
291
|
+
const match = /^(\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(time)
|
|
292
|
+
return match ? match[1] : time
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** ISO instant → "YYYY-MM-DDTHH:mm" in the browser's time zone, for <input type="datetime-local">. */
|
|
296
|
+
export function toLocalInput(iso?: string | null): string {
|
|
297
|
+
if (!iso) return ''
|
|
298
|
+
const d = new Date(iso)
|
|
299
|
+
const pad = (n: number) => String(n).padStart(2, '0')
|
|
300
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Value of an <input type="datetime-local"> → ISO instant (null when empty). */
|
|
304
|
+
export function fromLocalInput(value: string): string | null {
|
|
305
|
+
return value ? new Date(value).toISOString() : null
|
|
306
|
+
}
|