mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
code refactor
This commit is contained in:
+2
-2
@@ -16,7 +16,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed, watch, onMounted } from 'vue';
|
import { ref, computed, watch, onMounted } from 'vue';
|
||||||
|
|
||||||
import { useTheme } from 'vuetify';
|
import { useTheme } from 'vuetify';
|
||||||
import { register } from 'register-service-worker';
|
import { register } from 'register-service-worker';
|
||||||
@@ -46,7 +46,7 @@ const userStore = useUserStore();
|
|||||||
const tokensStore = useTokensStore();
|
const tokensStore = useTokensStore();
|
||||||
const exchangeRatesStore = useExchangeRatesStore();
|
const exchangeRatesStore = useExchangeRatesStore();
|
||||||
|
|
||||||
const showNotification: Ref<boolean> = ref(false);
|
const showNotification = ref<boolean>(false);
|
||||||
|
|
||||||
const currentNotificationContent = computed<string | null>(() => rootStore.currentNotification);
|
const currentNotificationContent = computed<string | null>(() => rootStore.currentNotification);
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed, watch, onMounted } from 'vue';
|
import { ref, computed, watch, onMounted } from 'vue';
|
||||||
|
|
||||||
import type { Notification, Actions, Dialog, Popover, Popup, Sheet } from 'framework7/types';
|
import type { Notification, Actions, Dialog, Popover, Popup, Sheet } from 'framework7/types';
|
||||||
import { f7ready } from 'framework7-vue';
|
import { f7ready } from 'framework7-vue';
|
||||||
@@ -36,7 +36,7 @@ const userStore = useUserStore();
|
|||||||
const tokensStore = useTokensStore();
|
const tokensStore = useTokensStore();
|
||||||
const exchangeRatesStore = useExchangeRatesStore();
|
const exchangeRatesStore = useExchangeRatesStore();
|
||||||
|
|
||||||
const f7params: Ref<object> = ref({
|
const f7params = ref<object>({
|
||||||
name: 'ezBookkeeping',
|
name: 'ezBookkeeping',
|
||||||
theme: 'ios',
|
theme: 'ios',
|
||||||
colors: {
|
colors: {
|
||||||
@@ -100,11 +100,11 @@ const f7params: Ref<object> = ref({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const notification: Ref<Notification.Notification | null> = ref(null);
|
const notification = ref<Notification.Notification | null>(null);
|
||||||
|
|
||||||
const isDarkMode: Ref<boolean | undefined> = ref(undefined);
|
const isDarkMode = ref<boolean | undefined>(undefined);
|
||||||
const hasPushPopupBackdrop: Ref<boolean | undefined> = ref(undefined);
|
const hasPushPopupBackdrop = ref<boolean | undefined>(undefined);
|
||||||
const hasBackdrop: Ref<boolean | undefined> = ref(undefined);
|
const hasBackdrop = ref<boolean | undefined>(undefined);
|
||||||
const currentNotificationContent = computed<string | null>(() => rootStore.currentNotification);
|
const currentNotificationContent = computed<string | null>(() => rootStore.currentNotification);
|
||||||
|
|
||||||
function isiOSHomeScreenMode(): boolean {
|
function isiOSHomeScreenMode(): boolean {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed, useTemplateRef } from 'vue';
|
import { ref, computed, useTemplateRef } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
@@ -27,12 +27,12 @@ const props = defineProps<{
|
|||||||
const { tt, getCurrentLanguageInfo } = useI18n();
|
const { tt, getCurrentLanguageInfo } = useI18n();
|
||||||
|
|
||||||
const mapContainer = useTemplateRef<HTMLElement>('mapContainer');
|
const mapContainer = useTemplateRef<HTMLElement>('mapContainer');
|
||||||
const mapInstance: Ref<MapInstance | null> = ref(createMapInstance());
|
const mapInstance = ref<MapInstance | null>(createMapInstance());
|
||||||
const initCenter: Ref<MapPosition> = ref({
|
const initCenter = ref<MapPosition>({
|
||||||
latitude: 0,
|
latitude: 0,
|
||||||
longitude: 0
|
longitude: 0
|
||||||
});
|
});
|
||||||
const zoomLevel: Ref<number> = ref(1);
|
const zoomLevel = ref<number>(1);
|
||||||
|
|
||||||
const mapSupported = computed<boolean>(() => {
|
const mapSupported = computed<boolean>(() => {
|
||||||
return !!mapInstance.value;
|
return !!mapInstance.value;
|
||||||
@@ -56,7 +56,7 @@ const finalMapStyle = computed<Record<string, unknown>>(() => {
|
|||||||
return styles;
|
return styles;
|
||||||
});
|
});
|
||||||
|
|
||||||
function initMapView() {
|
function initMapView(): void {
|
||||||
let isFirstInit = false;
|
let isFirstInit = false;
|
||||||
let centerChanged = false;
|
let centerChanged = false;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed, watch, useTemplateRef } from 'vue';
|
import { ref, computed, watch, useTemplateRef } from 'vue';
|
||||||
|
|
||||||
interface PinCode {
|
interface PinCode {
|
||||||
value: string;
|
value: string;
|
||||||
@@ -38,11 +38,11 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: string): void
|
(e: 'update:modelValue', value: string): void;
|
||||||
(e: 'pincode:confirm', value: string): void
|
(e: 'pincode:confirm', value: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const codes: Ref<PinCode[]> = ref([]);
|
const codes = ref<PinCode[]>([]);
|
||||||
const pinCodeInputs = useTemplateRef<HTMLInputElement[]>('pin-code-input');
|
const pinCodeInputs = useTemplateRef<HTMLInputElement[]>('pin-code-input');
|
||||||
|
|
||||||
const finalPinCode = computed<string>(() => {
|
const finalPinCode = computed<string>(() => {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: unknown): void
|
(e: 'update:modelValue', value: unknown): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const value = computed<unknown>({
|
const value = computed<unknown>({
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed, useTemplateRef, nextTick } from 'vue';
|
import { ref, computed, useTemplateRef, nextTick } from 'vue';
|
||||||
|
|
||||||
import type { ColorValue, ColorInfo } from '@/core/color.ts';
|
import type { ColorValue, ColorInfo } from '@/core/color.ts';
|
||||||
import { DEFAULT_ICON_COLOR } from '@/consts/color.ts';
|
import { DEFAULT_ICON_COLOR } from '@/consts/color.ts';
|
||||||
@@ -61,7 +61,7 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: ColorValue): void
|
(e: 'update:modelValue', value: ColorValue): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
@@ -70,7 +70,7 @@ const icons = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const dropdownMenu = useTemplateRef<HTMLElement>('dropdownMenu');
|
const dropdownMenu = useTemplateRef<HTMLElement>('dropdownMenu');
|
||||||
const itemPerRow: Ref<number> = ref(props.columnCount || 7);
|
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||||
|
|
||||||
const allColorRows = computed<ColorInfo[][]>(() => {
|
const allColorRows = computed<ColorInfo[][]>(() => {
|
||||||
return getColorsInRows(props.allColorInfos, itemPerRow.value);
|
return getColorsInRows(props.allColorInfos, itemPerRow.value);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
@@ -29,20 +29,20 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const showState: Ref<boolean> = ref(false);
|
const showState = ref<boolean>(false);
|
||||||
const titleContent: Ref<string> = ref(props.title || tt('global.app.title'));
|
const titleContent = ref<string>(props.title || tt('global.app.title'));
|
||||||
const textContent: Ref<string> = ref(props.text || '');
|
const textContent = ref<string>(props.text || '');
|
||||||
const finalColor: Ref<string> = ref(props.color || 'primary');
|
const finalColor = ref<string>(props.color || 'primary');
|
||||||
|
|
||||||
let resolveFunc: ((value?: unknown) => void) | null = null;
|
let resolveFunc: ((value?: unknown) => void) | null = null;
|
||||||
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
||||||
|
|
||||||
function open(titleOrText: string, textOrOptions: string | Record<string, unknown>, options: Record<string, unknown>) {
|
function open(titleOrText: string, textOrOptions: string | Record<string, unknown>, options: Record<string, unknown>): Promise<unknown> {
|
||||||
showState.value = true;
|
showState.value = true;
|
||||||
|
|
||||||
if (isString(textOrOptions)) { // second parameter is text
|
if (isString(textOrOptions)) { // second parameter is text
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed, useTemplateRef, nextTick } from 'vue';
|
import { ref, computed, useTemplateRef, nextTick } from 'vue';
|
||||||
|
|
||||||
import type { ColorValue } from '@/core/color.ts';
|
import type { ColorValue } from '@/core/color.ts';
|
||||||
import type { IconInfo, IconInfoWithId } from '@/core/icon.ts';
|
import type { IconInfo, IconInfoWithId } from '@/core/icon.ts';
|
||||||
@@ -60,7 +60,7 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: string): void
|
(e: 'update:modelValue', value: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
@@ -68,13 +68,13 @@ const icons = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const dropdownMenu = useTemplateRef<HTMLElement>('dropdownMenu');
|
const dropdownMenu = useTemplateRef<HTMLElement>('dropdownMenu');
|
||||||
const itemPerRow: Ref<number> = ref(props.columnCount || 7);
|
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||||
|
|
||||||
const allIconRows = computed<IconInfoWithId[][]>(() => {
|
const allIconRows = computed<IconInfoWithId[][]>(() => {
|
||||||
return getIconsInRows(props.allIconInfos, itemPerRow.value);
|
return getIconsInRows(props.allIconInfos, itemPerRow.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
const icon = computed({
|
const icon = computed<string>({
|
||||||
get: () => props.modelValue,
|
get: () => props.modelValue,
|
||||||
set: (value: string) => emit('update:modelValue', value)
|
set: (value: string) => emit('update:modelValue', value)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,20 +9,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
import { isObject } from '@/lib/common.ts';
|
import { isObject } from '@/lib/common.ts';
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt, te } = useI18n();
|
const { tt, te } = useI18n();
|
||||||
|
|
||||||
const showState: Ref<boolean> = ref(false);
|
const showState= ref<boolean>(false);
|
||||||
const messageContent: Ref<string> = ref('');
|
const messageContent = ref<string>('');
|
||||||
|
|
||||||
function showMessage(message: string, options: Record<string, unknown>): void {
|
function showMessage(message: string, options: Record<string, unknown>): void {
|
||||||
showState.value = true;
|
showState.value = true;
|
||||||
@@ -35,7 +35,7 @@ function showError(error: string | { message: string }): void {
|
|||||||
if (isObject(error) && (error as { message: string }).message) {
|
if (isObject(error) && (error as { message: string }).message) {
|
||||||
messageContent.value = te((error as { message: string }).message);
|
messageContent.value = te((error as { message: string }).message);
|
||||||
} else {
|
} else {
|
||||||
messageContent.value = te(error);
|
messageContent.value = te(error as string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'step:change', stepName: string): void
|
(e: 'step:change', stepName: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const isClickable = computed<boolean>(() => {
|
const isClickable = computed<boolean>(() => {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|||||||
@@ -29,14 +29,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
import type { ColorValue, ColorInfo } from '@/core/color.ts';
|
import type { ColorValue, ColorInfo } from '@/core/color.ts';
|
||||||
import { arrayContainsFieldValue } from '@/lib/common.ts';
|
import { arrayContainsFieldValue } from '@/lib/common.ts';
|
||||||
import { getColorsInRows } from '@/lib/color.ts';
|
import { getColorsInRows } from '@/lib/color.ts';
|
||||||
import { scrollToSelectedItem } from '@/lib/ui/mobile.ts';
|
import { type Framework7Dom, scrollToSelectedItem } from '@/lib/ui/mobile.ts';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: ColorValue;
|
modelValue: ColorValue;
|
||||||
@@ -46,34 +46,34 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: ColorValue): void
|
(e: 'update:modelValue', value: ColorValue): void;
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const currentValue: Ref<ColorValue> = ref(props.modelValue);
|
const currentValue = ref<ColorValue>(props.modelValue);
|
||||||
const itemPerRow: Ref<number> = ref(props.columnCount || 7);
|
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||||
|
|
||||||
const allColorRows = computed<ColorInfo[][]>(() => {
|
const allColorRows = computed<ColorInfo[][]>(() => {
|
||||||
return getColorsInRows(props.allColorInfos, itemPerRow.value);
|
return getColorsInRows(props.allColorInfos, itemPerRow.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
function onColorClicked(colorInfo: ColorInfo) {
|
function onColorClicked(colorInfo: ColorInfo): void {
|
||||||
currentValue.value = colorInfo.color;
|
currentValue.value = colorInfo.color;
|
||||||
emit('update:modelValue', currentValue.value);
|
emit('update:modelValue', currentValue.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasSelectedIcon(row: ColorInfo[]) {
|
function hasSelectedIcon(row: ColorInfo[]): boolean {
|
||||||
return arrayContainsFieldValue(row, 'id', currentValue.value);
|
return arrayContainsFieldValue(row, 'id', currentValue.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetOpen(event: { $el: HTMLElement }) {
|
function onSheetOpen(event: { $el: Framework7Dom }): void {
|
||||||
currentValue.value = props.modelValue;
|
currentValue.value = props.modelValue;
|
||||||
scrollToSelectedItem(event.$el, '.page-content', '.row-has-selected-item');
|
scrollToSelectedItem(event.$el, '.page-content', '.row-has-selected-item');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetClosed() {
|
function onSheetClosed(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -29,14 +29,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
import type { IconInfo, IconInfoWithId } from '@/core/icon.ts';
|
import type { IconInfo, IconInfoWithId } from '@/core/icon.ts';
|
||||||
import { arrayContainsFieldValue } from '@/lib/common.ts';
|
import { arrayContainsFieldValue } from '@/lib/common.ts';
|
||||||
import { getIconsInRows } from '@/lib/icon.ts';
|
import { getIconsInRows } from '@/lib/icon.ts';
|
||||||
import { scrollToSelectedItem } from '@/lib/ui/mobile.ts';
|
import { type Framework7Dom, scrollToSelectedItem } from '@/lib/ui/mobile.ts';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: string;
|
modelValue: string;
|
||||||
@@ -47,14 +47,14 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: string): void
|
(e: 'update:modelValue', value: string): void;
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const currentValue: Ref<string> = ref(props.modelValue);
|
const currentValue = ref<string>(props.modelValue);
|
||||||
const itemPerRow: Ref<number> = ref(props.columnCount || 7);
|
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||||
|
|
||||||
const allIconRows = computed<IconInfoWithId[][]>(() => {
|
const allIconRows = computed<IconInfoWithId[][]>(() => {
|
||||||
return getIconsInRows(props.allIconInfos, itemPerRow.value);
|
return getIconsInRows(props.allIconInfos, itemPerRow.value);
|
||||||
@@ -70,20 +70,20 @@ const heightClass = computed<string>(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function onIconClicked(iconInfo: IconInfoWithId) {
|
function onIconClicked(iconInfo: IconInfoWithId): void {
|
||||||
currentValue.value = iconInfo.id;
|
currentValue.value = iconInfo.id;
|
||||||
emit('update:modelValue', currentValue.value);
|
emit('update:modelValue', currentValue.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasSelectedIcon(row: IconInfoWithId[]) {
|
function hasSelectedIcon(row: IconInfoWithId[]): boolean {
|
||||||
return arrayContainsFieldValue(row, 'id', currentValue.value);
|
return arrayContainsFieldValue(row, 'id', currentValue.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetOpen(event: { $el: HTMLElement }) {
|
function onSheetOpen(event: { $el: Framework7Dom }): void {
|
||||||
scrollToSelectedItem(event.$el, '.page-content', '.row-has-selected-item');
|
scrollToSelectedItem(event.$el, '.page-content', '.row-has-selected-item');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetClosed() {
|
function onSheetClosed(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -41,17 +41,17 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
(e: 'info:copied'): void
|
(e: 'info:copied'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const iconCopyToClipboard = useTemplateRef('copyToClipboardIcon');
|
const iconCopyToClipboard = useTemplateRef<unknown>('copyToClipboardIcon');
|
||||||
|
|
||||||
let clipboardHolder: ClipboardHolder | null = null;
|
let clipboardHolder: ClipboardHolder | null = null;
|
||||||
|
|
||||||
function makeCopyToClipboardClickable() {
|
function makeCopyToClipboardClickable(): void {
|
||||||
if (clipboardHolder) {
|
if (clipboardHolder) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -67,11 +67,11 @@ function makeCopyToClipboardClickable() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetClosed() {
|
function onSheetClosed(): void {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: MapPosition | undefined): void,
|
(e: 'update:modelValue', value: MapPosition | undefined): void;
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
@@ -63,21 +63,21 @@ const geoLocation = computed<MapPosition | undefined>({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function save() {
|
function save(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetOpen() {
|
function onSheetOpen(): void {
|
||||||
if (map.value) {
|
if (map.value) {
|
||||||
map.value.initMapView();
|
map.value.initMapView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetClosed() {
|
function onSheetClosed(): void {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helper.js';
|
import { useI18n } from '@/locales/helper.js';
|
||||||
import { useI18nUIComponents } from '@/lib/ui/mobile.ts';
|
import { useI18nUIComponents } from '@/lib/ui/mobile.ts';
|
||||||
@@ -95,13 +95,13 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: number): void,
|
(e: 'update:modelValue', value: number): void;
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const previousValue: Ref<string> = ref('');
|
const previousValue = ref<string>('');
|
||||||
const currentSymbol: Ref<string> = ref('');
|
const currentSymbol = ref<string>('');
|
||||||
const currentValue: Ref<string> = ref(getStringValue(props.modelValue));
|
const currentValue = ref<string>(getStringValue(props.modelValue));
|
||||||
|
|
||||||
const decimalSeparator = computed<string>(() => getCurrentDecimalSeparator(userStore));
|
const decimalSeparator = computed<string>(() => getCurrentDecimalSeparator(userStore));
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
@@ -51,16 +51,16 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: string): void
|
(e: 'update:modelValue', value: string): void;
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
(e: 'passcode:confirm', value: string): void
|
(e: 'passcode:confirm', value: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const currentPasscode: Ref<string> = ref('');
|
const currentPasscode = ref<string>('');
|
||||||
|
|
||||||
function confirm() {
|
function confirm(): void {
|
||||||
if (!currentPasscode.value || props.confirmDisabled) {
|
if (!currentPasscode.value || props.confirmDisabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -69,19 +69,19 @@ function confirm() {
|
|||||||
emit('passcode:confirm', currentPasscode.value);
|
emit('passcode:confirm', currentPasscode.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel(): void {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetOpen() {
|
function onSheetOpen(): void {
|
||||||
currentPasscode.value = '';
|
currentPasscode.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetClosed() {
|
function onSheetClosed(): void {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
@@ -53,16 +53,16 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: string): void
|
(e: 'update:modelValue', value: string): void;
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
(e: 'password:confirm', value: string): void
|
(e: 'password:confirm', value: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const currentPassword: Ref<string> = ref('');
|
const currentPassword = ref<string>('');
|
||||||
|
|
||||||
function confirm() {
|
function confirm(): void {
|
||||||
if (!currentPassword.value || props.confirmDisabled) {
|
if (!currentPassword.value || props.confirmDisabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -71,19 +71,19 @@ function confirm() {
|
|||||||
emit('password:confirm', currentPassword.value);
|
emit('password:confirm', currentPassword.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel(): void {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetOpen() {
|
function onSheetOpen(): void {
|
||||||
currentPassword.value = '';
|
currentPassword.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetClosed() {
|
function onSheetClosed(): void {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type Ref, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
@@ -41,20 +41,20 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: string): void
|
(e: 'update:modelValue', value: string): void;
|
||||||
(e: 'update:show', value: boolean): void
|
(e: 'update:show', value: boolean): void;
|
||||||
(e: 'pincode:confirm', value: string): void
|
(e: 'pincode:confirm', value: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const currentPinCode: Ref<string> = ref('');
|
const currentPinCode = ref<string>('');
|
||||||
|
|
||||||
const currentPinCodeValid = computed<boolean>(() => {
|
const currentPinCodeValid = computed<boolean>(() => {
|
||||||
return currentPinCode.value?.length === 6 || false;
|
return currentPinCode.value?.length === 6 || false;
|
||||||
});
|
});
|
||||||
|
|
||||||
function confirm() {
|
function confirm(): void {
|
||||||
if (!currentPinCodeValid.value || props.confirmDisabled) {
|
if (!currentPinCodeValid.value || props.confirmDisabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -63,15 +63,15 @@ function confirm() {
|
|||||||
emit('pincode:confirm', currentPinCode.value);
|
emit('pincode:confirm', currentPinCode.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel(): void {
|
||||||
emit('update:show', false);
|
emit('update:show', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetOpen() {
|
function onSheetOpen(): void {
|
||||||
currentPinCode.value = '';
|
currentPinCode.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSheetClosed() {
|
function onSheetClosed(): void {
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { isEnableAnimate } from '../settings.ts';
|
|||||||
// @ts-expect-error the above file is migrating to ts
|
// @ts-expect-error the above file is migrating to ts
|
||||||
import { translateError } from '@/locales/helper.js';
|
import { translateError } from '@/locales/helper.js';
|
||||||
|
|
||||||
interface Framework7Dom {
|
export interface Framework7Dom {
|
||||||
length: number;
|
length: number;
|
||||||
[index: number]: Element;
|
[index: number]: Element;
|
||||||
find: (selector?: string) => Framework7Dom;
|
find: (selector?: string) => Framework7Dom;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { type Ref, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import type { LatestExchangeRate, LatestExchangeRateResponse } from '@/models/exchange_rate.ts';
|
import type { LatestExchangeRate, LatestExchangeRateResponse } from '@/models/exchange_rate.ts';
|
||||||
@@ -32,7 +32,7 @@ function clearExchangeRatesFromLocalStorage(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
export const useExchangeRatesStore = defineStore('exchangeRates', () => {
|
||||||
const latestExchangeRates: Ref<LatestExchangeRates> = ref(getExchangeRatesFromLocalStorage());
|
const latestExchangeRates = ref<LatestExchangeRates>(getExchangeRatesFromLocalStorage());
|
||||||
|
|
||||||
const exchangeRatesLastUpdateTime = computed<number | null>(() => {
|
const exchangeRatesLastUpdateTime = computed<number | null>(() => {
|
||||||
const exchangeRates = latestExchangeRates.value || {};
|
const exchangeRates = latestExchangeRates.value || {};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { type Ref, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import { useSettingsStore } from './setting.ts';
|
import { useSettingsStore } from './setting.ts';
|
||||||
@@ -101,7 +101,7 @@ export const useOverviewStore = defineStore('overview', () => {
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const exchangeRatesStore = useExchangeRatesStore();
|
const exchangeRatesStore = useExchangeRatesStore();
|
||||||
|
|
||||||
const transactionDataRange: Ref<TransactionDataRange> = ref({
|
const transactionDataRange = ref<TransactionDataRange>({
|
||||||
today: {
|
today: {
|
||||||
startTime: getTodayFirstUnixTime(),
|
startTime: getTodayFirstUnixTime(),
|
||||||
endTime: getTodayLastUnixTime()
|
endTime: getTodayLastUnixTime()
|
||||||
@@ -164,12 +164,12 @@ export const useOverviewStore = defineStore('overview', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const transactionOverviewOptions: Ref<TransactionOverviewOptions> = ref({
|
const transactionOverviewOptions = ref<TransactionOverviewOptions>({
|
||||||
loadLast11Months: false
|
loadLast11Months: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const transactionOverviewData: Ref<TransactionAmountsResponse> = ref({});
|
const transactionOverviewData = ref<TransactionAmountsResponse>({});
|
||||||
const transactionOverviewStateInvalid: Ref<boolean> = ref(true);
|
const transactionOverviewStateInvalid = ref<boolean>(true);
|
||||||
|
|
||||||
const transactionOverview = computed<TransactionOverviewResponse>(() => {
|
const transactionOverview = computed<TransactionOverviewResponse>(() => {
|
||||||
const overviewData = transactionOverviewData.value;
|
const overviewData = transactionOverviewData.value;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { type Ref, ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import type { ApplicationSettings, LocaleDefaultSettings } from '@/core/setting.ts';
|
import type { ApplicationSettings, LocaleDefaultSettings } from '@/core/setting.ts';
|
||||||
@@ -11,8 +11,8 @@ import {
|
|||||||
} from '@/lib/settings.ts';
|
} from '@/lib/settings.ts';
|
||||||
|
|
||||||
export const useSettingsStore = defineStore('settings', () => {
|
export const useSettingsStore = defineStore('settings', () => {
|
||||||
const appSettings: Ref<ApplicationSettings> = ref(getApplicationSettings());
|
const appSettings = ref<ApplicationSettings>(getApplicationSettings());
|
||||||
const localeDefaultSettings: Ref<LocaleDefaultSettings> = ref(getLocaleDefaultSettings());
|
const localeDefaultSettings = ref<LocaleDefaultSettings>(getLocaleDefaultSettings());
|
||||||
|
|
||||||
function setTheme(value: string): void {
|
function setTheme(value: string): void {
|
||||||
updateApplicationSettingsValue('theme', value);
|
updateApplicationSettingsValue('theme', value);
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import { type Ref, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import { useSettingsStore } from './setting.ts';
|
import { useSettingsStore } from './setting.ts';
|
||||||
@@ -33,7 +33,7 @@ import services from '@/lib/services.ts';
|
|||||||
|
|
||||||
export const useUserStore = defineStore('user', () => {
|
export const useUserStore = defineStore('user', () => {
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
const currentUserBasicInfo: Ref<UserBasicInfo | null> = ref(getCurrentUserInfo());
|
const currentUserBasicInfo = ref<UserBasicInfo | null>(getCurrentUserInfo());
|
||||||
|
|
||||||
const currentUserNickname = computed<string | null>(() => {
|
const currentUserNickname = computed<string | null>(() => {
|
||||||
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
|
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import SnackBar from '@/components/desktop/SnackBar.vue';
|
import SnackBar from '@/components/desktop/SnackBar.vue';
|
||||||
|
|
||||||
import { type Ref, ref, computed, useTemplateRef } from 'vue';
|
import { ref, computed, useTemplateRef } from 'vue';
|
||||||
|
|
||||||
import { useDisplay } from 'vuetify';
|
import { useDisplay } from 'vuetify';
|
||||||
import { useTheme } from 'vuetify';
|
import { useTheme } from 'vuetify';
|
||||||
@@ -272,11 +272,11 @@ const icons = {
|
|||||||
|
|
||||||
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
||||||
|
|
||||||
const logouting: Ref<boolean> = ref(false);
|
const logouting = ref<boolean>(false);
|
||||||
const isVerticalNavScrolled: Ref<boolean> = ref(false);
|
const isVerticalNavScrolled = ref<boolean>(false);
|
||||||
const showVerticalOverlayMenu: Ref<boolean> = ref(false);
|
const showVerticalOverlayMenu = ref<boolean>(false);
|
||||||
const showLoading: Ref<boolean> = ref(false);
|
const showLoading = ref<boolean>(false);
|
||||||
const showMobileQrCode: Ref<boolean> = ref(false);
|
const showMobileQrCode = ref<boolean>(false);
|
||||||
|
|
||||||
const mdAndDown = computed<boolean>(() => {
|
const mdAndDown = computed<boolean>(() => {
|
||||||
return display.mdAndDown.value;
|
return display.mdAndDown.value;
|
||||||
@@ -315,16 +315,16 @@ const isEnableApplicationLock = computed<boolean>(() => {
|
|||||||
return settingsStore.appSettings.applicationLock;
|
return settingsStore.appSettings.applicationLock;
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleNavScroll(e: Event) {
|
function handleNavScroll(e: Event): void {
|
||||||
isVerticalNavScrolled.value = (e.target as HTMLElement).scrollTop > 0;
|
isVerticalNavScrolled.value = (e.target as HTMLElement).scrollTop > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function lock() {
|
function lock(): void {
|
||||||
rootStore.lock();
|
rootStore.lock();
|
||||||
router.replace('/unlock');
|
router.replace('/unlock');
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout(): void {
|
||||||
logouting.value = true;
|
logouting.value = true;
|
||||||
showLoading.value = true;
|
showLoading.value = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user