@wizishop/angular-components 14.2.4 → 14.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3530,45 +3530,137 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
3530
3530
  type: Input
3531
3531
  }] } });
3532
3532
 
3533
+ class BlockSeparatorComponent {
3534
+ constructor() { }
3535
+ }
3536
+ BlockSeparatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: BlockSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3537
+ BlockSeparatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: BlockSeparatorComponent, selector: "wac-block-separator", ngImport: i0, template: ``, isInline: true, encapsulation: i0.ViewEncapsulation.None });
3538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: BlockSeparatorComponent, decorators: [{
3539
+ type: Component,
3540
+ args: [{
3541
+ selector: 'wac-block-separator',
3542
+ template: ``,
3543
+ encapsulation: ViewEncapsulation.None
3544
+ }]
3545
+ }], ctorParameters: function () { return []; } });
3546
+
3533
3547
  class BlockComponent {
3534
- constructor() {
3535
- this.titleBlock = ''; // Titre interne au block
3536
- this.titleExternalBlock = false; // Titre externe au block
3537
- this.sticky = false; // add sticky to block
3538
- this.simple = false;
3539
- this.noFullHeight = false; // not full height
3540
- this.icon = '';
3541
- this.titleUppercase = true;
3542
- this.borderRadius = false;
3543
- this.removePadding = false;
3544
- this.stretchHeight = false;
3548
+ constructor(renderer2, wacBlockElementRef) {
3549
+ this.renderer2 = renderer2;
3550
+ this.wacBlockElementRef = wacBlockElementRef;
3551
+ this.config = {
3552
+ borderRadius: '3px'
3553
+ };
3554
+ this.destroy$ = new Subject();
3555
+ }
3556
+ get borderRadius() {
3557
+ return `--wac-block-border-radius: ${this.config.borderRadius ? this.config.borderRadius : '3px'};`;
3558
+ }
3559
+ ngAfterViewInit() {
3560
+ const groupedNodesList = this.getSeparatedGroupedOfNodes(this.wacBlockElementRef.nativeElement.childNodes);
3561
+ this.attachSeparatedBlocksToTheDom(groupedNodesList, this.wacBlockElementRef.nativeElement);
3562
+ this.blockSeparators
3563
+ .changes.pipe(takeUntil$1(this.destroy$))
3564
+ .subscribe(() => {
3565
+ this.handleAddedSeparator();
3566
+ setTimeout(() => {
3567
+ this.handleRemovedSeparator();
3568
+ }, 0);
3569
+ });
3570
+ }
3571
+ handleRemovedSeparator() {
3572
+ const wacBlockComponentChildNodes = this.wacBlockElementRef.nativeElement.childNodes;
3573
+ for (let i = 0; i < wacBlockComponentChildNodes.length; i++) {
3574
+ const childNode = wacBlockComponentChildNodes[i];
3575
+ const nextChild = wacBlockComponentChildNodes[i + 1];
3576
+ const areWacBlockSideBySide = nextChild && childNode.classList.contains('wac-block') && nextChild.classList.contains('wac-block');
3577
+ if (!areWacBlockSideBySide) {
3578
+ continue;
3579
+ }
3580
+ const parentElement = this.wacBlockElementRef.nativeElement;
3581
+ this.fusionNextBlockWithCurrentBlock(parentElement, nextChild, childNode);
3582
+ i--; // we remove a child, so we need to go back to the previous index
3583
+ }
3584
+ }
3585
+ fusionNextBlockWithCurrentBlock(parentElement, nextChild, childNode) {
3586
+ parentElement.removeChild(nextChild); // not working with renderer2, it just freeze the app
3587
+ childNode.append(...nextChild.childNodes);
3588
+ }
3589
+ handleAddedSeparator() {
3590
+ const wacBlockComponentChildNodes = [...this.wacBlockElementRef.nativeElement.childNodes];
3591
+ for (let i = 0; i < wacBlockComponentChildNodes.length; i++) {
3592
+ const childNode = wacBlockComponentChildNodes[i];
3593
+ if (childNode.nodeName === 'WAC-BLOCK-SEPARATOR') {
3594
+ continue;
3595
+ }
3596
+ if (!this.hasBlockSeparator(childNode.childNodes)) {
3597
+ continue;
3598
+ }
3599
+ const groupedNodesList = this.getSeparatedGroupedOfNodes(childNode.childNodes);
3600
+ groupedNodesList.shift(); // remove first group, it's the current block
3601
+ this.attachSeparatedBlocksToTheDom(groupedNodesList, this.wacBlockElementRef.nativeElement, wacBlockComponentChildNodes[i + 1]);
3602
+ }
3603
+ }
3604
+ hasBlockSeparator(childNodes) {
3605
+ return [...childNodes].some(groupedNodes => groupedNodes?.nodeName === 'WAC-BLOCK-SEPARATOR');
3606
+ }
3607
+ attachSeparatedBlocksToTheDom(groupedNodesList, parentElement, nextElement) {
3608
+ for (let index = 0; index < groupedNodesList.length; index++) {
3609
+ const groupedNodes = groupedNodesList[index];
3610
+ if (groupedNodes[0]?.nodeName === 'WAC-BLOCK-SEPARATOR') {
3611
+ this.attachToTheDom(groupedNodes[0], parentElement, nextElement);
3612
+ continue;
3613
+ }
3614
+ const separatedWacBlock = document.createElement('div');
3615
+ separatedWacBlock.classList.add('wac-block');
3616
+ groupedNodes.forEach(node => {
3617
+ separatedWacBlock.appendChild(node);
3618
+ });
3619
+ this.attachToTheDom(separatedWacBlock, parentElement, nextElement);
3620
+ }
3621
+ }
3622
+ attachToTheDom(child, parentElement, nextElement) {
3623
+ if (nextElement) {
3624
+ this.renderer2.insertBefore(parentElement, child, nextElement, true);
3625
+ }
3626
+ else {
3627
+ this.renderer2.appendChild(parentElement, child);
3628
+ }
3629
+ }
3630
+ getSeparatedGroupedOfNodes(childNodes) {
3631
+ const groupedNodesList = [];
3632
+ let followingNodes = [];
3633
+ for (const node of childNodes) {
3634
+ if (node.nodeName === 'WAC-BLOCK-SEPARATOR') {
3635
+ groupedNodesList.push(followingNodes, [node]); // close a group and start a new one
3636
+ followingNodes = [];
3637
+ continue;
3638
+ }
3639
+ followingNodes.push(node);
3640
+ }
3641
+ if (followingNodes.length) {
3642
+ groupedNodesList.push(followingNodes);
3643
+ }
3644
+ return groupedNodesList;
3645
+ }
3646
+ ngOnDesTroy() {
3647
+ this.destroy$.next();
3648
+ this.destroy$.complete();
3545
3649
  }
3546
3650
  }
3547
- BlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: BlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3548
- BlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: BlockComponent, selector: "wac-block", inputs: { titleBlock: "titleBlock", titleExternalBlock: "titleExternalBlock", sticky: "sticky", simple: "simple", noFullHeight: "noFullHeight", icon: "icon", titleUppercase: "titleUppercase", borderRadius: "borderRadius", removePadding: "removePadding", stretchHeight: "stretchHeight" }, ngImport: i0, template: "<div\n class=\"wac-block\"\n [ngClass]=\"{ 'wac-block__external': titleExternalBlock, sticky: sticky, noFullHeight: noFullHeight, 'stretch': stretchHeight, 'border-radius': borderRadius, 'no-padding' : removePadding }\"\n>\n <h2 *ngIf=\"titleBlock.length\" class=\"wac-block__title\" [ngClass]=\"{ 'is-simple': simple, 'no-uppercase': !titleUppercase }\">\n {{ titleBlock }} <i *ngIf=\"icon\" [ngClass]=\"icon\"></i>\n </h2>\n <div class=\"wac-block__content\">\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3651
+ BlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: BlockComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3652
+ BlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: BlockComponent, selector: "wac-block", inputs: { config: "config" }, host: { properties: { "style": "this.borderRadius" } }, queries: [{ propertyName: "blockSeparators", predicate: BlockSeparatorComponent }], ngImport: i0, template: "<ng-content></ng-content>", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
3549
3653
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: BlockComponent, decorators: [{
3550
3654
  type: Component,
3551
- args: [{ selector: 'wac-block', template: "<div\n class=\"wac-block\"\n [ngClass]=\"{ 'wac-block__external': titleExternalBlock, sticky: sticky, noFullHeight: noFullHeight, 'stretch': stretchHeight, 'border-radius': borderRadius, 'no-padding' : removePadding }\"\n>\n <h2 *ngIf=\"titleBlock.length\" class=\"wac-block__title\" [ngClass]=\"{ 'is-simple': simple, 'no-uppercase': !titleUppercase }\">\n {{ titleBlock }} <i *ngIf=\"icon\" [ngClass]=\"icon\"></i>\n </h2>\n <div class=\"wac-block__content\">\n <ng-content></ng-content>\n </div>\n</div>\n" }]
3552
- }], ctorParameters: function () { return []; }, propDecorators: { titleBlock: [{
3553
- type: Input
3554
- }], titleExternalBlock: [{
3555
- type: Input
3556
- }], sticky: [{
3557
- type: Input
3558
- }], simple: [{
3559
- type: Input
3560
- }], noFullHeight: [{
3561
- type: Input
3562
- }], icon: [{
3563
- type: Input
3564
- }], titleUppercase: [{
3655
+ args: [{ selector: 'wac-block', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>" }]
3656
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { blockSeparators: [{
3657
+ type: ContentChildren,
3658
+ args: [BlockSeparatorComponent]
3659
+ }], config: [{
3565
3660
  type: Input
3566
3661
  }], borderRadius: [{
3567
- type: Input
3568
- }], removePadding: [{
3569
- type: Input
3570
- }], stretchHeight: [{
3571
- type: Input
3662
+ type: HostBinding,
3663
+ args: ['style']
3572
3664
  }] } });
3573
3665
 
3574
3666
  class WrapperComponent {
@@ -5327,6 +5419,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
5327
5419
  }]
5328
5420
  }] });
5329
5421
 
5422
+ class BlockTitleLegacyComponent {
5423
+ constructor() {
5424
+ this.simple = false;
5425
+ this.icon = '';
5426
+ }
5427
+ }
5428
+ BlockTitleLegacyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: BlockTitleLegacyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5429
+ BlockTitleLegacyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: BlockTitleLegacyComponent, selector: "wac-block-title-legacy", inputs: { simple: "simple", icon: "icon" }, ngImport: i0, template: "<h2 class=\"wac-block__title\" [ngClass]=\"{ 'is-simple': simple }\">\n <ng-content></ng-content> <i *ngIf=\"icon\" [ngClass]=\"icon\"></i>\n</h2>", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
5430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: BlockTitleLegacyComponent, decorators: [{
5431
+ type: Component,
5432
+ args: [{ selector: 'wac-block-title-legacy', encapsulation: ViewEncapsulation.None, template: "<h2 class=\"wac-block__title\" [ngClass]=\"{ 'is-simple': simple }\">\n <ng-content></ng-content> <i *ngIf=\"icon\" [ngClass]=\"icon\"></i>\n</h2>" }]
5433
+ }], ctorParameters: function () { return []; }, propDecorators: { simple: [{
5434
+ type: Input
5435
+ }], icon: [{
5436
+ type: Input
5437
+ }] } });
5438
+
5330
5439
  ;
5331
5440
  class SummaryComponent {
5332
5441
  constructor() {
@@ -5401,6 +5510,7 @@ const components = [
5401
5510
  PopinComponent,
5402
5511
  FreePopinComponent,
5403
5512
  BlockComponent,
5513
+ BlockTitleLegacyComponent,
5404
5514
  WrapperComponent,
5405
5515
  FiltersComponent,
5406
5516
  WrapperBlocsComponent,
@@ -5424,6 +5534,7 @@ const components = [
5424
5534
  ContentWithButtonsComponent,
5425
5535
  WrapperMultipleBlockComponent,
5426
5536
  DraganddropListComponent,
5537
+ BlockSeparatorComponent,
5427
5538
  SummaryComponent
5428
5539
  ];
5429
5540
  const exportsFromModule = [
@@ -5480,6 +5591,7 @@ SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0",
5480
5591
  PopinComponent,
5481
5592
  FreePopinComponent,
5482
5593
  BlockComponent,
5594
+ BlockTitleLegacyComponent,
5483
5595
  WrapperComponent,
5484
5596
  FiltersComponent,
5485
5597
  WrapperBlocsComponent,
@@ -5503,6 +5615,7 @@ SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0",
5503
5615
  ContentWithButtonsComponent,
5504
5616
  WrapperMultipleBlockComponent,
5505
5617
  DraganddropListComponent,
5618
+ BlockSeparatorComponent,
5506
5619
  SummaryComponent], imports: [CommonModule,
5507
5620
  FormsModule,
5508
5621
  NwbAllModule, i1$3.TranslateModule, ReactiveFormsModule,
@@ -5561,6 +5674,7 @@ SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0",
5561
5674
  PopinComponent,
5562
5675
  FreePopinComponent,
5563
5676
  BlockComponent,
5677
+ BlockTitleLegacyComponent,
5564
5678
  WrapperComponent,
5565
5679
  FiltersComponent,
5566
5680
  WrapperBlocsComponent,
@@ -5584,6 +5698,7 @@ SharedComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0",
5584
5698
  ContentWithButtonsComponent,
5585
5699
  WrapperMultipleBlockComponent,
5586
5700
  DraganddropListComponent,
5701
+ BlockSeparatorComponent,
5587
5702
  SummaryComponent, PaginationComponent,
5588
5703
  TableComponent,
5589
5704
  TableColumn,
@@ -5703,5 +5818,5 @@ class TableFiltersGroup extends NwbFilterGroup {
5703
5818
  * Generated bundle index. Do not edit.
5704
5819
  */
5705
5820
 
5706
- export { ACCORDION_ITEM, AbstractDebounceDirective, AccordionComponent, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, BlockWithCheckboxComponent, BreadcrumbsComponent, ButtonComponent, CalendarComponent, CardPriceComponent, CheckBoxRow, CheckboxComponent, ConfirmDeleteComponent, ContentWithButtonsComponent, DebounceKeyupDirective, DeleteComponent, DraganddropListComponent, DropdownComponent, EXPANSION_PANEL_HEADER, ExpansionExport, ExpansionModule, ExpansionPanelBase, ExpansionPanelComponent, ExpansionPanelDirective, ExpansionPanelHeaderComponent, ExpansionPanelHeaderDirective, FilterOptionsPipe, FiltersComponent, FiltersTableService, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, KeypressEnterDirective, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MosaicComponent, MultipleSearchComponent, MultipleSearchPlusComponent, OptionCallToActionComponent, OptionComponent, OptionalDisableContainerComponent, PaginationComponent, PlaceholderComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectFiltersPipe, SelectInTextComponent, SelectOptionDirective, SelectSearchTriggerComponent, SelectTestComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SummaryComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TagLabelComponent, TextAreaComponent, TextComponent, TokenCheckComponent, TooltipComponent, TreeComponent, TreeModule, UploadComponent, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WrapperMultipleBlockComponent, WrapperSidebarComponent, WzEditInPlaceComponent, ZindexToggleDirective };
5821
+ export { ACCORDION_ITEM, AbstractDebounceDirective, AccordionComponent, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, BlockSeparatorComponent, BlockTitleLegacyComponent, BlockWithCheckboxComponent, BreadcrumbsComponent, ButtonComponent, CalendarComponent, CardPriceComponent, CheckBoxRow, CheckboxComponent, ConfirmDeleteComponent, ContentWithButtonsComponent, DebounceKeyupDirective, DeleteComponent, DraganddropListComponent, DropdownComponent, EXPANSION_PANEL_HEADER, ExpansionExport, ExpansionModule, ExpansionPanelBase, ExpansionPanelComponent, ExpansionPanelDirective, ExpansionPanelHeaderComponent, ExpansionPanelHeaderDirective, FilterOptionsPipe, FiltersComponent, FiltersTableService, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, KeypressEnterDirective, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MosaicComponent, MultipleSearchComponent, MultipleSearchPlusComponent, OptionCallToActionComponent, OptionComponent, OptionalDisableContainerComponent, PaginationComponent, PlaceholderComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectFiltersPipe, SelectInTextComponent, SelectOptionDirective, SelectSearchTriggerComponent, SelectTestComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SummaryComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TagLabelComponent, TextAreaComponent, TextComponent, TokenCheckComponent, TooltipComponent, TreeComponent, TreeModule, UploadComponent, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WrapperMultipleBlockComponent, WrapperSidebarComponent, WzEditInPlaceComponent, ZindexToggleDirective };
5707
5822
  //# sourceMappingURL=wizishop-angular-components.mjs.map