@ng-nest/ui 13.0.4 → 13.0.8

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 (167) hide show
  1. package/alert/alert.component.d.ts +2 -1
  2. package/core/config/config.d.ts +7 -1
  3. package/core/interfaces/layout.type.d.ts +1 -1
  4. package/dialog/{dialog-container.component.d.ts → dialog-portal.component.d.ts} +3 -3
  5. package/dialog/{dialog-container.directives.d.ts → dialog-portal.directives.d.ts} +0 -0
  6. package/dialog/dialog-ref.d.ts +3 -3
  7. package/dialog/dialog.module.d.ts +3 -3
  8. package/dialog/dialog.property.d.ts +3 -3
  9. package/dialog/public-api.d.ts +2 -2
  10. package/drawer/drawer-container.component.d.ts +3 -13
  11. package/drawer/drawer-portal.component.d.ts +18 -0
  12. package/drawer/{drawer-container.directives.d.ts → drawer-portal.directives.d.ts} +0 -0
  13. package/drawer/drawer-ref.d.ts +3 -3
  14. package/drawer/drawer.component.d.ts +10 -3
  15. package/drawer/drawer.module.d.ts +9 -8
  16. package/drawer/drawer.property.d.ts +16 -2
  17. package/drawer/examples/en_US/default/container/README.md +6 -0
  18. package/drawer/examples/zh_CN/default/container/README.md +6 -0
  19. package/drawer/public-api.d.ts +3 -2
  20. package/esm2020/alert/alert.component.mjs +9 -4
  21. package/esm2020/auto-complete/auto-complete.module.mjs +2 -3
  22. package/esm2020/cascade/cascade.module.mjs +2 -3
  23. package/esm2020/color-picker/color-picker.module.mjs +2 -3
  24. package/esm2020/core/config/config.mjs +1 -1
  25. package/esm2020/core/interfaces/layout.type.mjs +1 -1
  26. package/esm2020/date-picker/date-picker.module.mjs +2 -3
  27. package/esm2020/dialog/dialog-portal.component.mjs +52 -0
  28. package/esm2020/dialog/{dialog-container.directives.mjs → dialog-portal.directives.mjs} +7 -7
  29. package/esm2020/dialog/dialog-ref.mjs +1 -1
  30. package/esm2020/dialog/dialog.component.mjs +5 -5
  31. package/esm2020/dialog/dialog.module.mjs +7 -7
  32. package/esm2020/dialog/dialog.property.mjs +2 -2
  33. package/esm2020/dialog/dialog.service.mjs +3 -3
  34. package/esm2020/dialog/public-api.mjs +3 -3
  35. package/esm2020/drawer/drawer-container.component.mjs +16 -39
  36. package/esm2020/drawer/drawer-portal.component.mjs +52 -0
  37. package/esm2020/drawer/{drawer-container.directives.mjs → drawer-portal.directives.mjs} +5 -5
  38. package/esm2020/drawer/drawer-ref.mjs +1 -1
  39. package/esm2020/drawer/drawer.component.mjs +54 -18
  40. package/esm2020/drawer/drawer.module.mjs +23 -6
  41. package/esm2020/drawer/drawer.property.mjs +19 -1
  42. package/esm2020/drawer/drawer.service.mjs +4 -4
  43. package/esm2020/drawer/public-api.mjs +4 -3
  44. package/esm2020/dropdown/dropdown.module.mjs +2 -3
  45. package/esm2020/find/find.component.mjs +13 -4
  46. package/esm2020/find/find.property.mjs +18 -2
  47. package/esm2020/menu/menu.component.mjs +3 -3
  48. package/esm2020/menu/menu.property.mjs +7 -2
  49. package/esm2020/message/message-ref.mjs +12 -0
  50. package/esm2020/message/message.component.mjs +3 -3
  51. package/esm2020/message/message.property.mjs +1 -1
  52. package/esm2020/message/message.service.mjs +34 -13
  53. package/esm2020/message/public-api.mjs +2 -1
  54. package/esm2020/popconfirm/popconfirm.component.mjs +26 -5
  55. package/esm2020/popconfirm/popconfirm.property.mjs +10 -3
  56. package/esm2020/popover/popover.directive.mjs +8 -2
  57. package/esm2020/popover/popover.module.mjs +2 -3
  58. package/esm2020/popover/popover.property.mjs +7 -2
  59. package/esm2020/select/select.module.mjs +2 -3
  60. package/esm2020/table/table-body.component.mjs +4 -4
  61. package/esm2020/table/table.component.mjs +3 -3
  62. package/esm2020/table/table.property.mjs +7 -3
  63. package/esm2020/time-picker/time-picker.module.mjs +2 -3
  64. package/esm2020/tooltip/tooltip.directive.mjs +12 -4
  65. package/esm2020/tooltip/tooltip.module.mjs +2 -3
  66. package/esm2020/tooltip/tooltip.property.mjs +18 -2
  67. package/esm2020/tree/tree-node.component.mjs +3 -3
  68. package/esm2020/tree/tree.property.mjs +8 -2
  69. package/fesm2015/ng-nest-ui-alert.mjs +8 -3
  70. package/fesm2015/ng-nest-ui-alert.mjs.map +1 -1
  71. package/fesm2015/ng-nest-ui-auto-complete.mjs +1 -2
  72. package/fesm2015/ng-nest-ui-auto-complete.mjs.map +1 -1
  73. package/fesm2015/ng-nest-ui-cascade.mjs +1 -2
  74. package/fesm2015/ng-nest-ui-cascade.mjs.map +1 -1
  75. package/fesm2015/ng-nest-ui-color-picker.mjs +1 -2
  76. package/fesm2015/ng-nest-ui-color-picker.mjs.map +1 -1
  77. package/fesm2015/ng-nest-ui-core.mjs.map +1 -1
  78. package/fesm2015/ng-nest-ui-date-picker.mjs +1 -2
  79. package/fesm2015/ng-nest-ui-date-picker.mjs.map +1 -1
  80. package/fesm2015/ng-nest-ui-dialog.mjs +22 -22
  81. package/fesm2015/ng-nest-ui-dialog.mjs.map +1 -1
  82. package/fesm2015/ng-nest-ui-drawer.mjs +129 -32
  83. package/fesm2015/ng-nest-ui-drawer.mjs.map +1 -1
  84. package/fesm2015/ng-nest-ui-dropdown.mjs +1 -2
  85. package/fesm2015/ng-nest-ui-dropdown.mjs.map +1 -1
  86. package/fesm2015/ng-nest-ui-find.mjs +29 -4
  87. package/fesm2015/ng-nest-ui-find.mjs.map +1 -1
  88. package/fesm2015/ng-nest-ui-menu.mjs +8 -3
  89. package/fesm2015/ng-nest-ui-menu.mjs.map +1 -1
  90. package/fesm2015/ng-nest-ui-message.mjs +48 -15
  91. package/fesm2015/ng-nest-ui-message.mjs.map +1 -1
  92. package/fesm2015/ng-nest-ui-popconfirm.mjs +34 -6
  93. package/fesm2015/ng-nest-ui-popconfirm.mjs.map +1 -1
  94. package/fesm2015/ng-nest-ui-popover.mjs +14 -4
  95. package/fesm2015/ng-nest-ui-popover.mjs.map +1 -1
  96. package/fesm2015/ng-nest-ui-select.mjs +1 -2
  97. package/fesm2015/ng-nest-ui-select.mjs.map +1 -1
  98. package/fesm2015/ng-nest-ui-table.mjs +11 -7
  99. package/fesm2015/ng-nest-ui-table.mjs.map +1 -1
  100. package/fesm2015/ng-nest-ui-time-picker.mjs +1 -2
  101. package/fesm2015/ng-nest-ui-time-picker.mjs.map +1 -1
  102. package/fesm2015/ng-nest-ui-tooltip.mjs +29 -6
  103. package/fesm2015/ng-nest-ui-tooltip.mjs.map +1 -1
  104. package/fesm2015/ng-nest-ui-tree.mjs +9 -3
  105. package/fesm2015/ng-nest-ui-tree.mjs.map +1 -1
  106. package/fesm2020/ng-nest-ui-alert.mjs +8 -3
  107. package/fesm2020/ng-nest-ui-alert.mjs.map +1 -1
  108. package/fesm2020/ng-nest-ui-auto-complete.mjs +1 -2
  109. package/fesm2020/ng-nest-ui-auto-complete.mjs.map +1 -1
  110. package/fesm2020/ng-nest-ui-cascade.mjs +1 -2
  111. package/fesm2020/ng-nest-ui-cascade.mjs.map +1 -1
  112. package/fesm2020/ng-nest-ui-color-picker.mjs +1 -2
  113. package/fesm2020/ng-nest-ui-color-picker.mjs.map +1 -1
  114. package/fesm2020/ng-nest-ui-core.mjs.map +1 -1
  115. package/fesm2020/ng-nest-ui-date-picker.mjs +1 -2
  116. package/fesm2020/ng-nest-ui-date-picker.mjs.map +1 -1
  117. package/fesm2020/ng-nest-ui-dialog.mjs +22 -22
  118. package/fesm2020/ng-nest-ui-dialog.mjs.map +1 -1
  119. package/fesm2020/ng-nest-ui-drawer.mjs +127 -32
  120. package/fesm2020/ng-nest-ui-drawer.mjs.map +1 -1
  121. package/fesm2020/ng-nest-ui-dropdown.mjs +1 -2
  122. package/fesm2020/ng-nest-ui-dropdown.mjs.map +1 -1
  123. package/fesm2020/ng-nest-ui-find.mjs +29 -4
  124. package/fesm2020/ng-nest-ui-find.mjs.map +1 -1
  125. package/fesm2020/ng-nest-ui-menu.mjs +8 -3
  126. package/fesm2020/ng-nest-ui-menu.mjs.map +1 -1
  127. package/fesm2020/ng-nest-ui-message.mjs +47 -15
  128. package/fesm2020/ng-nest-ui-message.mjs.map +1 -1
  129. package/fesm2020/ng-nest-ui-popconfirm.mjs +34 -6
  130. package/fesm2020/ng-nest-ui-popconfirm.mjs.map +1 -1
  131. package/fesm2020/ng-nest-ui-popover.mjs +14 -4
  132. package/fesm2020/ng-nest-ui-popover.mjs.map +1 -1
  133. package/fesm2020/ng-nest-ui-select.mjs +1 -2
  134. package/fesm2020/ng-nest-ui-select.mjs.map +1 -1
  135. package/fesm2020/ng-nest-ui-table.mjs +11 -7
  136. package/fesm2020/ng-nest-ui-table.mjs.map +1 -1
  137. package/fesm2020/ng-nest-ui-time-picker.mjs +1 -2
  138. package/fesm2020/ng-nest-ui-time-picker.mjs.map +1 -1
  139. package/fesm2020/ng-nest-ui-tooltip.mjs +29 -6
  140. package/fesm2020/ng-nest-ui-tooltip.mjs.map +1 -1
  141. package/fesm2020/ng-nest-ui-tree.mjs +9 -3
  142. package/fesm2020/ng-nest-ui-tree.mjs.map +1 -1
  143. package/find/find.property.d.ts +31 -1
  144. package/menu/menu.property.d.ts +8 -3
  145. package/message/examples/en_US/default/loading/README.md +6 -0
  146. package/message/examples/zh_CN/default/loading/README.md +6 -0
  147. package/message/message-ref.d.ts +8 -0
  148. package/message/message.component.d.ts +3 -3
  149. package/message/message.property.d.ts +23 -3
  150. package/message/message.service.d.ts +4 -1
  151. package/message/public-api.d.ts +1 -0
  152. package/package.json +7 -7
  153. package/popconfirm/examples/en_US/default/async-close/README.md +6 -0
  154. package/popconfirm/examples/en_US/default/condition/README.md +6 -0
  155. package/popconfirm/examples/zh_CN/default/async-close/README.md +6 -0
  156. package/popconfirm/examples/zh_CN/default/condition/README.md +6 -0
  157. package/popconfirm/popconfirm.component.d.ts +6 -2
  158. package/popconfirm/popconfirm.property.d.ts +13 -2
  159. package/popover/popover.property.d.ts +6 -1
  160. package/steps/examples/zh_CN/default/node-status/README.md +1 -1
  161. package/table/examples/en_US/default/rowclass/README.md +6 -0
  162. package/table/examples/zh_CN/default/rowclass/README.md +6 -0
  163. package/table/table.property.d.ts +23 -2
  164. package/tooltip/tooltip.directive.d.ts +1 -0
  165. package/tooltip/tooltip.property.d.ts +11 -1
  166. package/tree/tree.property.d.ts +6 -1
  167. package/esm2020/dialog/dialog-container.component.mjs +0 -52
@@ -61,13 +61,16 @@ class XMenuProperty extends XProperty {
61
61
  }
62
62
  }
63
63
  /** @nocollapse */ /** @nocollapse */ XMenuProperty.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XMenuProperty, deps: null, target: i0.ɵɵFactoryTarget.Component });
64
- /** @nocollapse */ /** @nocollapse */ XMenuProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XMenuProperty, selector: "ng-component", inputs: { data: "data", layout: "layout", size: "size", collapsed: "collapsed", trigger: "trigger", nodeTpl: "nodeTpl", expandedAll: "expandedAll", expandedLevel: "expandedLevel", activatedId: "activatedId", target: "target", portalMinWidth: "portalMinWidth" }, outputs: { nodeClick: "nodeClick", activatedIdChange: "activatedIdChange" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
64
+ /** @nocollapse */ /** @nocollapse */ XMenuProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XMenuProperty, selector: "ng-component", inputs: { data: "data", layout: "layout", size: "size", width: "width", collapsed: "collapsed", trigger: "trigger", nodeTpl: "nodeTpl", expandedAll: "expandedAll", expandedLevel: "expandedLevel", activatedId: "activatedId", target: "target", portalMinWidth: "portalMinWidth" }, outputs: { nodeClick: "nodeClick", activatedIdChange: "activatedIdChange" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
65
65
  __decorate([
66
66
  XDataConvert()
67
67
  ], XMenuProperty.prototype, "data", void 0);
68
68
  __decorate([
69
69
  XWithConfig(X_CONFIG_NAME, 'medium')
70
70
  ], XMenuProperty.prototype, "size", void 0);
71
+ __decorate([
72
+ XWithConfig(X_CONFIG_NAME, '12rem')
73
+ ], XMenuProperty.prototype, "width", void 0);
71
74
  __decorate([
72
75
  XInputBoolean()
73
76
  ], XMenuProperty.prototype, "collapsed", void 0);
@@ -89,6 +92,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
89
92
  type: Input
90
93
  }], size: [{
91
94
  type: Input
95
+ }], width: [{
96
+ type: Input
92
97
  }], collapsed: [{
93
98
  type: Input
94
99
  }], trigger: [{
@@ -335,10 +340,10 @@ class XMenuComponent extends XMenuProperty {
335
340
  }
336
341
  }
337
342
  /** @nocollapse */ /** @nocollapse */ XMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XMenuComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: i1.XConfigService }], target: i0.ɵɵFactoryTarget.Component });
338
- /** @nocollapse */ /** @nocollapse */ XMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XMenuComponent, selector: "x-menu", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div #menu class=\"x-menu\" [ngClass]=\"classMap\">\r\n <div class=\"x-menu-nodes\" *ngIf=\"layout === 'column'\">\r\n <ng-container *ngFor=\"let node of nodes; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: node, $children: true }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <x-slider\r\n *ngIf=\"layout === 'row'\"\r\n [data]=\"nodes\"\r\n [size]=\"size\"\r\n [nodeTpl]=\"nodeRowTpl\"\r\n [nodeJustify]=\"'center'\"\r\n [activatedIndex]=\"rootIndex\"\r\n (indexChange)=\"rootIndexChange($event)\"\r\n ></x-slider>\r\n</div>\r\n\r\n<ng-template #nodeTpl let-node=\"$node\">\r\n <x-dropdown\r\n *ngIf=\"node.level === 0 && collapsed\"\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n placement=\"right-start\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <x-menu-node [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n </x-dropdown>\r\n <x-menu-node *ngIf=\"!collapsed\" [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n</ng-template>\r\n\r\n<ng-template #nodeRowTpl let-node=\"$node\">\r\n <x-dropdown\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <div class=\"x-menu-node\" [ngClass]=\"nodeClassMap\">\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n </x-dropdown>\r\n</ng-template>\r\n\r\n<ng-template #nodeColumnTpl let-node=\"$node\">\r\n <div\r\n class=\"x-menu-node\"\r\n [class.x-activated]=\"activated?.id === node.id\"\r\n [class.x-menu-category]=\"node.categoryNode\"\r\n [ngClass]=\"nodeClassMap\"\r\n (click)=\"onToggle($event, node)\"\r\n [style.padding-left.rem]=\"(node.level + 1) * 0.875\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n <div class=\"x-menu-nodes\" *ngIf=\"node.childrenLoaded || (node.leaf && node.open)\" [hidden]=\"!node.open\">\r\n <ng-container *ngFor=\"let child of node.children; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: child }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n", styles: ["x-menu{display:block}.x-menu{margin:0;padding:0}.x-menu-icon.x-icon{font-size:1rem;transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon{transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon.is-open{transform:rotate(180deg)}.x-menu-node.x-size-big{padding:0 calc(var(--x-padding-big) + .25rem);height:calc(var(--x-height-big) + .75rem);line-height:calc(var(--x-height-big) + .75rem)}.x-menu-node.x-size-big.x-menu-category{height:calc(calc(var(--x-height-big) + .75rem) * 1.5)}.x-menu-node.x-size-large{padding:0 calc(var(--x-padding-large) + .25rem);height:calc(var(--x-height-large) + .75rem);line-height:calc(var(--x-height-large) + .75rem)}.x-menu-node.x-size-large.x-menu-category{height:calc(calc(var(--x-height-large) + .75rem) * 1.5)}.x-menu-node.x-size-medium{padding:0 calc(var(--x-padding-medium) + .25rem);height:calc(var(--x-height-medium) + .75rem);line-height:calc(var(--x-height-medium) + .75rem)}.x-menu-node.x-size-medium.x-menu-category{height:calc(calc(var(--x-height-medium) + .75rem) * 1.5)}.x-menu-node.x-size-small{padding:0 var(--x-padding-small);height:calc(var(--x-height-small) + .5rem);line-height:calc(var(--x-height-small) + .5rem)}.x-menu-node.x-size-small.x-menu-category{height:calc(calc(var(--x-height-small) + .5rem) * 1.5)}.x-menu-node.x-size-mini{padding:0 var(--x-padding-mini);height:calc(var(--x-height-mini) + .5rem);line-height:calc(var(--x-height-mini) + .5rem)}.x-menu-node.x-size-mini.x-menu-category{height:calc(calc(var(--x-height-mini) + .5rem) * 1.5)}.x-menu x-slider .x-slider-scroll>ul>li.x-slider-highlight{background-color:inherit;border-radius:0;border:none;border-bottom:.125rem solid var(--x-primary)}.x-menu x-slider .x-slider-scroll>ul>li>x-link{padding:0!important;height:inherit!important;line-height:inherit!important}.x-menu-column{width:12rem;transition:var(--x-animation-duration-base)}.x-menu-row .x-menu-text{margin-left:.25rem}.x-menu-nodes .x-menu-node{cursor:pointer;display:flex;align-items:center;justify-content:space-between;transition:width var(--x-animation-duration-base),background-color var(--x-animation-duration-base);border-right:.125rem solid var(--x-border);position:relative;-webkit-user-select:none;user-select:none;padding-right:.875rem}.x-menu-nodes .x-menu-node .x-menu-text{flex:1;margin:0 .25rem;transition:background-color var(--x-animation-duration-base),opacity var(--x-animation-duration-base);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.x-menu-nodes .x-menu-node:hover{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node x-menu-node{flex:1;display:flex;align-items:center;justify-content:space-between;overflow:hidden}.x-menu-nodes .x-menu-node x-menu-node>a{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:none}.x-menu-nodes .x-menu-node.x-activated{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node.x-activated:after{content:\"\";position:absolute;height:100%;right:-.125rem;top:0;border-right:.125rem solid var(--x-primary)}.x-menu-nodes .x-menu-node.x-menu-category{cursor:inherit;color:var(--x-text-400)}.x-menu-nodes .x-menu-node.x-menu-category:hover{background-color:transparent}.x-menu-nodes .x-menu-node.x-menu-category>x-menu-node{border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border-300)}.x-menu-collapsed.x-menu-column{width:3rem}.x-menu-collapsed .x-menu-nodes x-dropdown,.x-menu-collapsed .x-menu-nodes .x-dropdown{display:flex;flex:1}.x-menu-collapsed .x-menu-nodes .x-menu-node{padding-left:0!important;padding-right:0}.x-menu-collapsed .x-menu-nodes .x-menu-node x-menu-node{padding-left:.875rem}.x-menu-collapsed .x-menu-nodes .x-menu-node .x-menu-text{opacity:0;width:0}.x-menu-collapsed .x-menu-nodes .x-menu-nodes{display:none}.x-menu-collapsed .x-menu-arrow.x-icon{opacity:0;width:0}\n"], components: [{ type: i2$1.XSliderComponent, selector: "x-slider" }, { type: i3.XDropdownComponent, selector: "x-dropdown" }, { type: XMenuNodeComponent, selector: "x-menu-node", inputs: ["menu"] }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
343
+ /** @nocollapse */ /** @nocollapse */ XMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XMenuComponent, selector: "x-menu", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div #menu class=\"x-menu\" [ngClass]=\"classMap\" [style.width]=\"layout === 'column' ? width : ''\">\r\n <div class=\"x-menu-nodes\" *ngIf=\"layout === 'column'\">\r\n <ng-container *ngFor=\"let node of nodes; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: node, $children: true }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <x-slider\r\n *ngIf=\"layout === 'row'\"\r\n [data]=\"nodes\"\r\n [size]=\"size\"\r\n [nodeTpl]=\"nodeRowTpl\"\r\n [nodeJustify]=\"'center'\"\r\n [activatedIndex]=\"rootIndex\"\r\n (indexChange)=\"rootIndexChange($event)\"\r\n ></x-slider>\r\n</div>\r\n\r\n<ng-template #nodeTpl let-node=\"$node\">\r\n <x-dropdown\r\n *ngIf=\"node.level === 0 && collapsed\"\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n placement=\"right-start\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <x-menu-node [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n </x-dropdown>\r\n <x-menu-node *ngIf=\"!collapsed\" [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n</ng-template>\r\n\r\n<ng-template #nodeRowTpl let-node=\"$node\">\r\n <x-dropdown\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <div class=\"x-menu-node\" [ngClass]=\"nodeClassMap\">\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n </x-dropdown>\r\n</ng-template>\r\n\r\n<ng-template #nodeColumnTpl let-node=\"$node\">\r\n <div\r\n class=\"x-menu-node\"\r\n [class.x-activated]=\"activated?.id === node.id\"\r\n [class.x-menu-category]=\"node.categoryNode\"\r\n [ngClass]=\"nodeClassMap\"\r\n (click)=\"onToggle($event, node)\"\r\n [style.padding-left.rem]=\"(node.level + 1) * 0.875\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n <div class=\"x-menu-nodes\" *ngIf=\"node.childrenLoaded || (node.leaf && node.open)\" [hidden]=\"!node.open\">\r\n <ng-container *ngFor=\"let child of node.children; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: child }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n", styles: ["x-menu{display:block}.x-menu{margin:0;padding:0}.x-menu-icon.x-icon{font-size:1rem;transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon{transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon.is-open{transform:rotate(180deg)}.x-menu-node.x-size-big{padding:0 calc(var(--x-padding-big) + .25rem);height:calc(var(--x-height-big) + .75rem);line-height:calc(var(--x-height-big) + .75rem)}.x-menu-node.x-size-big.x-menu-category{height:calc(calc(var(--x-height-big) + .75rem) * 1.5)}.x-menu-node.x-size-large{padding:0 calc(var(--x-padding-large) + .25rem);height:calc(var(--x-height-large) + .75rem);line-height:calc(var(--x-height-large) + .75rem)}.x-menu-node.x-size-large.x-menu-category{height:calc(calc(var(--x-height-large) + .75rem) * 1.5)}.x-menu-node.x-size-medium{padding:0 calc(var(--x-padding-medium) + .25rem);height:calc(var(--x-height-medium) + .75rem);line-height:calc(var(--x-height-medium) + .75rem)}.x-menu-node.x-size-medium.x-menu-category{height:calc(calc(var(--x-height-medium) + .75rem) * 1.5)}.x-menu-node.x-size-small{padding:0 var(--x-padding-small);height:calc(var(--x-height-small) + .5rem);line-height:calc(var(--x-height-small) + .5rem)}.x-menu-node.x-size-small.x-menu-category{height:calc(calc(var(--x-height-small) + .5rem) * 1.5)}.x-menu-node.x-size-mini{padding:0 var(--x-padding-mini);height:calc(var(--x-height-mini) + .5rem);line-height:calc(var(--x-height-mini) + .5rem)}.x-menu-node.x-size-mini.x-menu-category{height:calc(calc(var(--x-height-mini) + .5rem) * 1.5)}.x-menu x-slider .x-slider-scroll>ul>li.x-slider-highlight{background-color:inherit;border-radius:0;border:none;border-bottom:.125rem solid var(--x-primary)}.x-menu x-slider .x-slider-scroll>ul>li>x-link{padding:0!important;height:inherit!important;line-height:inherit!important}.x-menu-column{width:16rem;transition:var(--x-animation-duration-base)}.x-menu-row .x-menu-text{margin-left:.25rem}.x-menu-nodes .x-menu-node{cursor:pointer;display:flex;align-items:center;justify-content:space-between;transition:width var(--x-animation-duration-base),background-color var(--x-animation-duration-base);border-right:.125rem solid var(--x-border);position:relative;-webkit-user-select:none;user-select:none;padding-right:.875rem}.x-menu-nodes .x-menu-node .x-menu-text{flex:1;margin:0 .25rem;transition:background-color var(--x-animation-duration-base),opacity var(--x-animation-duration-base);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.x-menu-nodes .x-menu-node:hover{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node x-menu-node{flex:1;display:flex;align-items:center;justify-content:space-between;overflow:hidden}.x-menu-nodes .x-menu-node x-menu-node>a{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:none}.x-menu-nodes .x-menu-node.x-activated{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node.x-activated:after{content:\"\";position:absolute;height:100%;right:-.125rem;top:0;border-right:.125rem solid var(--x-primary)}.x-menu-nodes .x-menu-node.x-menu-category{cursor:inherit;color:var(--x-text-400)}.x-menu-nodes .x-menu-node.x-menu-category:hover{background-color:transparent}.x-menu-nodes .x-menu-node.x-menu-category>x-menu-node{border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border-300)}.x-menu-collapsed.x-menu-column{width:3rem}.x-menu-collapsed .x-menu-nodes x-dropdown,.x-menu-collapsed .x-menu-nodes .x-dropdown{display:flex;flex:1}.x-menu-collapsed .x-menu-nodes .x-menu-node{padding-left:0!important;padding-right:0}.x-menu-collapsed .x-menu-nodes .x-menu-node x-menu-node{padding-left:.875rem}.x-menu-collapsed .x-menu-nodes .x-menu-node .x-menu-text{opacity:0;width:0}.x-menu-collapsed .x-menu-nodes .x-menu-nodes{display:none}.x-menu-collapsed .x-menu-arrow.x-icon{opacity:0;width:0}\n"], components: [{ type: i2$1.XSliderComponent, selector: "x-slider" }, { type: i3.XDropdownComponent, selector: "x-dropdown" }, { type: XMenuNodeComponent, selector: "x-menu-node", inputs: ["menu"] }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
339
344
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XMenuComponent, decorators: [{
340
345
  type: Component,
341
- args: [{ selector: `${XMenuPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #menu class=\"x-menu\" [ngClass]=\"classMap\">\r\n <div class=\"x-menu-nodes\" *ngIf=\"layout === 'column'\">\r\n <ng-container *ngFor=\"let node of nodes; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: node, $children: true }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <x-slider\r\n *ngIf=\"layout === 'row'\"\r\n [data]=\"nodes\"\r\n [size]=\"size\"\r\n [nodeTpl]=\"nodeRowTpl\"\r\n [nodeJustify]=\"'center'\"\r\n [activatedIndex]=\"rootIndex\"\r\n (indexChange)=\"rootIndexChange($event)\"\r\n ></x-slider>\r\n</div>\r\n\r\n<ng-template #nodeTpl let-node=\"$node\">\r\n <x-dropdown\r\n *ngIf=\"node.level === 0 && collapsed\"\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n placement=\"right-start\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <x-menu-node [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n </x-dropdown>\r\n <x-menu-node *ngIf=\"!collapsed\" [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n</ng-template>\r\n\r\n<ng-template #nodeRowTpl let-node=\"$node\">\r\n <x-dropdown\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <div class=\"x-menu-node\" [ngClass]=\"nodeClassMap\">\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n </x-dropdown>\r\n</ng-template>\r\n\r\n<ng-template #nodeColumnTpl let-node=\"$node\">\r\n <div\r\n class=\"x-menu-node\"\r\n [class.x-activated]=\"activated?.id === node.id\"\r\n [class.x-menu-category]=\"node.categoryNode\"\r\n [ngClass]=\"nodeClassMap\"\r\n (click)=\"onToggle($event, node)\"\r\n [style.padding-left.rem]=\"(node.level + 1) * 0.875\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n <div class=\"x-menu-nodes\" *ngIf=\"node.childrenLoaded || (node.leaf && node.open)\" [hidden]=\"!node.open\">\r\n <ng-container *ngFor=\"let child of node.children; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: child }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n", styles: ["x-menu{display:block}.x-menu{margin:0;padding:0}.x-menu-icon.x-icon{font-size:1rem;transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon{transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon.is-open{transform:rotate(180deg)}.x-menu-node.x-size-big{padding:0 calc(var(--x-padding-big) + .25rem);height:calc(var(--x-height-big) + .75rem);line-height:calc(var(--x-height-big) + .75rem)}.x-menu-node.x-size-big.x-menu-category{height:calc(calc(var(--x-height-big) + .75rem) * 1.5)}.x-menu-node.x-size-large{padding:0 calc(var(--x-padding-large) + .25rem);height:calc(var(--x-height-large) + .75rem);line-height:calc(var(--x-height-large) + .75rem)}.x-menu-node.x-size-large.x-menu-category{height:calc(calc(var(--x-height-large) + .75rem) * 1.5)}.x-menu-node.x-size-medium{padding:0 calc(var(--x-padding-medium) + .25rem);height:calc(var(--x-height-medium) + .75rem);line-height:calc(var(--x-height-medium) + .75rem)}.x-menu-node.x-size-medium.x-menu-category{height:calc(calc(var(--x-height-medium) + .75rem) * 1.5)}.x-menu-node.x-size-small{padding:0 var(--x-padding-small);height:calc(var(--x-height-small) + .5rem);line-height:calc(var(--x-height-small) + .5rem)}.x-menu-node.x-size-small.x-menu-category{height:calc(calc(var(--x-height-small) + .5rem) * 1.5)}.x-menu-node.x-size-mini{padding:0 var(--x-padding-mini);height:calc(var(--x-height-mini) + .5rem);line-height:calc(var(--x-height-mini) + .5rem)}.x-menu-node.x-size-mini.x-menu-category{height:calc(calc(var(--x-height-mini) + .5rem) * 1.5)}.x-menu x-slider .x-slider-scroll>ul>li.x-slider-highlight{background-color:inherit;border-radius:0;border:none;border-bottom:.125rem solid var(--x-primary)}.x-menu x-slider .x-slider-scroll>ul>li>x-link{padding:0!important;height:inherit!important;line-height:inherit!important}.x-menu-column{width:12rem;transition:var(--x-animation-duration-base)}.x-menu-row .x-menu-text{margin-left:.25rem}.x-menu-nodes .x-menu-node{cursor:pointer;display:flex;align-items:center;justify-content:space-between;transition:width var(--x-animation-duration-base),background-color var(--x-animation-duration-base);border-right:.125rem solid var(--x-border);position:relative;-webkit-user-select:none;user-select:none;padding-right:.875rem}.x-menu-nodes .x-menu-node .x-menu-text{flex:1;margin:0 .25rem;transition:background-color var(--x-animation-duration-base),opacity var(--x-animation-duration-base);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.x-menu-nodes .x-menu-node:hover{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node x-menu-node{flex:1;display:flex;align-items:center;justify-content:space-between;overflow:hidden}.x-menu-nodes .x-menu-node x-menu-node>a{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:none}.x-menu-nodes .x-menu-node.x-activated{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node.x-activated:after{content:\"\";position:absolute;height:100%;right:-.125rem;top:0;border-right:.125rem solid var(--x-primary)}.x-menu-nodes .x-menu-node.x-menu-category{cursor:inherit;color:var(--x-text-400)}.x-menu-nodes .x-menu-node.x-menu-category:hover{background-color:transparent}.x-menu-nodes .x-menu-node.x-menu-category>x-menu-node{border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border-300)}.x-menu-collapsed.x-menu-column{width:3rem}.x-menu-collapsed .x-menu-nodes x-dropdown,.x-menu-collapsed .x-menu-nodes .x-dropdown{display:flex;flex:1}.x-menu-collapsed .x-menu-nodes .x-menu-node{padding-left:0!important;padding-right:0}.x-menu-collapsed .x-menu-nodes .x-menu-node x-menu-node{padding-left:.875rem}.x-menu-collapsed .x-menu-nodes .x-menu-node .x-menu-text{opacity:0;width:0}.x-menu-collapsed .x-menu-nodes .x-menu-nodes{display:none}.x-menu-collapsed .x-menu-arrow.x-icon{opacity:0;width:0}\n"] }]
346
+ args: [{ selector: `${XMenuPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #menu class=\"x-menu\" [ngClass]=\"classMap\" [style.width]=\"layout === 'column' ? width : ''\">\r\n <div class=\"x-menu-nodes\" *ngIf=\"layout === 'column'\">\r\n <ng-container *ngFor=\"let node of nodes; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: node, $children: true }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <x-slider\r\n *ngIf=\"layout === 'row'\"\r\n [data]=\"nodes\"\r\n [size]=\"size\"\r\n [nodeTpl]=\"nodeRowTpl\"\r\n [nodeJustify]=\"'center'\"\r\n [activatedIndex]=\"rootIndex\"\r\n (indexChange)=\"rootIndexChange($event)\"\r\n ></x-slider>\r\n</div>\r\n\r\n<ng-template #nodeTpl let-node=\"$node\">\r\n <x-dropdown\r\n *ngIf=\"node.level === 0 && collapsed\"\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n placement=\"right-start\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <x-menu-node [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n </x-dropdown>\r\n <x-menu-node *ngIf=\"!collapsed\" [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n</ng-template>\r\n\r\n<ng-template #nodeRowTpl let-node=\"$node\">\r\n <x-dropdown\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <div class=\"x-menu-node\" [ngClass]=\"nodeClassMap\">\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n </x-dropdown>\r\n</ng-template>\r\n\r\n<ng-template #nodeColumnTpl let-node=\"$node\">\r\n <div\r\n class=\"x-menu-node\"\r\n [class.x-activated]=\"activated?.id === node.id\"\r\n [class.x-menu-category]=\"node.categoryNode\"\r\n [ngClass]=\"nodeClassMap\"\r\n (click)=\"onToggle($event, node)\"\r\n [style.padding-left.rem]=\"(node.level + 1) * 0.875\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n <div class=\"x-menu-nodes\" *ngIf=\"node.childrenLoaded || (node.leaf && node.open)\" [hidden]=\"!node.open\">\r\n <ng-container *ngFor=\"let child of node.children; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: child }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n", styles: ["x-menu{display:block}.x-menu{margin:0;padding:0}.x-menu-icon.x-icon{font-size:1rem;transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon{transition:opacity var(--x-animation-duration-base)}.x-menu-arrow.x-icon.is-open{transform:rotate(180deg)}.x-menu-node.x-size-big{padding:0 calc(var(--x-padding-big) + .25rem);height:calc(var(--x-height-big) + .75rem);line-height:calc(var(--x-height-big) + .75rem)}.x-menu-node.x-size-big.x-menu-category{height:calc(calc(var(--x-height-big) + .75rem) * 1.5)}.x-menu-node.x-size-large{padding:0 calc(var(--x-padding-large) + .25rem);height:calc(var(--x-height-large) + .75rem);line-height:calc(var(--x-height-large) + .75rem)}.x-menu-node.x-size-large.x-menu-category{height:calc(calc(var(--x-height-large) + .75rem) * 1.5)}.x-menu-node.x-size-medium{padding:0 calc(var(--x-padding-medium) + .25rem);height:calc(var(--x-height-medium) + .75rem);line-height:calc(var(--x-height-medium) + .75rem)}.x-menu-node.x-size-medium.x-menu-category{height:calc(calc(var(--x-height-medium) + .75rem) * 1.5)}.x-menu-node.x-size-small{padding:0 var(--x-padding-small);height:calc(var(--x-height-small) + .5rem);line-height:calc(var(--x-height-small) + .5rem)}.x-menu-node.x-size-small.x-menu-category{height:calc(calc(var(--x-height-small) + .5rem) * 1.5)}.x-menu-node.x-size-mini{padding:0 var(--x-padding-mini);height:calc(var(--x-height-mini) + .5rem);line-height:calc(var(--x-height-mini) + .5rem)}.x-menu-node.x-size-mini.x-menu-category{height:calc(calc(var(--x-height-mini) + .5rem) * 1.5)}.x-menu x-slider .x-slider-scroll>ul>li.x-slider-highlight{background-color:inherit;border-radius:0;border:none;border-bottom:.125rem solid var(--x-primary)}.x-menu x-slider .x-slider-scroll>ul>li>x-link{padding:0!important;height:inherit!important;line-height:inherit!important}.x-menu-column{width:16rem;transition:var(--x-animation-duration-base)}.x-menu-row .x-menu-text{margin-left:.25rem}.x-menu-nodes .x-menu-node{cursor:pointer;display:flex;align-items:center;justify-content:space-between;transition:width var(--x-animation-duration-base),background-color var(--x-animation-duration-base);border-right:.125rem solid var(--x-border);position:relative;-webkit-user-select:none;user-select:none;padding-right:.875rem}.x-menu-nodes .x-menu-node .x-menu-text{flex:1;margin:0 .25rem;transition:background-color var(--x-animation-duration-base),opacity var(--x-animation-duration-base);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.x-menu-nodes .x-menu-node:hover{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node x-menu-node{flex:1;display:flex;align-items:center;justify-content:space-between;overflow:hidden}.x-menu-nodes .x-menu-node x-menu-node>a{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:none}.x-menu-nodes .x-menu-node.x-activated{color:var(--x-primary);background-color:var(--x-background-a100)}.x-menu-nodes .x-menu-node.x-activated:after{content:\"\";position:absolute;height:100%;right:-.125rem;top:0;border-right:.125rem solid var(--x-primary)}.x-menu-nodes .x-menu-node.x-menu-category{cursor:inherit;color:var(--x-text-400)}.x-menu-nodes .x-menu-node.x-menu-category:hover{background-color:transparent}.x-menu-nodes .x-menu-node.x-menu-category>x-menu-node{border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border-300)}.x-menu-collapsed.x-menu-column{width:3rem}.x-menu-collapsed .x-menu-nodes x-dropdown,.x-menu-collapsed .x-menu-nodes .x-dropdown{display:flex;flex:1}.x-menu-collapsed .x-menu-nodes .x-menu-node{padding-left:0!important;padding-right:0}.x-menu-collapsed .x-menu-nodes .x-menu-node x-menu-node{padding-left:.875rem}.x-menu-collapsed .x-menu-nodes .x-menu-node .x-menu-text{opacity:0;width:0}.x-menu-collapsed .x-menu-nodes .x-menu-nodes{display:none}.x-menu-collapsed .x-menu-arrow.x-icon{opacity:0;width:0}\n"] }]
342
347
  }], ctorParameters: function () {
343
348
  return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
344
349
  type: Inject,
@@ -1 +1 @@
1
- {"version":3,"file":"ng-nest-ui-menu.mjs","sources":["../../../../lib/ng-nest/ui/menu/menu.property.ts","../../../../lib/ng-nest/ui/menu/menu-node.component.ts","../../../../lib/ng-nest/ui/menu/menu-node.component.html","../../../../lib/ng-nest/ui/menu/menu.component.ts","../../../../lib/ng-nest/ui/menu/menu.component.html","../../../../lib/ng-nest/ui/menu/menu.module.ts","../../../../lib/ng-nest/ui/menu/ng-nest-ui-menu.ts"],"sourcesContent":["import {\r\n XParentIdentityProperty,\r\n XData,\r\n XSize,\r\n XProperty,\r\n XDataConvert,\r\n XInputNumber,\r\n XNumber,\r\n XInputBoolean,\r\n XBoolean,\r\n XWithConfig,\r\n XTrigger\r\n} from '@ng-nest/ui/core';\r\nimport { TemplateRef, Input, Output, EventEmitter, Component } from '@angular/core';\r\n\r\n/**\r\n * Menu\r\n * @selector x-menu\r\n * @decorator component\r\n */\r\nexport const XMenuPrefix = 'x-menu';\r\nconst X_CONFIG_NAME = 'menu';\r\n\r\n/**\r\n * Menu Property\r\n */\r\n@Component({ template: '' })\r\nexport class XMenuProperty extends XProperty {\r\n /**\r\n * @zh_CN 节点数据\r\n * @en_US Node data\r\n */\r\n @Input() @XDataConvert() data: XData<XMenuNode> = [];\r\n /**\r\n * @zh_CN 布局方向\r\n * @en_US Layout direction\r\n */\r\n @Input() layout: XMenuLayout = 'row';\r\n /**\r\n * @zh_CN 尺寸\r\n * @en_US Size\r\n */\r\n @Input() @XWithConfig<XSize>(X_CONFIG_NAME, 'medium') size?: XSize;\r\n /**\r\n * @zh_CN 缩起菜单\r\n * @en_US Shrink menu\r\n */\r\n @Input() @XInputBoolean() collapsed: XBoolean = false;\r\n /**\r\n * @zh_CN 触发方式,只针对横向布局\r\n * @en_US Trigger mode, only for horizontal layout\r\n */\r\n @Input() @XWithConfig<XMenuTrigger>(X_CONFIG_NAME, 'hover') trigger?: XMenuTrigger;\r\n /**\r\n * @zh_CN 节点模板\r\n * @en_US Node template\r\n */\r\n @Input() nodeTpl?: TemplateRef<any>;\r\n /**\r\n * @zh_CN 展开的所有层级,只对 layout 布局为 'column' 的生效\r\n * @en_US All expanded levels are only effective for the layout of'column'\r\n */\r\n @Input() @XInputBoolean() expandedAll?: XBoolean;\r\n /**\r\n * @zh_CN 默认展开的层级,只对 layout 布局为 'column' 的生效\r\n * @en_US The level expanded by default is only valid for the layout of'column'\r\n */\r\n @Input() @XInputNumber() expandedLevel: XNumber = -1;\r\n /**\r\n * @zh_CN 当前激活的节点 id\r\n * @en_US Currently active node id\r\n */\r\n @Input() activatedId: any;\r\n /**\r\n * @zh_CN 滚动容器\r\n * @en_US Rolling container\r\n */\r\n @Input() target?: string | HTMLElement;\r\n /**\r\n * @zh_CN 弹框的最小宽度\r\n * @en_US Portal min-width\r\n */\r\n @Input() portalMinWidth?: string | number;\r\n /**\r\n * @zh_CN 节点点击的事件\r\n * @en_US Node click event\r\n */\r\n @Output() nodeClick = new EventEmitter<XMenuNode>();\r\n /**\r\n * @zh_CN 节点点击的事件\r\n * @en_US Node click event\r\n */\r\n @Output() activatedIdChange = new EventEmitter<any>();\r\n}\r\n\r\n/**\r\n * @zh_CN MenuNode 节点数据\r\n * @en_US MenuNode node data\r\n */\r\nexport interface XMenuNode extends XParentIdentityProperty<XMenuNode> {\r\n /**\r\n * @zh_CN 图标\r\n * @en_US Icon\r\n */\r\n icon?: string;\r\n /**\r\n * @zh_CN 展开\r\n * @en_US Unfold\r\n */\r\n open?: boolean;\r\n /**\r\n * @zh_CN 子节点已加载过\r\n * @en_US Child node has been loaded\r\n */\r\n childrenLoaded?: boolean;\r\n /**\r\n * @zh_CN 分类显示,设置值后节点显示成分类样式\r\n * @en_US Category display, after setting the value, the node is displayed in a category style\r\n */\r\n category?: string;\r\n /**\r\n * @zh_CN 分类节点,通过内部计算\r\n * @en_US Classification node, through internal calculation\r\n */\r\n categoryNode?: boolean;\r\n /**\r\n * @zh_CN 检查更新\r\n * @en_US Check for updates\r\n */\r\n change?: Function;\r\n /**\r\n * @zh_CN 路由\r\n * @en_US Router\r\n */\r\n routerLink?: string | any[];\r\n}\r\n\r\n/**\r\n * @zh_CN 布局方式\r\n * @en_US Layout\r\n */\r\nexport type XMenuLayout = 'row' | 'column';\r\n\r\n/**\r\n * @zh_CN 触发方式\r\n * @en_US Trigger method\r\n */\r\nexport type XMenuTrigger = XTrigger;\r\n\r\n/**\r\n * Menu Node\r\n * @selector x-menu-node\r\n * @decorator component\r\n */\r\nexport const XMenuNodePrefix = 'x-menu-node';\r\n\r\n/**\r\n * Menu Node Property\r\n */\r\n@Component({ template: '' })\r\nexport class XMenuNodeProperty extends XProperty {\r\n /**\r\n * @zh_CN 节点数据\r\n * @en_US Node data\r\n */\r\n @Input() node!: XMenuNode;\r\n}\r\n","import { Component, ViewEncapsulation, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, Input } from '@angular/core';\r\nimport { XMenuNodeProperty, XMenuNodePrefix } from './menu.property';\r\nimport { XConfigService } from '@ng-nest/ui/core';\r\n\r\n@Component({\r\n selector: `${XMenuNodePrefix}`,\r\n templateUrl: './menu-node.component.html',\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XMenuNodeComponent extends XMenuNodeProperty {\r\n @Input() menu: any;\r\n constructor(\r\n // @Host() @Optional() public menu: XMenuComponent,\r\n public cdr: ChangeDetectorRef,\r\n public elementRef: ElementRef,\r\n public configService: XConfigService\r\n ) {\r\n super();\r\n }\r\n ngOnInit() {\r\n if (this.menu?.activatedId == this.node.id) {\r\n this.menu.activatedElementRef = this.elementRef;\r\n }\r\n this.node.change = () => {\r\n this.cdr.detectChanges();\r\n };\r\n }\r\n}\r\n","<a *ngIf=\"node.routerLink && !node.leaf; else menuTpl\" [routerLink]=\"node.routerLink\">\r\n <ng-container *ngTemplateOutlet=\"menuTpl\"></ng-container>\r\n</a>\r\n\r\n<ng-template #menuTpl>\r\n <x-icon class=\"x-menu-icon\" *ngIf=\"node.icon\" [type]=\"node.icon\"></x-icon>\r\n <span class=\"x-menu-text\" *ngIf=\"node.label\">{{ node.label }}</span>\r\n <x-icon class=\"x-menu-arrow\" *ngIf=\"node.leaf\" [class.is-open]=\"node.open\" type=\"fto-chevron-down\"></x-icon>\r\n</ng-template>\r\n","import {\r\n Component,\r\n OnInit,\r\n ViewEncapsulation,\r\n Renderer2,\r\n ElementRef,\r\n ChangeDetectorRef,\r\n ChangeDetectionStrategy,\r\n SimpleChanges,\r\n OnChanges,\r\n OnDestroy,\r\n AfterViewInit,\r\n Inject\r\n} from '@angular/core';\r\nimport { XMenuPrefix, XMenuNode, XMenuProperty } from './menu.property';\r\nimport { XClassMap, XIsChange, XIsEmpty, XSetData, groupBy, XConfigService } from '@ng-nest/ui/core';\r\nimport { Subject } from 'rxjs';\r\nimport { DOCUMENT } from '@angular/common';\r\n\r\n@Component({\r\n selector: `${XMenuPrefix}`,\r\n templateUrl: './menu.component.html',\r\n styleUrls: ['./menu.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XMenuComponent extends XMenuProperty implements OnInit, OnChanges, OnDestroy, AfterViewInit {\r\n showCategory = false;\r\n get scroll(): HTMLElement {\r\n return this._target;\r\n }\r\n nodeClassMap: XClassMap = {};\r\n datas: XMenuNode[] = [];\r\n nodes: XMenuNode[] = [];\r\n rootIndex: number = 0;\r\n activated!: XMenuNode;\r\n activatedElementRef!: ElementRef;\r\n expanded: any[] = [];\r\n private _unSubject = new Subject<void>();\r\n private _target!: HTMLElement;\r\n\r\n constructor(\r\n public renderer: Renderer2,\r\n public elementRef: ElementRef,\r\n public cdr: ChangeDetectorRef,\r\n @Inject(DOCUMENT) public doc: any,\r\n public configService: XConfigService\r\n ) {\r\n super();\r\n }\r\n\r\n ngOnInit() {\r\n this.setClassMap();\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n const { data, activatedId, collapsed, target } = changes;\r\n XIsChange(data) && this.setData();\r\n XIsChange(activatedId) && this.setActivatedNode(this.datas);\r\n XIsChange(collapsed) && this.setClassMap();\r\n if (XIsChange(target)) {\r\n this._target = typeof this.target === 'string' ? this.doc.querySelector(this.target) : this.target;\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._unSubject.next();\r\n this._unSubject.unsubscribe();\r\n }\r\n\r\n ngAfterViewInit() {\r\n if (this.activatedElementRef && this.scroll) {\r\n const nodeRect: DOMRect = this.activatedElementRef.nativeElement.getBoundingClientRect();\r\n const scrollRect: DOMRect = this.scroll.getBoundingClientRect();\r\n let scrollTop = nodeRect.top - scrollRect.top - scrollRect.height;\r\n if (scrollTop > 0) {\r\n let offset = 0;\r\n while (offset < scrollRect.height / 2) {\r\n offset = offset + nodeRect.height;\r\n }\r\n this.scroll.scrollTop = scrollTop + offset;\r\n }\r\n }\r\n }\r\n\r\n onNodeClick(node: XMenuNode) {\r\n if (!this.collapsed) {\r\n this.rootIndex = this.nodes.indexOf(this.getRoot(node));\r\n this.activatedId = node.id;\r\n this.activated = node;\r\n this.nodeClick.emit(node);\r\n this.activatedIdChange.emit(node.id);\r\n this.cdr.detectChanges();\r\n } else {\r\n this.onToggle(null, node, true);\r\n }\r\n }\r\n\r\n rootIndexChange(index: number) {\r\n this.rootIndex = index;\r\n let node = this.nodes[index];\r\n this.activatedId = node.id;\r\n this.activated = node;\r\n this.nodeClick.emit(node);\r\n this.activatedIdChange.emit(node.id);\r\n this.cdr.detectChanges();\r\n }\r\n\r\n onToggle(event: Event | null, node: XMenuNode, isDropdown = false) {\r\n if ((this.collapsed && !isDropdown) || node.categoryNode) return;\r\n if (!node.leaf) {\r\n this.activated = node;\r\n } else {\r\n event?.stopPropagation();\r\n node.open = !node.open;\r\n if (node.open && !node.childrenLoaded) {\r\n node.childrenLoaded = true;\r\n }\r\n }\r\n this.nodeClick.emit(node);\r\n node.change && node.change();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n setClassMap() {\r\n this.classMap[`${XMenuPrefix}-${this.layout}`] = this.layout ? true : false;\r\n this.classMap[`${XMenuPrefix}-collapsed`] = Boolean(this.collapsed);\r\n this.nodeClassMap[`x-size-${this.size}`] = this.size ? true : false;\r\n this.cdr.detectChanges();\r\n }\r\n\r\n private setData() {\r\n XSetData<XMenuNode>(this.data, this._unSubject).subscribe((x) => {\r\n this.setDataChange(x);\r\n });\r\n }\r\n\r\n private setDataChange(value: XMenuNode[]) {\r\n !XIsEmpty(this.activatedId) && this.setActivatedNode(value);\r\n let handlerDatas: XMenuNode[] = [];\r\n const getChildren = (node: XMenuNode, level: number) => {\r\n node.level = level;\r\n node.children = value.filter((y) => y.pid === node.id);\r\n node.leaf = node.children?.length > 0;\r\n if (node.leaf) {\r\n node.open = Boolean(this.expandedAll) || level <= this.expandedLevel || this.expanded.indexOf(node.id) >= 0;\r\n node.childrenLoaded = node.open;\r\n node.children.map((y) => getChildren(y, level + 1));\r\n node.children = this.setCategory(node.children);\r\n }\r\n handlerDatas = [...handlerDatas, node];\r\n return node;\r\n };\r\n\r\n this.nodes = this.setCategory(value.filter((x) => XIsEmpty(x.pid))).map((x) => getChildren(x, 0));\r\n this.datas = handlerDatas;\r\n this.cdr.detectChanges();\r\n }\r\n\r\n private getRoot(value: XMenuNode) {\r\n let root = value;\r\n const getParent = (node: XMenuNode) => {\r\n const parent = this.datas.find((x) => node.pid === x.id) as XMenuNode;\r\n if (XIsEmpty(parent?.pid)) root = parent;\r\n else getParent(parent);\r\n };\r\n if (!XIsEmpty(value.pid)) getParent(value);\r\n return root;\r\n }\r\n\r\n setCategory(nodes: XMenuNode[]) {\r\n const group = groupBy(nodes as XMenuNode[], 'category');\r\n for (let list of group) {\r\n const first = list[0];\r\n if (first.category) {\r\n list.unshift({\r\n id: `${first.pid}__${first.category}`,\r\n pid: first.pid,\r\n label: first.category,\r\n level: first.level,\r\n categoryNode: true\r\n });\r\n }\r\n }\r\n let con: XMenuNode[] = [];\r\n group.map((x) => {\r\n con = con.concat(x);\r\n });\r\n return con;\r\n }\r\n\r\n setActivatedNode(nodes: XMenuNode[]) {\r\n this.activated = nodes.find((x) => x.id == this.activatedId) as XMenuNode;\r\n this.rootIndex = nodes.findIndex((x) => x.id == this.activatedId && !x.pid);\r\n if (this.activated) {\r\n this.setParentOpen(nodes, this.activated);\r\n }\r\n }\r\n\r\n setParentOpen(nodes: XMenuNode[], node: XMenuNode) {\r\n const getParent = (child: XMenuNode) => {\r\n if (XIsEmpty(child.pid)) return;\r\n const parent = nodes.find((x) => x.id === child.pid) as XMenuNode;\r\n if (!XIsEmpty(parent)) {\r\n this.expanded = [...this.expanded, parent.id];\r\n getParent(parent);\r\n }\r\n };\r\n getParent(node);\r\n }\r\n\r\n trackByNode(_index: number, item: XMenuNode) {\r\n return item.id;\r\n }\r\n}\r\n","<div #menu class=\"x-menu\" [ngClass]=\"classMap\">\r\n <div class=\"x-menu-nodes\" *ngIf=\"layout === 'column'\">\r\n <ng-container *ngFor=\"let node of nodes; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: node, $children: true }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <x-slider\r\n *ngIf=\"layout === 'row'\"\r\n [data]=\"nodes\"\r\n [size]=\"size\"\r\n [nodeTpl]=\"nodeRowTpl\"\r\n [nodeJustify]=\"'center'\"\r\n [activatedIndex]=\"rootIndex\"\r\n (indexChange)=\"rootIndexChange($event)\"\r\n ></x-slider>\r\n</div>\r\n\r\n<ng-template #nodeTpl let-node=\"$node\">\r\n <x-dropdown\r\n *ngIf=\"node.level === 0 && collapsed\"\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n placement=\"right-start\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <x-menu-node [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n </x-dropdown>\r\n <x-menu-node *ngIf=\"!collapsed\" [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n</ng-template>\r\n\r\n<ng-template #nodeRowTpl let-node=\"$node\">\r\n <x-dropdown\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <div class=\"x-menu-node\" [ngClass]=\"nodeClassMap\">\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n </x-dropdown>\r\n</ng-template>\r\n\r\n<ng-template #nodeColumnTpl let-node=\"$node\">\r\n <div\r\n class=\"x-menu-node\"\r\n [class.x-activated]=\"activated?.id === node.id\"\r\n [class.x-menu-category]=\"node.categoryNode\"\r\n [ngClass]=\"nodeClassMap\"\r\n (click)=\"onToggle($event, node)\"\r\n [style.padding-left.rem]=\"(node.level + 1) * 0.875\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n <div class=\"x-menu-nodes\" *ngIf=\"node.childrenLoaded || (node.leaf && node.open)\" [hidden]=\"!node.open\">\r\n <ng-container *ngFor=\"let child of node.children; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: child }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { XMenuComponent } from './menu.component';\r\nimport { XMenuNodeComponent } from './menu-node.component';\r\nimport { XDropdownModule } from '@ng-nest/ui/dropdown';\r\nimport { XSliderModule } from '@ng-nest/ui/slider';\r\nimport { XIconModule } from '@ng-nest/ui/icon';\r\nimport { XMenuProperty, XMenuNodeProperty } from './menu.property';\r\nimport { RouterModule } from '@angular/router';\r\n\r\n@NgModule({\r\n declarations: [XMenuComponent, XMenuNodeComponent, XMenuProperty, XMenuNodeProperty],\r\n exports: [XMenuComponent, XMenuNodeComponent],\r\n imports: [CommonModule, RouterModule, XDropdownModule, XSliderModule, XIconModule]\r\n})\r\nexport class XMenuModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAeA;;;;;MAKa,WAAW,GAAG,SAAS;AACpC,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B;;;MAIa,sBAAsB,SAAS;IAD5C;;;;;;QAM2B,SAAI,GAAqB,EAAE,CAAC;;;;;QAK5C,WAAM,GAAgB,KAAK,CAAC;;;;;QAUX,cAAS,GAAa,KAAK,CAAC;;;;;QAoB7B,kBAAa,GAAY,CAAC,CAAC,CAAC;;;;;QAoB3C,cAAS,GAAG,IAAI,YAAY,EAAa,CAAC;;;;;QAK1C,sBAAiB,GAAG,IAAI,YAAY,EAAO,CAAC;KACvD;;gJAlEY,aAAa;oIAAb,aAAa,8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,YAAY,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,CAAC;oBACpF,OAAO,EAAE,CAAC,cAAc,EAAE,kBAAkB,CAAC;oBAC7C,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,CAAC;iBACnF;;;ACdD;;;;;;"}
1
+ {"version":3,"file":"ng-nest-ui-menu.mjs","sources":["../../../../lib/ng-nest/ui/menu/menu.property.ts","../../../../lib/ng-nest/ui/menu/menu-node.component.ts","../../../../lib/ng-nest/ui/menu/menu-node.component.html","../../../../lib/ng-nest/ui/menu/menu.component.ts","../../../../lib/ng-nest/ui/menu/menu.component.html","../../../../lib/ng-nest/ui/menu/menu.module.ts","../../../../lib/ng-nest/ui/menu/ng-nest-ui-menu.ts"],"sourcesContent":["import {\r\n XParentIdentityProperty,\r\n XData,\r\n XSize,\r\n XProperty,\r\n XDataConvert,\r\n XInputNumber,\r\n XNumber,\r\n XInputBoolean,\r\n XBoolean,\r\n XWithConfig,\r\n XTrigger\r\n} from '@ng-nest/ui/core';\r\nimport { TemplateRef, Input, Output, EventEmitter, Component } from '@angular/core';\r\n\r\n/**\r\n * Menu\r\n * @selector x-menu\r\n * @decorator component\r\n */\r\nexport const XMenuPrefix = 'x-menu';\r\nconst X_CONFIG_NAME = 'menu';\r\n\r\n/**\r\n * Menu Property\r\n */\r\n@Component({ template: '' })\r\nexport class XMenuProperty extends XProperty {\r\n /**\r\n * @zh_CN 节点数据\r\n * @en_US Node data\r\n */\r\n @Input() @XDataConvert() data: XData<XMenuNode> = [];\r\n /**\r\n * @zh_CN 布局方向\r\n * @en_US Layout direction\r\n */\r\n @Input() layout: XMenuLayout = 'row';\r\n /**\r\n * @zh_CN 尺寸\r\n * @en_US Size\r\n */\r\n @Input() @XWithConfig<XSize>(X_CONFIG_NAME, 'medium') size!: XSize;\r\n /**\r\n * @zh_CN 宽度,只有布局 layout 为 'column' 生效\r\n * @en_US Width, only layout layout is the 'column'\r\n */\r\n @Input() @XWithConfig<string>(X_CONFIG_NAME, '12rem') width!: string;\r\n /**\r\n * @zh_CN 缩起菜单\r\n * @en_US Shrink menu\r\n */\r\n @Input() @XInputBoolean() collapsed: XBoolean = false;\r\n /**\r\n * @zh_CN 触发方式,只针对横向布局\r\n * @en_US Trigger mode, only for horizontal layout\r\n */\r\n @Input() @XWithConfig<XMenuTrigger>(X_CONFIG_NAME, 'hover') trigger!: XMenuTrigger;\r\n /**\r\n * @zh_CN 节点模板\r\n * @en_US Node template\r\n */\r\n @Input() nodeTpl?: TemplateRef<any>;\r\n /**\r\n * @zh_CN 展开的所有层级,只对 layout 布局为 'column' 的生效\r\n * @en_US All expanded levels are only effective for the layout of'column'\r\n */\r\n @Input() @XInputBoolean() expandedAll?: XBoolean;\r\n /**\r\n * @zh_CN 默认展开的层级,只对 layout 布局为 'column' 的生效\r\n * @en_US The level expanded by default is only valid for the layout of'column'\r\n */\r\n @Input() @XInputNumber() expandedLevel: XNumber = -1;\r\n /**\r\n * @zh_CN 当前激活的节点 id\r\n * @en_US Currently active node id\r\n */\r\n @Input() activatedId: any;\r\n /**\r\n * @zh_CN 滚动容器\r\n * @en_US Rolling container\r\n */\r\n @Input() target?: string | HTMLElement;\r\n /**\r\n * @zh_CN 弹框的最小宽度\r\n * @en_US Portal min-width\r\n */\r\n @Input() portalMinWidth?: string | number;\r\n /**\r\n * @zh_CN 节点点击的事件\r\n * @en_US Node click event\r\n */\r\n @Output() nodeClick = new EventEmitter<XMenuNode>();\r\n /**\r\n * @zh_CN 节点点击的事件\r\n * @en_US Node click event\r\n */\r\n @Output() activatedIdChange = new EventEmitter<any>();\r\n}\r\n\r\n/**\r\n * @zh_CN MenuNode 节点数据\r\n * @en_US MenuNode node data\r\n */\r\nexport interface XMenuNode extends XParentIdentityProperty<XMenuNode> {\r\n /**\r\n * @zh_CN 图标\r\n * @en_US Icon\r\n */\r\n icon?: string;\r\n /**\r\n * @zh_CN 展开\r\n * @en_US Unfold\r\n */\r\n open?: boolean;\r\n /**\r\n * @zh_CN 子节点已加载过\r\n * @en_US Child node has been loaded\r\n */\r\n childrenLoaded?: boolean;\r\n /**\r\n * @zh_CN 分类显示,设置值后节点显示成分类样式\r\n * @en_US Category display, after setting the value, the node is displayed in a category style\r\n */\r\n category?: string;\r\n /**\r\n * @zh_CN 分类节点,通过内部计算\r\n * @en_US Classification node, through internal calculation\r\n */\r\n categoryNode?: boolean;\r\n /**\r\n * @zh_CN 检查更新\r\n * @en_US Check for updates\r\n */\r\n change?: Function;\r\n /**\r\n * @zh_CN 路由\r\n * @en_US Router\r\n */\r\n routerLink?: string | any[];\r\n}\r\n\r\n/**\r\n * @zh_CN 布局方式\r\n * @en_US Layout\r\n */\r\nexport type XMenuLayout = 'row' | 'column';\r\n\r\n/**\r\n * @zh_CN 触发方式\r\n * @en_US Trigger method\r\n */\r\nexport type XMenuTrigger = XTrigger;\r\n\r\n/**\r\n * Menu Node\r\n * @selector x-menu-node\r\n * @decorator component\r\n */\r\nexport const XMenuNodePrefix = 'x-menu-node';\r\n\r\n/**\r\n * Menu Node Property\r\n */\r\n@Component({ template: '' })\r\nexport class XMenuNodeProperty extends XProperty {\r\n /**\r\n * @zh_CN 节点数据\r\n * @en_US Node data\r\n */\r\n @Input() node!: XMenuNode;\r\n}\r\n","import { Component, ViewEncapsulation, ChangeDetectionStrategy, ChangeDetectorRef, ElementRef, Input } from '@angular/core';\r\nimport { XMenuNodeProperty, XMenuNodePrefix } from './menu.property';\r\nimport { XConfigService } from '@ng-nest/ui/core';\r\n\r\n@Component({\r\n selector: `${XMenuNodePrefix}`,\r\n templateUrl: './menu-node.component.html',\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XMenuNodeComponent extends XMenuNodeProperty {\r\n @Input() menu: any;\r\n constructor(\r\n // @Host() @Optional() public menu: XMenuComponent,\r\n public cdr: ChangeDetectorRef,\r\n public elementRef: ElementRef,\r\n public configService: XConfigService\r\n ) {\r\n super();\r\n }\r\n ngOnInit() {\r\n if (this.menu?.activatedId == this.node.id) {\r\n this.menu.activatedElementRef = this.elementRef;\r\n }\r\n this.node.change = () => {\r\n this.cdr.detectChanges();\r\n };\r\n }\r\n}\r\n","<a *ngIf=\"node.routerLink && !node.leaf; else menuTpl\" [routerLink]=\"node.routerLink\">\r\n <ng-container *ngTemplateOutlet=\"menuTpl\"></ng-container>\r\n</a>\r\n\r\n<ng-template #menuTpl>\r\n <x-icon class=\"x-menu-icon\" *ngIf=\"node.icon\" [type]=\"node.icon\"></x-icon>\r\n <span class=\"x-menu-text\" *ngIf=\"node.label\">{{ node.label }}</span>\r\n <x-icon class=\"x-menu-arrow\" *ngIf=\"node.leaf\" [class.is-open]=\"node.open\" type=\"fto-chevron-down\"></x-icon>\r\n</ng-template>\r\n","import {\r\n Component,\r\n OnInit,\r\n ViewEncapsulation,\r\n Renderer2,\r\n ElementRef,\r\n ChangeDetectorRef,\r\n ChangeDetectionStrategy,\r\n SimpleChanges,\r\n OnChanges,\r\n OnDestroy,\r\n AfterViewInit,\r\n Inject\r\n} from '@angular/core';\r\nimport { XMenuPrefix, XMenuNode, XMenuProperty } from './menu.property';\r\nimport { XClassMap, XIsChange, XIsEmpty, XSetData, groupBy, XConfigService } from '@ng-nest/ui/core';\r\nimport { Subject } from 'rxjs';\r\nimport { DOCUMENT } from '@angular/common';\r\n\r\n@Component({\r\n selector: `${XMenuPrefix}`,\r\n templateUrl: './menu.component.html',\r\n styleUrls: ['./menu.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class XMenuComponent extends XMenuProperty implements OnInit, OnChanges, OnDestroy, AfterViewInit {\r\n showCategory = false;\r\n get scroll(): HTMLElement {\r\n return this._target;\r\n }\r\n nodeClassMap: XClassMap = {};\r\n datas: XMenuNode[] = [];\r\n nodes: XMenuNode[] = [];\r\n rootIndex: number = 0;\r\n activated!: XMenuNode;\r\n activatedElementRef!: ElementRef;\r\n expanded: any[] = [];\r\n private _unSubject = new Subject<void>();\r\n private _target!: HTMLElement;\r\n\r\n constructor(\r\n public renderer: Renderer2,\r\n public elementRef: ElementRef,\r\n public cdr: ChangeDetectorRef,\r\n @Inject(DOCUMENT) public doc: any,\r\n public configService: XConfigService\r\n ) {\r\n super();\r\n }\r\n\r\n ngOnInit() {\r\n this.setClassMap();\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n const { data, activatedId, collapsed, target } = changes;\r\n XIsChange(data) && this.setData();\r\n XIsChange(activatedId) && this.setActivatedNode(this.datas);\r\n XIsChange(collapsed) && this.setClassMap();\r\n if (XIsChange(target)) {\r\n this._target = typeof this.target === 'string' ? this.doc.querySelector(this.target) : this.target;\r\n }\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this._unSubject.next();\r\n this._unSubject.unsubscribe();\r\n }\r\n\r\n ngAfterViewInit() {\r\n if (this.activatedElementRef && this.scroll) {\r\n const nodeRect: DOMRect = this.activatedElementRef.nativeElement.getBoundingClientRect();\r\n const scrollRect: DOMRect = this.scroll.getBoundingClientRect();\r\n let scrollTop = nodeRect.top - scrollRect.top - scrollRect.height;\r\n if (scrollTop > 0) {\r\n let offset = 0;\r\n while (offset < scrollRect.height / 2) {\r\n offset = offset + nodeRect.height;\r\n }\r\n this.scroll.scrollTop = scrollTop + offset;\r\n }\r\n }\r\n }\r\n\r\n onNodeClick(node: XMenuNode) {\r\n if (!this.collapsed) {\r\n this.rootIndex = this.nodes.indexOf(this.getRoot(node));\r\n this.activatedId = node.id;\r\n this.activated = node;\r\n this.nodeClick.emit(node);\r\n this.activatedIdChange.emit(node.id);\r\n this.cdr.detectChanges();\r\n } else {\r\n this.onToggle(null, node, true);\r\n }\r\n }\r\n\r\n rootIndexChange(index: number) {\r\n this.rootIndex = index;\r\n let node = this.nodes[index];\r\n this.activatedId = node.id;\r\n this.activated = node;\r\n this.nodeClick.emit(node);\r\n this.activatedIdChange.emit(node.id);\r\n this.cdr.detectChanges();\r\n }\r\n\r\n onToggle(event: Event | null, node: XMenuNode, isDropdown = false) {\r\n if ((this.collapsed && !isDropdown) || node.categoryNode) return;\r\n if (!node.leaf) {\r\n this.activated = node;\r\n } else {\r\n event?.stopPropagation();\r\n node.open = !node.open;\r\n if (node.open && !node.childrenLoaded) {\r\n node.childrenLoaded = true;\r\n }\r\n }\r\n this.nodeClick.emit(node);\r\n node.change && node.change();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n setClassMap() {\r\n this.classMap[`${XMenuPrefix}-${this.layout}`] = this.layout ? true : false;\r\n this.classMap[`${XMenuPrefix}-collapsed`] = Boolean(this.collapsed);\r\n this.nodeClassMap[`x-size-${this.size}`] = this.size ? true : false;\r\n this.cdr.detectChanges();\r\n }\r\n\r\n private setData() {\r\n XSetData<XMenuNode>(this.data, this._unSubject).subscribe((x) => {\r\n this.setDataChange(x);\r\n });\r\n }\r\n\r\n private setDataChange(value: XMenuNode[]) {\r\n !XIsEmpty(this.activatedId) && this.setActivatedNode(value);\r\n let handlerDatas: XMenuNode[] = [];\r\n const getChildren = (node: XMenuNode, level: number) => {\r\n node.level = level;\r\n node.children = value.filter((y) => y.pid === node.id);\r\n node.leaf = node.children?.length > 0;\r\n if (node.leaf) {\r\n node.open = Boolean(this.expandedAll) || level <= this.expandedLevel || this.expanded.indexOf(node.id) >= 0;\r\n node.childrenLoaded = node.open;\r\n node.children.map((y) => getChildren(y, level + 1));\r\n node.children = this.setCategory(node.children);\r\n }\r\n handlerDatas = [...handlerDatas, node];\r\n return node;\r\n };\r\n\r\n this.nodes = this.setCategory(value.filter((x) => XIsEmpty(x.pid))).map((x) => getChildren(x, 0));\r\n this.datas = handlerDatas;\r\n this.cdr.detectChanges();\r\n }\r\n\r\n private getRoot(value: XMenuNode) {\r\n let root = value;\r\n const getParent = (node: XMenuNode) => {\r\n const parent = this.datas.find((x) => node.pid === x.id) as XMenuNode;\r\n if (XIsEmpty(parent?.pid)) root = parent;\r\n else getParent(parent);\r\n };\r\n if (!XIsEmpty(value.pid)) getParent(value);\r\n return root;\r\n }\r\n\r\n setCategory(nodes: XMenuNode[]) {\r\n const group = groupBy(nodes as XMenuNode[], 'category');\r\n for (let list of group) {\r\n const first = list[0];\r\n if (first.category) {\r\n list.unshift({\r\n id: `${first.pid}__${first.category}`,\r\n pid: first.pid,\r\n label: first.category,\r\n level: first.level,\r\n categoryNode: true\r\n });\r\n }\r\n }\r\n let con: XMenuNode[] = [];\r\n group.map((x) => {\r\n con = con.concat(x);\r\n });\r\n return con;\r\n }\r\n\r\n setActivatedNode(nodes: XMenuNode[]) {\r\n this.activated = nodes.find((x) => x.id == this.activatedId) as XMenuNode;\r\n this.rootIndex = nodes.findIndex((x) => x.id == this.activatedId && !x.pid);\r\n if (this.activated) {\r\n this.setParentOpen(nodes, this.activated);\r\n }\r\n }\r\n\r\n setParentOpen(nodes: XMenuNode[], node: XMenuNode) {\r\n const getParent = (child: XMenuNode) => {\r\n if (XIsEmpty(child.pid)) return;\r\n const parent = nodes.find((x) => x.id === child.pid) as XMenuNode;\r\n if (!XIsEmpty(parent)) {\r\n this.expanded = [...this.expanded, parent.id];\r\n getParent(parent);\r\n }\r\n };\r\n getParent(node);\r\n }\r\n\r\n trackByNode(_index: number, item: XMenuNode) {\r\n return item.id;\r\n }\r\n}\r\n","<div #menu class=\"x-menu\" [ngClass]=\"classMap\" [style.width]=\"layout === 'column' ? width : ''\">\r\n <div class=\"x-menu-nodes\" *ngIf=\"layout === 'column'\">\r\n <ng-container *ngFor=\"let node of nodes; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: node, $children: true }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <x-slider\r\n *ngIf=\"layout === 'row'\"\r\n [data]=\"nodes\"\r\n [size]=\"size\"\r\n [nodeTpl]=\"nodeRowTpl\"\r\n [nodeJustify]=\"'center'\"\r\n [activatedIndex]=\"rootIndex\"\r\n (indexChange)=\"rootIndexChange($event)\"\r\n ></x-slider>\r\n</div>\r\n\r\n<ng-template #nodeTpl let-node=\"$node\">\r\n <x-dropdown\r\n *ngIf=\"node.level === 0 && collapsed\"\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n placement=\"right-start\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <x-menu-node [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n </x-dropdown>\r\n <x-menu-node *ngIf=\"!collapsed\" [node]=\"node\" [menu]=\"this\"></x-menu-node>\r\n</ng-template>\r\n\r\n<ng-template #nodeRowTpl let-node=\"$node\">\r\n <x-dropdown\r\n [disabled]=\"!node.leaf\"\r\n [data]=\"node.children\"\r\n [trigger]=\"trigger\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n [portalMinWidth]=\"portalMinWidth\"\r\n children\r\n >\r\n <div class=\"x-menu-node\" [ngClass]=\"nodeClassMap\">\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n </x-dropdown>\r\n</ng-template>\r\n\r\n<ng-template #nodeColumnTpl let-node=\"$node\">\r\n <div\r\n class=\"x-menu-node\"\r\n [class.x-activated]=\"activated?.id === node.id\"\r\n [class.x-menu-category]=\"node.categoryNode\"\r\n [ngClass]=\"nodeClassMap\"\r\n (click)=\"onToggle($event, node)\"\r\n [style.padding-left.rem]=\"(node.level + 1) * 0.875\"\r\n >\r\n <ng-container *ngTemplateOutlet=\"nodeTpl; context: { $node: node }\"></ng-container>\r\n </div>\r\n <div class=\"x-menu-nodes\" *ngIf=\"node.childrenLoaded || (node.leaf && node.open)\" [hidden]=\"!node.open\">\r\n <ng-container *ngFor=\"let child of node.children; trackBy: trackByNode\">\r\n <ng-container *ngTemplateOutlet=\"nodeColumnTpl; context: { $node: child }\"></ng-container>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { XMenuComponent } from './menu.component';\r\nimport { XMenuNodeComponent } from './menu-node.component';\r\nimport { XDropdownModule } from '@ng-nest/ui/dropdown';\r\nimport { XSliderModule } from '@ng-nest/ui/slider';\r\nimport { XIconModule } from '@ng-nest/ui/icon';\r\nimport { XMenuProperty, XMenuNodeProperty } from './menu.property';\r\nimport { RouterModule } from '@angular/router';\r\n\r\n@NgModule({\r\n declarations: [XMenuComponent, XMenuNodeComponent, XMenuProperty, XMenuNodeProperty],\r\n exports: [XMenuComponent, XMenuNodeComponent],\r\n imports: [CommonModule, RouterModule, XDropdownModule, XSliderModule, XIconModule]\r\n})\r\nexport class XMenuModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAeA;;;;;MAKa,WAAW,GAAG,SAAS;AACpC,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B;;;MAIa,sBAAsB,SAAS;IAD5C;;;;;;QAM2B,SAAI,GAAqB,EAAE,CAAC;;;;;QAK5C,WAAM,GAAgB,KAAK,CAAC;;;;;QAeX,cAAS,GAAa,KAAK,CAAC;;;;;QAoB7B,kBAAa,GAAY,CAAC,CAAC,CAAC;;;;;QAoB3C,cAAS,GAAG,IAAI,YAAY,EAAa,CAAC;;;;;QAK1C,sBAAiB,GAAG,IAAI,YAAY,EAAO,CAAC;KACvD;;gJAvEY,aAAa;oIAAb,aAAa,8aADH,EAAE;AAME;IAAf,YAAY,EAAE;2CAA6B;AAUC;IAA5C,WAAW,CAAQ,aAAa,EAAE,QAAQ,CAAC;2CAAc;AAKb;IAA5C,WAAW,CAAS,aAAa,EAAE,OAAO,CAAC;4CAAgB;AAK3C;IAAhB,aAAa,EAAE;gDAA6B;AAKM;IAAlD,WAAW,CAAe,aAAa,EAAE,OAAO,CAAC;8CAAwB;AAUzD;IAAhB,aAAa,EAA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,EAAE,WAAW,CAAC;iBACnF;;;ACdD;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, ViewEncapsulation, ChangeDetectionStrategy, Injectable, NgModule } from '@angular/core';
3
3
  import * as i2$1 from '@ng-nest/ui/core';
4
- import { XIsEmpty, XMoveAnimation, XIsString, XIsXTemplate, fillDefault } from '@ng-nest/ui/core';
4
+ import { XIsEmpty, XMoveAnimation, XIsString, XIsXTemplate, fillDefault, XIsUndefined } from '@ng-nest/ui/core';
5
5
  import { of } from 'rxjs';
6
6
  import { delay } from 'rxjs/operators';
7
7
  import * as i1 from '@ng-nest/ui/alert';
@@ -25,7 +25,7 @@ class XMessageComponent {
25
25
  this.renderer = renderer;
26
26
  this.elementRef = elementRef;
27
27
  this.cdr = cdr;
28
- this.message = { ref: {}, list: [], currentClose: () => { }, closeAll: () => { } };
28
+ this.message = { ref: {}, list: [], closeAll: () => { } };
29
29
  }
30
30
  onClose(item) {
31
31
  var _a, _b;
@@ -51,7 +51,7 @@ class XMessageComponent {
51
51
  }
52
52
  }
53
53
  trackByNode(_index, item) {
54
- return `${item.title}-${item.content}`;
54
+ return item.id;
55
55
  }
56
56
  }
57
57
  /** @nocollapse */ /** @nocollapse */ XMessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XMessageComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
@@ -61,6 +61,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
61
61
  args: [{ selector: `${XMessagePrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [XMoveAnimation], template: "<div class=\"x-message\">\r\n <ng-container *ngFor=\"let item of message.list; trackBy: trackByNode\">\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type\"\r\n [effect]=\"item.effect\"\r\n [hideClose]=\"item.hideClose\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon\"\r\n duration=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n </ng-container>\r\n</div>\r\n", styles: [".x-message{margin:0;padding:0}.x-message>x-alert{padding:.25rem 0}.x-message>x-alert>.x-alert{box-shadow:var(--x-box-shadow) var(--x-box-shadow-light-color)}.x-message-portal x-message{width:100%}\n"] }]
62
62
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
63
63
 
64
+ // TODO: add more function
65
+ class XMessageRef {
66
+ constructor(option) {
67
+ this.close = () => { };
68
+ this.closeAll = () => { };
69
+ this.update = (_option) => { };
70
+ if (!option.id)
71
+ option.id = `${new Date().getTime()}`;
72
+ this.option = option;
73
+ }
74
+ }
75
+
64
76
  class XMessageService {
65
77
  constructor(portal, configService) {
66
78
  this.portal = portal;
@@ -93,6 +105,9 @@ class XMessageService {
93
105
  error(option) {
94
106
  return this.createMessage(option, 'error');
95
107
  }
108
+ loading(option) {
109
+ return this.createMessage(option, 'loading');
110
+ }
96
111
  create(option) {
97
112
  const offset = XIsString(option.offset) ? [option.offset] : option.offset;
98
113
  return this.portal.attach({
@@ -113,7 +128,22 @@ class XMessageService {
113
128
  opt.type = type;
114
129
  }
115
130
  fillDefault(opt, this.default);
116
- return this.createMessagePlacement(opt);
131
+ const ref = new XMessageRef(opt);
132
+ if (XIsUndefined(opt.placement)) {
133
+ return ref;
134
+ }
135
+ ref.close = () => {
136
+ this.removeMessage(opt);
137
+ };
138
+ ref.closeAll = () => {
139
+ this.closeAll();
140
+ };
141
+ ref.update = (_opt) => {
142
+ this.updateMessage(_opt, opt);
143
+ };
144
+ this.setDuration(opt);
145
+ this.createMessagePlacement(opt);
146
+ return ref;
117
147
  }
118
148
  closeAll(excludeOption) {
119
149
  for (let key in this.messages) {
@@ -124,28 +154,22 @@ class XMessageService {
124
154
  }
125
155
  createMessagePlacement(option) {
126
156
  var _a, _b;
127
- if (typeof option.placement === 'undefined')
128
- return { ref: {}, list: [], currentClose: () => { }, closeAll: () => { } };
129
157
  let msgPlacement = this.messages[option.placement];
130
- this.setDuration(option);
131
158
  if (XIsEmpty(msgPlacement) || !((_b = (_a = msgPlacement.ref) === null || _a === void 0 ? void 0 : _a.overlayRef) === null || _b === void 0 ? void 0 : _b.hasAttached())) {
132
159
  this.messages[option.placement] = {
133
160
  ref: this.create(option),
134
161
  list: [option],
135
- currentClose: () => {
136
- this.removeMessage(option);
137
- },
138
162
  closeAll: () => {
139
163
  this.closeAll();
140
164
  }
141
165
  };
166
+ msgPlacement = this.messages[option.placement];
142
167
  }
143
168
  else {
144
- this.messages[option.placement].list = [...this.messages[option.placement].list, option];
169
+ msgPlacement.list = [...this.messages[option.placement].list, option];
145
170
  }
146
- this.messageChange(this.messages[option.placement]);
171
+ this.messageChange(msgPlacement);
147
172
  option.displayType === 'single' && this.closeAll(option);
148
- return this.messages[option.placement];
149
173
  }
150
174
  messageChange(message) {
151
175
  var _a, _b, _c, _d;
@@ -155,7 +179,7 @@ class XMessageService {
155
179
  message.ref.componentRef.instance.cdr.detectChanges();
156
180
  }
157
181
  setDuration(option) {
158
- if (option.duration) {
182
+ if (option.duration && option.type !== 'loading') {
159
183
  option.duration$ = of(true)
160
184
  .pipe(delay(option.duration))
161
185
  .subscribe(() => {
@@ -169,6 +193,15 @@ class XMessageService {
169
193
  return;
170
194
  (_b = (_a = this.messages[option.placement].ref) === null || _a === void 0 ? void 0 : _a.componentRef) === null || _b === void 0 ? void 0 : _b.instance.onClose(option);
171
195
  }
196
+ updateMessage(newOption, oldOption) {
197
+ var _a;
198
+ Object.assign(oldOption, newOption);
199
+ this.setDuration(oldOption);
200
+ const refs = this.messages[oldOption.placement];
201
+ if (refs) {
202
+ (_a = refs.ref.componentRef) === null || _a === void 0 ? void 0 : _a.instance.cdr.detectChanges();
203
+ }
204
+ }
172
205
  }
173
206
  /** @nocollapse */ /** @nocollapse */ XMessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XMessageService, deps: [{ token: i1$1.XPortalService }, { token: i2$1.XConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
174
207
  /** @nocollapse */ /** @nocollapse */ XMessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XMessageService });
@@ -195,5 +228,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
195
228
  * Generated bundle index. Do not edit.
196
229
  */
197
230
 
198
- export { XMessageComponent, XMessageModule, XMessagePortal, XMessagePrefix, XMessageService, X_MESSAGE_CONFIG_NAME };
231
+ export { XMessageComponent, XMessageModule, XMessagePortal, XMessagePrefix, XMessageRef, XMessageService, X_MESSAGE_CONFIG_NAME };
199
232
  //# sourceMappingURL=ng-nest-ui-message.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ng-nest-ui-message.mjs","sources":["../../../../lib/ng-nest/ui/message/message.property.ts","../../../../lib/ng-nest/ui/message/message.component.ts","../../../../lib/ng-nest/ui/message/message.component.html","../../../../lib/ng-nest/ui/message/message.service.ts","../../../../lib/ng-nest/ui/message/message.module.ts","../../../../lib/ng-nest/ui/message/ng-nest-ui-message.ts"],"sourcesContent":["import { XStatus, XPlace } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { Subscription, Subject } from 'rxjs';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { XMessageComponent } from './message.component';\r\n\r\n/**\r\n * Message\r\n * @selector x-message\r\n * @decorator component\r\n */\r\nexport const XMessagePrefix = 'x-message';\r\nexport const XMessagePortal = 'x-message-portal';\r\nexport const X_MESSAGE_CONFIG_NAME = 'message';\r\n\r\n/**\r\n * Message Option\r\n */\r\nexport interface XMessageOption extends XAlertOption {\r\n /**\r\n * @zh_CN 方位,九宫格\r\n * @en_US Direction, nine grid\r\n * @default 'top'\r\n * @withConfig true\r\n */\r\n placement?: XPlace;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '2rem'\r\n * @withConfig true\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n * @withConfig true\r\n */\r\n type?: XMessageType;\r\n /**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n * @default 'list'\r\n * @withConfig true\r\n */\r\n displayType?: XMessageDisplayType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @default '16rem'\r\n * @withConfig true\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 延迟关闭时间\r\n * @en_US Delay off time\r\n * @default 3000\r\n * @withConfig true\r\n */\r\n duration?: number;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n * @withConfig true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n * @withConfig true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 延迟关闭订阅后的对象,用来释放或取消\r\n * @en_US Delayed closing the subscribed object, used to release or cancel\r\n */\r\n duration$?: Subscription | null;\r\n /**\r\n * @zh_CN 延迟关闭订阅对象\r\n * @en_US Delay in closing the subscription object\r\n */\r\n durationSub?: Subject<any>;\r\n}\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XMessageOverlayRef extends XPortalOverlayRef<XMessageComponent> {}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in Jiugongge\r\n */\r\nexport interface XMessagePlacement {\r\n [property: string]: XMessageRef;\r\n}\r\n\r\nexport interface XMessageRef {\r\n ref: XMessageOverlayRef;\r\n list: XMessageOption[];\r\n currentClose: () => void;\r\n closeAll: () => void;\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XMessageType = XStatus;\r\n\r\n/**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n */\r\nexport type XMessageDisplayType = 'list' | 'single';\r\n","import { Component, ViewEncapsulation, Renderer2, ElementRef, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';\r\nimport { XMoveAnimation, XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XMessagePrefix, XMessageOption, XMessageRef } from './message.property';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: `${XMessagePrefix}`,\r\n templateUrl: './message.component.html',\r\n styleUrls: ['./message.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n animations: [XMoveAnimation]\r\n})\r\nexport class XMessageComponent {\r\n message: XMessageRef = { ref: {}, list: [], currentClose: () => {}, closeAll: () => {} };\r\n\r\n constructor(public renderer: Renderer2, public elementRef: ElementRef, public cdr: ChangeDetectorRef) {}\r\n\r\n onClose(item: XMessageOption) {\r\n this.message.list?.splice(this.message.list.indexOf(item), 1);\r\n item.duration$?.unsubscribe();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n moveDone($event: { toState: string }) {\r\n if ($event.toState === 'void' && XIsEmpty(this.message.list)) {\r\n this.message.ref?.overlayRef?.detach();\r\n }\r\n }\r\n\r\n onEnter(item: XMessageOption) {\r\n item.duration$?.unsubscribe();\r\n }\r\n\r\n onLeave(item: XMessageOption) {\r\n if (item.duration) {\r\n item.duration$ = of(true)\r\n .pipe(delay(item.duration))\r\n .subscribe(() => this.onClose(item));\r\n }\r\n }\r\n\r\n trackByNode(_index: number, item: XMessageOption) {\r\n return `${item.title}-${item.content}`;\r\n }\r\n}\r\n","<div class=\"x-message\">\r\n <ng-container *ngFor=\"let item of message.list; trackBy: trackByNode\">\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type\"\r\n [effect]=\"item.effect\"\r\n [hideClose]=\"item.hideClose\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon\"\r\n duration=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n </ng-container>\r\n</div>\r\n","import { Injectable } from '@angular/core';\r\nimport { XTemplate, XIsXTemplate, XIsEmpty, fillDefault, XIsString, XConfigService, XMessageConfig } from '@ng-nest/ui/core';\r\nimport {\r\n XMessageOverlayRef,\r\n XMessageType,\r\n XMessagePlacement,\r\n XMessageRef,\r\n XMessagePortal,\r\n XMessageOption,\r\n X_MESSAGE_CONFIG_NAME\r\n} from './message.property';\r\nimport { XMessageComponent } from './message.component';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\n\r\n@Injectable()\r\nexport class XMessageService {\r\n messages: XMessagePlacement = {};\r\n\r\n default: XMessageOption = {\r\n type: 'info',\r\n width: '16rem',\r\n placement: 'top',\r\n offset: '2rem',\r\n effect: 'white',\r\n displayType: 'list',\r\n duration: 3000,\r\n hideClose: true,\r\n showIcon: true,\r\n hide: false\r\n };\r\n\r\n configDefault?: XMessageConfig;\r\n\r\n constructor(public portal: XPortalService, public configService: XConfigService) {\r\n this.configDefault = this.configService.getConfigForComponent(X_MESSAGE_CONFIG_NAME);\r\n Object.assign(this.default, this.configDefault);\r\n }\r\n\r\n info(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'info');\r\n }\r\n\r\n success(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'success');\r\n }\r\n\r\n warning(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'warning');\r\n }\r\n\r\n error(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'error');\r\n }\r\n\r\n create(option: XMessageOption): XMessageOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n\r\n return this.portal.attach({\r\n content: XMessageComponent,\r\n overlayConfig: {\r\n panelClass: XMessagePortal,\r\n positionStrategy: this.portal.setPlace(option.placement, option.width, option.height, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private createMessage(option: XTemplate | XMessageOption, type: XMessageType): XMessageRef {\r\n let opt: XMessageOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate, type: type };\r\n } else {\r\n opt = option as XMessageOption;\r\n opt.type = type;\r\n }\r\n fillDefault(opt, this.default);\r\n return this.createMessagePlacement(opt);\r\n }\r\n\r\n private closeAll(excludeOption?: XMessageOption) {\r\n for (let key in this.messages) {\r\n for (let option of this.messages[key].list) {\r\n option !== excludeOption && this.removeMessage(option);\r\n }\r\n }\r\n }\r\n\r\n private createMessagePlacement(option: XMessageOption): XMessageRef {\r\n if (typeof option.placement === 'undefined') return { ref: {}, list: [], currentClose: () => {}, closeAll: () => {} };\r\n let msgPlacement = this.messages[option.placement];\r\n this.setDuration(option);\r\n if (XIsEmpty(msgPlacement) || !msgPlacement.ref?.overlayRef?.hasAttached()) {\r\n this.messages[option.placement] = {\r\n ref: this.create(option),\r\n list: [option],\r\n currentClose: () => {\r\n this.removeMessage(option);\r\n },\r\n closeAll: () => {\r\n this.closeAll();\r\n }\r\n };\r\n } else {\r\n this.messages[option.placement].list = [...(this.messages[option.placement].list as XMessageOption[]), option];\r\n }\r\n this.messageChange(this.messages[option.placement]);\r\n\r\n option.displayType === 'single' && this.closeAll(option);\r\n\r\n return this.messages[option.placement];\r\n }\r\n\r\n private messageChange(message: XMessageRef) {\r\n if (!message.ref?.overlayRef?.hasAttached() || !message?.ref?.componentRef?.instance) return;\r\n message.ref.componentRef.instance.message = message;\r\n message.ref.componentRef.instance.cdr.detectChanges();\r\n }\r\n\r\n private setDuration(option: XMessageOption) {\r\n if (option.duration) {\r\n option.duration$ = of(true)\r\n .pipe(delay(option.duration))\r\n .subscribe(() => {\r\n this.removeMessage(option);\r\n });\r\n }\r\n }\r\n\r\n private removeMessage(option: XMessageOption) {\r\n if (typeof option.placement === 'undefined') return;\r\n this.messages[option.placement].ref?.componentRef?.instance.onClose(option);\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { XMessageComponent } from './message.component';\r\nimport { XAlertModule } from '@ng-nest/ui/alert';\r\nimport { XMessageService } from './message.service';\r\nimport { XPortalModule } from '@ng-nest/ui/portal';\r\n\r\n@NgModule({\r\n declarations: [XMessageComponent],\r\n exports: [XMessageComponent],\r\n imports: [CommonModule, XPortalModule, XAlertModule],\r\n providers: [XMessageService]\r\n})\r\nexport class XMessageModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAMA;;;;;MAKa,cAAc,GAAG,YAAY;MAC7B,cAAc,GAAG,mBAAmB;MACpC,qBAAqB,GAAG;;MCCxB,iBAAiB;IAG5B,YAAmB,QAAmB,EAAS,UAAsB,EAAS,GAAsB;QAAjF,aAAQ,GAAR,QAAQ,CAAW;QAAS,eAAU,GAAV,UAAU,CAAY;QAAS,QAAG,GAAH,GAAG,CAAmB;QAFpG,YAAO,GAAgB,EAAE,GAAG,EAAE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,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;KACvD;IAEO,WAAW,CAAC,MAAsB;QACxC,IAAI,MAAM,CAAC,QAAQ,EAAE;YACnB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC;iBACxB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;iBAC5B,SAAS,CAAC;gBACT,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;aAC5B,CAAC,CAAC;SACN;KACF;IAEO,aAAa,CAAC,MAAsB;;QAC1C,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,WAAW;YAAE,OAAO;QACpD,MAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,0CAAE,YAAY,0CAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KAC7E;;kJAnHU,eAAe;sJAAf,eAAe;2FAAf,eAAe;kBAD3B,UAAU;;;MCHE,cAAc;;iJAAd,cAAc;kJAAd,cAAc,iBALV,iBAAiB,aAEtB,YAAY,EAAE,aAAa,EAAE,YAAY,aADzC,iBAAiB;kJAIhB,cAAc,aAFd,CAAC,eAAe,CAAC,YADnB,CAAC,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC;2FAGzC,cAAc;kBAN1B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC;oBACpD,SAAS,EAAE,CAAC,eAAe,CAAC;iBAC7B;;;ACZD;;;;;;"}
1
+ {"version":3,"file":"ng-nest-ui-message.mjs","sources":["../../../../lib/ng-nest/ui/message/message.property.ts","../../../../lib/ng-nest/ui/message/message.component.ts","../../../../lib/ng-nest/ui/message/message.component.html","../../../../lib/ng-nest/ui/message/message-ref.ts","../../../../lib/ng-nest/ui/message/message.service.ts","../../../../lib/ng-nest/ui/message/message.module.ts","../../../../lib/ng-nest/ui/message/ng-nest-ui-message.ts"],"sourcesContent":["import { XStatus, XPlace } from '@ng-nest/ui/core';\r\nimport { XAlertOption } from '@ng-nest/ui/alert';\r\nimport { Subscription, Subject } from 'rxjs';\r\nimport { XPortalOverlayRef } from '@ng-nest/ui/portal';\r\nimport { XMessageComponent } from './message.component';\r\n\r\n/**\r\n * Message\r\n * @selector x-message\r\n * @decorator component\r\n */\r\nexport const XMessagePrefix = 'x-message';\r\nexport const XMessagePortal = 'x-message-portal';\r\nexport const X_MESSAGE_CONFIG_NAME = 'message';\r\n\r\n/**\r\n * Message Option\r\n */\r\nexport interface XMessageOption extends XAlertOption {\r\n /**\r\n * @zh_CN 消息框的 id\r\n * @en_US Message id\r\n */\r\n id?: string;\r\n /**\r\n * @zh_CN 方位,九宫格\r\n * @en_US Direction, nine grid\r\n * @default 'top'\r\n * @withConfig true\r\n */\r\n placement?: XPlace;\r\n /**\r\n * @zh_CN 偏移距离\r\n * @en_US Offset distance\r\n * @default '2rem'\r\n * @withConfig true\r\n */\r\n offset?: string | string[];\r\n /**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n * @default 'info'\r\n * @withConfig true\r\n */\r\n type?: XMessageType;\r\n /**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n * @default 'list'\r\n * @withConfig true\r\n */\r\n displayType?: XMessageDisplayType;\r\n /**\r\n * @zh_CN 宽度\r\n * @en_US Width\r\n * @default '16rem'\r\n * @withConfig true\r\n */\r\n width?: string;\r\n /**\r\n * @zh_CN 高度\r\n * @en_US Height\r\n */\r\n height?: string;\r\n /**\r\n * @zh_CN 延迟关闭时间\r\n * @en_US Delay off time\r\n * @default 3000\r\n * @withConfig true\r\n */\r\n duration?: number;\r\n /**\r\n * @zh_CN 隐藏关闭按钮\r\n * @en_US Hide close button\r\n * @default true\r\n * @withConfig true\r\n */\r\n hideClose?: boolean;\r\n /**\r\n * @zh_CN 显示图标\r\n * @en_US Show icon\r\n * @default true\r\n * @withConfig true\r\n */\r\n showIcon?: boolean;\r\n /**\r\n * @zh_CN 延迟关闭订阅后的对象,用来释放或取消\r\n * @en_US Delayed closing the subscribed object, used to release or cancel\r\n */\r\n duration$?: Subscription | null;\r\n /**\r\n * @zh_CN 延迟关闭订阅对象\r\n * @en_US Delay in closing the subscription object\r\n */\r\n durationSub?: Subject<any>;\r\n}\r\n\r\n/**\r\n * @zh_CN 创建的消息对象\r\n * @en_US Message object created\r\n */\r\nexport interface XMessageOverlayRef extends XPortalOverlayRef<XMessageComponent> {}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in Jiugongge\r\n */\r\nexport interface XMessagePlacement {\r\n [property: string]: XMessagePlacementRef;\r\n}\r\n\r\n/**\r\n * @zh_CN 九宫格中的消息对象\r\n * @en_US Message object in Jiugongge\r\n */\r\nexport interface XMessagePlacementRef {\r\n /**\r\n * @zh_CN 方位对应的 overlayRef\r\n * @en_US Placement overlayRef\r\n */\r\n ref: XMessageOverlayRef;\r\n /**\r\n * @zh_CN 对应的消息 list 数据\r\n * @en_US Corresponding message list data\r\n */\r\n list: XMessageOption[];\r\n /**\r\n * @zh_CN 关闭所有数据\r\n * @en_US Close all data\r\n */\r\n closeAll: () => void;\r\n}\r\n\r\n/**\r\n * @zh_CN 类型\r\n * @en_US Types of\r\n */\r\nexport type XMessageType = XStatus;\r\n\r\n/**\r\n * @zh_CN 多个消息的时候,显示类型\r\n * @en_US When multiple messages, the display type\r\n */\r\nexport type XMessageDisplayType = 'list' | 'single';\r\n","import { Component, ViewEncapsulation, Renderer2, ElementRef, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';\r\nimport { XMoveAnimation, XIsEmpty } from '@ng-nest/ui/core';\r\nimport { XMessagePrefix, XMessageOption, XMessagePlacementRef } from './message.property';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: `${XMessagePrefix}`,\r\n templateUrl: './message.component.html',\r\n styleUrls: ['./message.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n animations: [XMoveAnimation]\r\n})\r\nexport class XMessageComponent {\r\n message: XMessagePlacementRef = { ref: {}, list: [], closeAll: () => {} };\r\n\r\n constructor(public renderer: Renderer2, public elementRef: ElementRef, public cdr: ChangeDetectorRef) {}\r\n\r\n onClose(item: XMessageOption) {\r\n this.message.list?.splice(this.message.list.indexOf(item), 1);\r\n item.duration$?.unsubscribe();\r\n this.cdr.detectChanges();\r\n }\r\n\r\n moveDone($event: { toState: string }) {\r\n if ($event.toState === 'void' && XIsEmpty(this.message.list)) {\r\n this.message.ref?.overlayRef?.detach();\r\n }\r\n }\r\n\r\n onEnter(item: XMessageOption) {\r\n item.duration$?.unsubscribe();\r\n }\r\n\r\n onLeave(item: XMessageOption) {\r\n if (item.duration) {\r\n item.duration$ = of(true)\r\n .pipe(delay(item.duration))\r\n .subscribe(() => this.onClose(item));\r\n }\r\n }\r\n\r\n trackByNode(_index: number, item: XMessageOption) {\r\n return item.id;\r\n }\r\n}\r\n","<div class=\"x-message\">\r\n <ng-container *ngFor=\"let item of message.list; trackBy: trackByNode\">\r\n <x-alert\r\n [@x-move-animation]=\"item.placement\"\r\n (@x-move-animation.done)=\"moveDone($event)\"\r\n (mouseenter)=\"onEnter(item)\"\r\n (mouseleave)=\"onLeave(item)\"\r\n (close)=\"onClose(item)\"\r\n [hide]=\"item.hide\"\r\n [title]=\"item.title\"\r\n [content]=\"item.content\"\r\n [type]=\"item.type\"\r\n [effect]=\"item.effect\"\r\n [hideClose]=\"item.hideClose\"\r\n [closeText]=\"item.closeText\"\r\n [showIcon]=\"item.showIcon\"\r\n duration=\"0\"\r\n manual\r\n disabledAnimation\r\n ></x-alert>\r\n </ng-container>\r\n</div>\r\n","import { XMessageOption } from './message.property';\r\n\r\n// TODO: add more function\r\nexport class XMessageRef {\r\n option: XMessageOption;\r\n constructor(option: XMessageOption) {\r\n if (!option.id) option.id = `${new Date().getTime()}`;\r\n this.option = option;\r\n }\r\n close = () => {};\r\n closeAll = () => {};\r\n update = (_option: XMessageOption) => {};\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { XTemplate, XIsXTemplate, XIsEmpty, fillDefault, XIsString, XConfigService, XMessageConfig, XIsUndefined } from '@ng-nest/ui/core';\r\nimport {\r\n XMessageOverlayRef,\r\n XMessageType,\r\n XMessagePlacement,\r\n XMessagePortal,\r\n XMessageOption,\r\n X_MESSAGE_CONFIG_NAME,\r\n XMessagePlacementRef\r\n} from './message.property';\r\nimport { XMessageComponent } from './message.component';\r\nimport { of } from 'rxjs';\r\nimport { delay } from 'rxjs/operators';\r\nimport { XPortalService } from '@ng-nest/ui/portal';\r\nimport { XMessageRef } from './message-ref';\r\n\r\n@Injectable()\r\nexport class XMessageService {\r\n messages: XMessagePlacement = {};\r\n\r\n default: XMessageOption = {\r\n type: 'info',\r\n width: '16rem',\r\n placement: 'top',\r\n offset: '2rem',\r\n effect: 'white',\r\n displayType: 'list',\r\n duration: 3000,\r\n hideClose: true,\r\n showIcon: true,\r\n hide: false\r\n };\r\n\r\n configDefault?: XMessageConfig;\r\n\r\n constructor(public portal: XPortalService, public configService: XConfigService) {\r\n this.configDefault = this.configService.getConfigForComponent(X_MESSAGE_CONFIG_NAME);\r\n Object.assign(this.default, this.configDefault);\r\n }\r\n\r\n info(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'info');\r\n }\r\n\r\n success(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'success');\r\n }\r\n\r\n warning(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'warning');\r\n }\r\n\r\n error(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'error');\r\n }\r\n\r\n loading(option: XTemplate | XMessageOption): XMessageRef {\r\n return this.createMessage(option, 'loading');\r\n }\r\n\r\n create(option: XMessageOption): XMessageOverlayRef {\r\n const offset = XIsString(option.offset) ? [option.offset as string] : (option.offset as string[]);\r\n return this.portal.attach({\r\n content: XMessageComponent,\r\n overlayConfig: {\r\n panelClass: XMessagePortal,\r\n positionStrategy: this.portal.setPlace(option.placement, option.width, option.height, ...offset)\r\n }\r\n });\r\n }\r\n\r\n private createMessage(option: XTemplate | XMessageOption, type: XMessageType): XMessageRef {\r\n let opt: XMessageOption;\r\n if (XIsXTemplate(option)) {\r\n opt = { title: option as XTemplate, type: type };\r\n } else {\r\n opt = option as XMessageOption;\r\n opt.type = type;\r\n }\r\n fillDefault(opt, this.default);\r\n const ref = new XMessageRef(opt);\r\n if (XIsUndefined(opt.placement)) {\r\n return ref;\r\n }\r\n ref.close = () => {\r\n this.removeMessage(opt);\r\n };\r\n ref.closeAll = () => {\r\n this.closeAll();\r\n };\r\n ref.update = (_opt) => {\r\n this.updateMessage(_opt, opt);\r\n };\r\n this.setDuration(opt);\r\n this.createMessagePlacement(opt);\r\n\r\n return ref;\r\n }\r\n\r\n private closeAll(excludeOption?: XMessageOption) {\r\n for (let key in this.messages) {\r\n for (let option of this.messages[key].list) {\r\n option !== excludeOption && this.removeMessage(option);\r\n }\r\n }\r\n }\r\n\r\n private createMessagePlacement(option: XMessageOption) {\r\n let msgPlacement = this.messages[option.placement!];\r\n if (XIsEmpty(msgPlacement) || !msgPlacement.ref?.overlayRef?.hasAttached()) {\r\n this.messages[option.placement!] = {\r\n ref: this.create(option),\r\n list: [option],\r\n closeAll: () => {\r\n this.closeAll();\r\n }\r\n };\r\n msgPlacement = this.messages[option.placement!];\r\n } else {\r\n msgPlacement.list = [...(this.messages[option.placement!].list as XMessageOption[]), option];\r\n }\r\n this.messageChange(msgPlacement);\r\n\r\n option.displayType === 'single' && this.closeAll(option);\r\n }\r\n\r\n private messageChange(message: XMessagePlacementRef) {\r\n if (!message.ref?.overlayRef?.hasAttached() || !message?.ref?.componentRef?.instance) return;\r\n message.ref.componentRef.instance.message = message;\r\n message.ref.componentRef.instance.cdr.detectChanges();\r\n }\r\n\r\n private setDuration(option: XMessageOption) {\r\n if (option.duration && option.type !== 'loading') {\r\n option.duration$ = of(true)\r\n .pipe(delay(option.duration))\r\n .subscribe(() => {\r\n this.removeMessage(option);\r\n });\r\n }\r\n }\r\n\r\n private removeMessage(option: XMessageOption) {\r\n if (typeof option.placement === 'undefined') return;\r\n this.messages[option.placement].ref?.componentRef?.instance.onClose(option);\r\n }\r\n\r\n private updateMessage(newOption: XMessageOption, oldOption: XMessageOption) {\r\n Object.assign(oldOption, newOption);\r\n this.setDuration(oldOption);\r\n const refs = this.messages[oldOption.placement!];\r\n if (refs) {\r\n refs.ref.componentRef?.instance.cdr.detectChanges();\r\n }\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { XMessageComponent } from './message.component';\r\nimport { XAlertModule } from '@ng-nest/ui/alert';\r\nimport { XMessageService } from './message.service';\r\nimport { XPortalModule } from '@ng-nest/ui/portal';\r\n\r\n@NgModule({\r\n declarations: [XMessageComponent],\r\n exports: [XMessageComponent],\r\n imports: [CommonModule, XPortalModule, XAlertModule],\r\n providers: [XMessageService]\r\n})\r\nexport class XMessageModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAMA;;;;;MAKa,cAAc,GAAG,YAAY;MAC7B,cAAc,GAAG,mBAAmB;MACpC,qBAAqB,GAAG;;MCCxB,iBAAiB;IAG5B,YAAmB,QAAmB,EAAS,UAAsB,EAAS,GAAsB;QAAjF,aAAQ,GAAR,QAAQ,CAAW;QAAS,eAAU,GAAV,UAAU,CAAY;QAAS,QAAG,GAAH,GAAG,CAAmB;QAFpG,YAAO,GAAyB,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAQ,EAAE,C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AC,SAAU,CAAC,CAAC;QACjD,IAAI,IAAI,EAAE;YACR,MAAA,IAAI,CAAC,GAAG,CAAC,YAAY,0CAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;SACrD;KACF;;kJAzIU,eAAe;sJAAf,eAAe;2FAAf,eAAe;kBAD3B,UAAU;;;MCJE,cAAc;;iJAAd,cAAc;kJAAd,cAAc,iBALV,iBAAiB,aAEtB,YAAY,EAAE,aAAa,EAAE,YAAY,aADzC,iBAAiB;kJAIhB,cAAc,aAFd,CAAC,eAAe,CAAC,YADnB,CAAC,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC;2FAGzC,cAAc;kBAN1B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC;oBACpD,SAAS,EAAE,CAAC,eAAe,CAAC;iBAC7B;;;ACZD;;;;;;"}
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { EventEmitter, Component, Input, Output, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
3
  import { __decorate } from 'tslib';
4
4
  import * as i1 from '@ng-nest/ui/core';
5
- import { XProperty, XWithConfig } from '@ng-nest/ui/core';
5
+ import { XProperty, XWithConfig, XInputBoolean } from '@ng-nest/ui/core';
6
6
  import { Subject } from 'rxjs';
7
7
  import { map, takeUntil } from 'rxjs/operators';
8
8
  import * as i2 from '@ng-nest/ui/i18n';
@@ -43,7 +43,7 @@ class XPopconfirmProperty extends XProperty {
43
43
  }
44
44
  }
45
45
  /** @nocollapse */ /** @nocollapse */ XPopconfirmProperty.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XPopconfirmProperty, deps: null, target: i0.ɵɵFactoryTarget.Component });
46
- /** @nocollapse */ /** @nocollapse */ XPopconfirmProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XPopconfirmProperty, selector: "ng-component", inputs: { title: "title", content: "content", placement: "placement", trigger: "trigger", width: "width", icon: "icon", iconColor: "iconColor", cancelText: "cancelText", confirmText: "confirmText" }, outputs: { cancel: "cancel", confirm: "confirm" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
46
+ /** @nocollapse */ /** @nocollapse */ XPopconfirmProperty.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XPopconfirmProperty, selector: "ng-component", inputs: { title: "title", content: "content", placement: "placement", trigger: "trigger", width: "width", icon: "icon", iconColor: "iconColor", cancelText: "cancelText", confirmText: "confirmText", confirmAsync: "confirmAsync", condition: "condition" }, outputs: { cancel: "cancel", confirm: "confirm" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
47
47
  __decorate([
48
48
  XWithConfig(X_CONFIG_NAME, 'bottom')
49
49
  ], XPopconfirmProperty.prototype, "placement", void 0);
@@ -65,6 +65,9 @@ __decorate([
65
65
  __decorate([
66
66
  XWithConfig(X_CONFIG_NAME)
67
67
  ], XPopconfirmProperty.prototype, "confirmText", void 0);
68
+ __decorate([
69
+ XInputBoolean()
70
+ ], XPopconfirmProperty.prototype, "condition", void 0);
68
71
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XPopconfirmProperty, decorators: [{
69
72
  type: Component,
70
73
  args: [{ template: '' }]
@@ -86,6 +89,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
86
89
  type: Input
87
90
  }], confirmText: [{
88
91
  type: Input
92
+ }], confirmAsync: [{
93
+ type: Input
94
+ }], condition: [{
95
+ type: Input
89
96
  }], cancel: [{
90
97
  type: Output
91
98
  }], confirm: [{
@@ -101,7 +108,9 @@ class XPopconfirmComponent extends XPopconfirmProperty {
101
108
  this.configService = configService;
102
109
  this.i18n = i18n;
103
110
  this.locale = {};
111
+ this.loading = false;
104
112
  this._unSubject = new Subject();
113
+ this._asyncUnSub = new Subject();
105
114
  }
106
115
  get getCancelText() {
107
116
  return this.cancelText || this.locale.cancelText;
@@ -117,20 +126,39 @@ class XPopconfirmComponent extends XPopconfirmProperty {
117
126
  this.cdr.markForCheck();
118
127
  });
119
128
  }
129
+ ngOnDestroy() {
130
+ this._unSubject.next();
131
+ this._unSubject.complete();
132
+ }
120
133
  onCancel() {
121
134
  this.visible = false;
122
135
  this.cancel.emit();
123
136
  }
124
137
  onConfirm() {
125
- this.visible = false;
126
- this.confirm.emit();
138
+ if (this.confirmAsync) {
139
+ this.loading = true;
140
+ this.confirmAsync.pipe(takeUntil(this._asyncUnSub)).subscribe(() => {
141
+ this.loading = false;
142
+ this.visible = false;
143
+ this.confirm.emit();
144
+ this.cdr.detectChanges();
145
+ this._asyncUnSub.next();
146
+ });
147
+ }
148
+ else {
149
+ this.visible = false;
150
+ this.confirm.emit();
151
+ }
152
+ }
153
+ onClick() {
154
+ this.condition && this.onConfirm();
127
155
  }
128
156
  }
129
157
  /** @nocollapse */ /** @nocollapse */ XPopconfirmComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XPopconfirmComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.XConfigService }, { token: i2.XI18nService }], target: i0.ɵɵFactoryTarget.Component });
130
- /** @nocollapse */ /** @nocollapse */ XPopconfirmComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XPopconfirmComponent, selector: "x-popconfirm", usesInheritance: true, ngImport: i0, template: "<div\r\n #popconfirm\r\n class=\"x-popconfirm\"\r\n x-popover\r\n [title]=\"titleTpl\"\r\n [content]=\"content\"\r\n [footer]=\"footerTpl\"\r\n [placement]=\"placement\"\r\n [trigger]=\"trigger\"\r\n [width]=\"width\"\r\n [(visible)]=\"visible\"\r\n>\r\n <ng-content></ng-content>\r\n</div>\r\n\r\n<ng-template #titleTpl>\r\n <div class=\"x-popconfirm-title\">\r\n <ng-container *xOutlet=\"title\">\r\n <x-icon *ngIf=\"icon\" [style.color]=\"iconColor\" [type]=\"icon\"></x-icon>\r\n <span>{{ title }}</span>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #footerTpl>\r\n <div class=\"x-popconfirm-buttons\">\r\n <x-button (click)=\"onCancel()\">{{ getCancelText }}</x-button>\r\n <x-button type=\"primary\" (click)=\"onConfirm()\">{{ getConfirmText }}</x-button>\r\n </div>\r\n</ng-template>\r\n", styles: [".x-popconfirm{margin:0;padding:0;display:inline-block}.x-popconfirm-buttons{display:flex;justify-content:flex-end}.x-popconfirm-buttons>x-button:not(:first-child){margin-left:.5rem}.x-popconfirm-title{display:flex;align-items:center}.x-popconfirm-title>.x-icon{margin-right:.325rem;font-size:1rem}\n"], components: [{ type: i3.XIconComponent, selector: "x-icon" }, { type: i4.XButtonComponent, selector: "x-button" }], directives: [{ type: i5.XPopoverDirective, selector: "[x-popover], x-popover" }, { type: i6.XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
158
+ /** @nocollapse */ /** @nocollapse */ XPopconfirmComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: XPopconfirmComponent, selector: "x-popconfirm", usesInheritance: true, ngImport: i0, template: "<div\r\n #popconfirm\r\n class=\"x-popconfirm\"\r\n x-popover\r\n [title]=\"titleTpl\"\r\n [content]=\"content\"\r\n [footer]=\"footerTpl\"\r\n [placement]=\"placement\"\r\n [trigger]=\"trigger\"\r\n [width]=\"width\"\r\n [condition]=\"condition\"\r\n [(visible)]=\"visible\"\r\n (click)=\"onClick()\"\r\n>\r\n <ng-content></ng-content>\r\n</div>\r\n\r\n<ng-template #titleTpl>\r\n <div class=\"x-popconfirm-title\">\r\n <ng-container *xOutlet=\"title\">\r\n <x-icon *ngIf=\"icon\" [style.color]=\"iconColor\" [type]=\"icon\"></x-icon>\r\n <span>{{ title }}</span>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #footerTpl>\r\n <div class=\"x-popconfirm-buttons\">\r\n <x-button (click)=\"onCancel()\">{{ getCancelText }}</x-button>\r\n <x-button type=\"primary\" (click)=\"onConfirm()\" [loading]=\"loading\">{{ getConfirmText }}</x-button>\r\n </div>\r\n</ng-template>\r\n", styles: [".x-popconfirm{margin:0;padding:0;display:inline-block}.x-popconfirm-buttons{display:flex;justify-content:flex-end}.x-popconfirm-buttons>x-button:not(:first-child){margin-left:.5rem}.x-popconfirm-title{display:flex;align-items:center}.x-popconfirm-title>.x-icon{margin-right:.325rem;font-size:1rem}\n"], components: [{ type: i3.XIconComponent, selector: "x-icon" }, { type: i4.XButtonComponent, selector: "x-button" }], directives: [{ type: i5.XPopoverDirective, selector: "[x-popover], x-popover" }, { type: i6.XOutletDirective, selector: "[xOutlet]", inputs: ["xOutletContext", "xOutlet"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
131
159
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: XPopconfirmComponent, decorators: [{
132
160
  type: Component,
133
- args: [{ selector: `${XPopconfirmPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n #popconfirm\r\n class=\"x-popconfirm\"\r\n x-popover\r\n [title]=\"titleTpl\"\r\n [content]=\"content\"\r\n [footer]=\"footerTpl\"\r\n [placement]=\"placement\"\r\n [trigger]=\"trigger\"\r\n [width]=\"width\"\r\n [(visible)]=\"visible\"\r\n>\r\n <ng-content></ng-content>\r\n</div>\r\n\r\n<ng-template #titleTpl>\r\n <div class=\"x-popconfirm-title\">\r\n <ng-container *xOutlet=\"title\">\r\n <x-icon *ngIf=\"icon\" [style.color]=\"iconColor\" [type]=\"icon\"></x-icon>\r\n <span>{{ title }}</span>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #footerTpl>\r\n <div class=\"x-popconfirm-buttons\">\r\n <x-button (click)=\"onCancel()\">{{ getCancelText }}</x-button>\r\n <x-button type=\"primary\" (click)=\"onConfirm()\">{{ getConfirmText }}</x-button>\r\n </div>\r\n</ng-template>\r\n", styles: [".x-popconfirm{margin:0;padding:0;display:inline-block}.x-popconfirm-buttons{display:flex;justify-content:flex-end}.x-popconfirm-buttons>x-button:not(:first-child){margin-left:.5rem}.x-popconfirm-title{display:flex;align-items:center}.x-popconfirm-title>.x-icon{margin-right:.325rem;font-size:1rem}\n"] }]
161
+ args: [{ selector: `${XPopconfirmPrefix}`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n #popconfirm\r\n class=\"x-popconfirm\"\r\n x-popover\r\n [title]=\"titleTpl\"\r\n [content]=\"content\"\r\n [footer]=\"footerTpl\"\r\n [placement]=\"placement\"\r\n [trigger]=\"trigger\"\r\n [width]=\"width\"\r\n [condition]=\"condition\"\r\n [(visible)]=\"visible\"\r\n (click)=\"onClick()\"\r\n>\r\n <ng-content></ng-content>\r\n</div>\r\n\r\n<ng-template #titleTpl>\r\n <div class=\"x-popconfirm-title\">\r\n <ng-container *xOutlet=\"title\">\r\n <x-icon *ngIf=\"icon\" [style.color]=\"iconColor\" [type]=\"icon\"></x-icon>\r\n <span>{{ title }}</span>\r\n </ng-container>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #footerTpl>\r\n <div class=\"x-popconfirm-buttons\">\r\n <x-button (click)=\"onCancel()\">{{ getCancelText }}</x-button>\r\n <x-button type=\"primary\" (click)=\"onConfirm()\" [loading]=\"loading\">{{ getConfirmText }}</x-button>\r\n </div>\r\n</ng-template>\r\n", styles: [".x-popconfirm{margin:0;padding:0;display:inline-block}.x-popconfirm-buttons{display:flex;justify-content:flex-end}.x-popconfirm-buttons>x-button:not(:first-child){margin-left:.5rem}.x-popconfirm-title{display:flex;align-items:center}.x-popconfirm-title>.x-icon{margin-right:.325rem;font-size:1rem}\n"] }]
134
162
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.XConfigService }, { type: i2.XI18nService }]; } });
135
163
 
136
164
  class XPopconfirmModule {