@cniot/mdd-editor 0.2.0-beta.8 → 0.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.
Files changed (75) hide show
  1. package/README.MD +311 -11
  2. package/build/index.cjs.js +27 -25
  3. package/build/index.es.js +3679 -507
  4. package/build/style.css +1 -1
  5. package/package.json +1 -1
  6. package/src/ai/LocalAIDrawer.jsx +211 -0
  7. package/src/ai/bridgeClient.js +76 -0
  8. package/src/ai/pageIR.js +148 -0
  9. package/src/components/address-select/formily.jsx +1 -1
  10. package/src/components/ajax-schema-form/formily-table-form-proxy.jsx +1 -1
  11. package/src/components/ajax-schema-form/formily.jsx +1 -1
  12. package/src/components/ajax-schema-form/table-form-proxy.jsx +1 -1
  13. package/src/components/ajax-schema-form/table-form.jsx +1 -1
  14. package/src/components/data-source-select/formily.jsx +1 -1
  15. package/src/components/dynamic-value/base/formily.jsx +1 -1
  16. package/src/components/dynamic-value/date/formily.jsx +1 -1
  17. package/src/components/formily-select/index.tsx +1 -1
  18. package/src/components/params-select/formily.jsx +1 -1
  19. package/src/components/time-range/formily.jsx +1 -1
  20. package/src/hooks/useSchema.jsx +5 -5
  21. package/src/hooks/useSwagger.jsx +2 -2
  22. package/src/schema/base-schema/AjaxSchema.js +1 -1
  23. package/src/schema/base-schema/AjaxSchemaQueue.js +1 -1
  24. package/src/schema/blocks/edit-table.js +57 -0
  25. package/src/schema/blocks/filter.js +49 -0
  26. package/src/schema/blocks/form.js +49 -0
  27. package/src/schema/blocks/index.js +32 -10
  28. package/src/schema/blocks/table.js +3 -4
  29. package/src/schema/detail/detail-item.js +5 -5
  30. package/src/schema/detail/index.js +26 -18
  31. package/src/schema/edit-table/header-toolbar.js +1 -1
  32. package/src/schema/edit-table/index.js +10 -5
  33. package/src/schema/edit-table/table.js +10 -2
  34. package/src/schema/formily-form/data-source.js +1 -1
  35. package/src/schema/formily-form/form-schema.js +1 -1
  36. package/src/schema/formily-form/index.js +8 -8
  37. package/src/schema/formily-form-v2/form-info.js +2 -2
  38. package/src/schema/formily-form-v2/form-items.js +1 -1
  39. package/src/schema/formily-form-v2/index.js +3 -3
  40. package/src/schema/ftp/data-source.js +1 -1
  41. package/src/schema/ftp/filter.js +2 -2
  42. package/src/schema/ftp/header-toolbar.js +1 -1
  43. package/src/schema/ftp/index.js +4 -4
  44. package/src/schema/ftp/middle-item.js +1 -1
  45. package/src/schema/ftp/table.js +9 -3
  46. package/src/schema/util.js +3 -3
  47. package/src/services/index.js +1 -1
  48. package/src/template/blocks/EditTable.jsx +62 -0
  49. package/src/template/blocks/Filter.jsx +137 -0
  50. package/src/template/blocks/Form.jsx +136 -0
  51. package/src/template/blocks/Table.jsx +4 -4
  52. package/src/template/const.js +22 -5
  53. package/src/template/detail/DetailItems.jsx +6 -1
  54. package/src/template/detail/components/Actions.jsx +1 -1
  55. package/src/template/detail/components/DetailCard.jsx +8 -5
  56. package/src/template/detail/components/DetailColumns.jsx +193 -113
  57. package/src/template/detail/components/DetailCustom.jsx +2 -2
  58. package/src/template/detail/components/DetailTable.jsx +13 -8
  59. package/src/template/detail/components/MultiAjaxSchemaForm.jsx +1 -1
  60. package/src/template/edit-table/HeaderToolbar.jsx +3 -2
  61. package/src/template/edit-table/Table.jsx +56 -3
  62. package/src/template/formily-form-v2/FormInfo.jsx +1 -1
  63. package/src/template/formily-form-v2/FormItems.jsx +4 -8
  64. package/src/template/formilyform/components/AsyncDataSourceSetter/index.tsx +1 -1
  65. package/src/template/formilyform/components/SubmitActionSetter/index.tsx +1 -1
  66. package/src/template/ftp/DataSource.jsx +1 -1
  67. package/src/template/ftp/Filter.jsx +14 -7
  68. package/src/template/ftp/HeaderToolbar.jsx +8 -4
  69. package/src/template/ftp/Middle.jsx +11 -7
  70. package/src/template/ftp/Table.jsx +143 -12
  71. package/src/template/simple-ftp/Table.jsx +2 -2
  72. package/src/toolbar.jsx +76 -14
  73. package/src/utils/buildFieldsToCompJson.js +3 -3
  74. package/src/utils/persistentStorage.js +1 -1
  75. package/src/utils/swagger/api2SchemaFromSwagger.js +7 -7
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { formilyReact, formilyCore } from '@cainiaofe/cn-ui';
3
- import { mapSize, mapStatus } from '@src/utils/formilyHook';
3
+ import { mapSize, mapStatus } from '$src/utils/formilyHook';
4
4
  import DynamicValueDate from './index';
5
5
 
6
6
  const { connect, mapReadPretty, mapProps } = formilyReact;
@@ -86,7 +86,7 @@ const patchDataSource = (dataSource: any = []) => {
86
86
  if (!result.children || result.children.length === 0) {
87
87
  delete result.children;
88
88
  } else {
89
- result.children = result.children.map(removeEmptyChildren);
89
+ result.children = result.children?.map?.(removeEmptyChildren);
90
90
  }
91
91
  return result;
92
92
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { formilyReact, formilyCore } from '@cainiaofe/cn-ui';
3
- import { mapSize, mapStatus } from '@src/utils/formilyHook';
3
+ import { mapSize, mapStatus } from '$src/utils/formilyHook';
4
4
  import DataSourceSelect from './index';
5
5
 
6
6
  const { connect, mapReadPretty, mapProps } = formilyReact;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { formilyReact, formilyCore } from '@cainiaofe/cn-ui';
3
- import { mapSize, mapStatus } from '@src/utils/formilyHook';
3
+ import { mapSize, mapStatus } from '$src/utils/formilyHook';
4
4
  import TimeRange from './index';
5
5
 
6
6
  const { connect, mapReadPretty, mapProps } = formilyReact;
@@ -1,10 +1,10 @@
1
1
  import { useState } from 'react';
2
2
  import { createModel } from 'hox';
3
- import storage from '@src/utils/persistentStorage';
4
- import useSwagger from '@src/hooks/useSwagger';
5
- import { MDD_SCHEMA_LS_KEY } from '@src/common/const';
6
- import { Util } from '@src/schema';
7
- import { IS_VSCODE } from '@src/utils/vscode';
3
+ import storage from '$src/utils/persistentStorage';
4
+ import useSwagger from '$src/hooks/useSwagger';
5
+ import { MDD_SCHEMA_LS_KEY } from '$src/common/const';
6
+ import { Util } from '$src/schema';
7
+ import { IS_VSCODE } from '$src/utils/vscode';
8
8
 
9
9
  function useSchema() {
10
10
  const { fetchSwaggerInfo } = useSwagger();
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
- import { getSwaggerInfo } from '@src/services';
2
+ import { getSwaggerInfo } from '$src/services';
3
3
  import { createModel } from 'hox';
4
- import { getSwaggerInfoFromJson, buildSwaggerApiJson, buildFieldsToCompJson } from '@src/utils';
4
+ import { getSwaggerInfoFromJson, buildSwaggerApiJson, buildFieldsToCompJson } from '$src/utils';
5
5
 
6
6
  /**
7
7
  * @returns 缓存swagger元数据信息, 方便后面匹配接口选择
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  // https://yuque.antfin.com/docs/share/fcab2e9f-8f44-43b6-b84c-12ec19c2ef5d?# 《ajax schema》
4
4
  export default class AjaxSchema extends JSONWatch {
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
  import AjaxSchema from './AjaxSchema';
3
3
 
4
4
  // https://yuque.antfin.com/docs/share/fcab2e9f-8f44-43b6-b84c-12ec19c2ef5d?# 《ajax schema》
@@ -0,0 +1,57 @@
1
+ /* eslint-disable indent */
2
+ import JSONWatch from '$src/utils/JSONWatch';
3
+
4
+ export default class EditTableSchema extends JSONWatch {
5
+ constructor(props) {
6
+ super({
7
+ columns: props, // 与 BlockSchema 中的 toJSON toJSONKey 对应
8
+ });
9
+ }
10
+
11
+ setFieldsAll(columns, ignoreUpdate = false) {
12
+ // TODO 已有的schema结构,如何merge
13
+ this.set('columns', columns, ignoreUpdate);
14
+ }
15
+
16
+ // 更新
17
+ setItemAll(value, type = 'columns', ignoreUpdate = false) {
18
+ this.set(type, value, ignoreUpdate);
19
+ }
20
+
21
+ add(field, key = 'columns', ignoreUpdate = false) {
22
+ this.data[key].push(field);
23
+ this.emit('$updated', null, ignoreUpdate);
24
+ }
25
+
26
+ remove(index, key = 'columns', ignoreUpdate = false) {
27
+ this.data[key].splice(index, 1);
28
+ this.emit('$updated', null, ignoreUpdate);
29
+ }
30
+ update(index, data, key = 'columns', ignoreUpdate = false) {
31
+ /**
32
+ * key 的类型如下:
33
+ * {string} primaryKey 主键
34
+ * {array} bulkActions 批量操作
35
+ * {array} columns 列
36
+ * {array} actionColumns 操作列
37
+ * {object} pagination 分页
38
+ */
39
+ if (['columns', 'actionColumns', 'bulkActions'].includes(key)) {
40
+ this.data[key].splice(index, 1, data);
41
+ } else {
42
+ this.data[key] = data;
43
+ }
44
+ this.emit('$updated', null, ignoreUpdate);
45
+ }
46
+
47
+ updateAll(data) {
48
+ this.data = data;
49
+ this.emit('$updated');
50
+ }
51
+
52
+ delete() {}
53
+
54
+ getJSON() {
55
+ return super.getJSON();
56
+ }
57
+ }
@@ -0,0 +1,49 @@
1
+ /* eslint-disable indent */
2
+ import JSONWatch from '$src/utils/JSONWatch';
3
+ import { getDefaultFomrLabelAlign } from '$src/utils';
4
+
5
+ export default class FilterSchema extends JSONWatch {
6
+ constructor(props) {
7
+ super({
8
+ fields: props, // 与 BlockSchema 中的 toJSON toJSONKey 对应
9
+ });
10
+ }
11
+
12
+ setFieldsAll(fields, ignoreUpdate = false) {
13
+ this.set('fields', fields, ignoreUpdate);
14
+ }
15
+
16
+ // 更新
17
+ setItemAll(value, type = 'fields', ignoreUpdate = false) {
18
+ this.set(type, value, ignoreUpdate);
19
+ }
20
+
21
+ add(field, key = 'fields', ignoreUpdate = false) {
22
+ this.data[key].push(field);
23
+ this.emit('$updated', null, ignoreUpdate);
24
+ }
25
+
26
+ remove(index, key = 'fields', ignoreUpdate = false) {
27
+ this.data[key].splice(index, 1);
28
+ this.emit('$updated', null, ignoreUpdate);
29
+ }
30
+ update(index, data, key = 'fields', ignoreUpdate = false) {
31
+ if (['fields'].includes(key)) {
32
+ this.data[key].splice(index, 1, data);
33
+ } else {
34
+ this.data[key] = data;
35
+ }
36
+ this.emit('$updated', null, ignoreUpdate);
37
+ }
38
+
39
+ updateAll(data) {
40
+ this.data = data;
41
+ this.emit('$updated');
42
+ }
43
+
44
+ delete() {}
45
+
46
+ getJSON() {
47
+ return super.getJSON();
48
+ }
49
+ }
@@ -0,0 +1,49 @@
1
+ /* eslint-disable indent */
2
+ import JSONWatch from '$src/utils/JSONWatch';
3
+ import { getDefaultFomrLabelAlign } from '$src/utils';
4
+
5
+ export default class FormSchema extends JSONWatch {
6
+ constructor(props) {
7
+ super({
8
+ fields: props, // 与 BlockSchema 中的 toJSON toJSONKey 对应
9
+ });
10
+ }
11
+
12
+ setFieldsAll(fields, ignoreUpdate = false) {
13
+ this.set('fields', fields, ignoreUpdate);
14
+ }
15
+
16
+ // 更新
17
+ setItemAll(value, type = 'fields', ignoreUpdate = false) {
18
+ this.set(type, value, ignoreUpdate);
19
+ }
20
+
21
+ add(field, key = 'fields', ignoreUpdate = false) {
22
+ this.data[key].push(field);
23
+ this.emit('$updated', null, ignoreUpdate);
24
+ }
25
+
26
+ remove(index, key = 'fields', ignoreUpdate = false) {
27
+ this.data[key].splice(index, 1);
28
+ this.emit('$updated', null, ignoreUpdate);
29
+ }
30
+ update(index, data, key = 'fields', ignoreUpdate = false) {
31
+ if (['fields'].includes(key)) {
32
+ this.data[key].splice(index, 1, data);
33
+ } else {
34
+ this.data[key] = data;
35
+ }
36
+ this.emit('$updated', null, ignoreUpdate);
37
+ }
38
+
39
+ updateAll(data) {
40
+ this.data = data;
41
+ this.emit('$updated');
42
+ }
43
+
44
+ delete() {}
45
+
46
+ getJSON() {
47
+ return super.getJSON();
48
+ }
49
+ }
@@ -1,9 +1,31 @@
1
- import { EVENT_KEY } from '@src/common/const';
1
+ import { EVENT_KEY } from '$src/common/const';
2
2
  import Schema from '../Schema';
3
3
  import Table from './table';
4
+ import Filter from './filter';
5
+ import Form from './form';
6
+ import EditTable from './edit-table';
4
7
 
5
8
  export default class BlocksSchema extends Schema {
6
- static Table = Table;
9
+ // static Table = Table;
10
+ // static Filter = Filter;
11
+ static BlocksInfoMap = {
12
+ 'blocks-table': {
13
+ schema: Table,
14
+ toJSONKey: 'columns',
15
+ },
16
+ 'blocks-edit-table': {
17
+ schema: EditTable,
18
+ toJSONKey: 'columns',
19
+ },
20
+ 'blocks-filter': {
21
+ schema: Filter,
22
+ toJSONKey: 'fields',
23
+ },
24
+ 'blocks-form': {
25
+ schema: Form,
26
+ toJSONKey: 'fields',
27
+ },
28
+ };
7
29
 
8
30
  /**
9
31
  * @param {*} props
@@ -13,10 +35,11 @@ export default class BlocksSchema extends Schema {
13
35
  * }
14
36
  */
15
37
  constructor(props, isCompleteSchema = false) {
16
- const { type, blocks, ...more } = isCompleteSchema ? props.body : props;
38
+ const { type, blocks = [], ...more } = isCompleteSchema ? props.body : props;
17
39
  super(more);
18
40
  this.type = type;
19
- this.blocks = new Table(blocks);
41
+ const RealSchema = BlocksSchema.BlocksInfoMap[type].schema;
42
+ this.blocks = new RealSchema(blocks);
20
43
 
21
44
  this.willDetach = this.initChangeListener();
22
45
  }
@@ -37,7 +60,7 @@ export default class BlocksSchema extends Schema {
37
60
  // 根据schema初始化对象, 二次打开
38
61
  initFromCache(schema) {
39
62
  const { body, ...more } = schema;
40
- const { blocks, } = body;
63
+ const { blocks } = body;
41
64
  // 先关闭storage的更新
42
65
  if (this.willDetach) {
43
66
  this.willDetach();
@@ -46,7 +69,6 @@ export default class BlocksSchema extends Schema {
46
69
  this.init(more);
47
70
  this.blocks.updateAll(blocks);
48
71
 
49
-
50
72
  // 再开启change监听
51
73
  this.willDetach = this.initChangeListener();
52
74
  }
@@ -56,20 +78,20 @@ export default class BlocksSchema extends Schema {
56
78
  return this.type;
57
79
  }
58
80
 
59
- // table内容
60
- getTablePanel() {
81
+ getPanel() {
61
82
  return this.blocks;
62
83
  }
63
84
 
64
85
  getAllJSON() {
65
86
  const res = super.getAllJSON();
66
- return { ...res, type: 'blocks', }
87
+ return { ...res, type: 'blocks' };
67
88
  }
68
89
 
69
90
  toJSON() {
91
+ const toJSONKey = BlocksSchema.BlocksInfoMap[this.type].toJSONKey;
70
92
  return {
71
93
  type: this.type,
72
- blocks: this.blocks.getJSON().columns, // 与 TableSchema constructor 中 的 key 对应
94
+ blocks: this.blocks.getJSON()[toJSONKey], // 与 TableSchema constructor 中 的 key 对应
73
95
  };
74
96
  }
75
97
 
@@ -1,12 +1,11 @@
1
1
  /* eslint-disable indent */
2
- import JSONWatch from '@src/utils/JSONWatch';
2
+ import JSONWatch from '$src/utils/JSONWatch';
3
3
 
4
4
  export default class TableSchema extends JSONWatch {
5
5
  constructor(props) {
6
6
  super({
7
- columns: props, // 与 BlockSchema 中的 toJSON 对应
7
+ columns: props, // 与 BlockSchema 中的 toJSON toJSONKey 对应
8
8
  });
9
-
10
9
  }
11
10
 
12
11
  setFieldsAll(columns, ignoreUpdate = false) {
@@ -50,7 +49,7 @@ export default class TableSchema extends JSONWatch {
50
49
  this.emit('$updated');
51
50
  }
52
51
 
53
- delete() { }
52
+ delete() {}
54
53
 
55
54
  getJSON() {
56
55
  return super.getJSON();
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  export default class DetailItemSchema extends JSONWatch {
4
4
  constructor(props) {
@@ -20,7 +20,7 @@ export default class DetailItemSchema extends JSONWatch {
20
20
  current = 1, // 步骤条,当前步数
21
21
  columnsDirection = 'row', // 分栏组件 方向,默认横向分栏
22
22
  columnsBoxes = [],
23
- hideCardTitle = false,
23
+ height = 100,
24
24
  ...more
25
25
  } = props || {};
26
26
  super({
@@ -41,7 +41,7 @@ export default class DetailItemSchema extends JSONWatch {
41
41
  current,
42
42
  columnsDirection,
43
43
  columnsBoxes,
44
- hideCardTitle,
44
+ height,
45
45
  ...more,
46
46
  });
47
47
  }
@@ -143,7 +143,7 @@ export default class DetailItemSchema extends JSONWatch {
143
143
  * {array} actionColumns 操作列
144
144
  * {object} pagination 分页
145
145
  */
146
- if (['columnsBoxes','columns', 'actionColumns', 'bulkActions'].includes(key)) {
146
+ if (['columnsBoxes', 'columns', 'actionColumns', 'bulkActions'].includes(key)) {
147
147
  this.data[key].splice(index, 1, record);
148
148
  } else {
149
149
  this.data[key] = record;
@@ -195,5 +195,5 @@ export default class DetailItemSchema extends JSONWatch {
195
195
  this.emit('$updated');
196
196
  }
197
197
 
198
- delete() { }
198
+ delete() {}
199
199
  }
@@ -1,10 +1,10 @@
1
- import { EVENT_KEY } from '@src/common/const';
1
+ import { EVENT_KEY } from '$src/common/const';
2
2
  import Schema from '../Schema';
3
3
  import { Message } from '@cainiaofe/cn-ui';
4
4
  import DetailItem from './detail-item';
5
5
  import AjaxSchema from '../base-schema/AjaxSchema';
6
- import buildSwaggerApiJson from '@src/utils/buildSwaggerApiJson';
7
- import buildFieldsToCompJson from '@src/utils/buildFieldsToCompJson';
6
+ import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
7
+ import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
8
8
 
9
9
  export default class DetailSchema extends Schema {
10
10
  /**
@@ -20,6 +20,8 @@ export default class DetailSchema extends Schema {
20
20
  hasAnchor = false,
21
21
  children,
22
22
  initDataSource,
23
+ fullHeight,
24
+ whiteBackground,
23
25
  ...more
24
26
  } = isCompleteSchema ? props.body : props;
25
27
  super(more);
@@ -27,6 +29,8 @@ export default class DetailSchema extends Schema {
27
29
  this.hasBackBtn = hasBackBtn;
28
30
  this.backText = backText;
29
31
  this.hasAnchor = hasAnchor; // 是否带电梯
32
+ this.fullHeight = fullHeight;
33
+ this.whiteBackground = whiteBackground;
30
34
  this.initChildren(children, initDataSource);
31
35
 
32
36
  this.initDataSource = initDataSource ? new AjaxSchema(initDataSource) : {};
@@ -39,21 +43,21 @@ export default class DetailSchema extends Schema {
39
43
  /* eslint-disable */
40
44
  this.children = children
41
45
  ? children
42
- .map((item) => {
43
- if (!item) return null;
44
- return new DetailItem(item);
45
- })
46
- .filter(Boolean)
46
+ .map((item) => {
47
+ if (!item) return null;
48
+ return new DetailItem(item);
49
+ })
50
+ .filter(Boolean)
47
51
  : [
48
- new DetailItem({
49
- groupId: '',
50
- type: 'detail-card',
51
- label: '基础信息',
52
- col: 3,
53
- columns: [],
54
- source: [initDataSource],
55
- }),
56
- ];
52
+ new DetailItem({
53
+ groupId: '',
54
+ type: 'detail-card',
55
+ label: '基础信息',
56
+ col: 3,
57
+ columns: [],
58
+ source: [initDataSource],
59
+ }),
60
+ ];
57
61
  }
58
62
 
59
63
  // 基础信息change key 主要是 hasBackBtn 和 backText
@@ -126,7 +130,7 @@ export default class DetailSchema extends Schema {
126
130
  // 根据schema初始化对象, 二次打开
127
131
  initFromCache(schema) {
128
132
  const { body, ...more } = schema;
129
- const { hasBackBtn, backText, hasAnchor, children } = body;
133
+ const { hasBackBtn, backText, hasAnchor, fullHeight, whiteBackground, children } = body;
130
134
 
131
135
  // 先关闭storage的更新
132
136
  // if (this.willDetach) {
@@ -136,6 +140,8 @@ export default class DetailSchema extends Schema {
136
140
  this.baseInfoChange('hasBackBtn', hasBackBtn);
137
141
  this.baseInfoChange('backText', backText);
138
142
  this.baseInfoChange('hasAnchor', hasAnchor);
143
+ this.baseInfoChange('fullHeight,', fullHeight);
144
+ this.baseInfoChange('whiteBackground,', whiteBackground);
139
145
  this.initChildren(children);
140
146
 
141
147
  this.refreshChildrenListener();
@@ -186,6 +192,8 @@ export default class DetailSchema extends Schema {
186
192
  hasBackBtn: this.hasBackBtn,
187
193
  backText: this.backText,
188
194
  hasAnchor: this.hasAnchor,
195
+ fullHeight: this.fullHeight,
196
+ whiteBackground: this.whiteBackground,
189
197
  children: this.children.map((item) => item.getJSON()),
190
198
  };
191
199
  }
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  export default class HeaderToolbar extends JSONWatch {
4
4
  constructor(operationFields = []) {
@@ -1,14 +1,14 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
2
- import { EVENT_KEY } from '@src/common/const';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
+ import { EVENT_KEY } from '$src/common/const';
3
3
  import Schema from '../Schema';
4
4
  import { Message } from '@cainiaofe/cn-ui';
5
5
  import Table from './table';
6
6
  import AjaxSchema from '../base-schema/AjaxSchema';
7
7
  import HeaderToolbar from './header-toolbar';
8
- import buildSwaggerApiJson from '@src/utils/buildSwaggerApiJson';
9
- import buildFieldsToCompJson from '@src/utils/buildFieldsToCompJson';
8
+ import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
9
+ import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
10
10
 
11
- export default class FtpSchema extends Schema {
11
+ export default class EditTableSchema extends Schema {
12
12
  /**
13
13
  * @param {*} props
14
14
  * type:"edit-table",
@@ -31,6 +31,7 @@ export default class FtpSchema extends Schema {
31
31
  hasAddRow = true,
32
32
  hasDeleteRow = true,
33
33
  headerToolbar = [],
34
+ maxRowLength,
34
35
  ...more
35
36
  } = isCompleteSchema ? props.body : props;
36
37
  super(more);
@@ -41,6 +42,7 @@ export default class FtpSchema extends Schema {
41
42
  this.deleteBtnText = deleteBtnText;
42
43
  this.hasSaveBtn = hasSaveBtn;
43
44
  this.hasAddRow = hasAddRow;
45
+ this.maxRowLength = maxRowLength;
44
46
  this.hasDeleteRow = hasDeleteRow;
45
47
 
46
48
  this.initApi = new AjaxSchema(initApi);
@@ -102,6 +104,7 @@ export default class FtpSchema extends Schema {
102
104
  hasAddRow,
103
105
  hasDeleteRow,
104
106
  headerToolbar,
107
+ maxRowLength,
105
108
  } = body;
106
109
 
107
110
  // 先关闭storage的更新
@@ -119,6 +122,7 @@ export default class FtpSchema extends Schema {
119
122
  this.saveBtnText = saveBtnText;
120
123
  this.hasSaveBtn = hasSaveBtn;
121
124
  this.hasAddRow = hasAddRow;
125
+ this.maxRowLength = maxRowLength;
122
126
  this.hasDeleteRow = hasDeleteRow;
123
127
 
124
128
  // 再开启change监听
@@ -191,6 +195,7 @@ export default class FtpSchema extends Schema {
191
195
  deleteBtnText: this.deleteBtnText,
192
196
  hasSaveBtn: this.hasSaveBtn,
193
197
  hasAddRow: this.hasAddRow,
198
+ maxRowLength: this.maxRowLength,
194
199
  hasDeleteRow: this.hasDeleteRow,
195
200
  initApi: this.initApi.getJSON(),
196
201
  submitApi: this.submitApi.getJSON(),
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  export default class TableSchema extends JSONWatch {
4
4
  constructor(props) {
@@ -9,12 +9,16 @@ export default class TableSchema extends JSONWatch {
9
9
  primaryKey = 'id',
10
10
  tree = false, // 开启树形
11
11
  showIndex = false, // 是否显示序号
12
- hideCommonToolbar = false, // 是否影藏通用顶部操作区
12
+ hideCommonToolbar = true, // 是否隐藏通用顶部操作区
13
+ useVirtual = true, // 开启虚拟滚动
14
+ columnsAutoWidth = true, // 开启列宽自适应
13
15
  pagination = {
14
16
  defaultPageSize: 20, // 默认分页大小
15
17
  paging: true, // 开启分页
16
18
  disableGlobalConfig: false, // 禁用全局分页配置
17
19
  },
20
+ maxHeight,
21
+ storageKey = Date.now(),
18
22
  } = props || {};
19
23
  super({
20
24
  columns,
@@ -25,6 +29,10 @@ export default class TableSchema extends JSONWatch {
25
29
  tree,
26
30
  showIndex,
27
31
  hideCommonToolbar,
32
+ useVirtual,
33
+ columnsAutoWidth,
34
+ maxHeight,
35
+ storageKey,
28
36
  });
29
37
  }
30
38
 
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  export default class DataSourceSchema extends JSONWatch {
4
4
  constructor(api) {
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  export default class FormSchema extends JSONWatch {
4
4
  constructor(props) {
@@ -1,13 +1,13 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
  import Schema from '../Schema';
3
3
  import DataSource from './data-source';
4
- import FormSchema from '@src/schema/formily-form/form-schema';
5
- import buildSwagerApiJosn from '@src/utils/buildSwaggerApiJson';
6
- import { schemaScenarioList } from '@src/services';
7
- import { makeSchema, list2Schema } from '@src/utils/formilyUtil';
8
- import { EVENT_KEY } from '@src/common/const';
9
- import buildFieldsToCompJson from '@src/utils/buildFieldsToCompJson';
10
- import buildSwaggerApiJson from '@src/utils/buildSwaggerApiJson';
4
+ import FormSchema from '$src/schema/formily-form/form-schema';
5
+ import buildSwagerApiJosn from '$src/utils/buildSwaggerApiJson';
6
+ import { schemaScenarioList } from '$src/services';
7
+ import { makeSchema, list2Schema } from '$src/utils/formilyUtil';
8
+ import { EVENT_KEY } from '$src/common/const';
9
+ import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
10
+ import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
11
11
  import upperFirst from 'lodash/upperFirst';
12
12
 
13
13
  const fieldsComp2FormilyComp = (str) => {
@@ -1,5 +1,5 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
2
- import { getDefaultFomrLabelAlign } from '@src/utils';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
+ import { getDefaultFomrLabelAlign } from '$src/utils';
3
3
 
4
4
  // 表单基础信息配置
5
5
  export default class FormInfo extends JSONWatch {
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  // 表单项配置
4
4
  export default class FormItems extends JSONWatch {
@@ -1,11 +1,11 @@
1
- import { EVENT_KEY } from '@src/common/const';
1
+ import { EVENT_KEY } from '$src/common/const';
2
2
  import Schema from '../Schema';
3
3
  import FormInfo from './form-info';
4
4
  import FormItems from './form-items';
5
5
  import AjaxSchema from '../base-schema/AjaxSchema';
6
6
  import AjaxSchemaQueue from '../base-schema/AjaxSchemaQueue';
7
- import buildSwaggerApiJson from '@src/utils/buildSwaggerApiJson';
8
- import buildFieldsToCompJson from '@src/utils/buildFieldsToCompJson';
7
+ import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
8
+ import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
9
9
 
10
10
  export default class FormilyFormV2Schema extends Schema {
11
11
  static FormInfo = FormInfo;
@@ -1,4 +1,4 @@
1
- import JSONWatch from '@src/utils/JSONWatch';
1
+ import JSONWatch from '$src/utils/JSONWatch';
2
2
 
3
3
  export default class DataSourceSchema extends JSONWatch {
4
4
  constructor(props) {