dromo-uploader-react 2.8.0 → 2.9.0
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.d.mts +52 -0
- package/dist/index.d.ts +52 -48
- package/dist/index.js +2 -135
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +2 -133
- package/dist/index.modern.js.map +1 -1
- package/package.json +12 -9
- package/dist/index.test.d.ts +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IUser, IDeveloperField, IDeveloperSettings, IImporterOptions, IRowHook, IBulkRowHook, IRowDeleteHook, IColumnHook, IStepHook, ICustomStepConfig, IParseFileCallback, IBeforeFinishCallback, IResultMetadata } from 'dromo-uploader-js';
|
|
3
|
+
export { CustomStepInsertAfter, IBeforeFinishCallback, IBulkRowHook, IColumnHook, IColumnHookInput, IColumnHookOutput, ICustomStepConfig, ICustomStepConnectionMethods, IDeveloperField, IDeveloperSettings, IDeveloperStyleOverrides, IImporterOptions, IParseFileCallback, IResultMetadata, IRowDeleteHook, IRowHook, IRowHookInput, IRowHookOutput, IStepHook, IUser, IValidatorField } from 'dromo-uploader-js';
|
|
4
|
+
|
|
5
|
+
type VerboseRequiredProps = {
|
|
6
|
+
user: IUser;
|
|
7
|
+
fields: IDeveloperField[];
|
|
8
|
+
licenseKey: string;
|
|
9
|
+
settings: IDeveloperSettings;
|
|
10
|
+
};
|
|
11
|
+
type SavedSchemaProps = {
|
|
12
|
+
licenseKey: string;
|
|
13
|
+
} & ({
|
|
14
|
+
schemaName: string;
|
|
15
|
+
} | {
|
|
16
|
+
schemaId: string;
|
|
17
|
+
}) & IImporterOptions;
|
|
18
|
+
type CommonProps = {
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
className?: string;
|
|
21
|
+
rowHooks?: IRowHook[];
|
|
22
|
+
bulkRowHooks?: IBulkRowHook[];
|
|
23
|
+
rowDeleteHooks?: IRowDeleteHook[];
|
|
24
|
+
columnHooks?: IColumnHook[];
|
|
25
|
+
stepHooks?: IStepHook[];
|
|
26
|
+
customSteps?: ICustomStepConfig[];
|
|
27
|
+
fileParsers?: {
|
|
28
|
+
extensions: string[];
|
|
29
|
+
parseFile: IParseFileCallback;
|
|
30
|
+
}[];
|
|
31
|
+
beforeFinish?: IBeforeFinishCallback;
|
|
32
|
+
onResults?: (data: any, metadata: IResultMetadata) => void;
|
|
33
|
+
onCancel?: () => void;
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
open?: boolean;
|
|
36
|
+
inline?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps;
|
|
39
|
+
declare class DromoReactUploader extends React.Component<Props> {
|
|
40
|
+
dromo: any;
|
|
41
|
+
inlineRef: React.RefObject<HTMLDivElement> | null;
|
|
42
|
+
constructor(props: Props);
|
|
43
|
+
init: () => void;
|
|
44
|
+
open: () => void;
|
|
45
|
+
initInline: () => void;
|
|
46
|
+
componentDidMount(): void;
|
|
47
|
+
componentDidUpdate(prevProps: Props): void;
|
|
48
|
+
componentWillUnmount(): void;
|
|
49
|
+
render(): JSX.Element;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { DromoReactUploader as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IUser, IDeveloperField, IDeveloperSettings, IImporterOptions, IRowHook, IBulkRowHook, IRowDeleteHook, IColumnHook, IStepHook, ICustomStepConfig, IParseFileCallback, IBeforeFinishCallback, IResultMetadata } from 'dromo-uploader-js';
|
|
3
|
+
export { CustomStepInsertAfter, IBeforeFinishCallback, IBulkRowHook, IColumnHook, IColumnHookInput, IColumnHookOutput, ICustomStepConfig, ICustomStepConnectionMethods, IDeveloperField, IDeveloperSettings, IDeveloperStyleOverrides, IImporterOptions, IParseFileCallback, IResultMetadata, IRowDeleteHook, IRowHook, IRowHookInput, IRowHookOutput, IStepHook, IUser, IValidatorField } from 'dromo-uploader-js';
|
|
4
|
+
|
|
5
|
+
type VerboseRequiredProps = {
|
|
6
|
+
user: IUser;
|
|
7
|
+
fields: IDeveloperField[];
|
|
8
|
+
licenseKey: string;
|
|
9
|
+
settings: IDeveloperSettings;
|
|
10
|
+
};
|
|
11
|
+
type SavedSchemaProps = {
|
|
12
|
+
licenseKey: string;
|
|
13
|
+
} & ({
|
|
14
|
+
schemaName: string;
|
|
15
|
+
} | {
|
|
16
|
+
schemaId: string;
|
|
17
|
+
}) & IImporterOptions;
|
|
18
|
+
type CommonProps = {
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
className?: string;
|
|
21
|
+
rowHooks?: IRowHook[];
|
|
22
|
+
bulkRowHooks?: IBulkRowHook[];
|
|
23
|
+
rowDeleteHooks?: IRowDeleteHook[];
|
|
24
|
+
columnHooks?: IColumnHook[];
|
|
25
|
+
stepHooks?: IStepHook[];
|
|
26
|
+
customSteps?: ICustomStepConfig[];
|
|
27
|
+
fileParsers?: {
|
|
28
|
+
extensions: string[];
|
|
29
|
+
parseFile: IParseFileCallback;
|
|
30
|
+
}[];
|
|
31
|
+
beforeFinish?: IBeforeFinishCallback;
|
|
32
|
+
onResults?: (data: any, metadata: IResultMetadata) => void;
|
|
33
|
+
onCancel?: () => void;
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
open?: boolean;
|
|
36
|
+
inline?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps;
|
|
39
|
+
declare class DromoReactUploader extends React.Component<Props> {
|
|
40
|
+
dromo: any;
|
|
41
|
+
inlineRef: React.RefObject<HTMLDivElement> | null;
|
|
42
|
+
constructor(props: Props);
|
|
43
|
+
init: () => void;
|
|
44
|
+
open: () => void;
|
|
45
|
+
initInline: () => void;
|
|
46
|
+
componentDidMount(): void;
|
|
47
|
+
componentDidUpdate(prevProps: Props): void;
|
|
48
|
+
componentWillUnmount(): void;
|
|
49
|
+
render(): JSX.Element;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { DromoReactUploader as default };
|
package/dist/index.js
CHANGED
|
@@ -1,135 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var DromoUploader = _interopDefault(require('dromo-uploader-js'));
|
|
5
|
-
|
|
6
|
-
function _inheritsLoose(t, o) {
|
|
7
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
8
|
-
}
|
|
9
|
-
function _setPrototypeOf(t, e) {
|
|
10
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
11
|
-
return t.__proto__ = e, t;
|
|
12
|
-
}, _setPrototypeOf(t, e);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
|
|
16
|
-
function DromoReactUploader(props) {
|
|
17
|
-
var _this;
|
|
18
|
-
_this = _React$Component.call(this, props) || this;
|
|
19
|
-
_this.inlineRef = null;
|
|
20
|
-
_this.init = function () {
|
|
21
|
-
if ('fields' in _this.props && 'settings' in _this.props) {
|
|
22
|
-
_this.dromo = new DromoUploader(_this.props.licenseKey, _this.props.fields, _this.props.settings, _this.props.user);
|
|
23
|
-
} else if ('schemaId' in _this.props || 'schemaName' in _this.props) {
|
|
24
|
-
var idOrName = 'schemaId' in _this.props ? _this.props.schemaId : _this.props.schemaName;
|
|
25
|
-
_this.dromo = new DromoUploader(_this.props.licenseKey, idOrName);
|
|
26
|
-
if ('developmentMode' in _this.props) {
|
|
27
|
-
_this.dromo.setDevelopmentMode(_this.props.developmentMode);
|
|
28
|
-
}
|
|
29
|
-
if ('user' in _this.props) {
|
|
30
|
-
_this.dromo.setUser(_this.props.user);
|
|
31
|
-
}
|
|
32
|
-
if ('headerRowOverride' in _this.props) {
|
|
33
|
-
_this.dromo.setHeaderRowOverride(_this.props.headerRowOverride);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (_this.props.rowHooks) {
|
|
37
|
-
_this.props.rowHooks.forEach(function (hook) {
|
|
38
|
-
return _this.dromo.registerRowHook(hook);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
if (_this.props.bulkRowHooks) {
|
|
42
|
-
_this.props.bulkRowHooks.forEach(function (hook) {
|
|
43
|
-
return _this.dromo.registerBulkRowHook(hook);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
if (_this.props.columnHooks) {
|
|
47
|
-
_this.props.columnHooks.forEach(function (hook) {
|
|
48
|
-
_this.dromo.registerColumnHook(hook.fieldName, hook.callback);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (_this.props.rowDeleteHooks) {
|
|
52
|
-
_this.props.rowDeleteHooks.forEach(function (hook) {
|
|
53
|
-
return _this.dromo.registerRowDeleteHook(hook);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (_this.props.beforeFinish) {
|
|
57
|
-
_this.dromo.beforeFinish(_this.props.beforeFinish);
|
|
58
|
-
}
|
|
59
|
-
if (_this.props.onResults) {
|
|
60
|
-
_this.dromo.onResults(_this.props.onResults);
|
|
61
|
-
}
|
|
62
|
-
if (_this.props.onCancel) {
|
|
63
|
-
_this.dromo.onCancel(_this.props.onCancel);
|
|
64
|
-
}
|
|
65
|
-
if (_this.props.stepHooks) {
|
|
66
|
-
_this.props.stepHooks.forEach(function (hook) {
|
|
67
|
-
_this.dromo.registerStepHook(hook.type, hook.callback);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (_this.props.fileParsers) {
|
|
71
|
-
_this.props.fileParsers.forEach(function (parser) {
|
|
72
|
-
_this.dromo.registerFileParser(parser);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
_this.open = function () {
|
|
77
|
-
_this.init();
|
|
78
|
-
_this.dromo.open();
|
|
79
|
-
};
|
|
80
|
-
_this.initInline = function () {
|
|
81
|
-
if (!_this.inlineRef) return;
|
|
82
|
-
_this.init();
|
|
83
|
-
_this.dromo.initInline(_this.inlineRef.current);
|
|
84
|
-
};
|
|
85
|
-
if (props.inline) {
|
|
86
|
-
_this.inlineRef = React.createRef();
|
|
87
|
-
}
|
|
88
|
-
return _this;
|
|
89
|
-
}
|
|
90
|
-
_inheritsLoose(DromoReactUploader, _React$Component);
|
|
91
|
-
var _proto = DromoReactUploader.prototype;
|
|
92
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
93
|
-
if (this.props.inline && this.inlineRef) {
|
|
94
|
-
this.initInline();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (this.props.open) this.open();
|
|
98
|
-
};
|
|
99
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
100
|
-
if (this.props.inline) {
|
|
101
|
-
this.initInline();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (!prevProps.open && this.props.open) {
|
|
105
|
-
this.open();
|
|
106
|
-
}
|
|
107
|
-
if (prevProps.open && !this.props.open) {
|
|
108
|
-
this.dromo.close();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
112
|
-
if (this.props.open && !this.props.inline) {
|
|
113
|
-
this.dromo.close();
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
_proto.render = function render() {
|
|
117
|
-
if (this.props.inline) {
|
|
118
|
-
return React.createElement("div", {
|
|
119
|
-
ref: this.inlineRef,
|
|
120
|
-
className: this.props.className,
|
|
121
|
-
style: this.props.style
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
if (this.props.children === undefined) return React.createElement(React.Fragment, null);
|
|
125
|
-
return React.createElement("button", {
|
|
126
|
-
style: this.props.style,
|
|
127
|
-
className: this.props.className,
|
|
128
|
-
onClick: this.open
|
|
129
|
-
}, this.props.children);
|
|
130
|
-
};
|
|
131
|
-
return DromoReactUploader;
|
|
132
|
-
}(React.Component);
|
|
133
|
-
|
|
134
|
-
module.exports = DromoReactUploader;
|
|
135
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
var m=Object.create;var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var I=(s,e)=>{for(var t in e)p(s,t,{get:e[t],enumerable:!0})},h=(s,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!u.call(s,r)&&r!==t&&p(s,r,{get:()=>e[r],enumerable:!(l=d(e,r))||l.enumerable});return s};var a=(s,e,t)=>(t=s!=null?m(f(s)):{},h(e||!s||!s.__esModule?p(t,"default",{value:s,enumerable:!0}):t,s)),k=s=>h(p({},"__esModule",{value:!0}),s);var R={};I(R,{CustomStepInsertAfter:()=>o.CustomStepInsertAfter,IBeforeFinishCallback:()=>o.IBeforeFinishCallback,IBulkRowHook:()=>o.IBulkRowHook,IColumnHook:()=>o.IColumnHook,IColumnHookInput:()=>o.IColumnHookInput,IColumnHookOutput:()=>o.IColumnHookOutput,ICustomStepConfig:()=>o.ICustomStepConfig,ICustomStepConnectionMethods:()=>o.ICustomStepConnectionMethods,IDeveloperField:()=>o.IDeveloperField,IDeveloperSettings:()=>o.IDeveloperSettings,IDeveloperStyleOverrides:()=>o.IDeveloperStyleOverrides,IImporterOptions:()=>o.IImporterOptions,IParseFileCallback:()=>o.IParseFileCallback,IResultMetadata:()=>o.IResultMetadata,IRowDeleteHook:()=>o.IRowDeleteHook,IRowHook:()=>o.IRowHook,IRowHookInput:()=>o.IRowHookInput,IRowHookOutput:()=>o.IRowHookOutput,IStepHook:()=>o.IStepHook,IUser:()=>o.IUser,IValidatorField:()=>o.IValidatorField,default:()=>n});module.exports=k(R);var i=a(require("react")),o=a(require("dromo-uploader-js")),n=class extends i.Component{dromo;inlineRef=null;constructor(e){super(e),e.inline&&(this.inlineRef=i.createRef())}init=()=>{if("fields"in this.props&&"settings"in this.props)this.dromo=new o.default(this.props.licenseKey,this.props.fields,this.props.settings,this.props.user);else if("schemaId"in this.props||"schemaName"in this.props){let e="schemaId"in this.props?this.props.schemaId:this.props.schemaName;this.dromo=new o.default(this.props.licenseKey,e),"developmentMode"in this.props&&this.dromo.setDevelopmentMode(this.props.developmentMode),"user"in this.props&&this.dromo.setUser(this.props.user),"headerRowOverride"in this.props&&this.dromo.setHeaderRowOverride(this.props.headerRowOverride)}this.props.rowHooks&&this.props.rowHooks.forEach(e=>this.dromo.registerRowHook(e)),this.props.bulkRowHooks&&this.props.bulkRowHooks.forEach(e=>this.dromo.registerBulkRowHook(e)),this.props.columnHooks&&this.props.columnHooks.forEach(e=>{this.dromo.registerColumnHook(e.fieldName,e.callback)}),this.props.rowDeleteHooks&&this.props.rowDeleteHooks.forEach(e=>this.dromo.registerRowDeleteHook(e)),this.props.beforeFinish&&this.dromo.beforeFinish(this.props.beforeFinish),this.props.onResults&&this.dromo.onResults(this.props.onResults),this.props.onCancel&&this.dromo.onCancel(this.props.onCancel),this.props.stepHooks&&this.props.stepHooks.forEach(e=>{this.dromo.registerStepHook(e.type,e.callback)}),this.props.customSteps&&this.props.customSteps.forEach(e=>{this.dromo.registerCustomStep(e)}),this.props.fileParsers&&this.props.fileParsers.forEach(e=>{this.dromo.registerFileParser(e)})};open=()=>{this.init(),this.dromo.open()};initInline=()=>{this.inlineRef&&(this.init(),this.dromo.initInline(this.inlineRef.current))};componentDidMount(){if(this.props.inline&&this.inlineRef){this.initInline();return}this.props.open&&this.open()}componentDidUpdate(e){if(this.props.inline){this.initInline();return}!e.open&&this.props.open&&this.open(),e.open&&!this.props.open&&this.dromo.close()}componentWillUnmount(){this.props.open&&!this.props.inline&&this.dromo.close()}render(){return this.props.inline?i.createElement("div",{ref:this.inlineRef,className:this.props.className,style:this.props.style}):this.props.children===void 0?i.createElement(i.Fragment,null):i.createElement("button",{style:this.props.style,className:this.props.className,onClick:this.open},this.props.children)}};0&&(module.exports={CustomStepInsertAfter,IBeforeFinishCallback,IBulkRowHook,IColumnHook,IColumnHookInput,IColumnHookOutput,ICustomStepConfig,ICustomStepConnectionMethods,IDeveloperField,IDeveloperSettings,IDeveloperStyleOverrides,IImporterOptions,IParseFileCallback,IResultMetadata,IRowDeleteHook,IRowHook,IRowHookInput,IRowHookOutput,IStepHook,IUser,IValidatorField});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport DromoUploader, {\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback\n} from 'dromo-uploader-js'\n\ntype VerboseRequiredProps = {\n user: IUser\n fields: IDeveloperField[]\n licenseKey: string\n settings: IDeveloperSettings\n}\n\ntype SavedSchemaProps = {\n licenseKey: string\n} & ({ schemaName: string } | { schemaId: string }) &\n IImporterOptions\n\ntype CommonProps = {\n style?: React.CSSProperties\n className?: string\n rowHooks?: IRowHook[]\n bulkRowHooks?: IBulkRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n fileParsers?: { extensions: string[]; parseFile: IParseFileCallback }[]\n beforeFinish?: IBeforeFinishCallback\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children?: React.ReactNode\n open?: boolean\n inline?: boolean\n}\n\ntype Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n inlineRef: React.RefObject<HTMLDivElement> | null = null\n\n constructor(props: Props) {\n super(props)\n\n if (props.inline) {\n this.inlineRef = React.createRef()\n }\n }\n\n init = () => {\n if ('fields' in this.props && 'settings' in this.props) {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n } else if ('schemaId' in this.props || 'schemaName' in this.props) {\n const idOrName =\n 'schemaId' in this.props ? this.props.schemaId : this.props.schemaName\n\n this.dromo = new DromoUploader(this.props.licenseKey, idOrName)\n\n if ('developmentMode' in this.props) {\n this.dromo.setDevelopmentMode(this.props.developmentMode)\n }\n if ('user' in this.props) {\n this.dromo.setUser(this.props.user)\n }\n if ('headerRowOverride' in this.props) {\n this.dromo.setHeaderRowOverride(this.props.headerRowOverride)\n }\n }\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.bulkRowHooks) {\n this.props.bulkRowHooks.forEach((hook) =>\n this.dromo.registerBulkRowHook(hook)\n )\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.beforeFinish) {\n this.dromo.beforeFinish(this.props.beforeFinish)\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 if (this.props.fileParsers) {\n this.props.fileParsers.forEach((parser) => {\n this.dromo.registerFileParser(parser)\n })\n }\n }\n\n open = () => {\n this.init()\n this.dromo.open()\n }\n\n initInline = () => {\n if (!this.inlineRef) return\n\n this.init()\n this.dromo.initInline(this.inlineRef.current)\n }\n\n componentDidMount() {\n if (this.props.inline && this.inlineRef) {\n this.initInline()\n return\n }\n\n if (this.props.open) this.open()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (this.props.inline) {\n this.initInline()\n return\n }\n\n if (!prevProps.open && this.props.open) {\n this.open()\n }\n\n if (prevProps.open && !this.props.open) {\n this.dromo.close()\n }\n }\n\n componentWillUnmount() {\n if (this.props.open && !this.props.inline) {\n this.dromo.close()\n }\n }\n\n render() {\n if (this.props.inline) {\n return (\n <div\n ref={this.inlineRef}\n className={this.props.className}\n style={this.props.style}\n />\n )\n }\n\n if (this.props.children === undefined) return <React.Fragment />\n\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback\n}\n"],"names":["DromoReactUploader","_React$Component","props","_this","call","dromo","DromoUploader","licenseKey","fields","settings","user","idOrName","schemaId","schemaName","setDevelopmentMode","developmentMode","setUser","setHeaderRowOverride","headerRowOverride","rowHooks","forEach","hook","registerRowHook","bulkRowHooks","registerBulkRowHook","columnHooks","registerColumnHook","fieldName","callback","rowDeleteHooks","registerRowDeleteHook","beforeFinish","onResults","onCancel","stepHooks","registerStepHook","type","fileParsers","parser","registerFileParser","init","open","inlineRef","initInline","current","inline","React","_inheritsLoose","_proto","prototype","componentDidMount","componentDidUpdate","prevProps","close","componentWillUnmount","render","ref","className","style","children","undefined","onClick"],"mappings":";;;;;;;;;;;;;;IAqDqBA,kBAAmB,0BAAAC,gBAAA;EAItC,SAAAD,mBAAYE,KAAY;;IACtBC,KAAA,GAAAF,gBAAA,CAAAG,IAAA,OAAMF,KAAK,CAAC;IAHdC,KAAA,UAAS,GAA2C,IAAI;IAUxDA,KAAA,KAAI,GAAG;MACL,IAAI,QAAQ,IAAIA,KAAA,CAAKD,KAAK,IAAI,UAAU,IAAIC,KAAA,CAAKD,KAAK,EAAE;QACtDC,KAAA,CAAKE,KAAK,GAAG,IAAIC,aAAa,CAC5BH,KAAA,CAAKD,KAAK,CAACK,UAAU,EACrBJ,KAAA,CAAKD,KAAK,CAACM,MAAM,EACjBL,KAAA,CAAKD,KAAK,CAACO,QAAQ,EACnBN,KAAA,CAAKD,KAAK,CAACQ,IAAI,CAChB;OACF,MAAM,IAAI,UAAU,IAAIP,KAAA,CAAKD,KAAK,IAAI,YAAY,IAAIC,KAAA,CAAKD,KAAK,EAAE;QACjE,IAAMS,QAAQ,GACZ,UAAU,IAAIR,KAAA,CAAKD,KAAK,GAAGC,KAAA,CAAKD,KAAK,CAACU,QAAQ,GAAGT,KAAA,CAAKD,KAAK,CAACW,UAAU;QAExEV,KAAA,CAAKE,K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EAAE;MACrB,OACEC;QACEU,GAAG,EAAE,IAAI,CAACd,SAAS;QACnBe,SAAS,EAAE,IAAI,CAACvD,KAAK,CAACuD,SAAS;QAC/BC,KAAK,EAAE,IAAI,CAACxD,KAAK,CAACwD;QAClB;;IAIN,IAAI,IAAI,CAACxD,KAAK,CAACyD,QAAQ,KAAKC,SAAS,EAAE,OAAOd,oBAACA,cAAc,OAAG;IAEhE,OACEA;MACEY,KAAK,EAAE,IAAI,CAACxD,KAAK,CAACwD,KAAK;MACvBD,SAAS,EAAE,IAAI,CAACvD,KAAK,CAACuD,SAAS;MAC/BI,OAAO,EAAE,IAAI,CAACpB;OAEb,IAAI,CAACvC,KAAK,CAACyD,QAAQ,CACb;GAEZ;EAAA,OAAA3D,kBAAA;AAAA,EApJ6C8C,eAAsB;;;;"}
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport DromoUploader, {\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback,\n CustomStepInsertAfter,\n ICustomStepConfig,\n ICustomStepConnectionMethods\n} from 'dromo-uploader-js'\n\ntype VerboseRequiredProps = {\n user: IUser\n fields: IDeveloperField[]\n licenseKey: string\n settings: IDeveloperSettings\n}\n\ntype SavedSchemaProps = {\n licenseKey: string\n} & ({ schemaName: string } | { schemaId: string }) &\n IImporterOptions\n\ntype CommonProps = {\n style?: React.CSSProperties\n className?: string\n rowHooks?: IRowHook[]\n bulkRowHooks?: IBulkRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n customSteps?: ICustomStepConfig[]\n fileParsers?: { extensions: string[]; parseFile: IParseFileCallback }[]\n beforeFinish?: IBeforeFinishCallback\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children?: React.ReactNode\n open?: boolean\n inline?: boolean\n}\n\ntype Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n inlineRef: React.RefObject<HTMLDivElement> | null = null\n\n constructor(props: Props) {\n super(props)\n\n if (props.inline) {\n this.inlineRef = React.createRef()\n }\n }\n\n init = () => {\n if ('fields' in this.props && 'settings' in this.props) {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n } else if ('schemaId' in this.props || 'schemaName' in this.props) {\n const idOrName =\n 'schemaId' in this.props ? this.props.schemaId : this.props.schemaName\n\n this.dromo = new DromoUploader(this.props.licenseKey, idOrName)\n\n if ('developmentMode' in this.props) {\n this.dromo.setDevelopmentMode(this.props.developmentMode)\n }\n if ('user' in this.props) {\n this.dromo.setUser(this.props.user)\n }\n if ('headerRowOverride' in this.props) {\n this.dromo.setHeaderRowOverride(this.props.headerRowOverride)\n }\n }\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.bulkRowHooks) {\n this.props.bulkRowHooks.forEach((hook) =>\n this.dromo.registerBulkRowHook(hook)\n )\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.beforeFinish) {\n this.dromo.beforeFinish(this.props.beforeFinish)\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 if (this.props.customSteps) {\n this.props.customSteps.forEach((step) => {\n this.dromo.registerCustomStep(step)\n })\n }\n\n if (this.props.fileParsers) {\n this.props.fileParsers.forEach((parser) => {\n this.dromo.registerFileParser(parser)\n })\n }\n }\n\n open = () => {\n this.init()\n this.dromo.open()\n }\n\n initInline = () => {\n if (!this.inlineRef) return\n\n this.init()\n this.dromo.initInline(this.inlineRef.current)\n }\n\n componentDidMount() {\n if (this.props.inline && this.inlineRef) {\n this.initInline()\n return\n }\n\n if (this.props.open) this.open()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (this.props.inline) {\n this.initInline()\n return\n }\n\n if (!prevProps.open && this.props.open) {\n this.open()\n }\n\n if (prevProps.open && !this.props.open) {\n this.dromo.close()\n }\n }\n\n componentWillUnmount() {\n if (this.props.open && !this.props.inline) {\n this.dromo.close()\n }\n }\n\n render() {\n if (this.props.inline) {\n return (\n <div\n ref={this.inlineRef}\n className={this.props.className}\n style={this.props.style}\n />\n )\n }\n\n if (this.props.children === undefined) return <React.Fragment />\n\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback,\n ICustomStepConfig,\n CustomStepInsertAfter,\n ICustomStepConnectionMethods\n}\n"],"mappings":"6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,m0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBACvBC,EAsBO,gCAkCcH,EAArB,cAAsD,WAAiB,CACrE,MACA,UAAoD,KAEpD,YAAYI,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GAAS,CACrC,KAAK,MAAM,iBAAiBA,EAAK,KAAMA,EAAK,QAAQ,CACtD,CAAC,EAGC,KAAK,MAAM,aACb,KAAK,MAAM,YAAY,QAASC,GAAS,CACvC,KAAK,MAAM,mBAAmBA,CAAI,CACpC,CAAC,EAGC,KAAK,MAAM,aACb,KAAK,MAAM,YAAY,QAASC,GAAW,CACzC,KAAK,MAAM,mBAAmBA,CAAM,CACtC,CAAC,CAEL,EAEA,KAAO,IAAM,CACX,KAAK,KAAK,EACV,KAAK,MAAM,KAAK,CAClB,EAEA,WAAa,IAAM,CACZ,KAAK,YAEV,KAAK,KAAK,EACV,KAAK,MAAM,WAAW,KAAK,UAAU,OAAO,EAC9C,EAEA,mBAAoB,CAClB,GAAI,KAAK,MAAM,QAAU,KAAK,UAAW,CACvC,KAAK,WAAW,EAChB,MACF,CAEI,KAAK,MAAM,MAAM,KAAK,KAAK,CACjC,CAEA,mBAAmBC,EAAkB,CACnC,GAAI,KAAK,MAAM,OAAQ,CACrB,KAAK,WAAW,EAChB,MACF,CAEI,CAACA,EAAU,MAAQ,KAAK,MAAM,MAChC,KAAK,KAAK,EAGRA,EAAU,MAAQ,CAAC,KAAK,MAAM,MAChC,KAAK,MAAM,MAAM,CAErB,CAEA,sBAAuB,CACjB,KAAK,MAAM,MAAQ,CAAC,KAAK,MAAM,QACjC,KAAK,MAAM,MAAM,CAErB,CAEA,QAAS,CACP,OAAI,KAAK,MAAM,OAEX,gBAAC,OACC,IAAK,KAAK,UACV,UAAW,KAAK,MAAM,UACtB,MAAO,KAAK,MAAM,MACpB,EAIA,KAAK,MAAM,WAAa,OAAkB,gBAAO,WAAN,IAAe,EAG5D,gBAAC,UACC,MAAO,KAAK,MAAM,MAClB,UAAW,KAAK,MAAM,UACtB,QAAS,KAAK,MAEb,KAAK,MAAM,QACd,CAEJ,CACF","names":["index_exports","__export","DromoReactUploader","__toCommonJS","React","import_dromo_uploader_js","props","DromoUploader","idOrName","hook","step","parser","prevProps"]}
|
package/dist/index.modern.js
CHANGED
|
@@ -1,133 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function _inheritsLoose(t, o) {
|
|
5
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
6
|
-
}
|
|
7
|
-
function _setPrototypeOf(t, e) {
|
|
8
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
9
|
-
return t.__proto__ = e, t;
|
|
10
|
-
}, _setPrototypeOf(t, e);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
|
|
14
|
-
function DromoReactUploader(props) {
|
|
15
|
-
var _this;
|
|
16
|
-
_this = _React$Component.call(this, props) || this;
|
|
17
|
-
_this.inlineRef = null;
|
|
18
|
-
_this.init = function () {
|
|
19
|
-
if ('fields' in _this.props && 'settings' in _this.props) {
|
|
20
|
-
_this.dromo = new DromoUploader(_this.props.licenseKey, _this.props.fields, _this.props.settings, _this.props.user);
|
|
21
|
-
} else if ('schemaId' in _this.props || 'schemaName' in _this.props) {
|
|
22
|
-
var idOrName = 'schemaId' in _this.props ? _this.props.schemaId : _this.props.schemaName;
|
|
23
|
-
_this.dromo = new DromoUploader(_this.props.licenseKey, idOrName);
|
|
24
|
-
if ('developmentMode' in _this.props) {
|
|
25
|
-
_this.dromo.setDevelopmentMode(_this.props.developmentMode);
|
|
26
|
-
}
|
|
27
|
-
if ('user' in _this.props) {
|
|
28
|
-
_this.dromo.setUser(_this.props.user);
|
|
29
|
-
}
|
|
30
|
-
if ('headerRowOverride' in _this.props) {
|
|
31
|
-
_this.dromo.setHeaderRowOverride(_this.props.headerRowOverride);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (_this.props.rowHooks) {
|
|
35
|
-
_this.props.rowHooks.forEach(function (hook) {
|
|
36
|
-
return _this.dromo.registerRowHook(hook);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (_this.props.bulkRowHooks) {
|
|
40
|
-
_this.props.bulkRowHooks.forEach(function (hook) {
|
|
41
|
-
return _this.dromo.registerBulkRowHook(hook);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (_this.props.columnHooks) {
|
|
45
|
-
_this.props.columnHooks.forEach(function (hook) {
|
|
46
|
-
_this.dromo.registerColumnHook(hook.fieldName, hook.callback);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
if (_this.props.rowDeleteHooks) {
|
|
50
|
-
_this.props.rowDeleteHooks.forEach(function (hook) {
|
|
51
|
-
return _this.dromo.registerRowDeleteHook(hook);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
if (_this.props.beforeFinish) {
|
|
55
|
-
_this.dromo.beforeFinish(_this.props.beforeFinish);
|
|
56
|
-
}
|
|
57
|
-
if (_this.props.onResults) {
|
|
58
|
-
_this.dromo.onResults(_this.props.onResults);
|
|
59
|
-
}
|
|
60
|
-
if (_this.props.onCancel) {
|
|
61
|
-
_this.dromo.onCancel(_this.props.onCancel);
|
|
62
|
-
}
|
|
63
|
-
if (_this.props.stepHooks) {
|
|
64
|
-
_this.props.stepHooks.forEach(function (hook) {
|
|
65
|
-
_this.dromo.registerStepHook(hook.type, hook.callback);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (_this.props.fileParsers) {
|
|
69
|
-
_this.props.fileParsers.forEach(function (parser) {
|
|
70
|
-
_this.dromo.registerFileParser(parser);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
_this.open = function () {
|
|
75
|
-
_this.init();
|
|
76
|
-
_this.dromo.open();
|
|
77
|
-
};
|
|
78
|
-
_this.initInline = function () {
|
|
79
|
-
if (!_this.inlineRef) return;
|
|
80
|
-
_this.init();
|
|
81
|
-
_this.dromo.initInline(_this.inlineRef.current);
|
|
82
|
-
};
|
|
83
|
-
if (props.inline) {
|
|
84
|
-
_this.inlineRef = createRef();
|
|
85
|
-
}
|
|
86
|
-
return _this;
|
|
87
|
-
}
|
|
88
|
-
_inheritsLoose(DromoReactUploader, _React$Component);
|
|
89
|
-
var _proto = DromoReactUploader.prototype;
|
|
90
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
91
|
-
if (this.props.inline && this.inlineRef) {
|
|
92
|
-
this.initInline();
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (this.props.open) this.open();
|
|
96
|
-
};
|
|
97
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
98
|
-
if (this.props.inline) {
|
|
99
|
-
this.initInline();
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (!prevProps.open && this.props.open) {
|
|
103
|
-
this.open();
|
|
104
|
-
}
|
|
105
|
-
if (prevProps.open && !this.props.open) {
|
|
106
|
-
this.dromo.close();
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
110
|
-
if (this.props.open && !this.props.inline) {
|
|
111
|
-
this.dromo.close();
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
_proto.render = function render() {
|
|
115
|
-
if (this.props.inline) {
|
|
116
|
-
return createElement("div", {
|
|
117
|
-
ref: this.inlineRef,
|
|
118
|
-
className: this.props.className,
|
|
119
|
-
style: this.props.style
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
if (this.props.children === undefined) return createElement(Fragment, null);
|
|
123
|
-
return createElement("button", {
|
|
124
|
-
style: this.props.style,
|
|
125
|
-
className: this.props.className,
|
|
126
|
-
onClick: this.open
|
|
127
|
-
}, this.props.children);
|
|
128
|
-
};
|
|
129
|
-
return DromoReactUploader;
|
|
130
|
-
}(Component);
|
|
131
|
-
|
|
132
|
-
export default DromoReactUploader;
|
|
133
|
-
//# sourceMappingURL=index.modern.js.map
|
|
1
|
+
import*as e from"react";import i,{IColumnHookInput as p,IColumnHookOutput as n,IColumnHook as l,IDeveloperField as h,IValidatorField as a,IDeveloperSettings as m,IRowHookInput as d,IRowHookOutput as c,IRowHook as f,IDeveloperStyleOverrides as u,IUser as I,IResultMetadata as k,IStepHook as R,IRowDeleteHook as H,IBeforeFinishCallback as C,IBulkRowHook as w,IImporterOptions as g,IParseFileCallback as b,CustomStepInsertAfter as S,ICustomStepConfig as v,ICustomStepConnectionMethods as y}from"dromo-uploader-js";var s=class extends e.Component{dromo;inlineRef=null;constructor(o){super(o),o.inline&&(this.inlineRef=e.createRef())}init=()=>{if("fields"in this.props&&"settings"in this.props)this.dromo=new i(this.props.licenseKey,this.props.fields,this.props.settings,this.props.user);else if("schemaId"in this.props||"schemaName"in this.props){let o="schemaId"in this.props?this.props.schemaId:this.props.schemaName;this.dromo=new i(this.props.licenseKey,o),"developmentMode"in this.props&&this.dromo.setDevelopmentMode(this.props.developmentMode),"user"in this.props&&this.dromo.setUser(this.props.user),"headerRowOverride"in this.props&&this.dromo.setHeaderRowOverride(this.props.headerRowOverride)}this.props.rowHooks&&this.props.rowHooks.forEach(o=>this.dromo.registerRowHook(o)),this.props.bulkRowHooks&&this.props.bulkRowHooks.forEach(o=>this.dromo.registerBulkRowHook(o)),this.props.columnHooks&&this.props.columnHooks.forEach(o=>{this.dromo.registerColumnHook(o.fieldName,o.callback)}),this.props.rowDeleteHooks&&this.props.rowDeleteHooks.forEach(o=>this.dromo.registerRowDeleteHook(o)),this.props.beforeFinish&&this.dromo.beforeFinish(this.props.beforeFinish),this.props.onResults&&this.dromo.onResults(this.props.onResults),this.props.onCancel&&this.dromo.onCancel(this.props.onCancel),this.props.stepHooks&&this.props.stepHooks.forEach(o=>{this.dromo.registerStepHook(o.type,o.callback)}),this.props.customSteps&&this.props.customSteps.forEach(o=>{this.dromo.registerCustomStep(o)}),this.props.fileParsers&&this.props.fileParsers.forEach(o=>{this.dromo.registerFileParser(o)})};open=()=>{this.init(),this.dromo.open()};initInline=()=>{this.inlineRef&&(this.init(),this.dromo.initInline(this.inlineRef.current))};componentDidMount(){if(this.props.inline&&this.inlineRef){this.initInline();return}this.props.open&&this.open()}componentDidUpdate(o){if(this.props.inline){this.initInline();return}!o.open&&this.props.open&&this.open(),o.open&&!this.props.open&&this.dromo.close()}componentWillUnmount(){this.props.open&&!this.props.inline&&this.dromo.close()}render(){return this.props.inline?e.createElement("div",{ref:this.inlineRef,className:this.props.className,style:this.props.style}):this.props.children===void 0?e.createElement(e.Fragment,null):e.createElement("button",{style:this.props.style,className:this.props.className,onClick:this.open},this.props.children)}};export{S as CustomStepInsertAfter,C as IBeforeFinishCallback,w as IBulkRowHook,l as IColumnHook,p as IColumnHookInput,n as IColumnHookOutput,v as ICustomStepConfig,y as ICustomStepConnectionMethods,h as IDeveloperField,m as IDeveloperSettings,u as IDeveloperStyleOverrides,g as IImporterOptions,b as IParseFileCallback,k as IResultMetadata,H as IRowDeleteHook,f as IRowHook,d as IRowHookInput,c as IRowHookOutput,R as IStepHook,I as IUser,a as IValidatorField,s as default};
|
|
2
|
+
//# sourceMappingURL=index.modern.js.map
|
package/dist/index.modern.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.js","sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport DromoUploader, {\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback\n} from 'dromo-uploader-js'\n\ntype VerboseRequiredProps = {\n user: IUser\n fields: IDeveloperField[]\n licenseKey: string\n settings: IDeveloperSettings\n}\n\ntype SavedSchemaProps = {\n licenseKey: string\n} & ({ schemaName: string } | { schemaId: string }) &\n IImporterOptions\n\ntype CommonProps = {\n style?: React.CSSProperties\n className?: string\n rowHooks?: IRowHook[]\n bulkRowHooks?: IBulkRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n fileParsers?: { extensions: string[]; parseFile: IParseFileCallback }[]\n beforeFinish?: IBeforeFinishCallback\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children?: React.ReactNode\n open?: boolean\n inline?: boolean\n}\n\ntype Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n inlineRef: React.RefObject<HTMLDivElement> | null = null\n\n constructor(props: Props) {\n super(props)\n\n if (props.inline) {\n this.inlineRef = React.createRef()\n }\n }\n\n init = () => {\n if ('fields' in this.props && 'settings' in this.props) {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n } else if ('schemaId' in this.props || 'schemaName' in this.props) {\n const idOrName =\n 'schemaId' in this.props ? this.props.schemaId : this.props.schemaName\n\n this.dromo = new DromoUploader(this.props.licenseKey, idOrName)\n\n if ('developmentMode' in this.props) {\n this.dromo.setDevelopmentMode(this.props.developmentMode)\n }\n if ('user' in this.props) {\n this.dromo.setUser(this.props.user)\n }\n if ('headerRowOverride' in this.props) {\n this.dromo.setHeaderRowOverride(this.props.headerRowOverride)\n }\n }\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.bulkRowHooks) {\n this.props.bulkRowHooks.forEach((hook) =>\n this.dromo.registerBulkRowHook(hook)\n )\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.beforeFinish) {\n this.dromo.beforeFinish(this.props.beforeFinish)\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 if (this.props.fileParsers) {\n this.props.fileParsers.forEach((parser) => {\n this.dromo.registerFileParser(parser)\n })\n }\n }\n\n open = () => {\n this.init()\n this.dromo.open()\n }\n\n initInline = () => {\n if (!this.inlineRef) return\n\n this.init()\n this.dromo.initInline(this.inlineRef.current)\n }\n\n componentDidMount() {\n if (this.props.inline && this.inlineRef) {\n this.initInline()\n return\n }\n\n if (this.props.open) this.open()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (this.props.inline) {\n this.initInline()\n return\n }\n\n if (!prevProps.open && this.props.open) {\n this.open()\n }\n\n if (prevProps.open && !this.props.open) {\n this.dromo.close()\n }\n }\n\n componentWillUnmount() {\n if (this.props.open && !this.props.inline) {\n this.dromo.close()\n }\n }\n\n render() {\n if (this.props.inline) {\n return (\n <div\n ref={this.inlineRef}\n className={this.props.className}\n style={this.props.style}\n />\n )\n }\n\n if (this.props.children === undefined) return <React.Fragment />\n\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback\n}\n"],"names":["DromoReactUploader","_React$Component","props","_this","call","dromo","DromoUploader","licenseKey","fields","settings","user","idOrName","schemaId","schemaName","setDevelopmentMode","developmentMode","setUser","setHeaderRowOverride","headerRowOverride","rowHooks","forEach","hook","registerRowHook","bulkRowHooks","registerBulkRowHook","columnHooks","registerColumnHook","fieldName","callback","rowDeleteHooks","registerRowDeleteHook","beforeFinish","onResults","onCancel","stepHooks","registerStepHook","type","fileParsers","parser","registerFileParser","init","open","inlineRef","initInline","current","inline","React","_inheritsLoose","_proto","prototype","componentDidMount","componentDidUpdate","prevProps","close","componentWillUnmount","render","ref","className","style","children","undefined","onClick"],"mappings":";;;;;;;;;;;;IAqDqBA,kBAAmB,0BAAAC,gBAAA;EAItC,SAAAD,mBAAYE,KAAY;;IACtBC,KAAA,GAAAF,gBAAA,CAAAG,IAAA,OAAMF,KAAK,CAAC;IAHdC,KAAA,UAAS,GAA2C,IAAI;IAUxDA,KAAA,KAAI,GAAG;MACL,IAAI,QAAQ,IAAIA,KAAA,CAAKD,KAAK,IAAI,UAAU,IAAIC,KAAA,CAAKD,KAAK,EAAE;QACtDC,KAAA,CAAKE,KAAK,GAAG,IAAIC,aAAa,CAC5BH,KAAA,CAAKD,KAAK,CAACK,UAAU,EACrBJ,KAAA,CAAKD,KAAK,CAACM,MAAM,EACjBL,KAAA,CAAKD,KAAK,CAACO,QAAQ,EACnBN,KAAA,CAAKD,KAAK,CAACQ,IAAI,CAChB;OACF,MAAM,IAAI,UAAU,IAAIP,KAAA,CAAKD,KAAK,IAAI,YAAY,IAAIC,KAAA,CAAKD,KAAK,EAAE;QACjE,IAAMS,QAAQ,GACZ,UAAU,IAAIR,KAAA,CAAKD,KAAK,GAAGC,KAAA,CAAKD,KAAK,CAACU,QAAQ,GAAGT,KAAA,CAAKD,KAAK,CAACW,UAAU;QAExEV,KAAA,CAAKE,KAAK,GAAG,IAAIC,aAAa,CAACH,KAAA,CAAKD,KAAK,CAACK,UAAU,EAAEI,QAAQ,CAAC;QAE/D,IAAI,iBAAiB,IAAIR,KAAA,CAAKD,KAAK,EAAE;UACnCC,KAAA,CAAKE,KAAK,CAACS,kBAAkB,CAACX,KAAA,CAAKD,KAAK,CAACa,eAAe,CAAC;;QAE3D,IAAI,MAAM,IAAIZ,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;IAEhE,OACEA;MACEY,KAAK,EAAE,IAAI,CAACxD,KAAK,CAACwD,KAAK;MACvBD,SAAS,EAAE,IAAI,CAACvD,KAAK,CAACuD,SAAS;MAC/BI,OAAO,EAAE,IAAI,CAACpB;OAEb,IAAI,CAACvC,KAAK,CAACyD,QAAQ,CACb;GAEZ;EAAA,OAAA3D,kBAAA;AAAA,EApJ6C8C,SAAsB;;;;"}
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport DromoUploader, {\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback,\n CustomStepInsertAfter,\n ICustomStepConfig,\n ICustomStepConnectionMethods\n} from 'dromo-uploader-js'\n\ntype VerboseRequiredProps = {\n user: IUser\n fields: IDeveloperField[]\n licenseKey: string\n settings: IDeveloperSettings\n}\n\ntype SavedSchemaProps = {\n licenseKey: string\n} & ({ schemaName: string } | { schemaId: string }) &\n IImporterOptions\n\ntype CommonProps = {\n style?: React.CSSProperties\n className?: string\n rowHooks?: IRowHook[]\n bulkRowHooks?: IBulkRowHook[]\n rowDeleteHooks?: IRowDeleteHook[]\n columnHooks?: IColumnHook[]\n stepHooks?: IStepHook[]\n customSteps?: ICustomStepConfig[]\n fileParsers?: { extensions: string[]; parseFile: IParseFileCallback }[]\n beforeFinish?: IBeforeFinishCallback\n onResults?: (data: any, metadata: IResultMetadata) => void\n onCancel?: () => void\n children?: React.ReactNode\n open?: boolean\n inline?: boolean\n}\n\ntype Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n inlineRef: React.RefObject<HTMLDivElement> | null = null\n\n constructor(props: Props) {\n super(props)\n\n if (props.inline) {\n this.inlineRef = React.createRef()\n }\n }\n\n init = () => {\n if ('fields' in this.props && 'settings' in this.props) {\n this.dromo = new DromoUploader(\n this.props.licenseKey,\n this.props.fields,\n this.props.settings,\n this.props.user\n )\n } else if ('schemaId' in this.props || 'schemaName' in this.props) {\n const idOrName =\n 'schemaId' in this.props ? this.props.schemaId : this.props.schemaName\n\n this.dromo = new DromoUploader(this.props.licenseKey, idOrName)\n\n if ('developmentMode' in this.props) {\n this.dromo.setDevelopmentMode(this.props.developmentMode)\n }\n if ('user' in this.props) {\n this.dromo.setUser(this.props.user)\n }\n if ('headerRowOverride' in this.props) {\n this.dromo.setHeaderRowOverride(this.props.headerRowOverride)\n }\n }\n\n if (this.props.rowHooks) {\n this.props.rowHooks.forEach((hook) => this.dromo.registerRowHook(hook))\n }\n\n if (this.props.bulkRowHooks) {\n this.props.bulkRowHooks.forEach((hook) =>\n this.dromo.registerBulkRowHook(hook)\n )\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.beforeFinish) {\n this.dromo.beforeFinish(this.props.beforeFinish)\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 if (this.props.customSteps) {\n this.props.customSteps.forEach((step) => {\n this.dromo.registerCustomStep(step)\n })\n }\n\n if (this.props.fileParsers) {\n this.props.fileParsers.forEach((parser) => {\n this.dromo.registerFileParser(parser)\n })\n }\n }\n\n open = () => {\n this.init()\n this.dromo.open()\n }\n\n initInline = () => {\n if (!this.inlineRef) return\n\n this.init()\n this.dromo.initInline(this.inlineRef.current)\n }\n\n componentDidMount() {\n if (this.props.inline && this.inlineRef) {\n this.initInline()\n return\n }\n\n if (this.props.open) this.open()\n }\n\n componentDidUpdate(prevProps: Props) {\n if (this.props.inline) {\n this.initInline()\n return\n }\n\n if (!prevProps.open && this.props.open) {\n this.open()\n }\n\n if (prevProps.open && !this.props.open) {\n this.dromo.close()\n }\n }\n\n componentWillUnmount() {\n if (this.props.open && !this.props.inline) {\n this.dromo.close()\n }\n }\n\n render() {\n if (this.props.inline) {\n return (\n <div\n ref={this.inlineRef}\n className={this.props.className}\n style={this.props.style}\n />\n )\n }\n\n if (this.props.children === undefined) return <React.Fragment />\n\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 IStepHook,\n IRowDeleteHook,\n IBeforeFinishCallback,\n IBulkRowHook,\n IImporterOptions,\n IParseFileCallback,\n ICustomStepConfig,\n CustomStepInsertAfter,\n ICustomStepConnectionMethods\n}\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,OAAOC,GACL,oBAAAC,EACA,qBAAAC,EACA,eAAAC,EACA,mBAAAC,EACA,mBAAAC,EACA,sBAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,4BAAAC,EACA,SAAAC,EACA,mBAAAC,EACA,aAAAC,EACA,kBAAAC,EACA,yBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,yBAAAC,EACA,qBAAAC,EACA,gCAAAC,MACK,oBAkCP,IAAqBC,EAArB,cAAsD,WAAiB,CACrE,MACA,UAAoD,KAEpD,YAAYC,EAAc,CACxB,MAAMA,CAAK,EAEPA,EAAM,SAC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AAK,QAAQ,CACtD,CAAC,EAGC,KAAK,MAAM,aACb,KAAK,MAAM,YAAY,QAASC,GAAS,CACvC,KAAK,MAAM,mBAAmBA,CAAI,CACpC,CAAC,EAGC,KAAK,MAAM,aACb,KAAK,MAAM,YAAY,QAASC,GAAW,CACzC,KAAK,MAAM,mBAAmBA,CAAM,CACtC,CAAC,CAEL,EAEA,KAAO,IAAM,CACX,KAAK,KAAK,EACV,KAAK,MAAM,KAAK,CAClB,EAEA,WAAa,IAAM,CACZ,KAAK,YAEV,KAAK,KAAK,EACV,KAAK,MAAM,WAAW,KAAK,UAAU,OAAO,EAC9C,EAEA,mBAAoB,CAClB,GAAI,KAAK,MAAM,QAAU,KAAK,UAAW,CACvC,KAAK,WAAW,EAChB,MACF,CAEI,KAAK,MAAM,MAAM,KAAK,KAAK,CACjC,CAEA,mBAAmBC,EAAkB,CACnC,GAAI,KAAK,MAAM,OAAQ,CACrB,KAAK,WAAW,EAChB,MACF,CAEI,CAACA,EAAU,MAAQ,KAAK,MAAM,MAChC,KAAK,KAAK,EAGRA,EAAU,MAAQ,CAAC,KAAK,MAAM,MAChC,KAAK,MAAM,MAAM,CAErB,CAEA,sBAAuB,CACjB,KAAK,MAAM,MAAQ,CAAC,KAAK,MAAM,QACjC,KAAK,MAAM,MAAM,CAErB,CAEA,QAAS,CACP,OAAI,KAAK,MAAM,OAEX,gBAAC,OACC,IAAK,KAAK,UACV,UAAW,KAAK,MAAM,UACtB,MAAO,KAAK,MAAM,MACpB,EAIA,KAAK,MAAM,WAAa,OAAkB,gBAAO,WAAN,IAAe,EAG5D,gBAAC,UACC,MAAO,KAAK,MAAM,MAClB,UAAW,KAAK,MAAM,UACtB,QAAS,KAAK,MAEb,KAAK,MAAM,QACd,CAEJ,CACF","names":["React","DromoUploader","IColumnHookInput","IColumnHookOutput","IColumnHook","IDeveloperField","IValidatorField","IDeveloperSettings","IRowHookInput","IRowHookOutput","IRowHook","IDeveloperStyleOverrides","IUser","IResultMetadata","IStepHook","IRowDeleteHook","IBeforeFinishCallback","IBulkRowHook","IImporterOptions","IParseFileCallback","CustomStepInsertAfter","ICustomStepConfig","ICustomStepConnectionMethods","DromoReactUploader","props","idOrName","hook","step","parser","prevProps"]}
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dromo-uploader-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Easy to use data (CSV, TSV, Excel) importer",
|
|
5
5
|
"author": "ankitgoyal100",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "dromo",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.modern.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
10
11
|
"source": "src/index.tsx",
|
|
11
12
|
"engines": {
|
|
12
13
|
"node": ">=10"
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
15
|
-
"build": "
|
|
16
|
-
"start": "
|
|
16
|
+
"build": "tsup",
|
|
17
|
+
"start": "tsup --watch",
|
|
17
18
|
"prepare": "run-s build",
|
|
18
19
|
"test": "run-s test:unit test:lint test:build",
|
|
19
20
|
"test:build": "run-s build",
|
|
@@ -50,25 +51,25 @@
|
|
|
50
51
|
"eslint-plugin-react": "^7.37.5",
|
|
51
52
|
"eslint-plugin-standard": "^4.0.1",
|
|
52
53
|
"gh-pages": "^5.0.0",
|
|
53
|
-
"microbundle-crl": "^0.13.10",
|
|
54
54
|
"npm-run-all": "^4.1.5",
|
|
55
55
|
"prettier": "^2.0.4",
|
|
56
56
|
"react": "^18.2.0",
|
|
57
57
|
"react-dom": "^18.2.0",
|
|
58
58
|
"react-scripts": "^5.0.1",
|
|
59
|
+
"tsup": "^8.5.1",
|
|
59
60
|
"typescript": "^4.9.5"
|
|
60
61
|
},
|
|
61
62
|
"overrides": {
|
|
62
63
|
"ansi-html": "^0.0.8",
|
|
63
64
|
"ansi-regex": "^5.0.1",
|
|
64
|
-
"async": "
|
|
65
|
+
"async": "2.6.4",
|
|
65
66
|
"body-parser": "^1.20.3",
|
|
66
67
|
"braces": "^3.0.3",
|
|
67
68
|
"browserify-sign": "^4.2.2",
|
|
68
69
|
"cross-spawn": "^7.0.5",
|
|
69
70
|
"decode-uri-component": "^0.2.1",
|
|
70
|
-
"dns-packet": "^1.3.2",
|
|
71
71
|
"follow-redirects": "^1.14.7",
|
|
72
|
+
"flatted": "^3.4.2",
|
|
72
73
|
"glob-parent": "^5.1.2",
|
|
73
74
|
"is-svg": "^4.3.0",
|
|
74
75
|
"json5": "^2.2.2",
|
|
@@ -78,24 +79,26 @@
|
|
|
78
79
|
"minimist": "^1.2.8",
|
|
79
80
|
"node-forge": "^1.3.2",
|
|
80
81
|
"nth-check": "^2.0.1",
|
|
81
|
-
"path-to-regexp": "^0.1.
|
|
82
|
+
"path-to-regexp": "^0.1.13",
|
|
82
83
|
"qs": "^6.14.1",
|
|
83
84
|
"semver@^6.0.0": "^6.3.1",
|
|
84
85
|
"semver@^7.0.0": "^7.5.2",
|
|
85
86
|
"ssri@^6.0.0": "^6.0.2",
|
|
86
87
|
"ssri@^7.0.0": "^7.1.1",
|
|
88
|
+
"serialize-javascript": "^7.0.5",
|
|
87
89
|
"terser": "^4.8.1",
|
|
88
90
|
"tmpl": "^1.0.5",
|
|
89
91
|
"ws@^5.0.0": "^5.2.4",
|
|
90
92
|
"ws@^6.0.0": "^6.2.3",
|
|
91
93
|
"@babel/traverse": "^7.23.2",
|
|
92
94
|
"form-data": "^2.5.4",
|
|
93
|
-
"shell-quote": "^1.7.3"
|
|
95
|
+
"shell-quote": "^1.7.3",
|
|
96
|
+
"underscore": "^1.13.8"
|
|
94
97
|
},
|
|
95
98
|
"files": [
|
|
96
99
|
"dist"
|
|
97
100
|
],
|
|
98
101
|
"dependencies": {
|
|
99
|
-
"dromo-uploader-js": "^2.
|
|
102
|
+
"dromo-uploader-js": "^2.9.0"
|
|
100
103
|
}
|
|
101
104
|
}
|
package/dist/index.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|