conditons (but FROM_TODAY)
This commit is contained in:
@@ -21,15 +21,15 @@ export const conditionList: ConditionItem[] = [
|
||||
label: (field) => (isDateTimeType(field) ? '≦ (以前)' : '≦ (以下)'),
|
||||
type: (field) => dateTimeComponent[field.type] || 'input',
|
||||
},
|
||||
{ value: '<', label: '< (より前)', type: 'input' },
|
||||
{ value: '<', label: '< (より前)', type: (field) => dateTimeComponent[field.type] || 'input' },
|
||||
{
|
||||
value: '>=',
|
||||
label: (field) => (isDateTimeType(field) ? '≧ (以降)' : '≧ (以上)'),
|
||||
type: (field) => dateTimeComponent[field.type] || 'input',
|
||||
},
|
||||
{ value: '>', label: '> (より後)', type: 'input' },
|
||||
{ value: '>', label: '> (より後)', type: (field) => dateTimeComponent[field.type] || 'input' },
|
||||
{ value: 'like', label: '次のキーワードを含む', type: 'input' },
|
||||
{ value: 'not like', label: '次のキーワードを含まない', type: 'input' },
|
||||
{ value: 'not like', label: '次のキーワードを含まない', type: 'input' },
|
||||
{ value: 'in', label: '次のいずれかを含む', type: 'input' },
|
||||
{ value: 'not in', label: '次のいずれも含まない', type: 'input' },
|
||||
];
|
||||
@@ -103,10 +103,10 @@ export const isDateTimeType = (field: OneOf) => {
|
||||
|
||||
const dateTimeComponent: Partial<Record<FieldType, ComponentType>> = {
|
||||
TIME: 'time',
|
||||
// DATE: 'date',
|
||||
// DATETIME: 'datetime',
|
||||
// CREATED_TIME: 'datetime',
|
||||
// UPDATED_TIME: 'datetime',
|
||||
DATE: 'date',
|
||||
DATETIME: 'datetime',
|
||||
CREATED_TIME: 'datetime',
|
||||
UPDATED_TIME: 'datetime',
|
||||
};
|
||||
|
||||
export type ComponentType = keyof typeof component;
|
||||
@@ -123,15 +123,49 @@ type DateFuncItem = {
|
||||
key: DateFuncKey;
|
||||
};
|
||||
|
||||
export type DateFuncKey = '' | 'FROM_TODAY' | 'NOW' | 'TODAY' | 'THIS_WEEK' | 'THIS_MONTH';
|
||||
export type DateFuncKey =
|
||||
| ''
|
||||
| 'FROM_TODAY'
|
||||
| '---NOW---'
|
||||
| 'NOW'
|
||||
| '---DAY---'
|
||||
| 'YESTERDAY'
|
||||
| 'TODAY'
|
||||
| 'TOMORROW'
|
||||
| '---WEEK---'
|
||||
| 'LAST_WEEK'
|
||||
| 'THIS_WEEK'
|
||||
| 'NEXT_WEEK'
|
||||
| '---MONTH---'
|
||||
| 'LAST_MONTH'
|
||||
| 'THIS_MONTH'
|
||||
| 'NEXT_MONTH'
|
||||
| '---YEAR---'
|
||||
| 'LAST_YEAR'
|
||||
| 'THIS_YEAR'
|
||||
| 'NEXT_YEAR';
|
||||
|
||||
export const dateFuncList: DateFuncItem[] = [
|
||||
{ key: '', value: '%s', label: (isTime) => (isTime ? '日時を指定' : '日付を指定') },
|
||||
{ key: 'FROM_TODAY', value: 'FROM_TODAY(%s)', label: '今日から' },
|
||||
{ key: 'FROM_TODAY', value: 'FROM_TODAY(%d, %s)', label: '今日から' },
|
||||
{ key: '---NOW---', value: '\---NOW---', label: '' },
|
||||
{ key: 'NOW', value: 'NOW()', label: '当時刻', condition: 'datetime' },
|
||||
{ key: '---DAY---', value: '\---DAY---', label: '', condition: 'datetime' },
|
||||
{ key: 'YESTERDAY', value: 'YESTERDAY()', label: '昨日' },
|
||||
{ key: 'TODAY', value: 'TODAY()', label: '今日' },
|
||||
{ key: 'TOMORROW', value: 'TOMORROW()', label: '明日' },
|
||||
{ key: '---WEEK---', value: '\---WEEK---', label: '' },
|
||||
{ key: 'LAST_WEEK', value: 'LAST_WEEK(%s)', label: '先週' },
|
||||
{ key: 'THIS_WEEK', value: 'THIS_WEEK(%s)', label: '今週' },
|
||||
{ key: 'NEXT_WEEK', value: 'NEXT_WEEK(%s)', label: '来週' },
|
||||
{ key: '---MONTH---', value: '\---MONTH---', label: '' },
|
||||
{ key: 'LAST_MONTH', value: 'LAST_MONTH(%s)', label: '先月' },
|
||||
{ key: 'THIS_MONTH', value: 'THIS_MONTH(%s)', label: '今月' },
|
||||
{ key: 'NEXT_MONTH', value: 'NEXT_MONTH(%s)', label: '来月' },
|
||||
{ key: '---YEAR---', value: '\---YEAR---', label: '' },
|
||||
{ key: 'LAST_YEAR', value: 'LAST_YEAR()', label: '昨年' },
|
||||
{ key: 'THIS_YEAR', value: 'THIS_YEAR()', label: '今年' },
|
||||
{ key: 'NEXT_YEAR', value: 'NEXT_YEAR()', label: '来年' },
|
||||
];
|
||||
|
||||
// search from dateFuncList
|
||||
|
||||
@@ -23,6 +23,7 @@ export function generateId(): string {
|
||||
}
|
||||
|
||||
export function search(list: Array<WhereCondition | FieldsJoinMapping>, id: string) {
|
||||
if (!list) return;
|
||||
return list.find((item) => item.id === id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user