@teselagen/ui 0.5.23-beta.12 → 0.5.23-beta.14
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/utils/withTableParams.d.ts +1 -1
- package/index.cjs.js +34 -38
- package/index.es.js +34 -38
- package/package.json +1 -1
- package/src/DataTable/index.js +13 -3
- package/src/DataTable/utils/withTableParams.js +14 -27
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @property {object} defaults - tableParam defaults such as pageSize, filter, etc
|
|
14
14
|
* @property {boolean} noOrderError - won't console an error if an order is not found on schema
|
|
15
15
|
*/
|
|
16
|
-
export default function withTableParams(
|
|
16
|
+
export default function withTableParams(topLevelOptions: any): any;
|
|
17
17
|
/**
|
|
18
18
|
* Note all these options can be passed at Design Time or at Runtime (like reduxForm())
|
|
19
19
|
*/
|
package/index.cjs.js
CHANGED
|
@@ -48405,11 +48405,12 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48405
48405
|
props = __spreadValues(__spreadValues({}, props), withSelectedEntities2 && typeof withSelectedEntities2 === "string" && {
|
|
48406
48406
|
[withSelectedEntities2]: selectedEntities
|
|
48407
48407
|
});
|
|
48408
|
-
const
|
|
48408
|
+
const _currentParams = React$1.useMemo(() => {
|
|
48409
48409
|
const tmp = (urlConnected ? getCurrentParamsFromUrl(history.location) : reduxFormQueryParams) || {};
|
|
48410
48410
|
tmp.searchTerm = reduxFormSearchInput;
|
|
48411
48411
|
return tmp;
|
|
48412
48412
|
}, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
|
|
48413
|
+
const currentParams = useDeepEqualMemo(_currentParams);
|
|
48413
48414
|
const tableParams = React$1.useMemo(() => {
|
|
48414
48415
|
if (!isTableParamsConnected) {
|
|
48415
48416
|
const updateSearch = /* @__PURE__ */ __name((val) => {
|
|
@@ -48663,7 +48664,13 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48663
48664
|
if (!showForcedHiddenColumns && withDisplayOptions && (isSimple || isInfinite)) {
|
|
48664
48665
|
noValsForField = entities.every((e2) => {
|
|
48665
48666
|
const val = get$5(e2, field.path);
|
|
48666
|
-
return field.render ? !field.render(val, e2
|
|
48667
|
+
return field.render ? !field.render(val, e2, void 0, {
|
|
48668
|
+
currentParams,
|
|
48669
|
+
setNewParams
|
|
48670
|
+
}) : (cellRenderer == null ? void 0 : cellRenderer[field.path]) ? !cellRenderer[field.path](val, e2, void 0, {
|
|
48671
|
+
currentParams,
|
|
48672
|
+
setNewParams
|
|
48673
|
+
}) : !val;
|
|
48667
48674
|
});
|
|
48668
48675
|
}
|
|
48669
48676
|
if (noValsForField) {
|
|
@@ -48707,6 +48714,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48707
48714
|
}, [
|
|
48708
48715
|
cellRenderer,
|
|
48709
48716
|
convertedSchema,
|
|
48717
|
+
currentParams,
|
|
48710
48718
|
entities,
|
|
48711
48719
|
history,
|
|
48712
48720
|
isInfinite,
|
|
@@ -48714,6 +48722,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48714
48722
|
isSimple,
|
|
48715
48723
|
isViewable,
|
|
48716
48724
|
onDoubleClick,
|
|
48725
|
+
setNewParams,
|
|
48717
48726
|
showForcedHiddenColumns,
|
|
48718
48727
|
tableConfig.columnOrderings,
|
|
48719
48728
|
tableConfig.fieldOptions,
|
|
@@ -64403,29 +64412,14 @@ const withStore = /* @__PURE__ */ __name((Component) => {
|
|
|
64403
64412
|
return /* @__PURE__ */ React$1.createElement(Component, __spreadProps(__spreadValues({}, props), { store }));
|
|
64404
64413
|
};
|
|
64405
64414
|
}, "withStore");
|
|
64406
|
-
const
|
|
64407
|
-
const
|
|
64408
|
-
|
|
64409
|
-
|
|
64410
|
-
|
|
64411
|
-
|
|
64412
|
-
|
|
64413
|
-
|
|
64414
|
-
return isEq2;
|
|
64415
|
-
}, "isEq");
|
|
64416
|
-
const pure = /* @__PURE__ */ __name((BaseComponent) => {
|
|
64417
|
-
const hoc = shouldUpdate((props, nextProps) => !isEq(props, nextProps));
|
|
64418
|
-
return hoc(BaseComponent);
|
|
64419
|
-
}, "pure");
|
|
64420
|
-
function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
64421
|
-
let topLevelOptions;
|
|
64422
|
-
let Component;
|
|
64423
|
-
if (!pTopLevelOpts) {
|
|
64424
|
-
topLevelOptions = compOrOpts;
|
|
64425
|
-
} else {
|
|
64426
|
-
topLevelOptions = pTopLevelOpts;
|
|
64427
|
-
Component = compOrOpts;
|
|
64428
|
-
}
|
|
64415
|
+
const getSchema = /* @__PURE__ */ __name((options) => {
|
|
64416
|
+
const { schema } = options;
|
|
64417
|
+
if (isFunction$4(schema))
|
|
64418
|
+
return schema(options);
|
|
64419
|
+
else
|
|
64420
|
+
return schema;
|
|
64421
|
+
}, "getSchema");
|
|
64422
|
+
function withTableParams(topLevelOptions) {
|
|
64429
64423
|
const { isLocalCall = false } = topLevelOptions;
|
|
64430
64424
|
const mapStateToProps = /* @__PURE__ */ __name((state, ownProps) => {
|
|
64431
64425
|
var _a, _b;
|
|
@@ -64600,23 +64594,11 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
64600
64594
|
}),
|
|
64601
64595
|
//don't use withRouter if noRouter is passed!
|
|
64602
64596
|
branch((props) => !props.noRouter, withRouter),
|
|
64603
|
-
reactRedux.connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
64604
|
-
pure
|
|
64597
|
+
reactRedux.connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
64605
64598
|
);
|
|
64606
|
-
if (Component) {
|
|
64607
|
-
return toReturn(Component);
|
|
64608
|
-
}
|
|
64609
64599
|
return toReturn;
|
|
64610
64600
|
}
|
|
64611
64601
|
__name(withTableParams, "withTableParams");
|
|
64612
|
-
function getSchema(options) {
|
|
64613
|
-
const { schema } = options;
|
|
64614
|
-
if (isFunction$4(schema))
|
|
64615
|
-
return schema(options);
|
|
64616
|
-
else
|
|
64617
|
-
return schema;
|
|
64618
|
-
}
|
|
64619
|
-
__name(getSchema, "getSchema");
|
|
64620
64602
|
function showAppSpinner() {
|
|
64621
64603
|
return renderOnDocSimple(
|
|
64622
64604
|
/* @__PURE__ */ React$1.createElement(core.Overlay, { isOpen: true }, /* @__PURE__ */ React$1.createElement(Loading, { centeredInPage: true, loading: true }))
|
|
@@ -69420,6 +69402,20 @@ function withSelectTableRecords(_tableFormName, propName = "selectTableRecords")
|
|
|
69420
69402
|
);
|
|
69421
69403
|
}
|
|
69422
69404
|
__name(withSelectTableRecords, "withSelectTableRecords");
|
|
69405
|
+
const isEq = /* @__PURE__ */ __name((o1, o2) => {
|
|
69406
|
+
const isEq2 = isEqualWith(o1, o2, function(val1, val2) {
|
|
69407
|
+
if (isFunction$4(val1) && isFunction$4(val2)) {
|
|
69408
|
+
return val1 === val2 || val1.toString() === val2.toString();
|
|
69409
|
+
}
|
|
69410
|
+
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
69411
|
+
return true;
|
|
69412
|
+
});
|
|
69413
|
+
return isEq2;
|
|
69414
|
+
}, "isEq");
|
|
69415
|
+
const pure = /* @__PURE__ */ __name((BaseComponent) => {
|
|
69416
|
+
const hoc = shouldUpdate((props, nextProps) => !isEq(props, nextProps));
|
|
69417
|
+
return hoc(BaseComponent);
|
|
69418
|
+
}, "pure");
|
|
69423
69419
|
const isSafari = /^((?!chrome|android).)*safari/i.test(
|
|
69424
69420
|
navigator.userAgent
|
|
69425
69421
|
);
|
package/index.es.js
CHANGED
|
@@ -48387,11 +48387,12 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48387
48387
|
props = __spreadValues(__spreadValues({}, props), withSelectedEntities2 && typeof withSelectedEntities2 === "string" && {
|
|
48388
48388
|
[withSelectedEntities2]: selectedEntities
|
|
48389
48389
|
});
|
|
48390
|
-
const
|
|
48390
|
+
const _currentParams = useMemo(() => {
|
|
48391
48391
|
const tmp = (urlConnected ? getCurrentParamsFromUrl(history.location) : reduxFormQueryParams) || {};
|
|
48392
48392
|
tmp.searchTerm = reduxFormSearchInput;
|
|
48393
48393
|
return tmp;
|
|
48394
48394
|
}, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
|
|
48395
|
+
const currentParams = useDeepEqualMemo(_currentParams);
|
|
48395
48396
|
const tableParams = useMemo(() => {
|
|
48396
48397
|
if (!isTableParamsConnected) {
|
|
48397
48398
|
const updateSearch = /* @__PURE__ */ __name((val) => {
|
|
@@ -48645,7 +48646,13 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48645
48646
|
if (!showForcedHiddenColumns && withDisplayOptions && (isSimple || isInfinite)) {
|
|
48646
48647
|
noValsForField = entities.every((e2) => {
|
|
48647
48648
|
const val = get$5(e2, field.path);
|
|
48648
|
-
return field.render ? !field.render(val, e2
|
|
48649
|
+
return field.render ? !field.render(val, e2, void 0, {
|
|
48650
|
+
currentParams,
|
|
48651
|
+
setNewParams
|
|
48652
|
+
}) : (cellRenderer == null ? void 0 : cellRenderer[field.path]) ? !cellRenderer[field.path](val, e2, void 0, {
|
|
48653
|
+
currentParams,
|
|
48654
|
+
setNewParams
|
|
48655
|
+
}) : !val;
|
|
48649
48656
|
});
|
|
48650
48657
|
}
|
|
48651
48658
|
if (noValsForField) {
|
|
@@ -48689,6 +48696,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48689
48696
|
}, [
|
|
48690
48697
|
cellRenderer,
|
|
48691
48698
|
convertedSchema,
|
|
48699
|
+
currentParams,
|
|
48692
48700
|
entities,
|
|
48693
48701
|
history,
|
|
48694
48702
|
isInfinite,
|
|
@@ -48696,6 +48704,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48696
48704
|
isSimple,
|
|
48697
48705
|
isViewable,
|
|
48698
48706
|
onDoubleClick,
|
|
48707
|
+
setNewParams,
|
|
48699
48708
|
showForcedHiddenColumns,
|
|
48700
48709
|
tableConfig.columnOrderings,
|
|
48701
48710
|
tableConfig.fieldOptions,
|
|
@@ -64385,29 +64394,14 @@ const withStore = /* @__PURE__ */ __name((Component2) => {
|
|
|
64385
64394
|
return /* @__PURE__ */ React__default.createElement(Component2, __spreadProps(__spreadValues({}, props), { store }));
|
|
64386
64395
|
};
|
|
64387
64396
|
}, "withStore");
|
|
64388
|
-
const
|
|
64389
|
-
const
|
|
64390
|
-
|
|
64391
|
-
|
|
64392
|
-
|
|
64393
|
-
|
|
64394
|
-
|
|
64395
|
-
|
|
64396
|
-
return isEq2;
|
|
64397
|
-
}, "isEq");
|
|
64398
|
-
const pure = /* @__PURE__ */ __name((BaseComponent) => {
|
|
64399
|
-
const hoc = shouldUpdate((props, nextProps) => !isEq(props, nextProps));
|
|
64400
|
-
return hoc(BaseComponent);
|
|
64401
|
-
}, "pure");
|
|
64402
|
-
function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
64403
|
-
let topLevelOptions;
|
|
64404
|
-
let Component2;
|
|
64405
|
-
if (!pTopLevelOpts) {
|
|
64406
|
-
topLevelOptions = compOrOpts;
|
|
64407
|
-
} else {
|
|
64408
|
-
topLevelOptions = pTopLevelOpts;
|
|
64409
|
-
Component2 = compOrOpts;
|
|
64410
|
-
}
|
|
64397
|
+
const getSchema = /* @__PURE__ */ __name((options) => {
|
|
64398
|
+
const { schema } = options;
|
|
64399
|
+
if (isFunction$4(schema))
|
|
64400
|
+
return schema(options);
|
|
64401
|
+
else
|
|
64402
|
+
return schema;
|
|
64403
|
+
}, "getSchema");
|
|
64404
|
+
function withTableParams(topLevelOptions) {
|
|
64411
64405
|
const { isLocalCall = false } = topLevelOptions;
|
|
64412
64406
|
const mapStateToProps = /* @__PURE__ */ __name((state, ownProps) => {
|
|
64413
64407
|
var _a, _b;
|
|
@@ -64582,23 +64576,11 @@ function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
64582
64576
|
}),
|
|
64583
64577
|
//don't use withRouter if noRouter is passed!
|
|
64584
64578
|
branch((props) => !props.noRouter, withRouter),
|
|
64585
|
-
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
64586
|
-
pure
|
|
64579
|
+
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
64587
64580
|
);
|
|
64588
|
-
if (Component2) {
|
|
64589
|
-
return toReturn(Component2);
|
|
64590
|
-
}
|
|
64591
64581
|
return toReturn;
|
|
64592
64582
|
}
|
|
64593
64583
|
__name(withTableParams, "withTableParams");
|
|
64594
|
-
function getSchema(options) {
|
|
64595
|
-
const { schema } = options;
|
|
64596
|
-
if (isFunction$4(schema))
|
|
64597
|
-
return schema(options);
|
|
64598
|
-
else
|
|
64599
|
-
return schema;
|
|
64600
|
-
}
|
|
64601
|
-
__name(getSchema, "getSchema");
|
|
64602
64584
|
function showAppSpinner() {
|
|
64603
64585
|
return renderOnDocSimple(
|
|
64604
64586
|
/* @__PURE__ */ React__default.createElement(Overlay, { isOpen: true }, /* @__PURE__ */ React__default.createElement(Loading, { centeredInPage: true, loading: true }))
|
|
@@ -69402,6 +69384,20 @@ function withSelectTableRecords(_tableFormName, propName = "selectTableRecords")
|
|
|
69402
69384
|
);
|
|
69403
69385
|
}
|
|
69404
69386
|
__name(withSelectTableRecords, "withSelectTableRecords");
|
|
69387
|
+
const isEq = /* @__PURE__ */ __name((o1, o2) => {
|
|
69388
|
+
const isEq2 = isEqualWith(o1, o2, function(val1, val2) {
|
|
69389
|
+
if (isFunction$4(val1) && isFunction$4(val2)) {
|
|
69390
|
+
return val1 === val2 || val1.toString() === val2.toString();
|
|
69391
|
+
}
|
|
69392
|
+
if (val1 && val1.constructor && val1.constructor.name === "FiberNode")
|
|
69393
|
+
return true;
|
|
69394
|
+
});
|
|
69395
|
+
return isEq2;
|
|
69396
|
+
}, "isEq");
|
|
69397
|
+
const pure = /* @__PURE__ */ __name((BaseComponent) => {
|
|
69398
|
+
const hoc = shouldUpdate((props, nextProps) => !isEq(props, nextProps));
|
|
69399
|
+
return hoc(BaseComponent);
|
|
69400
|
+
}, "pure");
|
|
69405
69401
|
const isSafari = /^((?!chrome|android).)*safari/i.test(
|
|
69406
69402
|
navigator.userAgent
|
|
69407
69403
|
);
|
package/package.json
CHANGED
package/src/DataTable/index.js
CHANGED
|
@@ -268,7 +268,7 @@ const DataTable = ({
|
|
|
268
268
|
})
|
|
269
269
|
};
|
|
270
270
|
|
|
271
|
-
const
|
|
271
|
+
const _currentParams = useMemo(() => {
|
|
272
272
|
const tmp =
|
|
273
273
|
(urlConnected
|
|
274
274
|
? getCurrentParamsFromUrl(history.location) //important to use history location and not ownProps.location because for some reason the location path lags one render behind!!
|
|
@@ -278,6 +278,8 @@ const DataTable = ({
|
|
|
278
278
|
return tmp;
|
|
279
279
|
}, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
|
|
280
280
|
|
|
281
|
+
const currentParams = useDeepEqualMemo(_currentParams);
|
|
282
|
+
|
|
281
283
|
const tableParams = useMemo(() => {
|
|
282
284
|
if (!isTableParamsConnected) {
|
|
283
285
|
const updateSearch = val => {
|
|
@@ -577,9 +579,15 @@ const DataTable = ({
|
|
|
577
579
|
noValsForField = entities.every(e => {
|
|
578
580
|
const val = get(e, field.path);
|
|
579
581
|
return field.render
|
|
580
|
-
? !field.render(val, e
|
|
582
|
+
? !field.render(val, e, undefined, {
|
|
583
|
+
currentParams,
|
|
584
|
+
setNewParams
|
|
585
|
+
})
|
|
581
586
|
: cellRenderer?.[field.path]
|
|
582
|
-
? !cellRenderer[field.path](val, e
|
|
587
|
+
? !cellRenderer[field.path](val, e, undefined, {
|
|
588
|
+
currentParams,
|
|
589
|
+
setNewParams
|
|
590
|
+
})
|
|
583
591
|
: !val;
|
|
584
592
|
});
|
|
585
593
|
}
|
|
@@ -639,6 +647,7 @@ const DataTable = ({
|
|
|
639
647
|
}, [
|
|
640
648
|
cellRenderer,
|
|
641
649
|
convertedSchema,
|
|
650
|
+
currentParams,
|
|
642
651
|
entities,
|
|
643
652
|
history,
|
|
644
653
|
isInfinite,
|
|
@@ -646,6 +655,7 @@ const DataTable = ({
|
|
|
646
655
|
isSimple,
|
|
647
656
|
isViewable,
|
|
648
657
|
onDoubleClick,
|
|
658
|
+
setNewParams,
|
|
649
659
|
showForcedHiddenColumns,
|
|
650
660
|
tableConfig.columnOrderings,
|
|
651
661
|
tableConfig.fieldOptions,
|
|
@@ -3,8 +3,6 @@ import { connect } from "react-redux";
|
|
|
3
3
|
import { isFunction, set } from "lodash-es";
|
|
4
4
|
import { withRouter } from "react-router-dom";
|
|
5
5
|
import { branch, compose } from "recompose";
|
|
6
|
-
|
|
7
|
-
import pureNoFunc from "../../utils/pureNoFunc";
|
|
8
6
|
import convertSchema from "./convertSchema";
|
|
9
7
|
import { getRecordsFromReduxForm } from "./withSelectedEntities";
|
|
10
8
|
import {
|
|
@@ -17,6 +15,17 @@ import {
|
|
|
17
15
|
} from "./queryParams";
|
|
18
16
|
import getTableConfigFromStorage from "./getTableConfigFromStorage";
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Given the options, get the schema. This enables the user to provide
|
|
20
|
+
* a function instead of an object for the schema.
|
|
21
|
+
* @param {Object} options Merged options
|
|
22
|
+
*/
|
|
23
|
+
const getSchema = options => {
|
|
24
|
+
const { schema } = options;
|
|
25
|
+
if (isFunction(schema)) return schema(options);
|
|
26
|
+
else return schema;
|
|
27
|
+
};
|
|
28
|
+
|
|
20
29
|
/**
|
|
21
30
|
* Note all these options can be passed at Design Time or at Runtime (like reduxForm())
|
|
22
31
|
*
|
|
@@ -32,15 +41,7 @@ import getTableConfigFromStorage from "./getTableConfigFromStorage";
|
|
|
32
41
|
* @property {object} defaults - tableParam defaults such as pageSize, filter, etc
|
|
33
42
|
* @property {boolean} noOrderError - won't console an error if an order is not found on schema
|
|
34
43
|
*/
|
|
35
|
-
export default function withTableParams(
|
|
36
|
-
let topLevelOptions;
|
|
37
|
-
let Component;
|
|
38
|
-
if (!pTopLevelOpts) {
|
|
39
|
-
topLevelOptions = compOrOpts;
|
|
40
|
-
} else {
|
|
41
|
-
topLevelOptions = pTopLevelOpts;
|
|
42
|
-
Component = compOrOpts;
|
|
43
|
-
}
|
|
44
|
+
export default function withTableParams(topLevelOptions) {
|
|
44
45
|
const { isLocalCall = false } = topLevelOptions;
|
|
45
46
|
const mapStateToProps = (state, ownProps) => {
|
|
46
47
|
const mergedOpts = getMergedOpts(topLevelOptions, ownProps);
|
|
@@ -169,6 +170,7 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
169
170
|
},
|
|
170
171
|
showEmptyColumnsByDefault
|
|
171
172
|
};
|
|
173
|
+
|
|
172
174
|
return mapStateProps;
|
|
173
175
|
// return { ...mergedOpts, ...mapStateProps };
|
|
174
176
|
};
|
|
@@ -253,22 +255,7 @@ export default function withTableParams(compOrOpts, pTopLevelOpts) {
|
|
|
253
255
|
}),
|
|
254
256
|
//don't use withRouter if noRouter is passed!
|
|
255
257
|
branch(props => !props.noRouter, withRouter),
|
|
256
|
-
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
257
|
-
pureNoFunc
|
|
258
|
+
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
|
258
259
|
);
|
|
259
|
-
if (Component) {
|
|
260
|
-
return toReturn(Component);
|
|
261
|
-
}
|
|
262
260
|
return toReturn;
|
|
263
261
|
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Given the options, get the schema. This enables the user to provide
|
|
267
|
-
* a function instead of an object for the schema.
|
|
268
|
-
* @param {Object} options Merged options
|
|
269
|
-
*/
|
|
270
|
-
function getSchema(options) {
|
|
271
|
-
const { schema } = options;
|
|
272
|
-
if (isFunction(schema)) return schema(options);
|
|
273
|
-
else return schema;
|
|
274
|
-
}
|