@salt-ds/data-grid 1.0.3 → 1.0.4-alpha.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/packages/grid/src/BaseCell.css.js +1 -1
- package/dist-cjs/packages/grid/src/BaseCell.js +35 -3
- package/dist-cjs/packages/grid/src/BaseCell.js.map +1 -1
- package/dist-cjs/packages/grid/src/ColumnSortContext.js +20 -0
- package/dist-cjs/packages/grid/src/ColumnSortContext.js.map +1 -0
- package/dist-cjs/packages/grid/src/Grid.js +211 -128
- package/dist-cjs/packages/grid/src/Grid.js.map +1 -1
- package/dist-cjs/packages/grid/src/GridColumn.js +1 -1
- package/dist-cjs/packages/grid/src/GridColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/HeaderCell.css.js +1 -1
- package/dist-cjs/packages/grid/src/HeaderCell.js +66 -2
- package/dist-cjs/packages/grid/src/HeaderCell.js.map +1 -1
- package/dist-cjs/packages/grid/src/NumericColumn.js +12 -0
- package/dist-cjs/packages/grid/src/NumericColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxCellValue.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxCellValue.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxColumn.js +14 -7
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxHeaderCellValue.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionCheckboxHeaderCellValue.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionRadioCellValue.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionRadioCellValue.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionRadioColumn.js +11 -7
- package/dist-cjs/packages/grid/src/RowSelectionRadioColumn.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowSelectionRadioHeaderCell.js +2 -2
- package/dist-cjs/packages/grid/src/RowSelectionRadioHeaderCell.js.map +1 -1
- package/dist-cjs/packages/grid/src/RowValidationStatus.js +13 -0
- package/dist-cjs/packages/grid/src/RowValidationStatus.js.map +1 -0
- package/dist-cjs/packages/grid/src/TextCellEditor.js +12 -0
- package/dist-cjs/packages/grid/src/TextCellEditor.js.map +1 -1
- package/dist-cjs/packages/grid/src/index.js +1 -0
- package/dist-cjs/packages/grid/src/index.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/Cell.css.js +1 -1
- package/dist-cjs/packages/grid/src/internal/CellStatusIcons.js +46 -0
- package/dist-cjs/packages/grid/src/internal/CellStatusIcons.js.map +1 -0
- package/dist-cjs/packages/grid/src/internal/LeftPart.js +4 -2
- package/dist-cjs/packages/grid/src/internal/LeftPart.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/MiddlePart.js +4 -2
- package/dist-cjs/packages/grid/src/internal/MiddlePart.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/RightPart.js +4 -2
- package/dist-cjs/packages/grid/src/internal/RightPart.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/TableBody.js +11 -4
- package/dist-cjs/packages/grid/src/internal/TableBody.js.map +1 -1
- package/dist-cjs/packages/grid/src/internal/TableRow.css.js +1 -1
- package/dist-cjs/packages/grid/src/internal/TableRow.js +33 -12
- package/dist-cjs/packages/grid/src/internal/TableRow.js.map +1 -1
- package/dist-es/packages/grid/src/BaseCell.css.js +1 -1
- package/dist-es/packages/grid/src/BaseCell.js +35 -3
- package/dist-es/packages/grid/src/BaseCell.js.map +1 -1
- package/dist-es/packages/grid/src/ColumnSortContext.js +15 -0
- package/dist-es/packages/grid/src/ColumnSortContext.js.map +1 -0
- package/dist-es/packages/grid/src/Grid.js +211 -129
- package/dist-es/packages/grid/src/Grid.js.map +1 -1
- package/dist-es/packages/grid/src/GridColumn.js +1 -1
- package/dist-es/packages/grid/src/GridColumn.js.map +1 -1
- package/dist-es/packages/grid/src/HeaderCell.css.js +1 -1
- package/dist-es/packages/grid/src/HeaderCell.js +66 -2
- package/dist-es/packages/grid/src/HeaderCell.js.map +1 -1
- package/dist-es/packages/grid/src/NumericColumn.js +12 -0
- package/dist-es/packages/grid/src/NumericColumn.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionCheckboxCellValue.js +2 -2
- package/dist-es/packages/grid/src/RowSelectionCheckboxCellValue.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionCheckboxColumn.js +14 -7
- package/dist-es/packages/grid/src/RowSelectionCheckboxColumn.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionCheckboxHeaderCellValue.js +2 -2
- package/dist-es/packages/grid/src/RowSelectionCheckboxHeaderCellValue.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioCellValue.js +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioCellValue.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioColumn.js +11 -7
- package/dist-es/packages/grid/src/RowSelectionRadioColumn.js.map +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioHeaderCell.js +1 -1
- package/dist-es/packages/grid/src/RowSelectionRadioHeaderCell.js.map +1 -1
- package/dist-es/packages/grid/src/RowValidationStatus.js +9 -0
- package/dist-es/packages/grid/src/RowValidationStatus.js.map +1 -0
- package/dist-es/packages/grid/src/TextCellEditor.js +12 -0
- package/dist-es/packages/grid/src/TextCellEditor.js.map +1 -1
- package/dist-es/packages/grid/src/index.js +1 -1
- package/dist-es/packages/grid/src/internal/Cell.css.js +1 -1
- package/dist-es/packages/grid/src/internal/CellStatusIcons.js +40 -0
- package/dist-es/packages/grid/src/internal/CellStatusIcons.js.map +1 -0
- package/dist-es/packages/grid/src/internal/LeftPart.js +4 -2
- package/dist-es/packages/grid/src/internal/LeftPart.js.map +1 -1
- package/dist-es/packages/grid/src/internal/MiddlePart.js +4 -2
- package/dist-es/packages/grid/src/internal/MiddlePart.js.map +1 -1
- package/dist-es/packages/grid/src/internal/RightPart.js +4 -2
- package/dist-es/packages/grid/src/internal/RightPart.js.map +1 -1
- package/dist-es/packages/grid/src/internal/TableBody.js +11 -4
- package/dist-es/packages/grid/src/internal/TableBody.js.map +1 -1
- package/dist-es/packages/grid/src/internal/TableRow.css.js +1 -1
- package/dist-es/packages/grid/src/internal/TableRow.js +33 -12
- package/dist-es/packages/grid/src/internal/TableRow.js.map +1 -1
- package/dist-es/packages/grid/src/internal/gridHooks.js +1 -1
- package/dist-types/ColumnSortContext.d.ts +12 -0
- package/dist-types/Grid.d.ts +7 -1
- package/dist-types/GridColumn.d.ts +54 -2
- package/dist-types/RowValidationStatus.d.ts +7 -0
- package/dist-types/internal/CellStatusIcons.d.ts +4 -0
- package/dist-types/internal/LeftPart.d.ts +2 -0
- package/dist-types/internal/MiddlePart.d.ts +2 -0
- package/dist-types/internal/RightPart.d.ts +2 -0
- package/dist-types/internal/TableBody.d.ts +2 -0
- package/dist-types/internal/TableRow.d.ts +2 -1
- package/package.json +6 -4
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var styleInject_es = require('../../../node_modules/style-inject/dist/style-inject.es.js');
|
|
4
4
|
|
|
5
|
-
var css_248z = ".saltGridBaseCell-valueContainer {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: calc(var(--grid-row-height) - 2px);\n border-style: solid;\n border-width: 1px;\n border-color: transparent;\n --grid-cell-padding: 0 calc(var(--grid-padding) - 1px);\n}\n\n.saltGridCell-editable .saltGridBaseCell-valueContainer {\n border-style: solid;\n border-width: 1px;\n border-color: var(--grid-editableCell-borderColor);\n}\n\n.saltGridCell-editable:hover .saltGridBaseCell-valueContainer {\n border-color: var(--grid-editableCell-borderColor-hover);\n}\n\n.saltGridCell-editable:focus .saltGridBaseCell-valueContainer {\n border-color: transparent;\n}\n";
|
|
5
|
+
var css_248z = ".saltGridBaseCell-valueContainer {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: calc(var(--grid-row-height) - 2px);\n border-style: solid;\n border-width: 1px;\n border-color: transparent;\n --grid-cell-padding: 0 calc(var(--grid-padding) - 1px);\n}\n\n.saltGridCell-editable .saltGridBaseCell-valueContainer {\n border-style: solid;\n border-width: 1px;\n border-color: var(--grid-editableCell-borderColor);\n}\n\n.saltGridCell-editable:hover .saltGridBaseCell-valueContainer {\n border-color: var(--grid-editableCell-borderColor-hover);\n}\n\n.saltGridCell-editable:focus .saltGridBaseCell-valueContainer {\n border-color: transparent;\n}\n\n.saltGridBaseCell-status-error {\n --status-border-color: var(--salt-status-error-borderColor);\n --status-background-color: var(--salt-status-error-background-emphasize);\n}\n\n.saltGridBaseCell-status-warning {\n --status-border-color: var(--salt-status-warning-borderColor);\n --status-background-color: var(--salt-status-warning-background-emphasize);\n}\n\n.saltGridBaseCell-status-success {\n --status-border-color: var(--salt-status-success-borderColor);\n --status-background-color: var(--salt-status-success-background-emphasize);\n}\n\n.saltGridCell-editable .saltGridBaseCell-valueContainer {\n border-color: var(--status-border-color);\n}\n\n.saltGridBaseCell-hasValidation:focus .saltGridCursor {\n border-color: var(--status-border-color);\n}\n\n.saltGridBaseCell-hasValidation:focus .saltGridCornerTag-focusOnly {\n border-left-color: var(--status-border-color);\n}\n\n.saltGridBaseCell-valueContainer {\n background-color: var(--status-background-color);\n}\n\n.salt-density-high {\n --grid-statusIndicator-size: 5px;\n}\n\n.salt-density-medium {\n --grid-statusIndicator-size: 6px;\n}\n\n.salt-density-low {\n --grid-statusIndicator-size: 7px;\n}\n\n.salt-density-touch {\n --grid-statusIndicator-size: 9px;\n}\n\n.saltGridBaseCell-statusContainer {\n font-size: var(--saltGrid-statusIndicator-size, var(--grid-statusIndicator-size));\n position: absolute;\n bottom: 3px;\n right: 3px;\n}\n\n.saltGridBaseCell-statusContainer svg {\n display: block;\n fill: var(--status-border-color);\n}\n\n.saltGridBaseCell-statusContainer.saltGridBaseCell-statusContainer-align-right {\n right: auto;\n left: 3px;\n}\n";
|
|
6
6
|
styleInject_es(css_248z);
|
|
7
7
|
|
|
8
8
|
module.exports = css_248z;
|
|
@@ -27,11 +27,17 @@ require('./internal/TopRightPart.js');
|
|
|
27
27
|
require('./internal/FakeCell.css.js');
|
|
28
28
|
require('./internal/DefaultCellValue.js');
|
|
29
29
|
var CornerTag = require('./CornerTag.js');
|
|
30
|
+
var CellStatusIcons = require('./internal/CellStatusIcons.js');
|
|
30
31
|
|
|
31
32
|
const withBaseName = core.makePrefixer("saltGridBaseCell");
|
|
32
33
|
function getCellId(rowKey, column) {
|
|
33
34
|
return `R${rowKey}C${column.info.props.id}`;
|
|
34
35
|
}
|
|
36
|
+
const icons = {
|
|
37
|
+
warning: CellStatusIcons.CellWarningIcon,
|
|
38
|
+
error: CellStatusIcons.CellErrorIcon,
|
|
39
|
+
success: CellStatusIcons.CellSuccessIcon
|
|
40
|
+
};
|
|
35
41
|
function BaseCell(props) {
|
|
36
42
|
const {
|
|
37
43
|
column,
|
|
@@ -41,12 +47,20 @@ function BaseCell(props) {
|
|
|
41
47
|
isFocused,
|
|
42
48
|
isSelected,
|
|
43
49
|
isEditable,
|
|
44
|
-
children
|
|
50
|
+
children,
|
|
51
|
+
validationStatus,
|
|
52
|
+
validationMessage,
|
|
53
|
+
validationType = "light",
|
|
54
|
+
align
|
|
45
55
|
} = props;
|
|
46
56
|
const { ref, isFocusableContent, onFocus } = gridHooks.useFocusableContent();
|
|
57
|
+
const cellId = getCellId(row.key, column);
|
|
58
|
+
const hasValidation = !!validationStatus;
|
|
59
|
+
const hasValidationMessage = !!validationMessage || hasValidation;
|
|
60
|
+
const validationMessageId = `${cellId}-statusMessage`;
|
|
47
61
|
return /* @__PURE__ */ jsxRuntime.jsxs(Cell.Cell, {
|
|
48
62
|
ref,
|
|
49
|
-
id:
|
|
63
|
+
id: cellId,
|
|
50
64
|
"data-row-index": row.index,
|
|
51
65
|
"data-column-index": column.index,
|
|
52
66
|
"data-testid": isFocused ? "grid-cell-focused" : void 0,
|
|
@@ -55,15 +69,33 @@ function BaseCell(props) {
|
|
|
55
69
|
separator: column.separator,
|
|
56
70
|
isSelected,
|
|
57
71
|
isEditable,
|
|
58
|
-
className,
|
|
72
|
+
className: clsx.clsx(className, {
|
|
73
|
+
[withBaseName("hasValidation")]: hasValidation,
|
|
74
|
+
[withBaseName(`status-${validationStatus}`)]: validationStatus
|
|
75
|
+
}),
|
|
59
76
|
style,
|
|
60
77
|
tabIndex: isFocused && !isFocusableContent ? 0 : -1,
|
|
61
78
|
onFocus,
|
|
79
|
+
"aria-invalid": validationStatus === "error" || void 0,
|
|
80
|
+
"aria-describedby": hasValidationMessage ? validationMessageId : void 0,
|
|
62
81
|
children: [
|
|
82
|
+
hasValidationMessage ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
83
|
+
id: validationMessageId,
|
|
84
|
+
className: "salt-visuallyHidden",
|
|
85
|
+
"aria-hidden": true,
|
|
86
|
+
role: "status",
|
|
87
|
+
children: validationMessage ? validationMessage : `Cell validation state is ${validationStatus}`
|
|
88
|
+
}) : null,
|
|
63
89
|
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
64
90
|
className: clsx.clsx(withBaseName("valueContainer")),
|
|
65
91
|
children
|
|
66
92
|
}),
|
|
93
|
+
hasValidation && validationType === "strong" ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
94
|
+
className: clsx.clsx(withBaseName("statusContainer"), {
|
|
95
|
+
[withBaseName(`statusContainer-align-${align}`)]: align
|
|
96
|
+
}),
|
|
97
|
+
children: icons[validationStatus]
|
|
98
|
+
}) : null,
|
|
67
99
|
isFocused && isEditable && /* @__PURE__ */ jsxRuntime.jsx(CornerTag.CornerTag, {
|
|
68
100
|
focusOnly: true
|
|
69
101
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCell.js","sources":["../src/BaseCell.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport \"./BaseCell.css\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { GridCellProps } from \"./GridColumn\";\nimport { GridColumnModel } from \"./Grid\";\nimport { Cell, Cursor, useFocusableContent } from \"./internal\";\nimport { CornerTag } from \"./CornerTag\";\n\nconst withBaseName = makePrefixer(\"saltGridBaseCell\");\n\nexport function getCellId<T>(rowKey: string, column: GridColumnModel<T>) {\n return `R${rowKey}C${column.info.props.id}`;\n}\n\n// Default component for grid cells. Provides selection, on-hover highlighting,\n// cursor etc.\nexport function BaseCell<T>(props: GridCellProps<T>) {\n const {\n column,\n className,\n row,\n style,\n isFocused,\n isSelected,\n isEditable,\n children,\n } = props;\n\n const { ref, isFocusableContent, onFocus } =\n useFocusableContent<HTMLTableCellElement>();\n
|
|
1
|
+
{"version":3,"file":"BaseCell.js","sources":["../src/BaseCell.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport \"./BaseCell.css\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { GridCellProps } from \"./GridColumn\";\nimport { GridColumnModel } from \"./Grid\";\nimport { Cell, Cursor, useFocusableContent } from \"./internal\";\nimport { CornerTag } from \"./CornerTag\";\nimport {\n CellErrorIcon,\n CellSuccessIcon,\n CellWarningIcon,\n} from \"./internal/CellStatusIcons\";\n\nconst withBaseName = makePrefixer(\"saltGridBaseCell\");\n\nexport function getCellId<T>(rowKey: string, column: GridColumnModel<T>) {\n return `R${rowKey}C${column.info.props.id}`;\n}\n\nconst icons = {\n warning: CellWarningIcon,\n error: CellErrorIcon,\n success: CellSuccessIcon,\n};\n\n// Default component for grid cells. Provides selection, on-hover highlighting,\n// cursor etc.\nexport function BaseCell<T>(props: GridCellProps<T>) {\n const {\n column,\n className,\n row,\n style,\n isFocused,\n isSelected,\n isEditable,\n children,\n validationStatus,\n validationMessage,\n validationType = \"light\",\n align,\n } = props;\n\n const { ref, isFocusableContent, onFocus } =\n useFocusableContent<HTMLTableCellElement>();\n const cellId = getCellId(row.key, column);\n const hasValidation = !!validationStatus;\n const hasValidationMessage = !!validationMessage || hasValidation;\n const validationMessageId = `${cellId}-statusMessage`;\n return (\n <Cell\n ref={ref}\n id={cellId}\n data-row-index={row.index}\n data-column-index={column.index}\n data-testid={isFocused ? \"grid-cell-focused\" : undefined}\n // aria-colindex uses one-based array indexing\n aria-colindex={column.index + 1}\n role=\"gridcell\"\n separator={column.separator}\n isSelected={isSelected}\n isEditable={isEditable}\n className={clsx(className, {\n [withBaseName(\"hasValidation\")]: hasValidation,\n [withBaseName(`status-${validationStatus as string}`)]:\n validationStatus,\n })}\n style={style}\n tabIndex={isFocused && !isFocusableContent ? 0 : -1}\n onFocus={onFocus}\n aria-invalid={validationStatus === \"error\" || undefined}\n aria-describedby={hasValidationMessage ? validationMessageId : undefined}\n >\n {hasValidationMessage ? (\n <div\n id={validationMessageId}\n className=\"salt-visuallyHidden\"\n aria-hidden\n role=\"status\"\n >\n {validationMessage\n ? validationMessage\n : `Cell validation state is ${validationStatus as string}`}\n </div>\n ) : null}\n <div className={clsx(withBaseName(\"valueContainer\"))}>{children}</div>\n {hasValidation && validationType === \"strong\" ? (\n <div\n className={clsx(withBaseName(\"statusContainer\"), {\n [withBaseName(`statusContainer-align-${align as string}`)]: align,\n })}\n >\n {icons[validationStatus]}\n </div>\n ) : null}\n {isFocused && isEditable && <CornerTag focusOnly={true} />}\n {isFocused && !isFocusableContent && <Cursor />}\n </Cell>\n );\n}\n"],"names":["makePrefixer","CellWarningIcon","CellErrorIcon","CellSuccessIcon","useFocusableContent","jsxs","Cell","clsx","jsx","CornerTag","Cursor"],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
|
|
7
|
+
const ColumnSortContext = react.createContext(
|
|
8
|
+
void 0
|
|
9
|
+
);
|
|
10
|
+
const useColumnSortContext = () => {
|
|
11
|
+
const c = react.useContext(ColumnSortContext);
|
|
12
|
+
if (!c) {
|
|
13
|
+
throw new Error(`useColumnSortContext invoked outside of a Grid`);
|
|
14
|
+
}
|
|
15
|
+
return c;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.ColumnSortContext = ColumnSortContext;
|
|
19
|
+
exports.useColumnSortContext = useColumnSortContext;
|
|
20
|
+
//# sourceMappingURL=ColumnSortContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnSortContext.js","sources":["../src/ColumnSortContext.ts"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport { SortOrder } from \"./Grid\";\nimport { GridColumnProps } from \"./GridColumn\";\n\nexport interface ColumnSortContext {\n sortByColumnId?: GridColumnProps[\"id\"];\n setSortByColumnId: (c: React.SetStateAction<GridColumnProps[\"id\"]>) => void;\n sortOrder: SortOrder;\n setSortOrder: (o: SortOrder) => void;\n onClickSortColumn: (colHeaderId: GridColumnProps[\"id\"]) => void;\n}\n\nexport const ColumnSortContext = createContext<ColumnSortContext | undefined>(\n undefined\n);\n\nexport const useColumnSortContext = () => {\n const c = useContext(ColumnSortContext);\n if (!c) {\n throw new Error(`useColumnSortContext invoked outside of a Grid`);\n }\n return c;\n};\n"],"names":["createContext","useContext"],"mappings":";;;;;;AAYO,MAAM,iBAAoB,GAAAA,mBAAA;AAAA,EAC/B,KAAA,CAAA;AACF,EAAA;AAEO,MAAM,uBAAuB,MAAM;AACxC,EAAM,MAAA,CAAA,GAAIC,iBAAW,iBAAiB,CAAA,CAAA;AACtC,EAAA,IAAI,CAAC,CAAG,EAAA;AACN,IAAM,MAAA,IAAI,MAAM,CAAgD,8CAAA,CAAA,CAAA,CAAA;AAAA,GAClE;AACA,EAAO,OAAA,CAAA,CAAA;AACT;;;;;"}
|
|
@@ -34,12 +34,20 @@ var ColumnDragContext = require('./ColumnDragContext.js');
|
|
|
34
34
|
var ColumnGhost = require('./internal/ColumnGhost.js');
|
|
35
35
|
var ColumnDropTarget = require('./internal/ColumnDropTarget.js');
|
|
36
36
|
var ColumnDataContext = require('./ColumnDataContext.js');
|
|
37
|
+
var ColumnSortContext = require('./ColumnSortContext.js');
|
|
37
38
|
|
|
38
39
|
const withBaseName = core.makePrefixer("saltGrid");
|
|
40
|
+
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
41
|
+
SortOrder2["ASC"] = "asc";
|
|
42
|
+
SortOrder2["DESC"] = "desc";
|
|
43
|
+
SortOrder2["NONE"] = "none";
|
|
44
|
+
return SortOrder2;
|
|
45
|
+
})(SortOrder || {});
|
|
39
46
|
function defaultRowKeyGetter(row, index) {
|
|
40
47
|
return `${index}`;
|
|
41
48
|
}
|
|
42
49
|
const Grid = function Grid2(props) {
|
|
50
|
+
var _a, _b, _c;
|
|
43
51
|
const {
|
|
44
52
|
rowData,
|
|
45
53
|
zebra,
|
|
@@ -59,7 +67,8 @@ const Grid = function Grid2(props) {
|
|
|
59
67
|
onColumnMoved,
|
|
60
68
|
cellSelectionMode = "none",
|
|
61
69
|
onVisibleRowRangeChange,
|
|
62
|
-
headerIsFocusable
|
|
70
|
+
headerIsFocusable,
|
|
71
|
+
getRowValidationStatus
|
|
63
72
|
} = props;
|
|
64
73
|
const rootRef = react.useRef(null);
|
|
65
74
|
const scrollableRef = react.useRef(null);
|
|
@@ -87,6 +96,8 @@ const Grid = function Grid2(props) {
|
|
|
87
96
|
const [focusedPart, setFocusedPart] = react.useState(
|
|
88
97
|
headerIsFocusable ? "header" : "body"
|
|
89
98
|
);
|
|
99
|
+
const [sortByColumnId, setSortByColumnId] = react.useState("");
|
|
100
|
+
const [sortOrder, setSortOrder] = react.useState("none" /* NONE */);
|
|
90
101
|
const [editMode, setEditMode] = react.useState(false);
|
|
91
102
|
const [initialText, setInitialText] = react.useState(void 0);
|
|
92
103
|
const resizeClient = react.useCallback(
|
|
@@ -131,8 +142,8 @@ const Grid = function Grid2(props) {
|
|
|
131
142
|
);
|
|
132
143
|
const midGrpByColId = react.useMemo(() => {
|
|
133
144
|
const m = /* @__PURE__ */ new Map();
|
|
134
|
-
for (
|
|
135
|
-
for (
|
|
145
|
+
for (const g of midGroups) {
|
|
146
|
+
for (const c of g.childrenIds) {
|
|
136
147
|
m.set(c, g);
|
|
137
148
|
}
|
|
138
149
|
}
|
|
@@ -246,6 +257,70 @@ const Grid = function Grid2(props) {
|
|
|
246
257
|
}),
|
|
247
258
|
[getColById]
|
|
248
259
|
);
|
|
260
|
+
const isSortMode = sortByColumnId && sortOrder !== "none" /* NONE */;
|
|
261
|
+
const onSortOrderChange = (_a = getColById(sortByColumnId)) == null ? void 0 : _a.info.props.onSortOrderChange;
|
|
262
|
+
const valueGetter = ((_b = getColById(sortByColumnId)) == null ? void 0 : _b.info.props.getValue) || ((r) => {
|
|
263
|
+
return r[sortByColumnId];
|
|
264
|
+
});
|
|
265
|
+
const customSortingFn = (_c = getColById(sortByColumnId)) == null ? void 0 : _c.info.props.customSort;
|
|
266
|
+
const sortedRowData = react.useMemo(() => {
|
|
267
|
+
if (!isSortMode || onSortOrderChange)
|
|
268
|
+
return rowData;
|
|
269
|
+
if (customSortingFn) {
|
|
270
|
+
return customSortingFn({ rowData, sortOrder });
|
|
271
|
+
}
|
|
272
|
+
const sortedData = [...rowData].sort(
|
|
273
|
+
(a, b) => valueGetter(a) < valueGetter(b) ? -1 : 1
|
|
274
|
+
);
|
|
275
|
+
if (sortOrder === "desc" /* DESC */) {
|
|
276
|
+
return sortedData.reverse();
|
|
277
|
+
}
|
|
278
|
+
return sortedData;
|
|
279
|
+
}, [
|
|
280
|
+
onSortOrderChange,
|
|
281
|
+
valueGetter,
|
|
282
|
+
customSortingFn,
|
|
283
|
+
isSortMode,
|
|
284
|
+
rowData,
|
|
285
|
+
sortByColumnId,
|
|
286
|
+
sortOrder
|
|
287
|
+
]);
|
|
288
|
+
const onClickSortColumn = react.useCallback(
|
|
289
|
+
(colHeaderId) => {
|
|
290
|
+
if (sortByColumnId === colHeaderId) {
|
|
291
|
+
switch (sortOrder) {
|
|
292
|
+
case "asc" /* ASC */:
|
|
293
|
+
setSortOrder("desc" /* DESC */);
|
|
294
|
+
break;
|
|
295
|
+
case "desc" /* DESC */:
|
|
296
|
+
setSortOrder("none" /* NONE */);
|
|
297
|
+
break;
|
|
298
|
+
default:
|
|
299
|
+
setSortOrder("asc" /* ASC */);
|
|
300
|
+
}
|
|
301
|
+
} else {
|
|
302
|
+
setSortByColumnId(colHeaderId);
|
|
303
|
+
setSortOrder("asc" /* ASC */);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
[sortByColumnId, sortOrder]
|
|
307
|
+
);
|
|
308
|
+
const columnSortContext = react.useMemo(
|
|
309
|
+
() => ({
|
|
310
|
+
sortByColumnId,
|
|
311
|
+
setSortByColumnId,
|
|
312
|
+
sortOrder,
|
|
313
|
+
setSortOrder,
|
|
314
|
+
onClickSortColumn
|
|
315
|
+
}),
|
|
316
|
+
[
|
|
317
|
+
sortByColumnId,
|
|
318
|
+
setSortByColumnId,
|
|
319
|
+
sortOrder,
|
|
320
|
+
setSortOrder,
|
|
321
|
+
onClickSortColumn
|
|
322
|
+
]
|
|
323
|
+
);
|
|
249
324
|
const scroll = react.useCallback(
|
|
250
325
|
(left, top, source) => {
|
|
251
326
|
setScrollSource(source || "user");
|
|
@@ -269,9 +344,9 @@ const Grid = function Grid2(props) {
|
|
|
269
344
|
);
|
|
270
345
|
const focusCellElement = (part, rowIdx, colIdx) => {
|
|
271
346
|
setTimeout(() => {
|
|
272
|
-
var
|
|
347
|
+
var _a2;
|
|
273
348
|
const selector = part === "body" ? `td[data-row-index="${rowIdx}"][data-column-index="${colIdx}"]` : `th[data-column-index="${colIdx}"]`;
|
|
274
|
-
const nodeToFocus = (
|
|
349
|
+
const nodeToFocus = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(selector);
|
|
275
350
|
if (nodeToFocus) {
|
|
276
351
|
nodeToFocus.focus({ preventScroll: true });
|
|
277
352
|
} else {
|
|
@@ -309,7 +384,7 @@ const Grid = function Grid2(props) {
|
|
|
309
384
|
`onChange is not specified for editable column "${c.info.props.id}".`
|
|
310
385
|
);
|
|
311
386
|
} else {
|
|
312
|
-
handler(
|
|
387
|
+
handler(sortedRowData[cursorRowIdx], cursorRowIdx, value);
|
|
313
388
|
}
|
|
314
389
|
setEditMode(false);
|
|
315
390
|
focusCellElement(focusedPart, cursorRowIdx, cursorColIdx);
|
|
@@ -333,7 +408,7 @@ const Grid = function Grid2(props) {
|
|
|
333
408
|
onMouseDown: onRowSelectionMouseDown
|
|
334
409
|
} = gridHooks.useRowSelection(
|
|
335
410
|
rowKeyGetter,
|
|
336
|
-
|
|
411
|
+
sortedRowData,
|
|
337
412
|
defaultSelectedRowIdxs,
|
|
338
413
|
selectedRowIdxs,
|
|
339
414
|
rowSelectionMode,
|
|
@@ -342,7 +417,6 @@ const Grid = function Grid2(props) {
|
|
|
342
417
|
const rangeSelection = gridHooks.useRangeSelection(cellSelectionMode);
|
|
343
418
|
const moveCursor = react.useCallback(
|
|
344
419
|
(part, rowIdx, colIdx) => {
|
|
345
|
-
cancelEditMode();
|
|
346
420
|
if (!headerIsFocusable && part === "header") {
|
|
347
421
|
console.warn(
|
|
348
422
|
`Cannot move focus to the header. "headerIsFocusable" prop is false.`
|
|
@@ -352,10 +426,10 @@ const Grid = function Grid2(props) {
|
|
|
352
426
|
setFocusedPart(part);
|
|
353
427
|
colIdx = utils.clamp(colIdx, 0, cols.length - 1);
|
|
354
428
|
if (part === "body") {
|
|
355
|
-
if (
|
|
429
|
+
if (sortedRowData.length < 1 || cols.length < 1) {
|
|
356
430
|
return;
|
|
357
431
|
}
|
|
358
|
-
rowIdx = utils.clamp(rowIdx, 0,
|
|
432
|
+
rowIdx = utils.clamp(rowIdx, 0, sortedRowData.length - 1);
|
|
359
433
|
} else if (part === "header") {
|
|
360
434
|
rowIdx = 0;
|
|
361
435
|
}
|
|
@@ -370,7 +444,7 @@ const Grid = function Grid2(props) {
|
|
|
370
444
|
[
|
|
371
445
|
setCursorRowIdx,
|
|
372
446
|
setCursorColIdx,
|
|
373
|
-
|
|
447
|
+
sortedRowData,
|
|
374
448
|
rowKeyGetter,
|
|
375
449
|
cols,
|
|
376
450
|
rootRef.current,
|
|
@@ -381,7 +455,7 @@ const Grid = function Grid2(props) {
|
|
|
381
455
|
headerIsFocusable
|
|
382
456
|
]
|
|
383
457
|
);
|
|
384
|
-
const rows = gridHooks.useRowModels(rowKeyGetter,
|
|
458
|
+
const rows = gridHooks.useRowModels(rowKeyGetter, sortedRowData, visRowRng);
|
|
385
459
|
const isLeftRaised = scrollLeft > 0;
|
|
386
460
|
const isRightRaised = scrollLeft + clientMidWidth < midWidth;
|
|
387
461
|
const isHeaderRaised = scrollTop > 0;
|
|
@@ -548,7 +622,7 @@ const Grid = function Grid2(props) {
|
|
|
548
622
|
if (cursorColIdx != void 0) {
|
|
549
623
|
rangeSelection.selectRange({
|
|
550
624
|
start: { rowIdx: 0, colIdx: cursorColIdx },
|
|
551
|
-
end: { rowIdx:
|
|
625
|
+
end: { rowIdx: sortedRowData.length, colIdx: cursorColIdx }
|
|
552
626
|
});
|
|
553
627
|
}
|
|
554
628
|
} else {
|
|
@@ -569,11 +643,13 @@ const Grid = function Grid2(props) {
|
|
|
569
643
|
if (event.ctrlKey || event.metaKey) {
|
|
570
644
|
rangeSelection.selectRange({
|
|
571
645
|
start: { rowIdx: 0, colIdx: 0 },
|
|
572
|
-
end: { rowIdx:
|
|
646
|
+
end: { rowIdx: sortedRowData.length, colIdx: cols.length }
|
|
573
647
|
});
|
|
574
648
|
selectAll();
|
|
649
|
+
return true;
|
|
650
|
+
} else {
|
|
651
|
+
return false;
|
|
575
652
|
}
|
|
576
|
-
break;
|
|
577
653
|
default:
|
|
578
654
|
return false;
|
|
579
655
|
}
|
|
@@ -588,7 +664,7 @@ const Grid = function Grid2(props) {
|
|
|
588
664
|
selectAll,
|
|
589
665
|
cursorColIdx,
|
|
590
666
|
cursorRowIdx,
|
|
591
|
-
|
|
667
|
+
sortedRowData.length,
|
|
592
668
|
cols.length,
|
|
593
669
|
focusedPart
|
|
594
670
|
]
|
|
@@ -603,7 +679,7 @@ const Grid = function Grid2(props) {
|
|
|
603
679
|
const [minCol, maxCol] = [start.colIdx, end.colIdx].sort(c);
|
|
604
680
|
const text = [];
|
|
605
681
|
for (let r = minRow; r <= maxRow; ++r) {
|
|
606
|
-
const row =
|
|
682
|
+
const row = sortedRowData[r];
|
|
607
683
|
const rowText = [];
|
|
608
684
|
for (let c2 = minCol; c2 <= maxCol; ++c2) {
|
|
609
685
|
const col = cols[c2];
|
|
@@ -679,7 +755,7 @@ const Grid = function Grid2(props) {
|
|
|
679
755
|
if (!event.ctrlKey) {
|
|
680
756
|
moveCursor(focusedPart, cursorRowIdx, cols.length - 1);
|
|
681
757
|
} else {
|
|
682
|
-
moveCursor(focusedPart,
|
|
758
|
+
moveCursor(focusedPart, sortedRowData.length - 1, cols.length - 1);
|
|
683
759
|
}
|
|
684
760
|
break;
|
|
685
761
|
case "Tab":
|
|
@@ -688,7 +764,7 @@ const Grid = function Grid2(props) {
|
|
|
688
764
|
if (cursorColIdx < cols.length - 1) {
|
|
689
765
|
moveCursor(focusedPart, cursorRowIdx, cursorColIdx + 1);
|
|
690
766
|
} else {
|
|
691
|
-
if (cursorRowIdx <
|
|
767
|
+
if (cursorRowIdx < sortedRowData.length - 1) {
|
|
692
768
|
moveCursor(focusedPart, cursorRowIdx + 1, 0);
|
|
693
769
|
}
|
|
694
770
|
}
|
|
@@ -728,7 +804,7 @@ const Grid = function Grid2(props) {
|
|
|
728
804
|
cursorRowIdx,
|
|
729
805
|
cursorRowIdx,
|
|
730
806
|
cols.length,
|
|
731
|
-
|
|
807
|
+
sortedRowData.length,
|
|
732
808
|
headerIsFocusable,
|
|
733
809
|
pageSize
|
|
734
810
|
]
|
|
@@ -813,115 +889,121 @@ const Grid = function Grid2(props) {
|
|
|
813
889
|
value: sizingContext,
|
|
814
890
|
children: /* @__PURE__ */ jsxRuntime.jsx(EditorContext.EditorContext.Provider, {
|
|
815
891
|
value: editorContext,
|
|
816
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
892
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ColumnDataContext.ColumnDataContext.Provider, {
|
|
817
893
|
value: columnDataContext,
|
|
818
|
-
children:
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
894
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ColumnSortContext.ColumnSortContext.Provider, {
|
|
895
|
+
value: columnSortContext,
|
|
896
|
+
children: [
|
|
897
|
+
props.children,
|
|
898
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
899
|
+
className: clsx.clsx(
|
|
900
|
+
withBaseName(),
|
|
901
|
+
{
|
|
902
|
+
[withBaseName("zebra")]: zebra,
|
|
903
|
+
[withBaseName("columnSeparators")]: columnSeparators,
|
|
904
|
+
[withBaseName("pinnedSeparators")]: pinnedSeparators,
|
|
905
|
+
[withBaseName("primaryBackground")]: variant === "primary",
|
|
906
|
+
[withBaseName("secondaryBackground")]: variant === "secondary"
|
|
907
|
+
},
|
|
908
|
+
className
|
|
909
|
+
),
|
|
910
|
+
style: rootStyle,
|
|
911
|
+
ref: rootRef,
|
|
912
|
+
onKeyDown,
|
|
913
|
+
onKeyUp,
|
|
914
|
+
onMouseDown,
|
|
915
|
+
onFocus,
|
|
916
|
+
onBlur,
|
|
917
|
+
"data-name": "grid-root",
|
|
918
|
+
role: "grid",
|
|
919
|
+
"aria-colcount": cols.length,
|
|
920
|
+
"aria-rowcount": rowCount + headRowCount,
|
|
921
|
+
"aria-multiselectable": rowSelectionMode === "multi",
|
|
922
|
+
children: [
|
|
923
|
+
/* @__PURE__ */ jsxRuntime.jsx(CellMeasure.CellMeasure, {
|
|
924
|
+
setRowHeight
|
|
925
|
+
}),
|
|
926
|
+
/* @__PURE__ */ jsxRuntime.jsx(Scrollable.Scrollable, {
|
|
927
|
+
resizeClient,
|
|
928
|
+
scrollLeft,
|
|
929
|
+
scrollTop,
|
|
930
|
+
scrollSource,
|
|
931
|
+
scroll,
|
|
932
|
+
scrollerRef: scrollableRef,
|
|
933
|
+
topRef,
|
|
934
|
+
rightRef,
|
|
935
|
+
bottomRef,
|
|
936
|
+
leftRef,
|
|
937
|
+
middleRef
|
|
938
|
+
}),
|
|
939
|
+
!hideHeader && leftCols.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(TopLeftPart.TopLeftPart, {
|
|
940
|
+
onWheel,
|
|
941
|
+
columns: leftCols,
|
|
942
|
+
columnGroups: leftGroups,
|
|
943
|
+
rightShadow: isLeftRaised,
|
|
944
|
+
bottomShadow: isHeaderRaised
|
|
945
|
+
}),
|
|
946
|
+
!hideHeader && /* @__PURE__ */ jsxRuntime.jsx(TopPart.TopPart, {
|
|
947
|
+
columns: headVisibleColumns,
|
|
948
|
+
columnGroups: visColGrps,
|
|
949
|
+
topRef,
|
|
950
|
+
onWheel,
|
|
951
|
+
midGap,
|
|
952
|
+
bottomShadow: isHeaderRaised
|
|
953
|
+
}),
|
|
954
|
+
!hideHeader && rightCols.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(TopRightPart.TopRightPart, {
|
|
955
|
+
onWheel,
|
|
956
|
+
columns: rightCols,
|
|
957
|
+
columnGroups: rightGroups,
|
|
958
|
+
leftShadow: isRightRaised,
|
|
959
|
+
bottomShadow: isHeaderRaised
|
|
960
|
+
}),
|
|
961
|
+
leftCols.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(LeftPart.LeftPart, {
|
|
962
|
+
leftRef,
|
|
963
|
+
onWheel,
|
|
964
|
+
columns: leftCols,
|
|
965
|
+
rows,
|
|
966
|
+
rightShadow: isLeftRaised,
|
|
967
|
+
hoverOverRowKey: hoverRowKey,
|
|
968
|
+
setHoverOverRowKey: setHoverRowKey,
|
|
969
|
+
zebra,
|
|
970
|
+
getRowValidationStatus
|
|
971
|
+
}),
|
|
972
|
+
/* @__PURE__ */ jsxRuntime.jsx(MiddlePart.MiddlePart, {
|
|
973
|
+
middleRef,
|
|
974
|
+
onWheel,
|
|
975
|
+
columns: bodyVisibleColumns,
|
|
976
|
+
rows,
|
|
977
|
+
hoverOverRowKey: hoverRowKey,
|
|
978
|
+
setHoverOverRowKey: setHoverRowKey,
|
|
979
|
+
midGap,
|
|
980
|
+
zebra,
|
|
981
|
+
getRowValidationStatus
|
|
982
|
+
}),
|
|
983
|
+
rightCols.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(RightPart.RightPart, {
|
|
984
|
+
rightRef,
|
|
985
|
+
onWheel,
|
|
986
|
+
columns: rightCols,
|
|
987
|
+
rows,
|
|
988
|
+
leftShadow: isRightRaised,
|
|
989
|
+
hoverOverRowKey: hoverRowKey,
|
|
990
|
+
setHoverOverRowKey: setHoverRowKey,
|
|
991
|
+
zebra,
|
|
992
|
+
getRowValidationStatus
|
|
993
|
+
}),
|
|
994
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColumnDropTarget.ColumnDropTarget, {
|
|
995
|
+
x: activeTarget == null ? void 0 : activeTarget.x
|
|
996
|
+
}),
|
|
997
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColumnGhost.ColumnGhost, {
|
|
998
|
+
columns: cols,
|
|
999
|
+
rows,
|
|
1000
|
+
dragState,
|
|
1001
|
+
zebra
|
|
1002
|
+
})
|
|
1003
|
+
]
|
|
1004
|
+
})
|
|
1005
|
+
]
|
|
1006
|
+
})
|
|
925
1007
|
})
|
|
926
1008
|
})
|
|
927
1009
|
})
|
|
@@ -933,4 +1015,5 @@ const Grid = function Grid2(props) {
|
|
|
933
1015
|
};
|
|
934
1016
|
|
|
935
1017
|
exports.Grid = Grid;
|
|
1018
|
+
exports.SortOrder = SortOrder;
|
|
936
1019
|
//# sourceMappingURL=Grid.js.map
|