@teselagen/ui 0.10.14 → 0.10.16
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/README.md +0 -12
- package/index.cjs.js +58 -33
- package/index.d.ts +1 -1
- package/index.es.js +58 -33
- package/package.json +4 -4
- package/src/DataTable/index.js +14 -8
- package/src/DataTable/utils/withTableParams.js +4 -4
- package/src/UploadCsvWizard.js +13 -7
- package/src/index.js +1 -1
- package/src/utils/hooks/useDeepEqualMemoIgnoreFns.js +28 -0
- package/utils/hooks/useDeepEqualMemoIgnoreFns.d.ts +4 -0
- package/src/utils/hooks/index.js +0 -1
- package/src/utils/hooks/useDeepEqualMemo.js +0 -15
- package/utils/hooks/index.d.ts +0 -1
- package/utils/hooks/useDeepEqualMemo.d.ts +0 -2
package/README.md
CHANGED
|
@@ -21,15 +21,3 @@ yarn add @teselagen/ui react react-dom
|
|
|
21
21
|
```
|
|
22
22
|
nx run ui:start
|
|
23
23
|
```
|
|
24
|
-
|
|
25
|
-
## Publishing
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
nx run ui:publish
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Publishing a beta version (for use when linking to a branch in another project)
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
nx run ui:publish-beta
|
|
35
|
-
```
|
package/index.cjs.js
CHANGED
|
@@ -17129,23 +17129,6 @@ const useTableEntities = /* @__PURE__ */ __name((tableFormName) => {
|
|
|
17129
17129
|
const { allOrderedEntities, selectedEntities } = reactRedux.useSelector(entitySelector);
|
|
17130
17130
|
return { selectTableEntities, allOrderedEntities, selectedEntities };
|
|
17131
17131
|
}, "useTableEntities");
|
|
17132
|
-
const isEqualIgnoreFunctions = /* @__PURE__ */ __name((o1, o2) => {
|
|
17133
|
-
const isEq = isEqualWith(o1, o2, function(val1, val2) {
|
|
17134
|
-
if (isFunction$1(val1) && isFunction$1(val2)) {
|
|
17135
|
-
return val1 === val2 || val1.toString() === val2.toString();
|
|
17136
|
-
}
|
|
17137
|
-
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
17138
|
-
return true;
|
|
17139
|
-
});
|
|
17140
|
-
return isEq;
|
|
17141
|
-
}, "isEqualIgnoreFunctions");
|
|
17142
|
-
const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
|
|
17143
|
-
const ref2 = React.useRef();
|
|
17144
|
-
if (!isEqualIgnoreFunctions(value, ref2.current)) {
|
|
17145
|
-
ref2.current = value;
|
|
17146
|
-
}
|
|
17147
|
-
return ref2.current;
|
|
17148
|
-
}, "useDeepEqualMemo");
|
|
17149
17132
|
function rowClick(e, rowInfo, entities, {
|
|
17150
17133
|
reduxFormSelectedEntityIdMap,
|
|
17151
17134
|
isSingleSelect,
|
|
@@ -56903,6 +56886,36 @@ if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
|
|
|
56903
56886
|
$mobx
|
|
56904
56887
|
});
|
|
56905
56888
|
}
|
|
56889
|
+
const isEqualIgnoreFunctions = /* @__PURE__ */ __name((o1, o2) => {
|
|
56890
|
+
const isEq = isEqualWith(o1, o2, function(val1, val2) {
|
|
56891
|
+
if (isFunction$1(val1) && isFunction$1(val2)) {
|
|
56892
|
+
return val1 === val2 || val1.toString() === val2.toString();
|
|
56893
|
+
}
|
|
56894
|
+
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
56895
|
+
return true;
|
|
56896
|
+
});
|
|
56897
|
+
return isEq;
|
|
56898
|
+
}, "isEqualIgnoreFunctions");
|
|
56899
|
+
const useDeepEqualMemoIgnoreFns = /* @__PURE__ */ __name((value) => {
|
|
56900
|
+
const ref2 = React.useRef();
|
|
56901
|
+
if (!isEqualIgnoreFunctions(value, ref2.current)) {
|
|
56902
|
+
ref2.current = value;
|
|
56903
|
+
}
|
|
56904
|
+
return ref2.current;
|
|
56905
|
+
}, "useDeepEqualMemoIgnoreFns");
|
|
56906
|
+
const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
|
|
56907
|
+
const ref2 = React.useRef();
|
|
56908
|
+
if (!isEqual(value, ref2.current)) {
|
|
56909
|
+
ref2.current = value;
|
|
56910
|
+
}
|
|
56911
|
+
return ref2.current;
|
|
56912
|
+
}, "useDeepEqualMemo");
|
|
56913
|
+
const useMemoDeepEqual = /* @__PURE__ */ __name((value, depsArray) => {
|
|
56914
|
+
return React.useMemo(value, useDeepEqualMemo(depsArray));
|
|
56915
|
+
}, "useMemoDeepEqual");
|
|
56916
|
+
const useDeepEqualEffect = /* @__PURE__ */ __name((effect3, deps) => {
|
|
56917
|
+
return React.useEffect(effect3, useDeepEqualMemoIgnoreFns(deps));
|
|
56918
|
+
}, "useDeepEqualEffect");
|
|
56906
56919
|
T();
|
|
56907
56920
|
const IS_LINUX = window.navigator.platform.toLowerCase().search("linux") > -1;
|
|
56908
56921
|
const itemSizeEstimators = {
|
|
@@ -56989,9 +57002,11 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
56989
57002
|
"reduxFormSelectedEntityIdMap"
|
|
56990
57003
|
);
|
|
56991
57004
|
}, "dtFormParamsSelector"));
|
|
56992
|
-
const reduxFormCellValidation =
|
|
56993
|
-
|
|
56994
|
-
|
|
57005
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
57006
|
+
_reduxFormCellValidation
|
|
57007
|
+
);
|
|
57008
|
+
const reduxFormQueryParams = useDeepEqualMemoIgnoreFns(_reduxFormQueryParams);
|
|
57009
|
+
const reduxFormSelectedEntityIdMap = useDeepEqualMemoIgnoreFns(
|
|
56995
57010
|
_reduxFormSelectedEntityIdMap
|
|
56996
57011
|
);
|
|
56997
57012
|
let props = ownProps;
|
|
@@ -57001,7 +57016,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57001
57016
|
entities: normalizedEntities
|
|
57002
57017
|
});
|
|
57003
57018
|
}
|
|
57004
|
-
const
|
|
57019
|
+
const __schema = useDeepEqualMemo(_schema);
|
|
57020
|
+
const convertedSchema = React.useMemo(() => convertSchema(__schema), [__schema]);
|
|
57005
57021
|
if (isLocalCall) {
|
|
57006
57022
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
57007
57023
|
throw new Error(
|
|
@@ -57065,7 +57081,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57065
57081
|
const tmp = (urlConnected ? getCurrentParamsFromUrl(history.location) : reduxFormQueryParams) || {};
|
|
57066
57082
|
return tmp;
|
|
57067
57083
|
}, [history, reduxFormQueryParams, urlConnected]);
|
|
57068
|
-
const currentParams =
|
|
57084
|
+
const currentParams = useDeepEqualMemoIgnoreFns(_currentParams);
|
|
57069
57085
|
const tableParams = React.useMemo(() => {
|
|
57070
57086
|
if (!isTableParamsConnected) {
|
|
57071
57087
|
const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
|
|
@@ -57246,8 +57262,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57246
57262
|
() => ((reduxFormEntities == null ? void 0 : reduxFormEntities.length) ? reduxFormEntities : _origEntities) || [],
|
|
57247
57263
|
[_origEntities, reduxFormEntities]
|
|
57248
57264
|
);
|
|
57249
|
-
const entities =
|
|
57250
|
-
const entitiesAcrossPages =
|
|
57265
|
+
const entities = useDeepEqualMemoIgnoreFns(_entities);
|
|
57266
|
+
const entitiesAcrossPages = useDeepEqualMemoIgnoreFns(_entitiesAcrossPages);
|
|
57251
57267
|
React.useEffect(() => {
|
|
57252
57268
|
change("allOrderedEntities", entitiesAcrossPages);
|
|
57253
57269
|
if (entities.length === 0 || isEmpty$1(reduxFormSelectedEntityIdMap)) return;
|
|
@@ -61826,7 +61842,7 @@ const SimpleInsertDataDialog = compose(
|
|
|
61826
61842
|
return (_b = (_a2 = state.form) == null ? void 0 : _a2[dataTableForm]) == null ? void 0 : _b.values.reduxFormEntities;
|
|
61827
61843
|
}
|
|
61828
61844
|
);
|
|
61829
|
-
const reduxFormEntities =
|
|
61845
|
+
const reduxFormEntities = useDeepEqualMemoIgnoreFns(_reduxFormEntities);
|
|
61830
61846
|
React.useEffect(() => {
|
|
61831
61847
|
return () => dispatch(reduxForm.destroy(dataTableForm));
|
|
61832
61848
|
}, [dataTableForm, dispatch]);
|
|
@@ -61836,7 +61852,9 @@ const SimpleInsertDataDialog = compose(
|
|
|
61836
61852
|
return (_b = (_a2 = state.form) == null ? void 0 : _a2[dataTableForm]) == null ? void 0 : _b.values.reduxFormCellValidation;
|
|
61837
61853
|
}, "_reduxFormCellValidationSelector")
|
|
61838
61854
|
);
|
|
61839
|
-
const reduxFormCellValidation =
|
|
61855
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
61856
|
+
_reduxFormCellValidation
|
|
61857
|
+
);
|
|
61840
61858
|
const { entsToUse, validationToUse } = React.useMemo(
|
|
61841
61859
|
() => removeCleanRows(reduxFormEntities, reduxFormCellValidation),
|
|
61842
61860
|
[reduxFormEntities, reduxFormCellValidation]
|
|
@@ -61921,8 +61939,10 @@ const UploadCsvWizardDialogInner = reduxForm.reduxForm()(({
|
|
|
61921
61939
|
"reduxFormCellValidation"
|
|
61922
61940
|
);
|
|
61923
61941
|
}, "dtFormNameSelector"));
|
|
61924
|
-
const reduxFormEntities =
|
|
61925
|
-
const reduxFormCellValidation =
|
|
61942
|
+
const reduxFormEntities = useDeepEqualMemoIgnoreFns(_reduxFormEntities);
|
|
61943
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
61944
|
+
_reduxFormCellValidation
|
|
61945
|
+
);
|
|
61926
61946
|
let inner;
|
|
61927
61947
|
if (hasSubmitted) {
|
|
61928
61948
|
inner = /* @__PURE__ */ React.createElement(
|
|
@@ -62224,8 +62244,10 @@ const UploadCsvWizardDialog = compose(
|
|
|
62224
62244
|
};
|
|
62225
62245
|
}
|
|
62226
62246
|
});
|
|
62227
|
-
const reduxFormEntitiesArray =
|
|
62228
|
-
|
|
62247
|
+
const reduxFormEntitiesArray = useDeepEqualMemoIgnoreFns(
|
|
62248
|
+
_reduxFormEntitiesArray
|
|
62249
|
+
);
|
|
62250
|
+
const finishedFiles = useDeepEqualMemoIgnoreFns(_finishedFiles);
|
|
62229
62251
|
const [hasSubmittedOuter, setSubmittedOuter] = React.useState();
|
|
62230
62252
|
const [steps, setSteps] = React.useState(getInitialSteps(true));
|
|
62231
62253
|
const [focusedTab, setFocusedTab] = React.useState(0);
|
|
@@ -67628,8 +67650,8 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
67628
67650
|
);
|
|
67629
67651
|
}
|
|
67630
67652
|
}
|
|
67631
|
-
const reduxFormQueryParams =
|
|
67632
|
-
const reduxFormSelectedEntityIdMap =
|
|
67653
|
+
const reduxFormQueryParams = useDeepEqualMemoIgnoreFns(_reduxFormQueryParams);
|
|
67654
|
+
const reduxFormSelectedEntityIdMap = useDeepEqualMemoIgnoreFns(
|
|
67633
67655
|
_reduxFormSelectedEntityIdMap
|
|
67634
67656
|
);
|
|
67635
67657
|
const _currentParams = React.useMemo(() => {
|
|
@@ -67640,7 +67662,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
67640
67662
|
() => withSelectedEntities2 ? Object.values(reduxFormSelectedEntityIdMap).sort((a2, b2) => a2.rowIndex - b2.rowIndex).map((item) => item.entity) : void 0,
|
|
67641
67663
|
[reduxFormSelectedEntityIdMap, withSelectedEntities2]
|
|
67642
67664
|
);
|
|
67643
|
-
const currentParams =
|
|
67665
|
+
const currentParams = useDeepEqualMemoIgnoreFns(_currentParams);
|
|
67644
67666
|
const defaultsToUse = React.useMemo(() => {
|
|
67645
67667
|
const _tableConfig = getTableConfigFromStorage(formName);
|
|
67646
67668
|
const userSetPageSize = (_tableConfig == null ? void 0 : _tableConfig.userSetPageSize) && parseInt(_tableConfig.userSetPageSize, 10);
|
|
@@ -73640,8 +73662,11 @@ exports.tg_modalState = tg_modalState;
|
|
|
73640
73662
|
exports.throwFormError = throwFormError;
|
|
73641
73663
|
exports.tickMenuEnhancer = tickMenuEnhancer;
|
|
73642
73664
|
exports.tubeIcon = tubeIcon;
|
|
73665
|
+
exports.useDeepEqualEffect = useDeepEqualEffect;
|
|
73643
73666
|
exports.useDeepEqualMemo = useDeepEqualMemo;
|
|
73667
|
+
exports.useDeepEqualMemoIgnoreFns = useDeepEqualMemoIgnoreFns;
|
|
73644
73668
|
exports.useDialog = useDialog;
|
|
73669
|
+
exports.useMemoDeepEqual = useMemoDeepEqual;
|
|
73645
73670
|
exports.useStableReference = useStableReference;
|
|
73646
73671
|
exports.useTableEntities = useTableEntities;
|
|
73647
73672
|
exports.useTableParams = useTableParams;
|
package/index.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export * from './utils/commandUtils';
|
|
|
17
17
|
export * from './utils/commandControls';
|
|
18
18
|
export * from './utils/useTraceUpdate';
|
|
19
19
|
export * from './utils/hooks/useStableReference';
|
|
20
|
+
export * from './utils/hooks/useDeepEqualMemoIgnoreFns';
|
|
20
21
|
export { default as Uploader } from './FormComponents/Uploader';
|
|
21
|
-
export { useDeepEqualMemo } from './utils/hooks';
|
|
22
22
|
export { default as Loading } from './Loading';
|
|
23
23
|
export { throwFormError } from './throwFormError';
|
|
24
24
|
export { default as AdvancedOptions } from './AdvancedOptions';
|
package/index.es.js
CHANGED
|
@@ -17111,23 +17111,6 @@ const useTableEntities = /* @__PURE__ */ __name((tableFormName) => {
|
|
|
17111
17111
|
const { allOrderedEntities, selectedEntities } = useSelector(entitySelector);
|
|
17112
17112
|
return { selectTableEntities, allOrderedEntities, selectedEntities };
|
|
17113
17113
|
}, "useTableEntities");
|
|
17114
|
-
const isEqualIgnoreFunctions = /* @__PURE__ */ __name((o1, o2) => {
|
|
17115
|
-
const isEq = isEqualWith(o1, o2, function(val1, val2) {
|
|
17116
|
-
if (isFunction$1(val1) && isFunction$1(val2)) {
|
|
17117
|
-
return val1 === val2 || val1.toString() === val2.toString();
|
|
17118
|
-
}
|
|
17119
|
-
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
17120
|
-
return true;
|
|
17121
|
-
});
|
|
17122
|
-
return isEq;
|
|
17123
|
-
}, "isEqualIgnoreFunctions");
|
|
17124
|
-
const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
|
|
17125
|
-
const ref2 = useRef();
|
|
17126
|
-
if (!isEqualIgnoreFunctions(value, ref2.current)) {
|
|
17127
|
-
ref2.current = value;
|
|
17128
|
-
}
|
|
17129
|
-
return ref2.current;
|
|
17130
|
-
}, "useDeepEqualMemo");
|
|
17131
17114
|
function rowClick(e, rowInfo, entities, {
|
|
17132
17115
|
reduxFormSelectedEntityIdMap,
|
|
17133
17116
|
isSingleSelect,
|
|
@@ -56885,6 +56868,36 @@ if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
|
|
|
56885
56868
|
$mobx
|
|
56886
56869
|
});
|
|
56887
56870
|
}
|
|
56871
|
+
const isEqualIgnoreFunctions = /* @__PURE__ */ __name((o1, o2) => {
|
|
56872
|
+
const isEq = isEqualWith(o1, o2, function(val1, val2) {
|
|
56873
|
+
if (isFunction$1(val1) && isFunction$1(val2)) {
|
|
56874
|
+
return val1 === val2 || val1.toString() === val2.toString();
|
|
56875
|
+
}
|
|
56876
|
+
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
56877
|
+
return true;
|
|
56878
|
+
});
|
|
56879
|
+
return isEq;
|
|
56880
|
+
}, "isEqualIgnoreFunctions");
|
|
56881
|
+
const useDeepEqualMemoIgnoreFns = /* @__PURE__ */ __name((value) => {
|
|
56882
|
+
const ref2 = useRef();
|
|
56883
|
+
if (!isEqualIgnoreFunctions(value, ref2.current)) {
|
|
56884
|
+
ref2.current = value;
|
|
56885
|
+
}
|
|
56886
|
+
return ref2.current;
|
|
56887
|
+
}, "useDeepEqualMemoIgnoreFns");
|
|
56888
|
+
const useDeepEqualMemo = /* @__PURE__ */ __name((value) => {
|
|
56889
|
+
const ref2 = useRef();
|
|
56890
|
+
if (!isEqual(value, ref2.current)) {
|
|
56891
|
+
ref2.current = value;
|
|
56892
|
+
}
|
|
56893
|
+
return ref2.current;
|
|
56894
|
+
}, "useDeepEqualMemo");
|
|
56895
|
+
const useMemoDeepEqual = /* @__PURE__ */ __name((value, depsArray) => {
|
|
56896
|
+
return useMemo(value, useDeepEqualMemo(depsArray));
|
|
56897
|
+
}, "useMemoDeepEqual");
|
|
56898
|
+
const useDeepEqualEffect = /* @__PURE__ */ __name((effect3, deps) => {
|
|
56899
|
+
return useEffect(effect3, useDeepEqualMemoIgnoreFns(deps));
|
|
56900
|
+
}, "useDeepEqualEffect");
|
|
56888
56901
|
T();
|
|
56889
56902
|
const IS_LINUX = window.navigator.platform.toLowerCase().search("linux") > -1;
|
|
56890
56903
|
const itemSizeEstimators = {
|
|
@@ -56971,9 +56984,11 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
56971
56984
|
"reduxFormSelectedEntityIdMap"
|
|
56972
56985
|
);
|
|
56973
56986
|
}, "dtFormParamsSelector"));
|
|
56974
|
-
const reduxFormCellValidation =
|
|
56975
|
-
|
|
56976
|
-
|
|
56987
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
56988
|
+
_reduxFormCellValidation
|
|
56989
|
+
);
|
|
56990
|
+
const reduxFormQueryParams = useDeepEqualMemoIgnoreFns(_reduxFormQueryParams);
|
|
56991
|
+
const reduxFormSelectedEntityIdMap = useDeepEqualMemoIgnoreFns(
|
|
56977
56992
|
_reduxFormSelectedEntityIdMap
|
|
56978
56993
|
);
|
|
56979
56994
|
let props = ownProps;
|
|
@@ -56983,7 +56998,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
56983
56998
|
entities: normalizedEntities
|
|
56984
56999
|
});
|
|
56985
57000
|
}
|
|
56986
|
-
const
|
|
57001
|
+
const __schema = useDeepEqualMemo(_schema);
|
|
57002
|
+
const convertedSchema = useMemo(() => convertSchema(__schema), [__schema]);
|
|
56987
57003
|
if (isLocalCall) {
|
|
56988
57004
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
56989
57005
|
throw new Error(
|
|
@@ -57047,7 +57063,7 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57047
57063
|
const tmp = (urlConnected ? getCurrentParamsFromUrl(history.location) : reduxFormQueryParams) || {};
|
|
57048
57064
|
return tmp;
|
|
57049
57065
|
}, [history, reduxFormQueryParams, urlConnected]);
|
|
57050
|
-
const currentParams =
|
|
57066
|
+
const currentParams = useDeepEqualMemoIgnoreFns(_currentParams);
|
|
57051
57067
|
const tableParams = useMemo(() => {
|
|
57052
57068
|
if (!isTableParamsConnected) {
|
|
57053
57069
|
const setNewParams2 = /* @__PURE__ */ __name((newParams) => {
|
|
@@ -57228,8 +57244,8 @@ const DataTable = /* @__PURE__ */ __name((_M) => {
|
|
|
57228
57244
|
() => ((reduxFormEntities == null ? void 0 : reduxFormEntities.length) ? reduxFormEntities : _origEntities) || [],
|
|
57229
57245
|
[_origEntities, reduxFormEntities]
|
|
57230
57246
|
);
|
|
57231
|
-
const entities =
|
|
57232
|
-
const entitiesAcrossPages =
|
|
57247
|
+
const entities = useDeepEqualMemoIgnoreFns(_entities);
|
|
57248
|
+
const entitiesAcrossPages = useDeepEqualMemoIgnoreFns(_entitiesAcrossPages);
|
|
57233
57249
|
useEffect(() => {
|
|
57234
57250
|
change$1("allOrderedEntities", entitiesAcrossPages);
|
|
57235
57251
|
if (entities.length === 0 || isEmpty$1(reduxFormSelectedEntityIdMap)) return;
|
|
@@ -61808,7 +61824,7 @@ const SimpleInsertDataDialog = compose(
|
|
|
61808
61824
|
return (_b = (_a2 = state.form) == null ? void 0 : _a2[dataTableForm]) == null ? void 0 : _b.values.reduxFormEntities;
|
|
61809
61825
|
}
|
|
61810
61826
|
);
|
|
61811
|
-
const reduxFormEntities =
|
|
61827
|
+
const reduxFormEntities = useDeepEqualMemoIgnoreFns(_reduxFormEntities);
|
|
61812
61828
|
useEffect(() => {
|
|
61813
61829
|
return () => dispatch(destroy(dataTableForm));
|
|
61814
61830
|
}, [dataTableForm, dispatch]);
|
|
@@ -61818,7 +61834,9 @@ const SimpleInsertDataDialog = compose(
|
|
|
61818
61834
|
return (_b = (_a2 = state.form) == null ? void 0 : _a2[dataTableForm]) == null ? void 0 : _b.values.reduxFormCellValidation;
|
|
61819
61835
|
}, "_reduxFormCellValidationSelector")
|
|
61820
61836
|
);
|
|
61821
|
-
const reduxFormCellValidation =
|
|
61837
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
61838
|
+
_reduxFormCellValidation
|
|
61839
|
+
);
|
|
61822
61840
|
const { entsToUse, validationToUse } = useMemo(
|
|
61823
61841
|
() => removeCleanRows(reduxFormEntities, reduxFormCellValidation),
|
|
61824
61842
|
[reduxFormEntities, reduxFormCellValidation]
|
|
@@ -61903,8 +61921,10 @@ const UploadCsvWizardDialogInner = reduxForm()(({
|
|
|
61903
61921
|
"reduxFormCellValidation"
|
|
61904
61922
|
);
|
|
61905
61923
|
}, "dtFormNameSelector"));
|
|
61906
|
-
const reduxFormEntities =
|
|
61907
|
-
const reduxFormCellValidation =
|
|
61924
|
+
const reduxFormEntities = useDeepEqualMemoIgnoreFns(_reduxFormEntities);
|
|
61925
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
61926
|
+
_reduxFormCellValidation
|
|
61927
|
+
);
|
|
61908
61928
|
let inner;
|
|
61909
61929
|
if (hasSubmitted) {
|
|
61910
61930
|
inner = /* @__PURE__ */ React__default.createElement(
|
|
@@ -62206,8 +62226,10 @@ const UploadCsvWizardDialog = compose(
|
|
|
62206
62226
|
};
|
|
62207
62227
|
}
|
|
62208
62228
|
});
|
|
62209
|
-
const reduxFormEntitiesArray =
|
|
62210
|
-
|
|
62229
|
+
const reduxFormEntitiesArray = useDeepEqualMemoIgnoreFns(
|
|
62230
|
+
_reduxFormEntitiesArray
|
|
62231
|
+
);
|
|
62232
|
+
const finishedFiles = useDeepEqualMemoIgnoreFns(_finishedFiles);
|
|
62211
62233
|
const [hasSubmittedOuter, setSubmittedOuter] = useState();
|
|
62212
62234
|
const [steps, setSteps] = useState(getInitialSteps(true));
|
|
62213
62235
|
const [focusedTab, setFocusedTab] = useState(0);
|
|
@@ -67610,8 +67632,8 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
67610
67632
|
);
|
|
67611
67633
|
}
|
|
67612
67634
|
}
|
|
67613
|
-
const reduxFormQueryParams =
|
|
67614
|
-
const reduxFormSelectedEntityIdMap =
|
|
67635
|
+
const reduxFormQueryParams = useDeepEqualMemoIgnoreFns(_reduxFormQueryParams);
|
|
67636
|
+
const reduxFormSelectedEntityIdMap = useDeepEqualMemoIgnoreFns(
|
|
67615
67637
|
_reduxFormSelectedEntityIdMap
|
|
67616
67638
|
);
|
|
67617
67639
|
const _currentParams = useMemo(() => {
|
|
@@ -67622,7 +67644,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
67622
67644
|
() => withSelectedEntities2 ? Object.values(reduxFormSelectedEntityIdMap).sort((a2, b2) => a2.rowIndex - b2.rowIndex).map((item) => item.entity) : void 0,
|
|
67623
67645
|
[reduxFormSelectedEntityIdMap, withSelectedEntities2]
|
|
67624
67646
|
);
|
|
67625
|
-
const currentParams =
|
|
67647
|
+
const currentParams = useDeepEqualMemoIgnoreFns(_currentParams);
|
|
67626
67648
|
const defaultsToUse = useMemo(() => {
|
|
67627
67649
|
const _tableConfig = getTableConfigFromStorage(formName);
|
|
67628
67650
|
const userSetPageSize = (_tableConfig == null ? void 0 : _tableConfig.userSetPageSize) && parseInt(_tableConfig.userSetPageSize, 10);
|
|
@@ -73623,8 +73645,11 @@ export {
|
|
|
73623
73645
|
throwFormError,
|
|
73624
73646
|
tickMenuEnhancer,
|
|
73625
73647
|
tubeIcon,
|
|
73648
|
+
useDeepEqualEffect,
|
|
73626
73649
|
useDeepEqualMemo,
|
|
73650
|
+
useDeepEqualMemoIgnoreFns,
|
|
73627
73651
|
useDialog,
|
|
73652
|
+
useMemoDeepEqual,
|
|
73628
73653
|
useStableReference,
|
|
73629
73654
|
useTableEntities,
|
|
73630
73655
|
useTableParams,
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/ui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.16",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": "https://github.com/TeselaGen/tg-oss",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"import": "./index.es.js",
|
|
@@ -56,6 +57,5 @@
|
|
|
56
57
|
"@dnd-kit/utilities": "3.2.2",
|
|
57
58
|
"@teselagen/file-utils": "0.3.20",
|
|
58
59
|
"@blueprintjs/icons": "3.33.0"
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/DataTable/index.js
CHANGED
|
@@ -70,7 +70,6 @@ import {
|
|
|
70
70
|
PRIMARY_SELECTED_VAL,
|
|
71
71
|
removeCleanRows
|
|
72
72
|
} from "./utils";
|
|
73
|
-
import { useDeepEqualMemo } from "../utils/hooks";
|
|
74
73
|
import rowClick, {
|
|
75
74
|
changeSelectedEntities,
|
|
76
75
|
finalizeSelection
|
|
@@ -104,6 +103,10 @@ import { throwFormError } from "../throwFormError";
|
|
|
104
103
|
import { isObservableArray, toJS } from "mobx";
|
|
105
104
|
import { isBeingCalledExcessively } from "../utils/isBeingCalledExcessively";
|
|
106
105
|
import { getCCDisplayName } from "./utils/tableQueryParamsToHasuraClauses";
|
|
106
|
+
import {
|
|
107
|
+
useDeepEqualMemo,
|
|
108
|
+
useDeepEqualMemoIgnoreFns
|
|
109
|
+
} from "../utils/hooks/useDeepEqualMemoIgnoreFns";
|
|
107
110
|
|
|
108
111
|
enablePatches();
|
|
109
112
|
const IS_LINUX = window.navigator.platform.toLowerCase().search("linux") > -1;
|
|
@@ -186,9 +189,11 @@ const DataTable = ({
|
|
|
186
189
|
|
|
187
190
|
// We want to make sure we don't rerender everything unnecessary
|
|
188
191
|
// with redux-forms we tend to do unnecessary renders
|
|
189
|
-
const reduxFormCellValidation =
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
193
|
+
_reduxFormCellValidation
|
|
194
|
+
);
|
|
195
|
+
const reduxFormQueryParams = useDeepEqualMemoIgnoreFns(_reduxFormQueryParams);
|
|
196
|
+
const reduxFormSelectedEntityIdMap = useDeepEqualMemoIgnoreFns(
|
|
192
197
|
_reduxFormSelectedEntityIdMap
|
|
193
198
|
);
|
|
194
199
|
|
|
@@ -205,7 +210,8 @@ const DataTable = ({
|
|
|
205
210
|
entities: normalizedEntities
|
|
206
211
|
};
|
|
207
212
|
}
|
|
208
|
-
const
|
|
213
|
+
const __schema = useDeepEqualMemo(_schema, true);
|
|
214
|
+
const convertedSchema = useMemo(() => convertSchema(__schema), [__schema]);
|
|
209
215
|
|
|
210
216
|
if (isLocalCall) {
|
|
211
217
|
if (!noForm && (!formName || formName === "tgDataTable")) {
|
|
@@ -287,7 +293,7 @@ const DataTable = ({
|
|
|
287
293
|
return tmp;
|
|
288
294
|
}, [history, reduxFormQueryParams, urlConnected]);
|
|
289
295
|
|
|
290
|
-
const currentParams =
|
|
296
|
+
const currentParams = useDeepEqualMemoIgnoreFns(_currentParams);
|
|
291
297
|
|
|
292
298
|
const tableParams = useMemo(() => {
|
|
293
299
|
if (!isTableParamsConnected) {
|
|
@@ -485,9 +491,9 @@ const DataTable = ({
|
|
|
485
491
|
() => (reduxFormEntities?.length ? reduxFormEntities : _origEntities) || [],
|
|
486
492
|
[_origEntities, reduxFormEntities]
|
|
487
493
|
);
|
|
488
|
-
const entities =
|
|
494
|
+
const entities = useDeepEqualMemoIgnoreFns(_entities);
|
|
489
495
|
|
|
490
|
-
const entitiesAcrossPages =
|
|
496
|
+
const entitiesAcrossPages = useDeepEqualMemoIgnoreFns(_entitiesAcrossPages);
|
|
491
497
|
|
|
492
498
|
// This is because we need to maintain the reduxFormSelectedEntityIdMap and
|
|
493
499
|
// allOrderedEntities updated
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./queryParams";
|
|
11
11
|
import { withRouter } from "react-router-dom";
|
|
12
12
|
import getTableConfigFromStorage from "./getTableConfigFromStorage";
|
|
13
|
-
import {
|
|
13
|
+
import { useDeepEqualMemoIgnoreFns } from "../../utils/hooks/useDeepEqualMemoIgnoreFns";
|
|
14
14
|
import { branch, compose } from "recompose";
|
|
15
15
|
import { getCCDisplayName } from "./tableQueryParamsToHasuraClauses";
|
|
16
16
|
|
|
@@ -131,8 +131,8 @@ export const useTableParams = props => {
|
|
|
131
131
|
|
|
132
132
|
// We want to make sure we don't rerender everything unnecessary
|
|
133
133
|
// with redux-forms we tend to do unnecessary renders
|
|
134
|
-
const reduxFormQueryParams =
|
|
135
|
-
const reduxFormSelectedEntityIdMap =
|
|
134
|
+
const reduxFormQueryParams = useDeepEqualMemoIgnoreFns(_reduxFormQueryParams);
|
|
135
|
+
const reduxFormSelectedEntityIdMap = useDeepEqualMemoIgnoreFns(
|
|
136
136
|
_reduxFormSelectedEntityIdMap
|
|
137
137
|
);
|
|
138
138
|
|
|
@@ -155,7 +155,7 @@ export const useTableParams = props => {
|
|
|
155
155
|
[reduxFormSelectedEntityIdMap, withSelectedEntities]
|
|
156
156
|
);
|
|
157
157
|
|
|
158
|
-
const currentParams =
|
|
158
|
+
const currentParams = useDeepEqualMemoIgnoreFns(_currentParams);
|
|
159
159
|
|
|
160
160
|
const defaultsToUse = useMemo(() => {
|
|
161
161
|
const _tableConfig = getTableConfigFromStorage(formName);
|
package/src/UploadCsvWizard.js
CHANGED
|
@@ -11,7 +11,6 @@ import { some } from "lodash-es";
|
|
|
11
11
|
import { times } from "lodash-es";
|
|
12
12
|
import DialogFooter from "./DialogFooter";
|
|
13
13
|
import DataTable from "./DataTable";
|
|
14
|
-
import { useDeepEqualMemo } from "./utils/hooks";
|
|
15
14
|
import { removeCleanRows } from "./DataTable/utils";
|
|
16
15
|
import wrapDialog from "./wrapDialog";
|
|
17
16
|
import { omit } from "lodash-es";
|
|
@@ -21,6 +20,7 @@ import { isEmpty } from "lodash-es";
|
|
|
21
20
|
import { addSpecialPropToAsyncErrs } from "./FormComponents/tryToMatchSchemas";
|
|
22
21
|
import { cloneDeep } from "lodash-es";
|
|
23
22
|
import { InputField } from "./FormComponents";
|
|
23
|
+
import { useDeepEqualMemoIgnoreFns } from "./utils/hooks/useDeepEqualMemoIgnoreFns";
|
|
24
24
|
|
|
25
25
|
const asyncValidateHelper = async (
|
|
26
26
|
validateAgainstSchema,
|
|
@@ -179,7 +179,7 @@ export const SimpleInsertDataDialog = compose(
|
|
|
179
179
|
const _reduxFormEntities = useSelector(
|
|
180
180
|
state => state.form?.[dataTableForm]?.values.reduxFormEntities
|
|
181
181
|
);
|
|
182
|
-
const reduxFormEntities =
|
|
182
|
+
const reduxFormEntities = useDeepEqualMemoIgnoreFns(_reduxFormEntities);
|
|
183
183
|
useEffect(() => {
|
|
184
184
|
return () => dispatch(destroy(dataTableForm));
|
|
185
185
|
}, [dataTableForm, dispatch]);
|
|
@@ -189,7 +189,9 @@ export const SimpleInsertDataDialog = compose(
|
|
|
189
189
|
return state.form?.[dataTableForm]?.values.reduxFormCellValidation;
|
|
190
190
|
}
|
|
191
191
|
);
|
|
192
|
-
const reduxFormCellValidation =
|
|
192
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
193
|
+
_reduxFormCellValidation
|
|
194
|
+
);
|
|
193
195
|
|
|
194
196
|
const { entsToUse, validationToUse } = useMemo(
|
|
195
197
|
() => removeCleanRows(reduxFormEntities, reduxFormCellValidation),
|
|
@@ -282,8 +284,10 @@ const UploadCsvWizardDialogInner = reduxForm()(({
|
|
|
282
284
|
);
|
|
283
285
|
});
|
|
284
286
|
|
|
285
|
-
const reduxFormEntities =
|
|
286
|
-
const reduxFormCellValidation =
|
|
287
|
+
const reduxFormEntities = useDeepEqualMemoIgnoreFns(_reduxFormEntities);
|
|
288
|
+
const reduxFormCellValidation = useDeepEqualMemoIgnoreFns(
|
|
289
|
+
_reduxFormCellValidation
|
|
290
|
+
);
|
|
287
291
|
|
|
288
292
|
let inner;
|
|
289
293
|
if (hasSubmitted) {
|
|
@@ -660,8 +664,10 @@ const UploadCsvWizardDialog = compose(
|
|
|
660
664
|
};
|
|
661
665
|
}
|
|
662
666
|
});
|
|
663
|
-
const reduxFormEntitiesArray =
|
|
664
|
-
|
|
667
|
+
const reduxFormEntitiesArray = useDeepEqualMemoIgnoreFns(
|
|
668
|
+
_reduxFormEntitiesArray
|
|
669
|
+
);
|
|
670
|
+
const finishedFiles = useDeepEqualMemoIgnoreFns(_finishedFiles);
|
|
665
671
|
|
|
666
672
|
const [hasSubmittedOuter, setSubmittedOuter] = useState();
|
|
667
673
|
const [steps, setSteps] = useState(getInitialSteps(true));
|
package/src/index.js
CHANGED
|
@@ -23,7 +23,6 @@ export {
|
|
|
23
23
|
} from "./DataTable";
|
|
24
24
|
export { removeCleanRows, useTableEntities } from "./DataTable/utils";
|
|
25
25
|
|
|
26
|
-
export { useDeepEqualMemo } from "./utils/hooks";
|
|
27
26
|
export { getIdOrCodeOrIndex } from "./DataTable/utils";
|
|
28
27
|
export { default as convertSchema } from "./DataTable/utils/convertSchema";
|
|
29
28
|
export { default as Loading } from "./Loading";
|
|
@@ -79,6 +78,7 @@ export * from "./utils/commandUtils";
|
|
|
79
78
|
export * from "./utils/commandControls";
|
|
80
79
|
export * from "./utils/useTraceUpdate";
|
|
81
80
|
export * from "./utils/hooks/useStableReference";
|
|
81
|
+
export * from "./utils/hooks/useDeepEqualMemoIgnoreFns";
|
|
82
82
|
export { default as AsyncValidateFieldSpinner } from "./AsyncValidateFieldSpinner";
|
|
83
83
|
export { default as showProgressToast } from "./utils/showProgressToast";
|
|
84
84
|
export { default as getTextFromEl } from "./utils/getTextFromEl";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useRef, useMemo } from "react";
|
|
2
|
+
import { isEqualIgnoreFunctions } from "../isEqualIgnoreFunctions";
|
|
3
|
+
import { isEqual } from "lodash-es";
|
|
4
|
+
|
|
5
|
+
export const useDeepEqualMemoIgnoreFns = value => {
|
|
6
|
+
const ref = useRef();
|
|
7
|
+
if (!isEqualIgnoreFunctions(value, ref.current)) {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
return ref.current;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const useDeepEqualMemo = value => {
|
|
14
|
+
const ref = useRef();
|
|
15
|
+
if (!isEqual(value, ref.current)) {
|
|
16
|
+
ref.current = value;
|
|
17
|
+
}
|
|
18
|
+
return ref.current;
|
|
19
|
+
};
|
|
20
|
+
export const useMemoDeepEqual = (value, depsArray) => {
|
|
21
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
+
return useMemo(value, useDeepEqualMemo(depsArray));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const useDeepEqualEffect = (effect, deps) => {
|
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
+
return useEffect(effect, useDeepEqualMemoIgnoreFns(deps));
|
|
28
|
+
};
|
package/src/utils/hooks/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useDeepEqualMemo } from "./useDeepEqualMemo";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
import { isEqualIgnoreFunctions } from "../isEqualIgnoreFunctions";
|
|
3
|
-
|
|
4
|
-
export const useDeepEqualMemo = value => {
|
|
5
|
-
const ref = useRef();
|
|
6
|
-
if (!isEqualIgnoreFunctions(value, ref.current)) {
|
|
7
|
-
ref.current = value;
|
|
8
|
-
}
|
|
9
|
-
return ref.current;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const useDeepEqualEffect = (effect, deps) => {
|
|
13
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
-
return useEffect(effect, useDeepEqualMemo(deps));
|
|
15
|
-
};
|
package/utils/hooks/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useDeepEqualMemo } from './useDeepEqualMemo';
|