amis 1.8.0-beta.0 → 1.8.0-beta.3

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 (217) hide show
  1. package/lib/SchemaRenderer.js +19 -3
  2. package/lib/SchemaRenderer.js.map +2 -2
  3. package/lib/WithRootStore.d.ts +18 -0
  4. package/lib/WithStore.js +2 -1
  5. package/lib/WithStore.js.map +2 -2
  6. package/lib/actions/CmptAction.js +14 -3
  7. package/lib/actions/CmptAction.js.map +2 -2
  8. package/lib/components/BarCode.js +1 -1
  9. package/lib/components/BarCode.js.map +2 -2
  10. package/lib/components/DatePicker.d.ts +3 -0
  11. package/lib/components/DatePicker.js +56 -11
  12. package/lib/components/DatePicker.js.map +2 -2
  13. package/lib/components/DateRangePicker.d.ts +92 -84
  14. package/lib/components/DateRangePicker.js +198 -5
  15. package/lib/components/DateRangePicker.js.map +2 -2
  16. package/lib/components/MonthRangePicker.d.ts +84 -84
  17. package/lib/components/Progress.js +12 -9
  18. package/lib/components/Progress.js.map +2 -2
  19. package/lib/components/Radios.d.ts +1 -1
  20. package/lib/components/Radios.js +3 -5
  21. package/lib/components/Radios.js.map +2 -2
  22. package/lib/components/Range.d.ts +2 -2
  23. package/lib/components/Range.js +24 -11
  24. package/lib/components/Range.js.map +2 -2
  25. package/lib/components/Steps.d.ts +6 -0
  26. package/lib/components/Steps.js +13 -9
  27. package/lib/components/Steps.js.map +2 -2
  28. package/lib/components/calendar/Calendar.js +16 -12
  29. package/lib/components/calendar/Calendar.js.map +2 -2
  30. package/lib/components/calendar/YearsView.js +3 -3
  31. package/lib/components/calendar/YearsView.js.map +2 -2
  32. package/lib/components/formula/Editor.d.ts +3 -1
  33. package/lib/components/formula/Editor.js +20 -2
  34. package/lib/components/formula/Editor.js.map +2 -2
  35. package/lib/components/formula/Picker.d.ts +5 -0
  36. package/lib/components/formula/Picker.js +19 -4
  37. package/lib/components/formula/Picker.js.map +2 -2
  38. package/lib/factory.d.ts +4 -0
  39. package/lib/factory.js +8 -2
  40. package/lib/factory.js.map +2 -2
  41. package/lib/index.js +1 -1
  42. package/lib/locale/de-DE.js +13 -0
  43. package/lib/locale/de-DE.js.map +2 -2
  44. package/lib/locale/en-US.js +13 -0
  45. package/lib/locale/en-US.js.map +2 -2
  46. package/lib/locale/zh-CN.js +13 -0
  47. package/lib/locale/zh-CN.js.map +2 -2
  48. package/lib/renderers/Action.d.ts +2 -0
  49. package/lib/renderers/Action.js +23 -5
  50. package/lib/renderers/Action.js.map +2 -2
  51. package/lib/renderers/Carousel.d.ts +1 -0
  52. package/lib/renderers/Carousel.js +13 -1
  53. package/lib/renderers/Carousel.js.map +2 -2
  54. package/lib/renderers/Dialog.d.ts +4 -0
  55. package/lib/renderers/Dialog.js +4 -3
  56. package/lib/renderers/Dialog.js.map +2 -2
  57. package/lib/renderers/DropDownButton.d.ts +2 -0
  58. package/lib/renderers/DropDownButton.js +13 -4
  59. package/lib/renderers/DropDownButton.js.map +2 -2
  60. package/lib/renderers/Form/Checkboxes.d.ts +2 -2
  61. package/lib/renderers/Form/Checkboxes.js +2 -6
  62. package/lib/renderers/Form/Checkboxes.js.map +2 -2
  63. package/lib/renderers/Form/Combo.js +3 -2
  64. package/lib/renderers/Form/Combo.js.map +2 -2
  65. package/lib/renderers/Form/InputCity.d.ts +3 -0
  66. package/lib/renderers/Form/InputCity.js +44 -2
  67. package/lib/renderers/Form/InputCity.js.map +2 -2
  68. package/lib/renderers/Form/InputDateRange.d.ts +5 -0
  69. package/lib/renderers/Form/InputDateRange.js.map +2 -2
  70. package/lib/renderers/Form/InputFile.js +6 -3
  71. package/lib/renderers/Form/InputFile.js.map +2 -2
  72. package/lib/renderers/Form/InputFormula.d.ts +4 -0
  73. package/lib/renderers/Form/InputFormula.js +2 -2
  74. package/lib/renderers/Form/InputFormula.js.map +2 -2
  75. package/lib/renderers/Form/InputImage.js +6 -3
  76. package/lib/renderers/Form/InputImage.js.map +2 -2
  77. package/lib/renderers/Form/InputRange.js +13 -14
  78. package/lib/renderers/Form/InputRange.js.map +2 -2
  79. package/lib/renderers/Form/InputTable.js +4 -2
  80. package/lib/renderers/Form/InputTable.js.map +2 -2
  81. package/lib/renderers/Form/Item.d.ts +11 -6
  82. package/lib/renderers/Form/index.js +1 -1
  83. package/lib/renderers/Form/index.js.map +2 -2
  84. package/lib/renderers/Form/wrapControl.d.ts +9 -0
  85. package/lib/renderers/Form/wrapControl.js +1 -1
  86. package/lib/renderers/Form/wrapControl.js.map +2 -2
  87. package/lib/renderers/Nav.js +2 -2
  88. package/lib/renderers/Nav.js.map +2 -2
  89. package/lib/renderers/Page.js +2 -3
  90. package/lib/renderers/Page.js.map +2 -2
  91. package/lib/renderers/Progress.d.ts +1 -1
  92. package/lib/renderers/Progress.js +1 -1
  93. package/lib/renderers/Progress.js.map +2 -2
  94. package/lib/renderers/Steps.d.ts +8 -0
  95. package/lib/renderers/Steps.js +2 -2
  96. package/lib/renderers/Steps.js.map +2 -2
  97. package/lib/renderers/Table/TableRow.js +1 -1
  98. package/lib/renderers/Table/TableRow.js.map +2 -2
  99. package/lib/renderers/Table/index.js +7 -3
  100. package/lib/renderers/Table/index.js.map +2 -2
  101. package/lib/renderers/Tabs.d.ts +4 -0
  102. package/lib/renderers/Tabs.js +22 -6
  103. package/lib/renderers/Tabs.js.map +2 -2
  104. package/lib/renderers/Wizard.d.ts +6 -3
  105. package/lib/renderers/Wizard.js +257 -152
  106. package/lib/renderers/Wizard.js.map +2 -2
  107. package/lib/store/index.d.ts +5 -0
  108. package/lib/store/index.js +14 -0
  109. package/lib/store/index.js.map +2 -2
  110. package/lib/store/table.js +4 -4
  111. package/lib/store/table.js.map +2 -2
  112. package/lib/themes/ang-ie11.css +194 -23
  113. package/lib/themes/ang.css +193 -22
  114. package/lib/themes/ang.css.map +1 -1
  115. package/lib/themes/antd-ie11.css +194 -23
  116. package/lib/themes/antd.css +193 -22
  117. package/lib/themes/antd.css.map +1 -1
  118. package/lib/themes/cxd-ie11.css +194 -23
  119. package/lib/themes/cxd.css +193 -22
  120. package/lib/themes/cxd.css.map +1 -1
  121. package/lib/themes/dark-ie11.css +194 -23
  122. package/lib/themes/dark.css +193 -22
  123. package/lib/themes/dark.css.map +1 -1
  124. package/lib/themes/default-ie11.css +194 -23
  125. package/lib/themes/default.css +193 -22
  126. package/lib/themes/default.css.map +1 -1
  127. package/lib/types.d.ts +1 -1
  128. package/lib/types.js.map +1 -1
  129. package/lib/utils/columnsSplit.d.ts +1 -0
  130. package/lib/utils/columnsSplit.js +40 -0
  131. package/lib/utils/columnsSplit.js.map +13 -0
  132. package/lib/utils/debug.d.ts +1 -1
  133. package/lib/utils/debug.js +16 -22
  134. package/lib/utils/debug.js.map +2 -2
  135. package/package.json +1 -1
  136. package/schema.json +181 -30
  137. package/scss/_properties.scss +2 -2
  138. package/scss/components/_barcode.scss +1 -1
  139. package/scss/components/_carousel.scss +1 -0
  140. package/scss/components/_debug.scss +3 -3
  141. package/scss/components/_formula.scss +18 -0
  142. package/scss/components/_progress.scss +3 -8
  143. package/scss/components/_steps.scss +199 -8
  144. package/scss/components/form/_date.scss +14 -0
  145. package/scss/components/form/_editor.scss +2 -1
  146. package/sdk/ang-ie11.css +234 -25
  147. package/sdk/ang.css +233 -24
  148. package/sdk/antd-ie11.css +234 -25
  149. package/sdk/antd.css +233 -24
  150. package/sdk/barcode.js +51 -51
  151. package/sdk/charts.js +14 -14
  152. package/sdk/codemirror.js +7 -7
  153. package/sdk/color-picker.js +65 -65
  154. package/sdk/cropperjs.js +2 -2
  155. package/sdk/cxd-ie11.css +234 -25
  156. package/sdk/cxd.css +233 -24
  157. package/sdk/dark-ie11.css +234 -25
  158. package/sdk/dark.css +233 -24
  159. package/sdk/exceljs.js +1 -1
  160. package/sdk/locale/de-DE.js +13 -0
  161. package/sdk/markdown.js +69 -69
  162. package/sdk/papaparse.js +1 -1
  163. package/sdk/renderers/Form/CityDB.js +1 -1
  164. package/sdk/rest.js +17 -17
  165. package/sdk/rich-text.js +62 -62
  166. package/sdk/sdk-ie11.css +234 -25
  167. package/sdk/sdk.css +233 -24
  168. package/sdk/sdk.js +1290 -1288
  169. package/sdk/thirds/hls.js/hls.js +1 -1
  170. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  171. package/sdk/tinymce.js +57 -57
  172. package/src/SchemaRenderer.tsx +32 -14
  173. package/src/WithStore.tsx +3 -1
  174. package/src/actions/CmptAction.ts +18 -0
  175. package/src/components/BarCode.tsx +2 -2
  176. package/src/components/DatePicker.tsx +77 -22
  177. package/src/components/DateRangePicker.tsx +198 -4
  178. package/src/components/Progress.tsx +8 -12
  179. package/src/components/Radios.tsx +6 -17
  180. package/src/components/Range.tsx +26 -12
  181. package/src/components/Steps.tsx +28 -27
  182. package/src/components/calendar/Calendar.tsx +17 -12
  183. package/src/components/calendar/YearsView.tsx +3 -4
  184. package/src/components/formula/Editor.tsx +34 -3
  185. package/src/components/formula/Picker.tsx +28 -1
  186. package/src/factory.tsx +15 -2
  187. package/src/locale/de-DE.ts +13 -0
  188. package/src/locale/en-US.ts +13 -0
  189. package/src/locale/zh-CN.ts +13 -0
  190. package/src/renderers/Action.tsx +22 -1
  191. package/src/renderers/Carousel.tsx +8 -0
  192. package/src/renderers/Dialog.tsx +17 -3
  193. package/src/renderers/DropDownButton.tsx +14 -3
  194. package/src/renderers/Form/Checkboxes.tsx +5 -18
  195. package/src/renderers/Form/Combo.tsx +2 -3
  196. package/src/renderers/Form/InputCity.tsx +33 -4
  197. package/src/renderers/Form/InputDateRange.tsx +8 -1
  198. package/src/renderers/Form/InputFile.tsx +7 -3
  199. package/src/renderers/Form/InputFormula.tsx +7 -0
  200. package/src/renderers/Form/InputImage.tsx +7 -3
  201. package/src/renderers/Form/InputRange.tsx +18 -16
  202. package/src/renderers/Form/InputTable.tsx +6 -2
  203. package/src/renderers/Form/index.tsx +1 -1
  204. package/src/renderers/Form/wrapControl.tsx +1 -1
  205. package/src/renderers/Nav.tsx +1 -1
  206. package/src/renderers/Page.tsx +1 -2
  207. package/src/renderers/Progress.tsx +2 -2
  208. package/src/renderers/Steps.tsx +14 -0
  209. package/src/renderers/Table/TableRow.tsx +1 -1
  210. package/src/renderers/Table/index.tsx +11 -2
  211. package/src/renderers/Tabs.tsx +75 -28
  212. package/src/renderers/Wizard.tsx +154 -93
  213. package/src/store/index.ts +20 -0
  214. package/src/store/table.ts +4 -4
  215. package/src/types.ts +3 -1
  216. package/src/utils/columnsSplit.tsx +57 -0
  217. package/src/utils/debug.tsx +17 -24
@@ -7,10 +7,11 @@ import {
7
7
  } from './Options';
8
8
  import cx from 'classnames';
9
9
  import Checkbox from '../../components/Checkbox';
10
- import chunk from 'lodash/chunk';
10
+
11
11
  import {Icon} from '../../components/icons';
12
12
  import {Api} from '../../types';
13
13
  import {autobind, hasAbility} from '../../utils/helper';
14
+ import {columnsSplit} from '../../utils/columnsSplit';
14
15
 
15
16
  /**
16
17
  * 复选框
@@ -32,7 +33,7 @@ export interface CheckboxesControlSchema extends FormOptionsControl {
32
33
  /**
33
34
  * 每行显示多少个
34
35
  */
35
- columnsCount?: number;
36
+ columnsCount?: number | number[];
36
37
  }
37
38
 
38
39
  export interface CheckboxesProps
@@ -47,7 +48,7 @@ export interface CheckboxesProps
47
48
  > {
48
49
  placeholder?: any;
49
50
  itemClassName?: string;
50
- columnsCount?: number;
51
+ columnsCount?: number | number[];
51
52
  labelClassName?: string;
52
53
  onAdd?: () => void;
53
54
  addApi?: Api;
@@ -221,21 +222,7 @@ export default class CheckboxesControl extends React.Component<
221
222
  );
222
223
  }
223
224
 
224
- if ((columnsCount as number) > 1) {
225
- let weight = 12 / (columnsCount as number);
226
- let cellClassName = `Grid-col--sm${
227
- weight === Math.round(weight) ? weight : ''
228
- }`;
229
- body = chunk(body, columnsCount).map((group, groupIndex) => (
230
- <div className={cx('Grid')} key={groupIndex}>
231
- {Array.from({length: columnsCount as number}).map((_, index) => (
232
- <div key={index} className={cx(cellClassName)}>
233
- {group[index]}
234
- </div>
235
- ))}
236
- </div>
237
- ));
238
- }
225
+ body = columnsSplit(body, cx, columnsCount);
239
226
 
240
227
  return (
241
228
  <div className={cx(`CheckboxesControl`, className)}>
@@ -642,7 +642,8 @@ export default class ComboControl extends React.Component<ComboProps> {
642
642
 
643
643
  if (
644
644
  syncDefaultValue === false ||
645
- this.subFormDefaultValues.length !== this.subForms.length
645
+ this.subFormDefaultValues.length !==
646
+ this.subForms.filter(item => item !== undefined).length
646
647
  ) {
647
648
  return;
648
649
  }
@@ -1372,9 +1373,7 @@ export default class ComboControl extends React.Component<ComboProps> {
1372
1373
  )
1373
1374
  ) : (
1374
1375
  <Button
1375
- level="default"
1376
1376
  className={cx(`Combo-addBtn`, addButtonClassName)}
1377
- block
1378
1377
  tooltip={__('Combo.add')}
1379
1378
  onClick={this.addItem}
1380
1379
  >
@@ -4,7 +4,8 @@ import {ClassNamesFn, themeable, ThemeProps} from '../../theme';
4
4
  import Spinner from '../../components/Spinner';
5
5
  import Select from '../../components/Select';
6
6
  import CityArea from '../../components/CityArea';
7
- import {autobind, isMobile} from '../../utils/helper';
7
+ import {autobind, isMobile, createObject} from '../../utils/helper';
8
+ import {Action} from '../../types';
8
9
  import {Option} from './Options';
9
10
  import {localeable, LocaleProps} from '../../locale';
10
11
 
@@ -432,10 +433,38 @@ export interface LocationControlProps extends FormControlProps {
432
433
  allowStreet?: boolean;
433
434
  }
434
435
  export class LocationControl extends React.Component<LocationControlProps> {
436
+
437
+ @autobind
438
+ doAction(action: Action, data: object, throwErrors: boolean) {
439
+ const {resetValue, onChange} = this.props;
440
+ const actionType = action?.actionType as string;
441
+
442
+ if (!!~['clear', 'reset'].indexOf(actionType)) {
443
+ onChange(resetValue ?? '');
444
+ }
445
+ }
446
+
447
+ @autobind
448
+ async handleChange(value: number | string) {
449
+ const {dispatchEvent, data, onChange} = this.props;
450
+
451
+ const rendererEvent = await dispatchEvent(
452
+ 'change',
453
+ createObject(data, {
454
+ value
455
+ })
456
+ );
457
+
458
+ if (rendererEvent?.prevented) {
459
+ return;
460
+ }
461
+
462
+ onChange(value);
463
+ }
464
+
435
465
  render() {
436
466
  const {
437
467
  value,
438
- onChange,
439
468
  allowCity,
440
469
  allowDistrict,
441
470
  extractValue,
@@ -453,7 +482,7 @@ export class LocationControl extends React.Component<LocationControlProps> {
453
482
  popOverContainer={
454
483
  env && env.getModalContainer ? env.getModalContainer : undefined
455
484
  }
456
- onChange={onChange}
485
+ onChange={this.handleChange}
457
486
  allowCity={allowCity}
458
487
  allowDistrict={allowDistrict}
459
488
  extractValue={extractValue}
@@ -466,7 +495,7 @@ export class LocationControl extends React.Component<LocationControlProps> {
466
495
  <ThemedCity
467
496
  searchable={searchable}
468
497
  value={value}
469
- onChange={onChange}
498
+ onChange={this.handleChange}
470
499
  allowCity={allowCity}
471
500
  allowDistrict={allowDistrict}
472
501
  extractValue={extractValue}
@@ -7,9 +7,11 @@ import includes from 'lodash/includes';
7
7
  import DateRangePicker, {
8
8
  DateRangePicker as BaseDateRangePicker
9
9
  } from '../../components/DateRangePicker';
10
- import { isMobile, createObject, autobind } from '../../utils/helper';
10
+ import {isMobile, createObject, autobind} from '../../utils/helper';
11
11
  import {Action} from '../../types';
12
12
 
13
+ import type {ShortCuts} from '../../components/DatePicker';
14
+
13
15
  /**
14
16
  * DateRange 日期范围控件
15
17
  * 文档:https://baidu.gitee.io/amis/docs/components/form/date-range
@@ -75,6 +77,11 @@ export interface DateRangeControlSchema extends FormBaseControl {
75
77
  * 开启后变成非弹出模式,即内联模式。
76
78
  */
77
79
  embed?: boolean;
80
+
81
+ /**
82
+ * 日期范围快捷键
83
+ */
84
+ ranges?: string | Array<ShortCuts>;
78
85
  }
79
86
 
80
87
  export interface DateRangeProps
@@ -28,6 +28,7 @@ import {
28
28
  SchemaUrlPath
29
29
  } from '../../Schema';
30
30
  import merge from 'lodash/merge';
31
+ import omit from 'lodash/omit';
31
32
 
32
33
  /**
33
34
  * File 文件上传控件
@@ -913,13 +914,16 @@ export default class FileControl extends React.Component<FileProps, FileState> {
913
914
  }
914
915
 
915
916
  syncAutoFill() {
916
- const {autoFill, multiple, onBulkChange, data} = this.props;
917
- if (!isEmpty(autoFill) && onBulkChange) {
917
+ const {autoFill, multiple, onBulkChange, data, name} = this.props;
918
+ // 排除自身的字段,否则会无限更新state
919
+ const excludeSelfAutoFill = omit(autoFill, name || '');
920
+
921
+ if (!isEmpty(excludeSelfAutoFill) && onBulkChange) {
918
922
  const files = this.state.files.filter(
919
923
  file => ~['uploaded', 'init', 'ready'].indexOf(file.state as string)
920
924
  );
921
925
  const toSync = dataMapping(
922
- autoFill,
926
+ excludeSelfAutoFill,
923
927
  multiple
924
928
  ? {
925
929
  items: files
@@ -55,6 +55,11 @@ export interface InputFormulaControlSchema extends FormBaseControl {
55
55
  */
56
56
  inputMode?: 'button' | 'input-button';
57
57
 
58
+ /**
59
+ * 外层input是否允许输入,否需要点击fx在弹窗中输入
60
+ */
61
+ allowInput?: boolean;
62
+
58
63
  /**
59
64
  * 按钮图标
60
65
  */
@@ -139,6 +144,7 @@ export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
139
144
  className,
140
145
  classPrefix: ns,
141
146
  classnames: cx,
147
+ allowInput = true,
142
148
  borderMode,
143
149
  placeholder,
144
150
  inputMode,
@@ -156,6 +162,7 @@ export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
156
162
  className={className}
157
163
  value={value}
158
164
  disabled={disabled}
165
+ allowInput={allowInput}
159
166
  onChange={onChange}
160
167
  evalMode={evalMode}
161
168
  variables={variables}
@@ -31,6 +31,7 @@ import {
31
31
  import {filter} from '../../utils/tpl';
32
32
  import isPlainObject from 'lodash/isPlainObject';
33
33
  import merge from 'lodash/merge';
34
+ import omit from 'lodash/omit';
34
35
 
35
36
  /**
36
37
  * Image 图片上传控件
@@ -817,13 +818,16 @@ export default class ImageControl extends React.Component<
817
818
  }
818
819
 
819
820
  syncAutoFill() {
820
- const {autoFill, multiple, onBulkChange, data} = this.props;
821
- if (!isEmpty(autoFill) && onBulkChange && this.initAutoFill) {
821
+ const {autoFill, multiple, onBulkChange, data, name} = this.props;
822
+ // 排除自身的字段,否则会无限更新state
823
+ const excludeSelfAutoFill = omit(autoFill, name || '');
824
+
825
+ if (!isEmpty(excludeSelfAutoFill) && onBulkChange && this.initAutoFill) {
822
826
  const files = this.state.files.filter(
823
827
  file => ~['uploaded', 'init', 'ready'].indexOf(file.state as string)
824
828
  );
825
829
  const toSync = dataMapping(
826
- autoFill,
830
+ excludeSelfAutoFill,
827
831
  multiple
828
832
  ? {
829
833
  items: files
@@ -271,7 +271,7 @@ export function formatValue(
271
271
  max: max === undefined || max > props.max ? props.max : max
272
272
  };
273
273
  }
274
- return +value ?? props.min;
274
+ return +value < props.min ? props.min : Math.min(+value, props.max);
275
275
  }
276
276
 
277
277
  /**
@@ -284,11 +284,13 @@ export class Input extends React.Component<RangeItemProps, any> {
284
284
  */
285
285
  @autobind
286
286
  onChange(value: number) {
287
- const {multiple, value: originValue, type} = this.props;
287
+ const {multiple, value: originValue, type, min} = this.props;
288
288
  const _value = this.getValue(value, type);
289
289
 
290
290
  this.props.updateValue(
291
- multiple ? {...(originValue as MultipleValue), [type]: _value} : value
291
+ multiple
292
+ ? {...(originValue as MultipleValue), [type]: _value}
293
+ : value ?? min
292
294
  );
293
295
  }
294
296
 
@@ -334,7 +336,8 @@ export class Input extends React.Component<RangeItemProps, any> {
334
336
  */
335
337
  getValue(value: string | number, type?: string) {
336
338
  const {max, min, step, value: stateValue} = this.props as RangeItemProps;
337
-
339
+ // value为null、undefined时,取对应的min/max
340
+ value = value ?? (type === 'min' ? min : max);
338
341
  // 校正value为step的倍数
339
342
  let _value = Math.round(parseFloat(value + '') / step) * step;
340
343
  // 同步value与步长小数位数
@@ -457,21 +460,26 @@ export default class RangeControl extends React.PureComponent<
457
460
  }
458
461
 
459
462
  componentDidUpdate(prevProps: RangeProps) {
460
- const {value} = prevProps;
463
+ const {value, min, max} = prevProps;
461
464
  const {
462
465
  value: nextPropsValue,
463
466
  multiple,
464
467
  delimiter,
465
- min,
466
- max,
468
+ min: nextPropsMin,
469
+ max: nextPropsMax,
467
470
  onChange
468
471
  } = this.props;
469
- if (value !== nextPropsValue) {
472
+
473
+ if (
474
+ value !== nextPropsValue ||
475
+ min !== nextPropsMin ||
476
+ max !== nextPropsMax
477
+ ) {
470
478
  const value = formatValue(nextPropsValue, {
471
479
  multiple,
472
480
  delimiter,
473
- min,
474
- max
481
+ min: nextPropsMin,
482
+ max: nextPropsMax
475
483
  });
476
484
  this.setState({
477
485
  value: this.getValue(value)
@@ -584,12 +592,6 @@ export default class RangeControl extends React.PureComponent<
584
592
  region
585
593
  } = props;
586
594
 
587
- // 指定parts -> 重新计算步长
588
- if (parts > 1) {
589
- props.step = (props.max - props.min) / props.parts;
590
- props.showSteps = true;
591
- }
592
-
593
595
  // 处理自定义json配置
594
596
  let renderMarks:
595
597
  | MarksType
@@ -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 ? (
@@ -1410,7 +1410,7 @@ export default class Form extends React.Component<FormProps, object> {
1410
1410
  formHorizontal: horizontal,
1411
1411
  controlWidth,
1412
1412
  disabled: disabled || (control as Schema).disabled || form.loading,
1413
- btnDisabled: form.loading || form.validating,
1413
+ btnDisabled: disabled || form.loading || form.validating,
1414
1414
  onAction: this.handleAction,
1415
1415
  onQuery: this.handleQuery,
1416
1416
  onChange: this.handleChange,
@@ -353,7 +353,7 @@ export function wrapControl<
353
353
  this.model.clearValueOnHidden &&
354
354
  this.model.form?.deleteValueByName(this.model.name);
355
355
 
356
- rootStore.removeStore(this.model);
356
+ isAlive(rootStore) && rootStore.removeStore(this.model);
357
357
  }
358
358
  delete this.model;
359
359
  }
@@ -523,7 +523,7 @@ const ConditionBuilderWithRemoteOptions = withRemoteConfig({
523
523
  env &&
524
524
  env.isCurrentUrl(filter(link.to as string, data))
525
525
  )),
526
- __id: link.id ?? link.__id ?? guid()
526
+ __id: link.__id ?? guid()
527
527
  };
528
528
 
529
529
  item.unfolded =
@@ -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
  }
@@ -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
  }
@@ -70,6 +70,16 @@ export interface StepsSchema extends BaseSchema {
70
70
  * 展示模式
71
71
  */
72
72
  mode?: 'horizontal' | 'vertical';
73
+
74
+ /**
75
+ * 标签放置位置
76
+ */
77
+ labelPlacement?: 'horizontal' | 'vertical';
78
+
79
+ /**
80
+ * 点状步骤条
81
+ */
82
+ progressDot?: boolean;
73
83
  }
74
84
 
75
85
  export interface StepsProps
@@ -82,6 +92,8 @@ export function StepsCmpt(props: StepsProps) {
82
92
  steps,
83
93
  status,
84
94
  mode,
95
+ labelPlacement,
96
+ progressDot,
85
97
  data,
86
98
  source,
87
99
  config,
@@ -139,6 +151,8 @@ export function StepsCmpt(props: StepsProps) {
139
151
  className={className}
140
152
  status={status}
141
153
  mode={mode}
154
+ progressDot={progressDot}
155
+ labelPlacement={labelPlacement}
142
156
  useMobileUI={useMobileUI}
143
157
  ></Steps>
144
158
  );
@@ -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,
@@ -2310,9 +2310,18 @@ export default class Table extends React.Component<TableProps, object> {
2310
2310
  });
2311
2311
  worksheet.views = [{state: 'frozen', xSplit: 0, ySplit: 1}];
2312
2312
 
2313
- const filteredColumns = toolbar.columns
2313
+ let exportColumns = toolbar.columns;
2314
+ if (isPureVariable(exportColumns)) {
2315
+ exportColumns = resolveVariableAndFilter(
2316
+ exportColumns,
2317
+ data,
2318
+ '| raw'
2319
+ );
2320
+ }
2321
+
2322
+ const filteredColumns = exportColumns
2314
2323
  ? columns.filter(column => {
2315
- const filterColumnsNames = toolbar.columns!;
2324
+ const filterColumnsNames = exportColumns!;
2316
2325
  if (filterColumnsNames.indexOf(column.name) !== -1) {
2317
2326
  return true;
2318
2327
  }
@@ -264,7 +264,11 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
264
264
 
265
265
  // 初始化 tabs 数组,当从 source 获取数据源时
266
266
  @autobind
267
- initTabArray(tabs: Array<TabSource>, source?: string, data?: any): [Array<TabSource>, boolean] {
267
+ initTabArray(
268
+ tabs: Array<TabSource>,
269
+ source?: string,
270
+ data?: any
271
+ ): [Array<TabSource>, boolean] {
268
272
  if (!tabs) {
269
273
  return [[], false];
270
274
  }
@@ -325,16 +329,28 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
325
329
  let localTabs = this.state.localTabs;
326
330
 
327
331
  // 响应外部修改 tabs
328
- const isTabsModified = isObjectShallowModified({
329
- tabs: props.tabs,
330
- source: resolveVariableAndFilter(props.source, props.data, '| raw')
331
- }, {
332
- tabs: preProps.tabs,
333
- source: resolveVariableAndFilter(preProps.source, preProps.data, '| raw')
334
- }, false);
332
+ const isTabsModified = isObjectShallowModified(
333
+ {
334
+ tabs: props.tabs,
335
+ source: resolveVariableAndFilter(props.source, props.data, '| raw')
336
+ },
337
+ {
338
+ tabs: preProps.tabs,
339
+ source: resolveVariableAndFilter(
340
+ preProps.source,
341
+ preProps.data,
342
+ '| raw'
343
+ )
344
+ },
345
+ false
346
+ );
335
347
 
336
348
  if (isTabsModified) {
337
- const [newLocalTabs, isFromSource] = this.initTabArray(props.tabs, props.source, props.data);
349
+ const [newLocalTabs, isFromSource] = this.initTabArray(
350
+ props.tabs,
351
+ props.source,
352
+ props.data
353
+ );
338
354
 
339
355
  this.setState({
340
356
  localTabs: newLocalTabs,
@@ -343,7 +359,11 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
343
359
  localTabs = newLocalTabs;
344
360
  }
345
361
 
346
- if (props.location && preProps.location && props.location.hash !== preProps.location.hash) {
362
+ if (
363
+ props.location &&
364
+ preProps.location &&
365
+ props.location.hash !== preProps.location.hash
366
+ ) {
347
367
  const hash = props.location.hash.substring(1);
348
368
  if (!hash) {
349
369
  return;
@@ -464,7 +484,10 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
464
484
  tab.hash ? tab.hash === key : index === key
465
485
  );
466
486
 
467
- if (localTabs[tabIndex] && !isVisible(localTabs[tabIndex], this.props.data)) {
487
+ if (
488
+ localTabs[tabIndex] &&
489
+ !isVisible(localTabs[tabIndex], this.props.data)
490
+ ) {
468
491
  let len = localTabs.length;
469
492
  let i = tabIndex - 1 + len;
470
493
  let tries = len - 1;
@@ -491,11 +514,14 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
491
514
  body: '新增tab 内容'
492
515
  } as TabSource);
493
516
 
494
- this.setState({
495
- localTabs: localTabs
496
- }, () => {
497
- this.switchTo(this.state.localTabs.length - 1);
498
- });
517
+ this.setState(
518
+ {
519
+ localTabs: localTabs
520
+ },
521
+ () => {
522
+ this.switchTo(this.state.localTabs.length - 1);
523
+ }
524
+ );
499
525
  }
500
526
 
501
527
  @autobind
@@ -520,20 +546,23 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
520
546
  }
521
547
 
522
548
  @autobind
523
- async handleDragChange(e: any){
549
+ async handleDragChange(e: any) {
524
550
  const activeTab = this.resolveTabByKey(this.activeKey);
525
551
  const originTabs: TabSource[] = this.state.localTabs.concat();
526
552
 
527
553
  originTabs.splice(e.newIndex, 0, originTabs.splice(e.oldIndex, 1)[0]);
528
554
 
529
- this.setState({
530
- localTabs: originTabs
531
- }, () => {
532
- if (activeTab) {
533
- const newActiveTabIndex = originTabs.indexOf(activeTab);
534
- this.switchTo(newActiveTabIndex);
555
+ this.setState(
556
+ {
557
+ localTabs: originTabs
558
+ },
559
+ () => {
560
+ if (activeTab) {
561
+ const newActiveTabIndex = originTabs.indexOf(activeTab);
562
+ this.switchTo(newActiveTabIndex);
563
+ }
535
564
  }
536
- });
565
+ );
537
566
  }
538
567
 
539
568
  @autobind
@@ -571,9 +600,12 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
571
600
  @autobind
572
601
  async handleChange(key: any, name: any) {
573
602
  const {dispatchEvent, data, onChange} = this.props;
574
- const rendererEvent = await dispatchEvent('change', createObject(data, {
575
- value: key,
576
- }));
603
+ const rendererEvent = await dispatchEvent(
604
+ 'change',
605
+ createObject(data, {
606
+ value: key
607
+ })
608
+ );
577
609
  if (rendererEvent?.prevented) {
578
610
  return;
579
611
  }
@@ -772,4 +804,19 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
772
804
  @Renderer({
773
805
  type: 'tabs'
774
806
  })
775
- export class TabsRenderer extends Tabs {}
807
+ export class TabsRenderer extends Tabs {
808
+ static contextType = ScopedContext;
809
+
810
+ constructor(props: TabsProps, context: IScopedContext) {
811
+ super(props);
812
+
813
+ const scoped = context;
814
+ scoped.registerComponent(this);
815
+ }
816
+
817
+ componentWillUnmount() {
818
+ super.componentWillUnmount?.();
819
+ const scoped = this.context as IScopedContext;
820
+ scoped.unRegisterComponent(this);
821
+ }
822
+ }