xmlui 0.10.16 → 0.10.19
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/{index-D4RYJasT.mjs → index-cuh97e2e.mjs} +1603 -1635
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-qzTZlH-6.mjs → initMock-BMxsanHc.mjs} +1 -1
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{collectedComponentMetadata-BQaefK3f.mjs → collectedComponentMetadata-Cp-9lpnG.mjs} +1716 -1757
- package/dist/metadata/{initMock-Cz6QssI3.mjs → initMock-C-cnv--V.mjs} +1 -1
- 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/Accordion/Accordion.spec.js +1 -1
- package/dist/scripts/src/components/Accordion/AccordionItemNative.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +54 -4
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +81 -62
- package/dist/scripts/src/components/Checkbox/Checkbox.js +1 -5
- package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +5 -0
- package/dist/scripts/src/components/ColorPicker/ColorPicker.js +2 -6
- package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +29 -0
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +12 -9
- package/dist/scripts/src/components/ComponentProvider.js +2 -0
- package/dist/scripts/src/components/DateInput/DateInput.js +1 -5
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +51 -17
- package/dist/scripts/src/components/DateInput/DateInputNative.js +12 -16
- package/dist/scripts/src/components/DatePicker/DatePicker.js +14 -13
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +50 -18
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +34 -32
- package/dist/scripts/src/components/FileInput/FileInput.js +1 -5
- package/dist/scripts/src/components/FileInput/FileInput.spec.js +36 -0
- package/dist/scripts/src/components/FileInput/FileInputNative.js +14 -15
- package/dist/scripts/src/components/Form/Form.spec.js +11 -9
- package/dist/scripts/src/components/Form/FormNative.js +15 -9
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +179 -30
- package/dist/scripts/src/components/FormItem/FormItemNative.js +20 -22
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +8 -17
- package/dist/scripts/src/components/FormItem/Validations.js +25 -6
- package/dist/scripts/src/components/Icon/Icon.js +1 -1
- package/dist/scripts/src/components/Input/PartialInput.js +2 -2
- package/dist/scripts/src/components/NumberBox/NumberBox.js +1 -5
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +38 -4
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +15 -17
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +1 -5
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +9 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +4 -5
- package/dist/scripts/src/components/RadioGroup/RadioItem.js +28 -0
- package/dist/scripts/src/components/Select/Select.js +1 -5
- package/dist/scripts/src/components/Select/Select.spec.js +290 -193
- package/dist/scripts/src/components/Select/SelectNative.js +26 -32
- package/dist/scripts/src/components/Slider/Slider.js +1 -5
- package/dist/scripts/src/components/Slider/Slider.spec.js +36 -0
- package/dist/scripts/src/components/Slider/SliderNative.js +18 -19
- package/dist/scripts/src/components/Switch/Switch.js +1 -5
- 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/TextArea/TextArea.js +1 -5
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +80 -0
- package/dist/scripts/src/components/TextArea/TextAreaNative.js +8 -29
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +45 -7
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +75 -37
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +6 -20
- package/dist/scripts/src/components/Timer/Timer.spec.js +66 -96
- package/dist/scripts/src/components/Toggle/Toggle.js +30 -25
- package/dist/scripts/src/components/Tree/Tree-icons.spec.js +206 -0
- package/dist/scripts/src/components/Tree/Tree.spec.js +1 -94
- package/dist/scripts/src/components/Tree/TreeComponent.js +44 -7
- package/dist/scripts/src/components/Tree/TreeNative.js +127 -85
- package/dist/scripts/src/components/Tree/testData.js +25 -1
- package/dist/scripts/src/components-core/behaviors/Behavior.js +2 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +8 -5
- package/dist/scripts/src/components-core/rendering/AppRoot.js +1 -2
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +12 -13
- package/dist/scripts/src/components-core/utils/treeUtils.js +8 -5
- package/dist/scripts/src/testing/ComponentDrivers.js +2 -4
- package/dist/standalone/xmlui-standalone.umd.js +15 -15
- package/package.json +1 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +0 -54
|
@@ -220,6 +220,278 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
220
220
|
yield (0, fixtures_1.expect)(table).toBeFocused();
|
|
221
221
|
}));
|
|
222
222
|
});
|
|
223
|
+
fixtures_1.test.describe("checkboxTolerance property", () => {
|
|
224
|
+
(0, fixtures_1.test)("allows checkbox interaction within compact tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
225
|
+
const { testStateDriver } = yield initTestBed(`
|
|
226
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
227
|
+
rowsSelectable="true"
|
|
228
|
+
checkboxTolerance="compact"
|
|
229
|
+
onSelectionDidChange="testState = 'selection changed'"
|
|
230
|
+
testId="table">
|
|
231
|
+
<Column bindTo="name"/>
|
|
232
|
+
<Column bindTo="quantity"/>
|
|
233
|
+
</Table>
|
|
234
|
+
`);
|
|
235
|
+
// Get first row checkbox - checkboxes exist but are hidden via CSS
|
|
236
|
+
const firstRowCheckbox = page.locator("input[type='checkbox']").nth(1); // Skip header checkbox
|
|
237
|
+
// Verify checkbox exists (even if hidden)
|
|
238
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeAttached();
|
|
239
|
+
// Get the first table row to interact with
|
|
240
|
+
const firstDataRow = page.locator("tbody tr").first();
|
|
241
|
+
yield (0, fixtures_1.expect)(firstDataRow).toBeVisible();
|
|
242
|
+
// Get row bounds for calculation
|
|
243
|
+
const rowBounds = yield firstDataRow.boundingBox();
|
|
244
|
+
// Click near the left edge of the row (where checkbox would be with tolerance)
|
|
245
|
+
// This simulates clicking within the 8px compact tolerance of the checkbox
|
|
246
|
+
const clickX = rowBounds.x + 15; // Slightly to the right of where checkbox would be
|
|
247
|
+
const clickY = rowBounds.y + rowBounds.height / 2;
|
|
248
|
+
// Click within tolerance boundary should trigger selection due to checkboxTolerance="compact"
|
|
249
|
+
yield page.mouse.click(clickX, clickY);
|
|
250
|
+
// Verify checkbox is now checked (using force since it's hidden)
|
|
251
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeChecked();
|
|
252
|
+
// Verify selection event was fired
|
|
253
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('selection changed');
|
|
254
|
+
}));
|
|
255
|
+
(0, fixtures_1.test)("allows header checkbox interaction within compact tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
256
|
+
const { testStateDriver } = yield initTestBed(`
|
|
257
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
258
|
+
rowsSelectable="true"
|
|
259
|
+
enableMultiRowSelection="true"
|
|
260
|
+
checkboxTolerance="compact"
|
|
261
|
+
onSelectionDidChange="testState = 'header selection changed'"
|
|
262
|
+
testId="table">
|
|
263
|
+
<Column bindTo="name"/>
|
|
264
|
+
<Column bindTo="quantity"/>
|
|
265
|
+
</Table>
|
|
266
|
+
`);
|
|
267
|
+
// Get header checkbox (select all checkbox)
|
|
268
|
+
const headerCheckbox = page.locator("input[type='checkbox']").first(); // Header checkbox is first
|
|
269
|
+
// Verify checkbox exists (even if hidden)
|
|
270
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeAttached();
|
|
271
|
+
// Get the header row to interact with
|
|
272
|
+
const headerRow = page.locator("thead tr").first();
|
|
273
|
+
yield (0, fixtures_1.expect)(headerRow).toBeVisible();
|
|
274
|
+
// Get header row bounds for calculation
|
|
275
|
+
const headerBounds = yield headerRow.boundingBox();
|
|
276
|
+
// Click near the left edge of the header row (where checkbox would be with tolerance)
|
|
277
|
+
// This simulates clicking within the 8px compact tolerance of the header checkbox
|
|
278
|
+
const clickX = headerBounds.x + 15; // Slightly to the right of where checkbox would be
|
|
279
|
+
const clickY = headerBounds.y + headerBounds.height / 2;
|
|
280
|
+
// Click within tolerance boundary should trigger "select all" due to checkboxTolerance="compact"
|
|
281
|
+
yield page.mouse.click(clickX, clickY);
|
|
282
|
+
// Verify header checkbox is now checked (select all)
|
|
283
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeChecked();
|
|
284
|
+
// Verify all row checkboxes are also checked (select all behavior)
|
|
285
|
+
const allCheckboxes = page.locator("input[type='checkbox']");
|
|
286
|
+
const checkboxCount = yield allCheckboxes.count();
|
|
287
|
+
for (let i = 0; i < checkboxCount; i++) {
|
|
288
|
+
yield (0, fixtures_1.expect)(allCheckboxes.nth(i)).toBeChecked();
|
|
289
|
+
}
|
|
290
|
+
// Verify selection event was fired
|
|
291
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('header selection changed');
|
|
292
|
+
}));
|
|
293
|
+
(0, fixtures_1.test)("allows checkbox interaction within none tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
294
|
+
const { testStateDriver } = yield initTestBed(`
|
|
295
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
296
|
+
rowsSelectable="true"
|
|
297
|
+
checkboxTolerance="none"
|
|
298
|
+
onSelectionDidChange="testState = 'none selection changed'"
|
|
299
|
+
testId="table">
|
|
300
|
+
<Column bindTo="name"/>
|
|
301
|
+
<Column bindTo="quantity"/>
|
|
302
|
+
</Table>
|
|
303
|
+
`);
|
|
304
|
+
// Get first row checkbox - checkboxes exist but are hidden via CSS
|
|
305
|
+
const firstRowCheckbox = page.locator("input[type='checkbox']").nth(1); // Skip header checkbox
|
|
306
|
+
// Verify checkbox exists (even if hidden)
|
|
307
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeAttached();
|
|
308
|
+
// Get the first table row to interact with
|
|
309
|
+
const firstDataRow = page.locator("tbody tr").first();
|
|
310
|
+
yield (0, fixtures_1.expect)(firstDataRow).toBeVisible();
|
|
311
|
+
// Get row bounds for calculation
|
|
312
|
+
const rowBounds = yield firstDataRow.boundingBox();
|
|
313
|
+
// For "none" tolerance, we need to click precisely on the checkbox
|
|
314
|
+
// Since checkboxes are hidden, click on their expected position
|
|
315
|
+
yield firstRowCheckbox.click({ force: true });
|
|
316
|
+
// Verify checkbox is now checked
|
|
317
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeChecked();
|
|
318
|
+
// Verify selection event was fired
|
|
319
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('none selection changed');
|
|
320
|
+
}));
|
|
321
|
+
(0, fixtures_1.test)("allows header checkbox interaction within none tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
322
|
+
const { testStateDriver } = yield initTestBed(`
|
|
323
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
324
|
+
rowsSelectable="true"
|
|
325
|
+
enableMultiRowSelection="true"
|
|
326
|
+
checkboxTolerance="none"
|
|
327
|
+
onSelectionDidChange="testState = 'header none selection changed'"
|
|
328
|
+
testId="table">
|
|
329
|
+
<Column bindTo="name"/>
|
|
330
|
+
<Column bindTo="quantity"/>
|
|
331
|
+
</Table>
|
|
332
|
+
`);
|
|
333
|
+
// Get header checkbox (select all checkbox)
|
|
334
|
+
const headerCheckbox = page.locator("input[type='checkbox']").first(); // Header checkbox is first
|
|
335
|
+
// Verify checkbox exists (even if hidden)
|
|
336
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeAttached();
|
|
337
|
+
// Get the header row to interact with
|
|
338
|
+
const headerRow = page.locator("thead tr").first();
|
|
339
|
+
yield (0, fixtures_1.expect)(headerRow).toBeVisible();
|
|
340
|
+
// Get header row bounds for calculation
|
|
341
|
+
const headerBounds = yield headerRow.boundingBox();
|
|
342
|
+
// For "none" tolerance, we need to click precisely on the checkbox
|
|
343
|
+
// Since checkboxes are hidden, click on their expected position
|
|
344
|
+
yield headerCheckbox.click({ force: true });
|
|
345
|
+
// Verify header checkbox is now checked (select all)
|
|
346
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeChecked();
|
|
347
|
+
// Verify all row checkboxes are also checked (select all behavior)
|
|
348
|
+
const allCheckboxes = page.locator("input[type='checkbox']");
|
|
349
|
+
const checkboxCount = yield allCheckboxes.count();
|
|
350
|
+
for (let i = 0; i < checkboxCount; i++) {
|
|
351
|
+
yield (0, fixtures_1.expect)(allCheckboxes.nth(i)).toBeChecked();
|
|
352
|
+
}
|
|
353
|
+
// Verify selection event was fired
|
|
354
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('header none selection changed');
|
|
355
|
+
}));
|
|
356
|
+
(0, fixtures_1.test)("allows checkbox interaction within comfortable tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
357
|
+
const { testStateDriver } = yield initTestBed(`
|
|
358
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
359
|
+
rowsSelectable="true"
|
|
360
|
+
checkboxTolerance="comfortable"
|
|
361
|
+
onSelectionDidChange="testState = 'comfortable selection changed'"
|
|
362
|
+
testId="table">
|
|
363
|
+
<Column bindTo="name"/>
|
|
364
|
+
<Column bindTo="quantity"/>
|
|
365
|
+
</Table>
|
|
366
|
+
`);
|
|
367
|
+
// Get first row checkbox - checkboxes exist but are hidden via CSS
|
|
368
|
+
const firstRowCheckbox = page.locator("input[type='checkbox']").nth(1); // Skip header checkbox
|
|
369
|
+
// Verify checkbox exists (even if hidden)
|
|
370
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeAttached();
|
|
371
|
+
// Get the first table row to interact with
|
|
372
|
+
const firstDataRow = page.locator("tbody tr").first();
|
|
373
|
+
yield (0, fixtures_1.expect)(firstDataRow).toBeVisible();
|
|
374
|
+
// Get row bounds for calculation
|
|
375
|
+
const rowBounds = yield firstDataRow.boundingBox();
|
|
376
|
+
// Click near the left edge of the row (where checkbox would be with tolerance)
|
|
377
|
+
// This simulates clicking within the 12px comfortable tolerance of the checkbox
|
|
378
|
+
const clickX = rowBounds.x + 20; // Further right to test 12px tolerance
|
|
379
|
+
const clickY = rowBounds.y + rowBounds.height / 2;
|
|
380
|
+
// Click within tolerance boundary should trigger selection due to checkboxTolerance="comfortable"
|
|
381
|
+
yield page.mouse.click(clickX, clickY);
|
|
382
|
+
// Verify checkbox is now checked
|
|
383
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeChecked();
|
|
384
|
+
// Verify selection event was fired
|
|
385
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('comfortable selection changed');
|
|
386
|
+
}));
|
|
387
|
+
(0, fixtures_1.test)("allows header checkbox interaction within comfortable tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
388
|
+
const { testStateDriver } = yield initTestBed(`
|
|
389
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
390
|
+
rowsSelectable="true"
|
|
391
|
+
enableMultiRowSelection="true"
|
|
392
|
+
checkboxTolerance="comfortable"
|
|
393
|
+
onSelectionDidChange="testState = 'header comfortable selection changed'"
|
|
394
|
+
testId="table">
|
|
395
|
+
<Column bindTo="name"/>
|
|
396
|
+
<Column bindTo="quantity"/>
|
|
397
|
+
</Table>
|
|
398
|
+
`);
|
|
399
|
+
// Get header checkbox (select all checkbox)
|
|
400
|
+
const headerCheckbox = page.locator("input[type='checkbox']").first(); // Header checkbox is first
|
|
401
|
+
// Verify checkbox exists (even if hidden)
|
|
402
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeAttached();
|
|
403
|
+
// Get the header row to interact with
|
|
404
|
+
const headerRow = page.locator("thead tr").first();
|
|
405
|
+
yield (0, fixtures_1.expect)(headerRow).toBeVisible();
|
|
406
|
+
// Get header row bounds for calculation
|
|
407
|
+
const headerBounds = yield headerRow.boundingBox();
|
|
408
|
+
// Click near the left edge of the header row (where checkbox would be with tolerance)
|
|
409
|
+
// This simulates clicking within the 12px comfortable tolerance of the header checkbox
|
|
410
|
+
const clickX = headerBounds.x + 20; // Further right to test 12px tolerance
|
|
411
|
+
const clickY = headerBounds.y + headerBounds.height / 2;
|
|
412
|
+
// Click within tolerance boundary should trigger "select all" due to checkboxTolerance="comfortable"
|
|
413
|
+
yield page.mouse.click(clickX, clickY);
|
|
414
|
+
// Verify header checkbox is now checked (select all)
|
|
415
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeChecked();
|
|
416
|
+
// Verify all row checkboxes are also checked (select all behavior)
|
|
417
|
+
const allCheckboxes = page.locator("input[type='checkbox']");
|
|
418
|
+
const checkboxCount = yield allCheckboxes.count();
|
|
419
|
+
for (let i = 0; i < checkboxCount; i++) {
|
|
420
|
+
yield (0, fixtures_1.expect)(allCheckboxes.nth(i)).toBeChecked();
|
|
421
|
+
}
|
|
422
|
+
// Verify selection event was fired
|
|
423
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('header comfortable selection changed');
|
|
424
|
+
}));
|
|
425
|
+
(0, fixtures_1.test)("allows checkbox interaction within spacious tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
426
|
+
const { testStateDriver } = yield initTestBed(`
|
|
427
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
428
|
+
rowsSelectable="true"
|
|
429
|
+
checkboxTolerance="spacious"
|
|
430
|
+
onSelectionDidChange="testState = 'spacious selection changed'"
|
|
431
|
+
testId="table">
|
|
432
|
+
<Column bindTo="name"/>
|
|
433
|
+
<Column bindTo="quantity"/>
|
|
434
|
+
</Table>
|
|
435
|
+
`);
|
|
436
|
+
// Get first row checkbox - checkboxes exist but are hidden via CSS
|
|
437
|
+
const firstRowCheckbox = page.locator("input[type='checkbox']").nth(1); // Skip header checkbox
|
|
438
|
+
// Verify checkbox exists (even if hidden)
|
|
439
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeAttached();
|
|
440
|
+
// Get the first table row to interact with
|
|
441
|
+
const firstDataRow = page.locator("tbody tr").first();
|
|
442
|
+
yield (0, fixtures_1.expect)(firstDataRow).toBeVisible();
|
|
443
|
+
// Get row bounds for calculation
|
|
444
|
+
const rowBounds = yield firstDataRow.boundingBox();
|
|
445
|
+
// Click near the left edge of the row (where checkbox would be with tolerance)
|
|
446
|
+
// This simulates clicking within the 16px spacious tolerance of the checkbox
|
|
447
|
+
const clickX = rowBounds.x + 24; // Even further right to test 16px tolerance
|
|
448
|
+
const clickY = rowBounds.y + rowBounds.height / 2;
|
|
449
|
+
// Click within tolerance boundary should trigger selection due to checkboxTolerance="spacious"
|
|
450
|
+
yield page.mouse.click(clickX, clickY);
|
|
451
|
+
// Verify checkbox is now checked
|
|
452
|
+
yield (0, fixtures_1.expect)(firstRowCheckbox).toBeChecked();
|
|
453
|
+
// Verify selection event was fired
|
|
454
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('spacious selection changed');
|
|
455
|
+
}));
|
|
456
|
+
(0, fixtures_1.test)("allows header checkbox interaction within spacious tolerance boundary", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
457
|
+
const { testStateDriver } = yield initTestBed(`
|
|
458
|
+
<Table data='{${JSON.stringify(sampleData)}}'
|
|
459
|
+
rowsSelectable="true"
|
|
460
|
+
enableMultiRowSelection="true"
|
|
461
|
+
checkboxTolerance="spacious"
|
|
462
|
+
onSelectionDidChange="testState = 'header spacious selection changed'"
|
|
463
|
+
testId="table">
|
|
464
|
+
<Column bindTo="name"/>
|
|
465
|
+
<Column bindTo="quantity"/>
|
|
466
|
+
</Table>
|
|
467
|
+
`);
|
|
468
|
+
// Get header checkbox (select all checkbox)
|
|
469
|
+
const headerCheckbox = page.locator("input[type='checkbox']").first(); // Header checkbox is first
|
|
470
|
+
// Verify checkbox exists (even if hidden)
|
|
471
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeAttached();
|
|
472
|
+
// Get the header row to interact with
|
|
473
|
+
const headerRow = page.locator("thead tr").first();
|
|
474
|
+
yield (0, fixtures_1.expect)(headerRow).toBeVisible();
|
|
475
|
+
// Get header row bounds for calculation
|
|
476
|
+
const headerBounds = yield headerRow.boundingBox();
|
|
477
|
+
// Click near the left edge of the header row (where checkbox would be with tolerance)
|
|
478
|
+
// This simulates clicking within the 16px spacious tolerance of the header checkbox
|
|
479
|
+
const clickX = headerBounds.x + 24; // Even further right to test 16px tolerance
|
|
480
|
+
const clickY = headerBounds.y + headerBounds.height / 2;
|
|
481
|
+
// Click within tolerance boundary should trigger "select all" due to checkboxTolerance="spacious"
|
|
482
|
+
yield page.mouse.click(clickX, clickY);
|
|
483
|
+
// Verify header checkbox is now checked (select all)
|
|
484
|
+
yield (0, fixtures_1.expect)(headerCheckbox).toBeChecked();
|
|
485
|
+
// Verify all row checkboxes are also checked (select all behavior)
|
|
486
|
+
const allCheckboxes = page.locator("input[type='checkbox']");
|
|
487
|
+
const checkboxCount = yield allCheckboxes.count();
|
|
488
|
+
for (let i = 0; i < checkboxCount; i++) {
|
|
489
|
+
yield (0, fixtures_1.expect)(allCheckboxes.nth(i)).toBeChecked();
|
|
490
|
+
}
|
|
491
|
+
// Verify selection event was fired
|
|
492
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual('header spacious selection changed');
|
|
493
|
+
}));
|
|
494
|
+
});
|
|
223
495
|
fixtures_1.test.describe("noDataTemplate property", () => {
|
|
224
496
|
(0, fixtures_1.test)("shows custom no data template when data is empty", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
225
497
|
yield initTestBed(`
|
|
@@ -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
|
};
|
|
@@ -64,10 +64,6 @@ exports.TextAreaMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
64
64
|
},
|
|
65
65
|
placeholder: (0, metadata_helpers_1.dPlaceholder)(),
|
|
66
66
|
initialValue: (0, metadata_helpers_1.dInitialValue)(),
|
|
67
|
-
label: (0, metadata_helpers_1.dLabel)(),
|
|
68
|
-
labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
|
|
69
|
-
labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
|
|
70
|
-
labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
|
|
71
67
|
maxLength: (0, metadata_helpers_1.dMaxLength)(),
|
|
72
68
|
autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
|
|
73
69
|
required: (0, metadata_helpers_1.dRequired)(),
|
|
@@ -103,5 +99,5 @@ exports.TextAreaMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
103
99
|
},
|
|
104
100
|
});
|
|
105
101
|
exports.textAreaComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TextAreaMd, ({ node, extractValue, state, updateState, className, registerComponentApi, lookupEventHandler, }) => {
|
|
106
|
-
return ((0, jsx_runtime_1.jsx)(TextAreaNative_1.TextArea, { value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue(node.props.placeholder), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), resize: node.props.resize, enterSubmits: extractValue.asOptionalBoolean(node.props.enterSubmits), escResets: extractValue.asOptionalBoolean(node.props.escResets), className: className, registerComponentApi: registerComponentApi, maxRows: extractValue.asOptionalNumber(node.props.maxRows), minRows: extractValue.asOptionalNumber(node.props.minRows), maxLength: extractValue.asOptionalNumber(node.props.maxLength), rows: extractValue.asOptionalNumber(node.props.rows), autoSize: extractValue.asOptionalBoolean(node.props.autoSize), validationStatus: extractValue(node.props.validationStatus),
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(TextAreaNative_1.TextArea, { value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue(node.props.initialValue), updateState: updateState, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue(node.props.placeholder), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), resize: node.props.resize, enterSubmits: extractValue.asOptionalBoolean(node.props.enterSubmits), escResets: extractValue.asOptionalBoolean(node.props.escResets), className: className, registerComponentApi: registerComponentApi, maxRows: extractValue.asOptionalNumber(node.props.maxRows), minRows: extractValue.asOptionalNumber(node.props.minRows), maxLength: extractValue.asOptionalNumber(node.props.maxLength), rows: extractValue.asOptionalNumber(node.props.rows), autoSize: extractValue.asOptionalBoolean(node.props.autoSize), validationStatus: extractValue(node.props.validationStatus), required: extractValue.asOptionalBoolean(node.props.required) }));
|
|
107
103
|
});
|