constants.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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 OperatorTypes from 'utils/operatorTypes'
  21. export enum ControlTypes {
  22. Select = 'select',
  23. Radio = 'radio',
  24. Date = 'date',
  25. DateRange = 'dateRange',
  26. InputText = 'inputText',
  27. NumberRange = 'numberRange',
  28. Slider = 'slider',
  29. TreeSelect = 'treeSelect'
  30. }
  31. export const ControlTypesLocale = {
  32. [ControlTypes.Select]: '下拉菜单',
  33. [ControlTypes.Radio]: '单选按钮',
  34. [ControlTypes.Date]: '日期选择',
  35. [ControlTypes.DateRange]: '日期范围选择',
  36. [ControlTypes.InputText]: '文本输入框',
  37. [ControlTypes.NumberRange]: '数字范围输入框',
  38. [ControlTypes.Slider]: '数字滑块',
  39. [ControlTypes.TreeSelect]: '下拉树'
  40. }
  41. export enum ControlFieldTypes {
  42. Column = 'column',
  43. Variable = 'variable'
  44. }
  45. export enum ControlOptionTypes {
  46. Auto = 'auto',
  47. Manual = 'manual',
  48. Custom = 'custom'
  49. }
  50. export enum ControlDefaultValueTypes {
  51. Dynamic = 'dynamic',
  52. Fixed = 'fixed'
  53. }
  54. export enum ControlVisibilityTypes {
  55. Visible = 'visible',
  56. Hidden = 'hidden',
  57. Conditional = 'conditional'
  58. }
  59. export enum DatePickerFormats {
  60. Date = 'YYYY-MM-DD',
  61. Datetime = 'YYYY-MM-DD HH:mm:ss',
  62. DatetimeMinute = 'YYYY-MM-DD HH:mm',
  63. Month = 'YYYY-MM',
  64. Week = 'YYYY-ww',
  65. Year = 'YYYY'
  66. }
  67. export const DatePickerFormatsLocale = {
  68. [DatePickerFormats.Date]: '日期',
  69. [DatePickerFormats.Datetime]: '日期时间',
  70. [DatePickerFormats.DatetimeMinute]: '日期时间分钟',
  71. [DatePickerFormats.Month]: '月',
  72. [DatePickerFormats.Week]: '周',
  73. [DatePickerFormats.Year]: '年'
  74. }
  75. export const DatePickerFormatsSelectSetting = {
  76. normal: [
  77. DatePickerFormats.Date,
  78. DatePickerFormats.Datetime,
  79. DatePickerFormats.DatetimeMinute,
  80. DatePickerFormats.Month,
  81. DatePickerFormats.Week,
  82. DatePickerFormats.Year
  83. ],
  84. multiple: [
  85. DatePickerFormats.Date,
  86. DatePickerFormats.Month,
  87. DatePickerFormats.Year
  88. ]
  89. }
  90. export const SHOULD_LOAD_OPTIONS = {
  91. [ControlTypes.Select]: true,
  92. [ControlTypes.Radio]: true,
  93. [ControlTypes.Date]: false,
  94. [ControlTypes.DateRange]: false,
  95. [ControlTypes.InputText]: false,
  96. [ControlTypes.NumberRange]: false,
  97. [ControlTypes.Slider]: false,
  98. [ControlTypes.TreeSelect]: true
  99. }
  100. export const IS_RANGE_TYPE = {
  101. [ControlTypes.Select]: false,
  102. [ControlTypes.Radio]: false,
  103. [ControlTypes.Date]: false,
  104. [ControlTypes.DateRange]: true,
  105. [ControlTypes.InputText]: false,
  106. [ControlTypes.NumberRange]: true,
  107. [ControlTypes.Slider]: true,
  108. [ControlTypes.TreeSelect]: false
  109. }
  110. export const IS_DATE_TYPE = {
  111. [ControlTypes.Select]: false,
  112. [ControlTypes.Radio]: false,
  113. [ControlTypes.Date]: true,
  114. [ControlTypes.DateRange]: true,
  115. [ControlTypes.InputText]: false,
  116. [ControlTypes.NumberRange]: false,
  117. [ControlTypes.Slider]: false,
  118. [ControlTypes.TreeSelect]: false
  119. }
  120. export const IS_NUMBER_TYPE = {
  121. [ControlTypes.Select]: false,
  122. [ControlTypes.Radio]: false,
  123. [ControlTypes.Date]: false,
  124. [ControlTypes.DateRange]: false,
  125. [ControlTypes.InputText]: false,
  126. [ControlTypes.NumberRange]: true,
  127. [ControlTypes.Slider]: true,
  128. [ControlTypes.TreeSelect]: false
  129. }
  130. export const CHANGE_IMMEDIATELY = {
  131. [ControlTypes.Select]: true,
  132. [ControlTypes.Radio]: true,
  133. [ControlTypes.Date]: true,
  134. [ControlTypes.DateRange]: true,
  135. [ControlTypes.InputText]: false,
  136. [ControlTypes.NumberRange]: false,
  137. [ControlTypes.Slider]: true,
  138. [ControlTypes.TreeSelect]: true
  139. }
  140. export const ControlTypesOperatorSetting = {
  141. [ControlTypes.Select]: {
  142. normal: [OperatorTypes.Equal, OperatorTypes.NotEqual],
  143. multiple: [OperatorTypes.In, OperatorTypes.NotIn]
  144. },
  145. [ControlTypes.Radio]: [OperatorTypes.Equal, OperatorTypes.NotEqual],
  146. [ControlTypes.Date]: {
  147. normal: [
  148. OperatorTypes.Equal,
  149. OperatorTypes.LessThan,
  150. OperatorTypes.LessThanOrEqual,
  151. OperatorTypes.GreaterThan,
  152. OperatorTypes.GreaterThanOrEqual
  153. ],
  154. multiple: [OperatorTypes.In, OperatorTypes.NotIn]
  155. },
  156. [ControlTypes.DateRange]: [],
  157. [ControlTypes.InputText]: [
  158. OperatorTypes.Equal,
  159. OperatorTypes.NotEqual,
  160. OperatorTypes.Contain,
  161. OperatorTypes.NotContain
  162. ],
  163. [ControlTypes.NumberRange]: [],
  164. [ControlTypes.Slider]: [],
  165. [ControlTypes.TreeSelect]: {
  166. normal: [OperatorTypes.Equal, OperatorTypes.NotEqual],
  167. multiple: [OperatorTypes.In, OperatorTypes.NotIn]
  168. }
  169. }
  170. export enum ControlPanelTypes {
  171. Global = 'global',
  172. Local = 'local'
  173. }
  174. export enum ControlPanelLayoutTypes {
  175. Dashboard = 'dashboard',
  176. Display = 'display',
  177. Fullscreen = 'fullscreen',
  178. DashboardItem = 'dashboardItem'
  179. }
  180. export const DEFAULT_DASHBOARD_CONTROL_GRID_WIDTH = {
  181. xxl: 3,
  182. xl: 4,
  183. lg: 6,
  184. md: 12
  185. }
  186. export const DEFAULT_DASHBOARD_ITEM_CONTROL_GRID_WIDTH = {
  187. xxl: 8,
  188. xl: 12,
  189. lg: 12,
  190. md: 12
  191. }
  192. export enum ControlQueryMode {
  193. Immediately,
  194. Manually
  195. }
  196. export const CONTROL_MAX_TAG_COUNT = 10
  197. export const CONTROL_MAX_TAG_TEXT_LENGTH = 10