mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
use for-of statements to replace for and for-in
This commit is contained in:
@@ -87,7 +87,7 @@
|
||||
:after="account.type === AccountType.SingleAccount.type ? accountBalance(account) : ''"
|
||||
:link="!sortable ? '/transaction/list?accountIds=' + account.id : null"
|
||||
:key="account.id"
|
||||
v-for="account in allCategorizedAccountsMap[accountCategory.type].accounts"
|
||||
v-for="account in allCategorizedAccountsMap[accountCategory.type]!.accounts"
|
||||
v-show="showHidden || !account.hidden"
|
||||
@taphold="setSortable()"
|
||||
>
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
<f7-list-item chevron-center
|
||||
:key="item.index"
|
||||
:id="item.transaction ? getTransactionDomId(item.transaction) : undefined"
|
||||
:class="{ 'transaction-info': item.type == 'transaction', 'last-transaction-of-day': allReconciliationStatementVirtualListItems[item.index + 1] && allReconciliationStatementVirtualListItems[item.index + 1].type === 'date', 'reconciliation-statement-transaction-date': item.type == 'date' }"
|
||||
:class="{ 'transaction-info': item.type == 'transaction', 'last-transaction-of-day': allReconciliationStatementVirtualListItems[item.index + 1] && allReconciliationStatementVirtualListItems[item.index + 1]!.type === 'date', 'reconciliation-statement-transaction-date': item.type == 'date' }"
|
||||
:style="`top: ${virtualDataItems.topPosition}px`"
|
||||
:virtual-list-index="item.index"
|
||||
:swipeout="item.type === 'transaction' && !!item.transaction"
|
||||
@@ -204,7 +204,7 @@
|
||||
{{ tt('Modify Balance') }}
|
||||
</span>
|
||||
<span v-else-if="item.transaction.type !== TransactionType.ModifyBalance && allCategoriesMap[item.transaction.categoryId]">
|
||||
{{ allCategoriesMap[item.transaction.categoryId].name }}
|
||||
{{ allCategoriesMap[item.transaction.categoryId]!.name }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -466,8 +466,7 @@ const allReconciliationStatementVirtualListItems = computed<ReconciliationStatem
|
||||
let index = 0;
|
||||
let lastDisplayDate: string | null = null;
|
||||
|
||||
for (let i = 0; i < reconciliationStatements.value.transactions.length; i++) {
|
||||
const transaction = reconciliationStatements.value.transactions[i];
|
||||
for (const transaction of reconciliationStatements.value.transactions) {
|
||||
const displayDate = getDisplayDate(transaction);
|
||||
|
||||
if (lastDisplayDate !== displayDate) {
|
||||
|
||||
@@ -47,22 +47,22 @@
|
||||
:key="accountCategory.category"
|
||||
v-for="accountCategory in allCategorizedAccounts"
|
||||
v-show="showHidden || accountCategory.allVisibleAccountCount > 0">
|
||||
<f7-accordion-item :opened="collapseStates[accountCategory.category].opened"
|
||||
@accordion:open="collapseStates[accountCategory.category].opened = true"
|
||||
@accordion:close="collapseStates[accountCategory.category].opened = false">
|
||||
<f7-accordion-item :opened="collapseStates[accountCategory.category]!.opened"
|
||||
@accordion:open="collapseStates[accountCategory.category]!.opened = true"
|
||||
@accordion:close="collapseStates[accountCategory.category]!.opened = false">
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers
|
||||
class="combination-list-header"
|
||||
:class="collapseStates[accountCategory.category].opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
:class="collapseStates[accountCategory.category]!.opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
<f7-list-item group-title>
|
||||
<small>{{ tt(accountCategory.name) }}</small>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[accountCategory.category].opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[accountCategory.category]!.opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content :style="{ height: collapseStates[accountCategory.category].opened ? 'auto' : '' }">
|
||||
<f7-accordion-content :style="{ height: collapseStates[accountCategory.category]!.opened ? 'auto' : '' }">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox
|
||||
:class="{ 'has-child-list-item': account.type === AccountType.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id]) }"
|
||||
@@ -189,9 +189,7 @@ function getCollapseStates(): Record<number, CollapseState> {
|
||||
const collapseStates: Record<number, CollapseState> = {};
|
||||
const allCategories = AccountCategory.values();
|
||||
|
||||
for (let i = 0; i < allCategories.length; i++) {
|
||||
const accountCategory = allCategories[i];
|
||||
|
||||
for (const accountCategory of allCategories) {
|
||||
collapseStates[accountCategory.type] = {
|
||||
opened: true
|
||||
};
|
||||
|
||||
@@ -52,22 +52,22 @@
|
||||
:key="categoryType.type"
|
||||
v-for="categoryType in allTransactionCategories"
|
||||
v-else-if="!loading">
|
||||
<f7-accordion-item :opened="collapseStates[categoryType.type].opened"
|
||||
@accordion:open="collapseStates[categoryType.type].opened = true"
|
||||
@accordion:close="collapseStates[categoryType.type].opened = false">
|
||||
<f7-accordion-item :opened="collapseStates[categoryType.type]!.opened"
|
||||
@accordion:open="collapseStates[categoryType.type]!.opened = true"
|
||||
@accordion:close="collapseStates[categoryType.type]!.opened = false">
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers
|
||||
class="combination-list-header"
|
||||
:class="collapseStates[categoryType.type].opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
:class="collapseStates[categoryType.type]!.opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
<f7-list-item group-title>
|
||||
<small>{{ getCategoryTypeName(categoryType.type) }}</small>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[categoryType.type].opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates[categoryType.type]!.opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content :style="{ height: collapseStates[categoryType.type].opened ? 'auto' : '' }">
|
||||
<f7-accordion-content :style="{ height: collapseStates[categoryType.type]!.opened ? 'auto' : '' }">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content" v-if="!hasAvailableCategory[categoryType.type]">
|
||||
<f7-list-item :title="tt('No available category')"></f7-list-item>
|
||||
</f7-list>
|
||||
@@ -242,7 +242,7 @@ function updateAllSubCategoriesSelected(e: Event): void {
|
||||
const categoryId = target.value;
|
||||
const category = transactionCategoriesStore.allTransactionCategoriesMap[categoryId];
|
||||
|
||||
selectAllSubCategories(filterCategoryIds.value, category, !target.checked);
|
||||
selectAllSubCategories(filterCategoryIds.value, !target.checked, category);
|
||||
}
|
||||
|
||||
function selectAllCategories(): void {
|
||||
|
||||
@@ -51,22 +51,22 @@
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-accordion-item :opened="collapseStates['default'].opened"
|
||||
@accordion:open="collapseStates['default'].opened = true"
|
||||
@accordion:close="collapseStates['default'].opened = false">
|
||||
<f7-accordion-item :opened="collapseStates['default']!.opened"
|
||||
@accordion:open="collapseStates['default']!.opened = true"
|
||||
@accordion:close="collapseStates['default']!.opened = false">
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers
|
||||
class="combination-list-header"
|
||||
:class="collapseStates['default'].opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
:class="collapseStates['default']!.opened ? 'combination-list-opened' : 'combination-list-closed'">
|
||||
<f7-list-item group-title>
|
||||
<small>{{ tt('Tags') }}</small>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates['default'].opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
<f7-icon class="combination-list-chevron-icon" :f7="collapseStates['default']!.opened ? 'chevron_up' : 'chevron_down'"></f7-icon>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content :style="{ height: collapseStates['default'].opened ? 'auto' : '' }">
|
||||
<f7-accordion-content :style="{ height: collapseStates['default']!.opened ? 'auto' : '' }">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox
|
||||
:title="transactionTag.name"
|
||||
|
||||
@@ -119,13 +119,13 @@ function init(): void {
|
||||
if (isString(query['value'])) {
|
||||
try {
|
||||
const filterItems = query['value'].split(':');
|
||||
const amountCount = getAmountFilterParameterCount(filterItems[0]);
|
||||
const amountCount = getAmountFilterParameterCount(filterItems[0] as string);
|
||||
|
||||
if (filterItems.length === 2 && amountCount === 1) {
|
||||
queryAmount1 = parseInt(filterItems[1]);
|
||||
queryAmount1 = parseInt(filterItems[1] as string);
|
||||
} else if (filterItems.length === 3 && amountCount === 2) {
|
||||
queryAmount1 = parseInt(filterItems[1]);
|
||||
queryAmount2 = parseInt(filterItems[2]);
|
||||
queryAmount1 = parseInt(filterItems[1] as string);
|
||||
queryAmount2 = parseInt(filterItems[2] as string);
|
||||
}
|
||||
} catch (ex) {
|
||||
logger.warn('cannot parse amount from filter value, original value is ' + query['value'], ex);
|
||||
|
||||
@@ -721,9 +721,9 @@ const transactionDisplayScheduledFrequency = computed<string>(() => {
|
||||
const items = (template.scheduledFrequency || '').split(',');
|
||||
const scheduledFrequencyValues: number[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i]) {
|
||||
scheduledFrequencyValues.push(parseInt(items[i]));
|
||||
for (const item of items) {
|
||||
if (item) {
|
||||
scheduledFrequencyValues.push(parseInt(item));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,7 +912,7 @@ function init(): void {
|
||||
if (query['id'] && responses[4] instanceof Transaction) {
|
||||
fromTransaction = responses[4];
|
||||
} else if (query['templateId'] && transactionTemplatesStore.allTransactionTemplatesMap && transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type]) {
|
||||
fromTransaction = transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type][query['templateId']];
|
||||
fromTransaction = (transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type] as Record<string, TransactionTemplate>)[query['templateId']] ?? null;
|
||||
|
||||
if (fromTransaction) {
|
||||
addByTemplateId.value = fromTransaction.id;
|
||||
@@ -1163,7 +1163,7 @@ function uploadPicture(event: Event): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const pictureFile = el.files[0];
|
||||
const pictureFile = el.files[0] as File;
|
||||
|
||||
el.value = '';
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ import { useI18nUIComponents, showLoading, hideLoading, onSwipeoutDeleted } from
|
||||
|
||||
import { useTokensStore } from '@/stores/token.ts';
|
||||
|
||||
import { itemAndIndex, reversedItemAndIndex } from '@/core/base.ts';
|
||||
import { TextDirection } from '@/core/text.ts';
|
||||
import { type TokenInfoResponse, SessionInfo } from '@/models/token.ts';
|
||||
|
||||
@@ -94,8 +95,7 @@ const sessions = computed<MobilePageSessionInfo[]>(() => {
|
||||
return sessions;
|
||||
}
|
||||
|
||||
for (let i = 0; i < tokens.value.length; i++) {
|
||||
const token = tokens.value[i];
|
||||
for (const token of tokens.value) {
|
||||
const sessionInfo = parseSessionInfo(token);
|
||||
sessions.push(new MobilePageSessionInfo(sessionInfo));
|
||||
}
|
||||
@@ -171,9 +171,9 @@ function revoke(session: SessionInfo): void {
|
||||
hideLoading();
|
||||
|
||||
onSwipeoutDeleted(getTokenDomId(session.tokenId), () => {
|
||||
for (let i = 0; i < tokens.value.length; i++) {
|
||||
if (tokens.value[i].tokenId === session.tokenId) {
|
||||
tokens.value.splice(i, 1);
|
||||
for (const [ token, index ] of itemAndIndex(tokens.value)) {
|
||||
if (token.tokenId === session.tokenId) {
|
||||
tokens.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -198,9 +198,9 @@ function revokeAll(): void {
|
||||
tokensStore.revokeAllTokens().then(() => {
|
||||
hideLoading();
|
||||
|
||||
for (let i = tokens.value.length - 1; i >= 0; i--) {
|
||||
if (!tokens.value[i].isCurrent) {
|
||||
tokens.value.splice(i, 1);
|
||||
for (const [ token, index ] of reversedItemAndIndex(tokens.value)) {
|
||||
if (!token.isCurrent) {
|
||||
tokens.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -666,9 +666,9 @@ const allLanguages = computed<LanguageOption[]>(() => getAllLanguageOptions(true
|
||||
const allCurrencies = computed<LocalizedCurrencyInfo[]>(() => getAllCurrencies());
|
||||
|
||||
const currentLanguageName = computed<string>(() => {
|
||||
for (let i = 0; i < allLanguages.value.length; i++) {
|
||||
if (allLanguages.value[i].languageTag === newProfile.value.language) {
|
||||
return allLanguages.value[i].nativeDisplayName;
|
||||
for (const lang of allLanguages.value) {
|
||||
if (lang.languageTag === newProfile.value.language) {
|
||||
return lang.nativeDisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user