tdesign-vue
Version:
160 lines (159 loc) • 7.42 kB
TypeScript
import { SetupContext } from '@vue/composition-api';
import { PrimaryTableProps } from '../interface';
import { AllValidateResult } from '../../form/type';
import { PrimaryTableRowEditContext, PrimaryTableRowValidateContext, TableRowData, TableErrorListMap, PrimaryTableCellParams } from '../type';
import { OnEditableChangeContext } from '../editable-cell';
export declare type ErrorListObjectType = PrimaryTableRowEditContext<TableRowData> & {
errorList: AllValidateResult[];
};
export interface TablePromiseErrorData {
errors: ErrorListObjectType[];
errorMap: TableErrorListMap;
}
export default function useRowEdit(props: PrimaryTableProps, context: SetupContext): {
editedFormData: import("@vue/composition-api").Ref<{
[x: string]: {
[x: string]: any;
};
}>;
errorListMap: import("@vue/composition-api").Ref<{
[x: string]: ({
result: boolean;
message: string;
type?: "error" | "success" | "warning";
} | {
result: boolean;
boolean?: boolean;
date?: boolean | {
format: string;
strictMode: boolean;
delimiters: string[];
};
email?: boolean | {
allow_display_name?: boolean;
require_display_name?: boolean;
allow_utf8_local_part?: boolean;
require_tld?: boolean;
ignore_max_length?: boolean;
allow_ip_domain?: boolean;
domain_specific_validation?: boolean;
allow_underscores?: boolean;
host_blacklist?: string[];
host_whitelist?: string[];
blacklisted_chars?: string;
};
enum?: string[];
idcard?: boolean;
len?: number | boolean;
max?: number | boolean;
message?: string;
min?: number | boolean;
number?: boolean;
pattern?: {
exec: (string: string) => RegExpExecArray;
test: (string: string) => boolean;
readonly source: string;
readonly global: boolean;
readonly ignoreCase: boolean;
readonly multiline: boolean;
lastIndex: number;
compile: (pattern: string, flags?: string) => RegExp;
readonly flags: string;
readonly sticky: boolean;
readonly unicode: boolean;
readonly dotAll: boolean;
[Symbol.match]: (string: string) => RegExpMatchArray;
[Symbol.replace]: {
(string: string, replaceValue: string): string;
(string: string, replacer: (substring: string, ...args: any[]) => string): string;
};
[Symbol.search]: (string: string) => number;
[Symbol.split]: (string: string, limit?: number) => string[];
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
};
required?: boolean;
telnumber?: boolean;
trigger?: "blur" | "change" | "submit" | ("blur" | "change" | "submit")[];
type?: "error" | "warning";
url?: boolean | {
protocols?: string[];
require_tld?: boolean;
require_protocol?: boolean;
require_host?: boolean;
require_port?: boolean;
require_valid_protocol?: boolean;
allow_underscores?: boolean;
host_whitelist?: (string | {
exec: (string: string) => RegExpExecArray;
test: (string: string) => boolean;
readonly source: string;
readonly global: boolean;
readonly ignoreCase: boolean;
readonly multiline: boolean;
lastIndex: number;
compile: (pattern: string, flags?: string) => RegExp;
readonly flags: string;
readonly sticky: boolean;
readonly unicode: boolean;
readonly dotAll: boolean;
[Symbol.match]: (string: string) => RegExpMatchArray;
[Symbol.replace]: {
(string: string, replaceValue: string): string;
(string: string, replacer: (substring: string, ...args: any[]) => string): string;
};
[Symbol.search]: (string: string) => number;
[Symbol.split]: (string: string, limit?: number) => string[];
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
})[];
host_blacklist?: (string | {
exec: (string: string) => RegExpExecArray;
test: (string: string) => boolean;
readonly source: string;
readonly global: boolean;
readonly ignoreCase: boolean;
readonly multiline: boolean;
lastIndex: number;
compile: (pattern: string, flags?: string) => RegExp;
readonly flags: string;
readonly sticky: boolean;
readonly unicode: boolean;
readonly dotAll: boolean;
[Symbol.match]: (string: string) => RegExpMatchArray;
[Symbol.replace]: {
(string: string, replaceValue: string): string;
(string: string, replacer: (substring: string, ...args: any[]) => string): string;
};
[Symbol.search]: (string: string) => number;
[Symbol.split]: (string: string, limit?: number) => string[];
[Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
})[];
allow_trailing_dot?: boolean;
allow_protocol_relative_urls?: boolean;
disallow_auth?: boolean;
allow_fragments?: boolean;
allow_query_components?: boolean;
validate_length?: boolean;
max_allowed_length?: number | false;
};
validator?: import("../../form/type").CustomValidator;
whitespace?: boolean;
})[];
}>;
editableKeysMap: import("@vue/composition-api").ComputedRef<{
[key: string]: boolean;
[key: number]: boolean;
}>;
validateTableData: () => Promise<unknown>;
validateRowData: (rowValue: any) => Promise<unknown>;
onRuleChange: (context: PrimaryTableRowEditContext<TableRowData>) => void;
clearValidateData: () => void;
getEditRowData: ({ row, col }: PrimaryTableCellParams<TableRowData>) => {
[x: string]: any;
};
onUpdateEditedCell: (rowValue: any, lastRowData: TableRowData, data: {
[key: string]: any;
}) => void;
onPrimaryTableRowEdit: (params: PrimaryTableRowEditContext<TableRowData>) => void;
onPrimaryTableRowValidate: (params: PrimaryTableRowValidateContext<TableRowData>) => void;
onPrimaryTableCellEditChange: (params: OnEditableChangeContext<TableRowData>) => void;
};