import { themesColorMap, themesAnimationMap } from '@fmsim/api' import MCSUnit from './mcs-unit.js' export default class MCSCarrierHolder extends MCSUnit { static get properties(): any { return [ ...MCSUnit.properties, { type: 'select', label: 'carrier-legend-name', name: 'carrierLegendName', property: { options: themesColorMap } }, { type: 'select', label: 'carrier-animation-name', name: 'carrierAnimationName', property: { options: themesAnimationMap } }, { type: 'boolean', label: 'show-carrier-text', name: 'showCarrierText' } ] } get showOverflow() { return true } get hierarchy() { return { ...super.hierarchy, components: [] } } dispose(): void { ;(this.root as any)?.carrierManager?.update(this, {}, this.data) super.dispose() } async ready() { super.ready() const { CARRIERNAME, CARRIERTYPE = '', EMPTYTYPE, CARRIERSTATUS } = this.data || {} if(CARRIERNAME) { ;(this.root as any).carrierManager.update(this, { CARRIERNAME, CARRIERTYPE, EMPTYTYPE, CARRIERSTATUS }, undefined) } } onchangeData(after: Record, before: Record): void { // CARRIERNAME, CARRIERTYPE = '', EMPTYTYPE, CARRIERSTATUS 이 변경되었을 때만 캐리어 관리자에게 알린다. const { CARRIERNAME, CARRIERTYPE = '', EMPTYTYPE, CARRIERSTATUS } = after.data || {} const { CARRIERNAME: beforeCARRIERNAME, CARRIERTYPE: beforeCARRIERTYPE = '', EMPTYTYPE: beforeEMPTYTYPE, CARRIERSTATUS: beforeCARRIERSTATUS } = before.data || {} if(CARRIERNAME !== beforeCARRIERNAME || CARRIERTYPE !== beforeCARRIERTYPE || EMPTYTYPE !== beforeEMPTYTYPE || CARRIERSTATUS !== beforeCARRIERSTATUS) { ;(this.root as any).carrierManager.update(this, { CARRIERNAME, CARRIERTYPE, EMPTYTYPE, CARRIERSTATUS }, { CARRIERNAME: beforeCARRIERNAME, CARRIERTYPE: beforeCARRIERTYPE, EMPTYTYPE: beforeEMPTYTYPE, CARRIERSTATUS: beforeCARRIERSTATUS }) } super.onchangeData(after, before) } }