fix bug for +/-

This commit is contained in:
2025-01-23 17:13:34 +08:00
parent 6bd86ae92c
commit 36a24ebdff
11 changed files with 146 additions and 62 deletions

View File

@@ -0,0 +1,11 @@
import type { FieldType } from "./kintone-rest-api-client";
const availableJoinType: FieldType[] = [
'SINGLE_LINE_TEXT',
'NUMBER',
'CALC',
'DATE',
'TIME',
'DATETIME',
'LINK'
] as const

View File

@@ -1,4 +1,4 @@
import type { FieldsInfo, JoinTable, WhereCondition } from '@/types/model';
import type { FieldsInfo, FieldsJoinMapping, JoinTable, WhereCondition } from '@/types/model';
import { client, isType, type FieldType, type App, type Layout } from './kintone-rest-api-client';
import type { DropdownItem } from 'kintone-ui-component';
@@ -7,11 +7,21 @@ export const EMPTY_OPTION = {
label: '--------',
} as DropdownItem;
export const getEmptyWhereCondition = () => ({ field: '', condition: '', data: '' }) as WhereCondition;
export const getEmptyOnCondition = () => ({ leftField: '', rightField: '' });
export const getEmptyFieldsMapping = () => ({ leftField: '', rightField: '' });
export function generateId(): string {
const timestamp = new Date().getTime().toString(36);
const randomNum = Math.random().toString(36).substring(2, 11);
return `${timestamp}-${randomNum}`;
}
export function createEmptyJoinTable(id = Number(new Date())) {
export function search(list: Array<WhereCondition|FieldsJoinMapping>, id: string) {
return list.find(item => item.id === id);
}
export const getEmptyWhereCondition = () => ({ field: '', condition: '', data: '', id: generateId()} as WhereCondition);
export const getEmptyOnCondition = () => ({ leftField: '', rightField: '', id: generateId() } as FieldsJoinMapping);
export const getEmptyFieldsMapping = () => ({ leftField: '', rightField: '', id: generateId() } as FieldsJoinMapping);
export function createEmptyJoinTable(id = generateId()) {
return resetTable({ id, app: '' } as JoinTable);
}