@usecsv/react 0.2.9 → 0.2.11

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/build/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @usecsv/react v0.2.9
2
+ * @usecsv/react v0.2.11
3
3
  * (c) layercode
4
4
  * Released under the MIT License.
5
5
  */
@@ -32,7 +32,7 @@ function __rest(s, e) {
32
32
  }
33
33
 
34
34
  /*!
35
- * @usecsv/js v0.6.1
35
+ * @usecsv/js v0.8.0
36
36
  * (c) layercode
37
37
  * Released under the MIT License.
38
38
  */
@@ -614,20 +614,28 @@ whenDomReady.resume = function (doc) {
614
614
 
615
615
  // eslint-disable-next-line dot-notation
616
616
  var MOUNT_URL = {"MOUNT_URL":"https://app.usecsv.com/importer"}["MOUNT_URL"] ;
617
- var insertIframe = function (id) {
618
- var _a;
619
- 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");
620
- document.body.insertAdjacentHTML("beforeend", "<div id=".concat(id, " class=\"usecsv_container loading\">\n</div>"));
617
+ var insertIframe = function (id, importerDisplay) {
618
+ var usecsvInlineWrapper = document.getElementById("usecsv-importer-inline-wrapper");
619
+ var usecsvContainerStyles = importerDisplay === "modal" || !usecsvInlineWrapper
620
+ ? ".usecsv_container { position: fixed; top: 0px; bottom: 0; right: 0; left: 0; z-index: 100000; }"
621
+ : "";
622
+ insertCss_2("\n ".concat(usecsvContainerStyles, "\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"));
623
+ document.body.insertAdjacentHTML("beforeend", "<div id=".concat(id, " class=\"usecsv_container loading\"></div>"));
621
624
  var iframe = document.createElement("iframe");
622
625
  iframe.setAttribute("src", MOUNT_URL);
623
- (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.appendChild(iframe);
626
+ var usecsvContainer = document.getElementById(id);
627
+ usecsvContainer === null || usecsvContainer === void 0 ? void 0 : usecsvContainer.appendChild(iframe);
628
+ if (importerDisplay === "inline" && usecsvInlineWrapper) {
629
+ // usecsvInlineWrapper > usecsvContainer > iframe
630
+ usecsvInlineWrapper === null || usecsvInlineWrapper === void 0 ? void 0 : usecsvInlineWrapper.appendChild(usecsvContainer);
631
+ }
624
632
  return iframe;
625
633
  };
626
634
  var useCsvPlugin = function (_a) {
627
- var importerKey = _a.importerKey, user = _a.user, metadata = _a.metadata, onData = _a.onData, onRecordsInitial = _a.onRecordsInitial, onRecordEdit = _a.onRecordEdit;
635
+ var importerKey = _a.importerKey, user = _a.user, metadata = _a.metadata, onData = _a.onData, onRecordsInitial = _a.onRecordsInitial, onRecordEdit = _a.onRecordEdit, _b = _a.importerDisplay, importerDisplay = _b === void 0 ? "modal" : _b;
628
636
  var id = "usecsv-".concat(Math.round(Math.random() * 100000000));
629
637
  return whenDomReady().then(function () {
630
- var iframe = insertIframe(id);
638
+ var iframe = insertIframe(id, importerDisplay);
631
639
  var closeIframe = function () {
632
640
  var _a;
633
641
  (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.remove();