dromo-uploader-react 2.1.7 → 2.1.9

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.ts CHANGED
@@ -30,11 +30,16 @@ declare type CommonProps = {
30
30
  onCancel?: () => void;
31
31
  children?: React.ReactNode;
32
32
  open?: boolean;
33
+ inline?: boolean;
33
34
  };
34
35
  declare type Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps;
35
36
  export default class DromoReactUploader extends React.Component<Props> {
36
37
  dromo: any;
38
+ inlineRef: React.RefObject<HTMLDivElement> | null;
39
+ constructor(props: Props);
40
+ init: () => void;
37
41
  open: () => void;
42
+ initInline: () => void;
38
43
  componentDidMount(): void;
39
44
  componentDidUpdate(prevProps: Props): void;
40
45
  componentWillUnmount(): void;
package/dist/index.js CHANGED
@@ -12,12 +12,13 @@ function _inheritsLoose(subClass, superClass) {
12
12
  var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
13
13
  _inheritsLoose(DromoReactUploader, _React$Component);
14
14
 
15
- function DromoReactUploader() {
15
+ function DromoReactUploader(props) {
16
16
  var _this;
17
17
 
18
- _this = _React$Component.apply(this, arguments) || this;
18
+ _this = _React$Component.call(this, props) || this;
19
+ _this.inlineRef = null;
19
20
 
20
- _this.open = function () {
21
+ _this.init = function () {
21
22
  if ('fields' in _this.props && 'settings' in _this.props) {
22
23
  _this.dromo = new DromoUploader(_this.props.licenseKey, _this.props.fields, _this.props.settings, _this.props.user);
23
24
  } else if ('schemaId' in _this.props || 'schemaName' in _this.props) {
@@ -84,20 +85,46 @@ var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
84
85
  _this.dromo.registerFileParser(parser);
85
86
  });
86
87
  }
88
+ };
89
+
90
+ _this.open = function () {
91
+ _this.init();
87
92
 
88
93
  _this.dromo.open();
89
94
  };
90
95
 
96
+ _this.initInline = function () {
97
+ if (!_this.inlineRef) return;
98
+
99
+ _this.init();
100
+
101
+ _this.dromo.initInline(_this.inlineRef.current);
102
+ };
103
+
104
+ if (props.inline) {
105
+ _this.inlineRef = React.createRef();
106
+ }
107
+
91
108
  return _this;
92
109
  }
93
110
 
94
111
  var _proto = DromoReactUploader.prototype;
95
112
 
96
113
  _proto.componentDidMount = function componentDidMount() {
114
+ if (this.props.inline && this.inlineRef) {
115
+ this.initInline();
116
+ return;
117
+ }
118
+
97
119
  if (this.props.open) this.open();
98
120
  };
99
121
 
100
122
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
123
+ if (this.props.inline) {
124
+ this.initInline();
125
+ return;
126
+ }
127
+
101
128
  if (!prevProps.open && this.props.open) {
102
129
  this.open();
103
130
  }
@@ -108,12 +135,20 @@ var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
108
135
  };
109
136
 
110
137
  _proto.componentWillUnmount = function componentWillUnmount() {
111
- if (this.props.open) {
138
+ if (this.props.open && !this.props.inline) {
112
139
  this.dromo.close();
113
140
  }
114
141
  };
115
142
 
116
143
  _proto.render = function render() {
144
+ if (this.props.inline) {
145
+ return React.createElement("div", {
146
+ ref: this.inlineRef,
147
+ className: this.props.className,
148
+ style: this.props.style
149
+ });
150
+ }
151
+
117
152
  if (this.props.children === undefined) return React.createElement(React.Fragment, null);
118
153
  return React.createElement("button", {
119
154
  style: this.props.style,
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}\n\ntype Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n\n open = () => {\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 this.dromo.open()\n }\n\n componentDidMount() {\n if (this.props.open) this.open()\n }\n\n componentDidUpdate(prevProps: Props) {\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) {\n this.dromo.close()\n }\n }\n\n render() {\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","props","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","open","componentDidMount","componentDidUpdate","prevProps","close","componentWillUnmount","render","children","undefined","React","style","className","onClick"],"mappings":";;;;;;;;;;;IAoDqBA;;;AAArB;;;;;AAGE,cAAA,GAAO;AACL,UA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AAWkC,kBAAX,CAA8BD,MAA9B;AACD,SAFD;AAGD;;AAED,YAAKjC,KAAL,CAAWmC,IAAX;AACD,KAxED;;;AA2GD;;;;SAjCCC,oBAAA;AACE,QAAI,KAAKrC,KAAL,CAAWoC,IAAf,EAAqB,KAAKA,IAAL;AACtB;;SAEDE,qBAAA,4BAAmBC,SAAnB;AACE,QAAI,CAACA,SAAS,CAACH,IAAX,IAAmB,KAAKpC,KAAL,CAAWoC,IAAlC,EAAwC;AACtC,WAAKA,IAAL;AACD;;AAED,QAAIG,SAAS,CAACH,IAAV,IAAkB,CAAC,KAAKpC,KAAL,CAAWoC,IAAlC,EAAwC;AACtC,WAAKnC,KAAL,CAAWuC,KAAX;AACD;AACF;;SAEDC,uBAAA;AACE,QAAI,KAAKzC,KAAL,CAAWoC,IAAf,EAAqB;AACnB,WAAKnC,KAAL,CAAWuC,KAAX;AACD;AACF;;SAEDE,SAAA;AACE,QAAI,KAAK1C,KAAL,CAAW2C,QAAX,KAAwBC,SAA5B,EAAuC,OAAOC,mBAAA,CAACA,cAAD,MAAA,CAAP;AAEvC,WACEA,mBAAA,SAAA;AACEC,MAAAA,KAAK,EAAE,KAAK9C,KAAL,CAAW8C;AAClBC,MAAAA,SAAS,EAAE,KAAK/C,KAAL,CAAW+C;AACtBC,MAAAA,OAAO,EAAE,KAAKZ;KAHhB,EAKG,KAAKpC,KAAL,CAAW2C,QALd,CADF;AASD;;;EA7G6CE;;;;"}
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","props","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","componentDidMount","componentDidUpdate","prevProps","close","componentWillUnmount","render","ref","className","style","children","undefined","onClick"],"mappings":";;;;;;;;;;;IAqDqBA;;;AAInB,8BAAYC,KAAZ;;;AACE,wCAAMA,KAAN;AAHF,mBAAA,GAAoD,IAApD;;AAUA,cAAA,GAAO;AACL,UAAI,YAAY,MAAKA,KAAjB,IAA0B,cAAc,MAAKA,KAAjD,EAAwD;AACtD,cAAKC,KAAL,GAAa,IAAIC,aAAJ,CACX,MAAKF,KAAL,CAAWG,UADA,EAEX,MAAKH,KAAL,CAAWI,MAFA,EAGX,MAAKJ,KAAL,CAAWK,QAHA,EAIX,MAAKL,KAAL,CAAWM,IAJA,CAAb;AAMD,OAPD,MAOO,IAAI,cAAc,MAAKN,KAAnB,IAA4B,gBAAgB,MAAKA,KAArD,EAA4D;AACjE,YAAMO,QAAQ,GACZ,cAAc,MAAKP,KAAnB,GAA2B,MAAKA,KAAL,CAAWQ,QAAtC,GAAiD,MAAKR,KAAL,CAAWS,UAD9D;AAGA,cAAKR,KAAL,GAAa,IAAIC,aAAJ,CAAkB,MAAKF,KAAL,CAAWG,UAA7B,EAAyCI,QAAzC,CAAb;;AAEA,YAAI,qBAAqB,MAAKP,KAA9B,EAAqC;AACnC,gBAAKC,KAAL,CAAWS,kBAAX,CAA8B,MAAKV,KAAL,CAAWW,eAAzC;AACD;;AACD,YAAI,UAAU,MAAKX,KAAnB,EAA0B;AACxB,gBAAKC,KAAL,CAAWW,OAAX,CAAm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AAmB,KAAKrC,KAAL,CAAWqC,IAAlC,EAAwC;AACtC,WAAKA,IAAL;AACD;;AAED,QAAIQ,SAAS,CAACR,IAAV,IAAkB,CAAC,KAAKrC,KAAL,CAAWqC,IAAlC,EAAwC;AACtC,WAAKpC,KAAL,CAAW6C,KAAX;AACD;AACF;;SAEDC,uBAAA;AACE,QAAI,KAAK/C,KAAL,CAAWqC,IAAX,IAAmB,CAAC,KAAKrC,KAAL,CAAWyC,MAAnC,EAA2C;AACzC,WAAKxC,KAAL,CAAW6C,KAAX;AACD;AACF;;SAEDE,SAAA;AACE,QAAI,KAAKhD,KAAL,CAAWyC,MAAf,EAAuB;AACrB,aACEC,mBAAA,MAAA;AACEO,QAAAA,GAAG,EAAE,KAAKX;AACVY,QAAAA,SAAS,EAAE,KAAKlD,KAAL,CAAWkD;AACtBC,QAAAA,KAAK,EAAE,KAAKnD,KAAL,CAAWmD;OAHpB,CADF;AAOD;;AAED,QAAI,KAAKnD,KAAL,CAAWoD,QAAX,KAAwBC,SAA5B,EAAuC,OAAOX,mBAAA,CAACA,cAAD,MAAA,CAAP;AAEvC,WACEA,mBAAA,SAAA;AACES,MAAAA,KAAK,EAAE,KAAKnD,KAAL,CAAWmD;AAClBD,MAAAA,SAAS,EAAE,KAAKlD,KAAL,CAAWkD;AACtBI,MAAAA,OAAO,EAAE,KAAKjB;KAHhB,EAKG,KAAKrC,KAAL,CAAWoD,QALd,CADF;AASD;;;EApJ6CV;;;;"}
@@ -1,4 +1,4 @@
1
- import { createElement, Fragment, Component } from 'react';
1
+ import { createElement, Fragment, createRef, Component } from 'react';
2
2
  import DromoUploader from 'dromo-uploader-js';
3
3
 
4
4
  function _inheritsLoose(subClass, superClass) {
@@ -10,12 +10,13 @@ function _inheritsLoose(subClass, superClass) {
10
10
  var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
11
11
  _inheritsLoose(DromoReactUploader, _React$Component);
12
12
 
13
- function DromoReactUploader() {
13
+ function DromoReactUploader(props) {
14
14
  var _this;
15
15
 
16
- _this = _React$Component.apply(this, arguments) || this;
16
+ _this = _React$Component.call(this, props) || this;
17
+ _this.inlineRef = null;
17
18
 
18
- _this.open = function () {
19
+ _this.init = function () {
19
20
  if ('fields' in _this.props && 'settings' in _this.props) {
20
21
  _this.dromo = new DromoUploader(_this.props.licenseKey, _this.props.fields, _this.props.settings, _this.props.user);
21
22
  } else if ('schemaId' in _this.props || 'schemaName' in _this.props) {
@@ -82,20 +83,46 @@ var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
82
83
  _this.dromo.registerFileParser(parser);
83
84
  });
84
85
  }
86
+ };
87
+
88
+ _this.open = function () {
89
+ _this.init();
85
90
 
86
91
  _this.dromo.open();
87
92
  };
88
93
 
94
+ _this.initInline = function () {
95
+ if (!_this.inlineRef) return;
96
+
97
+ _this.init();
98
+
99
+ _this.dromo.initInline(_this.inlineRef.current);
100
+ };
101
+
102
+ if (props.inline) {
103
+ _this.inlineRef = createRef();
104
+ }
105
+
89
106
  return _this;
90
107
  }
91
108
 
92
109
  var _proto = DromoReactUploader.prototype;
93
110
 
94
111
  _proto.componentDidMount = function componentDidMount() {
112
+ if (this.props.inline && this.inlineRef) {
113
+ this.initInline();
114
+ return;
115
+ }
116
+
95
117
  if (this.props.open) this.open();
96
118
  };
97
119
 
98
120
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
121
+ if (this.props.inline) {
122
+ this.initInline();
123
+ return;
124
+ }
125
+
99
126
  if (!prevProps.open && this.props.open) {
100
127
  this.open();
101
128
  }
@@ -106,12 +133,20 @@ var DromoReactUploader = /*#__PURE__*/function (_React$Component) {
106
133
  };
107
134
 
108
135
  _proto.componentWillUnmount = function componentWillUnmount() {
109
- if (this.props.open) {
136
+ if (this.props.open && !this.props.inline) {
110
137
  this.dromo.close();
111
138
  }
112
139
  };
113
140
 
114
141
  _proto.render = function render() {
142
+ if (this.props.inline) {
143
+ return createElement("div", {
144
+ ref: this.inlineRef,
145
+ className: this.props.className,
146
+ style: this.props.style
147
+ });
148
+ }
149
+
115
150
  if (this.props.children === undefined) return createElement(Fragment, null);
116
151
  return createElement("button", {
117
152
  style: this.props.style,
@@ -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}\n\ntype Props = (VerboseRequiredProps | SavedSchemaProps) & CommonProps\n\nexport default class DromoReactUploader extends React.Component<Props> {\n dromo: any\n\n open = () => {\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 this.dromo.open()\n }\n\n componentDidMount() {\n if (this.props.open) this.open()\n }\n\n componentDidUpdate(prevProps: Props) {\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) {\n this.dromo.close()\n }\n }\n\n render() {\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","props","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","open","componentDidMount","componentDidUpdate","prevProps","close","componentWillUnmount","render","children","undefined","React","style","className","onClick"],"mappings":";;;;;;;;;IAoDqBA;;;AAArB;;;;;AAGE,cAAA,GAAO;AACL,UAAI,YAAY,MAAKC,KAAjB,IAA0B,cAAc,MAAKA,KAAjD,EAAwD;AACtD,cAAKC,KAAL,GAAa,IAAIC,aAAJ,CACX,MAAKF,KAAL,CAAWG,UADA,EAEX,MAAKH,KAAL,CAAWI,MAFA,EAGX,MAAKJ,KAAL,CAAWK,QAHA,EAIX,MAAKL,KAAL,CAAWM,IAJA,CAAb;AAMD,OAPD,MAOO,IAAI,cAAc,MAAKN,KAAnB,IAA4B,gBAAgB,MAAKA,KAArD,EAA4D;AACjE,YAAMO,QAAQ,GACZ,cAAc,MAAKP,KAAnB,GAA2B,MAAKA,KAAL,CAAWQ,QAAtC,GAAiD,MAAKR,KAAL,CAAWS,UAD9D;AAGA,cAAKR,KAAL,GAAa,IAAIC,aAAJ,CAAkB,MAAKF,KAAL,CAAWG,UAA7B,EAAyCI,QAAzC,CAAb;;AAEA,YAAI,qBAAqB,MAAKP,KAA9B,EAAqC;AACnC,gBAAKC,KAAL,CAAWS,kBAAX,CAA8B,MAAKV,KAAL,CAAWW,eAAzC;AACD;;AACD,YAAI,UAAU,MAAKX,KAAnB,EAA0B;AACxB,gBAAKC,KAAL,CAAWW,OAAX,CAAmB,MA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,KAAL,CAAW8C;AAClBC,MAAAA,SAAS,EAAE,KAAK/C,KAAL,CAAW+C;AACtBC,MAAAA,OAAO,EAAE,KAAKZ;KAHhB,EAKG,KAAKpC,KAAL,CAAW2C,QALd,CADF;AASD;;;EA7G6CE;;;;"}
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","props","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","componentDidMount","componentDidUpdate","prevProps","close","componentWillUnmount","render","ref","className","style","children","undefined","onClick"],"mappings":";;;;;;;;;IAqDqBA;;;AAInB,8BAAYC,KAAZ;;;AACE,wCAAMA,KAAN;AAHF,mBAAA,GAAoD,IAApD;;AAUA,cAAA,GAAO;AACL,UAAI,YAAY,MAAKA,KAAjB,IAA0B,cAAc,MAAKA,KAAjD,EAAwD;AACtD,cAAKC,KAAL,GAAa,IAAIC,aAAJ,CACX,MAAKF,KAAL,CAAWG,UADA,EAEX,MAAKH,KAAL,CAAWI,MAFA,EAGX,MAAKJ,KAAL,CAAWK,QAHA,EAIX,MAAKL,KAAL,CAAWM,I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AAKnD,KAAL,CAAWmD;AAClBD,MAAAA,SAAS,EAAE,KAAKlD,KAAL,CAAWkD;AACtBI,MAAAA,OAAO,EAAE,KAAKjB;KAHhB,EAKG,KAAKrC,KAAL,CAAWoD,QALd,CADF;AASD;;;EApJ6CV;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dromo-uploader-react",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Easy to use data (CSV, TSV, Excel) importer",
5
5
  "author": "ankitgoyal100",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "deploy": "gh-pages -d example/build"
25
25
  },
26
26
  "peerDependencies": {
27
- "react": "^16.0.0 || ^17.0.0 || ^18.0.0"
27
+ "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@testing-library/jest-dom": "^4.2.4",
@@ -61,6 +61,6 @@
61
61
  "dist"
62
62
  ],
63
63
  "dependencies": {
64
- "dromo-uploader-js": "^2.1.7"
64
+ "dromo-uploader-js": "^2.1.9"
65
65
  }
66
66
  }