dromo-uploader-react 1.2.22 → 1.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/interfaces.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/interfaces.ts","../src/index.tsx"],"sourcesContent":["export interface IDeveloperField {\n label: string;\n key: string;\n type?: \"string\" | \"checkbox\" | \"select\";\n description?: string;\n alternateMatches?: string[];\n validators?: IValidatorField[];\n selectOptions?: {\n label: string;\n value: string;\n }[];\n invalidValueMessage?: string;\n}\n\ninterface IAbstractValidator<ValidateKey> {\n validate: ValidateKey;\n errorMessage?: string;\n level?: \"info\" | \"warning\" | \"error\";\n}\n\nexport type IRequiredValidator = IAbstractValidator<\"required\">;\n\nexport type IUniqueValidator = IAbstractValidator<\n \"unique\" | \"unique_case_insensitive\"\n>;\n\nexport interface IUniqueWithValidator\n extends IAbstractValidator<\"unique_with\"> {\n uniqueKey: string;\n}\n\nexport interface IRegexValidator\n extends IAbstractValidator<\"regex_match\" | \"regex_exclude\"> {\n regex: string;\n regexOptions?: {\n ignoreCase?: boolean;\n dotAll?: boolean;\n multiline?: boolean;\n unicode?: boolean;\n };\n}\n\nexport interface IRequireWithValidator\n extends IAbstractValidator<\n | \"require_with\"\n | \"require_without\"\n | \"require_with_all\"\n | \"require_without_all\"\n > {\n fields: string[];\n}\n\nexport interface IRequireWithValuesValidator\n extends IAbstractValidator<\n | \"require_with_values\"\n | \"require_without_values\"\n | \"require_with_all_values\"\n | \"require_without_all_values\"\n > {\n fieldValues: { [key: string]: string };\n}\n\nexport type IValidatorField =\n | IRequiredValidator\n | IUniqueValidator\n | IUniqueWithValidator\n | IRegexValidator\n | IRequireWithValidator\n | IRequireWithValuesValidator;\n\nexport interface IDeveloperSettings {\n importIdentifier: string;\n title?: string;\n allowInvalidSubmit?: boolean;\n invalidDataBehavior?: EInvalidDataBehavior;\n backendSync?: boolean;\n manualInputDisabled?: boolean;\n manualInputOnly?: boolean;\n allowCustomFields?: boolean;\n maxRecords?: number | null;\n developmentMode?: boolean;\n displayEncoding?: boolean;\n styleOverrides?: IDeveloperStyleOverrides;\n webhookUrl?: string;\n initialData?: { [key: string]: string }[] | any[][] | null;\n uploadStep?: {\n helpText?: string;\n };\n matchingStep?: {\n helpText?: string;\n headerRowOverride?: number | null;\n fuzzyMatchHeaders?: boolean;\n };\n reviewStep?: {\n helpText?: string;\n processingText?: string;\n };\n autoMapHeaders?: boolean;\n delimiter?: string;\n backendOverride?: {\n url: string;\n type: \"AWS\" | \"AZURE\";\n } | null;\n locale?: TLocaleShorthand;\n templateDownloadFilename?: string;\n}\n\n// If you update this, also update IDeveloperStylesOverridesStrict\n// in interfaces.tsx\nexport interface IDeveloperStyleOverrides {\n global?: {\n textColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n successColor?: string;\n warningColor?: string;\n customFontURL?: string | null;\n customFontFamily?: string | null;\n };\n primaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n secondaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n tertiaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n dropzone?: {\n borderWidth?: number;\n borderRadius?: number;\n borderColor?: string;\n borderStyle?: string;\n color?: string;\n outline?: string;\n };\n stepperBar?: {\n completeColor?: string;\n incompleteColor?: string;\n currentColor?: string;\n };\n}\n\nexport interface IUser {\n id: string;\n name?: string;\n email?: string;\n companyId?: string;\n companyName?: string;\n}\n\nexport interface ICellRef {\n rowIndex: number;\n fieldKey: string;\n}\n\nexport interface ITableMessage {\n message: string;\n level: \"info\" | \"warning\" | \"error\";\n}\n\nexport interface IMessagesForCell extends ICellRef {\n messages: ITableMessage[];\n}\n\nexport interface IColumnHook {\n fieldName: string;\n callback: (\n values: IColumnHookInput[]\n ) => IColumnHookOutput[] | Promise<IColumnHookOutput[]>;\n}\n\nexport interface IRowHook {\n (data: IRowHookInput, mode: \"init\" | \"update\"):\n | IRowHookOutput\n | Promise<IRowHookOutput>;\n}\n\nexport interface IRowDeleteHook {\n (data: IRowHookInput): void;\n}\n\nexport interface IColumnHookInput {\n index: number;\n value: any;\n}\n\nexport interface IColumnHookOutput {\n index: number;\n value?: any;\n info?: ITableMessage[];\n}\n\nexport interface IRowHookInput {\n row: {\n [key: string]: {\n value: any;\n info?: ITableMessage[];\n };\n };\n index: number;\n}\n\nexport interface IRowHookOutput {\n row: {\n [key: string]: {\n value?: any;\n info?: ITableMessage[];\n };\n };\n}\n\nexport interface IRowHookOutputInternal extends IRowHookOutput {\n index: number;\n}\n\nexport type IFieldMetadata = Record<\n string,\n {\n fileHeader: string | null;\n fileHeaderIndex: number | null;\n isCustom: boolean;\n }\n>;\n\nexport interface IResultMetadata {\n id: string | null;\n filename: string | null;\n importIdentifier: string;\n user: IUser;\n rowsWithError: number[];\n rawHeaders: string[] | null;\n fields: IFieldMetadata;\n}\n\nexport type TLocaleShorthand = \"en\" | \"de\";\n\nexport enum EStepHook {\n UPLOAD_STEP = \"UPLOAD_STEP\",\n REVIEW_STEP = \"REVIEW_STEP\",\n REVIEW_STEP_POST_HOOKS = \"REVIEW_STEP_POST_HOOKS\",\n}\n\nexport interface IUploadStepData {\n filename: string | null;\n dataPreview: any[][];\n}\n\nexport interface IReviewStepData {\n rawHeaders: string[] | null;\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IReviewStepPostHooksData {\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IStepHook {\n type: keyof typeof EStepHook;\n callback: (\n uploader: any,\n data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData\n ) => void | Promise<void>;\n}\n\nexport enum EInvalidDataBehavior {\n BLOCK_SUBMIT = \"BLOCK_SUBMIT\",\n REMOVE_INVALID_ROWS = \"REMOVE_INVALID_ROWS\",\n INCLUDE_INVALID_ROWS = \"INCLUDE_INVALID_ROWS\",\n}\n","import * as React from 'react'\nimport {\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IDeveloperField,\n IValidatorField,\n IDeveloperSettings,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IDeveloperStyleOverrides,\n IUser,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n} from './interfaces'\n\ninterface Props {\n style?: React.CSSProperties\n className?: string\n licenseKey: string\n user: IUser\n fields: IDeveloperField[]\n settings: IDeveloperSettings\n rowHooks?: IRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children: React.ReactNode\n}\n\ndeclare var DromoUploader: any\n\nconst SCRIPT_SRC = 'https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js'\nconst SCRIPT_LOADED_EVENT = 'DROMO_SCRIPT_LOADED'\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n\n componentDidMount() {\n // Add event listener post load to set up Dromo\n window.addEventListener(SCRIPT_LOADED_EVENT, this.scriptLoaded.bind(this))\n\n const loadingScript = Array.from(\n document.getElementsByTagName('script')\n ).find((s) => s.src === SCRIPT_SRC)\n\n // If there is no script tag added to HTML then we add. Prevents multiple\n // adds if there are multiple components\n if (!loadingScript) {\n const script = document.createElement('script')\n script.src = SCRIPT_SRC\n script.async = true\n script.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n document.body.appendChild(script)\n } else {\n if ('DromoUploader' in window) {\n // If the script has been injected and has been loaded we can call\n // scriptLoaded\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n } else {\n // If the script has been injected but hasn't been loaded, we wait\n // for load\n loadingScript.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n }\n }\n }\n\n componentWillUnmount() {\n window.removeEventListener(\n SCRIPT_LOADED_EVENT,\n this.scriptLoaded.bind(this)\n )\n }\n\n scriptLoaded = () => {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.columnHooks) {\n this.props.columnHooks.forEach((hook) => {\n this.dromo.registerColumnHook(hook.fieldName, hook.callback)\n })\n }\n\n if (this.props.rowDeleteHooks) {\n this.props.rowDeleteHooks.forEach((hook) => {\n return this.dromo.registerRowDeleteHook(hook)\n })\n }\n\n if (this.props.onResults) {\n this.dromo.onResults(this.props.onResults)\n }\n\n if (this.props.onCancel) {\n this.dromo.onCancel(this.props.onCancel)\n }\n\n if (this.props.stepHooks) {\n this.props.stepHooks.forEach((hook) => {\n this.dromo.registerStepHook(hook.type, hook.callback)\n })\n }\n }\n\n open = () => {\n if (this.dromo) this.dromo.open()\n }\n\n render() {\n return (\n <button\n style={this.props.style}\n className={this.props.className}\n onClick={this.open}\n >\n {this.props.children}\n </button>\n )\n }\n}\n\nexport {\n IDeveloperField,\n IDeveloperSettings,\n IUser,\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IValidatorField,\n IDeveloperStyleOverrides,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n}\n"],"names":["EStepHook","EInvalidDataBehavior","SCRIPT_SRC","SCRIPT_LOADED_EVENT","DromoReactUploader","dromo","DromoUploader","props","licenseKey","fields","settings","user","rowHooks","forEach","hook","registerRowHook","columnHooks","registerColumnHook","fieldName","callback","rowDeleteHooks","registerRowDeleteHook","onResults","onCancel","stepHooks","registerStepHook","type","open","componentDidMount","window","addEventListener","scriptLoaded","bind","loadingScript","Array","from","document","getElementsByTagName","find","s","src","script","createElement","async","onload","event","Event","dispatchEvent","body","appendChild","componentWillUnmount","removeEventListener","render","React","style","className","onClick","children"],"mappings":";;;;;;;;AA+PA,WAAYA;AACVA,EAAAA,wBAAA,gBAAA;AACAA,EAAAA,wBAAA,gBAAA;AACAA,EAAAA,mCAAA,2BAAA;AACD,CAJD,EAAYA,iBAAS,KAATA,iBAAS,KAAA,CAArB;;AA8BA,IAAYC,oBAAZ;;AAAA,WAAYA;AACVA,EAAAA,oCAAA,iBAAA;AACAA,EAAAA,2CAAA,wBAAA;AACAA,EAAAA,4CAAA,yBAAA;AACD,CAJD,EAAYA,oBAAoB,KAApBA,oBAAoB,KAAA,CAAhC;;ACxPA,IAAMC,UAAU,GAAG,2DAAnB;AACA,IAAMC,mBAAmB,GAAG,qBAA5B;;IAEqBC;;;AAArB;;;;;AA8CE,sBAAA,GAAe;AACb,YAAKC,KAAL,GAAa,IAAIC,aAAJ,CACX,MAAKC,KAAL,CAAWC,UADA,EAEX,MAAKD,KAAL,CAAWE,MAFA,EAGX,MAAKF,KAAL,CAAWG,QAHA,EAIX,MAAKH,KAAL,CAAWI,IAJA,CAAb;;AAOA,UAAI,MAAKJ,KAAL,CAAWK,QAAf,EAAyB;AACvB,cAAKL,KAAL,CAAWK,QAAX,CAAoBC,OAApB,CAA4B,UAACC,IAAD;AAAA,iBAAU,MAAKT,KAAL,CAAWU,eAAX,CAA2BD,IAA3B,CAAV;AAAA,SAA5B;AACD;;AAED,UAAI,MAAKP,KAAL,CAAWS,WAAf,EAA4B;AAC1B,cAAKT,KAAL,CAAWS,WAAX,CAAuBH,OAAvB,CAA+B,UAACC,IAAD;AAC7B,gBAAKT,KAAL,CAAWY,kB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M,GAAGL,QAAQ,CAACM,aAAT,CAAuB,QAAvB,CAAf;AACAD,MAAAA,MAAM,CAACD,GAAP,GAAatC,UAAb;AACAuC,MAAAA,MAAM,CAACE,KAAP,GAAe,IAAf;;AACAF,MAAAA,MAAM,CAACG,MAAP,GAAgB;AACd,YAAMC,KAAK,GAAG,IAAIC,KAAJ,CAAU3C,mBAAV,CAAd;AACA0B,QAAAA,MAAM,CAACkB,aAAP,CAAqBF,KAArB;AACD,OAHD;;AAIAT,MAAAA,QAAQ,CAACY,IAAT,CAAcC,WAAd,CAA0BR,MAA1B;AACD,KATD,MASO;AACL,UAAI,mBAAmBZ,MAAvB,EAA+B;AAG7B,YAAMgB,KAAK,GAAG,IAAIC,KAAJ,CAAU3C,mBAAV,CAAd;AACA0B,QAAAA,MAAM,CAACkB,aAAP,CAAqBF,KAArB;AACD,OALD,MAKO;AAGLZ,QAAAA,aAAa,CAACW,MAAd,GAAuB;AACrB,cAAMC,KAAK,GAAG,IAAIC,KAAJ,CAAU3C,mBAAV,CAAd;AACA0B,UAAAA,MAAM,CAACkB,aAAP,CAAqBF,KAArB;AACD,SAHD;AAID;AACF;AACF;;SAEDK,uBAAA;AACErB,IAAAA,MAAM,CAACsB,mBAAP,CACEhD,mBADF,EAEE,KAAK4B,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB,CAFF;AAID;;SA6CDoB,SAAA;AACE,WACEC,mBAAA,SAAA;AACEC,MAAAA,KAAK,EAAE,KAAK/C,KAAL,CAAW+C;AAClBC,MAAAA,SAAS,EAAE,KAAKhD,KAAL,CAAWgD;AACtBC,MAAAA,OAAO,EAAE,KAAK7B;KAHhB,EAKG,KAAKpB,KAAL,CAAWkD,QALd,CADF;AASD;;;EAnG6CJ;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/interfaces.ts","../src/index.tsx"],"sourcesContent":["export type IDeveloperFieldType =\n | \"string\"\n | \"checkbox\"\n | \"select\"\n | \"number\"\n | \"date\"\n | \"datetime\"\n | \"time\"\n | \"email\";\n\nexport interface IDeveloperField {\n label: string;\n key: string;\n type?: IDeveloperFieldType | [IDeveloperFieldType, any];\n description?: string;\n alternateMatches?: string[];\n validators?: IValidatorField[];\n selectOptions?: {\n label: string;\n value: string;\n }[];\n invalidValueMessage?: string;\n}\n\ninterface IAbstractValidator<ValidateKey> {\n validate: ValidateKey;\n errorMessage?: string;\n level?: \"info\" | \"warning\" | \"error\";\n}\n\nexport type IRequiredValidator = IAbstractValidator<\"required\">;\n\nexport type IUniqueValidator = IAbstractValidator<\n \"unique\" | \"unique_case_insensitive\"\n>;\n\nexport interface IUniqueWithValidator\n extends IAbstractValidator<\"unique_with\"> {\n uniqueKey: string;\n}\n\nexport interface IRegexValidator\n extends IAbstractValidator<\"regex_match\" | \"regex_exclude\"> {\n regex: string;\n regexOptions?: {\n ignoreCase?: boolean;\n dotAll?: boolean;\n multiline?: boolean;\n unicode?: boolean;\n };\n}\n\nexport interface IRequireWithValidator\n extends IAbstractValidator<\n | \"require_with\"\n | \"require_without\"\n | \"require_with_all\"\n | \"require_without_all\"\n > {\n fields: string[];\n}\n\nexport interface IRequireWithValuesValidator\n extends IAbstractValidator<\n | \"require_with_values\"\n | \"require_without_values\"\n | \"require_with_all_values\"\n | \"require_without_all_values\"\n > {\n fieldValues: { [key: string]: string };\n}\n\nexport type IValidatorField =\n | IRequiredValidator\n | IUniqueValidator\n | IUniqueWithValidator\n | IRegexValidator\n | IRequireWithValidator\n | IRequireWithValuesValidator;\n\nexport interface IDeveloperSettings {\n importIdentifier: string;\n title?: string;\n allowInvalidSubmit?: boolean;\n invalidDataBehavior?: keyof typeof EInvalidDataBehavior;\n backendSync?: boolean;\n manualInputDisabled?: boolean;\n manualInputOnly?: boolean;\n allowCustomFields?: boolean;\n maxRecords?: number | null;\n developmentMode?: boolean;\n displayEncoding?: boolean;\n styleOverrides?: IDeveloperStyleOverrides;\n webhookUrl?: string;\n initialData?: { [key: string]: string }[] | any[][] | null;\n uploadStep?: {\n helpText?: string;\n };\n matchingStep?: {\n helpText?: string;\n headerRowOverride?: number | null;\n fuzzyMatchHeaders?: boolean;\n };\n reviewStep?: {\n helpText?: string;\n processingText?: string;\n };\n autoMapHeaders?: boolean;\n delimiter?: string;\n backendOverride?: {\n url: string;\n type: \"AWS\" | \"AZURE\";\n } | null;\n locale?: TLocaleShorthand;\n templateDownloadFilename?: string;\n}\n\n// If you update this, also update IDeveloperStylesOverridesStrict\n// in interfaces.tsx\nexport interface IDeveloperStyleOverrides {\n global?: {\n textColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n successColor?: string;\n warningColor?: string;\n customFontURL?: string | null;\n customFontFamily?: string | null;\n };\n primaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n secondaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n tertiaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n dropzone?: {\n borderWidth?: number;\n borderRadius?: number;\n borderColor?: string;\n borderStyle?: string;\n color?: string;\n outline?: string;\n };\n stepperBar?: {\n completeColor?: string;\n incompleteColor?: string;\n currentColor?: string;\n };\n}\n\nexport interface IUser {\n id: string;\n name?: string;\n email?: string;\n companyId?: string;\n companyName?: string;\n}\n\nexport interface ICellRef {\n rowIndex: number;\n fieldKey: string;\n}\n\nexport interface ITableMessage {\n message: string;\n level: \"info\" | \"warning\" | \"error\";\n}\n\nexport interface IMessagesForCell extends ICellRef {\n messages: ITableMessage[];\n}\n\nexport interface IColumnHook {\n fieldName: string;\n callback: (\n values: IColumnHookInput[]\n ) => IColumnHookOutput[] | Promise<IColumnHookOutput[]>;\n}\n\nexport interface IRowHook {\n (data: IRowHookInput, mode: \"init\" | \"update\"):\n | IRowHookOutput\n | Promise<IRowHookOutput>;\n}\n\nexport interface IRowDeleteHook {\n (data: IRowHookInput): void;\n}\n\nexport interface IColumnHookInput {\n index: number;\n value: any;\n}\n\nexport interface IColumnHookOutput {\n index: number;\n value?: any;\n info?: ITableMessage[];\n}\n\nexport interface IRowHookInput {\n row: {\n [key: string]: {\n value: any;\n resultValue: any;\n info?: ITableMessage[];\n };\n };\n index: number;\n}\n\nexport interface IRowHookOutput {\n row: {\n [key: string]: {\n value?: any;\n info?: ITableMessage[];\n };\n };\n}\n\nexport interface IRowHookOutputInternal extends IRowHookOutput {\n index: number;\n}\n\nexport type IFieldMetadata = Record<\n string,\n {\n fileHeader: string | null;\n fileHeaderIndex: number | null;\n isCustom: boolean;\n }\n>;\n\nexport interface IResultMetadata {\n id: string | null;\n filename: string | null;\n importIdentifier: string;\n user: IUser;\n rowsWithError: number[];\n rawHeaders: string[] | null;\n fields: IFieldMetadata;\n}\n\nexport type TLocaleShorthand = \"en\" | \"de\";\n\nexport enum EStepHook {\n UPLOAD_STEP = \"UPLOAD_STEP\",\n REVIEW_STEP = \"REVIEW_STEP\",\n REVIEW_STEP_POST_HOOKS = \"REVIEW_STEP_POST_HOOKS\",\n}\n\nexport interface IUploadStepData {\n filename: string | null;\n dataPreview: any[][];\n}\n\nexport interface IReviewStepData {\n rawHeaders: string[] | null;\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IReviewStepPostHooksData {\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IStepHook {\n type: keyof typeof EStepHook;\n callback: (\n uploader: any,\n data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData\n ) => void | Promise<void>;\n}\n\nexport enum EInvalidDataBehavior {\n BLOCK_SUBMIT = \"BLOCK_SUBMIT\",\n REMOVE_INVALID_ROWS = \"REMOVE_INVALID_ROWS\",\n INCLUDE_INVALID_ROWS = \"INCLUDE_INVALID_ROWS\",\n}\n","import * as React from 'react'\nimport {\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IDeveloperField,\n IValidatorField,\n IDeveloperSettings,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IDeveloperStyleOverrides,\n IUser,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n} from './interfaces'\n\ninterface Props {\n style?: React.CSSProperties\n className?: string\n licenseKey: string\n user: IUser\n fields: IDeveloperField[]\n settings: IDeveloperSettings\n rowHooks?: IRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children: React.ReactNode\n}\n\ndeclare var DromoUploader: any\n\nconst SCRIPT_SRC = 'https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js'\nconst SCRIPT_LOADED_EVENT = 'DROMO_SCRIPT_LOADED'\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n\n componentDidMount() {\n // Add event listener post load to set up Dromo\n window.addEventListener(SCRIPT_LOADED_EVENT, this.scriptLoaded.bind(this))\n\n const loadingScript = Array.from(\n document.getElementsByTagName('script')\n ).find((s) => s.src === SCRIPT_SRC)\n\n // If there is no script tag added to HTML then we add. Prevents multiple\n // adds if there are multiple components\n if (!loadingScript) {\n const script = document.createElement('script')\n script.src = SCRIPT_SRC\n script.async = true\n script.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n document.body.appendChild(script)\n } else {\n if ('DromoUploader' in window) {\n // If the script has been injected and has been loaded we can call\n // scriptLoaded\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n } else {\n // If the script has been injected but hasn't been loaded, we wait\n // for load\n loadingScript.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n }\n }\n }\n\n componentWillUnmount() {\n window.removeEventListener(\n SCRIPT_LOADED_EVENT,\n this.scriptLoaded.bind(this)\n )\n }\n\n scriptLoaded = () => {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.columnHooks) {\n this.props.columnHooks.forEach((hook) => {\n this.dromo.registerColumnHook(hook.fieldName, hook.callback)\n })\n }\n\n if (this.props.rowDeleteHooks) {\n this.props.rowDeleteHooks.forEach((hook) => {\n return this.dromo.registerRowDeleteHook(hook)\n })\n }\n\n if (this.props.onResults) {\n this.dromo.onResults(this.props.onResults)\n }\n\n if (this.props.onCancel) {\n this.dromo.onCancel(this.props.onCancel)\n }\n\n if (this.props.stepHooks) {\n this.props.stepHooks.forEach((hook) => {\n this.dromo.registerStepHook(hook.type, hook.callback)\n })\n }\n }\n\n open = () => {\n if (this.dromo) this.dromo.open()\n }\n\n render() {\n return (\n <button\n style={this.props.style}\n className={this.props.className}\n onClick={this.open}\n >\n {this.props.children}\n </button>\n )\n }\n}\n\nexport {\n IDeveloperField,\n IDeveloperSettings,\n IUser,\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IValidatorField,\n IDeveloperStyleOverrides,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n}\n"],"names":["EStepHook","EInvalidDataBehavior","SCRIPT_SRC","SCRIPT_LOADED_EVENT","DromoReactUploader","dromo","DromoUploader","props","licenseKey","fields","settings","user","rowHooks","forEach","hook","registerRowHook","columnHooks","registerColumnHook","fieldName","callback","rowDeleteHooks","registerRowDeleteHook","onResults","onCancel","stepHooks","registerStepHook","type","open","componentDidMount","window","addEventListener","scriptLoaded","bind","loadingScript","Array","from","document","getElementsByTagName","find","s","src","script","createElement","async","onload","event","Event","dispatchEvent","body","appendChild","componentWillUnmount","removeEventListener","render","React","style","className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M,CAACkB,aAAP,CAAqBF,KAArB;AACD,OAHD;;AAIAT,MAAAA,QAAQ,CAACY,IAAT,CAAcC,WAAd,CAA0BR,MAA1B;AACD,KATD,MASO;AACL,UAAI,mBAAmBZ,MAAvB,EAA+B;AAG7B,YAAMgB,KAAK,GAAG,IAAIC,KAAJ,CAAU3C,mBAAV,CAAd;AACA0B,QAAAA,MAAM,CAACkB,aAAP,CAAqBF,KAArB;AACD,OALD,MAKO;AAGLZ,QAAAA,aAAa,CAACW,MAAd,GAAuB;AACrB,cAAMC,KAAK,GAAG,IAAIC,KAAJ,CAAU3C,mBAAV,CAAd;AACA0B,UAAAA,MAAM,CAACkB,aAAP,CAAqBF,KAArB;AACD,SAHD;AAID;AACF;AACF;;SAEDK,uBAAA;AACErB,IAAAA,MAAM,CAACsB,mBAAP,CACEhD,mBADF,EAEE,KAAK4B,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB,CAFF;AAID;;SA6CDoB,SAAA;AACE,WACEC,mBAAA,SAAA;AACEC,MAAAA,KAAK,EAAE,KAAK/C,KAAL,CAAW+C;AAClBC,MAAAA,SAAS,EAAE,KAAKhD,KAAL,CAAWgD;AACtBC,MAAAA,OAAO,EAAE,KAAK7B;KAHhB,EAKG,KAAKpB,KAAL,CAAWkD,QALd,CADF;AASD;;;EAnG6CJ;;;;"}
|
package/dist/index.modern.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../src/interfaces.ts","../src/index.tsx"],"sourcesContent":["export interface IDeveloperField {\n label: string;\n key: string;\n type?: \"string\" | \"checkbox\" | \"select\";\n description?: string;\n alternateMatches?: string[];\n validators?: IValidatorField[];\n selectOptions?: {\n label: string;\n value: string;\n }[];\n invalidValueMessage?: string;\n}\n\ninterface IAbstractValidator<ValidateKey> {\n validate: ValidateKey;\n errorMessage?: string;\n level?: \"info\" | \"warning\" | \"error\";\n}\n\nexport type IRequiredValidator = IAbstractValidator<\"required\">;\n\nexport type IUniqueValidator = IAbstractValidator<\n \"unique\" | \"unique_case_insensitive\"\n>;\n\nexport interface IUniqueWithValidator\n extends IAbstractValidator<\"unique_with\"> {\n uniqueKey: string;\n}\n\nexport interface IRegexValidator\n extends IAbstractValidator<\"regex_match\" | \"regex_exclude\"> {\n regex: string;\n regexOptions?: {\n ignoreCase?: boolean;\n dotAll?: boolean;\n multiline?: boolean;\n unicode?: boolean;\n };\n}\n\nexport interface IRequireWithValidator\n extends IAbstractValidator<\n | \"require_with\"\n | \"require_without\"\n | \"require_with_all\"\n | \"require_without_all\"\n > {\n fields: string[];\n}\n\nexport interface IRequireWithValuesValidator\n extends IAbstractValidator<\n | \"require_with_values\"\n | \"require_without_values\"\n | \"require_with_all_values\"\n | \"require_without_all_values\"\n > {\n fieldValues: { [key: string]: string };\n}\n\nexport type IValidatorField =\n | IRequiredValidator\n | IUniqueValidator\n | IUniqueWithValidator\n | IRegexValidator\n | IRequireWithValidator\n | IRequireWithValuesValidator;\n\nexport interface IDeveloperSettings {\n importIdentifier: string;\n title?: string;\n allowInvalidSubmit?: boolean;\n invalidDataBehavior?: EInvalidDataBehavior;\n backendSync?: boolean;\n manualInputDisabled?: boolean;\n manualInputOnly?: boolean;\n allowCustomFields?: boolean;\n maxRecords?: number | null;\n developmentMode?: boolean;\n displayEncoding?: boolean;\n styleOverrides?: IDeveloperStyleOverrides;\n webhookUrl?: string;\n initialData?: { [key: string]: string }[] | any[][] | null;\n uploadStep?: {\n helpText?: string;\n };\n matchingStep?: {\n helpText?: string;\n headerRowOverride?: number | null;\n fuzzyMatchHeaders?: boolean;\n };\n reviewStep?: {\n helpText?: string;\n processingText?: string;\n };\n autoMapHeaders?: boolean;\n delimiter?: string;\n backendOverride?: {\n url: string;\n type: \"AWS\" | \"AZURE\";\n } | null;\n locale?: TLocaleShorthand;\n templateDownloadFilename?: string;\n}\n\n// If you update this, also update IDeveloperStylesOverridesStrict\n// in interfaces.tsx\nexport interface IDeveloperStyleOverrides {\n global?: {\n textColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n successColor?: string;\n warningColor?: string;\n customFontURL?: string | null;\n customFontFamily?: string | null;\n };\n primaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n secondaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n tertiaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n dropzone?: {\n borderWidth?: number;\n borderRadius?: number;\n borderColor?: string;\n borderStyle?: string;\n color?: string;\n outline?: string;\n };\n stepperBar?: {\n completeColor?: string;\n incompleteColor?: string;\n currentColor?: string;\n };\n}\n\nexport interface IUser {\n id: string;\n name?: string;\n email?: string;\n companyId?: string;\n companyName?: string;\n}\n\nexport interface ICellRef {\n rowIndex: number;\n fieldKey: string;\n}\n\nexport interface ITableMessage {\n message: string;\n level: \"info\" | \"warning\" | \"error\";\n}\n\nexport interface IMessagesForCell extends ICellRef {\n messages: ITableMessage[];\n}\n\nexport interface IColumnHook {\n fieldName: string;\n callback: (\n values: IColumnHookInput[]\n ) => IColumnHookOutput[] | Promise<IColumnHookOutput[]>;\n}\n\nexport interface IRowHook {\n (data: IRowHookInput, mode: \"init\" | \"update\"):\n | IRowHookOutput\n | Promise<IRowHookOutput>;\n}\n\nexport interface IRowDeleteHook {\n (data: IRowHookInput): void;\n}\n\nexport interface IColumnHookInput {\n index: number;\n value: any;\n}\n\nexport interface IColumnHookOutput {\n index: number;\n value?: any;\n info?: ITableMessage[];\n}\n\nexport interface IRowHookInput {\n row: {\n [key: string]: {\n value: any;\n info?: ITableMessage[];\n };\n };\n index: number;\n}\n\nexport interface IRowHookOutput {\n row: {\n [key: string]: {\n value?: any;\n info?: ITableMessage[];\n };\n };\n}\n\nexport interface IRowHookOutputInternal extends IRowHookOutput {\n index: number;\n}\n\nexport type IFieldMetadata = Record<\n string,\n {\n fileHeader: string | null;\n fileHeaderIndex: number | null;\n isCustom: boolean;\n }\n>;\n\nexport interface IResultMetadata {\n id: string | null;\n filename: string | null;\n importIdentifier: string;\n user: IUser;\n rowsWithError: number[];\n rawHeaders: string[] | null;\n fields: IFieldMetadata;\n}\n\nexport type TLocaleShorthand = \"en\" | \"de\";\n\nexport enum EStepHook {\n UPLOAD_STEP = \"UPLOAD_STEP\",\n REVIEW_STEP = \"REVIEW_STEP\",\n REVIEW_STEP_POST_HOOKS = \"REVIEW_STEP_POST_HOOKS\",\n}\n\nexport interface IUploadStepData {\n filename: string | null;\n dataPreview: any[][];\n}\n\nexport interface IReviewStepData {\n rawHeaders: string[] | null;\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IReviewStepPostHooksData {\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IStepHook {\n type: keyof typeof EStepHook;\n callback: (\n uploader: any,\n data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData\n ) => void | Promise<void>;\n}\n\nexport enum EInvalidDataBehavior {\n BLOCK_SUBMIT = \"BLOCK_SUBMIT\",\n REMOVE_INVALID_ROWS = \"REMOVE_INVALID_ROWS\",\n INCLUDE_INVALID_ROWS = \"INCLUDE_INVALID_ROWS\",\n}\n","import * as React from 'react'\nimport {\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IDeveloperField,\n IValidatorField,\n IDeveloperSettings,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IDeveloperStyleOverrides,\n IUser,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n} from './interfaces'\n\ninterface Props {\n style?: React.CSSProperties\n className?: string\n licenseKey: string\n user: IUser\n fields: IDeveloperField[]\n settings: IDeveloperSettings\n rowHooks?: IRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children: React.ReactNode\n}\n\ndeclare var DromoUploader: any\n\nconst SCRIPT_SRC = 'https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js'\nconst SCRIPT_LOADED_EVENT = 'DROMO_SCRIPT_LOADED'\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n\n componentDidMount() {\n // Add event listener post load to set up Dromo\n window.addEventListener(SCRIPT_LOADED_EVENT, this.scriptLoaded.bind(this))\n\n const loadingScript = Array.from(\n document.getElementsByTagName('script')\n ).find((s) => s.src === SCRIPT_SRC)\n\n // If there is no script tag added to HTML then we add. Prevents multiple\n // adds if there are multiple components\n if (!loadingScript) {\n const script = document.createElement('script')\n script.src = SCRIPT_SRC\n script.async = true\n script.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n document.body.appendChild(script)\n } else {\n if ('DromoUploader' in window) {\n // If the script has been injected and has been loaded we can call\n // scriptLoaded\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n } else {\n // If the script has been injected but hasn't been loaded, we wait\n // for load\n loadingScript.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n }\n }\n }\n\n componentWillUnmount() {\n window.removeEventListener(\n SCRIPT_LOADED_EVENT,\n this.scriptLoaded.bind(this)\n )\n }\n\n scriptLoaded = () => {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.columnHooks) {\n this.props.columnHooks.forEach((hook) => {\n this.dromo.registerColumnHook(hook.fieldName, hook.callback)\n })\n }\n\n if (this.props.rowDeleteHooks) {\n this.props.rowDeleteHooks.forEach((hook) => {\n return this.dromo.registerRowDeleteHook(hook)\n })\n }\n\n if (this.props.onResults) {\n this.dromo.onResults(this.props.onResults)\n }\n\n if (this.props.onCancel) {\n this.dromo.onCancel(this.props.onCancel)\n }\n\n if (this.props.stepHooks) {\n this.props.stepHooks.forEach((hook) => {\n this.dromo.registerStepHook(hook.type, hook.callback)\n })\n }\n }\n\n open = () => {\n if (this.dromo) this.dromo.open()\n }\n\n render() {\n return (\n <button\n style={this.props.style}\n className={this.props.className}\n onClick={this.open}\n >\n {this.props.children}\n </button>\n )\n }\n}\n\nexport {\n IDeveloperField,\n IDeveloperSettings,\n IUser,\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IValidatorField,\n IDeveloperStyleOverrides,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n}\n"],"names":["EStepHook","EInvalidDataBehavior","SCRIPT_SRC","SCRIPT_LOADED_EVENT","DromoReactUploader","dromo","DromoUploader","props","licenseKey","fields","settings","user","rowHooks","forEach","hook","registerRowHook","columnHooks","registerColumnHook","fieldName","callback","rowDeleteHooks","registerRowDeleteHook","onResults","onCancel","stepHooks","registerStepHook","type","open","componentDidMount","window","addEventListener","scriptLoaded","bind","loadingScript","Array","from","document","getElementsByTagName","find","s","src","script","createElement","async","onload","event","Event","dispatchEvent","body","appendChild","componentWillUnmount","removeEventListener","render","React","style","className","onClick","children"],"mappings":";;;;;;;;IA+PYA;;AAAZ,WAAYA;AACVA,EAAAA,wBAAA,gBAAA;AACAA,EAAAA,wBAAA,gBAAA;AACAA,EAAAA,mCAAA,2BAAA;AACD,CAJD,EAAYA,SAAS,KAATA,SAAS,KAAA,CAArB;;AA8BA,IAAYC,oBAAZ;;AAAA,WAAYA;AACVA,EAAAA,oCAAA,iBAAA;AACAA,EAAAA,2CAAA,wBAAA;AACAA,EAAAA,4CAAA,yBAAA;AACD,CAJD,EAAYA,oBAAoB,KAApBA,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,cAAMC,KAAK,GAAG,IAAIC,KAAJ,CAAU3C,mBAAV,CAAd;AACA0B,UAAAA,MAAM,CAACkB,aAAP,CAAqBF,KAArB;AACD,SAHD;AAID;AACF;AACF;;SAEDK,uBAAA;AACErB,IAAAA,MAAM,CAACsB,mBAAP,CACEhD,mBADF,EAEE,KAAK4B,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB,CAFF;AAID;;SA6CDoB,SAAA;AACE,WACEC,aAAA,SAAA;AACEC,MAAAA,KAAK,EAAE,KAAK/C,KAAL,CAAW+C;AAClBC,MAAAA,SAAS,EAAE,KAAKhD,KAAL,CAAWgD;AACtBC,MAAAA,OAAO,EAAE,KAAK7B;KAHhB,EAKG,KAAKpB,KAAL,CAAWkD,QALd,CADF;AASD;;;EAnG6CJ;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.modern.js","sources":["../src/interfaces.ts","../src/index.tsx"],"sourcesContent":["export type IDeveloperFieldType =\n | \"string\"\n | \"checkbox\"\n | \"select\"\n | \"number\"\n | \"date\"\n | \"datetime\"\n | \"time\"\n | \"email\";\n\nexport interface IDeveloperField {\n label: string;\n key: string;\n type?: IDeveloperFieldType | [IDeveloperFieldType, any];\n description?: string;\n alternateMatches?: string[];\n validators?: IValidatorField[];\n selectOptions?: {\n label: string;\n value: string;\n }[];\n invalidValueMessage?: string;\n}\n\ninterface IAbstractValidator<ValidateKey> {\n validate: ValidateKey;\n errorMessage?: string;\n level?: \"info\" | \"warning\" | \"error\";\n}\n\nexport type IRequiredValidator = IAbstractValidator<\"required\">;\n\nexport type IUniqueValidator = IAbstractValidator<\n \"unique\" | \"unique_case_insensitive\"\n>;\n\nexport interface IUniqueWithValidator\n extends IAbstractValidator<\"unique_with\"> {\n uniqueKey: string;\n}\n\nexport interface IRegexValidator\n extends IAbstractValidator<\"regex_match\" | \"regex_exclude\"> {\n regex: string;\n regexOptions?: {\n ignoreCase?: boolean;\n dotAll?: boolean;\n multiline?: boolean;\n unicode?: boolean;\n };\n}\n\nexport interface IRequireWithValidator\n extends IAbstractValidator<\n | \"require_with\"\n | \"require_without\"\n | \"require_with_all\"\n | \"require_without_all\"\n > {\n fields: string[];\n}\n\nexport interface IRequireWithValuesValidator\n extends IAbstractValidator<\n | \"require_with_values\"\n | \"require_without_values\"\n | \"require_with_all_values\"\n | \"require_without_all_values\"\n > {\n fieldValues: { [key: string]: string };\n}\n\nexport type IValidatorField =\n | IRequiredValidator\n | IUniqueValidator\n | IUniqueWithValidator\n | IRegexValidator\n | IRequireWithValidator\n | IRequireWithValuesValidator;\n\nexport interface IDeveloperSettings {\n importIdentifier: string;\n title?: string;\n allowInvalidSubmit?: boolean;\n invalidDataBehavior?: keyof typeof EInvalidDataBehavior;\n backendSync?: boolean;\n manualInputDisabled?: boolean;\n manualInputOnly?: boolean;\n allowCustomFields?: boolean;\n maxRecords?: number | null;\n developmentMode?: boolean;\n displayEncoding?: boolean;\n styleOverrides?: IDeveloperStyleOverrides;\n webhookUrl?: string;\n initialData?: { [key: string]: string }[] | any[][] | null;\n uploadStep?: {\n helpText?: string;\n };\n matchingStep?: {\n helpText?: string;\n headerRowOverride?: number | null;\n fuzzyMatchHeaders?: boolean;\n };\n reviewStep?: {\n helpText?: string;\n processingText?: string;\n };\n autoMapHeaders?: boolean;\n delimiter?: string;\n backendOverride?: {\n url: string;\n type: \"AWS\" | \"AZURE\";\n } | null;\n locale?: TLocaleShorthand;\n templateDownloadFilename?: string;\n}\n\n// If you update this, also update IDeveloperStylesOverridesStrict\n// in interfaces.tsx\nexport interface IDeveloperStyleOverrides {\n global?: {\n textColor?: string;\n primaryTextColor?: string;\n secondaryTextColor?: string;\n successColor?: string;\n warningColor?: string;\n customFontURL?: string | null;\n customFontFamily?: string | null;\n };\n primaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n secondaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n tertiaryButton?: {\n borderRadius?: string;\n backgroundColor?: string;\n textColor?: string;\n border?: string;\n hoverBackgroundColor?: string;\n hoverTextColor?: string;\n hoverBorder?: string;\n };\n dropzone?: {\n borderWidth?: number;\n borderRadius?: number;\n borderColor?: string;\n borderStyle?: string;\n color?: string;\n outline?: string;\n };\n stepperBar?: {\n completeColor?: string;\n incompleteColor?: string;\n currentColor?: string;\n };\n}\n\nexport interface IUser {\n id: string;\n name?: string;\n email?: string;\n companyId?: string;\n companyName?: string;\n}\n\nexport interface ICellRef {\n rowIndex: number;\n fieldKey: string;\n}\n\nexport interface ITableMessage {\n message: string;\n level: \"info\" | \"warning\" | \"error\";\n}\n\nexport interface IMessagesForCell extends ICellRef {\n messages: ITableMessage[];\n}\n\nexport interface IColumnHook {\n fieldName: string;\n callback: (\n values: IColumnHookInput[]\n ) => IColumnHookOutput[] | Promise<IColumnHookOutput[]>;\n}\n\nexport interface IRowHook {\n (data: IRowHookInput, mode: \"init\" | \"update\"):\n | IRowHookOutput\n | Promise<IRowHookOutput>;\n}\n\nexport interface IRowDeleteHook {\n (data: IRowHookInput): void;\n}\n\nexport interface IColumnHookInput {\n index: number;\n value: any;\n}\n\nexport interface IColumnHookOutput {\n index: number;\n value?: any;\n info?: ITableMessage[];\n}\n\nexport interface IRowHookInput {\n row: {\n [key: string]: {\n value: any;\n resultValue: any;\n info?: ITableMessage[];\n };\n };\n index: number;\n}\n\nexport interface IRowHookOutput {\n row: {\n [key: string]: {\n value?: any;\n info?: ITableMessage[];\n };\n };\n}\n\nexport interface IRowHookOutputInternal extends IRowHookOutput {\n index: number;\n}\n\nexport type IFieldMetadata = Record<\n string,\n {\n fileHeader: string | null;\n fileHeaderIndex: number | null;\n isCustom: boolean;\n }\n>;\n\nexport interface IResultMetadata {\n id: string | null;\n filename: string | null;\n importIdentifier: string;\n user: IUser;\n rowsWithError: number[];\n rawHeaders: string[] | null;\n fields: IFieldMetadata;\n}\n\nexport type TLocaleShorthand = \"en\" | \"de\";\n\nexport enum EStepHook {\n UPLOAD_STEP = \"UPLOAD_STEP\",\n REVIEW_STEP = \"REVIEW_STEP\",\n REVIEW_STEP_POST_HOOKS = \"REVIEW_STEP_POST_HOOKS\",\n}\n\nexport interface IUploadStepData {\n filename: string | null;\n dataPreview: any[][];\n}\n\nexport interface IReviewStepData {\n rawHeaders: string[] | null;\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IReviewStepPostHooksData {\n headerMapping: { [header: string]: string | undefined };\n fields: IFieldMetadata;\n}\n\nexport interface IStepHook {\n type: keyof typeof EStepHook;\n callback: (\n uploader: any,\n data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData\n ) => void | Promise<void>;\n}\n\nexport enum EInvalidDataBehavior {\n BLOCK_SUBMIT = \"BLOCK_SUBMIT\",\n REMOVE_INVALID_ROWS = \"REMOVE_INVALID_ROWS\",\n INCLUDE_INVALID_ROWS = \"INCLUDE_INVALID_ROWS\",\n}\n","import * as React from 'react'\nimport {\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IDeveloperField,\n IValidatorField,\n IDeveloperSettings,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IDeveloperStyleOverrides,\n IUser,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n} from './interfaces'\n\ninterface Props {\n style?: React.CSSProperties\n className?: string\n licenseKey: string\n user: IUser\n fields: IDeveloperField[]\n settings: IDeveloperSettings\n rowHooks?: IRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children: React.ReactNode\n}\n\ndeclare var DromoUploader: any\n\nconst SCRIPT_SRC = 'https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js'\nconst SCRIPT_LOADED_EVENT = 'DROMO_SCRIPT_LOADED'\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n\n componentDidMount() {\n // Add event listener post load to set up Dromo\n window.addEventListener(SCRIPT_LOADED_EVENT, this.scriptLoaded.bind(this))\n\n const loadingScript = Array.from(\n document.getElementsByTagName('script')\n ).find((s) => s.src === SCRIPT_SRC)\n\n // If there is no script tag added to HTML then we add. Prevents multiple\n // adds if there are multiple components\n if (!loadingScript) {\n const script = document.createElement('script')\n script.src = SCRIPT_SRC\n script.async = true\n script.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n document.body.appendChild(script)\n } else {\n if ('DromoUploader' in window) {\n // If the script has been injected and has been loaded we can call\n // scriptLoaded\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n } else {\n // If the script has been injected but hasn't been loaded, we wait\n // for load\n loadingScript.onload = () => {\n const event = new Event(SCRIPT_LOADED_EVENT)\n window.dispatchEvent(event)\n }\n }\n }\n }\n\n componentWillUnmount() {\n window.removeEventListener(\n SCRIPT_LOADED_EVENT,\n this.scriptLoaded.bind(this)\n )\n }\n\n scriptLoaded = () => {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.columnHooks) {\n this.props.columnHooks.forEach((hook) => {\n this.dromo.registerColumnHook(hook.fieldName, hook.callback)\n })\n }\n\n if (this.props.rowDeleteHooks) {\n this.props.rowDeleteHooks.forEach((hook) => {\n return this.dromo.registerRowDeleteHook(hook)\n })\n }\n\n if (this.props.onResults) {\n this.dromo.onResults(this.props.onResults)\n }\n\n if (this.props.onCancel) {\n this.dromo.onCancel(this.props.onCancel)\n }\n\n if (this.props.stepHooks) {\n this.props.stepHooks.forEach((hook) => {\n this.dromo.registerStepHook(hook.type, hook.callback)\n })\n }\n }\n\n open = () => {\n if (this.dromo) this.dromo.open()\n }\n\n render() {\n return (\n <button\n style={this.props.style}\n className={this.props.className}\n onClick={this.open}\n >\n {this.props.children}\n </button>\n )\n }\n}\n\nexport {\n IDeveloperField,\n IDeveloperSettings,\n IUser,\n IColumnHookInput,\n IColumnHookOutput,\n IColumnHook,\n IRowHookInput,\n IRowHookOutput,\n IRowHook,\n IValidatorField,\n IDeveloperStyleOverrides,\n IResultMetadata,\n EStepHook,\n IStepHook,\n IRowDeleteHook\n}\n"],"names":["EStepHook","EInvalidDataBehavior","SCRIPT_SRC","SCRIPT_LOADED_EVENT","DromoReactUploader","dromo","DromoUploader","props","licenseKey","fields","settings","user","rowHooks","forEach","hook","registerRowHook","columnHooks","registerColumnHook","fieldName","callback","rowDeleteHooks","registerRowDeleteHook","onResults","onCancel","stepHooks","registerStepHook","type","open","componentDidMount","window","addEventListener","scriptLoaded","bind","loadingScript","Array","from","document","getElementsByTagName","find","s","src","script","createElement","async","onload","event","Event","dispatchEvent","body","appendChild","componentWillUnmount","removeEventListener","render","React","style","className","onClick","children"],"mappings":";;;;;;;;IA0QYA;;AAAZ,WAAYA;AACVA,EAAAA,wBAAA,gBAAA;AACAA,EAAAA,wBAAA,gBAAA;AACAA,EAAAA,mCAAA,2BAAA;AACD,CAJD,EAAYA,SAAS,KAATA,SAAS,KAAA,CAArB;;AA8BA,IAAYC,oBAAZ;;AAAA,WAAYA;AACVA,EAAAA,oCAAA,iBAAA;AACAA,EAAAA,2CAAA,wBAAA;AACAA,EAAAA,4CAAA,yBAAA;AACD,CAJD,EAAYA,oBAAoB,KAApBA,oBAAoB,KAAA,CAAhC;;ACnQA,IAAMC,UAAU,GAAG,2DAAnB;AACA,IAAMC,mBAAmB,GAAG,qBAA5B;;IAEqBC;;;AAArB;;;;;AA8CE,sBAAA,GAAe;AACb,YAAKC,KAAL,GAAa,IAAIC,aAAJ,CACX,MAAKC,KAAL,CAAWC,UADA,EAEX,MAAKD,KAAL,CAAWE,MAFA,EAGX,MA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FF;AAID;;SA6CDoB,SAAA;AACE,WACEC,aAAA,SAAA;AACEC,MAAAA,KAAK,EAAE,KAAK/C,KAAL,CAAW+C;AAClBC,MAAAA,SAAS,EAAE,KAAKhD,KAAL,CAAWgD;AACtBC,MAAAA,OAAO,EAAE,KAAK7B;KAHhB,EAKG,KAAKpB,KAAL,CAAWkD,QALd,CADF;AASD;;;EAnG6CJ;;;;;"}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export declare type IDeveloperFieldType = "string" | "checkbox" | "select" | "number" | "date" | "datetime" | "time" | "email";
|
|
1
2
|
export interface IDeveloperField {
|
|
2
3
|
label: string;
|
|
3
4
|
key: string;
|
|
4
|
-
type?:
|
|
5
|
+
type?: IDeveloperFieldType | [IDeveloperFieldType, any];
|
|
5
6
|
description?: string;
|
|
6
7
|
alternateMatches?: string[];
|
|
7
8
|
validators?: IValidatorField[];
|
|
@@ -43,7 +44,7 @@ export interface IDeveloperSettings {
|
|
|
43
44
|
importIdentifier: string;
|
|
44
45
|
title?: string;
|
|
45
46
|
allowInvalidSubmit?: boolean;
|
|
46
|
-
invalidDataBehavior?: EInvalidDataBehavior;
|
|
47
|
+
invalidDataBehavior?: keyof typeof EInvalidDataBehavior;
|
|
47
48
|
backendSync?: boolean;
|
|
48
49
|
manualInputDisabled?: boolean;
|
|
49
50
|
manualInputOnly?: boolean;
|
|
@@ -169,6 +170,7 @@ export interface IRowHookInput {
|
|
|
169
170
|
row: {
|
|
170
171
|
[key: string]: {
|
|
171
172
|
value: any;
|
|
173
|
+
resultValue: any;
|
|
172
174
|
info?: ITableMessage[];
|
|
173
175
|
};
|
|
174
176
|
};
|