schummar-table 0.30.1 → 0.31.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/cjs/index.js +27 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +27 -21
- package/dist/es/index.js.map +1 -1
- package/dist/types/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1967,6 +1967,7 @@ function calcProps(props) {
|
|
|
1967
1967
|
} else {
|
|
1968
1968
|
parentId = noopParentId;
|
|
1969
1969
|
}
|
|
1970
|
+
const columnProps = props.columnProps && cache("columnProps", props.columnProps);
|
|
1970
1971
|
let inputColumns;
|
|
1971
1972
|
if (props.columns instanceof Function) {
|
|
1972
1973
|
inputColumns = props.columns((value, column) => ({
|
|
@@ -1979,38 +1980,42 @@ function calcProps(props) {
|
|
|
1979
1980
|
dependecies: void 0
|
|
1980
1981
|
}));
|
|
1981
1982
|
}
|
|
1982
|
-
const
|
|
1983
|
+
const globalDefaults = props.defaultColumnProps;
|
|
1983
1984
|
const mapColumn = ({
|
|
1984
1985
|
id: _id,
|
|
1985
|
-
header
|
|
1986
|
-
footer
|
|
1986
|
+
header,
|
|
1987
|
+
footer,
|
|
1987
1988
|
value,
|
|
1988
|
-
renderCell
|
|
1989
|
-
exportCell
|
|
1990
|
-
sortBy
|
|
1989
|
+
renderCell,
|
|
1990
|
+
exportCell,
|
|
1991
|
+
sortBy,
|
|
1991
1992
|
disableSort,
|
|
1992
|
-
hidden
|
|
1993
|
-
classes
|
|
1994
|
-
styles
|
|
1995
|
-
filter
|
|
1996
|
-
width
|
|
1993
|
+
hidden,
|
|
1994
|
+
classes,
|
|
1995
|
+
styles,
|
|
1996
|
+
filter,
|
|
1997
|
+
width
|
|
1997
1998
|
}, index) => {
|
|
1998
1999
|
const id2 = _id ?? index;
|
|
1999
2000
|
const cacheKey = typeof id2 === "string" ? `s${id2}` : `n${id2}`;
|
|
2001
|
+
const defaults = {
|
|
2002
|
+
...globalDefaults,
|
|
2003
|
+
...columnProps == null ? void 0 : columnProps(id2)
|
|
2004
|
+
};
|
|
2000
2005
|
return {
|
|
2001
2006
|
id: id2,
|
|
2002
|
-
header,
|
|
2003
|
-
footer,
|
|
2007
|
+
header: header ?? (defaults == null ? void 0 : defaults.header) ?? null,
|
|
2008
|
+
footer: footer ?? (defaults == null ? void 0 : defaults.footer) ?? null,
|
|
2004
2009
|
value: cache(`columns.${cacheKey}.value`, value),
|
|
2005
|
-
renderCell: cache(`columns.${cacheKey}.renderCell`, renderCell),
|
|
2006
|
-
exportCell,
|
|
2007
|
-
sortBy: sortBy.map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
|
|
2010
|
+
renderCell: cache(`columns.${cacheKey}.renderCell`, renderCell ?? (defaults == null ? void 0 : defaults.renderCell) ?? asString),
|
|
2011
|
+
exportCell: exportCell ?? (defaults == null ? void 0 : defaults.exportCell) ?? asString,
|
|
2012
|
+
sortBy: (sortBy ?? (defaults == null ? void 0 : defaults.sortBy) ?? [(v) => typeof v === "number" || v instanceof Date ? v : v === null || v === void 0 ? "" : String(v)]).map((function_, i) => cache(`columns.${cacheKey}.sortBy.${i}`, function_)),
|
|
2008
2013
|
disableSort,
|
|
2009
|
-
hidden,
|
|
2010
|
-
classes,
|
|
2011
|
-
styles,
|
|
2012
|
-
filter,
|
|
2013
|
-
width
|
|
2014
|
+
hidden: hidden ?? (defaults == null ? void 0 : defaults.hidden),
|
|
2015
|
+
classes: classes ?? (defaults == null ? void 0 : defaults.classes),
|
|
2016
|
+
styles: styles ?? (defaults == null ? void 0 : defaults.styles),
|
|
2017
|
+
filter: filter ?? (defaults == null ? void 0 : defaults.filter),
|
|
2018
|
+
width: width ?? (defaults == null ? void 0 : defaults.width)
|
|
2014
2019
|
};
|
|
2015
2020
|
};
|
|
2016
2021
|
const columns = inputColumns.map(mapColumn);
|
|
@@ -2041,6 +2046,7 @@ function calcProps(props) {
|
|
|
2041
2046
|
id,
|
|
2042
2047
|
parentId,
|
|
2043
2048
|
columns,
|
|
2049
|
+
columnProps,
|
|
2044
2050
|
wrapCell,
|
|
2045
2051
|
rowAction,
|
|
2046
2052
|
enableSelection: props.enableSelection ?? true,
|