@shortstravelmgmt/component-lib 0.2.12-rc.1 → 0.2.12-rc.2
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 +10 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3148,6 +3148,15 @@ interface GridTableProps<R = GridRow> {
|
|
|
3148
3148
|
secondarySortComparator?: (a: R, b: R) => number;
|
|
3149
3149
|
/** Draws a rule between rows. */
|
|
3150
3150
|
bordered?: boolean;
|
|
3151
|
+
/**
|
|
3152
|
+
* Renders the rows without their heading row.
|
|
3153
|
+
*
|
|
3154
|
+
* For grids whose columns are already labelled somewhere else: an editable
|
|
3155
|
+
* row inside a form, or rows sitting under a heading strip supplied
|
|
3156
|
+
* separately by GridHeaderRow. Sorting goes with it — the headings are what
|
|
3157
|
+
* you click to sort, so there is nothing left to sort by.
|
|
3158
|
+
*/
|
|
3159
|
+
hideHeader?: boolean;
|
|
3151
3160
|
/** Shown in place of the rows when there are none. */
|
|
3152
3161
|
emptyMessage?: ReactNode;
|
|
3153
3162
|
/** Sums a column into a sticky footer row. */
|
|
@@ -3167,7 +3176,7 @@ interface GridTableProps<R = GridRow> {
|
|
|
3167
3176
|
* again to reverse — and an optional total row sums a column into a sticky
|
|
3168
3177
|
* footer.
|
|
3169
3178
|
*/
|
|
3170
|
-
declare function GridTable<R = GridRow>({ columns, data, gridTemplateColumns, rowKey, header, initialSortColumn, initialSortAscending, secondarySortComparator, bordered, emptyMessage, totalRow, className, }: GridTableProps<R>): React__default.JSX.Element;
|
|
3179
|
+
declare function GridTable<R = GridRow>({ columns, data, gridTemplateColumns, rowKey, header, initialSortColumn, initialSortAscending, secondarySortComparator, bordered, hideHeader, emptyMessage, totalRow, className, }: GridTableProps<R>): React__default.JSX.Element;
|
|
3171
3180
|
declare namespace GridTable {
|
|
3172
3181
|
var displayName: string;
|
|
3173
3182
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -3976,7 +3976,7 @@ function toNumber(value) {
|
|
|
3976
3976
|
* again to reverse — and an optional total row sums a column into a sticky
|
|
3977
3977
|
* footer.
|
|
3978
3978
|
*/
|
|
3979
|
-
function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.length}, minmax(0, 1fr))`, rowKey, header = {}, initialSortColumn, initialSortAscending, secondarySortComparator, bordered = true, emptyMessage = 'No data available.', totalRow, className = '', }) {
|
|
3979
|
+
function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.length}, minmax(0, 1fr))`, rowKey, header = {}, initialSortColumn, initialSortAscending, secondarySortComparator, bordered = true, hideHeader = false, emptyMessage = 'No data available.', totalRow, className = '', }) {
|
|
3980
3980
|
const [sortColumn, setSortColumn] = useState(initialSortColumn);
|
|
3981
3981
|
const [ascending, setAscending] = useState(initialSortAscending);
|
|
3982
3982
|
const sorted = useMemo(() => {
|
|
@@ -4012,7 +4012,7 @@ function GridTable({ columns, data, gridTemplateColumns = `repeat(${columns.leng
|
|
|
4012
4012
|
}, 0);
|
|
4013
4013
|
}, [columns, data, totalRow]);
|
|
4014
4014
|
const totalIndex = totalRow ? columns.findIndex((c) => c.name === totalRow.columnName) : -1;
|
|
4015
|
-
return (jsxs("div", { className: `${styles$W.table} ${className}`, children: [jsxs("div", { className: styles$W.header, children: [header.above, jsx("div", { className: styles$W.grid, style: { gridTemplateColumns }, role: "row", children: columns.map((column, i) => (jsx(React.Fragment, { children: heading(column, { interactive: true }) }, i))) }), header.below] }), !sorted.length ? (jsx("div", { className: styles$W.empty, children: emptyMessage })) : (jsx("div", { className: styles$W.body, children: sorted.map((row, rowIndex) => {
|
|
4015
|
+
return (jsxs("div", { className: `${styles$W.table} ${className}`, children: [!hideHeader && (jsxs("div", { className: styles$W.header, children: [header.above, jsx("div", { className: styles$W.grid, style: { gridTemplateColumns }, role: "row", children: columns.map((column, i) => (jsx(React.Fragment, { children: heading(column, { interactive: true }) }, i))) }), header.below] })), !sorted.length ? (jsx("div", { className: styles$W.empty, children: emptyMessage })) : (jsx("div", { className: styles$W.body, children: sorted.map((row, rowIndex) => {
|
|
4016
4016
|
const record = row;
|
|
4017
4017
|
const key = String((rowKey && record[rowKey]) ?? record.id ?? rowIndex);
|
|
4018
4018
|
return (jsx("div", { className: `${styles$W.row} ${bordered ? styles$W.bordered : ''}`, style: { gridTemplateColumns }, "data-rowid": key, "data-testid": `row-${key}`, children: columns.map((column, colIndex) => {
|