amis 1.5.6-beta.0 → 1.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/lib/Root.js +1 -1
  2. package/lib/Root.js.map +2 -2
  3. package/lib/Schema.d.ts +1 -1
  4. package/lib/Schema.js.map +1 -1
  5. package/lib/SchemaRenderer.js +4 -4
  6. package/lib/SchemaRenderer.js.map +2 -2
  7. package/lib/components/AsideNav.d.ts +1 -1
  8. package/lib/components/AsideNav.js.map +1 -1
  9. package/lib/components/Card.d.ts +20 -20
  10. package/lib/components/Card.js +1 -1
  11. package/lib/components/Card.js.map +2 -2
  12. package/lib/components/CodeMirror.d.ts +26 -0
  13. package/lib/components/CodeMirror.js +104 -0
  14. package/lib/components/CodeMirror.js.map +13 -0
  15. package/lib/components/Collapse.d.ts +22 -21
  16. package/lib/components/Collapse.js +5 -7
  17. package/lib/components/Collapse.js.map +2 -2
  18. package/lib/components/CollapseGroup.d.ts +20 -20
  19. package/lib/components/CollapseGroup.js +5 -3
  20. package/lib/components/CollapseGroup.js.map +2 -2
  21. package/lib/components/ColorPicker.d.ts +85 -84
  22. package/lib/components/ColorPicker.js +15 -3
  23. package/lib/components/ColorPicker.js.map +2 -2
  24. package/lib/components/DatePicker.d.ts +84 -84
  25. package/lib/components/DatePicker.js +7 -3
  26. package/lib/components/DatePicker.js.map +2 -2
  27. package/lib/components/DateRangePicker.d.ts +85 -84
  28. package/lib/components/DateRangePicker.js +5 -3
  29. package/lib/components/DateRangePicker.js.map +2 -2
  30. package/lib/components/LocationPicker.d.ts +84 -84
  31. package/lib/components/MonthRangePicker.d.ts +85 -84
  32. package/lib/components/MonthRangePicker.js +5 -3
  33. package/lib/components/MonthRangePicker.js.map +2 -2
  34. package/lib/components/PickerContainer.d.ts +2 -1
  35. package/lib/components/PickerContainer.js +3 -3
  36. package/lib/components/PickerContainer.js.map +2 -2
  37. package/lib/components/PopUp.d.ts +93 -0
  38. package/lib/components/PopUp.js +58 -0
  39. package/lib/components/PopUp.js.map +13 -0
  40. package/lib/components/Rating.d.ts +203 -73
  41. package/lib/components/Rating.js +147 -31
  42. package/lib/components/Rating.js.map +2 -2
  43. package/lib/components/Select.d.ts +237 -237
  44. package/lib/components/Steps.d.ts +1 -0
  45. package/lib/components/Steps.js +5 -3
  46. package/lib/components/Steps.js.map +2 -2
  47. package/lib/components/Tabs.d.ts +20 -20
  48. package/lib/components/TabsTransferPicker.js +1 -1
  49. package/lib/components/TabsTransferPicker.js.map +2 -2
  50. package/lib/components/TransferPicker.d.ts +0 -1
  51. package/lib/components/TransferPicker.js +2 -15
  52. package/lib/components/TransferPicker.js.map +2 -2
  53. package/lib/components/formula/Editor.d.ts +560 -0
  54. package/lib/components/formula/Editor.js +186 -0
  55. package/lib/components/formula/Editor.js.map +13 -0
  56. package/lib/components/formula/FuncList.d.ts +67 -0
  57. package/lib/components/formula/FuncList.js +35 -0
  58. package/lib/components/formula/FuncList.js.map +13 -0
  59. package/lib/components/formula/Picker.d.ts +493 -0
  60. package/lib/components/formula/Picker.js +48 -0
  61. package/lib/components/formula/Picker.js.map +13 -0
  62. package/lib/components/formula/VariableList.d.ts +9 -0
  63. package/lib/components/formula/VariableList.js +15 -0
  64. package/lib/components/formula/VariableList.js.map +13 -0
  65. package/lib/components/formula/plugin.d.ts +18 -0
  66. package/lib/components/formula/plugin.js +136 -0
  67. package/lib/components/formula/plugin.js.map +13 -0
  68. package/lib/components/icons.js +2 -0
  69. package/lib/components/icons.js.map +2 -2
  70. package/lib/components/index.d.ts +2 -1
  71. package/lib/components/index.js +4 -2
  72. package/lib/components/index.js.map +2 -2
  73. package/lib/helper.css +57 -57
  74. package/lib/helper.css.map +1 -1
  75. package/lib/icons/star.js +12 -0
  76. package/lib/index.d.ts +1 -0
  77. package/lib/index.js +2 -1
  78. package/lib/index.js.map +2 -2
  79. package/lib/renderers/CRUD.js +1 -2
  80. package/lib/renderers/CRUD.js.map +2 -2
  81. package/lib/renderers/Collapse.js +8 -2
  82. package/lib/renderers/Collapse.js.map +2 -2
  83. package/lib/renderers/CollapseGroup.js.map +2 -2
  84. package/lib/renderers/Form/InputCity.d.ts +84 -84
  85. package/lib/renderers/Form/InputColor.d.ts +84 -84
  86. package/lib/renderers/Form/InputColor.js +2 -2
  87. package/lib/renderers/Form/InputColor.js.map +2 -2
  88. package/lib/renderers/Form/InputDate.js +2 -2
  89. package/lib/renderers/Form/InputDate.js.map +2 -2
  90. package/lib/renderers/Form/InputDateRange.js +2 -2
  91. package/lib/renderers/Form/InputDateRange.js.map +2 -2
  92. package/lib/renderers/Form/InputFormula.d.ts +35 -0
  93. package/lib/renderers/Form/InputFormula.js +25 -0
  94. package/lib/renderers/Form/InputFormula.js.map +13 -0
  95. package/lib/renderers/Form/InputMonthRange.js +2 -2
  96. package/lib/renderers/Form/InputMonthRange.js.map +2 -2
  97. package/lib/renderers/Form/InputQuarterRange.js +2 -2
  98. package/lib/renderers/Form/InputQuarterRange.js.map +2 -2
  99. package/lib/renderers/Form/InputRating.d.ts +37 -0
  100. package/lib/renderers/Form/InputRating.js +6 -2
  101. package/lib/renderers/Form/InputRating.js.map +2 -2
  102. package/lib/renderers/Form/InputYearRange.js +2 -2
  103. package/lib/renderers/Form/InputYearRange.js.map +2 -2
  104. package/lib/renderers/Form/TreeSelect.d.ts +1 -0
  105. package/lib/renderers/Form/TreeSelect.js +11 -8
  106. package/lib/renderers/Form/TreeSelect.js.map +2 -2
  107. package/lib/renderers/Form/index.js +2 -1
  108. package/lib/renderers/Form/index.js.map +2 -2
  109. package/lib/renderers/Json.js +7 -0
  110. package/lib/renderers/Json.js.map +2 -2
  111. package/lib/renderers/Nav.js +4 -1
  112. package/lib/renderers/Nav.js.map +2 -2
  113. package/lib/renderers/Steps.js +2 -2
  114. package/lib/renderers/Steps.js.map +2 -2
  115. package/lib/renderers/Table/TableRow.js +4 -1
  116. package/lib/renderers/Table/TableRow.js.map +2 -2
  117. package/lib/store/formItem.js +17 -7
  118. package/lib/store/formItem.js.map +2 -2
  119. package/lib/store/table.js +1 -1
  120. package/lib/store/table.js.map +2 -2
  121. package/lib/themes/ang-ie11.css +305 -10
  122. package/lib/themes/ang.css +305 -10
  123. package/lib/themes/ang.css.map +1 -1
  124. package/lib/themes/antd-ie11.css +305 -10
  125. package/lib/themes/antd.css +305 -10
  126. package/lib/themes/antd.css.map +1 -1
  127. package/lib/themes/cxd-ie11.css +307 -11
  128. package/lib/themes/cxd.css +307 -11
  129. package/lib/themes/cxd.css.map +1 -1
  130. package/lib/themes/dark-ie11.css +305 -10
  131. package/lib/themes/dark.css +305 -10
  132. package/lib/themes/dark.css.map +1 -1
  133. package/lib/themes/default.css +307 -11
  134. package/lib/themes/default.css.map +1 -1
  135. package/lib/utils/api.js +2 -2
  136. package/lib/utils/api.js.map +2 -2
  137. package/lib/utils/helper.js +2 -7
  138. package/lib/utils/helper.js.map +2 -2
  139. package/package.json +5 -3
  140. package/schema.json +59 -7
  141. package/scss/_properties.scss +3 -1
  142. package/scss/_variables.scss +1 -1
  143. package/scss/components/_formula.scss +122 -0
  144. package/scss/components/_popup.scss +123 -0
  145. package/scss/components/_steps.scss +60 -0
  146. package/scss/components/form/_color.scss +4 -0
  147. package/scss/components/form/_date-range.scss +4 -0
  148. package/scss/components/form/_date.scss +3 -0
  149. package/scss/components/form/_rating.scss +60 -21
  150. package/scss/components/form/_tree-select.scss +4 -0
  151. package/scss/helper/background/_background-color.scss +1 -1
  152. package/scss/helper/border/_border-color.scss +1 -1
  153. package/scss/helper/typography/_text-color.scss +1 -1
  154. package/scss/themes/_common.scss +2 -0
  155. package/scss/themes/_cxd-variables.scss +3 -1
  156. package/sdk/ang-ie11.css +922 -8
  157. package/sdk/ang.css +926 -10
  158. package/sdk/antd-ie11.css +922 -8
  159. package/sdk/antd.css +926 -10
  160. package/sdk/charts.js +17 -17
  161. package/sdk/codemirror.js +14 -0
  162. package/sdk/color-picker.js +65 -65
  163. package/sdk/cropperjs.js +3 -3
  164. package/sdk/cxd-ie11.css +923 -9
  165. package/sdk/cxd.css +928 -11
  166. package/sdk/dark-ie11.css +922 -8
  167. package/sdk/dark.css +926 -10
  168. package/sdk/exceljs.js +1 -1
  169. package/sdk/helper.css +57 -57
  170. package/sdk/helper.css.map +1 -1
  171. package/sdk/markdown.js +69 -69
  172. package/sdk/papaparse.js +1 -1
  173. package/sdk/renderers/Form/CityDB.js +1 -1
  174. package/sdk/rest.js +18 -18
  175. package/sdk/rich-text.js +62 -62
  176. package/sdk/sdk-ie11.css +923 -9
  177. package/sdk/sdk.css +928 -11
  178. package/sdk/sdk.js +1318 -1208
  179. package/sdk/thirds/hls.js/hls.js +18 -18
  180. package/sdk/thirds/mpegts.js/mpegts.js +2 -2
  181. package/sdk/tinymce.js +57 -57
  182. package/src/Root.tsx +1 -0
  183. package/src/Schema.ts +1 -0
  184. package/src/SchemaRenderer.tsx +4 -0
  185. package/src/components/AsideNav.tsx +1 -1
  186. package/src/components/Card.tsx +2 -2
  187. package/src/components/CodeMirror.tsx +99 -0
  188. package/src/components/Collapse.tsx +22 -14
  189. package/src/components/CollapseGroup.tsx +9 -11
  190. package/src/components/ColorPicker.tsx +45 -3
  191. package/src/components/DatePicker.tsx +33 -3
  192. package/src/components/DateRangePicker.tsx +17 -3
  193. package/src/components/MonthRangePicker.tsx +18 -4
  194. package/src/components/PickerContainer.tsx +10 -6
  195. package/src/components/PopUp.tsx +133 -0
  196. package/src/components/Rating.tsx +235 -47
  197. package/src/components/Steps.tsx +8 -3
  198. package/src/components/TabsTransferPicker.tsx +1 -1
  199. package/src/components/TransferPicker.tsx +1 -11
  200. package/src/components/formula/Editor.tsx +261 -0
  201. package/src/components/formula/FuncList.tsx +82 -0
  202. package/src/components/formula/Picker.tsx +86 -0
  203. package/src/components/formula/VariableList.tsx +49 -0
  204. package/src/components/formula/plugin.ts +177 -0
  205. package/src/components/icons.tsx +2 -0
  206. package/src/components/index.tsx +2 -0
  207. package/src/icons/star.svg +12 -0
  208. package/src/index.tsx +1 -0
  209. package/src/renderers/CRUD.tsx +1 -3
  210. package/src/renderers/Collapse.tsx +27 -27
  211. package/src/renderers/CollapseGroup.tsx +13 -12
  212. package/src/renderers/Form/InputColor.tsx +2 -3
  213. package/src/renderers/Form/InputDate.tsx +2 -0
  214. package/src/renderers/Form/InputDateRange.tsx +2 -0
  215. package/src/renderers/Form/InputFormula.tsx +75 -0
  216. package/src/renderers/Form/InputMonthRange.tsx +2 -0
  217. package/src/renderers/Form/InputQuarterRange.tsx +2 -0
  218. package/src/renderers/Form/InputRating.tsx +66 -3
  219. package/src/renderers/Form/InputYearRange.tsx +2 -0
  220. package/src/renderers/Form/TreeSelect.tsx +82 -63
  221. package/src/renderers/Form/index.tsx +2 -1
  222. package/src/renderers/Json.tsx +5 -0
  223. package/src/renderers/Nav.tsx +4 -1
  224. package/src/renderers/Steps.tsx +4 -2
  225. package/src/renderers/Table/TableRow.tsx +3 -1
  226. package/src/store/formItem.ts +17 -2
  227. package/src/store/table.ts +2 -1
  228. package/src/utils/api.ts +5 -2
  229. package/src/utils/helper.ts +5 -14
@@ -1532,9 +1532,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
1532
1532
  renderBulkActions(childProps: any) {
1533
1533
  let {bulkActions, itemActions, store, render, classnames: cx} = this.props;
1534
1534
 
1535
- const items = childProps.items;
1536
-
1537
- if (!items.length || !bulkActions || !bulkActions.length) {
1535
+ if (!bulkActions || !bulkActions.length) {
1538
1536
  return null;
1539
1537
  }
1540
1538
 
@@ -1,12 +1,7 @@
1
1
  import React from 'react';
2
2
  import {Renderer, RendererProps} from '../factory';
3
3
  import {Collapse as BasicCollapse} from '../components/Collapse';
4
- import {
5
- BaseSchema,
6
- SchemaCollection,
7
- SchemaTpl,
8
- SchemaObject
9
- } from '../Schema';
4
+ import {BaseSchema, SchemaCollection, SchemaTpl, SchemaObject} from '../Schema';
10
5
 
11
6
  /**
12
7
  * Collapse 折叠渲染器,格式说明。
@@ -63,9 +58,9 @@ export interface CollapseSchema extends BaseSchema {
63
58
  */
64
59
  showArrow?: boolean;
65
60
 
66
- /**
67
- * 自定义切换图标
68
- */
61
+ /**
62
+ * 自定义切换图标
63
+ */
69
64
  expandIcon?: SchemaObject;
70
65
 
71
66
  /**
@@ -104,14 +99,9 @@ export interface CollapseProps
104
99
  children?: JSX.Element | ((props?: any) => JSX.Element);
105
100
  }
106
101
 
107
- export default class Collapse extends React.Component<
108
- CollapseProps,
109
- {}
110
- > {
111
-
102
+ export default class Collapse extends React.Component<CollapseProps, {}> {
112
103
  render() {
113
104
  const {
114
- key,
115
105
  id,
116
106
  classPrefix: ns,
117
107
  classnames: cx,
@@ -144,7 +134,6 @@ export default class Collapse extends React.Component<
144
134
 
145
135
  return (
146
136
  <BasicCollapse
147
- key={key}
148
137
  id={id}
149
138
  classnames={cx}
150
139
  classPrefix={ns}
@@ -162,19 +151,30 @@ export default class Collapse extends React.Component<
162
151
  showArrow={showArrow}
163
152
  disabled={disabled}
164
153
  propsUpdate={propsUpdate}
165
- expandIcon={expandIcon ? render('arrow-icon', expandIcon || '', {className: cx('Collapse-icon-tranform')}) : null}
166
- collapseHeader={collapseTitle || collapseHeader ? render('heading', collapseTitle || collapseHeader) : null}
154
+ expandIcon={
155
+ expandIcon
156
+ ? render('arrow-icon', expandIcon || '', {
157
+ className: cx('Collapse-icon-tranform')
158
+ })
159
+ : null
160
+ }
161
+ collapseHeader={
162
+ collapseTitle || collapseHeader
163
+ ? render('heading', collapseTitle || collapseHeader)
164
+ : null
165
+ }
167
166
  header={render('heading', title || header || '')}
168
- body={children
169
- ? typeof children === 'function'
170
- ? children(this.props)
171
- : children
172
- : body
173
- ? render('body', body)
174
- : null}
167
+ body={
168
+ children
169
+ ? typeof children === 'function'
170
+ ? children(this.props)
171
+ : children
172
+ : body
173
+ ? render('body', body)
174
+ : null
175
+ }
175
176
  onCollapse={onCollapse}
176
- >
177
- </BasicCollapse>
177
+ ></BasicCollapse>
178
178
  );
179
179
  }
180
180
  }
@@ -41,11 +41,13 @@ export interface CollapseGroupSchema extends BaseSchema {
41
41
  export interface CollapseGroupProps
42
42
  extends RendererProps,
43
43
  Omit<CollapseGroupSchema, 'type' | 'className'> {
44
-
45
44
  children?: JSX.Element | ((props?: any) => JSX.Element);
46
45
  }
47
46
 
48
- export class CollapseGroupRender extends React.Component<CollapseGroupProps, {}> {
47
+ export class CollapseGroupRender extends React.Component<
48
+ CollapseGroupProps,
49
+ {}
50
+ > {
49
51
  constructor(props: CollapseGroupProps) {
50
52
  super(props);
51
53
  }
@@ -61,19 +63,18 @@ export class CollapseGroupRender extends React.Component<CollapseGroupProps, {}>
61
63
  } = this.props;
62
64
  return (
63
65
  <CollapseGroup
64
- defaultActiveKey={defaultActiveKey}
65
- accordion={accordion}
66
- expandIcon={expandIcon}
67
- expandIconPosition={expandIconPosition}
68
- className={className}
69
- >
70
- {render('body', body || '')}
71
- </CollapseGroup>
72
- )
66
+ defaultActiveKey={defaultActiveKey}
67
+ accordion={accordion}
68
+ expandIcon={expandIcon}
69
+ expandIconPosition={expandIconPosition}
70
+ className={className}
71
+ >
72
+ {render('body', body || '')}
73
+ </CollapseGroup>
74
+ );
73
75
  }
74
76
  }
75
77
 
76
-
77
78
  @Renderer({
78
79
  type: 'collapse-group'
79
80
  })
@@ -68,12 +68,11 @@ export default class ColorControl extends React.PureComponent<
68
68
  };
69
69
 
70
70
  render() {
71
- const {className, classPrefix: ns, value, ...rest} = this.props;
72
-
71
+ const {className, classPrefix: ns, value, env, ...rest} = this.props;
73
72
  return (
74
73
  <div className={cx(`${ns}ColorControl`, className)}>
75
74
  <Suspense fallback={<div>...</div>}>
76
- <ColorPicker classPrefix={ns} {...rest} value={value || ''} />
75
+ <ColorPicker classPrefix={ns} {...rest} value={value || ''} useMobileUI={env.useMobileUI}/>
77
76
  </Suspense>
78
77
  </div>
79
78
  );
@@ -424,6 +424,7 @@ export default class DateControl extends React.PureComponent<
424
424
  format,
425
425
  timeFormat,
426
426
  valueFormat,
427
+ env,
427
428
  largeMode,
428
429
  render,
429
430
  ...rest
@@ -441,6 +442,7 @@ export default class DateControl extends React.PureComponent<
441
442
  format={valueFormat || format}
442
443
  {...this.state}
443
444
  classnames={cx}
445
+ useMobileUI={env.useMobileUI}
444
446
  schedules={this.state.schedules}
445
447
  largeMode={largeMode}
446
448
  onScheduleClick={this.onScheduleClick.bind(this)}
@@ -172,6 +172,7 @@ export default class DateRangeControl extends React.Component<DateRangeProps> {
172
172
  maxDuration,
173
173
  data,
174
174
  format,
175
+ env,
175
176
  ...rest
176
177
  } = this.props;
177
178
 
@@ -186,6 +187,7 @@ export default class DateRangeControl extends React.Component<DateRangeProps> {
186
187
  maxDate={maxDate ? filterDate(maxDate, data, format) : undefined}
187
188
  minDuration={minDuration ? parseDuration(minDuration) : undefined}
188
189
  maxDuration={maxDuration ? parseDuration(maxDuration) : undefined}
190
+ useMobileUI={env.useMobileUI}
189
191
  />
190
192
  </div>
191
193
  );
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import FormItem, {FormBaseControl, FormControlProps} from './Item';
3
+ import FormulaPicker from '../../components/formula/Picker';
4
+ import type {FuncGroup, VariableItem} from '../../components/formula/Editor';
5
+
6
+ /**
7
+ * InputFormula 公式编辑器
8
+ * 文档:https://baidu.gitee.io/amis/docs/components/form/input-formula
9
+ */
10
+ export interface InputFormulaControlSchema extends FormBaseControl {
11
+ type: 'input-formula';
12
+
13
+ /**
14
+ * evalMode 即直接就是表达式,否则
15
+ * 需要 ${这里面才是表达式}
16
+ * 默认为 true
17
+ */
18
+ evalMode?: boolean;
19
+
20
+ /**
21
+ * 用于提示的变量集合,默认为空
22
+ */
23
+ variables: Array<VariableItem>;
24
+
25
+ variableMode?: 'tabs' | 'tree';
26
+
27
+ /**
28
+ * 函数集合,默认不需要传,即 amis-formula 里面那个函数
29
+ * 如果有扩充,则需要传。
30
+ */
31
+ functions: Array<FuncGroup>;
32
+
33
+ /**
34
+ * 顶部标题,默认为表达式
35
+ */
36
+ header: string;
37
+ }
38
+
39
+ export interface InputFormulaProps
40
+ extends FormControlProps,
41
+ Omit<
42
+ InputFormulaControlSchema,
43
+ 'options' | 'inputClassName' | 'className' | 'descriptionClassName'
44
+ > {}
45
+
46
+ @FormItem({
47
+ type: 'input-formula'
48
+ })
49
+ export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
50
+ render() {
51
+ const {
52
+ selectedOptions,
53
+ disabled,
54
+ onChange,
55
+ evalMode,
56
+ variables,
57
+ variableMode,
58
+ functions,
59
+ header
60
+ } = this.props;
61
+
62
+ return (
63
+ <FormulaPicker
64
+ value={selectedOptions}
65
+ disabled={disabled}
66
+ onChange={onChange}
67
+ evalMode={evalMode}
68
+ variables={variables}
69
+ variableMode={variableMode}
70
+ functions={functions}
71
+ header={header}
72
+ />
73
+ );
74
+ }
75
+ }
@@ -170,6 +170,7 @@ export default class MonthRangeControl extends React.Component<MonthRangeProps>
170
170
  maxDuration,
171
171
  data,
172
172
  format,
173
+ env,
173
174
  ...rest
174
175
  } = this.props;
175
176
 
@@ -184,6 +185,7 @@ export default class MonthRangeControl extends React.Component<MonthRangeProps>
184
185
  maxDate={maxDate ? filterDate(maxDate, data, format) : undefined}
185
186
  minDuration={minDuration ? parseDuration(minDuration) : undefined}
186
187
  maxDuration={maxDuration ? parseDuration(maxDuration) : undefined}
188
+ useMobileUI={env.useMobileUI}
187
189
  />
188
190
  </div>
189
191
  );
@@ -26,6 +26,7 @@ export default class QuarterRangeControl extends InputDateRange {
26
26
  maxDuration,
27
27
  data,
28
28
  format,
29
+ env,
29
30
  ...rest
30
31
  } = this.props;
31
32
 
@@ -44,6 +45,7 @@ export default class QuarterRangeControl extends InputDateRange {
44
45
  maxDate={maxDate ? filterDate(maxDate, data, format) : undefined}
45
46
  minDuration={minDuration ? parseDuration(minDuration) : undefined}
46
47
  maxDuration={maxDuration ? parseDuration(maxDuration) : undefined}
48
+ useMobileUI={env.useMobileUI}
47
49
  />
48
50
  </div>
49
51
  );
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {FormItem, FormControlProps, FormBaseControl} from './Item';
3
- import Rating from '../../components/Rating';
3
+ import Rating, {textPositionType} from '../../components/Rating';
4
4
 
5
5
  /**
6
6
  * Rating
@@ -23,6 +23,50 @@ export interface RatingControlSchema extends FormBaseControl {
23
23
  * 是否允许再次点击后清除
24
24
  */
25
25
  allowClear?: boolean;
26
+
27
+ /**
28
+ * 是否只读
29
+ */
30
+ readonly?: boolean;
31
+
32
+ /**
33
+ * 星星被选中的颜色
34
+ */
35
+ // colors?: string | {
36
+ // [propName: string | number]: string;
37
+ // };
38
+
39
+ colors?: string | {[propName: string]: string};
40
+
41
+ /**
42
+ * 未被选中的星星的颜色
43
+ */
44
+ inactiveColor?: string;
45
+
46
+ /**
47
+ * 星星被选中时的提示文字
48
+ */
49
+ texts?: {[propName: string]: string};
50
+
51
+ /**
52
+ * 文字的位置
53
+ */
54
+ textPosition?: textPositionType;
55
+
56
+ /**
57
+ * 自定义字符
58
+ */
59
+ char?: string;
60
+
61
+ /**
62
+ * 自定义字符类名
63
+ */
64
+ charClassName?: string;
65
+
66
+ /**
67
+ * 自定义文字类名
68
+ */
69
+ textClassName?: string;
26
70
  }
27
71
 
28
72
  export interface RatingProps extends FormControlProps {
@@ -49,8 +93,15 @@ export default class RatingControl extends React.Component<RatingProps, any> {
49
93
  readOnly,
50
94
  disabled,
51
95
  onChange,
52
- size,
96
+ onHoverChange,
53
97
  allowClear,
98
+ char,
99
+ inactiveColor,
100
+ colors,
101
+ texts,
102
+ charClassName,
103
+ textClassName,
104
+ textPosition,
54
105
  classnames: cx
55
106
  } = this.props;
56
107
 
@@ -64,7 +115,19 @@ export default class RatingControl extends React.Component<RatingProps, any> {
64
115
  half={half}
65
116
  allowClear={allowClear}
66
117
  readOnly={readOnly}
67
- onChange={(value: any) => onChange(value)}
118
+ char={char}
119
+ inactiveColor={inactiveColor}
120
+ colors={colors}
121
+ texts={texts}
122
+ charClassName={charClassName}
123
+ textClassName={textClassName}
124
+ textPosition={textPosition}
125
+ onChange={(value: number) => {
126
+ onChange && onChange(value);
127
+ }}
128
+ onHoverChange={(value: number) => {
129
+ onHoverChange && onHoverChange(value);
130
+ }}
68
131
  />
69
132
  </div>
70
133
  );
@@ -26,6 +26,7 @@ export default class YearRangeControl extends InputDateRange {
26
26
  maxDuration,
27
27
  data,
28
28
  format,
29
+ env,
29
30
  ...rest
30
31
  } = this.props;
31
32
 
@@ -44,6 +45,7 @@ export default class YearRangeControl extends InputDateRange {
44
45
  maxDate={maxDate ? filterDate(maxDate, data, format) : undefined}
45
46
  minDuration={minDuration ? parseDuration(minDuration) : undefined}
46
47
  maxDuration={maxDuration ? parseDuration(maxDuration) : undefined}
48
+ useMobileUI={env.useMobileUI}
47
49
  />
48
50
  </div>
49
51
  );
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import Overlay from '../../components/Overlay';
3
3
  import PopOver from '../../components/PopOver';
4
+ import PopUp from '../../components/PopUp';
4
5
 
5
6
  import {
6
7
  OptionsControl,
@@ -17,7 +18,7 @@ import {Api} from '../../types';
17
18
  import {isEffectiveApi} from '../../utils/api';
18
19
  import Spinner from '../../components/Spinner';
19
20
  import ResultBox from '../../components/ResultBox';
20
- import {autobind, getTreeAncestors} from '../../utils/helper';
21
+ import {autobind, getTreeAncestors, isMobile} from '../../utils/helper';
21
22
  import {findDOMNode} from 'react-dom';
22
23
  import {normalizeOptions} from '../../components/Select';
23
24
 
@@ -90,6 +91,7 @@ export interface TreeSelectProps extends OptionsControlProps {
90
91
  hideNodePathLabel?: boolean;
91
92
  enableNodePath?: boolean;
92
93
  pathSeparator?: string;
94
+ useMobileUI?: boolean;
93
95
  }
94
96
 
95
97
  export interface TreeSelectState {
@@ -502,67 +504,51 @@ export default class TreeSelectControl extends React.Component<
502
504
  : options;
503
505
 
504
506
  return (
505
- <Overlay
506
- container={popOverContainer || (() => this.container.current)}
507
- target={() => this.target}
508
- show
509
- >
510
- <PopOver
511
- classPrefix={ns}
512
- className={`${ns}TreeSelect-popover`}
513
- style={{
514
- minWidth: this.target ? this.target.offsetWidth : undefined
515
- }}
516
- onHide={this.close}
517
- overlay
518
- >
519
- <TreeSelector
520
- classPrefix={ns}
521
- onlyChildren={onlyChildren}
522
- labelField={labelField}
523
- valueField={valueField}
524
- disabled={disabled}
525
- onChange={this.handleChange}
526
- joinValues={joinValues}
527
- extractValue={extractValue}
528
- delimiter={delimiter}
529
- placeholder={__(optionsPlaceholder)}
530
- options={filtedOptions}
531
- highlightTxt={this.state.inputValue}
532
- multiple={multiple}
533
- initiallyOpen={initiallyOpen}
534
- unfoldedLevel={unfoldedLevel}
535
- withChildren={withChildren}
536
- rootLabel={__(rootLabel)}
537
- rootValue={rootValue}
538
- showIcon={showIcon}
539
- showRadio={showRadio}
540
- cascade={cascade}
541
- foldedField="collapsed"
542
- hideRoot
543
- value={value || ''}
544
- nodePath={nodePath}
545
- enableNodePath={enableNodePath}
546
- pathSeparator={pathSeparator}
547
- maxLength={maxLength}
548
- minLength={minLength}
549
- onAdd={onAdd}
550
- creatable={creatable}
551
- createTip={createTip}
552
- rootCreatable={rootCreatable}
553
- rootCreateTip={rootCreateTip}
554
- onEdit={onEdit}
555
- editable={editable}
556
- editTip={editTip}
557
- removable={removable}
558
- removeTip={removeTip}
559
- onDelete={onDelete}
560
- bultinCUD={!addControls && !editControls}
561
- onDeferLoad={deferLoad}
562
- onExpandTree={expandTreeOptions}
563
- />
564
- </PopOver>
565
- </Overlay>
507
+ <TreeSelector
508
+ classPrefix={ns}
509
+ onlyChildren={onlyChildren}
510
+ labelField={labelField}
511
+ valueField={valueField}
512
+ disabled={disabled}
513
+ onChange={this.handleChange}
514
+ joinValues={joinValues}
515
+ extractValue={extractValue}
516
+ delimiter={delimiter}
517
+ placeholder={__(optionsPlaceholder)}
518
+ options={filtedOptions}
519
+ highlightTxt={this.state.inputValue}
520
+ multiple={multiple}
521
+ initiallyOpen={initiallyOpen}
522
+ unfoldedLevel={unfoldedLevel}
523
+ withChildren={withChildren}
524
+ rootLabel={__(rootLabel)}
525
+ rootValue={rootValue}
526
+ showIcon={showIcon}
527
+ showRadio={showRadio}
528
+ cascade={cascade}
529
+ foldedField="collapsed"
530
+ hideRoot
531
+ value={value || ''}
532
+ nodePath={nodePath}
533
+ enableNodePath={enableNodePath}
534
+ pathSeparator={pathSeparator}
535
+ maxLength={maxLength}
536
+ minLength={minLength}
537
+ onAdd={onAdd}
538
+ creatable={creatable}
539
+ createTip={createTip}
540
+ rootCreatable={rootCreatable}
541
+ rootCreateTip={rootCreateTip}
542
+ onEdit={onEdit}
543
+ editable={editable}
544
+ editTip={editTip}
545
+ removable={removable}
546
+ removeTip={removeTip}
547
+ onDelete={onDelete}
548
+ bultinCUD={!addControls && !editControls}
549
+ onDeferLoad={deferLoad}
550
+ onExpandTree={expandTreeOptions}
551
+ />
566
552
  );
567
553
  }
568
554
 
@@ -581,9 +567,13 @@ export default class TreeSelectControl extends React.Component<
581
567
  autoComplete,
582
568
  selectedOptions,
583
569
  placeholder,
570
+ popOverContainer,
571
+ env,
584
572
  translate: __
585
573
  } = this.props;
586
574
 
575
+ const { isOpened } = this.state;
576
+ const { useMobileUI } = env;
587
577
  return (
588
578
  <div ref={this.container} className={cx(`TreeSelectControl`, className)}>
589
579
  <ResultBox
@@ -622,7 +612,36 @@ export default class TreeSelectControl extends React.Component<
622
612
  >
623
613
  {loading ? <Spinner size="sm" /> : undefined}
624
614
  </ResultBox>
625
- {this.state.isOpened ? this.renderOuter() : null}
615
+ { !(useMobileUI && isMobile()) && isOpened ? (
616
+ <Overlay
617
+ container={popOverContainer || (() => this.container.current)}
618
+ target={() => this.target}
619
+ show
620
+ >
621
+ <PopOver
622
+ classPrefix={ns}
623
+ className={`${ns}TreeSelect-popover`}
624
+ style={{
625
+ minWidth: this.target ? this.target.offsetWidth : undefined
626
+ }}
627
+ onHide={this.close}
628
+ overlay
629
+ >
630
+ {this.renderOuter()}
631
+ </PopOver>
632
+ </Overlay>
633
+ ) : null}
634
+ {
635
+ useMobileUI && isMobile() && (
636
+ <PopUp
637
+ className={cx(`${ns}TreeSelect-popup`)}
638
+ isShow={isOpened}
639
+ onHide={this.close}
640
+ >
641
+ {this.renderOuter()}
642
+ </PopUp>
643
+ )
644
+ }
626
645
  </div>
627
646
  );
628
647
  }
@@ -398,7 +398,8 @@ export default class Form extends React.Component<FormProps, object> {
398
398
  'simpleMode',
399
399
  'inputOnly',
400
400
  'value',
401
- 'actions'
401
+ 'actions',
402
+ 'multiple'
402
403
  ];
403
404
 
404
405
  hooks: {
@@ -94,6 +94,11 @@ export class JSONField extends React.Component<JSONProps, object> {
94
94
  let data = value;
95
95
  if (source !== undefined && isPureVariable(source)) {
96
96
  data = resolveVariableAndFilter(source, this.props.data, '| raw');
97
+ } else if (typeof value === 'string') {
98
+ // 尝试解析 json
99
+ try {
100
+ data = JSON.parse(value);
101
+ } catch (e) {}
97
102
  }
98
103
 
99
104
  let jsonThemeValue = jsonTheme;
@@ -415,7 +415,10 @@ export class Navigation extends React.Component<
415
415
  />
416
416
  ) : hasSub ? (
417
417
  <span
418
- onClick={() => this.toggleLink(link)}
418
+ onClick={e => {
419
+ this.toggleLink(link);
420
+ e.stopPropagation();
421
+ }}
419
422
  className={cx('Nav-itemToggler', togglerClassName)}
420
423
  >
421
424
  <Icon icon="caret" className="icon" />
@@ -83,9 +83,10 @@ export function StepsCmpt(props: StepsProps) {
83
83
  data,
84
84
  source,
85
85
  config,
86
- render
86
+ render,
87
+ env
87
88
  } = props;
88
-
89
+
89
90
  const stepsRow =
90
91
  (resolveVariable(source, data) as Array<StepSchema>) ||
91
92
  config ||
@@ -140,6 +141,7 @@ export function StepsCmpt(props: StepsProps) {
140
141
  className={className}
141
142
  status={status}
142
143
  mode={mode}
144
+ useMobileUI={env.useMobileUI}
143
145
  ></Steps>
144
146
  );
145
147
  }
@@ -45,8 +45,10 @@ export class TableRow extends React.Component<TableRowProps> {
45
45
  const {itemAction, onAction, item} = this.props;
46
46
  if (itemAction) {
47
47
  onAction && onAction(e, itemAction, item?.data);
48
+ item.toggle();
49
+ } else {
50
+ this.props.onCheck(this.props.item);
48
51
  }
49
- this.props.onCheck(this.props.item);
50
52
  }
51
53
 
52
54
  handleAction(e: React.UIEvent<any>, action: Action, ctx: any) {