amis 1.2.4-beta.16 → 1.3.0

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.
package/src/factory.tsx CHANGED
@@ -224,7 +224,7 @@ export function loadRenderer(schema: Schema, path: string) {
224
224
 
225
225
  const defaultOptions: RenderOptions = {
226
226
  session: 'global',
227
- affixOffsetTop: 50,
227
+ affixOffsetTop: 0,
228
228
  affixOffsetBottom: 0,
229
229
  richTextToken: '',
230
230
  loadRenderer,
@@ -1110,7 +1110,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
1110
1110
  if (autoJumpToTopOnPagerChange && this.control) {
1111
1111
  (findDOMNode(this.control) as HTMLElement).scrollIntoView();
1112
1112
  const scrolledY = window.scrollY;
1113
- const offsetTop = affixOffsetTop ?? env?.affixOffsetTop ?? 50;
1113
+ const offsetTop = affixOffsetTop ?? env?.affixOffsetTop ?? 0;
1114
1114
  scrolledY && window.scroll(0, scrolledY - offsetTop);
1115
1115
  }
1116
1116
  }
@@ -356,12 +356,11 @@ export default class FileControl extends React.Component<FileProps, FileState> {
356
356
  if (value && value instanceof Blob) {
357
357
  files = [value as any];
358
358
  } else if (value) {
359
- files = (
360
- Array.isArray(value)
361
- ? value
362
- : joinValues
363
- ? `${(value as any)[valueField] || value}`.split(delimiter)
364
- : [value as any]
359
+ files = (Array.isArray(value)
360
+ ? value
361
+ : joinValues
362
+ ? `${(value as any)[valueField] || value}`.split(delimiter)
363
+ : [value as any]
365
364
  )
366
365
  .map(item => FileControl.valueToFile(item, props) as FileValue)
367
366
  .filter(item => item);
@@ -403,12 +402,11 @@ export default class FileControl extends React.Component<FileProps, FileState> {
403
402
  let files: Array<FileValue> = [];
404
403
 
405
404
  if (value) {
406
- files = (
407
- Array.isArray(value)
408
- ? value
409
- : joinValues && typeof value === 'string'
410
- ? value.split(delimiter)
411
- : [value as any]
405
+ files = (Array.isArray(value)
406
+ ? value
407
+ : joinValues && typeof value === 'string'
408
+ ? value.split(delimiter)
409
+ : [value as any]
412
410
  )
413
411
  .map(item => {
414
412
  let obj = FileControl.valueToFile(
@@ -884,6 +882,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
884
882
 
885
883
  qsstringify({...api.data, ...params})
886
884
  .split('&')
885
+ .filter(i => !!i)
887
886
  .forEach(item => {
888
887
  const parts = item.split('=');
889
888
  fd.append(parts[0], decodeURIComponent(parts[1]));
@@ -54,6 +54,7 @@ import {
54
54
  import {ActionSchema} from '../Action';
55
55
  import {ButtonGroupControlSchema} from './ButtonGroupSelect';
56
56
  import {DialogSchemaBase} from '../Dialog';
57
+ import Alert from '../../components/Alert2';
57
58
 
58
59
  export interface FormSchemaHorizontal {
59
60
  left?: number;
@@ -1493,6 +1494,8 @@ export default class Form extends React.Component<FormProps, object> {
1493
1494
 
1494
1495
  render() {
1495
1496
  const {
1497
+ $path,
1498
+ $schema,
1496
1499
  wrapWithPanel,
1497
1500
  render,
1498
1501
  title,
@@ -1507,7 +1510,8 @@ export default class Form extends React.Component<FormProps, object> {
1507
1510
  affixFooter,
1508
1511
  lazyLoad,
1509
1512
  translate: __,
1510
- footer
1513
+ footer,
1514
+ formStore
1511
1515
  } = this.props;
1512
1516
 
1513
1517
  // trace(true);
@@ -1515,7 +1519,20 @@ export default class Form extends React.Component<FormProps, object> {
1515
1519
 
1516
1520
  let body: JSX.Element = this.renderBody();
1517
1521
 
1518
- if (wrapWithPanel) {
1522
+ // 表单组件限制
1523
+ const isFormInFormActions: boolean = /panel\/action\/form$/.test($path);
1524
+ // props有formStore 说明是嵌套表单 || 不允许在表单的按钮组中再直接套表单
1525
+ if (formStore || isFormInFormActions) {
1526
+ body = (
1527
+ <Alert level="danger">
1528
+ <p>Error: 不允许在表单及表单按钮组中直接嵌套表单</p>
1529
+ <p>Path: {$path}</p>
1530
+ <pre>
1531
+ <code>{JSON.stringify($schema, null, 2)}</code>
1532
+ </pre>
1533
+ </Alert>
1534
+ );
1535
+ } else if (wrapWithPanel) {
1519
1536
  body = render(
1520
1537
  'body',
1521
1538
  {