amis 1.6.5-beta.4 → 1.8.0-beta.1

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 (202) hide show
  1. package/lib/Schema.d.ts +3 -2
  2. package/lib/Schema.js +0 -1
  3. package/lib/Schema.js.map +2 -2
  4. package/lib/components/Alert2.js +4 -2
  5. package/lib/components/Alert2.js.map +2 -2
  6. package/lib/components/Avatar.d.ts +20 -20
  7. package/lib/components/Card.d.ts +20 -20
  8. package/lib/components/CityArea.js +3 -0
  9. package/lib/components/CityArea.js.map +2 -2
  10. package/lib/components/DatePicker.d.ts +3 -0
  11. package/lib/components/DatePicker.js +41 -7
  12. package/lib/components/DatePicker.js.map +2 -2
  13. package/lib/components/ListGroup.d.ts +21 -21
  14. package/lib/components/PopUp.js +2 -1
  15. package/lib/components/PopUp.js.map +2 -2
  16. package/lib/components/Progress.js +12 -9
  17. package/lib/components/Progress.js.map +2 -2
  18. package/lib/components/Range.js.map +2 -2
  19. package/lib/components/Tabs.d.ts +27 -23
  20. package/lib/components/Tabs.js +37 -22
  21. package/lib/components/Tabs.js.map +2 -2
  22. package/lib/components/TooltipWrapper.d.ts +21 -20
  23. package/lib/components/TooltipWrapper.js +2 -2
  24. package/lib/components/TooltipWrapper.js.map +2 -2
  25. package/lib/components/calendar/Calendar.js +16 -12
  26. package/lib/components/calendar/Calendar.js.map +2 -2
  27. package/lib/components/formula/Editor.d.ts +3 -1
  28. package/lib/components/formula/Editor.js +20 -2
  29. package/lib/components/formula/Editor.js.map +2 -2
  30. package/lib/components/formula/Picker.d.ts +5 -0
  31. package/lib/components/formula/Picker.js +19 -4
  32. package/lib/components/formula/Picker.js.map +2 -2
  33. package/lib/components/icons.js +2 -0
  34. package/lib/components/icons.js.map +2 -2
  35. package/lib/factory.js +2 -2
  36. package/lib/factory.js.map +2 -2
  37. package/lib/icons/trash.js +10 -0
  38. package/lib/index.d.ts +1 -0
  39. package/lib/index.js +2 -1
  40. package/lib/index.js.map +2 -2
  41. package/lib/renderers/Action.d.ts +1 -1
  42. package/lib/renderers/Action.js.map +2 -2
  43. package/lib/renderers/ButtonGroup.d.ts +2 -2
  44. package/lib/renderers/ButtonGroup.js.map +1 -1
  45. package/lib/renderers/Dialog.d.ts +4 -0
  46. package/lib/renderers/Dialog.js +4 -3
  47. package/lib/renderers/Dialog.js.map +2 -2
  48. package/lib/renderers/DropDownButton.d.ts +2 -0
  49. package/lib/renderers/DropDownButton.js +13 -4
  50. package/lib/renderers/DropDownButton.js.map +2 -2
  51. package/lib/renderers/Form/Combo.d.ts +4 -3
  52. package/lib/renderers/Form/Combo.js +81 -32
  53. package/lib/renderers/Form/Combo.js.map +2 -2
  54. package/lib/renderers/Form/InputCity.js +4 -1
  55. package/lib/renderers/Form/InputCity.js.map +2 -2
  56. package/lib/renderers/Form/InputColor.js +3 -1
  57. package/lib/renderers/Form/InputColor.js.map +2 -2
  58. package/lib/renderers/Form/InputDate.js +3 -1
  59. package/lib/renderers/Form/InputDate.js.map +2 -2
  60. package/lib/renderers/Form/InputDateRange.js +3 -1
  61. package/lib/renderers/Form/InputDateRange.js.map +2 -2
  62. package/lib/renderers/Form/InputExcel.d.ts +4 -0
  63. package/lib/renderers/Form/InputExcel.js +33 -6
  64. package/lib/renderers/Form/InputExcel.js.map +2 -2
  65. package/lib/renderers/Form/InputFile.d.ts +4 -1
  66. package/lib/renderers/Form/InputFile.js +9 -0
  67. package/lib/renderers/Form/InputFile.js.map +2 -2
  68. package/lib/renderers/Form/InputFormula.d.ts +4 -0
  69. package/lib/renderers/Form/InputFormula.js +2 -2
  70. package/lib/renderers/Form/InputFormula.js.map +2 -2
  71. package/lib/renderers/Form/InputImage.d.ts +4 -1
  72. package/lib/renderers/Form/InputImage.js +12 -2
  73. package/lib/renderers/Form/InputImage.js.map +2 -2
  74. package/lib/renderers/Form/InputRange.d.ts +27 -9
  75. package/lib/renderers/Form/InputRange.js +88 -23
  76. package/lib/renderers/Form/InputRange.js.map +2 -2
  77. package/lib/renderers/Form/InputTable.js +4 -2
  78. package/lib/renderers/Form/InputTable.js.map +2 -2
  79. package/lib/renderers/Form/Select.js +3 -1
  80. package/lib/renderers/Form/Select.js.map +2 -2
  81. package/lib/renderers/Form/Switch.d.ts +7 -6
  82. package/lib/renderers/Form/Switch.js +4 -1
  83. package/lib/renderers/Form/Switch.js.map +2 -2
  84. package/lib/renderers/Log.js +2 -1
  85. package/lib/renderers/Log.js.map +2 -2
  86. package/lib/renderers/Page.js +2 -3
  87. package/lib/renderers/Page.js.map +2 -2
  88. package/lib/renderers/PopOver.js +1 -1
  89. package/lib/renderers/PopOver.js.map +2 -2
  90. package/lib/renderers/Progress.d.ts +1 -1
  91. package/lib/renderers/Progress.js +1 -1
  92. package/lib/renderers/Progress.js.map +2 -2
  93. package/lib/renderers/Table/TableRow.js +1 -1
  94. package/lib/renderers/Table/TableRow.js.map +2 -2
  95. package/lib/renderers/Tabs.d.ts +10 -2
  96. package/lib/renderers/Tabs.js +3 -3
  97. package/lib/renderers/Tabs.js.map +2 -2
  98. package/lib/renderers/TooltipWrapper.d.ts +104 -0
  99. package/lib/renderers/TooltipWrapper.js +59 -0
  100. package/lib/renderers/TooltipWrapper.js.map +13 -0
  101. package/lib/renderers/Video.d.ts +6 -0
  102. package/lib/renderers/Video.js +13 -6
  103. package/lib/renderers/Video.js.map +2 -2
  104. package/lib/store/table.js +1 -1
  105. package/lib/store/table.js.map +2 -2
  106. package/lib/themes/ang-ie11.css +242 -46
  107. package/lib/themes/ang.css +250 -41
  108. package/lib/themes/ang.css.map +1 -1
  109. package/lib/themes/antd-ie11.css +242 -46
  110. package/lib/themes/antd.css +250 -41
  111. package/lib/themes/antd.css.map +1 -1
  112. package/lib/themes/cxd-ie11.css +231 -35
  113. package/lib/themes/cxd.css +252 -42
  114. package/lib/themes/cxd.css.map +1 -1
  115. package/lib/themes/dark-ie11.css +242 -46
  116. package/lib/themes/dark.css +250 -41
  117. package/lib/themes/dark.css.map +1 -1
  118. package/lib/themes/default-ie11.css +231 -35
  119. package/lib/themes/default.css +252 -42
  120. package/lib/themes/default.css.map +1 -1
  121. package/package.json +1 -1
  122. package/schema.json +15871 -608
  123. package/scss/_properties.scss +23 -12
  124. package/scss/components/_alert.scss +1 -1
  125. package/scss/components/_button-group.scss +15 -0
  126. package/scss/components/_city-area.scss +2 -0
  127. package/scss/components/_formula.scss +18 -0
  128. package/scss/components/_popup.scss +13 -3
  129. package/scss/components/_progress.scss +3 -8
  130. package/scss/components/_tabs.scss +145 -13
  131. package/scss/components/_tooltip.scss +72 -0
  132. package/scss/components/form/_date.scss +13 -0
  133. package/scss/components/form/_number.scss +2 -0
  134. package/scss/components/form/_switch.scss +1 -3
  135. package/scss/themes/_cxd-variables.scss +2 -1
  136. package/sdk/ang-ie11.css +287 -48
  137. package/sdk/ang.css +295 -43
  138. package/sdk/antd-ie11.css +287 -48
  139. package/sdk/antd.css +295 -43
  140. package/sdk/barcode.js +51 -51
  141. package/sdk/charts.js +14 -14
  142. package/sdk/codemirror.js +7 -7
  143. package/sdk/color-picker.js +65 -65
  144. package/sdk/cropperjs.js +2 -2
  145. package/sdk/cxd-ie11.css +276 -37
  146. package/sdk/cxd.css +297 -44
  147. package/sdk/dark-ie11.css +287 -48
  148. package/sdk/dark.css +295 -43
  149. package/sdk/exceljs.js +1 -1
  150. package/sdk/markdown.js +69 -69
  151. package/sdk/papaparse.js +1 -1
  152. package/sdk/renderers/Form/CityDB.js +1 -1
  153. package/sdk/rest.js +17 -17
  154. package/sdk/rich-text.js +62 -62
  155. package/sdk/sdk-ie11.css +276 -37
  156. package/sdk/sdk.css +297 -44
  157. package/sdk/sdk.js +1251 -1247
  158. package/sdk/thirds/hls.js/hls.js +1 -1
  159. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  160. package/sdk/tinymce.js +57 -57
  161. package/src/Schema.ts +5 -2
  162. package/src/components/Alert2.tsx +9 -3
  163. package/src/components/CityArea.tsx +3 -0
  164. package/src/components/DatePicker.tsx +56 -18
  165. package/src/components/PopUp.tsx +6 -5
  166. package/src/components/Progress.tsx +8 -12
  167. package/src/components/Range.tsx +7 -1
  168. package/src/components/Tabs.tsx +51 -21
  169. package/src/components/TooltipWrapper.tsx +4 -1
  170. package/src/components/calendar/Calendar.tsx +17 -12
  171. package/src/components/formula/Editor.tsx +34 -3
  172. package/src/components/formula/Picker.tsx +28 -1
  173. package/src/components/icons.tsx +2 -0
  174. package/src/factory.tsx +2 -2
  175. package/src/icons/trash.svg +8 -0
  176. package/src/index.tsx +1 -0
  177. package/src/renderers/Action.tsx +2 -1
  178. package/src/renderers/ButtonGroup.tsx +2 -2
  179. package/src/renderers/Dialog.tsx +17 -3
  180. package/src/renderers/DropDownButton.tsx +14 -3
  181. package/src/renderers/Form/Combo.tsx +84 -26
  182. package/src/renderers/Form/InputCity.tsx +13 -1
  183. package/src/renderers/Form/InputColor.tsx +2 -0
  184. package/src/renderers/Form/InputDate.tsx +2 -0
  185. package/src/renderers/Form/InputDateRange.tsx +2 -0
  186. package/src/renderers/Form/InputExcel.tsx +27 -5
  187. package/src/renderers/Form/InputFile.tsx +13 -1
  188. package/src/renderers/Form/InputFormula.tsx +7 -0
  189. package/src/renderers/Form/InputImage.tsx +32 -12
  190. package/src/renderers/Form/InputRange.tsx +95 -40
  191. package/src/renderers/Form/InputTable.tsx +6 -2
  192. package/src/renderers/Form/Select.tsx +2 -0
  193. package/src/renderers/Form/Switch.tsx +16 -9
  194. package/src/renderers/Log.tsx +2 -1
  195. package/src/renderers/Page.tsx +1 -2
  196. package/src/renderers/PopOver.tsx +1 -1
  197. package/src/renderers/Progress.tsx +2 -2
  198. package/src/renderers/Table/TableRow.tsx +1 -1
  199. package/src/renderers/Tabs.tsx +16 -4
  200. package/src/renderers/TooltipWrapper.tsx +219 -0
  201. package/src/renderers/Video.tsx +21 -6
  202. package/src/store/table.ts +1 -1
@@ -6,7 +6,7 @@ import DropZone from 'react-dropzone';
6
6
  import {FileRejection} from 'react-dropzone';
7
7
  import 'blueimp-canvastoblob';
8
8
  import find from 'lodash/find';
9
- import {Payload} from '../../types';
9
+ import {Payload, Action} from '../../types';
10
10
  import {buildApi} from '../../utils/api';
11
11
  import {
12
12
  createObject,
@@ -244,7 +244,7 @@ export interface ImageControlSchema extends FormBaseControl {
244
244
  /**
245
245
  * 初始化时是否把其他字段同步到表单内部。
246
246
  */
247
- initAutoFill?: boolean
247
+ initAutoFill?: boolean;
248
248
 
249
249
  /**
250
250
  * 默认占位图图片地址
@@ -314,6 +314,9 @@ export interface FileX extends File {
314
314
  [propName: string]: any;
315
315
  }
316
316
 
317
+ export type InputImageRendererEvent = 'change' | 'success' | 'fail' | 'remove';
318
+ export type InputImageRendererAction = 'clear';
319
+
317
320
  export default class ImageControl extends React.Component<
318
321
  ImageProps,
319
322
  ImageState
@@ -501,8 +504,8 @@ export default class ImageControl extends React.Component<
501
504
  this.syncAutoFill
502
505
  );
503
506
  } else if (prevProps.value !== props.value && !this.initAutoFill) {
504
- this.initAutoFill = true
505
- this.syncAutoFill()
507
+ this.initAutoFill = true;
508
+ this.syncAutoFill();
506
509
  }
507
510
 
508
511
  if (prevProps.crop !== props.crop) {
@@ -1245,10 +1248,19 @@ export default class ImageControl extends React.Component<
1245
1248
 
1246
1249
  async dispatchEvent(e: string, data?: Record<string, any>) {
1247
1250
  const {dispatchEvent} = this.props;
1248
- data = data ? data : this.state.files;
1251
+ data = data ? data : this.files;
1249
1252
  return dispatchEvent(e, createObject(this.props.data, {file: data}));
1250
1253
  }
1251
1254
 
1255
+ // 动作
1256
+ doAction(action: Action, data: object, throwErrors: boolean) {
1257
+ const {onChange} = this.props;
1258
+ if (action.actionType === 'clear') {
1259
+ this.files = [];
1260
+ onChange('');
1261
+ }
1262
+ }
1263
+
1252
1264
  render() {
1253
1265
  const {
1254
1266
  className,
@@ -1382,10 +1394,21 @@ export default class ImageControl extends React.Component<
1382
1394
  file.state === 'error' ? (
1383
1395
  <div className={cx('Image--thumb')}>
1384
1396
  <div className={cx('Image-thumbWrap')}>
1385
- <div className={cx('Image-thumb', 'ImageControl-filename')}>
1397
+ <div
1398
+ className={cx(
1399
+ 'Image-thumb',
1400
+ 'ImageControl-filename'
1401
+ )}
1402
+ >
1386
1403
  <Icon icon="image" className="icon" />
1387
- <span title={file.name || getNameFromUrl(file.value || file.url)}>
1388
- {file.name || getNameFromUrl(file.value || file.url)}
1404
+ <span
1405
+ title={
1406
+ file.name ||
1407
+ getNameFromUrl(file.value || file.url)
1408
+ }
1409
+ >
1410
+ {file.name ||
1411
+ getNameFromUrl(file.value || file.url)}
1389
1412
  </span>
1390
1413
  </div>
1391
1414
 
@@ -1393,10 +1416,7 @@ export default class ImageControl extends React.Component<
1393
1416
  <a
1394
1417
  data-tooltip={__('File.repick')}
1395
1418
  data-position="bottom"
1396
- onClick={this.handleRetry.bind(
1397
- this,
1398
- key
1399
- )}
1419
+ onClick={this.handleRetry.bind(this, key)}
1400
1420
  >
1401
1421
  <Icon icon="refresh" className="icon" />
1402
1422
  </a>
@@ -2,14 +2,17 @@ import React, {CSSProperties, ReactNode} from 'react';
2
2
  import isNumber from 'lodash/isNumber';
3
3
  import isObject from 'lodash/isObject';
4
4
  import isEqual from 'lodash/isEqual';
5
+ import forEach from 'lodash/forEach';
5
6
 
6
7
  import {FormItem, FormControlProps, FormBaseControl} from './Item';
7
8
  import InputRange from '../../components/Range';
8
9
  import NumberInput from '../../components/NumberInput';
9
10
  import {Icon} from '../../components/icons';
10
11
  import {stripNumber} from '../../utils/tpl-builtin';
11
- import {autobind} from '../../utils/helper';
12
+ import {autobind, createObject} from '../../utils/helper';
12
13
  import {filter} from '../../utils/tpl';
14
+ import {SchemaObject} from '../../Schema';
15
+ import {Action} from '../../types';
13
16
 
14
17
  /**
15
18
  * Range
@@ -19,6 +22,8 @@ import {filter} from '../../utils/tpl';
19
22
  export type Value = string | MultipleValue | number | [number, number];
20
23
  export type FormatValue = MultipleValue | number;
21
24
  export type TooltipPosType = 'auto' | 'top' | 'right' | 'bottom' | 'left';
25
+ export type InputRangeRendererEvent = 'change' | 'blur' | 'focus';
26
+ export type InputRangeRendererAction = 'clear';
22
27
  export interface RangeControlSchema extends FormBaseControl {
23
28
  type: 'input-range';
24
29
 
@@ -60,7 +65,7 @@ export interface RangeControlSchema extends FormBaseControl {
60
65
  /**
61
66
  * 刻度
62
67
  */
63
- // marks?: MarksType;
68
+ marks?: MarksType;
64
69
 
65
70
  /**
66
71
  * 是否展示标签
@@ -98,13 +103,15 @@ export interface RangeControlSchema extends FormBaseControl {
98
103
  disabled?: boolean;
99
104
  }
100
105
 
101
- export type MarksType = {
102
- [index: number | string]: Record<
103
- number,
104
- {style?: React.CSSProperties; label?: string} | any
105
- >;
106
+ type MarksType = {
107
+ [index: number | string]: MarksValue;
106
108
  };
107
109
 
110
+ type MarksValue = Record<
111
+ number,
112
+ SchemaObject | {style?: React.CSSProperties; label?: string}
113
+ >;
114
+
108
115
  export interface RangeProps extends FormControlProps {
109
116
  /**
110
117
  * 滑块值
@@ -138,11 +145,8 @@ export interface RangeProps extends FormControlProps {
138
145
 
139
146
  /**
140
147
  * 刻度
141
- *
142
- * todo 这里面存在 React.Compnonent 复杂定义,不能转成 json schema
143
- * 需要简化类型定义,json 中是不能定义复杂类型的,如 function
144
148
  */
145
- // marks?: MarksType;
149
+ marks?: MarksType;
146
150
 
147
151
  /**
148
152
  * 是否展示标签
@@ -362,6 +366,24 @@ export class Input extends React.Component<RangeItemProps, any> {
362
366
  }
363
367
  }
364
368
 
369
+ /**
370
+ * 失焦事件
371
+ */
372
+ @autobind
373
+ onBlur() {
374
+ const {data, dispatchEvent} = this.props;
375
+ dispatchEvent('blur', data);
376
+ }
377
+
378
+ /**
379
+ * 聚焦事件
380
+ */
381
+ @autobind
382
+ onFocus() {
383
+ const {data, dispatchEvent} = this.props;
384
+ dispatchEvent('focus', data);
385
+ }
386
+
365
387
  render() {
366
388
  const {
367
389
  classnames: cx,
@@ -388,6 +410,8 @@ export class Input extends React.Component<RangeItemProps, any> {
388
410
  min={this.checkNum(min)}
389
411
  onChange={this.onChange}
390
412
  disabled={disabled}
413
+ onBlur={this.onBlur}
414
+ onFocus={this.onFocus}
391
415
  />
392
416
  </div>
393
417
  );
@@ -455,6 +479,12 @@ export default class RangeControl extends React.PureComponent<
455
479
  }
456
480
  }
457
481
 
482
+ doAction(action: Action, data: object, throwErrors: boolean) {
483
+ if (action.actionType === 'clear') {
484
+ this.clearValue();
485
+ }
486
+ }
487
+
458
488
  @autobind
459
489
  clearValue() {
460
490
  const {multiple, min, max} = this.props;
@@ -481,21 +511,23 @@ export default class RangeControl extends React.PureComponent<
481
511
  * @param value
482
512
  */
483
513
  @autobind
484
- updateValue(value: FormatValue) {
514
+ async updateValue(value: FormatValue) {
485
515
  this.setState({value: this.getValue(value)});
486
- const {multiple, joinValues, delimiter, onChange} = this.props;
487
- onChange(
488
- multiple
489
- ? joinValues
490
- ? [(value as MultipleValue).min, (value as MultipleValue).max].join(
491
- delimiter || ','
492
- )
493
- : {
494
- min: (value as MultipleValue).min,
495
- max: (value as MultipleValue).max
496
- }
497
- : value
516
+ const {onChange, data, dispatchEvent} = this.props;
517
+ const result = this.getFormatValue(value);
518
+
519
+ const rendererEvent = await dispatchEvent(
520
+ 'change',
521
+ createObject(data, {
522
+ value: result
523
+ })
498
524
  );
525
+
526
+ if (rendererEvent?.prevented) {
527
+ return;
528
+ }
529
+
530
+ onChange && onChange(result);
499
531
  }
500
532
 
501
533
  /**
@@ -504,20 +536,27 @@ export default class RangeControl extends React.PureComponent<
504
536
  @autobind
505
537
  onAfterChange() {
506
538
  const {value} = this.state;
507
- const {multiple, joinValues, delimiter, onAfterChange} = this.props;
508
- onAfterChange &&
509
- onAfterChange(
510
- multiple
511
- ? joinValues
512
- ? [(value as MultipleValue).min, (value as MultipleValue).max].join(
513
- delimiter || ','
514
- )
515
- : {
516
- min: (value as MultipleValue).min,
517
- max: (value as MultipleValue).max
518
- }
519
- : value
520
- );
539
+ const {onAfterChange, dispatchEvent, data} = this.props;
540
+ const result = this.getFormatValue(value);
541
+ onAfterChange && onAfterChange(result);
542
+ }
543
+
544
+ /**
545
+ * 获取导出格式数据
546
+ */
547
+ @autobind
548
+ getFormatValue(value: FormatValue) {
549
+ const {multiple, joinValues, delimiter} = this.props;
550
+ return multiple
551
+ ? joinValues
552
+ ? [(value as MultipleValue).min, (value as MultipleValue).max].join(
553
+ delimiter || ','
554
+ )
555
+ : {
556
+ min: (value as MultipleValue).min,
557
+ max: (value as MultipleValue).max
558
+ }
559
+ : value;
521
560
  }
522
561
 
523
562
  render() {
@@ -539,7 +578,10 @@ export default class RangeControl extends React.PureComponent<
539
578
  disabled,
540
579
  clearable,
541
580
  min,
542
- max
581
+ max,
582
+ render,
583
+ marks,
584
+ region
543
585
  } = props;
544
586
 
545
587
  // 指定parts -> 重新计算步长
@@ -548,6 +590,19 @@ export default class RangeControl extends React.PureComponent<
548
590
  props.showSteps = true;
549
591
  }
550
592
 
593
+ // 处理自定义json配置
594
+ let renderMarks:
595
+ | MarksType
596
+ | {[index: number | string]: ReactNode}
597
+ | undefined = marks ? {...marks} : marks;
598
+ marks &&
599
+ forEach(marks, (item, key) => {
600
+ if (isObject(item) && (item as SchemaObject).type) {
601
+ renderMarks &&
602
+ (renderMarks[key] = render(region, item as SchemaObject));
603
+ }
604
+ });
605
+
551
606
  return (
552
607
  <div
553
608
  className={cx(
@@ -558,7 +613,7 @@ export default class RangeControl extends React.PureComponent<
558
613
  )}
559
614
  >
560
615
  {showInput && multiple && <Input {...props} type="min" />}
561
- <InputRange {...props} />
616
+ <InputRange {...props} marks={renderMarks} />
562
617
  {showInput && <Input {...props} type="max" />}
563
618
  {clearable && !disabled && showInput ? (
564
619
  <a
@@ -1082,7 +1082,9 @@ export default class FormTable extends React.Component<TableProps, TableState> {
1082
1082
  prefixRow,
1083
1083
  formInited,
1084
1084
  perPage,
1085
- classnames: cx
1085
+ classnames: cx,
1086
+ rowClassName,
1087
+ rowClassNameExpr
1086
1088
  } = this.props;
1087
1089
 
1088
1090
  if (formInited === false) {
@@ -1131,7 +1133,9 @@ export default class FormTable extends React.Component<TableProps, TableState> {
1131
1133
  expandConfig,
1132
1134
  canAccessSuperData,
1133
1135
  reUseRow: false,
1134
- offset
1136
+ offset,
1137
+ rowClassName,
1138
+ rowClassNameExpr
1135
1139
  }
1136
1140
  )}
1137
1141
  {(addable && showAddBtn !== false) || showPager ? (
@@ -390,6 +390,8 @@ export default class SelectControl extends React.Component<SelectProps, any> {
390
390
  popOverContainer={
391
391
  mobileUI && env && env.getModalContainer
392
392
  ? env.getModalContainer
393
+ : mobileUI
394
+ ? undefined
393
395
  : rest.popOverContainer
394
396
  }
395
397
  borderMode={borderMode}
@@ -1,12 +1,16 @@
1
1
  import React from 'react';
2
2
  import {FormItem, FormControlProps, FormBaseControl} from './Item';
3
3
  import Switch from '../../components/Switch';
4
- import {createObject, autobind} from '../../utils/helper';
4
+ import {createObject, autobind, isObject} from '../../utils/helper';
5
+ import {generateIcon} from "../../utils/icon";
6
+ import {IconSchema} from "../Icon";
5
7
 
6
8
  /**
7
9
  * Switch
8
10
  * 文档:https://baidu.gitee.io/amis/docs/components/form/switch
9
11
  */
12
+
13
+
10
14
  export interface SwitchControlSchema extends FormBaseControl {
11
15
  /**
12
16
  * 指定为多行文本输入框
@@ -16,12 +20,12 @@ export interface SwitchControlSchema extends FormBaseControl {
16
20
  /**
17
21
  * 勾选值
18
22
  */
19
- trueValue?: any;
23
+ trueValue?: boolean | string | number;
20
24
 
21
25
  /**
22
26
  * 未勾选值
23
27
  */
24
- falseValue?: any;
28
+ falseValue?: boolean | string | number;
25
29
 
26
30
  /**
27
31
  * 选项说明
@@ -29,14 +33,14 @@ export interface SwitchControlSchema extends FormBaseControl {
29
33
  option?: string;
30
34
 
31
35
  /**
32
- * 开启时显示的文本
36
+ * 开启时显示的内容
33
37
  */
34
- onText?: string;
38
+ onText?: string | IconSchema;
35
39
 
36
40
  /**
37
- * 关闭时显示的文本
41
+ * 关闭时显示的内容
38
42
  */
39
- offText?: string;
43
+ offText?: string | IconSchema;
40
44
  }
41
45
 
42
46
  export interface SwitchProps extends FormControlProps {
@@ -83,6 +87,9 @@ export default class SwitchControl extends React.Component<SwitchProps, any> {
83
87
  optionAtLeft
84
88
  } = this.props;
85
89
 
90
+ const on = isObject(onText) ? generateIcon(cx, onText.icon, 'Switch-icon') : onText;
91
+ const off = isObject(offText) ? generateIcon(cx, offText.icon, 'Switch-icon') :offText;
92
+
86
93
  return (
87
94
  <div className={cx(`SwitchControl`, className)}>
88
95
  {optionAtLeft ? (
@@ -94,8 +101,8 @@ export default class SwitchControl extends React.Component<SwitchProps, any> {
94
101
  value={value}
95
102
  trueValue={trueValue}
96
103
  falseValue={falseValue}
97
- onText={onText}
98
- offText={offText}
104
+ onText={on}
105
+ offText={off}
99
106
  disabled={disabled}
100
107
  onChange={this.handleChange}
101
108
  />
@@ -134,7 +134,8 @@ export class Log extends React.Component<LogProps, LogState> {
134
134
  const res = await fetch(api.url, {
135
135
  method: api.method?.toLocaleUpperCase() || 'GET',
136
136
  headers: (api.headers as Record<string, string>) || undefined,
137
- body: api.data ? JSON.stringify(api.data) : undefined
137
+ body: api.data ? JSON.stringify(api.data) : undefined,
138
+ credentials: 'include'
138
139
  });
139
140
  if (res.status === 200) {
140
141
  const body = res.body;
@@ -853,7 +853,7 @@ export class PageRenderer extends Page {
853
853
  throwErrors: boolean = false,
854
854
  delegate?: IScopedContext
855
855
  ) {
856
- const scoped = this.context as IScopedContext;
856
+ const scoped = delegate || (this.context as IScopedContext);
857
857
 
858
858
  if (action.actionType === 'reload') {
859
859
  action.target && scoped.reload(action.target, ctx);
@@ -877,7 +877,6 @@ export class PageRenderer extends Page {
877
877
  action.reload &&
878
878
  ~['url', 'link', 'jump'].indexOf(action.actionType!)
879
879
  ) {
880
- const scoped = delegate || (this.context as IScopedContext);
881
880
  scoped.reload(action.reload, ctx);
882
881
  }
883
882
  }
@@ -207,7 +207,7 @@ export const HocPopOver =
207
207
  if (popOver === true) {
208
208
  schema = {
209
209
  type: 'panel',
210
- body: '${name}'
210
+ body: `\${${name}}`
211
211
  };
212
212
  } else if (
213
213
  popOver &&
@@ -59,7 +59,7 @@ export interface ProgressSchema extends BaseSchema {
59
59
  animate?: boolean;
60
60
 
61
61
  /**
62
- * 圆形进度条线的宽度
62
+ * 进度条线的宽度
63
63
  */
64
64
  strokeWidth?: number;
65
65
  /**
@@ -95,7 +95,7 @@ export class ProgressField extends React.Component<ProgressProps, object> {
95
95
  @autobind
96
96
  format(value: number) {
97
97
  const {valueTpl, render, data} = this.props;
98
- return render(`progress-value`, valueTpl + '', {
98
+ return render(`progress-value`, valueTpl || '${value}%', {
99
99
  data: createObject(data, {value})
100
100
  });
101
101
  }
@@ -195,7 +195,7 @@ export class TableRow extends React.Component<TableRowProps> {
195
195
  'is-checked': item.checked,
196
196
  'is-modified': item.modified,
197
197
  'is-moved': item.moved,
198
- 'is-expanded': item.expanded,
198
+ 'is-expanded': item.expanded && item.expandable,
199
199
  'is-expandable': item.expandable,
200
200
  [`Table-tr--hasItemAction`]: itemAction,
201
201
  [`Table-tr--odd`]: itemIndex % 2 === 0,
@@ -89,9 +89,9 @@ export interface TabSchema extends Omit<BaseSchema, 'type'> {
89
89
  */
90
90
  horizontal?: FormSchemaHorizontal;
91
91
  /**
92
- * 是否可关闭,优先级高于 tabs 的 closeable
92
+ * 是否可关闭,优先级高于 tabs 的 closable
93
93
  */
94
- closeable?: boolean;
94
+ closable?: boolean;
95
95
  /**
96
96
  * 是否禁用
97
97
  */
@@ -186,6 +186,14 @@ export interface TabsSchema extends BaseSchema {
186
186
  * 是否导航支持内容溢出滚动。属性废弃,为了兼容暂且保留
187
187
  */
188
188
  scrollable?: boolean;
189
+ /**
190
+ * 编辑器模式,侧边的位置
191
+ */
192
+ sidePosition?: 'left' | 'right';
193
+ /**
194
+ * 自定义增加按钮文案
195
+ */
196
+ addBtnText?: string;
189
197
  }
190
198
 
191
199
  export interface TabsProps
@@ -335,7 +343,7 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
335
343
  localTabs = newLocalTabs;
336
344
  }
337
345
 
338
- if (props.location && props.location.hash !== preProps.location.hash) {
346
+ if (props.location && preProps.location && props.location.hash !== preProps.location.hash) {
339
347
  const hash = props.location.hash.substring(1);
340
348
  if (!hash) {
341
349
  return;
@@ -643,7 +651,9 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
643
651
  draggable,
644
652
  showTip,
645
653
  showTipClassName,
646
- editable
654
+ editable,
655
+ sidePosition,
656
+ addBtnText
647
657
  } = this.props;
648
658
 
649
659
  const mode = tabsMode || dMode;
@@ -747,6 +757,8 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
747
757
  showTipClassName={showTipClassName}
748
758
  editable={editable}
749
759
  onEdit={this.handleEdit}
760
+ sidePosition={sidePosition}
761
+ addBtnText={addBtnText}
750
762
  >
751
763
  {children}
752
764
  </CTabs>