dromo-uploader-react
Advanced tools
Comparing version
import * as React from 'react'; | ||
import { IColumnHookInput, IColumnHookOutput, IColumnHook, IDeveloperField, IValidatorField, IDeveloperSettings, IRowHookInput, IRowHookOutput, IRowHook, IDeveloperStyleOverrides, IUser, IResultMetadata, EStepHook, IStepHook, IRowDeleteHook } from './interfaces'; | ||
import { IColumnHookInput, IColumnHookOutput, IColumnHook, IDeveloperField, IValidatorField, IDeveloperSettings, IRowHookInput, IRowHookOutput, IRowHook, IDeveloperStyleOverrides, IUser, IResultMetadata, EStepHook, IStepHook, IRowDeleteHook, IBulkRowHook, IBeforeFinishCallback } from './interfaces'; | ||
interface Props { | ||
@@ -11,5 +11,7 @@ style?: React.CSSProperties; | ||
rowHooks?: IRowHook[]; | ||
bulkRowHooks?: IBulkRowHook[]; | ||
rowDeleteHooks?: IRowDeleteHook[]; | ||
columnHooks?: IColumnHook[]; | ||
stepHooks?: IStepHook[]; | ||
beforeFinish?: IBeforeFinishCallback; | ||
onResults?: (data: any, metadata: IResultMetadata) => void; | ||
@@ -16,0 +18,0 @@ onCancel?: () => void; |
@@ -27,3 +27,3 @@ var React = require('react'); | ||
EBackendSyncMode["DISABLED"] = "DISABLED"; | ||
EBackendSyncMode["COLUMNS_ONLY"] = "COLUMNS_ONLY"; | ||
EBackendSyncMode["MAPPINGS_ONLY"] = "MAPPINGS_ONLY"; | ||
EBackendSyncMode["FULL_DATA"] = "FULL_DATA"; | ||
@@ -52,2 +52,8 @@ })(EBackendSyncMode || (EBackendSyncMode = {})); | ||
if (_this.props.bulkRowHooks) { | ||
_this.props.bulkRowHooks.forEach(function (hook) { | ||
return _this.dromo.registerBulkRowHook(hook); | ||
}); | ||
} | ||
if (_this.props.columnHooks) { | ||
@@ -65,2 +71,6 @@ _this.props.columnHooks.forEach(function (hook) { | ||
if (_this.props.beforeFinish) { | ||
_this.dromo.beforeFinish(_this.props.beforeFinish); | ||
} | ||
if (_this.props.onResults) { | ||
@@ -67,0 +77,0 @@ _this.dromo.onResults(_this.props.onResults); |
@@ -29,3 +29,3 @@ import { createElement, Component } from 'react'; | ||
EBackendSyncMode["DISABLED"] = "DISABLED"; | ||
EBackendSyncMode["COLUMNS_ONLY"] = "COLUMNS_ONLY"; | ||
EBackendSyncMode["MAPPINGS_ONLY"] = "MAPPINGS_ONLY"; | ||
EBackendSyncMode["FULL_DATA"] = "FULL_DATA"; | ||
@@ -54,2 +54,8 @@ })(EBackendSyncMode || (EBackendSyncMode = {})); | ||
if (_this.props.bulkRowHooks) { | ||
_this.props.bulkRowHooks.forEach(function (hook) { | ||
return _this.dromo.registerBulkRowHook(hook); | ||
}); | ||
} | ||
if (_this.props.columnHooks) { | ||
@@ -67,2 +73,6 @@ _this.props.columnHooks.forEach(function (hook) { | ||
if (_this.props.beforeFinish) { | ||
_this.dromo.beforeFinish(_this.props.beforeFinish); | ||
} | ||
if (_this.props.onResults) { | ||
@@ -69,0 +79,0 @@ _this.dromo.onResults(_this.props.onResults); |
@@ -0,1 +1,2 @@ | ||
declare type MaybeAsync<T> = T | Promise<T>; | ||
export declare type IDeveloperFieldType = "string" | "checkbox" | "select" | "number" | "date" | "datetime" | "time" | "email"; | ||
@@ -14,2 +15,3 @@ export interface IDeveloperField { | ||
invalidValueMessage?: string; | ||
readOnly?: boolean; | ||
} | ||
@@ -83,2 +85,3 @@ interface IAbstractValidator<ValidateKey> { | ||
templateDownloadFilename?: string; | ||
browserExcelParsing?: boolean; | ||
} | ||
@@ -156,7 +159,8 @@ export interface IDeveloperStyleOverrides { | ||
fieldName: string; | ||
callback: (values: IColumnHookInput[]) => IColumnHookOutput[] | Promise<IColumnHookOutput[]>; | ||
callback: (values: IColumnHookInput[]) => MaybeAsync<IColumnHookOutput[]>; | ||
} | ||
export interface IRowHook { | ||
(data: IRowHookInput, mode: "init" | "update"): IRowHookOutput | Promise<IRowHookOutput>; | ||
(data: IRowHookInput, mode: "init" | "update"): MaybeAsync<IRowHookOutput>; | ||
} | ||
export declare type IBulkRowHook = (data: IRowHookInput[], mode: "init" | "update") => IRowHookOutputInternal[] | Promise<IRowHookOutputInternal[]>; | ||
export interface IRowDeleteHook { | ||
@@ -235,4 +239,9 @@ (data: IRowHookInput): void; | ||
type: keyof typeof EStepHook; | ||
callback: (uploader: any, data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData) => void | Promise<void>; | ||
callback: (uploader: any, data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData) => MaybeAsync<void>; | ||
} | ||
export declare type IBeforeFinishCallback = (data: Record<string, any>[], metadata: IResultMetadata, instance: any) => MaybeAsync<IBeforeFinishOutput>; | ||
export declare type IBeforeFinishOutput = void | { | ||
cancel: true; | ||
message: string; | ||
}; | ||
export declare enum EInvalidDataBehavior { | ||
@@ -245,5 +254,5 @@ BLOCK_SUBMIT = "BLOCK_SUBMIT", | ||
DISABLED = "DISABLED", | ||
COLUMNS_ONLY = "COLUMNS_ONLY", | ||
MAPPINGS_ONLY = "MAPPINGS_ONLY", | ||
FULL_DATA = "FULL_DATA" | ||
} | ||
export {}; |
{ | ||
"name": "dromo-uploader-react", | ||
"version": "1.2.28", | ||
"version": "1.2.29", | ||
"description": "Easy to use data (CSV, TSV, Excel) importer", | ||
@@ -5,0 +5,0 @@ "author": "ankitgoyal100", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
56600
6.43%511
5.8%