{{>@macro/front-end/widgets/dashboard-detail/include-dashboard.hbs}}
<script setup lang="ts">
import { Subject } from 'rxjs';
import { ctrlState } from './{{spinalCase ctrl.codeName}}-dashboard-state';
import { DashboardControl, IActionParam, IParam, IContext } from '@core';

{{#each ctrl.psControls as | control |}}
{{#eq control.portletType "CONTAINER"}}
  {{#each control.psControls as | control2 |}}
  {{#if control2.psAppDataEntity}}
import { {{codeName}}Portlet } from '@widgets/{{spinalCase control2.psAppDataEntity.codeName}}/{{spinalCase codeName}}-portlet';
  {{else}}
import { {{codeName}}Portlet } from '@widgets/app/{{spinalCase codeName}}-portlet';
  {{/if}}
  {{/each}}
{{/eq}}
{{#neq control.portletType "CONTAINER"}}
{{#if control.psAppDataEntity}}
import { {{codeName}}Portlet } from '@widgets/{{spinalCase control.psAppDataEntity.codeName}}/{{spinalCase codeName}}-portlet';
{{else}}
import { {{codeName}}Portlet } from '@widgets/app/{{spinalCase codeName}}-portlet';
{{/if}}
{{/neq}}
{{/each}}

interface Props {
  name:string,
  context: IContext;
  viewParams?: IParam;
  viewSubject: Subject<IActionParam>;
}

const props = withDefaults(defineProps < Props > (), {
  viewSubject: () => new Subject < IActionParam > (),
})

// emit声明
interface CtrlEmit {
  (name: "ctrlEvent", value: IActionParam): void;
}

const emit = defineEmits <CtrlEmit> ();

// 安装功能模块，提供状态和能力方法
const { name, state, onCtrlEvent } = new DashboardControl(ctrlState, props, emit).moduleInstall();

// 暴露内部状态及能力
defineExpose({ name, state });
</script>
<template>
  <div class="app-dashboard{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}">
    <template v-if="!state.isEnableCustomized">
      {{>(lookup 'DASHBOARD') ctrl=ctrl}}
    </template>
  </div>
</template>
<style lang="scss">
</style>