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