types.ts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * <<
  3. * Davinci
  4. * ==
  5. * Copyright (C) 2016 - 2017 EDP
  6. * ==
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * >>
  19. */
  20. import { IViewModel } from 'containers/View/types'
  21. import { Merge } from 'utils/types'
  22. import { IFilter } from 'app/components/Control/types'
  23. import { IQueryVariableMap } from 'containers/Dashboard/types'
  24. import {
  25. IWidgetDimension,
  26. IWidgetFilter,
  27. IWidgetMetric,
  28. IWidgetSecondaryMetric,
  29. IChartStyles,
  30. DimetionType,
  31. RenderType,
  32. WidgetMode,
  33. IPaginationParams,
  34. IWidgetConfig
  35. } from 'containers/Widget/components/Widget'
  36. import { IDataParamProperty } from 'containers/Widget/components/Workbench/OperatingPanel'
  37. import { number } from 'prop-types'
  38. export enum DrillType {
  39. UP = 'up',
  40. DOWN = 'down'
  41. }
  42. export enum DrillCharts {
  43. DRILLUP = 'drillUp',
  44. PIVOTROW = 'pivotRow',
  45. PIVOTCOL = 'pivotCol',
  46. DIMETIONAXISCOL = 'dimetionAxisCol',
  47. DIMETIONAXISROW = 'dimetionAxisRow',
  48. COUSTOMTABLE = 'coustomTable',
  49. DEFAULT = 'defaultScenes',
  50. PIVOT = 'pivot',
  51. COMMON = 'common'
  52. }
  53. export enum WidgetDimensions {
  54. COL = 'cols',
  55. ROW = 'rows'
  56. }
  57. export enum WidgetDimension {
  58. COL = 'col',
  59. ROW = 'row'
  60. }
  61. export interface IWidgetPool {
  62. [widgetId: number]: WidgetAbstract
  63. }
  64. export default class WidgetAbstract {
  65. public data: object[]
  66. public cols: IWidgetDimension[]
  67. public rows: IWidgetDimension[]
  68. public metrics: IWidgetMetric[]
  69. public secondaryMetrics?: IWidgetSecondaryMetric[]
  70. public filters: IWidgetFilter[]
  71. public chartStyles: IChartStyles
  72. public selectedChart: number
  73. public interacting?: boolean
  74. public color?: IDataParamProperty
  75. public label?: IDataParamProperty
  76. public size?: IDataParamProperty
  77. public xAxis?: IDataParamProperty
  78. public tip?: IDataParamProperty
  79. public yAxis?: IDataParamProperty
  80. public dimetionAxis?: DimetionType
  81. public renderType?: RenderType
  82. public orders: Array<{ column: string; direction: string }>
  83. public mode: WidgetMode
  84. public model: IViewModel
  85. public pagination?: IPaginationParams
  86. public queryVariables?: IQueryVariableMap
  87. public controls: any[]
  88. public limit: number
  89. public cache: boolean
  90. public expired: number
  91. public autoLoadData: boolean
  92. public initGroups?: string[]
  93. public initAggregators?: object[]
  94. }
  95. export interface IDrillDetail {
  96. type: DrillType
  97. groups: string[]
  98. filters: IFilter[]
  99. currentGroup: string // 对应原 name
  100. [WidgetDimensions.COL]?: IWidgetDimension[]
  101. [WidgetDimensions.ROW]?: IWidgetDimension[]
  102. }
  103. export type IDrillStrategies = Merge<
  104. Required<IDrillDetail>,
  105. { widgetProps: WidgetAbstract }
  106. >
  107. export interface ISourceDataFilter {
  108. key: string
  109. value: string
  110. }
  111. export interface IDataDrillProps {
  112. widgetConfig: IWidgetConfig
  113. drillHistory?: IDrillDetail[]
  114. key?: string | number
  115. currentData?: object[]
  116. onDataDrillPath?: () => any
  117. onDataDrillDown?: (name: string, dimensions?: WidgetDimension) => any
  118. onDataDrillUp?: (name: string) => any
  119. drillpathSetting?: []
  120. }
  121. export interface IEnhancerPanel {
  122. isSelectedfilter: object[]
  123. isSelectedGroup: string[]
  124. chartStyle: number
  125. }