{"version":3,"file":"ng-nest-ui-thought-chain.mjs","sources":["../../../../lib/ng-nest/ui/thought-chain/thought-chain.property.ts","../../../../lib/ng-nest/ui/thought-chain/thought-chain.component.ts","../../../../lib/ng-nest/ui/thought-chain/thought-chain.component.html","../../../../lib/ng-nest/ui/thought-chain/thought-chain.module.ts","../../../../lib/ng-nest/ui/thought-chain/ng-nest-ui-thought-chain.ts"],"sourcesContent":["import { Component, input, model } from '@angular/core';\r\nimport { XPropertyFunction, XBoolean, XToBoolean, XSize, XTemplate } from '@ng-nest/ui/core';\r\nimport { XTimelineNode } from '@ng-nest/ui/timeline';\r\nimport type { XLoadingType } from '@ng-nest/ui/loading';\r\n\r\n/**\r\n * ThoughtChain\r\n * @selector x-thought-chain\r\n * @decorator component\r\n */\r\nexport const XThoughtChainPrefix = 'x-thought-chain';\r\nconst X_THOUGHT_CHAIN_CONFIG_NAME = 'thoughtChain';\r\n\r\n/**\r\n * ThoughtChain Property\r\n */\r\n@Component({ selector: `${XThoughtChainPrefix}-property`, template: '' })\r\nexport class XThoughtChainProperty extends XPropertyFunction(X_THOUGHT_CHAIN_CONFIG_NAME) {\r\n  /**\r\n   * @zh_CN 思维链节点数据\r\n   * @en_US ThoughtChain items\r\n   */\r\n  readonly data = model<XThoughtChainNode[]>([]);\r\n  /**\r\n   * @zh_CN 显示序号\r\n   * @en_US Show number\r\n   */\r\n  readonly showNumber = input<boolean, XBoolean>(this.config?.showNumber ?? true, { transform: XToBoolean });\r\n  /**\r\n   * @zh_CN 尺寸\r\n   * @en_US Size\r\n   */\r\n  readonly size = input<XSize>(this.config?.size ?? 'medium');\r\n  /**\r\n   * @zh_CN 自定义内容模板\r\n   * @en_US Content template\r\n   */\r\n  readonly wrapper = input<XTemplate>();\r\n  /**\r\n   * @zh_CN 自定义图标模板\r\n   * @en_US Icon template\r\n   */\r\n  readonly icon = input<XTemplate>();\r\n  /**\r\n   * @zh_CN 节点标题右侧额外的内容模板\r\n   * @en_US Node extra content\r\n   */\r\n  readonly extra = input<XTemplate>();\r\n  /**\r\n   * @zh_CN 节点详细内容模板\r\n   * @en_US Node detail content\r\n   */\r\n  readonly content = input<XTemplate>();\r\n  /**\r\n   * @zh_CN 详细内容是否可折叠\r\n   * @en_US Collapsible detail content\r\n   */\r\n  readonly collapsible = input<boolean, XBoolean>(this.config?.collapsible ?? false, { transform: XToBoolean });\r\n  /**\r\n   * @zh_CN loading 的类型样式\r\n   * @en_US Loading type style\r\n   */\r\n  readonly loadingType = input<XLoadingType>(this.config?.loadingType ?? 'circular');\r\n}\r\n\r\n/**\r\n * @zh_CN 思维链节点\r\n * @en_US Thought chain node\r\n */\r\nexport interface XThoughtChainNode extends XTimelineNode {\r\n  /**\r\n   * @zh_CN 节点描述\r\n   * @en_US Node description\r\n   */\r\n  description?: string;\r\n  /**\r\n   * @zh_CN 节点状态\r\n   * @en_US Node status\r\n   */\r\n  status?: XThoughtChainNodeStatus;\r\n}\r\n\r\n/**\r\n * @zh_CN 节点状态\r\n * @en_US Node status\r\n */\r\nexport type XThoughtChainNodeStatus = 'success' | 'error' | 'pending';\r\n","import { ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, ViewEncapsulation } from '@angular/core';\r\nimport { XThoughtChainNode, XThoughtChainProperty } from './thought-chain.property';\r\nimport { XTimelineComponent } from '@ng-nest/ui/timeline';\r\nimport { XOutletDirective } from '@ng-nest/ui/outlet';\r\nimport { XIconComponent } from '@ng-nest/ui/icon';\r\nimport { XLoadingComponent } from '@ng-nest/ui/loading';\r\nimport { XCollapseModule } from '@ng-nest/ui/collapse';\r\n\r\n@Component({\r\n  selector: 'x-thought-chain',\r\n  templateUrl: './thought-chain.component.html',\r\n  styleUrls: ['./thought-chain.component.scss'],\r\n  encapsulation: ViewEncapsulation.None,\r\n  changeDetection: ChangeDetectionStrategy.OnPush,\r\n  imports: [XTimelineComponent, XOutletDirective, XIconComponent, XLoadingComponent, XCollapseModule]\r\n})\r\nexport class XThoughtChainComponent extends XThoughtChainProperty {\r\n  cdr = inject(ChangeDetectorRef);\r\n  addNode(node: XThoughtChainNode) {\r\n    this.data.update((x) => [...x, node]);\r\n  }\r\n\r\n  updateNode(node: XThoughtChainNode) {\r\n    const nd = this.data().find((x) => x.id === node.id);\r\n    if (nd) Object.assign(nd, node);\r\n    this.cdr.detectChanges();\r\n  }\r\n\r\n  removeNode(node: XThoughtChainNode) {\r\n    this.data.update((x) => [...x.filter((y) => y.id !== node.id)]);\r\n  }\r\n}\r\n","<div class=\"x-thought-chain\">\r\n  <x-timeline\r\n    [data]=\"data()\"\r\n    [showNumber]=\"showNumber()\"\r\n    [icon]=\"iconTpl\"\r\n    [wrapper]=\"wrapper() ?? wrapperTpl\"\r\n    [size]=\"size()\"\r\n  ></x-timeline>\r\n\r\n  <ng-template #iconTpl let-node=\"$node\" let-index=\"$index\">\r\n    <div\r\n      class=\"x-thought-chain-icon\"\r\n      [class.x-thought-chain-success]=\"node.status === 'success'\"\r\n      [class.x-thought-chain-error]=\"node.status === 'error'\"\r\n      [class.x-thought-chain-pending]=\"node.status === 'pending'\"\r\n      [style.backgroundColor]=\"node.color\"\r\n    >\r\n      @if (showNumber() && !node.icon && !node.loading && node.status !== 'pending') {\r\n        {{ index + 1 }}\r\n      }\r\n      @if (node.icon && !node.loading && node.status !== 'pending') {\r\n        <x-icon [type]=\"node.icon\"></x-icon>\r\n      }\r\n      @if (node.loading || node.status === 'pending') {\r\n        <x-loading inline [x-loading]=\"true\" [size]=\"size()\" [type]=\"loadingType()\"></x-loading>\r\n      }\r\n    </div>\r\n  </ng-template>\r\n\r\n  <ng-template #wrapperTpl let-node=\"$node\" let-index=\"$index\">\r\n    @if (collapsible()) {\r\n      <x-collapse class=\"x-thought-chain-collapse\" ghost iconPosition=\"left\">\r\n        <x-collapse-panel [label]=\"labelTpl\">\r\n          <ng-container *xOutlet=\"contentTpl\"></ng-container>\r\n        </x-collapse-panel>\r\n      </x-collapse>\r\n    } @else {\r\n      <ng-container *xOutlet=\"labelTpl\"></ng-container>\r\n      <ng-container *xOutlet=\"contentTpl\"></ng-container>\r\n    }\r\n    <ng-template #labelTpl>\r\n      <div class=\"x-thought-chain-wrapper\">\r\n        <div class=\"x-thought-chain-inner\">\r\n          <div class=\"x-thought-chain-label\">{{ node.label }}</div>\r\n          <div class=\"x-thought-chain-description\">{{ node.description }}</div>\r\n        </div>\r\n        <div class=\"x-thought-chain-extra\">\r\n          <ng-container *xOutlet=\"extra(); context: { $node: node, $index: index }\"></ng-container>\r\n        </div>\r\n      </div>\r\n    </ng-template>\r\n\r\n    <ng-template #contentTpl>\r\n      @if (node.content || content()) {\r\n        @if (content()) {\r\n          <div class=\"x-thought-chain-content\">\r\n            <ng-container *xOutlet=\"content(); context: { $node: node, $index: index }\"></ng-container>\r\n          </div>\r\n        } @else {\r\n          <div class=\"x-thought-chain-content\" [innerHTML]=\"node.content\"></div>\r\n        }\r\n      }\r\n    </ng-template>\r\n  </ng-template>\r\n</div>\r\n","import { NgModule } from '@angular/core';\r\nimport { XThoughtChainComponent } from './thought-chain.component';\r\n\r\n@NgModule({\r\n  exports: [XThoughtChainComponent],\r\n  imports: [XThoughtChainComponent]\r\n})\r\nexport class XThoughtChainModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAKA;;;;AAIG;AACI,MAAM,mBAAmB,GAAG;AACnC,MAAM,2BAA2B,GAAG,cAAc;AAElD;;AAEG;MAEU,qBAAsB,SAAQ,iBAAiB,CAAC,2BAA2B,CAAC,CAAA;AADzF,IAAA,WAAA,GAAA;;AAEE;;;AAGG;AACM,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAsB,EAAE,gDAAC;AAC9C;;;AAGG;AACM,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAoB,IAAI,CAAC,MAAM,EAAE,UAAU,IAAI,IAAI,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,YAAA,EAAA,GAAA,EAAA,CA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