mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 03:02:15 +01:00
Enable npm workspaces and update dependencies
This commit is contained in:
@@ -23,11 +23,11 @@ export const colors = [
|
||||
];
|
||||
|
||||
export function getRandomColor() {
|
||||
return colors[Math.floor(Math.random() * colors.length)];
|
||||
return colors[Math.floor(Math.random() * colors.length)]!;
|
||||
}
|
||||
|
||||
export function getRandomColorWithSeed(seed: string) {
|
||||
const pseudoRandom = new Prando(seed);
|
||||
const index = pseudoRandom.nextInt(0, colors.length - 1);
|
||||
return colors[index];
|
||||
return colors[index]!;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ export type NumberFormat =
|
||||
export function formatNumber(value: number, format?: string): string {
|
||||
// Convert to fixed 2 decimal places first
|
||||
const parts = value.toFixed(2).split('.');
|
||||
const wholePart = parts[0];
|
||||
const decimalPart = parts[1];
|
||||
const wholePart = parts[0] ?? '0';
|
||||
const decimalPart = parts[1] ?? '00';
|
||||
|
||||
// Format the whole number part based on the format
|
||||
let formattedWhole: string;
|
||||
|
||||
@@ -107,7 +107,7 @@ export default class Prando {
|
||||
* @return An item from the array.
|
||||
*/
|
||||
public nextArrayItem<T>(array: T[]): T {
|
||||
return array[this.nextInt(0, array.length - 1)];
|
||||
return array[this.nextInt(0, array.length - 1)] as T;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,16 +12,16 @@ export function useSelectEvents<Type>(
|
||||
const currentHightlightedIndex = filteredItems.value.indexOf(highlightedItem.value);
|
||||
if (currentHightlightedIndex === 0) {
|
||||
highlightedItemId.value = getKeyFromItem(
|
||||
filteredItems.value[filteredItems.value.length - 1]
|
||||
filteredItems.value[filteredItems.value.length - 1]!
|
||||
);
|
||||
} else {
|
||||
highlightedItemId.value = getKeyFromItem(
|
||||
filteredItems.value[currentHightlightedIndex - 1]
|
||||
filteredItems.value[currentHightlightedIndex - 1]!
|
||||
);
|
||||
}
|
||||
} else {
|
||||
highlightedItemId.value = getKeyFromItem(
|
||||
filteredItems.value[filteredItems.value.length - 1]
|
||||
filteredItems.value[filteredItems.value.length - 1]!
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -30,14 +30,14 @@ export function useSelectEvents<Type>(
|
||||
if (highlightedItem.value) {
|
||||
const currentHightlightedIndex = filteredItems.value.indexOf(highlightedItem.value);
|
||||
if (currentHightlightedIndex === filteredItems.value.length - 1) {
|
||||
highlightedItemId.value = getKeyFromItem(filteredItems.value[0]);
|
||||
highlightedItemId.value = getKeyFromItem(filteredItems.value[0]!);
|
||||
} else {
|
||||
highlightedItemId.value = getKeyFromItem(
|
||||
filteredItems.value[currentHightlightedIndex + 1]
|
||||
filteredItems.value[currentHightlightedIndex + 1]!
|
||||
);
|
||||
}
|
||||
} else {
|
||||
highlightedItemId.value = getKeyFromItem(filteredItems.value[0]);
|
||||
highlightedItemId.value = getKeyFromItem(filteredItems.value[0]!);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,9 +227,9 @@ export function parseTimeInput(
|
||||
if (HHMMSStimeRegex.test(input)) {
|
||||
const match = input.match(HHMMSStimeRegex);
|
||||
if (match) {
|
||||
const hours = parseInt(match[1]);
|
||||
const minutes = parseInt(match[2]);
|
||||
const seconds = parseInt(match[3]);
|
||||
const hours = parseInt(match[1]!);
|
||||
const minutes = parseInt(match[2]!);
|
||||
const seconds = parseInt(match[3]!);
|
||||
return hours * 3600 + minutes * 60 + seconds;
|
||||
}
|
||||
}
|
||||
@@ -239,8 +239,8 @@ export function parseTimeInput(
|
||||
if (HHMMtimeRegex.test(input)) {
|
||||
const match = input.match(HHMMtimeRegex);
|
||||
if (match) {
|
||||
const hours = parseInt(match[1]);
|
||||
const minutes = parseInt(match[2]);
|
||||
const hours = parseInt(match[1]!);
|
||||
const minutes = parseInt(match[2]!);
|
||||
return (hours * 60 + minutes) * 60;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user