mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
migrate transaction template store to composition API and typescript
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ export function isObject(val: unknown): val is object {
|
||||
return val != null && typeof(val) === 'object' && !isArray(val);
|
||||
}
|
||||
|
||||
export function isArray(val: unknown): val is [] {
|
||||
export function isArray<T>(val: unknown): val is T[] {
|
||||
if (isFunction(Array.isArray)) {
|
||||
return Array.isArray(val);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export function isNoAvailableTemplate(templates, showHidden) {
|
||||
import { TransactionTemplate } from '@/models/transaction_template.ts';
|
||||
|
||||
export function isNoAvailableTemplate(templates: TransactionTemplate[], showHidden: boolean): boolean {
|
||||
for (let i = 0; i < templates.length; i++) {
|
||||
if (showHidden || !templates[i].hidden) {
|
||||
return false;
|
||||
@@ -8,7 +10,7 @@ export function isNoAvailableTemplate(templates, showHidden) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getAvailableTemplateCount(templates, showHidden) {
|
||||
export function getAvailableTemplateCount(templates: TransactionTemplate[], showHidden: boolean): number {
|
||||
let count = 0;
|
||||
|
||||
for (let i = 0; i < templates.length; i++) {
|
||||
@@ -20,7 +22,7 @@ export function getAvailableTemplateCount(templates, showHidden) {
|
||||
return count;
|
||||
}
|
||||
|
||||
export function getFirstShowingId(templates, showHidden) {
|
||||
export function getFirstShowingId(templates: TransactionTemplate[], showHidden: boolean): string | null {
|
||||
for (let i = 0; i < templates.length; i++) {
|
||||
if (showHidden || !templates[i].hidden) {
|
||||
return templates[i].id;
|
||||
@@ -30,7 +32,7 @@ export function getFirstShowingId(templates, showHidden) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getLastShowingId(templates, showHidden) {
|
||||
export function getLastShowingId(templates: TransactionTemplate[], showHidden: boolean): string | null {
|
||||
for (let i = templates.length - 1; i >= 0; i--) {
|
||||
if (showHidden || !templates[i].hidden) {
|
||||
return templates[i].id;
|
||||
Reference in New Issue
Block a user