@handsontable/angular-wrapper 0.0.0-next-c573c90-20260210 → 0.0.0-next-a4c3bb2-20260211

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.
Files changed (28) hide show
  1. package/esm2022/lib/editor/custom-editor-placeholder.component.mjs +5 -8
  2. package/esm2022/lib/editor/hot-cell-editor.component.mjs +1 -2
  3. package/esm2022/lib/hot-table.component.mjs +4 -7
  4. package/esm2022/lib/hot-table.module.mjs +2 -2
  5. package/esm2022/lib/models/column-settings.mjs +1 -1
  6. package/esm2022/lib/renderer/hot-dynamic-renderer-component.service.mjs +10 -62
  7. package/esm2022/lib/services/hot-settings-resolver.service.mjs +17 -54
  8. package/esm2022/public-api.mjs +1 -4
  9. package/fesm2022/handsontable-angular-wrapper.mjs +126 -496
  10. package/fesm2022/handsontable-angular-wrapper.mjs.map +1 -1
  11. package/lib/editor/custom-editor-placeholder.component.d.ts +2 -4
  12. package/lib/editor/hot-cell-editor.component.d.ts +0 -1
  13. package/lib/hot-table.component.d.ts +2 -3
  14. package/lib/models/column-settings.d.ts +2 -7
  15. package/lib/renderer/hot-dynamic-renderer-component.service.d.ts +0 -19
  16. package/lib/services/hot-settings-resolver.service.d.ts +0 -3
  17. package/package.json +1 -1
  18. package/public-api.d.ts +0 -3
  19. package/esm2022/lib/editor/editor-factory-adapter.mjs +0 -140
  20. package/esm2022/lib/editor/hot-cell-editor-advanced.component.mjs +0 -92
  21. package/esm2022/lib/editor/models/factory-editor-properties.mjs +0 -2
  22. package/esm2022/lib/editor/models/keyboard-shortcut-config.mjs +0 -2
  23. package/esm2022/lib/renderer/hot-cell-renderer-advanced.component.mjs +0 -55
  24. package/lib/editor/editor-factory-adapter.d.ts +0 -13
  25. package/lib/editor/hot-cell-editor-advanced.component.d.ts +0 -74
  26. package/lib/editor/models/factory-editor-properties.d.ts +0 -24
  27. package/lib/editor/models/keyboard-shortcut-config.d.ts +0 -13
  28. package/lib/renderer/hot-cell-renderer-advanced.component.d.ts +0 -33
@@ -1,9 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ViewContainerRef, Component, ChangeDetectionStrategy, Input, ViewChild, createComponent, EventEmitter, Directive, HostBinding, Output, Injectable, InjectionToken, Inject, ViewEncapsulation, NgModule } from '@angular/core';
2
+ import { ViewContainerRef, Component, ChangeDetectionStrategy, Input, ViewChild, createComponent, Injectable, InjectionToken, Inject, ViewEncapsulation, NgModule, EventEmitter, Directive, HostBinding, Output } from '@angular/core';
3
3
  import Handsontable from 'handsontable/base';
4
4
  import { take } from 'rxjs/operators';
5
- import { editorFactory } from 'handsontable/editors/factory';
6
- import { baseRenderer, rendererFactory, registerRenderer } from 'handsontable/renderers';
5
+ import { baseRenderer } from 'handsontable/renderers';
7
6
  import { BehaviorSubject } from 'rxjs';
8
7
 
9
8
  /**
@@ -22,7 +21,6 @@ class CustomEditorPlaceholderComponent {
22
21
  set isVisible(value) {
23
22
  this._isVisible = value;
24
23
  }
25
- placeholderCustomClass = 'handsontableInputHolder ht_clone_master';
26
24
  /** The reference to the component instance of the editor. */
27
25
  set componentRef(hotEditorComponentRef) {
28
26
  if (hotEditorComponentRef) {
@@ -43,8 +41,8 @@ class CustomEditorPlaceholderComponent {
43
41
  this.container.detach();
44
42
  }
45
43
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomEditorPlaceholderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
46
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CustomEditorPlaceholderComponent, selector: "ng-component", inputs: { top: "top", left: "left", height: "height", width: "width", isVisible: "isVisible", placeholderCustomClass: "placeholderCustomClass", componentRef: "componentRef" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["inputPlaceholder"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: ` <div
47
- [class]="placeholderCustomClass"
44
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CustomEditorPlaceholderComponent, selector: "ng-component", inputs: { top: "top", left: "left", height: "height", width: "width", isVisible: "isVisible", componentRef: "componentRef" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["inputPlaceholder"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: ` <div
45
+ class="handsontableInputHolder ht_clone_master"
48
46
  [style.display]="display"
49
47
  [style.width.px]="width"
50
48
  [style.height.px]="height"
@@ -60,7 +58,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
60
58
  type: Component,
61
59
  args: [{
62
60
  template: ` <div
63
- [class]="placeholderCustomClass"
61
+ class="handsontableInputHolder ht_clone_master"
64
62
  [style.display]="display"
65
63
  [style.width.px]="width"
66
64
  [style.height.px]="height"
@@ -84,8 +82,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
84
82
  type: Input
85
83
  }], isVisible: [{
86
84
  type: Input
87
- }], placeholderCustomClass: [{
88
- type: Input
89
85
  }], componentRef: [{
90
86
  type: Input
91
87
  }], container: [{
@@ -322,384 +318,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
322
318
  type: Input
323
319
  }] } });
324
320
 
325
- /**
326
- * Abstract class representing a Handsontable editor in angular.
327
- */
328
- class HotCellEditorComponent {
329
- static EDITOR_MARKER = Symbol('HotCellEditorComponent');
330
- /** The tabindex attribute for the editor. */
331
- tabindex = -1;
332
- /** The data-hot-input attribute for the editor. */
333
- dataHotInput = '';
334
- /** The handsontableInput class for the editor. */
335
- handsontableInputClass = true;
336
- /** The height of the editor as a percentage of the parent container. */
337
- heightFitParentContainer = 100;
338
- /** The width of the editor as a percentage of the parent container. */
339
- widthFitParentContainer = 100;
340
- /** The row index of the cell being edited. */
341
- row;
342
- /** The column index of the cell being edited. */
343
- column;
344
- /** The property name of the cell being edited. */
345
- prop;
346
- /** The original value of the cell being edited. */
347
- originalValue;
348
- /** The cell properties of the cell being edited. */
349
- cellProperties;
350
- /** Event emitted when the edit is finished.
351
- * The data will be saved to the model.
352
- */
353
- finishEdit = new EventEmitter();
354
- /** Event emitted when the edit is canceled.
355
- * The entered data will be reverted to the original value.
356
- */
357
- cancelEdit = new EventEmitter();
358
- /** The current value of the editor. */
359
- _value;
360
- /** Event triggered by Handsontable on closing the editor.
361
- * The user can define their own actions for
362
- * the custom editor to be called after the base logic. */
363
- onClose() { }
364
- /** Event triggered by Handsontable on open the editor.
365
- * The user can define their own actions for
366
- * the custom editor to be called after the base logic. */
367
- onOpen(event) { }
368
- /**
369
- * Gets the current value of the editor.
370
- * @returns The current value of the editor.
371
- */
372
- getValue() {
373
- return this._value;
374
- }
375
- /**
376
- * Sets the current value of the editor.
377
- * @param value The value to set.
378
- */
379
- setValue(value) {
380
- this._value = value;
381
- }
382
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
383
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: HotCellEditorComponent, inputs: { row: "row", column: "column", prop: "prop", originalValue: "originalValue", cellProperties: "cellProperties" }, outputs: { finishEdit: "finishEdit", cancelEdit: "cancelEdit" }, host: { properties: { "attr.tabindex": "this.tabindex", "attr.data-hot-input": "this.dataHotInput", "class.handsontableInput": "this.handsontableInputClass", "style.height.%": "this.heightFitParentContainer", "style.width.%": "this.widthFitParentContainer" } }, ngImport: i0 });
384
- }
385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellEditorComponent, decorators: [{
386
- type: Directive
387
- }], propDecorators: { tabindex: [{
388
- type: HostBinding,
389
- args: ['attr.tabindex']
390
- }], dataHotInput: [{
391
- type: HostBinding,
392
- args: ['attr.data-hot-input']
393
- }], handsontableInputClass: [{
394
- type: HostBinding,
395
- args: ['class.handsontableInput']
396
- }], heightFitParentContainer: [{
397
- type: HostBinding,
398
- args: ['style.height.%']
399
- }], widthFitParentContainer: [{
400
- type: HostBinding,
401
- args: ['style.width.%']
402
- }], row: [{
403
- type: Input
404
- }], column: [{
405
- type: Input
406
- }], prop: [{
407
- type: Input
408
- }], originalValue: [{
409
- type: Input
410
- }], cellProperties: [{
411
- type: Input
412
- }], finishEdit: [{
413
- type: Output
414
- }], cancelEdit: [{
415
- type: Output
416
- }] } });
417
-
418
- /**
419
- * Factory function to create a custom Handsontable editor adapter for Angular components.
420
- *
421
- * This adapter integrates Angular components with Handsontable's editor system using the new
422
- * editorFactory API, allowing you to use Angular components as custom cell editors while
423
- * maintaining full Angular lifecycle management and change detection.
424
- *
425
- * @returns A custom editor class that can be used in Handsontable column settings.
426
- *
427
- */
428
- const FactoryEditorAdapter = (componentRef) => editorFactory({
429
- position: componentRef.instance.position,
430
- shortcuts: componentRef.instance.shortcuts,
431
- config: componentRef.instance.config,
432
- init(editor) {
433
- editor._componentRef = componentRef;
434
- editor._editorPlaceHolderRef = undefined;
435
- editor._finishEditSubscription = undefined;
436
- editor._cancelEditSubscription = undefined;
437
- createEditorPlaceholder(editor, editor.hot._angularEnvironmentInjector);
438
- editor.input = editor._editorPlaceHolderRef.location.nativeElement;
439
- editor._afterRowResizeCallback = () => {
440
- if (editor.isOpened()) {
441
- applyPropsToEditor(editor);
442
- }
443
- };
444
- editor._afterColumnResizeCallback = () => {
445
- if (editor.isOpened()) {
446
- applyPropsToEditor(editor);
447
- }
448
- };
449
- editor._afterDestroyCallback = () => {
450
- if (editor._editorPlaceHolderRef) {
451
- editor._editorPlaceHolderRef.destroy();
452
- }
453
- };
454
- // Hooks are automatically removed by Handsontable on table destroy
455
- editor.hot.addHook('afterRowResize', editor._afterRowResizeCallback);
456
- editor.hot.addHook('afterColumnResize', editor._afterColumnResizeCallback);
457
- editor.hot.addHook('afterDestroy', editor._afterDestroyCallback);
458
- },
459
- afterInit: (editor) => editor._componentRef.instance.afterInit?.(editor),
460
- beforeOpen: (editor, context) => {
461
- cleanupSubscriptions(editor);
462
- applyPropsToEditor(editor);
463
- editor._finishEditSubscription = editor._componentRef.instance.finishEdit.pipe(take(1)).subscribe(() => {
464
- editor.finishEditing();
465
- });
466
- editor._cancelEditSubscription = editor._componentRef.instance.cancelEdit.pipe(take(1)).subscribe(() => {
467
- editor.cancelChanges();
468
- });
469
- editor._componentRef.instance.beforeOpen?.(editor, context);
470
- },
471
- afterOpen: (editor, event) => {
472
- editor._componentRef.instance.afterOpen?.(editor, event);
473
- },
474
- onFocus: (editor) => editor._componentRef.instance.onFocus?.(editor),
475
- afterClose: (editor) => {
476
- resetEditorState(editor);
477
- editor._editorPlaceHolderRef.changeDetectorRef.detectChanges();
478
- editor._editorPlaceHolderRef.instance.detachEditor();
479
- editor._componentRef.instance.afterClose?.(editor);
480
- },
481
- getValue: (editor) => editor._componentRef.instance.getValue(),
482
- setValue: (editor, value) => {
483
- editor.value = value;
484
- editor._componentRef.instance.setValue(value);
485
- editor._componentRef.changeDetectorRef.detectChanges();
486
- },
487
- });
488
- /**
489
- * Creates the editor placeholder component.
490
- * @param editor The editor instance.
491
- * @param injector The environment injector from Angular.
492
- */
493
- function createEditorPlaceholder(editor, injector) {
494
- if (!injector) {
495
- return;
496
- }
497
- editor._editorPlaceHolderRef = createComponent(CustomEditorPlaceholderComponent, {
498
- environmentInjector: injector,
499
- });
500
- }
501
- /**
502
- * Applies properties to the custom Angular editor and editor placeholder.
503
- * Updates position, size, and cell context information.
504
- * @param editor The editor instance.
505
- */
506
- function applyPropsToEditor(editor) {
507
- if (!editor._componentRef || !editor._editorPlaceHolderRef) {
508
- return;
509
- }
510
- editor._componentRef.setInput('originalValue', editor.originalValue);
511
- editor._componentRef.setInput('row', editor.row);
512
- editor._componentRef.setInput('column', editor.col);
513
- editor._componentRef.setInput('prop', editor.prop);
514
- editor._componentRef.setInput('cellProperties', editor.cellProperties);
515
- const rect = editor.hot.getCell(editor.row, editor.col)?.getBoundingClientRect();
516
- editor._editorPlaceHolderRef.setInput('placeholderCustomClass', '');
517
- editor._editorPlaceHolderRef.setInput('height', rect.height);
518
- editor._editorPlaceHolderRef.setInput('width', rect.width);
519
- editor._editorPlaceHolderRef.setInput('isVisible', true);
520
- editor._editorPlaceHolderRef.setInput('componentRef', editor._componentRef);
521
- editor._editorPlaceHolderRef.changeDetectorRef.detectChanges();
522
- }
523
- /**
524
- * Resets the editor placeholder state.
525
- * Clears all positioning and visibility settings.
526
- * @param editor The editor instance.
527
- */
528
- function resetEditorState(editor) {
529
- if (!editor._editorPlaceHolderRef) {
530
- return;
531
- }
532
- editor._editorPlaceHolderRef.setInput('top', undefined);
533
- editor._editorPlaceHolderRef.setInput('left', undefined);
534
- editor._editorPlaceHolderRef.setInput('height', undefined);
535
- editor._editorPlaceHolderRef.setInput('width', undefined);
536
- editor._editorPlaceHolderRef.setInput('isVisible', false);
537
- editor._editorPlaceHolderRef.setInput('componentRef', undefined);
538
- }
539
- /**
540
- * Cleans up existing subscriptions.
541
- * @param editor The editor instance.
542
- */
543
- function cleanupSubscriptions(editor) {
544
- if (editor._finishEditSubscription) {
545
- editor._finishEditSubscription.unsubscribe();
546
- editor._finishEditSubscription = undefined;
547
- }
548
- if (editor._cancelEditSubscription) {
549
- editor._cancelEditSubscription.unsubscribe();
550
- editor._cancelEditSubscription = undefined;
551
- }
552
- }
553
-
554
- /**
555
- * Abstract base component for creating advanced custom cell renderer components for Handsontable.
556
- *
557
- * This class provides a common interface and properties required by any custom cell renderer.
558
- *
559
- * @template TValue - The type of the component renderer.
560
- * @template TProps - The type of additional renderer properties.
561
- */
562
- class HotCellRendererAdvancedComponent {
563
- static RENDERER_MARKER = Symbol('HotCellRendererAdvancedComponent');
564
- value = '';
565
- instance;
566
- td;
567
- row;
568
- col;
569
- prop;
570
- /**
571
- * The cell properties provided by Handsontable, extended with optional renderer-specific properties.
572
- */
573
- cellProperties;
574
- /**
575
- * Retrieves the renderer-specific properties from the cell properties.
576
- *
577
- * @returns The additional properties for the renderer.
578
- */
579
- getProps() {
580
- return this.cellProperties?.rendererProps ?? {};
581
- }
582
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellRendererAdvancedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
583
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: HotCellRendererAdvancedComponent, selector: "hot-cell-renderer-advanced", inputs: { value: "value", instance: "instance", td: "td", row: "row", col: "col", prop: "prop", cellProperties: "cellProperties" }, ngImport: i0, template: `<!-- This is an abstract component. Extend this component and provide your own template. -->`, isInline: true });
584
- }
585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellRendererAdvancedComponent, decorators: [{
586
- type: Component,
587
- args: [{
588
- selector: 'hot-cell-renderer-advanced',
589
- template: `<!-- This is an abstract component. Extend this component and provide your own template. -->`,
590
- }]
591
- }], propDecorators: { value: [{
592
- type: Input
593
- }], instance: [{
594
- type: Input
595
- }], td: [{
596
- type: Input
597
- }], row: [{
598
- type: Input
599
- }], col: [{
600
- type: Input
601
- }], prop: [{
602
- type: Input
603
- }], cellProperties: [{
604
- type: Input
605
- }] } });
606
-
607
- /**
608
- * Abstract class representing a Handsontable editor in angular.
609
- */
610
- class HotCellEditorAdvancedComponent {
611
- static EDITOR_MARKER = Symbol('HotCellEditorAdvancedComponent');
612
- /** The height of the editor as a percentage of the parent container. */
613
- heightFitParentContainer = 100;
614
- /** The width of the editor as a percentage of the parent container. */
615
- widthFitParentContainer = 100;
616
- /** The row index of the cell being edited. */
617
- row;
618
- /** The column index of the cell being edited. */
619
- column;
620
- /** The property name of the cell being edited. */
621
- prop;
622
- /** The original value of the cell being edited. */
623
- originalValue;
624
- /** The cell properties of the cell being edited. */
625
- cellProperties;
626
- /** Event emitted when the edit is finished.
627
- * The data will be saved to the model.
628
- */
629
- finishEdit = new EventEmitter();
630
- /** Event emitted when the edit is canceled.
631
- * The entered data will be reverted to the original value.
632
- */
633
- cancelEdit = new EventEmitter();
634
- /** The current value of the editor. */
635
- value;
636
- /** Event triggered by Handsontable on focus the editor.
637
- * The user have to define focus logic.
638
- */
639
- onFocus(editor) { }
640
- /**
641
- * Gets the current value of the editor.
642
- * @returns The current value of the editor.
643
- */
644
- getValue() {
645
- return this.value;
646
- }
647
- /**
648
- * Sets the current value of the editor.
649
- * @param value The value to set.
650
- */
651
- setValue(value) {
652
- this.value = value;
653
- }
654
- /** The position of the editor in the DOM. Used by Handsontable API. Available in advanced mode. */
655
- position = 'container';
656
- /** The shortcuts available for the editor. Available in advanced mode. */
657
- shortcuts;
658
- /** The group name for the shortcuts. Available in advanced mode.*/
659
- shortcutsGroup;
660
- /** Configuration. Available in advanced mode. */
661
- config;
662
- /** Lifecycle hook called after the editor is opened. Available in advanced mode.*/
663
- afterOpen(editor, event) { }
664
- /** Lifecycle hook called after the editor is closed. Available in advanced mode. */
665
- afterClose(editor) { }
666
- /** Lifecycle hook called after the editor is initialized. Available in advanced mode.*/
667
- afterInit(editor) { }
668
- /** Lifecycle hook called before the editor is opened. Available in advanced mode. */
669
- beforeOpen(editor, { row, col, prop, td, originalValue, cellProperties, }) { }
670
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellEditorAdvancedComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
671
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: HotCellEditorAdvancedComponent, inputs: { row: "row", column: "column", prop: "prop", originalValue: "originalValue", cellProperties: "cellProperties" }, outputs: { finishEdit: "finishEdit", cancelEdit: "cancelEdit" }, host: { properties: { "style.height.%": "this.heightFitParentContainer", "style.width.%": "this.widthFitParentContainer" } }, ngImport: i0 });
672
- }
673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellEditorAdvancedComponent, decorators: [{
674
- type: Directive
675
- }], propDecorators: { heightFitParentContainer: [{
676
- type: HostBinding,
677
- args: ['style.height.%']
678
- }], widthFitParentContainer: [{
679
- type: HostBinding,
680
- args: ['style.width.%']
681
- }], row: [{
682
- type: Input
683
- }], column: [{
684
- type: Input
685
- }], prop: [{
686
- type: Input
687
- }], originalValue: [{
688
- type: Input
689
- }], cellProperties: [{
690
- type: Input
691
- }], finishEdit: [{
692
- type: Output
693
- }], cancelEdit: [{
694
- type: Output
695
- }] } });
696
-
697
321
  const INVALID_RENDERER_WARNING = 'The provided renderer component was not recognized as a valid custom renderer. ' +
698
322
  'It must either extend HotCellRendererComponent or be a valid TemplateRef. ' +
699
323
  'Please ensure that your custom renderer is implemented correctly and imported from the proper source.';
700
- const INVALID_ADVANCED_RENDERER_WARNING = 'The provided renderer component was not recognized as a valid custom renderer. ' +
701
- 'It must either extend HotCellRendererAdvancedComponent. ' +
702
- 'Please ensure that your custom renderer is implemented correctly and imported from the proper source.';
703
324
  /**
704
325
  * Type guard that checks if the given object is a TemplateRef.
705
326
  *
@@ -718,15 +339,6 @@ function isTemplateRef(obj) {
718
339
  function isHotCellRendererComponent(obj) {
719
340
  return obj?.RENDERER_MARKER === HotCellRendererComponent.RENDERER_MARKER;
720
341
  }
721
- /**
722
- * Type guard to check if an object is an instance of HotCellRendererAdvancedComponent.
723
- *
724
- * @param obj - The object to check.
725
- * @returns True if the object is a HotCellRendererAdvancedComponent, false otherwise.
726
- */
727
- function isAdvancedHotCellRendererComponent(obj) {
728
- return obj?.RENDERER_MARKER === HotCellRendererAdvancedComponent.RENDERER_MARKER;
729
- }
730
342
  /**
731
343
  * Service for dynamically creating Angular components or templates as custom renderers for Handsontable.
732
344
  *
@@ -756,18 +368,14 @@ class DynamicComponentService {
756
368
  createRendererFromComponent(component, componentProps = {}, register = false) {
757
369
  return (instance, td, row, col, prop, value, cellProperties) => {
758
370
  const properties = {
759
- value,
760
- instance,
761
- td,
762
- row,
763
- col,
764
- prop,
765
- cellProperties,
371
+ value, instance, td, row, col, prop, cellProperties
766
372
  };
767
373
  if (componentProps) {
768
374
  Object.assign(cellProperties, { rendererProps: componentProps });
769
375
  }
770
- const rendererParameters = [instance, td, row, col, prop, value, cellProperties];
376
+ const rendererParameters = [
377
+ instance, td, row, col, prop, value, cellProperties
378
+ ];
771
379
  baseRenderer.apply(this, rendererParameters);
772
380
  td.innerHTML = '';
773
381
  if (isTemplateRef(component)) {
@@ -786,42 +394,6 @@ class DynamicComponentService {
786
394
  return td;
787
395
  };
788
396
  }
789
- /**
790
- * Creates a custom renderer function using rendererFactory from Handsontable.
791
- * This is an alternative implementation that uses the factory pattern.
792
- *
793
- * @param component - The Angular component type to use as renderer.
794
- * @param componentProps - An object containing additional properties to use by the renderer.
795
- * @param register - If true, registers the renderer with Handsontable using the component's name.
796
- * @returns A renderer function that can be used in Handsontable's configuration.
797
- */
798
- createRendererWithFactory(component, componentProps = {}, register = false) {
799
- return rendererFactory(({ instance, td, row, column, prop, value, cellProperties }) => {
800
- const properties = {
801
- value,
802
- instance,
803
- td,
804
- row,
805
- col: column,
806
- prop,
807
- cellProperties,
808
- };
809
- if (componentProps) {
810
- Object.assign(cellProperties, { rendererProps: componentProps });
811
- }
812
- td.innerHTML = '';
813
- if (isAdvancedHotCellRendererComponent(component)) {
814
- const componentRef = this.createComponent(component, properties);
815
- this.attachComponentToElement(componentRef, td);
816
- }
817
- else {
818
- console.warn(INVALID_ADVANCED_RENDERER_WARNING);
819
- }
820
- if (register && isAdvancedHotCellRendererComponent(component)) {
821
- registerRenderer(component.constructor.name, component);
822
- }
823
- });
824
- }
825
397
  /**
826
398
  * Attaches an embedded view created from a TemplateRef to a given DOM element.
827
399
  *
@@ -848,9 +420,9 @@ class DynamicComponentService {
848
420
  */
849
421
  createComponent(component, rendererParameters) {
850
422
  const componentRef = createComponent(component, {
851
- environmentInjector: this.environmentInjector,
423
+ environmentInjector: this.environmentInjector
852
424
  });
853
- Object.keys(rendererParameters).forEach((key) => {
425
+ Object.keys(rendererParameters).forEach(key => {
854
426
  if (rendererParameters.hasOwnProperty(key)) {
855
427
  componentRef.setInput(key, rendererParameters[key]);
856
428
  }
@@ -869,7 +441,8 @@ class DynamicComponentService {
869
441
  * @param container - The target DOM element to which the component's root node will be appended.
870
442
  */
871
443
  attachComponentToElement(componentRef, container) {
872
- const domElem = componentRef.hostView.rootNodes[0];
444
+ const domElem = componentRef.hostView
445
+ .rootNodes[0];
873
446
  container.appendChild(domElem);
874
447
  }
875
448
  /**
@@ -925,7 +498,7 @@ class HotSettingsResolver {
925
498
  */
926
499
  wrapHooksInNgZone(settings, ngZone) {
927
500
  const options = AVAILABLE_HOOKS.concat(AVAILABLE_OPTIONS);
928
- options.forEach((key) => {
501
+ options.forEach(key => {
929
502
  const isHook = AVAILABLE_HOOKS.indexOf(key) > -1;
930
503
  let option;
931
504
  if (isHook) {
@@ -934,7 +507,7 @@ class HotSettingsResolver {
934
507
  if (option === void 0) {
935
508
  return;
936
509
  }
937
- else if (!!ngZone && typeof option === 'function' && isHook) {
510
+ else if (!!ngZone && (typeof option === 'function' && isHook)) {
938
511
  settings[key] = function (...args) {
939
512
  return ngZone.run(() => option.apply(this, args));
940
513
  };
@@ -953,16 +526,13 @@ class HotSettingsResolver {
953
526
  return;
954
527
  }
955
528
  mergedSettings?.columns
956
- ?.filter((settings) => this.isCustomRenderer(settings.renderer))
529
+ ?.filter((settings) => this.isRendererComponentRefType(settings.renderer) || this.isTemplateRef(settings.renderer))
957
530
  ?.forEach((cellSettings) => {
958
- const renderer = cellSettings.renderer;
531
+ const renderer = this.isTemplateRef(cellSettings.renderer)
532
+ ? cellSettings.renderer
533
+ : cellSettings.renderer;
959
534
  const props = cellSettings.rendererProps ?? {};
960
- if (this.isAdvancedRendererComponentRefType(renderer)) {
961
- cellSettings.renderer = this.dynamicComponentService.createRendererWithFactory(renderer, props);
962
- }
963
- else if (this.isRendererComponentRefType(renderer) || this.isTemplateRef(renderer)) {
964
- cellSettings.renderer = this.dynamicComponentService.createRendererFromComponent(renderer, props);
965
- }
535
+ cellSettings.renderer = this.dynamicComponentService.createRendererFromComponent(renderer, props);
966
536
  });
967
537
  }
968
538
  /**
@@ -974,22 +544,14 @@ class HotSettingsResolver {
974
544
  return;
975
545
  }
976
546
  mergedSettings?.columns
977
- ?.filter((settings) => this.isEditorComponentRefType(settings.editor) || this.isAdvancedEditorComponentRefType(settings.editor))
547
+ ?.filter((settings) => this.isEditorComponentRefType(settings.editor))
978
548
  ?.forEach((cellSettings) => {
979
- if (this.isAdvancedEditorComponentRefType(cellSettings.editor)) {
980
- const component = createComponent(cellSettings.editor, {
981
- environmentInjector: this.environmentInjector,
982
- });
983
- cellSettings.editor = FactoryEditorAdapter(component);
984
- }
985
- else {
986
- const component = createComponent(cellSettings.editor, {
987
- environmentInjector: this.environmentInjector,
988
- });
989
- cellSettings['_editorComponentReference'] = component;
990
- cellSettings['_environmentInjector'] = this.environmentInjector;
991
- cellSettings.editor = BaseEditorAdapter;
992
- }
549
+ const customEditor = cellSettings.editor;
550
+ cellSettings['_editorComponentReference'] = createComponent(customEditor, {
551
+ environmentInjector: this.environmentInjector,
552
+ });
553
+ cellSettings['_environmentInjector'] = this.environmentInjector;
554
+ cellSettings.editor = BaseEditorAdapter;
993
555
  });
994
556
  }
995
557
  /**
@@ -1014,36 +576,15 @@ class HotSettingsResolver {
1014
576
  }
1015
577
  isEditorComponentRefType(editor) {
1016
578
  // ecmp - we need it to check if the editor is a component
1017
- return typeof editor === 'function' &&
1018
- !!editor?.ɵcmp &&
1019
- editor?.EDITOR_MARKER === HotCellEditorComponent.EDITOR_MARKER;
1020
- }
1021
- isAdvancedEditorComponentRefType(editor) {
1022
- // ecmp - we need it to check if the editor is a component
1023
- return typeof editor === 'function' &&
1024
- !!editor?.ɵcmp &&
1025
- editor?.EDITOR_MARKER === HotCellEditorAdvancedComponent.EDITOR_MARKER;
579
+ return typeof editor === 'function' && !!editor?.ɵcmp;
1026
580
  }
1027
581
  isRendererComponentRefType(renderer) {
1028
582
  // ecmp - we need it to check if the renderer is a component
1029
- return typeof renderer === 'function' &&
1030
- !!renderer?.ɵcmp &&
1031
- renderer?.RENDERER_MARKER === HotCellRendererComponent.RENDERER_MARKER;
1032
- }
1033
- isAdvancedRendererComponentRefType(renderer) {
1034
- // ecmp - we need it to check if the renderer is a component
1035
- return typeof renderer === 'function' &&
1036
- !!renderer?.ɵcmp &&
1037
- renderer?.RENDERER_MARKER === HotCellRendererAdvancedComponent.RENDERER_MARKER;
583
+ return typeof renderer === 'function' && !!renderer?.ɵcmp;
1038
584
  }
1039
585
  isTemplateRef(renderer) {
1040
586
  return renderer && typeof renderer.createEmbeddedView === 'function';
1041
587
  }
1042
- isCustomRenderer(renderer) {
1043
- return this.isRendererComponentRefType(renderer) ||
1044
- this.isTemplateRef(renderer) ||
1045
- this.isAdvancedRendererComponentRefType(renderer);
1046
- }
1047
588
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotSettingsResolver, deps: [{ token: DynamicComponentService }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
1048
589
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotSettingsResolver });
1049
590
  }
@@ -1160,7 +701,6 @@ class HotTableComponent {
1160
701
  _hotSettingsResolver;
1161
702
  _hotConfig;
1162
703
  ngZone;
1163
- environmentInjector;
1164
704
  // component inputs
1165
705
  /** The data for the Handsontable instance. */
1166
706
  data = null;
@@ -1171,11 +711,10 @@ class HotTableComponent {
1171
711
  /** The Handsontable instance. */
1172
712
  __hotInstance = null;
1173
713
  configSubscription;
1174
- constructor(_hotSettingsResolver, _hotConfig, ngZone, environmentInjector) {
714
+ constructor(_hotSettingsResolver, _hotConfig, ngZone) {
1175
715
  this._hotSettingsResolver = _hotSettingsResolver;
1176
716
  this._hotConfig = _hotConfig;
1177
717
  this.ngZone = ngZone;
1178
- this.environmentInjector = environmentInjector;
1179
718
  }
1180
719
  /**
1181
720
  * Gets the Handsontable instance.
@@ -1208,7 +747,6 @@ class HotTableComponent {
1208
747
  options = { ...options, ...negotiatedSettings, data: this.data };
1209
748
  this.ngZone.runOutsideAngular(() => {
1210
749
  this.hotInstance = new Handsontable.Core(this.container.nativeElement, options);
1211
- this.hotInstance._angularEnvironmentInjector = this.environmentInjector;
1212
750
  this.hotInstance.init();
1213
751
  });
1214
752
  this.configSubscription = this._hotConfig.config$.subscribe((config) => {
@@ -1291,13 +829,13 @@ class HotTableComponent {
1291
829
  }
1292
830
  return negotiatedSettings;
1293
831
  }
1294
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotTableComponent, deps: [{ token: HotSettingsResolver }, { token: HotGlobalConfigService }, { token: i0.NgZone }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Component });
832
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotTableComponent, deps: [{ token: HotSettingsResolver }, { token: HotGlobalConfigService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1295
833
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: HotTableComponent, selector: "hot-table", inputs: { data: "data", settings: "settings" }, providers: [HotSettingsResolver], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true }], usesOnChanges: true, ngImport: i0, template: '<div #container></div>', isInline: true, styles: [":host{display:block}\n"], encapsulation: i0.ViewEncapsulation.None });
1296
834
  }
1297
835
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotTableComponent, decorators: [{
1298
836
  type: Component,
1299
837
  args: [{ selector: 'hot-table', template: '<div #container></div>', encapsulation: ViewEncapsulation.None, providers: [HotSettingsResolver], styles: [":host{display:block}\n"] }]
1300
- }], ctorParameters: function () { return [{ type: HotSettingsResolver }, { type: HotGlobalConfigService }, { type: i0.NgZone }, { type: i0.EnvironmentInjector }]; }, propDecorators: { data: [{
838
+ }], ctorParameters: function () { return [{ type: HotSettingsResolver }, { type: HotGlobalConfigService }, { type: i0.NgZone }]; }, propDecorators: { data: [{
1301
839
  type: Input
1302
840
  }], settings: [{
1303
841
  type: Input
@@ -1311,7 +849,7 @@ class HotTableModule {
1311
849
  * Placeholder for the library version.
1312
850
  * Replaced automatically during the pre-build/post-build process.
1313
851
  */
1314
- static version = '0.0.0-next-c573c90-20260210';
852
+ static version = '0.0.0-next-a4c3bb2-20260211';
1315
853
  constructor() { }
1316
854
  static forRoot() {
1317
855
  return {
@@ -1331,6 +869,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1331
869
  }]
1332
870
  }], ctorParameters: function () { return []; } });
1333
871
 
872
+ /**
873
+ * Abstract class representing a Handsontable editor in angular.
874
+ */
875
+ class HotCellEditorComponent {
876
+ /** The tabindex attribute for the editor. */
877
+ tabindex = -1;
878
+ /** The data-hot-input attribute for the editor. */
879
+ dataHotInput = '';
880
+ /** The handsontableInput class for the editor. */
881
+ handsontableInputClass = true;
882
+ /** The height of the editor as a percentage of the parent container. */
883
+ heightFitParentContainer = 100;
884
+ /** The width of the editor as a percentage of the parent container. */
885
+ widthFitParentContainer = 100;
886
+ /** The row index of the cell being edited. */
887
+ row;
888
+ /** The column index of the cell being edited. */
889
+ column;
890
+ /** The property name of the cell being edited. */
891
+ prop;
892
+ /** The original value of the cell being edited. */
893
+ originalValue;
894
+ /** The cell properties of the cell being edited. */
895
+ cellProperties;
896
+ /** Event emitted when the edit is finished.
897
+ * The data will be saved to the model.
898
+ */
899
+ finishEdit = new EventEmitter();
900
+ /** Event emitted when the edit is canceled.
901
+ * The entered data will be reverted to the original value.
902
+ */
903
+ cancelEdit = new EventEmitter();
904
+ /** The current value of the editor. */
905
+ _value;
906
+ /** Event triggered by Handsontable on closing the editor.
907
+ * The user can define their own actions for
908
+ * the custom editor to be called after the base logic. */
909
+ onClose() { }
910
+ /** Event triggered by Handsontable on open the editor.
911
+ * The user can define their own actions for
912
+ * the custom editor to be called after the base logic. */
913
+ onOpen(event) { }
914
+ /**
915
+ * Gets the current value of the editor.
916
+ * @returns The current value of the editor.
917
+ */
918
+ getValue() {
919
+ return this._value;
920
+ }
921
+ /**
922
+ * Sets the current value of the editor.
923
+ * @param value The value to set.
924
+ */
925
+ setValue(value) {
926
+ this._value = value;
927
+ }
928
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
929
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: HotCellEditorComponent, inputs: { row: "row", column: "column", prop: "prop", originalValue: "originalValue", cellProperties: "cellProperties" }, outputs: { finishEdit: "finishEdit", cancelEdit: "cancelEdit" }, host: { properties: { "attr.tabindex": "this.tabindex", "attr.data-hot-input": "this.dataHotInput", "class.handsontableInput": "this.handsontableInputClass", "style.height.%": "this.heightFitParentContainer", "style.width.%": "this.widthFitParentContainer" } }, ngImport: i0 });
930
+ }
931
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HotCellEditorComponent, decorators: [{
932
+ type: Directive
933
+ }], propDecorators: { tabindex: [{
934
+ type: HostBinding,
935
+ args: ['attr.tabindex']
936
+ }], dataHotInput: [{
937
+ type: HostBinding,
938
+ args: ['attr.data-hot-input']
939
+ }], handsontableInputClass: [{
940
+ type: HostBinding,
941
+ args: ['class.handsontableInput']
942
+ }], heightFitParentContainer: [{
943
+ type: HostBinding,
944
+ args: ['style.height.%']
945
+ }], widthFitParentContainer: [{
946
+ type: HostBinding,
947
+ args: ['style.width.%']
948
+ }], row: [{
949
+ type: Input
950
+ }], column: [{
951
+ type: Input
952
+ }], prop: [{
953
+ type: Input
954
+ }], originalValue: [{
955
+ type: Input
956
+ }], cellProperties: [{
957
+ type: Input
958
+ }], finishEdit: [{
959
+ type: Output
960
+ }], cancelEdit: [{
961
+ type: Output
962
+ }] } });
963
+
1334
964
  /*
1335
965
  * Public API Surface of hot-table
1336
966
  */
@@ -1339,5 +969,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1339
969
  * Generated bundle index. Do not edit.
1340
970
  */
1341
971
 
1342
- export { DynamicComponentService, HOT_DESTROYED_WARNING, HOT_GLOBAL_CONFIG, HotCellEditorAdvancedComponent, HotCellEditorComponent, HotCellRendererAdvancedComponent, HotCellRendererComponent, HotGlobalConfigService, HotSettingsResolver, HotTableComponent, HotTableModule, INVALID_ADVANCED_RENDERER_WARNING, INVALID_RENDERER_WARNING, NON_COMMERCIAL_LICENSE, PredefinedTheme, isAdvancedHotCellRendererComponent, isHotCellRendererComponent, isTemplateRef };
972
+ export { DynamicComponentService, HOT_DESTROYED_WARNING, HOT_GLOBAL_CONFIG, HotCellEditorComponent, HotCellRendererComponent, HotGlobalConfigService, HotSettingsResolver, HotTableComponent, HotTableModule, INVALID_RENDERER_WARNING, NON_COMMERCIAL_LICENSE, PredefinedTheme, isHotCellRendererComponent, isTemplateRef };
1343
973
  //# sourceMappingURL=handsontable-angular-wrapper.mjs.map