@usecsv/react 0.0.1 → 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # [0.2.0](https://github.com/layercodedev/usecsv-react-plugin/compare/v0.1.0...v0.2.0) (2022-03-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * add onData callback ([58bed53](https://github.com/layercodedev/usecsv-react-plugin/commit/58bed53a64ef4843aae5dcea44f6e533ab756676))
7
+
8
+ # [0.1.0](https://github.com/layercodedev/usecsv-react-plugin/compare/v0.0.2...v0.1.0) (2021-12-30)
9
+
10
+
11
+ ### Features
12
+
13
+ * allow null user object ([#12](https://github.com/layercodedev/usecsv-react-plugin/issues/12)) ([979fe1e](https://github.com/layercodedev/usecsv-react-plugin/commit/979fe1e08c45b9f7083632c0c8f52a5110e2ec11))
14
+
15
+ # 0.0.2 (2021-12-08)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * upgrade core usecsv lib ([#9](https://github.com/layercodedev/usecsv-react-plugin/issues/9)) ([1492b93](https://github.com/layercodedev/usecsv-react-plugin/commit/1492b93f31656aa4d454eeb7c56a3f03447f9fd0))
package/build/index.cjs CHANGED
@@ -1,17 +1,70 @@
1
1
  /*!
2
- * @usecsv/react v0.0.1
2
+ * @usecsv/react v0.2.0
3
3
  * (c) layercode
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
7
  'use strict';
8
8
 
9
+ /*! *****************************************************************************
10
+ Copyright (c) Microsoft Corporation.
11
+
12
+ Permission to use, copy, modify, and/or distribute this software for any
13
+ purpose with or without fee is hereby granted.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
+ PERFORMANCE OF THIS SOFTWARE.
22
+ ***************************************************************************** */
23
+
24
+ function __rest(s, e) {
25
+ var t = {};
26
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
27
+ t[p] = s[p];
28
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
29
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
30
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
31
+ t[p[i]] = s[p[i]];
32
+ }
33
+ return t;
34
+ }
35
+
9
36
  /*!
10
- * @usecsv/js v0.0.11
37
+ * @usecsv/js v0.2.0
11
38
  * (c) layercode
12
39
  * Released under the MIT License.
13
40
  */
14
41
 
42
+ /*! *****************************************************************************
43
+ Copyright (c) Microsoft Corporation.
44
+
45
+ Permission to use, copy, modify, and/or distribute this software for any
46
+ purpose with or without fee is hereby granted.
47
+
48
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
49
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
50
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
51
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
52
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
53
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
54
+ PERFORMANCE OF THIS SOFTWARE.
55
+ ***************************************************************************** */
56
+
57
+ var __assign = function() {
58
+ __assign = Object.assign || function __assign(t) {
59
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
60
+ s = arguments[i];
61
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
62
+ }
63
+ return t;
64
+ };
65
+ return __assign.apply(this, arguments);
66
+ };
67
+
15
68
  var containers = []; // will store container HTMLElement references
16
69
  var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
17
70
 
@@ -566,19 +619,23 @@ var MOUNT_URL = {"MOUNT_URL":"https://app.usecsv.com/importer"}["MOUNT_URL"] ;
566
619
  var insertIframe = function (id) {
567
620
  var _a;
568
621
  insertCss_2("\n .usecsv_container {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 100000;\n }\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n");
569
- document.body.insertAdjacentHTML("beforeend", "<div id=" + id + " class=\"usecsv_container loading\">\n</div>");
622
+ document.body.insertAdjacentHTML("beforeend", "<div id=".concat(id, " class=\"usecsv_container loading\">\n</div>"));
570
623
  var iframe = document.createElement("iframe");
571
624
  iframe.setAttribute("src", MOUNT_URL);
572
625
  (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.appendChild(iframe);
573
626
  return iframe;
574
627
  };
575
628
  var useCsvPlugin = function (_a) {
576
- var importerKey = _a.importerKey, user = _a.user, metadata = _a.metadata;
577
- var id = "usecsv-" + Math.round(Math.random() * 100000000);
629
+ var importerKey = _a.importerKey, user = _a.user, metadata = _a.metadata, onData = _a.onData;
630
+ var id = "usecsv-".concat(Math.round(Math.random() * 100000000));
578
631
  return whenDomReady().then(function () {
579
632
  var iframe = insertIframe(id);
580
633
  var iframeConnection = connectToChild({
581
634
  iframe: iframe,
635
+ methods: __assign({ closeIframe: function () {
636
+ var _a;
637
+ (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.remove();
638
+ } }, (onData ? { onData: onData } : {})),
582
639
  });
583
640
  iframeConnection.promise.then(function (child) {
584
641
  var _a;
@@ -3089,8 +3146,8 @@ if (process.env.NODE_ENV === 'production') {
3089
3146
  });
3090
3147
 
3091
3148
  var UseCsvButton = function (_a) {
3092
- var children = _a.children, importerKey = _a.importerKey, user = _a.user, metadata = _a.metadata, render = _a.render;
3093
- return (react.createElement(react.Fragment, null, render ? (react.createElement(react.Fragment, null, render(function () { return useCsvPlugin({ importerKey: importerKey, user: user, metadata: metadata }); }))) : (react.createElement("button", { type: "button", id: "usecsv-button", style: {
3149
+ var children = _a.children, render = _a.render, parmas = __rest(_a, ["children", "render"]);
3150
+ return (react.createElement(react.Fragment, null, render ? (react.createElement(react.Fragment, null, render(function () { return useCsvPlugin(parmas); }))) : (react.createElement("button", { type: "button", id: "usecsv-button", style: {
3094
3151
  backgroundColor: "#FFF",
3095
3152
  color: "#000",
3096
3153
  border: "2px solid #000",
@@ -3099,7 +3156,7 @@ var UseCsvButton = function (_a) {
3099
3156
  textAlign: "center",
3100
3157
  fontSize: "16px",
3101
3158
  cursor: "pointer",
3102
- }, onClick: function () { return useCsvPlugin({ importerKey: importerKey, user: user, metadata: metadata }); } }, children))));
3159
+ }, onClick: function () { return useCsvPlugin(parmas); } }, children))));
3103
3160
  };
3104
3161
 
3105
3162
  module.exports = UseCsvButton;