amis 1.9.1-beta.23 → 1.9.1-beta.26

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 (54) hide show
  1. package/lib/index.js +1 -1
  2. package/lib/renderers/Dialog.d.ts +147 -169
  3. package/lib/renderers/Dialog.js.map +2 -2
  4. package/lib/renderers/Form/index.d.ts +4 -4
  5. package/lib/renderers/Form/index.js +252 -252
  6. package/lib/renderers/Form/index.js.map +2 -2
  7. package/lib/themes/ang-ie11.css +4 -7
  8. package/lib/themes/ang.css +4 -7
  9. package/lib/themes/ang.css.map +1 -1
  10. package/lib/themes/antd-ie11.css +4 -7
  11. package/lib/themes/antd.css +4 -7
  12. package/lib/themes/antd.css.map +1 -1
  13. package/lib/themes/cxd-ie11.css +4 -7
  14. package/lib/themes/cxd.css +4 -7
  15. package/lib/themes/cxd.css.map +1 -1
  16. package/lib/themes/dark-ie11.css +4 -7
  17. package/lib/themes/dark.css +4 -7
  18. package/lib/themes/dark.css.map +1 -1
  19. package/lib/themes/default-ie11.css +4 -7
  20. package/lib/themes/default.css +4 -7
  21. package/lib/themes/default.css.map +1 -1
  22. package/lib/utils/helper.js +1 -1
  23. package/lib/utils/helper.js.map +2 -2
  24. package/package.json +1 -1
  25. package/schema.json +24 -19
  26. package/scss/components/form/_date.scss +19 -11
  27. package/sdk/ang-ie11.css +4 -8
  28. package/sdk/ang.css +4 -8
  29. package/sdk/antd-ie11.css +4 -8
  30. package/sdk/antd.css +4 -8
  31. package/sdk/barcode.js +51 -51
  32. package/sdk/charts.js +14 -14
  33. package/sdk/codemirror.js +7 -7
  34. package/sdk/color-picker.js +65 -65
  35. package/sdk/cropperjs.js +2 -2
  36. package/sdk/cxd-ie11.css +4 -8
  37. package/sdk/cxd.css +4 -8
  38. package/sdk/dark-ie11.css +4 -8
  39. package/sdk/dark.css +4 -8
  40. package/sdk/exceljs.js +1 -1
  41. package/sdk/markdown.js +69 -69
  42. package/sdk/papaparse.js +1 -1
  43. package/sdk/renderers/Form/CityDB.js +1 -1
  44. package/sdk/rest.js +16 -16
  45. package/sdk/rich-text.js +62 -62
  46. package/sdk/sdk-ie11.css +4 -8
  47. package/sdk/sdk.css +4 -8
  48. package/sdk/sdk.js +1648 -1643
  49. package/sdk/thirds/hls.js/hls.js +1 -1
  50. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  51. package/sdk/tinymce.js +57 -57
  52. package/src/renderers/Dialog.tsx +0 -1
  53. package/src/renderers/Form/index.tsx +15 -24
  54. package/src/utils/helper.ts +2 -2
@@ -4,7 +4,6 @@ import {Renderer, RendererProps} from '../factory';
4
4
  import {SchemaNode, Schema, Action} from '../types';
5
5
  import {filter} from '../utils/tpl';
6
6
  import Modal from '../components/Modal';
7
- import findLast from 'lodash/findLast';
8
7
  import {
9
8
  guid,
10
9
  isVisible,
@@ -943,13 +943,13 @@ export default class Form extends React.Component<FormProps, object> {
943
943
  );
944
944
  }
945
945
 
946
- handleAction(
946
+ async handleAction(
947
947
  e: React.UIEvent<any> | void,
948
948
  action: Action,
949
949
  data: object,
950
950
  throwErrors: boolean = false,
951
951
  delegate?: IScopedContext
952
- ): any {
952
+ ): Promise<any> {
953
953
  const {
954
954
  store,
955
955
  onSubmit,
@@ -987,6 +987,7 @@ export default class Form extends React.Component<FormProps, object> {
987
987
  if (data === this.props.data) {
988
988
  data = store.data;
989
989
  }
990
+
990
991
  if (Array.isArray(action.required) && action.required.length) {
991
992
  store.clearErrors(); // 如果是按钮指定了required,则校验前先清空一下遗留的校验报错
992
993
 
@@ -994,31 +995,21 @@ export default class Form extends React.Component<FormProps, object> {
994
995
  name: item,
995
996
  rules: {isRequired: true}
996
997
  }));
998
+ const validationRes = await store.validateFields(fields);
997
999
 
998
- return store.validateFields(fields).then(async result => {
999
- if (!result) {
1000
- const dispatcher = await dispatchEvent(
1001
- 'validateError',
1002
- this.props.data
1003
- );
1004
- if (!dispatcher?.prevented) {
1005
- env.notify('error', __('Form.validateFailed'));
1006
- }
1000
+ if (!validationRes) {
1001
+ const dispatcher = await dispatchEvent(
1002
+ 'validateError',
1003
+ this.props.data
1004
+ );
1007
1005
 
1008
- /** 抛异常是为了在dialog中catch这个错误,避免弹窗直接关闭 */
1009
- return Promise.reject(__('Form.validateFailed'));
1010
- } else {
1011
- dispatchEvent('validateSucc', this.props.data);
1012
- this.handleAction(
1013
- e,
1014
- {...action, required: undefined},
1015
- data,
1016
- throwErrors,
1017
- delegate
1018
- );
1019
- return;
1006
+ if (!dispatcher?.prevented) {
1007
+ env.notify('error', __('Form.validateFailed'));
1020
1008
  }
1021
- });
1009
+
1010
+ /** 抛异常是为了在dialog中catch这个错误,避免弹窗直接关闭 */
1011
+ return Promise.reject(__('Form.validateFailed'));
1012
+ }
1022
1013
  }
1023
1014
  if (
1024
1015
  action.type === 'submit' ||
@@ -22,7 +22,7 @@ import {
22
22
  resolveVariable,
23
23
  resolveVariableAndFilter
24
24
  } from 'amis-formula';
25
- import {isObservable} from 'mobx';
25
+ import {isObservable, isObservableArray} from 'mobx';
26
26
 
27
27
  export {
28
28
  createObject,
@@ -937,7 +937,7 @@ export function everyTree<T extends TreeItem>(
937
937
  paths: Array<T> = [],
938
938
  indexes: Array<number> = []
939
939
  ): boolean {
940
- if (!Array.isArray(tree)) {
940
+ if (!Array.isArray(tree) && !isObservableArray(tree)) {
941
941
  return false;
942
942
  }
943
943
  return tree.every((item, index) => {