@mcurros2/microm 1.1.443-0 → 1.1.446-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +17 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -111
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -210,6 +210,7 @@ function $ed5512685e858344$export$f1f43a62560a15ec(props) {
|
|
|
210
210
|
]);
|
|
211
211
|
const getAbortController = (0, $b4te3$react.useRef)(new AbortController);
|
|
212
212
|
const saveAbortController = (0, $b4te3$react.useRef)(new AbortController);
|
|
213
|
+
const navigationProtectionBypassRef = (0, $b4te3$react.useRef)(false);
|
|
213
214
|
const getInFlightRef = (0, $b4te3$react.useRef)(false);
|
|
214
215
|
const cancellableSaveInFlightRef = (0, $b4te3$react.useRef)(false);
|
|
215
216
|
const preserveSilentSaveOnUnmountRef = (0, $b4te3$react.useRef)(false);
|
|
@@ -417,6 +418,20 @@ function $ed5512685e858344$export$f1f43a62560a15ec(props) {
|
|
|
417
418
|
const removeValidation = (0, $b4te3$react.useCallback)((column)=>{
|
|
418
419
|
delete validationObject.current[column.name];
|
|
419
420
|
}, []);
|
|
421
|
+
const completeWithNavigationProtectionBypassed = (0, $b4te3$react.useCallback)(async (complete)=>{
|
|
422
|
+
navigationProtectionBypassRef.current = true;
|
|
423
|
+
try {
|
|
424
|
+
const result = await complete();
|
|
425
|
+
// Awaiting callers resume before the next timer, so immediate navigation stays unprotected.
|
|
426
|
+
setTimeout(()=>{
|
|
427
|
+
navigationProtectionBypassRef.current = false;
|
|
428
|
+
}, 0);
|
|
429
|
+
return result;
|
|
430
|
+
} catch (error) {
|
|
431
|
+
navigationProtectionBypassRef.current = false;
|
|
432
|
+
throw error;
|
|
433
|
+
}
|
|
434
|
+
}, []);
|
|
420
435
|
// MMC: silentSave handling
|
|
421
436
|
const silentSaveInFlight = (0, $b4te3$react.useRef)(null);
|
|
422
437
|
const silentSave = (0, $b4te3$react.useCallback)((requestOptions)=>{
|
|
@@ -508,12 +523,14 @@ function $ed5512685e858344$export$f1f43a62560a15ec(props) {
|
|
|
508
523
|
lastGetValues.current = completedValues;
|
|
509
524
|
if (mountedRef.current) form.resetDirty(completedValues);
|
|
510
525
|
if (action.refreshOnClose && mountedRef.current) await performGetData();
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
526
|
+
return await completeWithNavigationProtectionBypassed(async ()=>{
|
|
527
|
+
if (buttonName === 'OK' && onSaved) await Promise.resolve(onSaved(actionStatus ?? {
|
|
528
|
+
loading: false,
|
|
529
|
+
operationType: formMode
|
|
530
|
+
}));
|
|
531
|
+
if (buttonName === 'Cancel' && onCancel) await Promise.resolve(onCancel());
|
|
532
|
+
return true;
|
|
533
|
+
});
|
|
517
534
|
}
|
|
518
535
|
});
|
|
519
536
|
} catch (error) {
|
|
@@ -522,6 +539,7 @@ function $ed5512685e858344$export$f1f43a62560a15ec(props) {
|
|
|
522
539
|
return false;
|
|
523
540
|
}
|
|
524
541
|
}, [
|
|
542
|
+
completeWithNavigationProtectionBypassed,
|
|
525
543
|
entity,
|
|
526
544
|
form,
|
|
527
545
|
formMode,
|
|
@@ -579,23 +597,27 @@ function $ed5512685e858344$export$f1f43a62560a15ec(props) {
|
|
|
579
597
|
}
|
|
580
598
|
else save_result = await saveAndGet(saveAndGetOnSubmit || false);
|
|
581
599
|
const saved = save_result.error === undefined && save_result.data !== undefined && save_result.data.Failed !== true;
|
|
582
|
-
if (saved
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
600
|
+
if (!saved) return false;
|
|
601
|
+
return await completeWithNavigationProtectionBypassed(async ()=>{
|
|
602
|
+
if (onSaved) {
|
|
603
|
+
// MMC: fix for mantine DateInput bug "invalid date"
|
|
604
|
+
// check all form values for date columns and set them to null if invalid
|
|
605
|
+
// The bug happens when closing the form with invalid date values, after save
|
|
606
|
+
for(const c in entity.def.columns){
|
|
607
|
+
if ((0, $lTNXP.isIn)(entity.def.columns[c].type, 'date', 'datetime', 'datetime2', 'smalldatetime')) {
|
|
608
|
+
if (form.values[c]?.toString() === 'Invalid Date' || form.values[c]?.toString() === '') {
|
|
609
|
+
form.values[c] = null;
|
|
610
|
+
entity.def.columns[c].value = null;
|
|
611
|
+
}
|
|
591
612
|
}
|
|
592
613
|
}
|
|
614
|
+
await Promise.resolve(onSaved(save_result));
|
|
593
615
|
}
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
return saved;
|
|
616
|
+
return true;
|
|
617
|
+
});
|
|
597
618
|
}, [
|
|
598
619
|
activeFormActions.OK,
|
|
620
|
+
completeWithNavigationProtectionBypassed,
|
|
599
621
|
entity.def.columns,
|
|
600
622
|
form.values,
|
|
601
623
|
formMode,
|
|
@@ -621,6 +643,7 @@ function $ed5512685e858344$export$f1f43a62560a15ec(props) {
|
|
|
621
643
|
onCancel
|
|
622
644
|
]);
|
|
623
645
|
const hasUnsavedChanges = (0, $b4te3$react.useCallback)(()=>{
|
|
646
|
+
if (navigationProtectionBypassRef.current) return false;
|
|
624
647
|
if (navigationProtectionMode === 'allways') return true;
|
|
625
648
|
if (navigationProtectionMode === 'disabled') return false;
|
|
626
649
|
return form.isDirty() && !(0, $2cfmO.areValuesObjectsEqual)(form.values, lastGetValues.current);
|
|
@@ -7351,6 +7374,8 @@ parcelRegister("9GCyf", function(module, exports) {
|
|
|
7351
7374
|
|
|
7352
7375
|
$parcel$export(module.exports, "useHierarchyKeys", function () { return $7f5304fd68d04ed6$export$1dc6a021c60990b5; });
|
|
7353
7376
|
|
|
7377
|
+
parcelRequire("2eyXi");
|
|
7378
|
+
var $2cfmO = parcelRequire("2cfmO");
|
|
7354
7379
|
const $7f5304fd68d04ed6$var$generateParentKeysArray = (hierarchy, mappedHierarchy, values, changedIndex)=>{
|
|
7355
7380
|
return hierarchy.map((_, index)=>{
|
|
7356
7381
|
const parentKeys = {};
|
|
@@ -7364,12 +7389,7 @@ const $7f5304fd68d04ed6$var$generateParentKeysArray = (hierarchy, mappedHierarch
|
|
|
7364
7389
|
};
|
|
7365
7390
|
const $7f5304fd68d04ed6$var$areParentKeysArraysEqual = (left, right)=>{
|
|
7366
7391
|
if (left.length !== right.length) return false;
|
|
7367
|
-
return left.every((leftKeys, index)=>
|
|
7368
|
-
const rightKeys = right[index];
|
|
7369
|
-
const leftNames = Object.keys(leftKeys);
|
|
7370
|
-
const rightNames = Object.keys(rightKeys);
|
|
7371
|
-
return leftNames.length === rightNames.length && leftNames.every((name)=>leftKeys[name] === rightKeys[name]);
|
|
7372
|
-
});
|
|
7392
|
+
return left.every((leftKeys, index)=>(0, $2cfmO.areValuesObjectsEqual)(leftKeys, right[index]));
|
|
7373
7393
|
};
|
|
7374
7394
|
const $7f5304fd68d04ed6$var$areStringArraysEqual = (left, right)=>{
|
|
7375
7395
|
if (left === undefined || right === undefined) return left === right;
|
|
@@ -9302,6 +9322,8 @@ $parcel$export(module.exports, "DataGrid", function () { return $3ea298384e41b05
|
|
|
9302
9322
|
|
|
9303
9323
|
|
|
9304
9324
|
|
|
9325
|
+
parcelRequire("2eyXi");
|
|
9326
|
+
var $2cfmO = parcelRequire("2cfmO");
|
|
9305
9327
|
parcelRequire("7xGLy");
|
|
9306
9328
|
var $d50o9 = parcelRequire("d50o9");
|
|
9307
9329
|
var $lFsp3 = parcelRequire("lFsp3");
|
|
@@ -9322,6 +9344,8 @@ var $3vFhj = parcelRequire("3vFhj");
|
|
|
9322
9344
|
var $TMsro = parcelRequire("TMsro");
|
|
9323
9345
|
|
|
9324
9346
|
var $5JIrZ = parcelRequire("5JIrZ");
|
|
9347
|
+
|
|
9348
|
+
var $5hC9b = parcelRequire("5hC9b");
|
|
9325
9349
|
const $3ea298384e41b05b$export$7a235056ace2c138 = {
|
|
9326
9350
|
search: [],
|
|
9327
9351
|
limit: "10000",
|
|
@@ -9378,13 +9402,35 @@ const $3ea298384e41b05b$export$7a235056ace2c138 = {
|
|
|
9378
9402
|
};
|
|
9379
9403
|
function $3ea298384e41b05b$export$c8dd51eb24f71762(props) {
|
|
9380
9404
|
props = (0, $b4te3$mantinecore.useComponentDefaultProps)('DataGrid', $3ea298384e41b05b$export$7a235056ace2c138, props);
|
|
9405
|
+
const { executeRetainedSearch: executeRetainedSearch, ...retainedSearchProps } = (0, $5hC9b.useRetainedSearch)({
|
|
9406
|
+
retainSearch: props.retainSearch,
|
|
9407
|
+
search: props.search,
|
|
9408
|
+
onSearch: props.onSearch,
|
|
9409
|
+
onSearchTextChange: props.onSearchTextChange
|
|
9410
|
+
});
|
|
9411
|
+
props = {
|
|
9412
|
+
...props,
|
|
9413
|
+
...retainedSearchProps
|
|
9414
|
+
};
|
|
9381
9415
|
const { entity: entity, selectionMode: selectionMode, gridHeight: gridHeight, preserveSelection: preserveSelection, autoSelectFirstRow: autoSelectFirstRow, autoFocus: autoFocus, toolbarIconVariant: toolbarIconVariant, actionsButtonVariant: actionsButtonVariant, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, enableExport: enableExport, columnBorders: columnBorders, autoSizeColumnsOnLoad: autoSizeColumnsOnLoad, rowBorders: rowBorders, withBorder: withBorder, labels: labels, columnsOverrides: columnsOverrides, toolbarSize: toolbarSize, viewName: viewName, showActions: showActions, renderOnlyWhenVisible: renderOnlyWhenVisible, filtersFormSize: filtersFormSize, parentKeys: parentKeys, search: search, limit: limit, parentFormAPI: parentFormAPI, showToolbar: showToolbar, showActionsToolbar: showActionsToolbar, enableImport: enableImport, setInitialFiltersFromColumns: setInitialFiltersFromColumns, visibleFilters: visibleFilters, formMode: formMode, showColumnsConfigMenu: showColumnsConfigMenu, showSelectRowsButton: showSelectRowsButton, maxSearchTerms: maxSearchTerms, minGridHeight: minGridHeight, refreshOnInit: refreshOnInit, onSearch: onSearch, onSearchTextChange: onSearchTextChange, addActionName: addActionName, editActionName: editActionName, deleteActionName: deleteActionName, viewActionName: viewActionName } = props;
|
|
9382
9416
|
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
9383
9417
|
const visibilityDivRef = (0, $b4te3$react.useRef)(null);
|
|
9384
9418
|
const isFirstVisible = (0, $i27OQ.useFirstVisible)(visibilityDivRef);
|
|
9385
9419
|
const [searchData, setSearchData] = (0, $b4te3$react.useState)((0, $7B1hX.getInitialSearchData)(search) ?? []);
|
|
9386
9420
|
const viewState = (0, $7B1hX.useViewState)(search, limit);
|
|
9387
|
-
const [executeViewEnabled, setExecuteViewEnabled] = (0, $b4te3$react.useState)(refreshOnInit !== false);
|
|
9421
|
+
const [executeViewEnabled, setExecuteViewEnabled] = (0, $b4te3$react.useState)(refreshOnInit !== false || executeRetainedSearch);
|
|
9422
|
+
const [initialParentKeys] = (0, $b4te3$react.useState)(parentKeys);
|
|
9423
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
9424
|
+
if (executeViewEnabled) return;
|
|
9425
|
+
if (!executeRetainedSearch && (0, $2cfmO.areValuesObjectsEqual)(initialParentKeys, parentKeys)) return;
|
|
9426
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
9427
|
+
setExecuteViewEnabled(true);
|
|
9428
|
+
}, [
|
|
9429
|
+
executeRetainedSearch,
|
|
9430
|
+
executeViewEnabled,
|
|
9431
|
+
initialParentKeys,
|
|
9432
|
+
parentKeys
|
|
9433
|
+
]);
|
|
9388
9434
|
const executeViewState = (0, $lB8CV.useExecuteView)(entity, parentKeys, viewName, viewState.searchText, viewState.limitRows, viewState.refresh, viewState.filterValues, executeViewEnabled);
|
|
9389
9435
|
const dataGridAPI = (0, $5JIrZ.useDataGrid)(props, {
|
|
9390
9436
|
executeViewState: executeViewState,
|
|
@@ -34766,6 +34812,71 @@ function $8e67432a124f4bfb$export$f77741f33c48605(props, stateProps) {
|
|
|
34766
34812
|
|
|
34767
34813
|
});
|
|
34768
34814
|
|
|
34815
|
+
parcelRegister("5hC9b", function(module, exports) {
|
|
34816
|
+
|
|
34817
|
+
$parcel$export(module.exports, "useRetainedSearch", function () { return $77f9cb72fb2d6360$export$af39f590caec4ba9; });
|
|
34818
|
+
|
|
34819
|
+
|
|
34820
|
+
const $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION = 1;
|
|
34821
|
+
const $77f9cb72fb2d6360$var$RETAINED_SEARCH_PREFIX = "retained-search";
|
|
34822
|
+
const $77f9cb72fb2d6360$var$DISABLED_SEARCH_KEY = `${$77f9cb72fb2d6360$var$RETAINED_SEARCH_PREFIX}:disabled`;
|
|
34823
|
+
function $77f9cb72fb2d6360$var$createInitialState(initialSearch) {
|
|
34824
|
+
return {
|
|
34825
|
+
version: $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION,
|
|
34826
|
+
executed: false,
|
|
34827
|
+
terms: initialSearch ?? []
|
|
34828
|
+
};
|
|
34829
|
+
}
|
|
34830
|
+
function $77f9cb72fb2d6360$var$deserializeRetainedSearch(value, initialSearch) {
|
|
34831
|
+
try {
|
|
34832
|
+
const parsed = JSON.parse(value);
|
|
34833
|
+
if (parsed.version !== $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION || typeof parsed.executed !== "boolean" || !Array.isArray(parsed.terms) || !parsed.terms.every((term)=>typeof term === "string")) return $77f9cb72fb2d6360$var$createInitialState(initialSearch);
|
|
34834
|
+
return parsed;
|
|
34835
|
+
} catch {
|
|
34836
|
+
return $77f9cb72fb2d6360$var$createInitialState(initialSearch);
|
|
34837
|
+
}
|
|
34838
|
+
}
|
|
34839
|
+
function $77f9cb72fb2d6360$export$af39f590caec4ba9({ retainSearch: retainSearch, search: search, onSearch: onSearch, onSearchTextChange: onSearchTextChange }) {
|
|
34840
|
+
const [state, setState] = (0, $b4te3$mantinehooks.useSessionStorage)({
|
|
34841
|
+
key: retainSearch ? `${$77f9cb72fb2d6360$var$RETAINED_SEARCH_PREFIX}:${retainSearch}` : $77f9cb72fb2d6360$var$DISABLED_SEARCH_KEY,
|
|
34842
|
+
defaultValue: $77f9cb72fb2d6360$var$createInitialState(search),
|
|
34843
|
+
getInitialValueInEffect: false,
|
|
34844
|
+
deserialize: (value)=>$77f9cb72fb2d6360$var$deserializeRetainedSearch(value, search)
|
|
34845
|
+
});
|
|
34846
|
+
const handleSearch = (0, $b4te3$react.useCallback)((searchText)=>{
|
|
34847
|
+
setState(searchText?.length ? {
|
|
34848
|
+
version: $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION,
|
|
34849
|
+
executed: true,
|
|
34850
|
+
terms: searchText
|
|
34851
|
+
} : $77f9cb72fb2d6360$var$createInitialState());
|
|
34852
|
+
onSearch?.(searchText);
|
|
34853
|
+
}, [
|
|
34854
|
+
onSearch,
|
|
34855
|
+
setState
|
|
34856
|
+
]);
|
|
34857
|
+
const handleSearchTextChange = (0, $b4te3$react.useCallback)((searchText)=>{
|
|
34858
|
+
if (!searchText?.length) setState($77f9cb72fb2d6360$var$createInitialState());
|
|
34859
|
+
onSearchTextChange?.(searchText);
|
|
34860
|
+
}, [
|
|
34861
|
+
onSearchTextChange,
|
|
34862
|
+
setState
|
|
34863
|
+
]);
|
|
34864
|
+
if (!retainSearch) return {
|
|
34865
|
+
search: search,
|
|
34866
|
+
executeRetainedSearch: false,
|
|
34867
|
+
onSearch: onSearch,
|
|
34868
|
+
onSearchTextChange: onSearchTextChange
|
|
34869
|
+
};
|
|
34870
|
+
return {
|
|
34871
|
+
search: state.terms,
|
|
34872
|
+
executeRetainedSearch: state.executed,
|
|
34873
|
+
onSearch: handleSearch,
|
|
34874
|
+
onSearchTextChange: handleSearchTextChange
|
|
34875
|
+
};
|
|
34876
|
+
}
|
|
34877
|
+
|
|
34878
|
+
});
|
|
34879
|
+
|
|
34769
34880
|
|
|
34770
34881
|
parcelRegister("jLHxW", function(module, exports) {
|
|
34771
34882
|
|
|
@@ -35028,8 +35139,6 @@ parcelRequire("2Qb3Q");
|
|
|
35028
35139
|
var $kjFvY = parcelRequire("kjFvY");
|
|
35029
35140
|
|
|
35030
35141
|
var $8Yv4s = parcelRequire("8Yv4s");
|
|
35031
|
-
|
|
35032
|
-
var $5hC9b = parcelRequire("5hC9b");
|
|
35033
35142
|
const $8d0c133549cd711e$export$ca3c0aba4a54ad4 = {
|
|
35034
35143
|
actionsButtonVariant: 'light',
|
|
35035
35144
|
toolbarIconVariant: 'light',
|
|
@@ -35051,19 +35160,16 @@ function $8d0c133549cd711e$export$9cb50712304736e2(props) {
|
|
|
35051
35160
|
const { client: client, parentKeys: parentKeys, actionsButtonVariant: actionsButtonVariant, toolbarIconVariant: toolbarIconVariant, formMode: formMode, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, retainSearch: retainSearch, search: search, refreshOnInit: refreshOnInit, onSearch: onSearch, onSearchTextChange: onSearchTextChange, bgLight: bgLight, bgDark: bgDark, gridHeight: gridHeight, containerCardProps: containerCardProps, loadingComponent: loadingComponent, entityConstructor: entityConstructor, entityLoader: entityLoader, ...rest } = mergedProps;
|
|
35052
35161
|
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
35053
35162
|
const { result: entityBuilder, ready: entityReady } = (0, $8Yv4s.useResolvedEntityBuilder)(client, parentKeys, mergedProps);
|
|
35054
|
-
const retainedSearchProps = (0, $5hC9b.useRetainedSearch)({
|
|
35055
|
-
retainSearch: retainSearch,
|
|
35056
|
-
search: search,
|
|
35057
|
-
refreshOnInit: refreshOnInit,
|
|
35058
|
-
onSearch: onSearch,
|
|
35059
|
-
onSearchTextChange: onSearchTextChange
|
|
35060
|
-
});
|
|
35061
35163
|
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Card), {
|
|
35062
35164
|
bg: theme.colorScheme === "light" ? bgLight : bgDark,
|
|
35063
35165
|
...containerCardProps,
|
|
35064
35166
|
children: !entityReady || !entityBuilder ? loadingComponent : /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $kjFvY.DataGrid), {
|
|
35065
35167
|
...rest,
|
|
35066
|
-
|
|
35168
|
+
retainSearch: retainSearch,
|
|
35169
|
+
search: search,
|
|
35170
|
+
refreshOnInit: refreshOnInit,
|
|
35171
|
+
onSearch: onSearch,
|
|
35172
|
+
onSearchTextChange: onSearchTextChange,
|
|
35067
35173
|
parentKeys: parentKeys,
|
|
35068
35174
|
formMode: formMode,
|
|
35069
35175
|
enableAdd: enableAdd !== undefined ? enableAdd : formMode === "view" ? false : undefined,
|
|
@@ -35121,71 +35227,6 @@ function $37d1aaa86f76c559$export$c87356516bcec8d(client, parentKeys, source) {
|
|
|
35121
35227
|
|
|
35122
35228
|
});
|
|
35123
35229
|
|
|
35124
|
-
parcelRegister("5hC9b", function(module, exports) {
|
|
35125
|
-
|
|
35126
|
-
$parcel$export(module.exports, "useRetainedSearch", function () { return $77f9cb72fb2d6360$export$af39f590caec4ba9; });
|
|
35127
|
-
|
|
35128
|
-
|
|
35129
|
-
const $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION = 1;
|
|
35130
|
-
const $77f9cb72fb2d6360$var$RETAINED_SEARCH_PREFIX = "retained-search";
|
|
35131
|
-
const $77f9cb72fb2d6360$var$DISABLED_SEARCH_KEY = `${$77f9cb72fb2d6360$var$RETAINED_SEARCH_PREFIX}:disabled`;
|
|
35132
|
-
function $77f9cb72fb2d6360$var$createInitialState(initialSearch) {
|
|
35133
|
-
return {
|
|
35134
|
-
version: $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION,
|
|
35135
|
-
executed: false,
|
|
35136
|
-
terms: initialSearch ?? []
|
|
35137
|
-
};
|
|
35138
|
-
}
|
|
35139
|
-
function $77f9cb72fb2d6360$var$deserializeRetainedSearch(value, initialSearch) {
|
|
35140
|
-
try {
|
|
35141
|
-
const parsed = JSON.parse(value);
|
|
35142
|
-
if (parsed.version !== $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION || typeof parsed.executed !== "boolean" || !Array.isArray(parsed.terms) || !parsed.terms.every((term)=>typeof term === "string")) return $77f9cb72fb2d6360$var$createInitialState(initialSearch);
|
|
35143
|
-
return parsed;
|
|
35144
|
-
} catch {
|
|
35145
|
-
return $77f9cb72fb2d6360$var$createInitialState(initialSearch);
|
|
35146
|
-
}
|
|
35147
|
-
}
|
|
35148
|
-
function $77f9cb72fb2d6360$export$af39f590caec4ba9({ retainSearch: retainSearch, search: search, refreshOnInit: refreshOnInit, onSearch: onSearch, onSearchTextChange: onSearchTextChange }) {
|
|
35149
|
-
const [state, setState] = (0, $b4te3$mantinehooks.useSessionStorage)({
|
|
35150
|
-
key: retainSearch ? `${$77f9cb72fb2d6360$var$RETAINED_SEARCH_PREFIX}:${retainSearch}` : $77f9cb72fb2d6360$var$DISABLED_SEARCH_KEY,
|
|
35151
|
-
defaultValue: $77f9cb72fb2d6360$var$createInitialState(search),
|
|
35152
|
-
getInitialValueInEffect: false,
|
|
35153
|
-
deserialize: (value)=>$77f9cb72fb2d6360$var$deserializeRetainedSearch(value, search)
|
|
35154
|
-
});
|
|
35155
|
-
const handleSearch = (0, $b4te3$react.useCallback)((searchText)=>{
|
|
35156
|
-
setState(searchText?.length ? {
|
|
35157
|
-
version: $77f9cb72fb2d6360$var$RETAINED_SEARCH_VERSION,
|
|
35158
|
-
executed: true,
|
|
35159
|
-
terms: searchText
|
|
35160
|
-
} : $77f9cb72fb2d6360$var$createInitialState());
|
|
35161
|
-
onSearch?.(searchText);
|
|
35162
|
-
}, [
|
|
35163
|
-
onSearch,
|
|
35164
|
-
setState
|
|
35165
|
-
]);
|
|
35166
|
-
const handleSearchTextChange = (0, $b4te3$react.useCallback)((searchText)=>{
|
|
35167
|
-
if (!searchText?.length) setState($77f9cb72fb2d6360$var$createInitialState());
|
|
35168
|
-
onSearchTextChange?.(searchText);
|
|
35169
|
-
}, [
|
|
35170
|
-
onSearchTextChange,
|
|
35171
|
-
setState
|
|
35172
|
-
]);
|
|
35173
|
-
if (!retainSearch) return {
|
|
35174
|
-
search: search,
|
|
35175
|
-
refreshOnInit: refreshOnInit,
|
|
35176
|
-
onSearch: onSearch,
|
|
35177
|
-
onSearchTextChange: onSearchTextChange
|
|
35178
|
-
};
|
|
35179
|
-
return {
|
|
35180
|
-
search: state.terms,
|
|
35181
|
-
refreshOnInit: state.executed ? true : refreshOnInit,
|
|
35182
|
-
onSearch: handleSearch,
|
|
35183
|
-
onSearchTextChange: handleSearchTextChange
|
|
35184
|
-
};
|
|
35185
|
-
}
|
|
35186
|
-
|
|
35187
|
-
});
|
|
35188
|
-
|
|
35189
35230
|
|
|
35190
35231
|
|
|
35191
35232
|
parcelRegister("17D0Z", function(module, exports) {
|
|
@@ -41017,6 +41058,8 @@ $parcel$export(module.exports, "DataView", function () { return $2a573abad3e0e83
|
|
|
41017
41058
|
|
|
41018
41059
|
|
|
41019
41060
|
|
|
41061
|
+
parcelRequire("2eyXi");
|
|
41062
|
+
var $2cfmO = parcelRequire("2cfmO");
|
|
41020
41063
|
parcelRequire("7xGLy");
|
|
41021
41064
|
var $d50o9 = parcelRequire("d50o9");
|
|
41022
41065
|
var $7B1hX = parcelRequire("7B1hX");
|
|
@@ -41028,6 +41071,8 @@ var $j8hoz = parcelRequire("j8hoz");
|
|
|
41028
41071
|
|
|
41029
41072
|
var $TMsro = parcelRequire("TMsro");
|
|
41030
41073
|
|
|
41074
|
+
var $5hC9b = parcelRequire("5hC9b");
|
|
41075
|
+
|
|
41031
41076
|
var $2iAx4 = parcelRequire("2iAx4");
|
|
41032
41077
|
|
|
41033
41078
|
var $5yF9X = parcelRequire("5yF9X");
|
|
@@ -41082,10 +41127,32 @@ const $2a573abad3e0e83e$export$8d0177ff9f5686ad = {
|
|
|
41082
41127
|
};
|
|
41083
41128
|
const $2a573abad3e0e83e$export$5e15d737b33a1c27 = /*#__PURE__*/ (0, $b4te3$react.forwardRef)(function DataView(props, ref) {
|
|
41084
41129
|
props = (0, $b4te3$mantinecore.useComponentDefaultProps)('DataView', $2a573abad3e0e83e$export$8d0177ff9f5686ad, props);
|
|
41130
|
+
const { executeRetainedSearch: executeRetainedSearch, ...retainedSearchProps } = (0, $5hC9b.useRetainedSearch)({
|
|
41131
|
+
retainSearch: props.retainSearch,
|
|
41132
|
+
search: props.search,
|
|
41133
|
+
onSearch: props.onSearch,
|
|
41134
|
+
onSearchTextChange: props.onSearchTextChange
|
|
41135
|
+
});
|
|
41136
|
+
props = {
|
|
41137
|
+
...props,
|
|
41138
|
+
...retainedSearchProps
|
|
41139
|
+
};
|
|
41085
41140
|
const { entity: entity, autoFocus: autoFocus, toolbarIconVariant: toolbarIconVariant, actionsButtonVariant: actionsButtonVariant, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, enableExport: enableExport, labels: labels, Card: Card, CardContainer: CardContainer, limit: limit, search: search, viewName: viewName, filtersFormSize: filtersFormSize, toolbarSize: toolbarSize, showAppliedFilters: showAppliedFilters, showRefreshButton: showRefreshButton, hideCheckboxToggle: hideCheckboxToggle, showFiltersButton: showFiltersButton, searchPlaceholder: searchPlaceholder, showActions: showActions, parentKeys: parentKeys, visibleFilters: visibleFilters, setInitialFiltersFromColumns: setInitialFiltersFromColumns, cardHrefRootURL: cardHrefRootURL, cardHrefTarget: cardHrefTarget, showSearchInput: showSearchInput, showSelectRowsButton: showSelectRowsButton, showToolbar: showToolbar, showDeleteOnlyWhenMultiselect: showDeleteOnlyWhenMultiselect, parentFormAPI: parentFormAPI, formMode: formMode, CardRowAlign: CardRowAlign, RowsContainer: RowsContainer, refreshOnInit: refreshOnInit, RowsContainerProps: RowsContainerProps, onSearch: onSearch, onSearchTextChange: onSearchTextChange, addActionName: addActionName, editActionName: editActionName, deleteActionName: deleteActionName, viewActionName: viewActionName } = props;
|
|
41086
41141
|
const [searchData, setSearchData] = (0, $b4te3$react.useState)((0, $7B1hX.getInitialSearchData)(search) ?? []);
|
|
41087
41142
|
const viewState = (0, $7B1hX.useViewState)(search, limit);
|
|
41088
|
-
const [executeViewEnabled, setExecuteViewEnabled] = (0, $b4te3$react.useState)(refreshOnInit !== false);
|
|
41143
|
+
const [executeViewEnabled, setExecuteViewEnabled] = (0, $b4te3$react.useState)(refreshOnInit !== false || executeRetainedSearch);
|
|
41144
|
+
const [initialParentKeys] = (0, $b4te3$react.useState)(parentKeys);
|
|
41145
|
+
(0, $b4te3$react.useEffect)(()=>{
|
|
41146
|
+
if (executeViewEnabled) return;
|
|
41147
|
+
if (!executeRetainedSearch && (0, $2cfmO.areValuesObjectsEqual)(initialParentKeys, parentKeys)) return;
|
|
41148
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
41149
|
+
setExecuteViewEnabled(true);
|
|
41150
|
+
}, [
|
|
41151
|
+
executeRetainedSearch,
|
|
41152
|
+
executeViewEnabled,
|
|
41153
|
+
initialParentKeys,
|
|
41154
|
+
parentKeys
|
|
41155
|
+
]);
|
|
41089
41156
|
const executeViewState = (0, $lB8CV.useExecuteView)(entity, parentKeys, viewName, viewState.searchText, viewState.limitRows, viewState.refresh, viewState.filterValues, executeViewEnabled);
|
|
41090
41157
|
const dataViewAPI = (0, $5yF9X.useDataView)(props, {
|
|
41091
41158
|
executeViewState: executeViewState,
|
|
@@ -41358,8 +41425,6 @@ $parcel$export(module.exports, "DataViewPanel", function () { return $5072e0bd8d
|
|
|
41358
41425
|
parcelRequire("ccjva");
|
|
41359
41426
|
var $7n39P = parcelRequire("7n39P");
|
|
41360
41427
|
|
|
41361
|
-
var $5hC9b = parcelRequire("5hC9b");
|
|
41362
|
-
|
|
41363
41428
|
var $8Yv4s = parcelRequire("8Yv4s");
|
|
41364
41429
|
const $5072e0bd8dd4d8f5$export$7eaaa54623f2185b = {
|
|
41365
41430
|
actionsButtonVariant: 'light',
|
|
@@ -41402,19 +41467,16 @@ function $5072e0bd8dd4d8f5$export$3dd1ad9bd450bb4f(props) {
|
|
|
41402
41467
|
const { client: client, parentKeys: parentKeys, actionsButtonVariant: actionsButtonVariant, toolbarIconVariant: toolbarIconVariant, formMode: formMode, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, Card: CardProp, retainSearch: retainSearch, search: search, refreshOnInit: refreshOnInit, onSearch: onSearch, onSearchTextChange: onSearchTextChange, bgLight: bgLight, bgDark: bgDark, rowsContainerProps: rowsContainerProps, containerCardProps: containerCardProps, loadingComponent: loadingComponent, entityConstructor: entityConstructor, entityLoader: entityLoader, ...rest } = mergedProps;
|
|
41403
41468
|
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
41404
41469
|
const { result: entityBuilder, ready: entityReady } = (0, $8Yv4s.useResolvedEntityBuilder)(client, parentKeys, mergedProps);
|
|
41405
|
-
const retainedSearchProps = (0, $5hC9b.useRetainedSearch)({
|
|
41406
|
-
retainSearch: retainSearch,
|
|
41407
|
-
search: search,
|
|
41408
|
-
refreshOnInit: refreshOnInit,
|
|
41409
|
-
onSearch: onSearch,
|
|
41410
|
-
onSearchTextChange: onSearchTextChange
|
|
41411
|
-
});
|
|
41412
41470
|
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Card), {
|
|
41413
41471
|
bg: theme.colorScheme === "light" ? bgLight : bgDark,
|
|
41414
41472
|
...containerCardProps,
|
|
41415
41473
|
children: !entityReady || !entityBuilder ? loadingComponent : /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $7n39P.DataView), {
|
|
41416
41474
|
...rest,
|
|
41417
|
-
|
|
41475
|
+
retainSearch: retainSearch,
|
|
41476
|
+
search: search,
|
|
41477
|
+
refreshOnInit: refreshOnInit,
|
|
41478
|
+
onSearch: onSearch,
|
|
41479
|
+
onSearchTextChange: onSearchTextChange,
|
|
41418
41480
|
RowsContainer: (0, $b4te3$mantinecore.SimpleGrid),
|
|
41419
41481
|
RowsContainerProps: rowsContainerProps,
|
|
41420
41482
|
formMode: formMode,
|