xmlui 0.10.18 → 0.10.20
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/lib/{apiInterceptorWorker-DPgtUtdA.mjs → apiInterceptorWorker-QiltRtq1.mjs} +1 -1
- package/dist/lib/{index-Cy6Emsex.mjs → index-Ckhnrf1F.mjs} +1093 -714
- package/dist/lib/index.css +1 -1
- package/dist/{metadata/initMock-D0wDKF_I.mjs → lib/initMock-qnCFw6Zc.mjs} +25 -15
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-CtY0QcvH.mjs → metadata-utils-BTIt1_wE.mjs} +1 -1
- package/dist/lib/{server-common-Cine5nRR.mjs → server-common-DYZtsdM7.mjs} +51 -14
- package/dist/lib/{transform-bHBjkKSL.mjs → transform-Tooy42EB.mjs} +16 -18
- package/dist/lib/xmlui-parser.mjs +2 -2
- package/dist/lib/{xmlui-serializer-DB6BLiXK.mjs → xmlui-serializer-uCYa8_tZ.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +11 -3
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{apiInterceptorWorker-BmKP8bnq.mjs → apiInterceptorWorker-Dql7QGw2.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-CB63ngkU.mjs → collectedComponentMetadata-Dg7P-zOz.mjs} +1071 -701
- package/dist/{lib/initMock-B-rmnC-t.mjs → metadata/initMock-ZyyFNOpL.mjs} +25 -15
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Animation/AnimationNative.js +28 -28
- package/dist/scripts/src/components/App/App.spec.js +17 -17
- package/dist/scripts/src/components/AppState/AppState.js +3 -2
- package/dist/scripts/src/components/AppState/AppState.spec.js +26 -2
- package/dist/scripts/src/components/AppState/AppStateNative.js +3 -4
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +15 -10
- package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +25 -4
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +4 -4
- package/dist/scripts/src/components/Carousel/Carousel.spec.js +214 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +5 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +2 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +193 -0
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +28 -23
- package/dist/scripts/src/components/DatePicker/DatePicker.js +14 -9
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +21 -18
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +24 -21
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +3 -3
- package/dist/scripts/src/components/FileInput/FileInput.spec.js +7 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +4 -13
- package/dist/scripts/src/components/Form/Form.spec.js +25 -9
- package/dist/scripts/src/components/Form/FormNative.js +7 -4
- package/dist/scripts/src/components/FormItem/FormItem.js +3 -1
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +5 -14
- package/dist/scripts/src/components/FormItem/FormItemNative.js +12 -8
- package/dist/scripts/src/components/FormItem/Validations.js +2 -2
- package/dist/scripts/src/components/Icon/Icon.js +1 -1
- package/dist/scripts/src/components/IconRegistryContext.js +1 -1
- package/dist/scripts/src/components/List/ListNative.js +2 -2
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +3 -12
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +2 -2
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +6 -3
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +3 -3
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +7 -2
- package/dist/scripts/src/components/Pagination/Pagination.spec.js +5 -0
- package/dist/scripts/src/components/Pagination/PaginationNative.js +1 -3
- package/dist/scripts/src/components/Queue/Queue.spec.js +45 -47
- package/dist/scripts/src/components/Queue/QueueNative.js +1 -1
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +14 -5
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +1 -1
- package/dist/scripts/src/components/Select/MultiSelectOption.js +42 -0
- package/dist/scripts/src/components/Select/Select.js +3 -3
- package/dist/scripts/src/components/Select/Select.spec.js +286 -217
- package/dist/scripts/src/components/Select/SelectContext.js +8 -1
- package/dist/scripts/src/components/Select/SelectNative.js +134 -142
- package/dist/scripts/src/components/Select/SelectOption.js +34 -0
- package/dist/scripts/src/components/Select/SimpleSelect.js +57 -0
- package/dist/scripts/src/components/Slider/Slider.spec.js +7 -0
- package/dist/scripts/src/components/Spinner/Spinner.spec.js +1 -1
- package/dist/scripts/src/components/Switch/Switch.spec.js +24 -17
- package/dist/scripts/src/components/Table/Table.js +11 -1
- package/dist/scripts/src/components/Table/Table.spec.js +272 -0
- package/dist/scripts/src/components/Table/TableNative.js +162 -5
- package/dist/scripts/src/components/Table/useRowSelection.js +14 -23
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +59 -8
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +7 -0
- package/dist/scripts/src/components/Theme/Theme.js +2 -1
- package/dist/scripts/src/components/Theme/Theme.spec.js +266 -0
- package/dist/scripts/src/components/Theme/ThemeNative.js +8 -1
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +47 -40
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +6 -20
- package/dist/scripts/src/components/Toggle/Toggle.js +3 -1
- package/dist/scripts/src/components/Tree/TreeNative.js +9 -11
- package/dist/scripts/src/components-core/InspectorContext.js +1 -1
- package/dist/scripts/src/components-core/StandaloneApp.js +6 -8
- package/dist/scripts/src/components-core/action/FileUploadAction.js +1 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +50 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +6 -1
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +9 -11
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +3 -3
- package/dist/scripts/src/components-core/interception/Backend.js +1 -1
- package/dist/scripts/src/components-core/interception/IndexedDb.js +64 -66
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +2 -2
- package/dist/scripts/src/components-core/loader/DataLoader.js +6 -14
- package/dist/scripts/src/components-core/loader/Loader.js +11 -11
- package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +4 -2
- package/dist/scripts/src/components-core/loader/PageableLoader.js +10 -9
- package/dist/scripts/src/components-core/rendering/AppContent.js +1 -7
- package/dist/scripts/src/components-core/rendering/ErrorBoundary.js +1 -1
- package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +1 -1
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +180 -186
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +6 -6
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +2 -2
- package/dist/scripts/src/components-core/utils/actionUtils.js +1 -1
- package/dist/scripts/src/components-core/utils/hooks.js +1 -1
- package/dist/scripts/src/components-core/utils/misc.js +4 -4
- package/dist/scripts/src/components-core/xmlui-parser.js +47 -31
- package/dist/scripts/src/language-server/server-common.js +25 -24
- package/dist/scripts/src/language-server/services/common/lsp-utils.js +2 -2
- package/dist/scripts/src/language-server/services/completion.js +20 -2
- package/dist/scripts/src/language-server/services/diagnostic.js +1 -1
- package/dist/scripts/src/language-server/services/hover.js +2 -2
- package/dist/scripts/src/parsers/common/utils.js +2 -2
- package/dist/scripts/src/parsers/scripting/Lexer.js +21 -15
- package/dist/scripts/src/parsers/scripting/Parser.js +8 -9
- package/dist/scripts/src/parsers/style-parser/StyleLexer.js +22 -22
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +70 -68
- package/dist/scripts/src/testing/ComponentDrivers.js +20 -39
- package/dist/scripts/src/testing/component-test-helpers.js +34 -50
- package/dist/scripts/src/testing/fixtures.js +114 -113
- package/dist/scripts/src/testing/themed-app-test-helpers.js +7 -13
- package/dist/standalone/xmlui-standalone.es.d.ts +11 -3
- package/dist/standalone/xmlui-standalone.umd.js +34 -34
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.defaultProps = exports.Table = exports.TablePaginationControlsLocationValues = void 0;
|
|
26
|
+
exports.defaultProps = exports.Table = exports.CheckboxToleranceValues = exports.TablePaginationControlsLocationValues = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = require("react");
|
|
29
29
|
const react_dom_1 = require("react-dom");
|
|
@@ -45,11 +45,53 @@ const IconNative_1 = require("../Icon/IconNative");
|
|
|
45
45
|
const useRowSelection_1 = __importDefault(require("./useRowSelection"));
|
|
46
46
|
const PaginationNative_1 = require("../Pagination/PaginationNative");
|
|
47
47
|
exports.TablePaginationControlsLocationValues = ["top", "bottom", "both"];
|
|
48
|
+
exports.CheckboxToleranceValues = ["none", "compact", "comfortable", "spacious"];
|
|
48
49
|
function defaultIsRowDisabled(_) {
|
|
49
50
|
return false;
|
|
50
51
|
}
|
|
51
52
|
const SELECT_COLUMN_WIDTH = 42;
|
|
52
53
|
const DEFAULT_PAGE_SIZES = [10];
|
|
54
|
+
/**
|
|
55
|
+
* Maps checkbox tolerance values to pixel values
|
|
56
|
+
* @param tolerance - The tolerance level
|
|
57
|
+
* @returns The number of pixels for the tolerance
|
|
58
|
+
*/
|
|
59
|
+
const getCheckboxTolerancePixels = (tolerance) => {
|
|
60
|
+
switch (tolerance) {
|
|
61
|
+
case "none":
|
|
62
|
+
return 0;
|
|
63
|
+
case "compact":
|
|
64
|
+
return 8;
|
|
65
|
+
case "comfortable":
|
|
66
|
+
return 12;
|
|
67
|
+
case "spacious":
|
|
68
|
+
return 16;
|
|
69
|
+
default:
|
|
70
|
+
return 8; // fallback to compact
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Helper function to check if a point is within the checkbox boundary
|
|
75
|
+
* @param pointX - X coordinate of the point to check
|
|
76
|
+
* @param pointY - Y coordinate of the point to check
|
|
77
|
+
* @param checkboxRect - Bounding rectangle of the checkbox
|
|
78
|
+
* @param tolerancePixels - Number of pixels to extend the boundary
|
|
79
|
+
* @returns true if the point is within the checkbox or within tolerancePixels of its boundary
|
|
80
|
+
*/
|
|
81
|
+
const isWithinCheckboxBoundary = (pointX, pointY, checkboxRect, tolerancePixels) => {
|
|
82
|
+
// Calculate distance from point to checkbox boundaries
|
|
83
|
+
const distanceToLeft = Math.abs(pointX - checkboxRect.left);
|
|
84
|
+
const distanceToRight = Math.abs(pointX - checkboxRect.right);
|
|
85
|
+
const distanceToTop = Math.abs(pointY - checkboxRect.top);
|
|
86
|
+
const distanceToBottom = Math.abs(pointY - checkboxRect.bottom);
|
|
87
|
+
// Check if point is within the checkbox bounds or within boundary pixels of any edge
|
|
88
|
+
const withinHorizontalBounds = pointX >= checkboxRect.left && pointX <= checkboxRect.right;
|
|
89
|
+
const withinVerticalBounds = pointY >= checkboxRect.top && pointY <= checkboxRect.bottom;
|
|
90
|
+
const withinCheckbox = withinHorizontalBounds && withinVerticalBounds;
|
|
91
|
+
const nearHorizontalBoundary = (withinVerticalBounds && (distanceToLeft <= tolerancePixels || distanceToRight <= tolerancePixels));
|
|
92
|
+
const nearVerticalBoundary = (withinHorizontalBounds && (distanceToTop <= tolerancePixels || distanceToBottom <= tolerancePixels));
|
|
93
|
+
return withinCheckbox || nearHorizontalBoundary || nearVerticalBoundary;
|
|
94
|
+
};
|
|
53
95
|
//These are the important styles to make sticky column pinning work!
|
|
54
96
|
//Apply styles like this using your CSS strategy of choice with this kind of logic to head cells, data cells, footer cells, etc.
|
|
55
97
|
//View the index.css file for more needed styles such as border-collapse: separate
|
|
@@ -74,7 +116,7 @@ const getCommonPinningStyles = (column) => {
|
|
|
74
116
|
// eslint-disable-next-line react/display-name
|
|
75
117
|
exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
76
118
|
var _b, _c, _d, _e, _f;
|
|
77
|
-
var { data = exports.defaultProps.data, columns = exports.defaultProps.columns, isPaginated = exports.defaultProps.isPaginated, loading = exports.defaultProps.loading, headerHeight, rowsSelectable = exports.defaultProps.rowsSelectable, enableMultiRowSelection = exports.defaultProps.enableMultiRowSelection, initiallySelected = exports.defaultProps.initiallySelected, syncWithAppState, pageSizeOptions = exports.defaultProps.pageSizeOptions, pageSize = (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) || DEFAULT_PAGE_SIZES[0], currentPageIndex = 0, rowDisabledPredicate = defaultIsRowDisabled, sortBy, sortingDirection = exports.defaultProps.sortingDirection, iconSortAsc, iconSortDesc, iconNoSort, sortingDidChange, willSort, style, className, noDataRenderer, autoFocus = exports.defaultProps.autoFocus, hideHeader = exports.defaultProps.hideHeader, hideNoDataView = exports.defaultProps.hideNoDataView, alwaysShowSelectionHeader = exports.defaultProps.alwaysShowSelectionHeader, registerComponentApi, onSelectionDidChange, noBottomBorder = exports.defaultProps.noBottomBorder, paginationControlsLocation = exports.defaultProps.paginationControlsLocation, cellVerticalAlign = exports.defaultProps.cellVerticalAlign, buttonRowPosition = exports.defaultProps.buttonRowPosition, pageSizeSelectorPosition = exports.defaultProps.pageSizeSelectorPosition, pageInfoPosition = exports.defaultProps.pageInfoPosition, showCurrentPage = exports.defaultProps.showCurrentPage, showPageInfo = exports.defaultProps.showPageInfo, showPageSizeSelector = exports.defaultProps.showPageSizeSelector } = _a, rest = __rest(_a, ["data", "columns", "isPaginated", "loading", "headerHeight", "rowsSelectable", "enableMultiRowSelection", "initiallySelected", "syncWithAppState", "pageSizeOptions", "pageSize", "currentPageIndex", "rowDisabledPredicate", "sortBy", "sortingDirection", "iconSortAsc", "iconSortDesc", "iconNoSort", "sortingDidChange", "willSort", "style", "className", "noDataRenderer", "autoFocus", "hideHeader", "hideNoDataView", "alwaysShowSelectionHeader", "registerComponentApi", "onSelectionDidChange", "noBottomBorder", "paginationControlsLocation", "cellVerticalAlign", "buttonRowPosition", "pageSizeSelectorPosition", "pageInfoPosition", "showCurrentPage", "showPageInfo", "showPageSizeSelector"])
|
|
119
|
+
var { data = exports.defaultProps.data, columns = exports.defaultProps.columns, isPaginated = exports.defaultProps.isPaginated, loading = exports.defaultProps.loading, headerHeight, rowsSelectable = exports.defaultProps.rowsSelectable, enableMultiRowSelection = exports.defaultProps.enableMultiRowSelection, initiallySelected = exports.defaultProps.initiallySelected, syncWithAppState, pageSizeOptions = exports.defaultProps.pageSizeOptions, pageSize = (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) || DEFAULT_PAGE_SIZES[0], currentPageIndex = 0, rowDisabledPredicate = defaultIsRowDisabled, sortBy, sortingDirection = exports.defaultProps.sortingDirection, iconSortAsc, iconSortDesc, iconNoSort, sortingDidChange, willSort, style, className, noDataRenderer, autoFocus = exports.defaultProps.autoFocus, hideHeader = exports.defaultProps.hideHeader, hideNoDataView = exports.defaultProps.hideNoDataView, alwaysShowSelectionHeader = exports.defaultProps.alwaysShowSelectionHeader, registerComponentApi, onSelectionDidChange, noBottomBorder = exports.defaultProps.noBottomBorder, paginationControlsLocation = exports.defaultProps.paginationControlsLocation, cellVerticalAlign = exports.defaultProps.cellVerticalAlign, buttonRowPosition = exports.defaultProps.buttonRowPosition, pageSizeSelectorPosition = exports.defaultProps.pageSizeSelectorPosition, pageInfoPosition = exports.defaultProps.pageInfoPosition, showCurrentPage = exports.defaultProps.showCurrentPage, showPageInfo = exports.defaultProps.showPageInfo, showPageSizeSelector = exports.defaultProps.showPageSizeSelector, checkboxTolerance = exports.defaultProps.checkboxTolerance } = _a, rest = __rest(_a, ["data", "columns", "isPaginated", "loading", "headerHeight", "rowsSelectable", "enableMultiRowSelection", "initiallySelected", "syncWithAppState", "pageSizeOptions", "pageSize", "currentPageIndex", "rowDisabledPredicate", "sortBy", "sortingDirection", "iconSortAsc", "iconSortDesc", "iconNoSort", "sortingDidChange", "willSort", "style", "className", "noDataRenderer", "autoFocus", "hideHeader", "hideNoDataView", "alwaysShowSelectionHeader", "registerComponentApi", "onSelectionDidChange", "noBottomBorder", "paginationControlsLocation", "cellVerticalAlign", "buttonRowPosition", "pageSizeSelectorPosition", "pageInfoPosition", "showCurrentPage", "showPageInfo", "showPageSizeSelector", "checkboxTolerance"])
|
|
78
120
|
// cols
|
|
79
121
|
;
|
|
80
122
|
const { getThemeVar } = (0, ThemeContext_1.useTheme)();
|
|
@@ -99,6 +141,12 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
99
141
|
}, [autoFocus]);
|
|
100
142
|
// --- Keep track of visible table rows
|
|
101
143
|
const [visibleItems, setVisibleItems] = (0, react_1.useState)(constants_1.EMPTY_ARRAY);
|
|
144
|
+
// --- Track which row should show forced hover for checkbox
|
|
145
|
+
const [hoveredRowId, setHoveredRowId] = (0, react_1.useState)(null);
|
|
146
|
+
// --- Track if the header checkbox should show forced hover
|
|
147
|
+
const [headerCheckboxHovered, setHeaderCheckboxHovered] = (0, react_1.useState)(false);
|
|
148
|
+
// --- Calculate tolerance pixels from the prop
|
|
149
|
+
const tolerancePixels = getCheckboxTolerancePixels(checkboxTolerance);
|
|
102
150
|
// --- Get the operations to manage selected rows in a table
|
|
103
151
|
const { toggleRow, checkAllRows, focusedIndex, onKeyDown, selectedRowIdMap, idKey, selectionApi, } = (0, useRowSelection_1.default)({
|
|
104
152
|
items: safeData,
|
|
@@ -221,18 +269,23 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
221
269
|
},
|
|
222
270
|
header: ({ table }) => enableMultiRowSelection ? ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { className: (0, classnames_1.default)(Table_module_scss_1.default.checkBoxWrapper, {
|
|
223
271
|
[Table_module_scss_1.default.showInHeader]: alwaysShowSelectionHeader,
|
|
272
|
+
[Table_module_scss_1.default.forceHoverWrapper]: headerCheckboxHovered,
|
|
224
273
|
}),
|
|
225
274
|
value: table.getIsAllRowsSelected(),
|
|
226
275
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
276
|
+
forceHover: headerCheckboxHovered,
|
|
227
277
|
onDidChange: () => {
|
|
228
278
|
const allSelected = table
|
|
229
279
|
.getRowModel()
|
|
230
280
|
.rows.every((row) => rowDisabledPredicate(row.original) || row.getIsSelected());
|
|
231
281
|
checkAllRows(!allSelected);
|
|
232
282
|
} })) : null,
|
|
233
|
-
cell: ({ row }) => ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { className: Table_module_scss_1.default.checkBoxWrapper,
|
|
283
|
+
cell: ({ row }) => ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { className: (0, classnames_1.default)(Table_module_scss_1.default.checkBoxWrapper, {
|
|
284
|
+
[Table_module_scss_1.default.forceHoverWrapper]: hoveredRowId === row.id,
|
|
285
|
+
}),
|
|
234
286
|
value: row.getIsSelected(),
|
|
235
287
|
indeterminate: row.getIsSomeSelected(),
|
|
288
|
+
forceHover: hoveredRowId === row.id,
|
|
236
289
|
onDidChange: () => {
|
|
237
290
|
toggleRow(row.original, { metaKey: true });
|
|
238
291
|
} })),
|
|
@@ -246,6 +299,8 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
246
299
|
checkAllRows,
|
|
247
300
|
toggleRow,
|
|
248
301
|
rowDisabledPredicate,
|
|
302
|
+
hoveredRowId,
|
|
303
|
+
headerCheckboxHovered,
|
|
249
304
|
]);
|
|
250
305
|
// --- Set up page information (using the first page size option)
|
|
251
306
|
// const [pagination, setPagination] = useState<PaginationState>();
|
|
@@ -396,7 +451,71 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
396
451
|
(paginationControlsLocation === "top" || paginationControlsLocation === "both") &&
|
|
397
452
|
paginationControls, (0, jsx_runtime_1.jsxs)("table", { className: Table_module_scss_1.default.table, ref: tableRef, children: [!hideHeader && ((0, jsx_runtime_1.jsx)("thead", { style: { height: headerHeight }, className: Table_module_scss_1.default.headerWrapper, children: table.getHeaderGroups().map((headerGroup, headerGroupIndex) => ((0, jsx_runtime_1.jsx)("tr", { className: (0, classnames_1.default)(Table_module_scss_1.default.headerRow, {
|
|
398
453
|
[Table_module_scss_1.default.allSelected]: table.getIsAllRowsSelected(),
|
|
399
|
-
}),
|
|
454
|
+
}), onClick: (event) => {
|
|
455
|
+
const target = event.target;
|
|
456
|
+
const headerCell = target.closest('th');
|
|
457
|
+
// Only handle clicks for the select column header
|
|
458
|
+
if (headerCell && rowsSelectable && enableMultiRowSelection) {
|
|
459
|
+
const header = headerGroup.headers.find(h => {
|
|
460
|
+
const headerElement = headerCell;
|
|
461
|
+
return (headerElement === null || headerElement === void 0 ? void 0 : headerElement.getAttribute('data-column-id')) === h.id || h.id === 'select';
|
|
462
|
+
});
|
|
463
|
+
if (header && header.id === 'select') {
|
|
464
|
+
const clickX = event.clientX;
|
|
465
|
+
const clickY = event.clientY;
|
|
466
|
+
const checkbox = headerCell.querySelector('input[type=\"checkbox\"]');
|
|
467
|
+
if (checkbox) {
|
|
468
|
+
const checkboxRect = checkbox.getBoundingClientRect();
|
|
469
|
+
if (isWithinCheckboxBoundary(clickX, clickY, checkboxRect, tolerancePixels)) {
|
|
470
|
+
// Prevent the default click and manually trigger the checkbox
|
|
471
|
+
event.preventDefault();
|
|
472
|
+
event.stopPropagation();
|
|
473
|
+
const allSelected = table
|
|
474
|
+
.getRowModel()
|
|
475
|
+
.rows.every((row) => rowDisabledPredicate(row.original) || row.getIsSelected());
|
|
476
|
+
checkAllRows(!allSelected);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}, onMouseMove: (event) => {
|
|
482
|
+
if (rowsSelectable && enableMultiRowSelection) {
|
|
483
|
+
const target = event.target;
|
|
484
|
+
const headerCell = target.closest('th');
|
|
485
|
+
if (headerCell) {
|
|
486
|
+
const header = headerGroup.headers.find(h => {
|
|
487
|
+
const headerElement = headerCell;
|
|
488
|
+
return (headerElement === null || headerElement === void 0 ? void 0 : headerElement.getAttribute('data-column-id')) === h.id || h.id === 'select';
|
|
489
|
+
});
|
|
490
|
+
if (header && header.id === 'select') {
|
|
491
|
+
const mouseX = event.clientX;
|
|
492
|
+
const mouseY = event.clientY;
|
|
493
|
+
const checkbox = headerCell.querySelector('input[type=\"checkbox\"]');
|
|
494
|
+
if (checkbox) {
|
|
495
|
+
const checkboxRect = checkbox.getBoundingClientRect();
|
|
496
|
+
const shouldShowHover = isWithinCheckboxBoundary(mouseX, mouseY, checkboxRect, tolerancePixels);
|
|
497
|
+
if (shouldShowHover && !headerCheckboxHovered) {
|
|
498
|
+
setHeaderCheckboxHovered(true);
|
|
499
|
+
event.currentTarget.style.cursor = 'pointer';
|
|
500
|
+
}
|
|
501
|
+
else if (!shouldShowHover && headerCheckboxHovered) {
|
|
502
|
+
setHeaderCheckboxHovered(false);
|
|
503
|
+
event.currentTarget.style.cursor = '';
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
else if (headerCheckboxHovered) {
|
|
508
|
+
setHeaderCheckboxHovered(false);
|
|
509
|
+
event.currentTarget.style.cursor = '';
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}, onMouseLeave: (event) => {
|
|
514
|
+
if (headerCheckboxHovered) {
|
|
515
|
+
setHeaderCheckboxHovered(false);
|
|
516
|
+
event.currentTarget.style.cursor = '';
|
|
517
|
+
}
|
|
518
|
+
}, children: headerGroup.headers.map((header, headerIndex) => {
|
|
400
519
|
var _a, _b, _c;
|
|
401
520
|
const _d = ((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.style) || {}, { width } = _d, style = __rest(_d, ["width"]);
|
|
402
521
|
const size = header.getSize();
|
|
@@ -405,7 +524,7 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
405
524
|
: cellVerticalAlign === "bottom"
|
|
406
525
|
? Table_module_scss_1.default.alignBottom
|
|
407
526
|
: Table_module_scss_1.default.alignCenter;
|
|
408
|
-
return ((0, jsx_runtime_1.jsxs)("th", { className: (0, classnames_1.default)(Table_module_scss_1.default.columnCell, alignmentClass), colSpan: header.colSpan, style: Object.assign({ position: "relative", width: size }, getCommonPinningStyles(header.column)), children: [(0, jsx_runtime_1.jsx)(ClickableHeader, { hasSorting: header.column.columnDef.enableSorting &&
|
|
527
|
+
return ((0, jsx_runtime_1.jsxs)("th", { "data-column-id": header.id, className: (0, classnames_1.default)(Table_module_scss_1.default.columnCell, alignmentClass), colSpan: header.colSpan, style: Object.assign({ position: "relative", width: size }, getCommonPinningStyles(header.column)), children: [(0, jsx_runtime_1.jsx)(ClickableHeader, { hasSorting: header.column.columnDef.enableSorting &&
|
|
409
528
|
!!((_b = header.column.columnDef.meta) === null || _b === void 0 ? void 0 : _b.accessorKey), updateSorting: () => { var _a; return _updateSorting((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.accessorKey); }, children: (0, jsx_runtime_1.jsxs)("div", { className: Table_module_scss_1.default.headerContent, style: style, children: [(0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()), header.column.columnDef.enableSorting && ((0, jsx_runtime_1.jsx)("span", { style: { display: "inline-flex", maxWidth: 16 }, children: (0, jsx_runtime_1.jsx)(ColumnOrderingIndicator, { iconSortAsc: iconSortAsc, iconSortDesc: iconSortDesc, iconNoSort: iconNoSort, direction: ((_c = header.column.columnDef.meta) === null || _c === void 0 ? void 0 : _c.accessorKey) === _sortBy
|
|
410
529
|
? _sortingDirection
|
|
411
530
|
: undefined }) }))] }) }), header.column.getCanResize() && ((0, jsx_runtime_1.jsx)("div", { onDoubleClick: () => {
|
|
@@ -449,7 +568,44 @@ exports.Table = (0, react_1.forwardRef)((_a, forwardedRef) => {
|
|
|
449
568
|
if (target.tagName.toLowerCase() === "input") {
|
|
450
569
|
return;
|
|
451
570
|
}
|
|
571
|
+
// Check if click is within checkbox boundary
|
|
572
|
+
const currentRow = event.currentTarget;
|
|
573
|
+
const checkbox = currentRow.querySelector('input[type="checkbox"]');
|
|
574
|
+
if (checkbox) {
|
|
575
|
+
const checkboxRect = checkbox.getBoundingClientRect();
|
|
576
|
+
const clickX = event.clientX;
|
|
577
|
+
const clickY = event.clientY;
|
|
578
|
+
if (isWithinCheckboxBoundary(clickX, clickY, checkboxRect, tolerancePixels)) {
|
|
579
|
+
// Toggle the checkbox when clicking within the boundary
|
|
580
|
+
toggleRow(row.original, { metaKey: true });
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
452
584
|
toggleRow(row.original, event);
|
|
585
|
+
}, onMouseMove: (event) => {
|
|
586
|
+
// Change cursor and hover state when within checkbox boundary
|
|
587
|
+
const currentRow = event.currentTarget;
|
|
588
|
+
const checkbox = currentRow.querySelector('input[type="checkbox"]');
|
|
589
|
+
if (checkbox) {
|
|
590
|
+
const checkboxRect = checkbox.getBoundingClientRect();
|
|
591
|
+
const mouseX = event.clientX;
|
|
592
|
+
const mouseY = event.clientY;
|
|
593
|
+
const shouldShowHover = isWithinCheckboxBoundary(mouseX, mouseY, checkboxRect, tolerancePixels);
|
|
594
|
+
// Update hover state and cursor based on proximity to checkbox
|
|
595
|
+
if (shouldShowHover) {
|
|
596
|
+
setHoveredRowId(row.id);
|
|
597
|
+
currentRow.style.cursor = 'pointer';
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
setHoveredRowId(null);
|
|
601
|
+
currentRow.style.cursor = '';
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}, onMouseLeave: (event) => {
|
|
605
|
+
// Reset cursor and hover state when leaving the row
|
|
606
|
+
const currentRow = event.currentTarget;
|
|
607
|
+
currentRow.style.cursor = '';
|
|
608
|
+
setHoveredRowId(null);
|
|
453
609
|
}, children: row.getVisibleCells().map((cell, i) => {
|
|
454
610
|
var _a, _b;
|
|
455
611
|
const cellRenderer = (_b = (_a = cell.column.columnDef) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.cellRenderer;
|
|
@@ -510,4 +666,5 @@ exports.defaultProps = {
|
|
|
510
666
|
buttonRowPosition: "center",
|
|
511
667
|
pageSizeSelectorPosition: "start",
|
|
512
668
|
pageInfoPosition: "end",
|
|
669
|
+
checkboxTolerance: "compact",
|
|
513
670
|
};
|
|
@@ -100,7 +100,7 @@ function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items
|
|
|
100
100
|
const appStateSelection = (_a = syncWithAppState === null || syncWithAppState === void 0 ? void 0 : syncWithAppState.value) === null || _a === void 0 ? void 0 : _a.selectedIds;
|
|
101
101
|
const prevAppStateSelection = (0, hooks_1.usePrevious)(appStateSelection);
|
|
102
102
|
// --- State machine for sync direction control
|
|
103
|
-
const [syncState, setSyncState] = (0, react_1.useState)(
|
|
103
|
+
const [syncState, setSyncState] = (0, react_1.useState)("idle");
|
|
104
104
|
// --- Use refs to track the last known selections to prevent update loops
|
|
105
105
|
const lastAppStateSelectionRef = (0, react_1.useRef)();
|
|
106
106
|
const lastTableSelectionRef = (0, react_1.useRef)();
|
|
@@ -112,23 +112,23 @@ function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items
|
|
|
112
112
|
if (!rowsSelectable ||
|
|
113
113
|
!syncWithAppState ||
|
|
114
114
|
!appStateSelection ||
|
|
115
|
-
syncState ===
|
|
115
|
+
syncState === "updating_to_appstate") {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
// Only update if AppState selection actually changed and this wasn't caused by our own table update
|
|
119
119
|
const appStateChanged = appStateSelection !== prevAppStateSelection;
|
|
120
120
|
const isDifferentFromLastKnown = JSON.stringify([...(appStateSelection || [])].sort()) !==
|
|
121
121
|
JSON.stringify([...(lastAppStateSelectionRef.current || [])].sort());
|
|
122
|
-
const wasNotOurUpdate = lastUpdateSourceRef.current !==
|
|
122
|
+
const wasNotOurUpdate = lastUpdateSourceRef.current !== "table";
|
|
123
123
|
if (appStateChanged && isDifferentFromLastKnown && wasNotOurUpdate && items.length > 0) {
|
|
124
124
|
// Set state machine to indicate we're updating from AppState
|
|
125
|
-
setSyncState(
|
|
125
|
+
setSyncState("updating_from_appstate");
|
|
126
126
|
const validIds = appStateSelection.filter((id) => items.some((item) => item[idKey] === id));
|
|
127
127
|
const idsToSelect = enableMultiRowSelection ? validIds : validIds.slice(0, 1);
|
|
128
128
|
// Track what we're setting to prevent loop
|
|
129
129
|
lastAppStateSelectionRef.current = [...appStateSelection];
|
|
130
130
|
lastTableSelectionRef.current = [...idsToSelect];
|
|
131
|
-
lastUpdateSourceRef.current =
|
|
131
|
+
lastUpdateSourceRef.current = "appstate";
|
|
132
132
|
setSelectedRowIds(idsToSelect);
|
|
133
133
|
setInitialSelectionApplied(true);
|
|
134
134
|
}
|
|
@@ -147,9 +147,7 @@ function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items
|
|
|
147
147
|
(0, react_1.useEffect)(() => {
|
|
148
148
|
var _a;
|
|
149
149
|
// Skip if not selectable, no sync, or currently updating from AppState
|
|
150
|
-
if (!rowsSelectable ||
|
|
151
|
-
!syncWithAppState ||
|
|
152
|
-
syncState === 'updating_from_appstate') {
|
|
150
|
+
if (!rowsSelectable || !syncWithAppState || syncState === "updating_from_appstate") {
|
|
153
151
|
return;
|
|
154
152
|
}
|
|
155
153
|
const currentSelectionIds = selectedItems.map((item) => item[idKey]);
|
|
@@ -159,37 +157,30 @@ function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items
|
|
|
159
157
|
JSON.stringify([...(lastTableSelectionRef.current || [])].sort());
|
|
160
158
|
const isDifferentFromAppState = JSON.stringify([...currentSelectionIds].sort()) !==
|
|
161
159
|
JSON.stringify([...appStateSelectionIds].sort());
|
|
162
|
-
const wasNotAppStateUpdate = lastUpdateSourceRef.current !==
|
|
160
|
+
const wasNotAppStateUpdate = lastUpdateSourceRef.current !== "appstate";
|
|
163
161
|
if (tableChanged && isDifferentFromAppState && wasNotAppStateUpdate) {
|
|
164
162
|
// Set state machine to indicate we're updating to AppState
|
|
165
|
-
setSyncState(
|
|
163
|
+
setSyncState("updating_to_appstate");
|
|
166
164
|
// Track what we're updating to prevent loop
|
|
167
165
|
lastTableSelectionRef.current = [...currentSelectionIds];
|
|
168
166
|
lastAppStateSelectionRef.current = [...currentSelectionIds];
|
|
169
|
-
lastUpdateSourceRef.current =
|
|
167
|
+
lastUpdateSourceRef.current = "table";
|
|
170
168
|
(_a = syncWithAppState.update) === null || _a === void 0 ? void 0 : _a.call(syncWithAppState, { selectedIds: currentSelectionIds });
|
|
171
169
|
}
|
|
172
|
-
}, [
|
|
173
|
-
selectedItems,
|
|
174
|
-
syncWithAppState,
|
|
175
|
-
appStateSelection,
|
|
176
|
-
idKey,
|
|
177
|
-
rowsSelectable,
|
|
178
|
-
syncState,
|
|
179
|
-
]);
|
|
170
|
+
}, [selectedItems, syncWithAppState, appStateSelection, idKey, rowsSelectable, syncState]);
|
|
180
171
|
// --- Reset sync state machine to idle when updates are complete
|
|
181
172
|
(0, react_1.useEffect)(() => {
|
|
182
|
-
if (syncState !==
|
|
173
|
+
if (syncState !== "idle") {
|
|
183
174
|
// Reset to idle state in the next tick to allow the current update to complete
|
|
184
175
|
const resetTimer = requestAnimationFrame(() => {
|
|
185
|
-
setSyncState(
|
|
176
|
+
setSyncState("idle");
|
|
186
177
|
});
|
|
187
178
|
return () => cancelAnimationFrame(resetTimer);
|
|
188
179
|
}
|
|
189
180
|
}, [syncState, appStateSelection, selectedItems]);
|
|
190
181
|
// --- Clear update source when sync state becomes idle
|
|
191
182
|
(0, react_1.useEffect)(() => {
|
|
192
|
-
if (syncState ===
|
|
183
|
+
if (syncState === "idle") {
|
|
193
184
|
// Use a separate frame to clear the source after the sync state is reset
|
|
194
185
|
const clearTimer = requestAnimationFrame(() => {
|
|
195
186
|
lastUpdateSourceRef.current = null;
|
|
@@ -389,7 +380,7 @@ function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items
|
|
|
389
380
|
});
|
|
390
381
|
(0, react_1.useEffect)(() => {
|
|
391
382
|
// console.log("selection DID CHANGE?");
|
|
392
|
-
onSelectionDidChange === null || onSelectionDidChange === void 0 ? void 0 : onSelectionDidChange(selectedItems);
|
|
383
|
+
void (onSelectionDidChange === null || onSelectionDidChange === void 0 ? void 0 : onSelectionDidChange(selectedItems));
|
|
393
384
|
}, [selectedItems, onSelectionDidChange]);
|
|
394
385
|
/**
|
|
395
386
|
* This operation checks or clears all rows
|
|
@@ -98,7 +98,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
98
98
|
const textarea = page.getByRole("textbox");
|
|
99
99
|
yield textarea.fill("Some content");
|
|
100
100
|
yield (0, fixtures_1.expect)(textarea).toHaveValue("Some content");
|
|
101
|
-
(0, fixtures_1.expect)(textarea).toHaveAttribute("placeholder", "Enter comments");
|
|
101
|
+
yield (0, fixtures_1.expect)(textarea).toHaveAttribute("placeholder", "Enter comments");
|
|
102
102
|
}));
|
|
103
103
|
(0, fixtures_1.test)("maxLength limits input length", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
104
104
|
yield initTestBed(`<TextArea maxLength="10" />`);
|
|
@@ -275,7 +275,7 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
275
275
|
}));
|
|
276
276
|
(0, fixtures_1.test)("component is keyboard accessible when interactive", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
277
277
|
const { testStateDriver } = yield initTestBed(`
|
|
278
|
-
<TextArea
|
|
278
|
+
<TextArea
|
|
279
279
|
label="Comments"
|
|
280
280
|
onGotFocus="testState = 'keyboard-focused'"
|
|
281
281
|
/>
|
|
@@ -327,6 +327,57 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
327
327
|
}));
|
|
328
328
|
});
|
|
329
329
|
// =============================================================================
|
|
330
|
+
// EVENT HANDLING TESTS
|
|
331
|
+
// =============================================================================
|
|
332
|
+
fixtures_1.test.describe("Event Handling", () => {
|
|
333
|
+
(0, fixtures_1.test)("didChange event fires on input change", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
334
|
+
const { testStateDriver } = yield initTestBed(`
|
|
335
|
+
<TextArea onDidChange="testState = 'changed'" />
|
|
336
|
+
`);
|
|
337
|
+
yield page.getByRole("textbox").fill("test");
|
|
338
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("changed");
|
|
339
|
+
}));
|
|
340
|
+
(0, fixtures_1.test)("didChange event passes new value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
341
|
+
const { testStateDriver } = yield initTestBed(`
|
|
342
|
+
<TextArea onDidChange="arg => testState = arg" />
|
|
343
|
+
`);
|
|
344
|
+
yield page.getByRole("textbox").fill("test value");
|
|
345
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("test value");
|
|
346
|
+
}));
|
|
347
|
+
(0, fixtures_1.test)("gotFocus event fires on focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
348
|
+
const { testStateDriver } = yield initTestBed(`
|
|
349
|
+
<TextArea onGotFocus="testState = 'focused'" />
|
|
350
|
+
`);
|
|
351
|
+
yield page.getByRole("textbox").focus();
|
|
352
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
353
|
+
}));
|
|
354
|
+
(0, fixtures_1.test)("gotFocus event fires on label click", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
355
|
+
const { testStateDriver } = yield initTestBed(`
|
|
356
|
+
<TextArea label="Comments" onGotFocus="testState = 'focused'" />
|
|
357
|
+
`);
|
|
358
|
+
yield page.getByText("Comments").click();
|
|
359
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
360
|
+
}));
|
|
361
|
+
(0, fixtures_1.test)("lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
362
|
+
const { testStateDriver } = yield initTestBed(`
|
|
363
|
+
<TextArea onLostFocus="testState = 'blurred'" />
|
|
364
|
+
`);
|
|
365
|
+
const textarea = page.getByRole("textbox");
|
|
366
|
+
yield textarea.focus();
|
|
367
|
+
yield textarea.blur();
|
|
368
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("blurred");
|
|
369
|
+
}));
|
|
370
|
+
(0, fixtures_1.test)("events do not fire when component is disabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
371
|
+
const { testStateDriver } = yield initTestBed(`
|
|
372
|
+
<TextArea enabled="false" onDidChange="testState = 'changed'" onGotFocus="testState = 'focused'" />
|
|
373
|
+
`);
|
|
374
|
+
const textarea = page.getByRole("textbox");
|
|
375
|
+
yield textarea.focus();
|
|
376
|
+
yield textarea.fill("test", { force: true });
|
|
377
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual(null);
|
|
378
|
+
}));
|
|
379
|
+
});
|
|
380
|
+
// =============================================================================
|
|
330
381
|
// VISUAL STATE TESTS
|
|
331
382
|
// =============================================================================
|
|
332
383
|
fixtures_1.test.describe("Visual States", () => {
|
|
@@ -357,7 +408,7 @@ fixtures_1.test.describe("Visual States", () => {
|
|
|
357
408
|
testThemeVars: {
|
|
358
409
|
"backgroundColor-TextArea--disabled": "rgb(255, 0, 0)",
|
|
359
410
|
"textColor-TextArea--disabled": "rgb(0, 255, 0)",
|
|
360
|
-
"borderColor-TextArea--disabled": "rgb(0, 0, 255)"
|
|
411
|
+
"borderColor-TextArea--disabled": "rgb(0, 0, 255)",
|
|
361
412
|
},
|
|
362
413
|
});
|
|
363
414
|
const textarea = page.getByRole("textbox");
|
|
@@ -459,15 +510,15 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
459
510
|
yield (0, fixtures_1.expect)(textarea).toBeVisible();
|
|
460
511
|
yield (0, fixtures_1.expect)(textarea).toHaveValue(longValue);
|
|
461
512
|
}));
|
|
462
|
-
(0, fixtures_1.test)("component handles invalid maxRows/minRows combinations with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
513
|
+
(0, fixtures_1.test)("component handles invalid maxRows/minRows combinations with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
463
514
|
yield initTestBed(`<TextArea autoSize="true" maxRows="2" minRows="5" />`);
|
|
464
515
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
465
516
|
}));
|
|
466
|
-
(0, fixtures_1.test)("component handles zero maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
517
|
+
(0, fixtures_1.test)("component handles zero maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
467
518
|
yield initTestBed(`<TextArea autoSize="true" maxRows="0" minRows="0" />`);
|
|
468
519
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
469
520
|
}));
|
|
470
|
-
(0, fixtures_1.test)("component handles negative maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
521
|
+
(0, fixtures_1.test)("component handles negative maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
471
522
|
yield initTestBed(`<TextArea autoSize="true" maxRows="{-1}" minRows="{-1}" />`);
|
|
472
523
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
473
524
|
}));
|
|
@@ -478,7 +529,7 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
478
529
|
fixtures_1.test.describe("Performance", () => {
|
|
479
530
|
(0, fixtures_1.test)("component memoization prevents unnecessary re-renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
480
531
|
const { testStateDriver } = yield initTestBed(`
|
|
481
|
-
<TextArea
|
|
532
|
+
<TextArea
|
|
482
533
|
label="Performance Test"
|
|
483
534
|
onDidChange="testState = ++testState || 1"
|
|
484
535
|
/>
|
|
@@ -569,7 +620,7 @@ fixtures_1.test.describe("Integration", () => {
|
|
|
569
620
|
(0, fixtures_1.test)("component works with event handling chain", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
570
621
|
const { testStateDriver } = yield initTestBed(`
|
|
571
622
|
<Fragment>
|
|
572
|
-
<TextArea
|
|
623
|
+
<TextArea
|
|
573
624
|
onGotFocus="testState = 'focused'"
|
|
574
625
|
onLostFocus="testState = 'blurred'"
|
|
575
626
|
onDidChange="(value) => testState = 'changed: ' + value"
|
|
@@ -257,6 +257,13 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
257
257
|
yield driver.input.focus();
|
|
258
258
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
259
259
|
}));
|
|
260
|
+
(0, fixtures_1.test)("gotFocus event fires on label click", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
261
|
+
const { testStateDriver } = yield initTestBed(`
|
|
262
|
+
<TextBox label="Username" onGotFocus="testState = 'focused'" />
|
|
263
|
+
`);
|
|
264
|
+
yield page.getByText("Username").click();
|
|
265
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
266
|
+
}));
|
|
260
267
|
(0, fixtures_1.test)("component lostFocus event fires on blur", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTextBoxDriver }) {
|
|
261
268
|
const { testStateDriver } = yield initTestBed(`
|
|
262
269
|
<TextBox testId="test" onLostFocus="testState = 'blurred'" />
|
|
@@ -31,6 +31,7 @@ exports.ThemeMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
31
31
|
defaultValue: "light",
|
|
32
32
|
},
|
|
33
33
|
root: (0, metadata_helpers_1.d)(`This property indicates whether the component is at the root of the application.`, undefined, "boolean", ThemeNative_1.defaultProps.root),
|
|
34
|
+
applyIf: (0, metadata_helpers_1.d)(`This property controls whether the theme wrapper is applied. When true (default), the theme wraps the children. When false, children are rendered unwrapped.`, undefined, "boolean", true),
|
|
34
35
|
},
|
|
35
36
|
opaque: true,
|
|
36
37
|
});
|
|
@@ -42,5 +43,5 @@ exports.themeComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP,
|
|
|
42
43
|
if (themeTone && themeTone !== "dark") {
|
|
43
44
|
themeTone = "light";
|
|
44
45
|
}
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(ThemeNative_1.Theme, { id: extractValue.asOptionalString(node.props.themeId), isRoot: extractValue.asOptionalBoolean(node.props.root), layoutContext: layoutContext, renderChild: renderChild, tone: themeTone, toastDuration: toastDuration, themeVars: extractValue(restProps), node: node }));
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(ThemeNative_1.Theme, { id: extractValue.asOptionalString(node.props.themeId), isRoot: extractValue.asOptionalBoolean(node.props.root), applyIf: extractValue.asOptionalBoolean(node.props.applyIf), layoutContext: layoutContext, renderChild: renderChild, tone: themeTone, toastDuration: toastDuration, themeVars: extractValue(restProps), node: node }));
|
|
46
47
|
});
|