@forestadmin/datasource-toolkit
Advanced tools
Comparing version 1.34.5 to 1.35.0
@@ -1,2 +0,2 @@ | ||
import { ActionField, ActionResult } from '../interfaces/action'; | ||
import { ActionFormElement, ActionResult } from '../interfaces/action'; | ||
import { Caller } from '../interfaces/caller'; | ||
@@ -20,3 +20,3 @@ import { Chart } from '../interfaces/chart'; | ||
execute(caller: Caller, name: string, data: RecordData, filter?: Filter): Promise<ActionResult>; | ||
getForm(caller: Caller, name: string, data?: RecordData, filter?: Filter, metas?: GetFormMetas): Promise<ActionField[]>; | ||
getForm(caller: Caller, name: string, data?: RecordData, filter?: Filter, metas?: GetFormMetas): Promise<ActionFormElement[]>; | ||
create(caller: Caller, data: RecordData[]): Promise<RecordData[]>; | ||
@@ -23,0 +23,0 @@ list(caller: Caller, filter: PaginatedFilter, projection: Projection): Promise<RecordData[]>; |
@@ -20,4 +20,8 @@ /// <reference types="node" /> | ||
}; | ||
export type ActionFieldBase = { | ||
export type ActionFormElementBase = { | ||
type: ActionFieldType | LayoutElementType; | ||
}; | ||
export interface ActionFieldBase extends ActionFormElementBase { | ||
type: ActionFieldType; | ||
widget?: ActionFieldWidget; | ||
label: string; | ||
@@ -29,36 +33,37 @@ description?: string; | ||
watchChanges: boolean; | ||
}; | ||
} | ||
export declare const ActionFieldTypeList: readonly ["Boolean", "Collection", "Date", "Dateonly", "Time", "Enum", "File", "Json", "Number", "String", "EnumList", "FileList", "NumberList", "StringList"]; | ||
export type ActionFieldType = (typeof ActionFieldTypeList)[number]; | ||
type ActionFieldLimitedValue<TWidget extends string, TType extends ActionFieldType = ActionFieldType, TValue = unknown> = ActionFieldBase & { | ||
type ActionFieldType = 'Boolean' | 'Collection' | 'Date' | 'Dateonly' | 'Time' | 'Enum' | 'File' | 'Json' | 'Number' | 'String' | 'EnumList' | 'FileList' | 'NumberList' | 'StringList'; | ||
export type LayoutElementType = 'Layout'; | ||
interface ActionFieldLimitedValue<TWidget extends ActionFieldWidget, TType extends ActionFieldType = ActionFieldType, TValue = unknown> extends ActionFieldBase { | ||
widget: TWidget; | ||
type: TType; | ||
options?: LimitedValuesOption<TValue>[]; | ||
}; | ||
export type ActionFieldDropdown<TType extends ActionFieldType = ActionFieldType, TValue = unknown> = ActionFieldBase & ActionFieldLimitedValue<'Dropdown', TType, TValue> & { | ||
} | ||
export interface ActionFieldDropdown<TType extends ActionFieldType = ActionFieldType, TValue = unknown> extends ActionFieldLimitedValue<'Dropdown', TType, TValue> { | ||
search?: 'static' | 'disabled' | 'dynamic'; | ||
placeholder?: string; | ||
}; | ||
export type ActionFieldCheckbox = ActionFieldBase & { | ||
} | ||
export interface ActionFieldCheckbox extends ActionFieldBase { | ||
type: 'Boolean'; | ||
widget: 'Checkbox'; | ||
}; | ||
export type ActionFieldEnum = ActionFieldBase & { | ||
} | ||
export interface ActionFieldEnum extends ActionFieldBase { | ||
type: 'Enum'; | ||
enumValues: string[]; | ||
}; | ||
export type ActionFieldEnumList = ActionFieldBase & { | ||
} | ||
export interface ActionFieldEnumList extends ActionFieldBase { | ||
type: 'EnumList'; | ||
enumValues: string[]; | ||
}; | ||
export type ActionFieldCollection = ActionFieldBase & { | ||
} | ||
export interface ActionFieldCollection extends ActionFieldBase { | ||
type: 'Collection'; | ||
collectionName: string; | ||
}; | ||
export type ActionFieldTextInput = ActionFieldBase & { | ||
} | ||
export interface ActionFieldTextInput extends ActionFieldBase { | ||
type: 'String'; | ||
widget: 'TextInput'; | ||
placeholder?: string; | ||
}; | ||
export type ActionFieldDatePickerInput = ActionFieldBase & { | ||
} | ||
export interface ActionFieldDatePickerInput extends ActionFieldBase { | ||
type: 'Date' | 'Dateonly' | 'String'; | ||
@@ -70,4 +75,4 @@ widget: 'DatePicker'; | ||
placeholder?: string; | ||
}; | ||
export type ActionFieldFilePicker = ActionFieldBase & { | ||
} | ||
export interface ActionFieldFilePicker extends ActionFieldBase { | ||
type: 'File' | 'FileList'; | ||
@@ -78,4 +83,4 @@ widget: 'FilePicker'; | ||
maxSizeMb?: number; | ||
}; | ||
export type ActionFieldTextInputList = ActionFieldBase & { | ||
} | ||
export interface ActionFieldTextInputList extends ActionFieldBase { | ||
type: 'StringList'; | ||
@@ -87,4 +92,4 @@ widget: 'TextInputList'; | ||
allowDuplicates?: boolean; | ||
}; | ||
export type ActionFieldTextArea = ActionFieldBase & { | ||
} | ||
export interface ActionFieldTextArea extends ActionFieldBase { | ||
type: 'String'; | ||
@@ -94,9 +99,9 @@ widget: 'TextArea'; | ||
rows?: number; | ||
}; | ||
export type ActionFieldRichText = ActionFieldBase & { | ||
} | ||
export interface ActionFieldRichText extends ActionFieldBase { | ||
type: 'String'; | ||
widget: 'RichText'; | ||
placeholder?: string; | ||
}; | ||
export type ActionFieldNumberInput = ActionFieldBase & { | ||
} | ||
export interface ActionFieldNumberInput extends ActionFieldBase { | ||
type: 'Number'; | ||
@@ -108,4 +113,4 @@ widget: 'NumberInput'; | ||
step?: number; | ||
}; | ||
export type ActionFieldColorPicker = ActionFieldBase & { | ||
} | ||
export interface ActionFieldColorPicker extends ActionFieldBase { | ||
type: 'String'; | ||
@@ -116,4 +121,4 @@ widget: 'ColorPicker'; | ||
quickPalette?: string[]; | ||
}; | ||
export type ActionFieldNumberInputList = ActionFieldBase & { | ||
} | ||
export interface ActionFieldNumberInputList extends ActionFieldBase { | ||
widget: 'NumberInputList'; | ||
@@ -127,4 +132,4 @@ type: 'NumberList'; | ||
step?: number; | ||
}; | ||
export type ActionFieldCurrencyInput = ActionFieldBase & { | ||
} | ||
export interface ActionFieldCurrencyInput extends ActionFieldBase { | ||
type: 'Number'; | ||
@@ -138,21 +143,21 @@ widget: 'CurrencyInput'; | ||
base?: 'Unit' | 'Cent'; | ||
}; | ||
export type ActionFieldUserDropdown = ActionFieldBase & { | ||
} | ||
export interface ActionFieldUserDropdown extends ActionFieldBase { | ||
type: 'String'; | ||
widget: 'UserDropdown'; | ||
placeholder?: string; | ||
}; | ||
export type ActionFieldTimePicker = ActionFieldBase & { | ||
} | ||
export interface ActionFieldTimePicker extends ActionFieldBase { | ||
type: 'Time'; | ||
widget: 'TimePicker'; | ||
}; | ||
export type ActionFieldJsonEditor = ActionFieldBase & { | ||
} | ||
export interface ActionFieldJsonEditor extends ActionFieldBase { | ||
type: 'Json'; | ||
widget: 'JsonEditor'; | ||
}; | ||
export type ActionFieldAddressAutocomplete = ActionFieldBase & { | ||
} | ||
export interface ActionFieldAddressAutocomplete extends ActionFieldBase { | ||
type: 'String'; | ||
widget: 'AddressAutocomplete'; | ||
placeholder?: string; | ||
}; | ||
} | ||
export type ActionFieldDropdownAll = ActionFieldDropdown<'Date' | 'Dateonly' | 'Number' | 'String' | 'StringList', string> | ActionFieldDropdown<'Number' | 'NumberList', number>; | ||
@@ -162,3 +167,21 @@ export type ActionFieldRadioGroupButtonAll = ActionFieldLimitedValue<'RadioGroup', 'Date' | 'Dateonly' | 'Number' | 'String', string> | ActionFieldLimitedValue<'RadioGroup', 'Number', number>; | ||
export type ActionField = StrictUnion<ActionFieldBase | ActionFieldEnum | ActionFieldEnumList | ActionFieldCollection | ActionFieldDropdownAll | ActionFieldRadioGroupButtonAll | ActionFieldCheckboxGroupAll | ActionFieldCheckbox | ActionFieldTextInput | ActionFieldTextInputList | ActionFieldTextArea | ActionFieldRichText | ActionFieldNumberInput | ActionFieldColorPicker | ActionFieldNumberInputList | ActionFieldDatePickerInput | ActionFieldCurrencyInput | ActionFieldUserDropdown | ActionFieldTimePicker | ActionFieldJsonEditor | ActionFieldFilePicker | ActionFieldAddressAutocomplete>; | ||
export type ActionFieldWidget = 'Dropdown' | 'RadioGroup' | 'CheckboxGroup' | 'Checkbox' | 'TextInput' | 'TextInputList' | 'TextArea' | 'Timepicker' | 'RichText' | 'NumberInput' | 'NumberInputList' | 'ColorPicker' | 'DatePicker' | 'AddressAutocomplete' | 'UserDropdown' | 'TimePicker' | 'FilePicker' | 'JsonEditor'; | ||
export type ActionFieldWidget = 'Dropdown' | 'RadioGroup' | 'CheckboxGroup' | 'Checkbox' | 'TextInput' | 'TextInputList' | 'TextArea' | 'Timepicker' | 'RichText' | 'NumberInput' | 'NumberInputList' | 'CurrencyInput' | 'ColorPicker' | 'DatePicker' | 'AddressAutocomplete' | 'UserDropdown' | 'TimePicker' | 'FilePicker' | 'JsonEditor'; | ||
type LayoutElementComponentType = 'Input' | 'Separator'; | ||
interface ActionLayoutElementBase extends ActionFormElementBase { | ||
type: 'Layout'; | ||
component: LayoutElementComponentType; | ||
} | ||
interface LayoutElementSeparator extends ActionLayoutElementBase { | ||
component: 'Separator'; | ||
} | ||
export interface LayoutElementInput extends ActionLayoutElementBase { | ||
component: 'Input'; | ||
fieldId: string; | ||
} | ||
export type ActionLayoutElement = LayoutElementSeparator | LayoutElementInput; | ||
export type ActionFormElement = ActionLayoutElement | ActionField; | ||
export type ActionForm = { | ||
fields: ActionField[]; | ||
layout: ActionLayoutElement[]; | ||
}; | ||
export type SuccessResult = { | ||
@@ -165,0 +188,0 @@ type: 'Success'; |
@@ -20,2 +20,2 @@ "use strict"; | ||
]; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2ludGVyZmFjZXMvYWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQStCYSxRQUFBLG1CQUFtQixHQUFHO0lBQ2pDLFNBQVM7SUFDVCxZQUFZO0lBQ1osTUFBTTtJQUNOLFVBQVU7SUFDVixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sUUFBUTtJQUNSLFFBQVE7SUFDUixVQUFVO0lBQ1YsVUFBVTtJQUNWLFlBQVk7SUFDWixZQUFZO0NBQ0osQ0FBQyJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2ludGVyZmFjZXMvYWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQW9DYSxRQUFBLG1CQUFtQixHQUFHO0lBQ2pDLFNBQVM7SUFDVCxZQUFZO0lBQ1osTUFBTTtJQUNOLFVBQVU7SUFDVixNQUFNO0lBQ04sTUFBTTtJQUNOLE1BQU07SUFDTixNQUFNO0lBQ04sUUFBUTtJQUNSLFFBQVE7SUFDUixVQUFVO0lBQ1YsVUFBVTtJQUNWLFlBQVk7SUFDWixZQUFZO0NBQ0osQ0FBQyJ9 |
@@ -1,2 +0,2 @@ | ||
import { ActionField, ActionResult } from './action'; | ||
import { ActionFormElement, ActionResult } from './action'; | ||
import { Caller } from './caller'; | ||
@@ -28,3 +28,3 @@ import { Chart } from './chart'; | ||
execute(caller: Caller, name: string, formValues: RecordData, filter?: Filter): Promise<ActionResult>; | ||
getForm(caller: Caller, name: string, formValues?: RecordData, filter?: Filter, metas?: GetFormMetas): Promise<ActionField[]>; | ||
getForm(caller: Caller, name: string, formValues?: RecordData, filter?: Filter, metas?: GetFormMetas): Promise<ActionFormElement[]>; | ||
create(caller: Caller, data: RecordData[]): Promise<RecordData[]>; | ||
@@ -31,0 +31,0 @@ list(caller: Caller, filter: PaginatedFilter, projection: Projection): Promise<RecordData[]>; |
{ | ||
"name": "@forestadmin/datasource-toolkit", | ||
"version": "1.34.5", | ||
"version": "1.35.0", | ||
"main": "dist/src/index.js", | ||
@@ -5,0 +5,0 @@ "license": "GPL-3.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
273981
3041