@teselagen/ui 0.3.69 → 0.3.71
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/index.cjs.js +70 -22
- package/index.es.js +71 -23
- package/package.json +1 -1
- package/src/FormComponents/LoadingDots.js +14 -0
- package/src/FormComponents/Uploader.js +53 -19
- package/src/FormComponents/style.css +1 -0
- package/src/FormComponents/tryToMatchSchemas.js +15 -12
- package/src/MatchHeaders.js +6 -0
- package/src/UploadCsvWizard.js +10 -4
- package/src/index.js +1 -0
- package/src/style.css +1 -1
- package/style.css +3 -1
package/index.cjs.js
CHANGED
|
@@ -3062,6 +3062,18 @@ function parentIncludesNoChildDataTip(el, count) {
|
|
|
3062
3062
|
return parentIncludesNoChildDataTip(el.parentElement, count + 1);
|
|
3063
3063
|
}
|
|
3064
3064
|
__name(parentIncludesNoChildDataTip, "parentIncludesNoChildDataTip");
|
|
3065
|
+
const LoadingDots = /* @__PURE__ */ __name(() => {
|
|
3066
|
+
const [dots, setDots] = React$1.useState("");
|
|
3067
|
+
React$1.useEffect(() => {
|
|
3068
|
+
const interval = setInterval(() => {
|
|
3069
|
+
setDots((dots2) => {
|
|
3070
|
+
return dots2.length === 3 ? "" : dots2 + ".";
|
|
3071
|
+
});
|
|
3072
|
+
}, 500);
|
|
3073
|
+
return () => clearInterval(interval);
|
|
3074
|
+
}, []);
|
|
3075
|
+
return /* @__PURE__ */ React$1.createElement("span", null, dots);
|
|
3076
|
+
}, "LoadingDots");
|
|
3065
3077
|
const AssignDefaultsModeContext = React$1.createContext({
|
|
3066
3078
|
inAssignDefaultsMode: false,
|
|
3067
3079
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -58768,6 +58780,7 @@ function MatchHeaders({
|
|
|
58768
58780
|
onMultiFileUploadSubmit,
|
|
58769
58781
|
doAllFilesHaveSameHeaders,
|
|
58770
58782
|
csvValidationIssue,
|
|
58783
|
+
ignoredHeadersMsg,
|
|
58771
58784
|
searchResults,
|
|
58772
58785
|
matchedHeaders,
|
|
58773
58786
|
userSchema,
|
|
@@ -58785,7 +58798,7 @@ function MatchHeaders({
|
|
|
58785
58798
|
if (v2)
|
|
58786
58799
|
flippedMatchedHeaders[v2] = k2;
|
|
58787
58800
|
});
|
|
58788
|
-
return /* @__PURE__ */ React$1.createElement("div", { style: { maxWidth: 500 } }, !onMultiFileUploadSubmit && /* @__PURE__ */ React$1.createElement(core$5.Callout, { style: { width: "fit-content" }, intent: "warning" }, csvValidationIssue), /* @__PURE__ */ React$1.createElement("br", null), /* @__PURE__ */ React$1.createElement(
|
|
58801
|
+
return /* @__PURE__ */ React$1.createElement("div", { style: { maxWidth: 500 } }, !onMultiFileUploadSubmit && /* @__PURE__ */ React$1.createElement(core$5.Callout, { style: { width: "fit-content" }, intent: "warning" }, csvValidationIssue), !onMultiFileUploadSubmit && ignoredHeadersMsg && /* @__PURE__ */ React$1.createElement(core$5.Callout, { style: { width: "fit-content" }, intent: "warning" }, ignoredHeadersMsg), /* @__PURE__ */ React$1.createElement("br", null), /* @__PURE__ */ React$1.createElement(
|
|
58789
58802
|
"tr",
|
|
58790
58803
|
{
|
|
58791
58804
|
style: {
|
|
@@ -60348,7 +60361,7 @@ function tryToMatchSchemas(_0) {
|
|
|
60348
60361
|
}) {
|
|
60349
60362
|
yield resolveValidateAgainstSchema();
|
|
60350
60363
|
const userSchema = getSchema(incomingData);
|
|
60351
|
-
const { searchResults, csvValidationIssue } = yield matchSchemas({
|
|
60364
|
+
const { searchResults, csvValidationIssue, ignoredHeadersMsg } = yield matchSchemas({
|
|
60352
60365
|
userSchema,
|
|
60353
60366
|
officialSchema: validateAgainstSchema
|
|
60354
60367
|
});
|
|
@@ -60384,6 +60397,7 @@ function tryToMatchSchemas(_0) {
|
|
|
60384
60397
|
}
|
|
60385
60398
|
});
|
|
60386
60399
|
return {
|
|
60400
|
+
ignoredHeadersMsg,
|
|
60387
60401
|
csvValidationIssue,
|
|
60388
60402
|
matchedHeaders,
|
|
60389
60403
|
userSchema,
|
|
@@ -60449,7 +60463,9 @@ function matchSchemas(_0) {
|
|
|
60449
60463
|
if (!officialSchema.fields.find(
|
|
60450
60464
|
(h2) => norm(h2.path) === norm(uh.path) || norm(h2.displayName) === norm(uh.path) || matchedAltPaths.includes(uh.path)
|
|
60451
60465
|
)) {
|
|
60452
|
-
|
|
60466
|
+
if (userSchema.userData.some((e2) => e2[uh.path])) {
|
|
60467
|
+
ignoredUserSchemaFields.push(uh);
|
|
60468
|
+
}
|
|
60453
60469
|
}
|
|
60454
60470
|
});
|
|
60455
60471
|
if (officialSchema.coerceUserSchema) {
|
|
@@ -60509,12 +60525,14 @@ function matchSchemas(_0) {
|
|
|
60509
60525
|
};
|
|
60510
60526
|
}
|
|
60511
60527
|
}
|
|
60512
|
-
|
|
60513
|
-
|
|
60528
|
+
let ignoredHeadersMsg;
|
|
60529
|
+
if (ignoredUserSchemaFields.length) {
|
|
60530
|
+
ignoredHeadersMsg = `It looks like the following headers in your file didn't map to any of the accepted headers: ${ignoredUserSchemaFields.map((f2) => f2.displayName || f2.path).join(", ")}`;
|
|
60514
60531
|
}
|
|
60515
60532
|
return {
|
|
60516
60533
|
searchResults: officialSchema.fields,
|
|
60517
|
-
csvValidationIssue
|
|
60534
|
+
csvValidationIssue,
|
|
60535
|
+
ignoredHeadersMsg
|
|
60518
60536
|
};
|
|
60519
60537
|
});
|
|
60520
60538
|
}
|
|
@@ -60584,6 +60602,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60584
60602
|
doAllFilesHaveSameHeaders,
|
|
60585
60603
|
destroyForms,
|
|
60586
60604
|
csvValidationIssue,
|
|
60605
|
+
ignoredHeadersMsg,
|
|
60587
60606
|
searchResults,
|
|
60588
60607
|
matchedHeaders,
|
|
60589
60608
|
userSchema,
|
|
@@ -60695,6 +60714,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60695
60714
|
destroyForms,
|
|
60696
60715
|
setFilesWIssues,
|
|
60697
60716
|
csvValidationIssue,
|
|
60717
|
+
ignoredHeadersMsg,
|
|
60698
60718
|
searchResults,
|
|
60699
60719
|
matchedHeaders,
|
|
60700
60720
|
userSchema,
|
|
@@ -60730,6 +60750,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60730
60750
|
reduxFormEntitiesArray,
|
|
60731
60751
|
// onMultiFileUploadSubmit,
|
|
60732
60752
|
csvValidationIssue,
|
|
60753
|
+
ignoredHeadersMsg,
|
|
60733
60754
|
searchResults,
|
|
60734
60755
|
matchedHeaders,
|
|
60735
60756
|
userSchema,
|
|
@@ -60772,6 +60793,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60772
60793
|
searchResults,
|
|
60773
60794
|
onUploadWizardFinish,
|
|
60774
60795
|
csvValidationIssue,
|
|
60796
|
+
ignoredHeadersMsg,
|
|
60775
60797
|
matchedHeaders,
|
|
60776
60798
|
//fromRedux:
|
|
60777
60799
|
changeForm,
|
|
@@ -60801,6 +60823,7 @@ const UploadCsvWizardDialogInner = compose(
|
|
|
60801
60823
|
searchResults,
|
|
60802
60824
|
onUploadWizardFinish,
|
|
60803
60825
|
csvValidationIssue,
|
|
60826
|
+
ignoredHeadersMsg,
|
|
60804
60827
|
matchedHeaders,
|
|
60805
60828
|
//fromRedux:
|
|
60806
60829
|
handleSubmit,
|
|
@@ -60838,6 +60861,7 @@ const UploadCsvWizardDialogInner = compose(
|
|
|
60838
60861
|
__spreadValues({}, {
|
|
60839
60862
|
onMultiFileUploadSubmit,
|
|
60840
60863
|
csvValidationIssue,
|
|
60864
|
+
ignoredHeadersMsg,
|
|
60841
60865
|
searchResults,
|
|
60842
60866
|
matchedHeaders,
|
|
60843
60867
|
userSchema,
|
|
@@ -70650,7 +70674,7 @@ __name(_ValidateAgainstSchema, "ValidateAgainstSchema");
|
|
|
70650
70674
|
let ValidateAgainstSchema = _ValidateAgainstSchema;
|
|
70651
70675
|
const emptyPromise = Promise.resolve.bind(Promise);
|
|
70652
70676
|
function UploaderInner({
|
|
70653
|
-
accept:
|
|
70677
|
+
accept: __accept,
|
|
70654
70678
|
contentOverride: maybeContentOverride,
|
|
70655
70679
|
innerIcon,
|
|
70656
70680
|
innerText,
|
|
@@ -70680,20 +70704,37 @@ function UploaderInner({
|
|
|
70680
70704
|
dropzoneProps = {},
|
|
70681
70705
|
overflowList,
|
|
70682
70706
|
autoUnzip,
|
|
70683
|
-
|
|
70707
|
+
_disabled,
|
|
70684
70708
|
noBuildCsvOption,
|
|
70685
70709
|
initializeForm,
|
|
70686
70710
|
showFilesCount,
|
|
70687
70711
|
threeDotMenuItems,
|
|
70688
70712
|
onPreviewClick
|
|
70689
70713
|
}) {
|
|
70690
|
-
var _a2, _b, _c, _d
|
|
70714
|
+
var _a2, _b, _c, _d;
|
|
70715
|
+
let dropzoneDisabled = _disabled;
|
|
70716
|
+
let _accept = __accept;
|
|
70691
70717
|
const validateAgainstSchemaStore = React$1.useRef(new ValidateAgainstSchema());
|
|
70692
|
-
const
|
|
70693
|
-
|
|
70694
|
-
|
|
70695
|
-
|
|
70696
|
-
)) == null ? void 0 :
|
|
70718
|
+
const [resolvedAccept, setResolvedAccept] = React$1.useState();
|
|
70719
|
+
if (resolvedAccept) {
|
|
70720
|
+
_accept = resolvedAccept;
|
|
70721
|
+
}
|
|
70722
|
+
const isAcceptPromise = (__accept == null ? void 0 : __accept.then) || (Array.isArray(__accept) ? __accept.some((a2) => a2 == null ? void 0 : a2.then) : false);
|
|
70723
|
+
const acceptLoading = !resolvedAccept && isAcceptPromise && `Accept Loading...`;
|
|
70724
|
+
if (isAcceptPromise && !resolvedAccept) {
|
|
70725
|
+
Promise.allSettled(Array.isArray(__accept) ? __accept : [__accept]).then(
|
|
70726
|
+
(results) => {
|
|
70727
|
+
const resolved = lodashExports.flatMap(results, (r2) => r2.value);
|
|
70728
|
+
setResolvedAccept(resolved);
|
|
70729
|
+
}
|
|
70730
|
+
);
|
|
70731
|
+
_accept = [];
|
|
70732
|
+
}
|
|
70733
|
+
if (acceptLoading)
|
|
70734
|
+
dropzoneDisabled = true;
|
|
70735
|
+
const accept = !_accept ? void 0 : !isAcceptPromise && !resolvedAccept ? [] : lodashExports.isPlainObject(_accept) ? [_accept] : lodashExports.isArray(_accept) ? _accept : _accept.split(",").map((a2) => ({ type: a2 }));
|
|
70736
|
+
const callout = _callout || ((_b = (_a2 = accept.find) == null ? void 0 : _a2.call(accept, (a2) => a2 == null ? void 0 : a2.callout)) == null ? void 0 : _b.callout);
|
|
70737
|
+
const validateAgainstSchemaToUse = _validateAgainstSchema || ((_d = (_c = accept.find) == null ? void 0 : _c.call(accept, (a2) => a2 == null ? void 0 : a2.validateAgainstSchema)) == null ? void 0 : _d.validateAgainstSchema);
|
|
70697
70738
|
React$1.useEffect(() => {
|
|
70698
70739
|
validateAgainstSchemaStore.current.setValidateAgainstSchema(
|
|
70699
70740
|
validateAgainstSchemaToUse
|
|
@@ -70703,7 +70744,6 @@ function UploaderInner({
|
|
|
70703
70744
|
if (validateAgainstSchemaToUse) {
|
|
70704
70745
|
validateAgainstSchema = validateAgainstSchemaStore.current;
|
|
70705
70746
|
}
|
|
70706
|
-
const accept = !_accept ? void 0 : lodashExports.isPlainObject(_accept) ? [_accept] : lodashExports.isArray(_accept) ? _accept : _accept.split(",").map((a2) => ({ type: a2 }));
|
|
70707
70747
|
if ((validateAgainstSchema || autoUnzip) && accept && !accept.some((a2) => a2.type === "zip")) {
|
|
70708
70748
|
accept == null ? void 0 : accept.unshift({
|
|
70709
70749
|
type: "zip",
|
|
@@ -70968,14 +71008,14 @@ function UploaderInner({
|
|
|
70968
71008
|
className: "tg-uploader-inner",
|
|
70969
71009
|
style: { width: "100%", height: "fit-content", minWidth: 0 }
|
|
70970
71010
|
},
|
|
70971
|
-
simpleAccept && /* @__PURE__ */ React$1.createElement(
|
|
71011
|
+
(simpleAccept || acceptLoading) && /* @__PURE__ */ React$1.createElement(
|
|
70972
71012
|
"div",
|
|
70973
71013
|
{
|
|
70974
71014
|
className: core$5.Classes.TEXT_MUTED,
|
|
70975
71015
|
style: { fontSize: 11, marginBottom: 5 }
|
|
70976
71016
|
},
|
|
70977
71017
|
advancedAccept ? /* @__PURE__ */ React$1.createElement("div", { style: {} }, "Accepts ", /* @__PURE__ */ React$1.createElement("span", { style: {} }, advancedAccept.map((a2, i) => {
|
|
70978
|
-
const
|
|
71018
|
+
const disabled = !(a2.description || a2.exampleFile || a2.exampleFiles);
|
|
70979
71019
|
const PopOrTooltip = a2.exampleFiles ? core$5.Popover : core$5.Tooltip;
|
|
70980
71020
|
const hasDownload = a2.exampleFile || a2.exampleFiles;
|
|
70981
71021
|
const CustomTag = !hasDownload ? "span" : "a";
|
|
@@ -70984,7 +71024,7 @@ function UploaderInner({
|
|
|
70984
71024
|
{
|
|
70985
71025
|
key: i,
|
|
70986
71026
|
interactionKind: "hover",
|
|
70987
|
-
disabled
|
|
71027
|
+
disabled,
|
|
70988
71028
|
modifiers: popoverOverflowModifiers,
|
|
70989
71029
|
content: a2.exampleFiles ? /* @__PURE__ */ React$1.createElement(core$5.Menu, null, a2.exampleFiles.map(
|
|
70990
71030
|
({ description, subtext, exampleFile, icon }, i2) => {
|
|
@@ -71062,12 +71102,15 @@ function UploaderInner({
|
|
|
71062
71102
|
)
|
|
71063
71103
|
)
|
|
71064
71104
|
);
|
|
71065
|
-
}))) :
|
|
71105
|
+
}))) : acceptLoading ? (
|
|
71106
|
+
// make the dots below "load"
|
|
71107
|
+
/* @__PURE__ */ React$1.createElement(React$1.Fragment, null, "Accept Loading", /* @__PURE__ */ React$1.createElement(LoadingDots, null))
|
|
71108
|
+
) : /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, "Accepts ", simpleAccept)
|
|
71066
71109
|
),
|
|
71067
71110
|
/* @__PURE__ */ React$1.createElement(
|
|
71068
71111
|
Dropzone$1,
|
|
71069
71112
|
__spreadValues(__spreadValues({
|
|
71070
|
-
disabled,
|
|
71113
|
+
disabled: dropzoneDisabled,
|
|
71071
71114
|
onClick: (evt) => evt.preventDefault(),
|
|
71072
71115
|
multiple: fileLimit !== 1,
|
|
71073
71116
|
accept: simpleAccept ? simpleAccept.split(", ").map((a2) => a2.startsWith(".") ? a2 : "." + a2).join(", ") : void 0
|
|
@@ -71168,7 +71211,8 @@ function UploaderInner({
|
|
|
71168
71211
|
csvValidationIssue: _csvValidationIssue,
|
|
71169
71212
|
matchedHeaders,
|
|
71170
71213
|
userSchema,
|
|
71171
|
-
searchResults
|
|
71214
|
+
searchResults,
|
|
71215
|
+
ignoredHeadersMsg
|
|
71172
71216
|
} = yield tryToMatchSchemas({
|
|
71173
71217
|
incomingData: parsedF.data,
|
|
71174
71218
|
validateAgainstSchema
|
|
@@ -71211,6 +71255,7 @@ function UploaderInner({
|
|
|
71211
71255
|
filesWIssues.push({
|
|
71212
71256
|
file,
|
|
71213
71257
|
csvValidationIssue,
|
|
71258
|
+
ignoredHeadersMsg,
|
|
71214
71259
|
matchedHeaders,
|
|
71215
71260
|
userSchema,
|
|
71216
71261
|
searchResults
|
|
@@ -71219,6 +71264,7 @@ function UploaderInner({
|
|
|
71219
71264
|
filesWOIssues.push({
|
|
71220
71265
|
file,
|
|
71221
71266
|
csvValidationIssue,
|
|
71267
|
+
ignoredHeadersMsg,
|
|
71222
71268
|
matchedHeaders,
|
|
71223
71269
|
userSchema,
|
|
71224
71270
|
searchResults
|
|
@@ -71318,7 +71364,8 @@ function UploaderInner({
|
|
|
71318
71364
|
"tg-dropzone-reject": isDragReject,
|
|
71319
71365
|
// tnr: the acceptClassName/rejectClassName doesn't work with file extensions (only mimetypes are supported when dragging). Thus we'll just always turn the drop area blue when dragging and let the filtering occur on drop. See https://github.com/react-dropzone/react-dropzone/issues/888#issuecomment-773938074
|
|
71320
71366
|
"tg-dropzone-accept": isDragAccept,
|
|
71321
|
-
"tg-dropzone-disabled":
|
|
71367
|
+
"tg-dropzone-disabled": dropzoneDisabled,
|
|
71368
|
+
"bp3-disabled": dropzoneDisabled
|
|
71322
71369
|
})
|
|
71323
71370
|
}),
|
|
71324
71371
|
/* @__PURE__ */ React$1.createElement("input", __spreadValues({}, getInputProps())),
|
|
@@ -77699,6 +77746,7 @@ exports.InfoHelper = InfoHelper;
|
|
|
77699
77746
|
exports.InputField = InputField;
|
|
77700
77747
|
exports.IntentText = IntentText;
|
|
77701
77748
|
exports.Loading = Loading;
|
|
77749
|
+
exports.LoadingDots = LoadingDots;
|
|
77702
77750
|
exports.MenuBar = MenuBar;
|
|
77703
77751
|
exports.MenuItemWithTooltip = MenuItemWithTooltip;
|
|
77704
77752
|
exports.NumericInputField = NumericInputField;
|
package/index.es.js
CHANGED
|
@@ -57,7 +57,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
import * as React$1 from "react";
|
|
60
|
-
import React__default, { forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer,
|
|
60
|
+
import React__default, { useState, useEffect, forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useCallback, memo, Component, PureComponent, createElement, isValidElement, useContext } from "react";
|
|
61
61
|
import { Icon, Classes, Button, Intent, Keys, MenuItem, Tag, useHotkeys, Popover, Tooltip, Toaster, Position, Menu, MenuDivider, NumericInput, InputGroup, Spinner, FormGroup, TextArea, Checkbox, Switch, EditableText, RadioGroup, Callout, ContextMenu, Dialog, Card, Tabs, Tab, Colors, Overlay, KeyCombo, ProgressBar } from "@blueprintjs/core";
|
|
62
62
|
import ReactDOM, { unstable_batchedUpdates, findDOMNode as findDOMNode$1 } from "react-dom";
|
|
63
63
|
import { FormName, formValueSelector, change, Field, reduxForm, SubmissionError, destroy, initialize, Fields } from "redux-form";
|
|
@@ -3044,6 +3044,18 @@ function parentIncludesNoChildDataTip(el, count) {
|
|
|
3044
3044
|
return parentIncludesNoChildDataTip(el.parentElement, count + 1);
|
|
3045
3045
|
}
|
|
3046
3046
|
__name(parentIncludesNoChildDataTip, "parentIncludesNoChildDataTip");
|
|
3047
|
+
const LoadingDots = /* @__PURE__ */ __name(() => {
|
|
3048
|
+
const [dots, setDots] = useState("");
|
|
3049
|
+
useEffect(() => {
|
|
3050
|
+
const interval = setInterval(() => {
|
|
3051
|
+
setDots((dots2) => {
|
|
3052
|
+
return dots2.length === 3 ? "" : dots2 + ".";
|
|
3053
|
+
});
|
|
3054
|
+
}, 500);
|
|
3055
|
+
return () => clearInterval(interval);
|
|
3056
|
+
}, []);
|
|
3057
|
+
return /* @__PURE__ */ React__default.createElement("span", null, dots);
|
|
3058
|
+
}, "LoadingDots");
|
|
3047
3059
|
const AssignDefaultsModeContext = React__default.createContext({
|
|
3048
3060
|
inAssignDefaultsMode: false,
|
|
3049
3061
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -58750,6 +58762,7 @@ function MatchHeaders({
|
|
|
58750
58762
|
onMultiFileUploadSubmit,
|
|
58751
58763
|
doAllFilesHaveSameHeaders,
|
|
58752
58764
|
csvValidationIssue,
|
|
58765
|
+
ignoredHeadersMsg,
|
|
58753
58766
|
searchResults,
|
|
58754
58767
|
matchedHeaders,
|
|
58755
58768
|
userSchema,
|
|
@@ -58767,7 +58780,7 @@ function MatchHeaders({
|
|
|
58767
58780
|
if (v2)
|
|
58768
58781
|
flippedMatchedHeaders[v2] = k2;
|
|
58769
58782
|
});
|
|
58770
|
-
return /* @__PURE__ */ React__default.createElement("div", { style: { maxWidth: 500 } }, !onMultiFileUploadSubmit && /* @__PURE__ */ React__default.createElement(Callout, { style: { width: "fit-content" }, intent: "warning" }, csvValidationIssue), /* @__PURE__ */ React__default.createElement("br", null), /* @__PURE__ */ React__default.createElement(
|
|
58783
|
+
return /* @__PURE__ */ React__default.createElement("div", { style: { maxWidth: 500 } }, !onMultiFileUploadSubmit && /* @__PURE__ */ React__default.createElement(Callout, { style: { width: "fit-content" }, intent: "warning" }, csvValidationIssue), !onMultiFileUploadSubmit && ignoredHeadersMsg && /* @__PURE__ */ React__default.createElement(Callout, { style: { width: "fit-content" }, intent: "warning" }, ignoredHeadersMsg), /* @__PURE__ */ React__default.createElement("br", null), /* @__PURE__ */ React__default.createElement(
|
|
58771
58784
|
"tr",
|
|
58772
58785
|
{
|
|
58773
58786
|
style: {
|
|
@@ -60330,7 +60343,7 @@ function tryToMatchSchemas(_0) {
|
|
|
60330
60343
|
}) {
|
|
60331
60344
|
yield resolveValidateAgainstSchema();
|
|
60332
60345
|
const userSchema = getSchema(incomingData);
|
|
60333
|
-
const { searchResults, csvValidationIssue } = yield matchSchemas({
|
|
60346
|
+
const { searchResults, csvValidationIssue, ignoredHeadersMsg } = yield matchSchemas({
|
|
60334
60347
|
userSchema,
|
|
60335
60348
|
officialSchema: validateAgainstSchema
|
|
60336
60349
|
});
|
|
@@ -60366,6 +60379,7 @@ function tryToMatchSchemas(_0) {
|
|
|
60366
60379
|
}
|
|
60367
60380
|
});
|
|
60368
60381
|
return {
|
|
60382
|
+
ignoredHeadersMsg,
|
|
60369
60383
|
csvValidationIssue,
|
|
60370
60384
|
matchedHeaders,
|
|
60371
60385
|
userSchema,
|
|
@@ -60431,7 +60445,9 @@ function matchSchemas(_0) {
|
|
|
60431
60445
|
if (!officialSchema.fields.find(
|
|
60432
60446
|
(h2) => norm(h2.path) === norm(uh.path) || norm(h2.displayName) === norm(uh.path) || matchedAltPaths.includes(uh.path)
|
|
60433
60447
|
)) {
|
|
60434
|
-
|
|
60448
|
+
if (userSchema.userData.some((e2) => e2[uh.path])) {
|
|
60449
|
+
ignoredUserSchemaFields.push(uh);
|
|
60450
|
+
}
|
|
60435
60451
|
}
|
|
60436
60452
|
});
|
|
60437
60453
|
if (officialSchema.coerceUserSchema) {
|
|
@@ -60491,12 +60507,14 @@ function matchSchemas(_0) {
|
|
|
60491
60507
|
};
|
|
60492
60508
|
}
|
|
60493
60509
|
}
|
|
60494
|
-
|
|
60495
|
-
|
|
60510
|
+
let ignoredHeadersMsg;
|
|
60511
|
+
if (ignoredUserSchemaFields.length) {
|
|
60512
|
+
ignoredHeadersMsg = `It looks like the following headers in your file didn't map to any of the accepted headers: ${ignoredUserSchemaFields.map((f2) => f2.displayName || f2.path).join(", ")}`;
|
|
60496
60513
|
}
|
|
60497
60514
|
return {
|
|
60498
60515
|
searchResults: officialSchema.fields,
|
|
60499
|
-
csvValidationIssue
|
|
60516
|
+
csvValidationIssue,
|
|
60517
|
+
ignoredHeadersMsg
|
|
60500
60518
|
};
|
|
60501
60519
|
});
|
|
60502
60520
|
}
|
|
@@ -60566,6 +60584,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60566
60584
|
doAllFilesHaveSameHeaders,
|
|
60567
60585
|
destroyForms,
|
|
60568
60586
|
csvValidationIssue,
|
|
60587
|
+
ignoredHeadersMsg,
|
|
60569
60588
|
searchResults,
|
|
60570
60589
|
matchedHeaders,
|
|
60571
60590
|
userSchema,
|
|
@@ -60677,6 +60696,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60677
60696
|
destroyForms,
|
|
60678
60697
|
setFilesWIssues,
|
|
60679
60698
|
csvValidationIssue,
|
|
60699
|
+
ignoredHeadersMsg,
|
|
60680
60700
|
searchResults,
|
|
60681
60701
|
matchedHeaders,
|
|
60682
60702
|
userSchema,
|
|
@@ -60712,6 +60732,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60712
60732
|
reduxFormEntitiesArray,
|
|
60713
60733
|
// onMultiFileUploadSubmit,
|
|
60714
60734
|
csvValidationIssue,
|
|
60735
|
+
ignoredHeadersMsg,
|
|
60715
60736
|
searchResults,
|
|
60716
60737
|
matchedHeaders,
|
|
60717
60738
|
userSchema,
|
|
@@ -60754,6 +60775,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
60754
60775
|
searchResults,
|
|
60755
60776
|
onUploadWizardFinish,
|
|
60756
60777
|
csvValidationIssue,
|
|
60778
|
+
ignoredHeadersMsg,
|
|
60757
60779
|
matchedHeaders,
|
|
60758
60780
|
//fromRedux:
|
|
60759
60781
|
changeForm,
|
|
@@ -60783,6 +60805,7 @@ const UploadCsvWizardDialogInner = compose(
|
|
|
60783
60805
|
searchResults,
|
|
60784
60806
|
onUploadWizardFinish,
|
|
60785
60807
|
csvValidationIssue,
|
|
60808
|
+
ignoredHeadersMsg,
|
|
60786
60809
|
matchedHeaders,
|
|
60787
60810
|
//fromRedux:
|
|
60788
60811
|
handleSubmit,
|
|
@@ -60820,6 +60843,7 @@ const UploadCsvWizardDialogInner = compose(
|
|
|
60820
60843
|
__spreadValues({}, {
|
|
60821
60844
|
onMultiFileUploadSubmit,
|
|
60822
60845
|
csvValidationIssue,
|
|
60846
|
+
ignoredHeadersMsg,
|
|
60823
60847
|
searchResults,
|
|
60824
60848
|
matchedHeaders,
|
|
60825
60849
|
userSchema,
|
|
@@ -70632,7 +70656,7 @@ __name(_ValidateAgainstSchema, "ValidateAgainstSchema");
|
|
|
70632
70656
|
let ValidateAgainstSchema = _ValidateAgainstSchema;
|
|
70633
70657
|
const emptyPromise = Promise.resolve.bind(Promise);
|
|
70634
70658
|
function UploaderInner({
|
|
70635
|
-
accept:
|
|
70659
|
+
accept: __accept,
|
|
70636
70660
|
contentOverride: maybeContentOverride,
|
|
70637
70661
|
innerIcon,
|
|
70638
70662
|
innerText,
|
|
@@ -70662,20 +70686,37 @@ function UploaderInner({
|
|
|
70662
70686
|
dropzoneProps = {},
|
|
70663
70687
|
overflowList,
|
|
70664
70688
|
autoUnzip,
|
|
70665
|
-
|
|
70689
|
+
_disabled,
|
|
70666
70690
|
noBuildCsvOption,
|
|
70667
70691
|
initializeForm,
|
|
70668
70692
|
showFilesCount,
|
|
70669
70693
|
threeDotMenuItems,
|
|
70670
70694
|
onPreviewClick
|
|
70671
70695
|
}) {
|
|
70672
|
-
var _a2, _b, _c, _d
|
|
70696
|
+
var _a2, _b, _c, _d;
|
|
70697
|
+
let dropzoneDisabled = _disabled;
|
|
70698
|
+
let _accept = __accept;
|
|
70673
70699
|
const validateAgainstSchemaStore = useRef(new ValidateAgainstSchema());
|
|
70674
|
-
const
|
|
70675
|
-
|
|
70676
|
-
|
|
70677
|
-
|
|
70678
|
-
)) == null ? void 0 :
|
|
70700
|
+
const [resolvedAccept, setResolvedAccept] = useState();
|
|
70701
|
+
if (resolvedAccept) {
|
|
70702
|
+
_accept = resolvedAccept;
|
|
70703
|
+
}
|
|
70704
|
+
const isAcceptPromise = (__accept == null ? void 0 : __accept.then) || (Array.isArray(__accept) ? __accept.some((a2) => a2 == null ? void 0 : a2.then) : false);
|
|
70705
|
+
const acceptLoading = !resolvedAccept && isAcceptPromise && `Accept Loading...`;
|
|
70706
|
+
if (isAcceptPromise && !resolvedAccept) {
|
|
70707
|
+
Promise.allSettled(Array.isArray(__accept) ? __accept : [__accept]).then(
|
|
70708
|
+
(results) => {
|
|
70709
|
+
const resolved = lodashExports.flatMap(results, (r2) => r2.value);
|
|
70710
|
+
setResolvedAccept(resolved);
|
|
70711
|
+
}
|
|
70712
|
+
);
|
|
70713
|
+
_accept = [];
|
|
70714
|
+
}
|
|
70715
|
+
if (acceptLoading)
|
|
70716
|
+
dropzoneDisabled = true;
|
|
70717
|
+
const accept = !_accept ? void 0 : !isAcceptPromise && !resolvedAccept ? [] : lodashExports.isPlainObject(_accept) ? [_accept] : lodashExports.isArray(_accept) ? _accept : _accept.split(",").map((a2) => ({ type: a2 }));
|
|
70718
|
+
const callout = _callout || ((_b = (_a2 = accept.find) == null ? void 0 : _a2.call(accept, (a2) => a2 == null ? void 0 : a2.callout)) == null ? void 0 : _b.callout);
|
|
70719
|
+
const validateAgainstSchemaToUse = _validateAgainstSchema || ((_d = (_c = accept.find) == null ? void 0 : _c.call(accept, (a2) => a2 == null ? void 0 : a2.validateAgainstSchema)) == null ? void 0 : _d.validateAgainstSchema);
|
|
70679
70720
|
useEffect(() => {
|
|
70680
70721
|
validateAgainstSchemaStore.current.setValidateAgainstSchema(
|
|
70681
70722
|
validateAgainstSchemaToUse
|
|
@@ -70685,7 +70726,6 @@ function UploaderInner({
|
|
|
70685
70726
|
if (validateAgainstSchemaToUse) {
|
|
70686
70727
|
validateAgainstSchema = validateAgainstSchemaStore.current;
|
|
70687
70728
|
}
|
|
70688
|
-
const accept = !_accept ? void 0 : lodashExports.isPlainObject(_accept) ? [_accept] : lodashExports.isArray(_accept) ? _accept : _accept.split(",").map((a2) => ({ type: a2 }));
|
|
70689
70729
|
if ((validateAgainstSchema || autoUnzip) && accept && !accept.some((a2) => a2.type === "zip")) {
|
|
70690
70730
|
accept == null ? void 0 : accept.unshift({
|
|
70691
70731
|
type: "zip",
|
|
@@ -70950,14 +70990,14 @@ function UploaderInner({
|
|
|
70950
70990
|
className: "tg-uploader-inner",
|
|
70951
70991
|
style: { width: "100%", height: "fit-content", minWidth: 0 }
|
|
70952
70992
|
},
|
|
70953
|
-
simpleAccept && /* @__PURE__ */ React__default.createElement(
|
|
70993
|
+
(simpleAccept || acceptLoading) && /* @__PURE__ */ React__default.createElement(
|
|
70954
70994
|
"div",
|
|
70955
70995
|
{
|
|
70956
70996
|
className: Classes.TEXT_MUTED,
|
|
70957
70997
|
style: { fontSize: 11, marginBottom: 5 }
|
|
70958
70998
|
},
|
|
70959
70999
|
advancedAccept ? /* @__PURE__ */ React__default.createElement("div", { style: {} }, "Accepts ", /* @__PURE__ */ React__default.createElement("span", { style: {} }, advancedAccept.map((a2, i) => {
|
|
70960
|
-
const
|
|
71000
|
+
const disabled = !(a2.description || a2.exampleFile || a2.exampleFiles);
|
|
70961
71001
|
const PopOrTooltip = a2.exampleFiles ? Popover : Tooltip;
|
|
70962
71002
|
const hasDownload = a2.exampleFile || a2.exampleFiles;
|
|
70963
71003
|
const CustomTag = !hasDownload ? "span" : "a";
|
|
@@ -70966,7 +71006,7 @@ function UploaderInner({
|
|
|
70966
71006
|
{
|
|
70967
71007
|
key: i,
|
|
70968
71008
|
interactionKind: "hover",
|
|
70969
|
-
disabled
|
|
71009
|
+
disabled,
|
|
70970
71010
|
modifiers: popoverOverflowModifiers,
|
|
70971
71011
|
content: a2.exampleFiles ? /* @__PURE__ */ React__default.createElement(Menu, null, a2.exampleFiles.map(
|
|
70972
71012
|
({ description, subtext, exampleFile, icon }, i2) => {
|
|
@@ -71044,12 +71084,15 @@ function UploaderInner({
|
|
|
71044
71084
|
)
|
|
71045
71085
|
)
|
|
71046
71086
|
);
|
|
71047
|
-
}))) :
|
|
71087
|
+
}))) : acceptLoading ? (
|
|
71088
|
+
// make the dots below "load"
|
|
71089
|
+
/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, "Accept Loading", /* @__PURE__ */ React__default.createElement(LoadingDots, null))
|
|
71090
|
+
) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, "Accepts ", simpleAccept)
|
|
71048
71091
|
),
|
|
71049
71092
|
/* @__PURE__ */ React__default.createElement(
|
|
71050
71093
|
Dropzone$1,
|
|
71051
71094
|
__spreadValues(__spreadValues({
|
|
71052
|
-
disabled,
|
|
71095
|
+
disabled: dropzoneDisabled,
|
|
71053
71096
|
onClick: (evt) => evt.preventDefault(),
|
|
71054
71097
|
multiple: fileLimit !== 1,
|
|
71055
71098
|
accept: simpleAccept ? simpleAccept.split(", ").map((a2) => a2.startsWith(".") ? a2 : "." + a2).join(", ") : void 0
|
|
@@ -71150,7 +71193,8 @@ function UploaderInner({
|
|
|
71150
71193
|
csvValidationIssue: _csvValidationIssue,
|
|
71151
71194
|
matchedHeaders,
|
|
71152
71195
|
userSchema,
|
|
71153
|
-
searchResults
|
|
71196
|
+
searchResults,
|
|
71197
|
+
ignoredHeadersMsg
|
|
71154
71198
|
} = yield tryToMatchSchemas({
|
|
71155
71199
|
incomingData: parsedF.data,
|
|
71156
71200
|
validateAgainstSchema
|
|
@@ -71193,6 +71237,7 @@ function UploaderInner({
|
|
|
71193
71237
|
filesWIssues.push({
|
|
71194
71238
|
file,
|
|
71195
71239
|
csvValidationIssue,
|
|
71240
|
+
ignoredHeadersMsg,
|
|
71196
71241
|
matchedHeaders,
|
|
71197
71242
|
userSchema,
|
|
71198
71243
|
searchResults
|
|
@@ -71201,6 +71246,7 @@ function UploaderInner({
|
|
|
71201
71246
|
filesWOIssues.push({
|
|
71202
71247
|
file,
|
|
71203
71248
|
csvValidationIssue,
|
|
71249
|
+
ignoredHeadersMsg,
|
|
71204
71250
|
matchedHeaders,
|
|
71205
71251
|
userSchema,
|
|
71206
71252
|
searchResults
|
|
@@ -71300,7 +71346,8 @@ function UploaderInner({
|
|
|
71300
71346
|
"tg-dropzone-reject": isDragReject,
|
|
71301
71347
|
// tnr: the acceptClassName/rejectClassName doesn't work with file extensions (only mimetypes are supported when dragging). Thus we'll just always turn the drop area blue when dragging and let the filtering occur on drop. See https://github.com/react-dropzone/react-dropzone/issues/888#issuecomment-773938074
|
|
71302
71348
|
"tg-dropzone-accept": isDragAccept,
|
|
71303
|
-
"tg-dropzone-disabled":
|
|
71349
|
+
"tg-dropzone-disabled": dropzoneDisabled,
|
|
71350
|
+
"bp3-disabled": dropzoneDisabled
|
|
71304
71351
|
})
|
|
71305
71352
|
}),
|
|
71306
71353
|
/* @__PURE__ */ React__default.createElement("input", __spreadValues({}, getInputProps())),
|
|
@@ -77682,6 +77729,7 @@ export {
|
|
|
77682
77729
|
InputField,
|
|
77683
77730
|
IntentText,
|
|
77684
77731
|
Loading,
|
|
77732
|
+
LoadingDots,
|
|
77685
77733
|
MenuBar,
|
|
77686
77734
|
MenuItemWithTooltip,
|
|
77687
77735
|
NumericInputField,
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export const LoadingDots = () => {
|
|
4
|
+
const [dots, setDots] = useState("");
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const interval = setInterval(() => {
|
|
7
|
+
setDots(dots => {
|
|
8
|
+
return dots.length === 3 ? "" : dots + ".";
|
|
9
|
+
});
|
|
10
|
+
}, 500);
|
|
11
|
+
return () => clearInterval(interval);
|
|
12
|
+
}, []);
|
|
13
|
+
return <span>{dots}</span>;
|
|
14
|
+
};
|
|
@@ -43,6 +43,7 @@ import { initialize } from "redux-form";
|
|
|
43
43
|
import classNames from "classnames";
|
|
44
44
|
import { compose } from "recompose";
|
|
45
45
|
import convertSchema from "../DataTable/utils/convertSchema";
|
|
46
|
+
import { LoadingDots } from "./LoadingDots";
|
|
46
47
|
|
|
47
48
|
configure({ isolateGlobalState: true });
|
|
48
49
|
const helperText = [
|
|
@@ -115,7 +116,7 @@ class ValidateAgainstSchema {
|
|
|
115
116
|
const emptyPromise = Promise.resolve.bind(Promise);
|
|
116
117
|
|
|
117
118
|
function UploaderInner({
|
|
118
|
-
accept:
|
|
119
|
+
accept: __accept,
|
|
119
120
|
contentOverride: maybeContentOverride,
|
|
120
121
|
innerIcon,
|
|
121
122
|
innerText,
|
|
@@ -138,23 +139,52 @@ function UploaderInner({
|
|
|
138
139
|
dropzoneProps = {},
|
|
139
140
|
overflowList,
|
|
140
141
|
autoUnzip,
|
|
141
|
-
|
|
142
|
+
_disabled,
|
|
142
143
|
noBuildCsvOption,
|
|
143
144
|
initializeForm,
|
|
144
145
|
showFilesCount,
|
|
145
146
|
threeDotMenuItems,
|
|
146
147
|
onPreviewClick
|
|
147
148
|
}) {
|
|
149
|
+
let dropzoneDisabled = _disabled;
|
|
150
|
+
let _accept = __accept;
|
|
148
151
|
//on component did mount
|
|
149
152
|
const validateAgainstSchemaStore = useRef(new ValidateAgainstSchema());
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
const [resolvedAccept, setResolvedAccept] = useState();
|
|
154
|
+
if (resolvedAccept) {
|
|
155
|
+
_accept = resolvedAccept;
|
|
156
|
+
}
|
|
157
|
+
const isAcceptPromise =
|
|
158
|
+
__accept?.then ||
|
|
159
|
+
(Array.isArray(__accept) ? __accept.some(a => a?.then) : false);
|
|
160
|
+
const acceptLoading =
|
|
161
|
+
!resolvedAccept && isAcceptPromise && `Accept Loading...`;
|
|
162
|
+
|
|
163
|
+
if (isAcceptPromise && !resolvedAccept) {
|
|
164
|
+
Promise.allSettled(Array.isArray(__accept) ? __accept : [__accept]).then(
|
|
165
|
+
results => {
|
|
166
|
+
const resolved = flatMap(results, r => r.value);
|
|
167
|
+
setResolvedAccept(resolved);
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
_accept = [];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (acceptLoading) dropzoneDisabled = true;
|
|
174
|
+
const accept = !_accept
|
|
175
|
+
? undefined
|
|
176
|
+
: !isAcceptPromise && !resolvedAccept
|
|
177
|
+
? []
|
|
178
|
+
: isPlainObject(_accept)
|
|
179
|
+
? [_accept]
|
|
180
|
+
: isArray(_accept)
|
|
181
|
+
? _accept
|
|
182
|
+
: _accept.split(",").map(a => ({ type: a }));
|
|
183
|
+
const callout = _callout || accept.find?.(a => a?.callout)?.callout;
|
|
184
|
+
|
|
153
185
|
const validateAgainstSchemaToUse =
|
|
154
186
|
_validateAgainstSchema ||
|
|
155
|
-
(
|
|
156
|
-
a => a?.validateAgainstSchema
|
|
157
|
-
)?.validateAgainstSchema;
|
|
187
|
+
accept.find?.(a => a?.validateAgainstSchema)?.validateAgainstSchema;
|
|
158
188
|
|
|
159
189
|
useEffect(() => {
|
|
160
190
|
// validateAgainstSchema
|
|
@@ -166,13 +196,7 @@ function UploaderInner({
|
|
|
166
196
|
if (validateAgainstSchemaToUse) {
|
|
167
197
|
validateAgainstSchema = validateAgainstSchemaStore.current;
|
|
168
198
|
}
|
|
169
|
-
|
|
170
|
-
? undefined
|
|
171
|
-
: isPlainObject(_accept)
|
|
172
|
-
? [_accept]
|
|
173
|
-
: isArray(_accept)
|
|
174
|
-
? _accept
|
|
175
|
-
: _accept.split(",").map(a => ({ type: a }));
|
|
199
|
+
|
|
176
200
|
if (
|
|
177
201
|
(validateAgainstSchema || autoUnzip) &&
|
|
178
202
|
accept &&
|
|
@@ -471,7 +495,7 @@ function UploaderInner({
|
|
|
471
495
|
className="tg-uploader-inner"
|
|
472
496
|
style={{ width: "100%", height: "fit-content", minWidth: 0 }}
|
|
473
497
|
>
|
|
474
|
-
{simpleAccept && (
|
|
498
|
+
{(simpleAccept || acceptLoading) && (
|
|
475
499
|
<div
|
|
476
500
|
className={Classes.TEXT_MUTED}
|
|
477
501
|
style={{ fontSize: 11, marginBottom: 5 }}
|
|
@@ -601,13 +625,19 @@ function UploaderInner({
|
|
|
601
625
|
})}
|
|
602
626
|
</span>
|
|
603
627
|
</div>
|
|
628
|
+
) : acceptLoading ? (
|
|
629
|
+
// make the dots below "load"
|
|
630
|
+
|
|
631
|
+
<>
|
|
632
|
+
Accept Loading<LoadingDots></LoadingDots>
|
|
633
|
+
</>
|
|
604
634
|
) : (
|
|
605
635
|
<>Accepts {simpleAccept}</>
|
|
606
636
|
)}
|
|
607
637
|
</div>
|
|
608
638
|
)}
|
|
609
639
|
<Dropzone
|
|
610
|
-
disabled={
|
|
640
|
+
disabled={dropzoneDisabled}
|
|
611
641
|
onClick={evt => evt.preventDefault()}
|
|
612
642
|
multiple={fileLimit !== 1}
|
|
613
643
|
accept={
|
|
@@ -729,7 +759,8 @@ function UploaderInner({
|
|
|
729
759
|
csvValidationIssue: _csvValidationIssue,
|
|
730
760
|
matchedHeaders,
|
|
731
761
|
userSchema,
|
|
732
|
-
searchResults
|
|
762
|
+
searchResults,
|
|
763
|
+
ignoredHeadersMsg
|
|
733
764
|
} = await tryToMatchSchemas({
|
|
734
765
|
incomingData: parsedF.data,
|
|
735
766
|
validateAgainstSchema
|
|
@@ -790,6 +821,7 @@ function UploaderInner({
|
|
|
790
821
|
filesWIssues.push({
|
|
791
822
|
file,
|
|
792
823
|
csvValidationIssue,
|
|
824
|
+
ignoredHeadersMsg,
|
|
793
825
|
matchedHeaders,
|
|
794
826
|
userSchema,
|
|
795
827
|
searchResults
|
|
@@ -798,6 +830,7 @@ function UploaderInner({
|
|
|
798
830
|
filesWOIssues.push({
|
|
799
831
|
file,
|
|
800
832
|
csvValidationIssue,
|
|
833
|
+
ignoredHeadersMsg,
|
|
801
834
|
matchedHeaders,
|
|
802
835
|
userSchema,
|
|
803
836
|
searchResults
|
|
@@ -919,7 +952,8 @@ function UploaderInner({
|
|
|
919
952
|
"tg-dropzone-active": isDragActive,
|
|
920
953
|
"tg-dropzone-reject": isDragReject, // tnr: the acceptClassName/rejectClassName doesn't work with file extensions (only mimetypes are supported when dragging). Thus we'll just always turn the drop area blue when dragging and let the filtering occur on drop. See https://github.com/react-dropzone/react-dropzone/issues/888#issuecomment-773938074
|
|
921
954
|
"tg-dropzone-accept": isDragAccept,
|
|
922
|
-
"tg-dropzone-disabled":
|
|
955
|
+
"tg-dropzone-disabled": dropzoneDisabled,
|
|
956
|
+
"bp3-disabled": dropzoneDisabled
|
|
923
957
|
})}
|
|
924
958
|
>
|
|
925
959
|
<input {...getInputProps()} />
|
|
@@ -28,10 +28,11 @@ export default async function tryToMatchSchemas({
|
|
|
28
28
|
await resolveValidateAgainstSchema(validateAgainstSchema);
|
|
29
29
|
const userSchema = getSchema(incomingData);
|
|
30
30
|
|
|
31
|
-
const { searchResults, csvValidationIssue } =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const { searchResults, csvValidationIssue, ignoredHeadersMsg } =
|
|
32
|
+
await matchSchemas({
|
|
33
|
+
userSchema,
|
|
34
|
+
officialSchema: validateAgainstSchema
|
|
35
|
+
});
|
|
35
36
|
|
|
36
37
|
const incomingHeadersToScores = {};
|
|
37
38
|
|
|
@@ -67,6 +68,7 @@ export default async function tryToMatchSchemas({
|
|
|
67
68
|
});
|
|
68
69
|
|
|
69
70
|
return {
|
|
71
|
+
ignoredHeadersMsg,
|
|
70
72
|
csvValidationIssue,
|
|
71
73
|
matchedHeaders,
|
|
72
74
|
userSchema,
|
|
@@ -150,7 +152,10 @@ async function matchSchemas({ userSchema, officialSchema }) {
|
|
|
150
152
|
matchedAltPaths.includes(uh.path)
|
|
151
153
|
)
|
|
152
154
|
) {
|
|
153
|
-
|
|
155
|
+
// check that the column does contain data (if it doesn't, it's probably a blank column)
|
|
156
|
+
if (userSchema.userData.some(e => e[uh.path])) {
|
|
157
|
+
ignoredUserSchemaFields.push(uh);
|
|
158
|
+
}
|
|
154
159
|
}
|
|
155
160
|
});
|
|
156
161
|
|
|
@@ -224,18 +229,16 @@ async function matchSchemas({ userSchema, officialSchema }) {
|
|
|
224
229
|
}
|
|
225
230
|
// csvValidationIssue = `Some of the data doesn't look quite right. Do these header mappings look correct?`;
|
|
226
231
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// }
|
|
231
|
-
if (!csvValidationIssue && ignoredUserSchemaFields.length) {
|
|
232
|
-
csvValidationIssue = `It looks like the following headers in your file didn't map to any of the accepted headers: ${ignoredUserSchemaFields
|
|
232
|
+
let ignoredHeadersMsg;
|
|
233
|
+
if (ignoredUserSchemaFields.length) {
|
|
234
|
+
ignoredHeadersMsg = `It looks like the following headers in your file didn't map to any of the accepted headers: ${ignoredUserSchemaFields
|
|
233
235
|
.map(f => f.displayName || f.path)
|
|
234
236
|
.join(", ")}`;
|
|
235
237
|
}
|
|
236
238
|
return {
|
|
237
239
|
searchResults: officialSchema.fields,
|
|
238
|
-
csvValidationIssue
|
|
240
|
+
csvValidationIssue,
|
|
241
|
+
ignoredHeadersMsg
|
|
239
242
|
};
|
|
240
243
|
}
|
|
241
244
|
|
package/src/MatchHeaders.js
CHANGED
|
@@ -13,6 +13,7 @@ export function MatchHeaders({
|
|
|
13
13
|
onMultiFileUploadSubmit,
|
|
14
14
|
doAllFilesHaveSameHeaders,
|
|
15
15
|
csvValidationIssue,
|
|
16
|
+
ignoredHeadersMsg,
|
|
16
17
|
searchResults,
|
|
17
18
|
matchedHeaders,
|
|
18
19
|
userSchema,
|
|
@@ -37,6 +38,11 @@ export function MatchHeaders({
|
|
|
37
38
|
{csvValidationIssue}
|
|
38
39
|
</Callout>
|
|
39
40
|
)}
|
|
41
|
+
{!onMultiFileUploadSubmit && ignoredHeadersMsg && (
|
|
42
|
+
<Callout style={{ width: "fit-content" }} intent="warning">
|
|
43
|
+
{ignoredHeadersMsg}
|
|
44
|
+
</Callout>
|
|
45
|
+
)}
|
|
40
46
|
<br></br>
|
|
41
47
|
<tr
|
|
42
48
|
style={{
|
package/src/UploadCsvWizard.js
CHANGED
|
@@ -76,6 +76,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
76
76
|
doAllFilesHaveSameHeaders,
|
|
77
77
|
destroyForms,
|
|
78
78
|
csvValidationIssue,
|
|
79
|
+
ignoredHeadersMsg,
|
|
79
80
|
searchResults,
|
|
80
81
|
matchedHeaders,
|
|
81
82
|
userSchema,
|
|
@@ -222,6 +223,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
222
223
|
destroyForms,
|
|
223
224
|
setFilesWIssues,
|
|
224
225
|
csvValidationIssue,
|
|
226
|
+
ignoredHeadersMsg,
|
|
225
227
|
searchResults,
|
|
226
228
|
matchedHeaders,
|
|
227
229
|
userSchema,
|
|
@@ -266,6 +268,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
266
268
|
reduxFormEntitiesArray,
|
|
267
269
|
// onMultiFileUploadSubmit,
|
|
268
270
|
csvValidationIssue,
|
|
271
|
+
ignoredHeadersMsg,
|
|
269
272
|
searchResults,
|
|
270
273
|
matchedHeaders,
|
|
271
274
|
userSchema,
|
|
@@ -312,6 +315,7 @@ const UploadCsvWizardDialog = compose(
|
|
|
312
315
|
searchResults,
|
|
313
316
|
onUploadWizardFinish,
|
|
314
317
|
csvValidationIssue,
|
|
318
|
+
ignoredHeadersMsg,
|
|
315
319
|
matchedHeaders,
|
|
316
320
|
//fromRedux:
|
|
317
321
|
changeForm,
|
|
@@ -344,6 +348,7 @@ const UploadCsvWizardDialogInner = compose(
|
|
|
344
348
|
searchResults,
|
|
345
349
|
onUploadWizardFinish,
|
|
346
350
|
csvValidationIssue,
|
|
351
|
+
ignoredHeadersMsg,
|
|
347
352
|
matchedHeaders,
|
|
348
353
|
//fromRedux:
|
|
349
354
|
handleSubmit,
|
|
@@ -383,6 +388,7 @@ const UploadCsvWizardDialogInner = compose(
|
|
|
383
388
|
{...{
|
|
384
389
|
onMultiFileUploadSubmit,
|
|
385
390
|
csvValidationIssue,
|
|
391
|
+
ignoredHeadersMsg,
|
|
386
392
|
searchResults,
|
|
387
393
|
matchedHeaders,
|
|
388
394
|
userSchema,
|
|
@@ -412,10 +418,10 @@ const UploadCsvWizardDialogInner = compose(
|
|
|
412
418
|
!hasSubmitted
|
|
413
419
|
? "Review and Edit Data"
|
|
414
420
|
: onMultiFileUploadSubmit
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
421
|
+
? isThisTheLastBadFile
|
|
422
|
+
? "Finalize Files"
|
|
423
|
+
: "Next File"
|
|
424
|
+
: "Add File"
|
|
419
425
|
}
|
|
420
426
|
submitting={submitting}
|
|
421
427
|
disabled={
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import "@blueprintjs/datetime/lib/css/blueprint-datetime.css";
|
|
|
3
3
|
import "@blueprintjs/icons/lib/css/blueprint-icons.css";
|
|
4
4
|
import "./style.css";
|
|
5
5
|
import "./autoTooltip";
|
|
6
|
+
export { LoadingDots } from "./FormComponents/LoadingDots";
|
|
6
7
|
export * from "./AssignDefaultsModeContext";
|
|
7
8
|
export { default as Uploader } from "./FormComponents/Uploader";
|
|
8
9
|
export { mergeSchemas } from "./DataTable/utils/convertSchema";
|
package/src/style.css
CHANGED
package/style.css
CHANGED
|
@@ -9063,7 +9063,8 @@ button:not(:disabled):active {
|
|
|
9063
9063
|
|
|
9064
9064
|
.bp3-dialog-header .bp3-heading {
|
|
9065
9065
|
width: 10px; /* tnw: this is a hack to prevent the dialog title from causing the dialog width to expand larger than the dialog content*/
|
|
9066
|
-
}
|
|
9066
|
+
}
|
|
9067
|
+
.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.rg-celleditor-input,
|
|
9067
9068
|
.rg-celleditor input {
|
|
9068
9069
|
border: none;
|
|
9069
9070
|
}
|
|
@@ -9778,6 +9779,7 @@ body:not(.drag-active)
|
|
|
9778
9779
|
border-color: rgb(91, 157, 211);
|
|
9779
9780
|
}
|
|
9780
9781
|
.tg-dropzone-disabled {
|
|
9782
|
+
cursor: not-allowed;
|
|
9781
9783
|
border-color: rgb(136, 133, 132) !important;
|
|
9782
9784
|
opacity: 0.8;
|
|
9783
9785
|
}
|