@teselagen/ui 0.5.23-beta.1 → 0.5.23-beta.10
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/DataTable/Columns.d.ts +54 -1
- package/DataTable/utils/index.d.ts +2 -1
- package/DataTable/utils/useTableEntities.d.ts +5 -0
- package/DataTable/viewColumn.d.ts +11 -4
- package/index.cjs.js +555 -505
- package/index.d.ts +1 -1
- package/index.es.js +556 -506
- package/package.json +7 -4
- package/src/DataTable/ColumnFilterMenu.js +1 -3
- package/src/DataTable/Columns.js +66 -67
- package/src/DataTable/EditabelCell.js +1 -2
- package/src/DataTable/dataTableEnhancer.js +0 -4
- package/src/DataTable/index.js +208 -149
- package/src/DataTable/utils/index.js +3 -1
- package/src/DataTable/utils/useTableEntities.js +41 -0
- package/src/DataTable/viewColumn.js +5 -9
- package/src/FormComponents/Uploader.js +281 -314
- package/src/enhancers/withDialog/tg_modalState.js +1 -0
- package/src/index.js +1 -1
package/index.cjs.js
CHANGED
|
@@ -17180,6 +17180,43 @@ const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
|
|
|
17180
17180
|
}
|
|
17181
17181
|
return ref2.current;
|
|
17182
17182
|
}, "useDeepEqualMemo");
|
|
17183
|
+
const useTableEntities = /* @__PURE__ */ __name((tableFormName) => {
|
|
17184
|
+
const dispatch = reactRedux.useDispatch();
|
|
17185
|
+
const selectTableEntities = React$1.useCallback(
|
|
17186
|
+
(entities = []) => {
|
|
17187
|
+
reduxForm.initialize(tableFormName, {}, true, {
|
|
17188
|
+
keepDirty: true,
|
|
17189
|
+
updateUnregisteredFields: true,
|
|
17190
|
+
keepValues: true
|
|
17191
|
+
});
|
|
17192
|
+
const selectedEntityIdMap = {};
|
|
17193
|
+
entities.forEach((entity) => {
|
|
17194
|
+
selectedEntityIdMap[entity.id] = {
|
|
17195
|
+
entity,
|
|
17196
|
+
time: Date.now()
|
|
17197
|
+
};
|
|
17198
|
+
});
|
|
17199
|
+
dispatch(
|
|
17200
|
+
reduxForm.change(
|
|
17201
|
+
tableFormName,
|
|
17202
|
+
"reduxFormSelectedEntityIdMap",
|
|
17203
|
+
selectedEntityIdMap
|
|
17204
|
+
)
|
|
17205
|
+
);
|
|
17206
|
+
},
|
|
17207
|
+
[dispatch, tableFormName]
|
|
17208
|
+
);
|
|
17209
|
+
const { allOrderedEntities = [], selectedEntities = {} } = reactRedux.useSelector(
|
|
17210
|
+
(state) => {
|
|
17211
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17212
|
+
return {
|
|
17213
|
+
allOrderedEntities: (_c = (_b = (_a = state.form) == null ? void 0 : _a[tableFormName]) == null ? void 0 : _b.values) == null ? void 0 : _c.allOrderedEntities,
|
|
17214
|
+
selectedEntities: (_f = (_e = (_d = state.form) == null ? void 0 : _d[tableFormName]) == null ? void 0 : _e.values) == null ? void 0 : _f.reduxFormSelectedEntityIdMap
|
|
17215
|
+
};
|
|
17216
|
+
}
|
|
17217
|
+
);
|
|
17218
|
+
return { selectTableEntities, allOrderedEntities, selectedEntities };
|
|
17219
|
+
}, "useTableEntities");
|
|
17183
17220
|
function rowClick(e2, rowInfo, entities, {
|
|
17184
17221
|
reduxFormSelectedEntityIdMap,
|
|
17185
17222
|
isSingleSelect,
|
|
@@ -33239,20 +33276,6 @@ const SortableColumns = /* @__PURE__ */ __name(({ className, style, children, mo
|
|
|
33239
33276
|
children
|
|
33240
33277
|
);
|
|
33241
33278
|
}, "SortableColumns");
|
|
33242
|
-
const isEq = /* @__PURE__ */ __name((o1, o2) => {
|
|
33243
|
-
const isEq2 = isEqualWith(o1, o2, function(val1, val2) {
|
|
33244
|
-
if (isFunction$4(val1) && isFunction$4(val2)) {
|
|
33245
|
-
return val1 === val2 || val1.toString() === val2.toString();
|
|
33246
|
-
}
|
|
33247
|
-
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
33248
|
-
return true;
|
|
33249
|
-
});
|
|
33250
|
-
return isEq2;
|
|
33251
|
-
}, "isEq");
|
|
33252
|
-
const pure = /* @__PURE__ */ __name((BaseComponent) => {
|
|
33253
|
-
const hoc = shouldUpdate((props, nextProps) => !isEq(props, nextProps));
|
|
33254
|
-
return hoc(BaseComponent);
|
|
33255
|
-
}, "pure");
|
|
33256
33279
|
var warning = /* @__PURE__ */ __name(function() {
|
|
33257
33280
|
}, "warning");
|
|
33258
33281
|
var warning_1 = warning;
|
|
@@ -34131,9 +34154,6 @@ var withRouter = /* @__PURE__ */ __name(function withRouter2(Component) {
|
|
|
34131
34154
|
return hoistStatics(C, Component);
|
|
34132
34155
|
}, "withRouter");
|
|
34133
34156
|
const dataTableEnhancer = compose(
|
|
34134
|
-
// Function to make sure we don't rerender unless there are changes
|
|
34135
|
-
// in the params
|
|
34136
|
-
branch((props) => !props.alwaysRerender, pure),
|
|
34137
34157
|
// form prop is needed for redux-form, but we are giving this prop as
|
|
34138
34158
|
// formName, so we need to rename it. Previously it was done in the withTableParams, but now
|
|
34139
34159
|
// it doesn't have it by default.
|
|
@@ -34556,18 +34576,14 @@ const viewColumn = {
|
|
|
34556
34576
|
return /* @__PURE__ */ React$1.createElement(core.Icon, { className: "dt-eyeIcon", icon: "eye-open" });
|
|
34557
34577
|
}
|
|
34558
34578
|
};
|
|
34559
|
-
const openColumn = __spreadProps(__spreadValues({}, viewColumn), {
|
|
34560
|
-
render: (val, record, rowInfo
|
|
34579
|
+
const openColumn = /* @__PURE__ */ __name(({ onDoubleClick, history }) => __spreadProps(__spreadValues({}, viewColumn), {
|
|
34580
|
+
render: (val, record, rowInfo) => {
|
|
34561
34581
|
return /* @__PURE__ */ React$1.createElement(core.Tooltip, { content: "Open" }, /* @__PURE__ */ React$1.createElement(
|
|
34562
34582
|
core.Button,
|
|
34563
34583
|
{
|
|
34564
34584
|
onClick: (e2) => {
|
|
34565
34585
|
e2.stopPropagation();
|
|
34566
|
-
|
|
34567
|
-
rowInfo.original,
|
|
34568
|
-
rowInfo.index,
|
|
34569
|
-
props.history
|
|
34570
|
-
);
|
|
34586
|
+
onDoubleClick && onDoubleClick(rowInfo.original, rowInfo.index, history);
|
|
34571
34587
|
},
|
|
34572
34588
|
minimal: true,
|
|
34573
34589
|
small: true,
|
|
@@ -34576,7 +34592,7 @@ const openColumn = __spreadProps(__spreadValues({}, viewColumn), {
|
|
|
34576
34592
|
}
|
|
34577
34593
|
));
|
|
34578
34594
|
}
|
|
34579
|
-
});
|
|
34595
|
+
}), "openColumn");
|
|
34580
34596
|
function convertSchema(schema) {
|
|
34581
34597
|
let schemaToUse = schema;
|
|
34582
34598
|
if (!schemaToUse.fields && Array.isArray(schema)) {
|
|
@@ -47025,9 +47041,7 @@ const ColumnFilterMenu = /* @__PURE__ */ __name(({
|
|
|
47025
47041
|
core.Popover,
|
|
47026
47042
|
{
|
|
47027
47043
|
position: "bottom",
|
|
47028
|
-
onClose: () =>
|
|
47029
|
-
setColumnFilterMenuOpen(false);
|
|
47030
|
-
},
|
|
47044
|
+
onClose: () => setColumnFilterMenuOpen(false),
|
|
47031
47045
|
isOpen: columnFilterMenuOpen,
|
|
47032
47046
|
modifiers: {
|
|
47033
47047
|
preventOverflow: { enabled: true },
|
|
@@ -47146,11 +47160,10 @@ const EditableCell = /* @__PURE__ */ __name(({
|
|
|
47146
47160
|
}, dataTest), {
|
|
47147
47161
|
autoFocus: true,
|
|
47148
47162
|
onKeyDown: (e2) => {
|
|
47163
|
+
e2.stopPropagation();
|
|
47149
47164
|
if (e2.key === "Enter") {
|
|
47150
47165
|
e2.target.blur();
|
|
47151
|
-
e2.stopPropagation();
|
|
47152
47166
|
} else if (e2.key === "Escape") {
|
|
47153
|
-
e2.stopPropagation();
|
|
47154
47167
|
cancelEdit();
|
|
47155
47168
|
}
|
|
47156
47169
|
},
|
|
@@ -47695,61 +47708,60 @@ const RenderCell = /* @__PURE__ */ __name(({
|
|
|
47695
47708
|
}
|
|
47696
47709
|
));
|
|
47697
47710
|
}, "RenderCell");
|
|
47698
|
-
const RenderColumns = /* @__PURE__ */ __name((
|
|
47699
|
-
|
|
47700
|
-
|
|
47701
|
-
|
|
47702
|
-
|
|
47703
|
-
|
|
47704
|
-
|
|
47705
|
-
|
|
47706
|
-
|
|
47707
|
-
|
|
47708
|
-
|
|
47709
|
-
|
|
47710
|
-
|
|
47711
|
-
|
|
47712
|
-
|
|
47713
|
-
|
|
47714
|
-
|
|
47715
|
-
|
|
47716
|
-
|
|
47717
|
-
|
|
47718
|
-
|
|
47719
|
-
|
|
47720
|
-
|
|
47721
|
-
|
|
47722
|
-
|
|
47723
|
-
|
|
47724
|
-
|
|
47725
|
-
|
|
47726
|
-
|
|
47727
|
-
|
|
47728
|
-
|
|
47729
|
-
|
|
47730
|
-
|
|
47731
|
-
|
|
47732
|
-
|
|
47733
|
-
|
|
47734
|
-
|
|
47735
|
-
|
|
47736
|
-
|
|
47737
|
-
|
|
47738
|
-
|
|
47739
|
-
|
|
47740
|
-
|
|
47741
|
-
|
|
47742
|
-
|
|
47743
|
-
|
|
47744
|
-
|
|
47745
|
-
|
|
47746
|
-
|
|
47747
|
-
|
|
47748
|
-
|
|
47749
|
-
|
|
47750
|
-
|
|
47751
|
-
|
|
47752
|
-
} = props;
|
|
47711
|
+
const RenderColumns = /* @__PURE__ */ __name(({
|
|
47712
|
+
addFilters,
|
|
47713
|
+
cellRenderer,
|
|
47714
|
+
change,
|
|
47715
|
+
columns,
|
|
47716
|
+
currentParams,
|
|
47717
|
+
compact: compact3,
|
|
47718
|
+
editableCellValue,
|
|
47719
|
+
editingCell,
|
|
47720
|
+
editingCellSelectAll,
|
|
47721
|
+
entities,
|
|
47722
|
+
expandedEntityIdMap,
|
|
47723
|
+
extraCompact,
|
|
47724
|
+
filters,
|
|
47725
|
+
getCellHoverText,
|
|
47726
|
+
isCellEditable,
|
|
47727
|
+
isEntityDisabled,
|
|
47728
|
+
isLocalCall,
|
|
47729
|
+
isSimple,
|
|
47730
|
+
isSingleSelect,
|
|
47731
|
+
isSelectionARectangle,
|
|
47732
|
+
noDeselectAll,
|
|
47733
|
+
noSelect,
|
|
47734
|
+
noUserSelect,
|
|
47735
|
+
onDeselect,
|
|
47736
|
+
onMultiRowSelect,
|
|
47737
|
+
onRowClick,
|
|
47738
|
+
onRowSelect,
|
|
47739
|
+
onSingleRowSelect,
|
|
47740
|
+
order: order2,
|
|
47741
|
+
primarySelectedCellId,
|
|
47742
|
+
reduxFormCellValidation,
|
|
47743
|
+
reduxFormSelectedEntityIdMap,
|
|
47744
|
+
refocusTable,
|
|
47745
|
+
removeSingleFilter = noop$3,
|
|
47746
|
+
schema,
|
|
47747
|
+
selectedCells,
|
|
47748
|
+
setEditableCellValue,
|
|
47749
|
+
setEditingCell,
|
|
47750
|
+
setExpandedEntityIdMap,
|
|
47751
|
+
setNewParams,
|
|
47752
|
+
setOrder = noop$3,
|
|
47753
|
+
setSelectedCells,
|
|
47754
|
+
shouldShowSubComponent,
|
|
47755
|
+
startCellEdit,
|
|
47756
|
+
SubComponent,
|
|
47757
|
+
tableRef,
|
|
47758
|
+
updateEntitiesHelper,
|
|
47759
|
+
updateValidation,
|
|
47760
|
+
withCheckboxes,
|
|
47761
|
+
withExpandAndCollapseAllButton,
|
|
47762
|
+
withFilter: _withFilter,
|
|
47763
|
+
withSort = true
|
|
47764
|
+
}) => {
|
|
47753
47765
|
const withFilter = _withFilter === void 0 ? !isSimple : _withFilter;
|
|
47754
47766
|
const onDragEnd = /* @__PURE__ */ __name((cellsToSelect) => {
|
|
47755
47767
|
const [primaryRowId, primaryCellPath] = primarySelectedCellId.split(":");
|
|
@@ -47921,13 +47933,16 @@ const RenderColumns = /* @__PURE__ */ __name((props) => {
|
|
|
47921
47933
|
let text2 = typeof val !== "string" ? row.value : val;
|
|
47922
47934
|
const record = row.original;
|
|
47923
47935
|
if (column.getClipboardData) {
|
|
47924
|
-
text2 = column.getClipboardData(row.value, record, row
|
|
47936
|
+
text2 = column.getClipboardData(row.value, record, row);
|
|
47925
47937
|
} else if (column.getValueToFilterOn) {
|
|
47926
|
-
text2 = column.getValueToFilterOn(record
|
|
47938
|
+
text2 = column.getValueToFilterOn(record);
|
|
47927
47939
|
} else if (column.render) {
|
|
47928
|
-
text2 = column.render(row.value, record, row,
|
|
47940
|
+
text2 = column.render(row.value, record, row, {
|
|
47941
|
+
currentParams,
|
|
47942
|
+
setNewParams
|
|
47943
|
+
});
|
|
47929
47944
|
} else if (cellRenderer && cellRenderer[column.path]) {
|
|
47930
|
-
text2 = cellRenderer[column.path](row.value, row.original, row
|
|
47945
|
+
text2 = cellRenderer[column.path](row.value, row.original, row);
|
|
47931
47946
|
} else if (text2) {
|
|
47932
47947
|
text2 = React$1.isValidElement(text2) ? text2 : String(text2);
|
|
47933
47948
|
}
|
|
@@ -48145,17 +48160,15 @@ const RenderColumns = /* @__PURE__ */ __name((props) => {
|
|
|
48145
48160
|
}
|
|
48146
48161
|
if (cellRenderer && cellRenderer[column.path]) {
|
|
48147
48162
|
tableColumn.Cell = (row) => {
|
|
48148
|
-
const val = cellRenderer[column.path](
|
|
48149
|
-
row.value,
|
|
48150
|
-
row.original,
|
|
48151
|
-
row,
|
|
48152
|
-
props
|
|
48153
|
-
);
|
|
48163
|
+
const val = cellRenderer[column.path](row.value, row.original, row);
|
|
48154
48164
|
return val;
|
|
48155
48165
|
};
|
|
48156
48166
|
} else if (column.render) {
|
|
48157
48167
|
tableColumn.Cell = (row) => {
|
|
48158
|
-
const val = column.render(row.value, row.original, row,
|
|
48168
|
+
const val = column.render(row.value, row.original, row, {
|
|
48169
|
+
currentParams,
|
|
48170
|
+
setNewParams
|
|
48171
|
+
});
|
|
48159
48172
|
return val;
|
|
48160
48173
|
};
|
|
48161
48174
|
} else if (column.type === "timestamp") {
|
|
@@ -48343,12 +48356,13 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48343
48356
|
// }
|
|
48344
48357
|
]
|
|
48345
48358
|
}, props.defaults || {}));
|
|
48346
|
-
|
|
48347
|
-
|
|
48348
|
-
|
|
48349
|
-
|
|
48350
|
-
|
|
48351
|
-
|
|
48359
|
+
const _schema = React$1.useMemo(() => {
|
|
48360
|
+
if (isFunction$4(__schema))
|
|
48361
|
+
return __schema(props);
|
|
48362
|
+
else
|
|
48363
|
+
return __schema;
|
|
48364
|
+
}, [__schema, props]);
|
|
48365
|
+
const convertedSchema = React$1.useMemo(() => convertSchema(_schema), [_schema]);
|
|
48352
48366
|
if (isLocalCall) {
|
|
48353
48367
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
48354
48368
|
throw new Error(
|
|
@@ -48389,12 +48403,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48389
48403
|
const tmp = (urlConnected ? getCurrentParamsFromUrl(history.location) : reduxFormQueryParams) || {};
|
|
48390
48404
|
tmp.searchTerm = reduxFormSearchInput;
|
|
48391
48405
|
return tmp;
|
|
48392
|
-
}, [
|
|
48393
|
-
history.location,
|
|
48394
|
-
reduxFormQueryParams,
|
|
48395
|
-
reduxFormSearchInput,
|
|
48396
|
-
urlConnected
|
|
48397
|
-
]);
|
|
48406
|
+
}, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
|
|
48398
48407
|
const tableParams = React$1.useMemo(() => {
|
|
48399
48408
|
if (!isTableParamsConnected) {
|
|
48400
48409
|
const updateSearch = /* @__PURE__ */ __name((val) => {
|
|
@@ -48431,7 +48440,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48431
48440
|
_tableParams,
|
|
48432
48441
|
change,
|
|
48433
48442
|
currentParams,
|
|
48434
|
-
history
|
|
48443
|
+
history,
|
|
48435
48444
|
isTableParamsConnected,
|
|
48436
48445
|
props,
|
|
48437
48446
|
selectedEntities,
|
|
@@ -48496,7 +48505,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48496
48505
|
doNotValidateUntouchedRows,
|
|
48497
48506
|
editingCellSelectAll,
|
|
48498
48507
|
entities: __origEntities = [],
|
|
48499
|
-
entitiesAcrossPages,
|
|
48508
|
+
entitiesAcrossPages: _entitiesAcrossPages,
|
|
48500
48509
|
entityCount,
|
|
48501
48510
|
errorParsingUrlString,
|
|
48502
48511
|
expandAllByDefault,
|
|
@@ -48580,6 +48589,19 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48580
48589
|
const entities = useDeepEqualMemo(
|
|
48581
48590
|
((reduxFormEntities == null ? void 0 : reduxFormEntities.length) ? reduxFormEntities : _origEntities) || []
|
|
48582
48591
|
);
|
|
48592
|
+
const entitiesAcrossPages = useDeepEqualMemo(_entitiesAcrossPages);
|
|
48593
|
+
React$1.useEffect(() => {
|
|
48594
|
+
if (change) {
|
|
48595
|
+
change("allOrderedEntities", entitiesAcrossPages);
|
|
48596
|
+
if (entities.length === 0 || isEmpty$1(reduxFormSelectedEntityIdMap))
|
|
48597
|
+
return;
|
|
48598
|
+
changeSelectedEntities({
|
|
48599
|
+
idMap: reduxFormSelectedEntityIdMap,
|
|
48600
|
+
entities,
|
|
48601
|
+
change
|
|
48602
|
+
});
|
|
48603
|
+
}
|
|
48604
|
+
}, [entitiesAcrossPages, reduxFormSelectedEntityIdMap]);
|
|
48583
48605
|
const [tableConfig, setTableConfig] = React$1.useState({ fieldOptions: [] });
|
|
48584
48606
|
React$1.useEffect(() => {
|
|
48585
48607
|
let newTableConfig = {};
|
|
@@ -48603,12 +48625,15 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48603
48625
|
withDisplayOptions
|
|
48604
48626
|
]);
|
|
48605
48627
|
const schema = React$1.useMemo(() => {
|
|
48606
|
-
const schema2 =
|
|
48628
|
+
const schema2 = convertedSchema;
|
|
48607
48629
|
if (isViewable) {
|
|
48608
48630
|
schema2.fields = [viewColumn, ...schema2.fields];
|
|
48609
48631
|
}
|
|
48610
48632
|
if (isOpenable) {
|
|
48611
|
-
schema2.fields = [
|
|
48633
|
+
schema2.fields = [
|
|
48634
|
+
openColumn({ onDoubleClick, history }),
|
|
48635
|
+
...schema2.fields
|
|
48636
|
+
];
|
|
48612
48637
|
}
|
|
48613
48638
|
schema2.fields = schema2.fields.map((field) => {
|
|
48614
48639
|
if (field.placementPath) {
|
|
@@ -48670,13 +48695,15 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48670
48695
|
}
|
|
48671
48696
|
return schema2;
|
|
48672
48697
|
}, [
|
|
48673
|
-
_schema,
|
|
48674
48698
|
cellRenderer,
|
|
48699
|
+
convertedSchema,
|
|
48675
48700
|
entities,
|
|
48701
|
+
history,
|
|
48676
48702
|
isInfinite,
|
|
48677
48703
|
isOpenable,
|
|
48678
48704
|
isSimple,
|
|
48679
48705
|
isViewable,
|
|
48706
|
+
onDoubleClick,
|
|
48680
48707
|
showForcedHiddenColumns,
|
|
48681
48708
|
tableConfig.columnOrderings,
|
|
48682
48709
|
tableConfig.fieldOptions,
|
|
@@ -49036,7 +49063,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
49036
49063
|
if (editingCell === cellId)
|
|
49037
49064
|
return;
|
|
49038
49065
|
if (pressedKey) {
|
|
49039
|
-
setEditableCellValue(
|
|
49066
|
+
setEditableCellValue("");
|
|
49040
49067
|
} else {
|
|
49041
49068
|
const [rowId, path2] = cellId.split(":");
|
|
49042
49069
|
const entityIdToEntity = getEntityIdToEntity(entities);
|
|
@@ -50326,23 +50353,29 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
50326
50353
|
acc.push(field.filterKey);
|
|
50327
50354
|
return acc;
|
|
50328
50355
|
}, []);
|
|
50329
|
-
const filtersOnNonDisplayedFields =
|
|
50330
|
-
|
|
50331
|
-
|
|
50332
|
-
|
|
50333
|
-
|
|
50334
|
-
|
|
50335
|
-
|
|
50336
|
-
|
|
50337
|
-
|
|
50338
|
-
|
|
50339
|
-
|
|
50340
|
-
|
|
50341
|
-
|
|
50342
|
-
|
|
50343
|
-
|
|
50356
|
+
const filtersOnNonDisplayedFields = React$1.useMemo(() => {
|
|
50357
|
+
const _filtersOnNonDisplayedFields = [];
|
|
50358
|
+
if (filters && filters.length) {
|
|
50359
|
+
schema.fields.forEach((field) => {
|
|
50360
|
+
const ccDisplayName = getCCDisplayName(field);
|
|
50361
|
+
if (field.isHidden) {
|
|
50362
|
+
filters.forEach((filter2) => {
|
|
50363
|
+
if (filter2.filterOn === ccDisplayName) {
|
|
50364
|
+
_filtersOnNonDisplayedFields.push(__spreadProps(__spreadValues({}, filter2), {
|
|
50365
|
+
displayName: field.displayName
|
|
50366
|
+
}));
|
|
50367
|
+
}
|
|
50368
|
+
});
|
|
50369
|
+
}
|
|
50370
|
+
});
|
|
50371
|
+
}
|
|
50372
|
+
return _filtersOnNonDisplayedFields;
|
|
50373
|
+
}, [filters, schema.fields]);
|
|
50344
50374
|
const numRows = isInfinite ? entities.length : pageSize;
|
|
50345
|
-
const idMap =
|
|
50375
|
+
const idMap = React$1.useMemo(
|
|
50376
|
+
() => reduxFormSelectedEntityIdMap || {},
|
|
50377
|
+
[reduxFormSelectedEntityIdMap]
|
|
50378
|
+
);
|
|
50346
50379
|
const selectedRowCount = Object.keys(idMap).filter((key) => idMap[key]).length;
|
|
50347
50380
|
let rowsToShow = doNotShowEmptyRows ? Math.min(numRows, entities.length) : numRows;
|
|
50348
50381
|
if (entities.length === 0 && rowsToShow < 3)
|
|
@@ -50352,10 +50385,12 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
50352
50385
|
acc[index2] = expandedEntityIdMap[rowId];
|
|
50353
50386
|
return acc;
|
|
50354
50387
|
}, {});
|
|
50355
|
-
|
|
50356
|
-
|
|
50357
|
-
|
|
50358
|
-
|
|
50388
|
+
const children = React$1.useMemo(() => {
|
|
50389
|
+
if (maybeChildren && typeof maybeChildren === "function") {
|
|
50390
|
+
return maybeChildren(props);
|
|
50391
|
+
}
|
|
50392
|
+
return maybeChildren;
|
|
50393
|
+
}, [maybeChildren, props]);
|
|
50359
50394
|
const showHeader = (withTitle || withSearch || children) && !noHeader;
|
|
50360
50395
|
const toggleFullscreenButton = /* @__PURE__ */ React$1.createElement(
|
|
50361
50396
|
core.Button,
|
|
@@ -50366,111 +50401,134 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
50366
50401
|
onClick: () => setFullscreen((prev) => !prev)
|
|
50367
50402
|
}
|
|
50368
50403
|
);
|
|
50369
|
-
|
|
50370
|
-
|
|
50371
|
-
|
|
50372
|
-
|
|
50373
|
-
|
|
50374
|
-
|
|
50375
|
-
|
|
50376
|
-
const
|
|
50377
|
-
|
|
50378
|
-
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
|
|
50382
|
-
|
|
50383
|
-
|
|
50384
|
-
|
|
50385
|
-
|
|
50386
|
-
|
|
50387
|
-
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
|
|
50404
|
+
const { showSelectAll, showClearAll } = React$1.useMemo(() => {
|
|
50405
|
+
let _showSelectAll = false;
|
|
50406
|
+
let _showClearAll = false;
|
|
50407
|
+
if (!isInfinite) {
|
|
50408
|
+
const canShowSelectAll = withSelectAll || entitiesAcrossPages && numRows < entitiesAcrossPages.length;
|
|
50409
|
+
if (canShowSelectAll) {
|
|
50410
|
+
let atLeastOneRowOnCurrentPageSelected = false;
|
|
50411
|
+
const allRowsOnCurrentPageSelected = entities.every((e2) => {
|
|
50412
|
+
const rowId = getIdOrCodeOrIndex(e2);
|
|
50413
|
+
const selected = idMap[rowId] || isEntityDisabled(e2);
|
|
50414
|
+
if (selected)
|
|
50415
|
+
atLeastOneRowOnCurrentPageSelected = true;
|
|
50416
|
+
return selected;
|
|
50417
|
+
});
|
|
50418
|
+
if (atLeastOneRowOnCurrentPageSelected && allRowsOnCurrentPageSelected) {
|
|
50419
|
+
let everyEntitySelected;
|
|
50420
|
+
if (isLocalCall) {
|
|
50421
|
+
everyEntitySelected = entitiesAcrossPages.every((e2) => {
|
|
50422
|
+
const rowId = getIdOrCodeOrIndex(e2);
|
|
50423
|
+
return idMap[rowId] || isEntityDisabled(e2);
|
|
50424
|
+
});
|
|
50425
|
+
} else {
|
|
50426
|
+
everyEntitySelected = entityCount <= selectedRowCount;
|
|
50427
|
+
}
|
|
50428
|
+
if (everyEntitySelected) {
|
|
50429
|
+
_showClearAll = selectedRowCount;
|
|
50430
|
+
}
|
|
50431
|
+
_showSelectAll = !everyEntitySelected;
|
|
50394
50432
|
}
|
|
50395
|
-
showSelectAll = !everyEntitySelected;
|
|
50396
50433
|
}
|
|
50397
50434
|
}
|
|
50398
|
-
|
|
50435
|
+
return { showSelectAll: _showSelectAll, showClearAll: _showClearAll };
|
|
50436
|
+
}, [
|
|
50437
|
+
entities,
|
|
50438
|
+
entitiesAcrossPages,
|
|
50439
|
+
entityCount,
|
|
50440
|
+
idMap,
|
|
50441
|
+
isEntityDisabled,
|
|
50442
|
+
isInfinite,
|
|
50443
|
+
isLocalCall,
|
|
50444
|
+
numRows,
|
|
50445
|
+
selectedRowCount,
|
|
50446
|
+
withSelectAll
|
|
50447
|
+
]);
|
|
50399
50448
|
const showNumSelected = !noSelect && !isSingleSelect && !hideSelectedCount;
|
|
50400
|
-
|
|
50401
|
-
|
|
50402
|
-
|
|
50403
|
-
|
|
50404
|
-
|
|
50405
|
-
|
|
50406
|
-
|
|
50407
|
-
|
|
50408
|
-
|
|
50409
|
-
|
|
50410
|
-
|
|
50411
|
-
|
|
50412
|
-
|
|
50449
|
+
const selectedAndTotalMessage = React$1.useMemo(() => {
|
|
50450
|
+
let _selectedAndTotalMessage = "";
|
|
50451
|
+
if (showNumSelected) {
|
|
50452
|
+
_selectedAndTotalMessage += `${selectedRowCount} Selected `;
|
|
50453
|
+
}
|
|
50454
|
+
if (showCount && showNumSelected) {
|
|
50455
|
+
_selectedAndTotalMessage += `/ `;
|
|
50456
|
+
}
|
|
50457
|
+
if (showCount) {
|
|
50458
|
+
_selectedAndTotalMessage += `${entityCount || 0} Total`;
|
|
50459
|
+
}
|
|
50460
|
+
if (_selectedAndTotalMessage) {
|
|
50461
|
+
_selectedAndTotalMessage = /* @__PURE__ */ React$1.createElement("div", null, _selectedAndTotalMessage);
|
|
50462
|
+
}
|
|
50463
|
+
return _selectedAndTotalMessage;
|
|
50464
|
+
}, [entityCount, selectedRowCount, showCount, showNumSelected]);
|
|
50413
50465
|
const shouldShowPaging = !isInfinite && withPaging && (hidePageSizeWhenPossible ? entityCount > pageSize : true);
|
|
50414
|
-
|
|
50415
|
-
|
|
50416
|
-
|
|
50417
|
-
|
|
50418
|
-
|
|
50419
|
-
|
|
50420
|
-
}
|
|
50421
|
-
if (shouldShow) {
|
|
50422
|
-
return SubComponent(row);
|
|
50423
|
-
}
|
|
50424
|
-
}, "SubComponentToUse");
|
|
50425
|
-
}
|
|
50426
|
-
let nonDisplayedFilterComp;
|
|
50427
|
-
if (filtersOnNonDisplayedFields.length) {
|
|
50428
|
-
const content2 = filtersOnNonDisplayedFields.map(
|
|
50429
|
-
({ displayName, path: path2, selectedFilter, filterValue }) => {
|
|
50430
|
-
let filterValToDisplay = filterValue;
|
|
50431
|
-
if (selectedFilter === "inList") {
|
|
50432
|
-
filterValToDisplay = Array.isArray(filterValToDisplay) ? filterValToDisplay : filterValToDisplay && filterValToDisplay.split(";");
|
|
50466
|
+
const SubComponentToUse = React$1.useMemo(() => {
|
|
50467
|
+
if (SubComponent) {
|
|
50468
|
+
return (row) => {
|
|
50469
|
+
let shouldShow = true;
|
|
50470
|
+
if (shouldShowSubComponent) {
|
|
50471
|
+
shouldShow = shouldShowSubComponent(row.original);
|
|
50433
50472
|
}
|
|
50434
|
-
if (
|
|
50435
|
-
|
|
50473
|
+
if (shouldShow) {
|
|
50474
|
+
return SubComponent(row);
|
|
50436
50475
|
}
|
|
50437
|
-
|
|
50438
|
-
|
|
50439
|
-
|
|
50440
|
-
|
|
50441
|
-
|
|
50442
|
-
|
|
50443
|
-
|
|
50444
|
-
|
|
50445
|
-
|
|
50446
|
-
"
|
|
50447
|
-
|
|
50448
|
-
|
|
50449
|
-
|
|
50450
|
-
|
|
50451
|
-
|
|
50452
|
-
|
|
50453
|
-
|
|
50454
|
-
|
|
50455
|
-
|
|
50456
|
-
|
|
50457
|
-
|
|
50458
|
-
|
|
50459
|
-
|
|
50460
|
-
|
|
50461
|
-
|
|
50462
|
-
|
|
50463
|
-
|
|
50464
|
-
|
|
50465
|
-
|
|
50466
|
-
}
|
|
50467
|
-
|
|
50468
|
-
|
|
50469
|
-
|
|
50470
|
-
|
|
50471
|
-
|
|
50476
|
+
};
|
|
50477
|
+
}
|
|
50478
|
+
return;
|
|
50479
|
+
}, [SubComponent, shouldShowSubComponent]);
|
|
50480
|
+
const nonDisplayedFilterComp = React$1.useMemo(() => {
|
|
50481
|
+
if (filtersOnNonDisplayedFields.length) {
|
|
50482
|
+
const content2 = filtersOnNonDisplayedFields.map(
|
|
50483
|
+
({ displayName, path: path2, selectedFilter, filterValue }) => {
|
|
50484
|
+
let filterValToDisplay = filterValue;
|
|
50485
|
+
if (selectedFilter === "inList") {
|
|
50486
|
+
filterValToDisplay = Array.isArray(filterValToDisplay) ? filterValToDisplay : filterValToDisplay && filterValToDisplay.split(";");
|
|
50487
|
+
}
|
|
50488
|
+
if (Array.isArray(filterValToDisplay)) {
|
|
50489
|
+
filterValToDisplay = filterValToDisplay.join(", ");
|
|
50490
|
+
}
|
|
50491
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
50492
|
+
"div",
|
|
50493
|
+
{
|
|
50494
|
+
key: displayName || startCase(camelCase(path2)),
|
|
50495
|
+
className: "tg-filter-on-non-displayed-field"
|
|
50496
|
+
},
|
|
50497
|
+
displayName || startCase(camelCase(path2)),
|
|
50498
|
+
" ",
|
|
50499
|
+
lowerCase(selectedFilter),
|
|
50500
|
+
" ",
|
|
50501
|
+
filterValToDisplay
|
|
50502
|
+
);
|
|
50503
|
+
}
|
|
50504
|
+
);
|
|
50505
|
+
return /* @__PURE__ */ React$1.createElement("div", { style: { marginRight: 5, marginLeft: "auto" } }, /* @__PURE__ */ React$1.createElement(
|
|
50506
|
+
core.Tooltip,
|
|
50507
|
+
{
|
|
50508
|
+
content: /* @__PURE__ */ React$1.createElement("div", null, "Active filters on hidden columns:", /* @__PURE__ */ React$1.createElement("br", null), /* @__PURE__ */ React$1.createElement("br", null), content2)
|
|
50509
|
+
},
|
|
50510
|
+
/* @__PURE__ */ React$1.createElement(core.Icon, { icon: "filter-list" })
|
|
50511
|
+
));
|
|
50512
|
+
}
|
|
50513
|
+
return null;
|
|
50514
|
+
}, [filtersOnNonDisplayedFields]);
|
|
50515
|
+
const filteredEnts = React$1.useMemo(() => {
|
|
50516
|
+
if (onlyShowRowsWErrors) {
|
|
50517
|
+
const rowToErrorMap = {};
|
|
50518
|
+
forEach(reduxFormCellValidation, (err, cellId) => {
|
|
50519
|
+
if (err) {
|
|
50520
|
+
const [rowId] = cellId.split(":");
|
|
50521
|
+
rowToErrorMap[rowId] = true;
|
|
50522
|
+
}
|
|
50523
|
+
});
|
|
50524
|
+
return entities.filter((e2) => {
|
|
50525
|
+
return rowToErrorMap[e2.id];
|
|
50526
|
+
});
|
|
50527
|
+
}
|
|
50528
|
+
return entities;
|
|
50529
|
+
}, [entities, onlyShowRowsWErrors, reduxFormCellValidation]);
|
|
50472
50530
|
const renderColumns = React$1.useMemo(
|
|
50473
|
-
() => RenderColumns(
|
|
50531
|
+
() => RenderColumns({
|
|
50474
50532
|
addFilters,
|
|
50475
50533
|
cellRenderer,
|
|
50476
50534
|
change,
|
|
@@ -50523,7 +50581,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
50523
50581
|
withExpandAndCollapseAllButton,
|
|
50524
50582
|
withFilter,
|
|
50525
50583
|
withSort
|
|
50526
|
-
})
|
|
50584
|
+
}),
|
|
50527
50585
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50528
50586
|
[
|
|
50529
50587
|
SubComponent,
|
|
@@ -63281,86 +63339,89 @@ const Uploader = /* @__PURE__ */ __name(({
|
|
|
63281
63339
|
threeDotMenuItems,
|
|
63282
63340
|
validateAgainstSchema: _validateAgainstSchema
|
|
63283
63341
|
}) => {
|
|
63342
|
+
var _a, _b;
|
|
63284
63343
|
const dispatch = reactRedux.useDispatch();
|
|
63285
63344
|
const [acceptLoading, setAcceptLoading] = React$1.useState();
|
|
63286
63345
|
const [resolvedAccept, setResolvedAccept] = React$1.useState();
|
|
63287
63346
|
const [loading, setLoading] = React$1.useState(false);
|
|
63288
63347
|
const filesToClean = React$1.useRef([]);
|
|
63289
|
-
const onChange =
|
|
63290
|
-
(
|
|
63291
|
-
|
|
63292
|
-
|
|
63293
|
-
|
|
63294
|
-
|
|
63295
|
-
|
|
63296
|
-
|
|
63297
|
-
|
|
63298
|
-
|
|
63299
|
-
|
|
63300
|
-
|
|
63301
|
-
|
|
63302
|
-
(
|
|
63303
|
-
|
|
63304
|
-
|
|
63305
|
-
|
|
63306
|
-
|
|
63307
|
-
|
|
63308
|
-
|
|
63309
|
-
|
|
63310
|
-
|
|
63311
|
-
|
|
63312
|
-
|
|
63313
|
-
|
|
63314
|
-
|
|
63315
|
-
|
|
63316
|
-
|
|
63317
|
-
|
|
63318
|
-
|
|
63319
|
-
onFileSuccess(res.data[0]).then(() => {
|
|
63320
|
-
cleanedFileList = cleanedFileList.map((file) => {
|
|
63321
|
-
const fileToReturn = __spreadValues(__spreadValues({}, file), res.data[0]);
|
|
63322
|
-
if (fileToReturn.id === fileToUpload.id) {
|
|
63323
|
-
fileToReturn.loading = false;
|
|
63324
|
-
}
|
|
63325
|
-
return fileToReturn;
|
|
63326
|
-
});
|
|
63327
|
-
onChange(cleanedFileList);
|
|
63328
|
-
});
|
|
63329
|
-
} catch (err) {
|
|
63330
|
-
console.error("Error uploading file:", err);
|
|
63331
|
-
responses.push(__spreadProps(__spreadValues({}, fileToUpload), {
|
|
63332
|
-
error: err && err.msg ? err.msg : err
|
|
63333
|
-
}));
|
|
63348
|
+
const onChange = /* @__PURE__ */ __name((val) => {
|
|
63349
|
+
require$$2$1.flushSync(() => {
|
|
63350
|
+
if (noRedux) {
|
|
63351
|
+
return _onChange(val);
|
|
63352
|
+
}
|
|
63353
|
+
dispatch(reduxForm.touch(formName, name));
|
|
63354
|
+
dispatch(reduxForm.change(formName, name, val));
|
|
63355
|
+
});
|
|
63356
|
+
}, "onChange");
|
|
63357
|
+
const handleSecondHalfOfUpload = /* @__PURE__ */ __name((_0) => __async(exports, [_0], function* ({
|
|
63358
|
+
acceptedFiles,
|
|
63359
|
+
cleanedFileList
|
|
63360
|
+
}) {
|
|
63361
|
+
onChange(cleanedFileList);
|
|
63362
|
+
const keepGoing = beforeUpload ? yield beforeUpload(cleanedFileList, onChange) : true;
|
|
63363
|
+
if (!keepGoing)
|
|
63364
|
+
return;
|
|
63365
|
+
if (action) {
|
|
63366
|
+
const responses = [];
|
|
63367
|
+
yield Promise.all(
|
|
63368
|
+
acceptedFiles.map((fileToUpload) => __async(exports, null, function* () {
|
|
63369
|
+
const data = new FormData();
|
|
63370
|
+
data.append("file", fileToUpload);
|
|
63371
|
+
try {
|
|
63372
|
+
const res = yield window.serverApi ? window.serverApi.post(action, data) : fetch(action, {
|
|
63373
|
+
method: "POST",
|
|
63374
|
+
body: data
|
|
63375
|
+
});
|
|
63376
|
+
responses.push(res.data && res.data[0]);
|
|
63377
|
+
onFileSuccess(res.data[0]).then(() => {
|
|
63334
63378
|
cleanedFileList = cleanedFileList.map((file) => {
|
|
63335
|
-
const fileToReturn = __spreadValues({}, file);
|
|
63379
|
+
const fileToReturn = __spreadValues(__spreadValues({}, file), res.data[0]);
|
|
63336
63380
|
if (fileToReturn.id === fileToUpload.id) {
|
|
63337
63381
|
fileToReturn.loading = false;
|
|
63338
|
-
fileToReturn.error = true;
|
|
63339
63382
|
}
|
|
63340
63383
|
return fileToReturn;
|
|
63341
63384
|
});
|
|
63342
63385
|
onChange(cleanedFileList);
|
|
63343
|
-
}
|
|
63344
|
-
}))
|
|
63345
|
-
);
|
|
63346
|
-
onFieldSubmit(responses);
|
|
63347
|
-
} else {
|
|
63348
|
-
onChange(
|
|
63349
|
-
cleanedFileList.map(function(file) {
|
|
63350
|
-
return __spreadProps(__spreadValues({}, file), {
|
|
63351
|
-
loading: false
|
|
63352
63386
|
});
|
|
63353
|
-
})
|
|
63354
|
-
|
|
63355
|
-
|
|
63356
|
-
|
|
63357
|
-
|
|
63358
|
-
|
|
63359
|
-
|
|
63387
|
+
} catch (err) {
|
|
63388
|
+
console.error("Error uploading file:", err);
|
|
63389
|
+
responses.push(__spreadProps(__spreadValues({}, fileToUpload), {
|
|
63390
|
+
error: err && err.msg ? err.msg : err
|
|
63391
|
+
}));
|
|
63392
|
+
cleanedFileList = cleanedFileList.map((file) => {
|
|
63393
|
+
const fileToReturn = __spreadValues({}, file);
|
|
63394
|
+
if (fileToReturn.id === fileToUpload.id) {
|
|
63395
|
+
fileToReturn.loading = false;
|
|
63396
|
+
fileToReturn.error = true;
|
|
63397
|
+
}
|
|
63398
|
+
return fileToReturn;
|
|
63399
|
+
});
|
|
63400
|
+
onChange(cleanedFileList);
|
|
63401
|
+
}
|
|
63402
|
+
}))
|
|
63403
|
+
);
|
|
63404
|
+
onFieldSubmit(responses);
|
|
63405
|
+
} else {
|
|
63406
|
+
onChange(
|
|
63407
|
+
cleanedFileList.map(function(file) {
|
|
63408
|
+
return __spreadProps(__spreadValues({}, file), {
|
|
63409
|
+
loading: false
|
|
63410
|
+
});
|
|
63411
|
+
})
|
|
63412
|
+
);
|
|
63413
|
+
}
|
|
63414
|
+
setLoading(false);
|
|
63415
|
+
}), "handleSecondHalfOfUpload");
|
|
63360
63416
|
const isAcceptPromise = React$1.useMemo(
|
|
63361
63417
|
() => (__accept == null ? void 0 : __accept.then) || (Array.isArray(__accept) ? __accept.some((acc) => acc == null ? void 0 : acc.then) : false),
|
|
63362
63418
|
[__accept]
|
|
63363
63419
|
);
|
|
63420
|
+
let dropzoneDisabled = _disabled;
|
|
63421
|
+
let _accept = __accept;
|
|
63422
|
+
if (resolvedAccept) {
|
|
63423
|
+
_accept = resolvedAccept;
|
|
63424
|
+
}
|
|
63364
63425
|
React$1.useEffect(() => {
|
|
63365
63426
|
if (isAcceptPromise) {
|
|
63366
63427
|
setAcceptLoading(true);
|
|
@@ -63373,234 +63434,208 @@ const Uploader = /* @__PURE__ */ __name(({
|
|
|
63373
63434
|
);
|
|
63374
63435
|
}
|
|
63375
63436
|
}, [__accept, isAcceptPromise]);
|
|
63376
|
-
|
|
63377
|
-
|
|
63378
|
-
|
|
63379
|
-
|
|
63380
|
-
|
|
63381
|
-
|
|
63382
|
-
}
|
|
63383
|
-
|
|
63384
|
-
|
|
63385
|
-
|
|
63386
|
-
|
|
63387
|
-
const validateAgainstSchema2 = setValidateAgainstSchema(
|
|
63388
|
-
_validateAgainstSchema || ((_b = (_a = newAccept == null ? void 0 : newAccept.find) == null ? void 0 : _a.call(newAccept, (a2) => a2 == null ? void 0 : a2.validateAgainstSchema)) == null ? void 0 : _b.validateAgainstSchema)
|
|
63389
|
-
);
|
|
63390
|
-
if ((validateAgainstSchema2 || autoUnzip) && newAccept && !newAccept.some((a2) => a2.type === "zip")) {
|
|
63391
|
-
newAccept == null ? void 0 : newAccept.unshift({
|
|
63392
|
-
type: "zip",
|
|
63393
|
-
description: "Any of the following types, just compressed"
|
|
63394
|
-
});
|
|
63395
|
-
}
|
|
63396
|
-
return { accept: newAccept, validateAgainstSchema: validateAgainstSchema2 };
|
|
63397
|
-
}, [
|
|
63398
|
-
__accept,
|
|
63399
|
-
_validateAgainstSchema,
|
|
63400
|
-
autoUnzip,
|
|
63401
|
-
isAcceptPromise,
|
|
63402
|
-
resolvedAccept
|
|
63403
|
-
]);
|
|
63404
|
-
const callout = React$1.useMemo(
|
|
63437
|
+
if (isAcceptPromise && !resolvedAccept) {
|
|
63438
|
+
_accept = [];
|
|
63439
|
+
}
|
|
63440
|
+
if (acceptLoading)
|
|
63441
|
+
dropzoneDisabled = true;
|
|
63442
|
+
const accept = React$1.useMemo(
|
|
63443
|
+
() => !_accept ? void 0 : isAcceptPromise && !resolvedAccept ? [] : isPlainObject$3(_accept) ? [_accept] : isArray$j(_accept) ? _accept : _accept.split(",").map((acc) => ({ type: acc })),
|
|
63444
|
+
[_accept, isAcceptPromise, resolvedAccept]
|
|
63445
|
+
);
|
|
63446
|
+
const callout = _callout || ((_b = (_a = accept == null ? void 0 : accept.find) == null ? void 0 : _a.call(accept, (a2) => a2 == null ? void 0 : a2.callout)) == null ? void 0 : _b.callout);
|
|
63447
|
+
const validateAgainstSchema = React$1.useMemo(
|
|
63405
63448
|
() => {
|
|
63406
|
-
var
|
|
63407
|
-
return
|
|
63449
|
+
var _a2, _b2;
|
|
63450
|
+
return setValidateAgainstSchema(
|
|
63451
|
+
_validateAgainstSchema || ((_b2 = (_a2 = accept == null ? void 0 : accept.find) == null ? void 0 : _a2.call(accept, (a2) => a2 == null ? void 0 : a2.validateAgainstSchema)) == null ? void 0 : _b2.validateAgainstSchema)
|
|
63452
|
+
);
|
|
63408
63453
|
},
|
|
63409
|
-
[
|
|
63454
|
+
[_validateAgainstSchema, accept]
|
|
63410
63455
|
);
|
|
63456
|
+
if ((validateAgainstSchema || autoUnzip) && accept && !accept.some((a2) => a2.type === "zip")) {
|
|
63457
|
+
accept == null ? void 0 : accept.unshift({
|
|
63458
|
+
type: "zip",
|
|
63459
|
+
description: "Any of the following types, just compressed"
|
|
63460
|
+
});
|
|
63461
|
+
}
|
|
63411
63462
|
const { showDialogPromise: showUploadCsvWizardDialog, Comp } = useDialog({
|
|
63412
63463
|
ModalComponent: UploadCsvWizardDialog
|
|
63413
63464
|
});
|
|
63414
63465
|
const { showDialogPromise: showSimpleInsertDataDialog, Comp: Comp2 } = useDialog({
|
|
63415
63466
|
ModalComponent: SimpleInsertDataDialog
|
|
63416
63467
|
});
|
|
63417
|
-
|
|
63468
|
+
function cleanupFiles() {
|
|
63418
63469
|
filesToClean.current.forEach((file) => URL.revokeObjectURL(file.preview));
|
|
63419
|
-
}
|
|
63470
|
+
}
|
|
63471
|
+
__name(cleanupFiles, "cleanupFiles");
|
|
63420
63472
|
React$1.useEffect(() => {
|
|
63421
63473
|
return () => {
|
|
63422
63474
|
cleanupFiles();
|
|
63423
63475
|
};
|
|
63424
|
-
}, [
|
|
63425
|
-
|
|
63426
|
-
|
|
63427
|
-
|
|
63428
|
-
|
|
63429
|
-
|
|
63430
|
-
|
|
63431
|
-
|
|
63432
|
-
|
|
63433
|
-
|
|
63434
|
-
|
|
63435
|
-
|
|
63436
|
-
|
|
63437
|
-
|
|
63438
|
-
|
|
63439
|
-
|
|
63440
|
-
|
|
63441
|
-
|
|
63442
|
-
|
|
63443
|
-
|
|
63444
|
-
}
|
|
63445
|
-
handleManuallyEnterData2 = /* @__PURE__ */ __name((e2) => __async(exports, null, function* () {
|
|
63446
|
-
e2.stopPropagation();
|
|
63447
|
-
const { newEntities, fileName } = yield showSimpleInsertDataDialog(
|
|
63448
|
-
"onSimpleInsertDialogFinish",
|
|
63449
|
-
{
|
|
63450
|
-
validateAgainstSchema
|
|
63451
|
-
}
|
|
63452
|
-
);
|
|
63453
|
-
if (!newEntities)
|
|
63454
|
-
return;
|
|
63455
|
-
const newFileName = getNewName(fileListToUse, fileName);
|
|
63456
|
-
const { newFile, cleanedEntities } = getNewCsvFile(
|
|
63457
|
-
newEntities,
|
|
63458
|
-
newFileName
|
|
63459
|
-
);
|
|
63460
|
-
const file = __spreadProps(__spreadValues({}, newFile), {
|
|
63461
|
-
parsedData: cleanedEntities,
|
|
63462
|
-
meta: {
|
|
63463
|
-
fields: validateAgainstSchema.fields.map(({ path: path2 }) => path2)
|
|
63464
|
-
},
|
|
63465
|
-
name: newFileName,
|
|
63466
|
-
originFileObj: newFile,
|
|
63467
|
-
originalFileObj: newFile,
|
|
63468
|
-
id: nanoid(),
|
|
63469
|
-
hasEditClick: true
|
|
63470
|
-
});
|
|
63471
|
-
const cleanedFileList = [file, ...fileListToUse].slice(
|
|
63472
|
-
0,
|
|
63473
|
-
fileLimit ? fileLimit : void 0
|
|
63474
|
-
);
|
|
63475
|
-
handleSecondHalfOfUpload({
|
|
63476
|
-
acceptedFiles: cleanedFileList,
|
|
63477
|
-
cleanedFileList
|
|
63478
|
-
});
|
|
63479
|
-
window.toastr.success(`File Added`);
|
|
63480
|
-
}), "handleManuallyEnterData2");
|
|
63481
|
-
const nameToUse = startCase(
|
|
63482
|
-
removeExt(
|
|
63483
|
-
validateAgainstSchema.fileName || validateAgainstSchema.name
|
|
63484
|
-
)
|
|
63485
|
-
) || "Example";
|
|
63486
|
-
const handleDownloadXlsxFile = /* @__PURE__ */ __name(() => __async(exports, null, function* () {
|
|
63487
|
-
var _a;
|
|
63488
|
-
const dataDictionarySchema = [
|
|
63489
|
-
{
|
|
63490
|
-
value: (f2) => f2.displayName || f2.path,
|
|
63491
|
-
column: `Column Name`
|
|
63492
|
-
},
|
|
63493
|
-
// {
|
|
63494
|
-
// value: f => f.isUnique ? "Unique" : "",
|
|
63495
|
-
// column: `Unique?`
|
|
63496
|
-
// },
|
|
63497
|
-
{
|
|
63498
|
-
value: (f2) => f2.isRequired ? "Required" : "Optional",
|
|
63499
|
-
column: `Required?`
|
|
63500
|
-
},
|
|
63501
|
-
{
|
|
63502
|
-
value: (f2) => f2.type === "dropdown" ? "text" : f2.type || "text",
|
|
63503
|
-
column: `Data Type`
|
|
63504
|
-
},
|
|
63505
|
-
{
|
|
63506
|
-
value: (f2) => f2.description,
|
|
63507
|
-
column: `Notes`
|
|
63508
|
-
},
|
|
63509
|
-
{
|
|
63510
|
-
value: (f2) => f2.example || f2.defaultValue || "",
|
|
63511
|
-
column: `Example Data`
|
|
63512
|
-
}
|
|
63513
|
-
];
|
|
63514
|
-
const mainExampleData = {};
|
|
63515
|
-
const fieldsToUse = [
|
|
63516
|
-
...validateAgainstSchema.fields,
|
|
63517
|
-
...(_a = validateAgainstSchema.exampleDownloadFields) != null ? _a : []
|
|
63518
|
-
];
|
|
63519
|
-
const mainSchema = fieldsToUse.map((f2) => {
|
|
63520
|
-
mainExampleData[f2.displayName || f2.path] = f2.example || f2.defaultValue;
|
|
63521
|
-
return {
|
|
63522
|
-
column: f2.displayName || f2.path,
|
|
63523
|
-
value: (v2) => {
|
|
63524
|
-
return v2[f2.displayName || f2.path];
|
|
63525
|
-
}
|
|
63526
|
-
};
|
|
63527
|
-
});
|
|
63528
|
-
const blobFile = yield writeXlsxFile(
|
|
63529
|
-
[[mainExampleData], fieldsToUse, helperText],
|
|
63530
|
-
{
|
|
63531
|
-
headerStyle: {
|
|
63532
|
-
fontWeight: "bold"
|
|
63533
|
-
},
|
|
63534
|
-
schema: [mainSchema, dataDictionarySchema, helperSchema],
|
|
63535
|
-
sheets: [nameToUse, "Column Info", "Upload Instructions"],
|
|
63536
|
-
filePath: "file.xlsx"
|
|
63537
|
-
}
|
|
63538
|
-
);
|
|
63539
|
-
downloadjs(blobFile, `${nameToUse}.xlsx`, "xlsx");
|
|
63540
|
-
}), "handleDownloadXlsxFile");
|
|
63541
|
-
acc.exampleFiles = [
|
|
63542
|
-
// ...(a.exampleFile ? [a.exampleFile] : []),
|
|
63476
|
+
}, []);
|
|
63477
|
+
let contentOverride = maybeContentOverride;
|
|
63478
|
+
if (contentOverride && typeof contentOverride === "function") {
|
|
63479
|
+
contentOverride = contentOverride({ loading });
|
|
63480
|
+
}
|
|
63481
|
+
let simpleAccept;
|
|
63482
|
+
let handleManuallyEnterData;
|
|
63483
|
+
let advancedAccept;
|
|
63484
|
+
if (Array.isArray(accept)) {
|
|
63485
|
+
if (accept.some((acc) => isPlainObject$3(acc))) {
|
|
63486
|
+
advancedAccept = accept;
|
|
63487
|
+
simpleAccept = flatMap(accept, (acc) => {
|
|
63488
|
+
if (acc.validateAgainstSchema) {
|
|
63489
|
+
if (!acc.type) {
|
|
63490
|
+
acc.type = [".csv", ".xlsx"];
|
|
63491
|
+
}
|
|
63492
|
+
handleManuallyEnterData = /* @__PURE__ */ __name((e2) => __async(exports, null, function* () {
|
|
63493
|
+
e2.stopPropagation();
|
|
63494
|
+
const { newEntities, fileName } = yield showSimpleInsertDataDialog(
|
|
63495
|
+
"onSimpleInsertDialogFinish",
|
|
63543
63496
|
{
|
|
63544
|
-
|
|
63545
|
-
|
|
63546
|
-
|
|
63547
|
-
|
|
63548
|
-
|
|
63549
|
-
|
|
63550
|
-
|
|
63551
|
-
|
|
63552
|
-
|
|
63553
|
-
|
|
63554
|
-
|
|
63555
|
-
|
|
63556
|
-
|
|
63557
|
-
|
|
63558
|
-
schemaToUse.map((f2) => {
|
|
63559
|
-
return `${f2.example || f2.defaultValue || ""}`;
|
|
63560
|
-
})
|
|
63561
|
-
);
|
|
63562
|
-
const csv = papaparse_minExports.unparse(rows);
|
|
63563
|
-
const downloadFn = ((_b = window.Cypress) == null ? void 0 : _b.downloadTest) || downloadjs;
|
|
63564
|
-
downloadFn(csv, `${nameToUse}.csv`, "csv");
|
|
63565
|
-
}
|
|
63497
|
+
validateAgainstSchema
|
|
63498
|
+
}
|
|
63499
|
+
);
|
|
63500
|
+
if (!newEntities)
|
|
63501
|
+
return;
|
|
63502
|
+
const newFileName = getNewName(fileListToUse, fileName);
|
|
63503
|
+
const { newFile, cleanedEntities } = getNewCsvFile(
|
|
63504
|
+
newEntities,
|
|
63505
|
+
newFileName
|
|
63506
|
+
);
|
|
63507
|
+
const file = __spreadProps(__spreadValues({}, newFile), {
|
|
63508
|
+
parsedData: cleanedEntities,
|
|
63509
|
+
meta: {
|
|
63510
|
+
fields: validateAgainstSchema.fields.map(({ path: path2 }) => path2)
|
|
63566
63511
|
},
|
|
63512
|
+
name: newFileName,
|
|
63513
|
+
originFileObj: newFile,
|
|
63514
|
+
originalFileObj: newFile,
|
|
63515
|
+
id: nanoid(),
|
|
63516
|
+
hasEditClick: true
|
|
63517
|
+
});
|
|
63518
|
+
const cleanedFileList = [file, ...fileListToUse].slice(
|
|
63519
|
+
0,
|
|
63520
|
+
fileLimit ? fileLimit : void 0
|
|
63521
|
+
);
|
|
63522
|
+
handleSecondHalfOfUpload({
|
|
63523
|
+
acceptedFiles: cleanedFileList,
|
|
63524
|
+
cleanedFileList
|
|
63525
|
+
});
|
|
63526
|
+
window.toastr.success(`File Added`);
|
|
63527
|
+
}), "handleManuallyEnterData");
|
|
63528
|
+
const nameToUse = startCase(
|
|
63529
|
+
removeExt(
|
|
63530
|
+
validateAgainstSchema.fileName || validateAgainstSchema.name
|
|
63531
|
+
)
|
|
63532
|
+
) || "Example";
|
|
63533
|
+
const handleDownloadXlsxFile = /* @__PURE__ */ __name(() => __async(exports, null, function* () {
|
|
63534
|
+
var _a2;
|
|
63535
|
+
const dataDictionarySchema = [
|
|
63536
|
+
{ value: (f2) => f2.displayName || f2.path, column: `Column Name` },
|
|
63537
|
+
// {
|
|
63538
|
+
// value: f => f.isUnique ? "Unique" : "",
|
|
63539
|
+
// column: `Unique?`
|
|
63540
|
+
// },
|
|
63567
63541
|
{
|
|
63568
|
-
|
|
63569
|
-
|
|
63570
|
-
exampleFile: handleDownloadXlsxFile
|
|
63542
|
+
value: (f2) => f2.isRequired ? "Required" : "Optional",
|
|
63543
|
+
column: `Required?`
|
|
63571
63544
|
},
|
|
63572
|
-
|
|
63573
|
-
|
|
63574
|
-
|
|
63575
|
-
|
|
63576
|
-
|
|
63577
|
-
|
|
63578
|
-
|
|
63579
|
-
|
|
63545
|
+
{
|
|
63546
|
+
value: (f2) => f2.type === "dropdown" ? "text" : f2.type || "text",
|
|
63547
|
+
column: `Data Type`
|
|
63548
|
+
},
|
|
63549
|
+
{
|
|
63550
|
+
value: (f2) => f2.description,
|
|
63551
|
+
column: `Notes`
|
|
63552
|
+
},
|
|
63553
|
+
{
|
|
63554
|
+
value: (f2) => f2.example || f2.defaultValue || "",
|
|
63555
|
+
column: `Example Data`
|
|
63556
|
+
}
|
|
63580
63557
|
];
|
|
63581
|
-
|
|
63582
|
-
|
|
63583
|
-
|
|
63584
|
-
|
|
63585
|
-
|
|
63586
|
-
|
|
63587
|
-
|
|
63588
|
-
|
|
63589
|
-
|
|
63590
|
-
|
|
63558
|
+
const mainExampleData = {};
|
|
63559
|
+
const fieldsToUse = [
|
|
63560
|
+
...validateAgainstSchema.fields,
|
|
63561
|
+
...(_a2 = validateAgainstSchema.exampleDownloadFields) != null ? _a2 : []
|
|
63562
|
+
];
|
|
63563
|
+
const mainSchema = fieldsToUse.map((f2) => {
|
|
63564
|
+
mainExampleData[f2.displayName || f2.path] = f2.example || f2.defaultValue;
|
|
63565
|
+
return {
|
|
63566
|
+
column: f2.displayName || f2.path,
|
|
63567
|
+
value: (v2) => {
|
|
63568
|
+
return v2[f2.displayName || f2.path];
|
|
63569
|
+
}
|
|
63570
|
+
};
|
|
63571
|
+
});
|
|
63572
|
+
const blobFile = yield writeXlsxFile(
|
|
63573
|
+
[[mainExampleData], fieldsToUse, helperText],
|
|
63574
|
+
{
|
|
63575
|
+
headerStyle: {
|
|
63576
|
+
fontWeight: "bold"
|
|
63577
|
+
},
|
|
63578
|
+
schema: [mainSchema, dataDictionarySchema, helperSchema],
|
|
63579
|
+
sheets: [nameToUse, "Column Info", "Upload Instructions"],
|
|
63580
|
+
filePath: "file.xlsx"
|
|
63581
|
+
}
|
|
63582
|
+
);
|
|
63583
|
+
downloadjs(blobFile, `${nameToUse}.xlsx`, "xlsx");
|
|
63584
|
+
}), "handleDownloadXlsxFile");
|
|
63585
|
+
acc.exampleFiles = [
|
|
63586
|
+
// ...(a.exampleFile ? [a.exampleFile] : []),
|
|
63587
|
+
{
|
|
63588
|
+
description: "Download Example CSV File",
|
|
63589
|
+
exampleFile: () => {
|
|
63590
|
+
var _a2, _b2;
|
|
63591
|
+
const rows = [];
|
|
63592
|
+
const schemaToUse = [
|
|
63593
|
+
...acc.validateAgainstSchema.fields,
|
|
63594
|
+
...(_a2 = acc.validateAgainstSchema.exampleDownloadFields) != null ? _a2 : []
|
|
63595
|
+
];
|
|
63596
|
+
rows.push(
|
|
63597
|
+
schemaToUse.map((f2) => {
|
|
63598
|
+
return `${f2.displayName || f2.path}`;
|
|
63599
|
+
})
|
|
63600
|
+
);
|
|
63601
|
+
rows.push(
|
|
63602
|
+
schemaToUse.map((f2) => {
|
|
63603
|
+
return `${f2.example || f2.defaultValue || ""}`;
|
|
63604
|
+
})
|
|
63605
|
+
);
|
|
63606
|
+
const csv = papaparse_minExports.unparse(rows);
|
|
63607
|
+
const downloadFn = ((_b2 = window.Cypress) == null ? void 0 : _b2.downloadTest) || downloadjs;
|
|
63608
|
+
downloadFn(csv, `${nameToUse}.csv`, "csv");
|
|
63609
|
+
}
|
|
63610
|
+
},
|
|
63611
|
+
{
|
|
63612
|
+
description: "Download Example XLSX File",
|
|
63613
|
+
subtext: "Includes Upload Instructions and Column Info",
|
|
63614
|
+
exampleFile: handleDownloadXlsxFile
|
|
63615
|
+
},
|
|
63616
|
+
...noBuildCsvOption ? [] : [
|
|
63617
|
+
{
|
|
63618
|
+
description: manualEnterMessage,
|
|
63619
|
+
subtext: manualEnterSubMessage,
|
|
63620
|
+
icon: "manually-entered-data",
|
|
63621
|
+
exampleFile: handleManuallyEnterData
|
|
63622
|
+
}
|
|
63623
|
+
]
|
|
63624
|
+
];
|
|
63625
|
+
delete acc.exampleFile;
|
|
63626
|
+
}
|
|
63627
|
+
if (acc.type)
|
|
63628
|
+
return acc.type;
|
|
63629
|
+
return acc;
|
|
63630
|
+
});
|
|
63631
|
+
simpleAccept = simpleAccept.join(", ");
|
|
63591
63632
|
} else {
|
|
63592
|
-
|
|
63633
|
+
simpleAccept = accept.join(", ");
|
|
63593
63634
|
}
|
|
63594
|
-
|
|
63595
|
-
|
|
63596
|
-
|
|
63597
|
-
|
|
63598
|
-
fileListToUse,
|
|
63599
|
-
handleSecondHalfOfUpload,
|
|
63600
|
-
noBuildCsvOption,
|
|
63601
|
-
showSimpleInsertDataDialog,
|
|
63602
|
-
validateAgainstSchema
|
|
63603
|
-
]);
|
|
63635
|
+
} else {
|
|
63636
|
+
simpleAccept = accept;
|
|
63637
|
+
}
|
|
63638
|
+
const fileListToUse = fileList ? fileList : [];
|
|
63604
63639
|
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, callout && /* @__PURE__ */ React$1.createElement(core.Callout, { style: { marginBottom: 5 }, intent: "primary" }, callout), /* @__PURE__ */ React$1.createElement(
|
|
63605
63640
|
"div",
|
|
63606
63641
|
{
|
|
@@ -63724,13 +63759,13 @@ const Uploader = /* @__PURE__ */ __name(({
|
|
|
63724
63759
|
multiple: fileLimit !== 1,
|
|
63725
63760
|
accept: simpleAccept ? simpleAccept.split(", ").map((acc) => acc.startsWith(".") ? acc : "." + acc).join(", ") : void 0,
|
|
63726
63761
|
onDrop: (_acceptedFiles, rejectedFiles) => __async(exports, null, function* () {
|
|
63727
|
-
var
|
|
63762
|
+
var _a2, _b2;
|
|
63728
63763
|
let acceptedFiles = [];
|
|
63729
63764
|
for (const file of _acceptedFiles) {
|
|
63730
63765
|
if ((validateAgainstSchema || autoUnzip) && isZipFile(file)) {
|
|
63731
63766
|
const files = yield filterFilesInZip(
|
|
63732
63767
|
file,
|
|
63733
|
-
((
|
|
63768
|
+
((_a2 = simpleAccept == null ? void 0 : simpleAccept.split(", ")) == null ? void 0 : _a2.map((acc) => acc.startsWith(".") ? acc : "." + acc)) || []
|
|
63734
63769
|
);
|
|
63735
63770
|
acceptedFiles.push(...files.map((f2) => f2.originFileObj));
|
|
63736
63771
|
} else {
|
|
@@ -63825,7 +63860,7 @@ const Uploader = /* @__PURE__ */ __name(({
|
|
|
63825
63860
|
incomingData: parsedF.data,
|
|
63826
63861
|
validateAgainstSchema
|
|
63827
63862
|
});
|
|
63828
|
-
if (((
|
|
63863
|
+
if (((_b2 = userSchema == null ? void 0 : userSchema.userData) == null ? void 0 : _b2.length) === 0) {
|
|
63829
63864
|
console.error(
|
|
63830
63865
|
`userSchema, parsedF.data:`,
|
|
63831
63866
|
userSchema,
|
|
@@ -64358,6 +64393,20 @@ const withStore = /* @__PURE__ */ __name((Component) => {
|
|
|
64358
64393
|
return /* @__PURE__ */ React$1.createElement(Component, __spreadProps(__spreadValues({}, props), { store }));
|
|
64359
64394
|
};
|
|
64360
64395
|
}, "withStore");
|
|
64396
|
+
const isEq = /* @__PURE__ */ __name((o1, o2) => {
|
|
64397
|
+
const isEq2 = isEqualWith(o1, o2, function(val1, val2) {
|
|
64398
|
+
if (isFunction$4(val1) && isFunction$4(val2)) {
|
|
64399
|
+
return val1 === val2 || val1.toString() === val2.toString();
|
|
64400
|
+
}
|
|
64401
|
+
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
64402
|
+
return true;
|
|
64403
|
+
});
|
|
64404
|
+
return isEq2;
|
|
64405
|
+
}, "isEq");
|
|
64406
|
+
const pure = /* @__PURE__ */ __name((BaseComponent) => {
|
|
64407
|
+
const hoc = shouldUpdate((props, nextProps) => !isEq(props, nextProps));
|
|
64408
|
+
return hoc(BaseComponent);
|
|
64409
|
+
}, "pure");
|
|
64361
64410
|
function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
64362
64411
|
let topLevelOptions;
|
|
64363
64412
|
let Component;
|
|
@@ -70686,6 +70735,7 @@ exports.tickMenuEnhancer = tickMenuEnhancer;
|
|
|
70686
70735
|
exports.tubeIcon = tubeIcon;
|
|
70687
70736
|
exports.useDeepEqualMemo = useDeepEqualMemo;
|
|
70688
70737
|
exports.useDialog = useDialog;
|
|
70738
|
+
exports.useTableEntities = useTableEntities;
|
|
70689
70739
|
exports.useTraceUpdate = useTraceUpdate;
|
|
70690
70740
|
exports.withAbstractWrapper = withAbstractWrapper;
|
|
70691
70741
|
exports.withCommand = withCommand;
|