@cniot/mdd-editor 0.2.0-beta.9 → 0.3.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 (75) hide show
  1. package/README.MD +308 -11
  2. package/build/index.cjs.js +27 -19
  3. package/build/index.es.js +3731 -446
  4. package/build/style.css +1 -1
  5. package/package.json +1 -1
  6. package/src/ai/LocalAIDrawer.jsx +217 -0
  7. package/src/ai/bridgeClient.js +168 -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 +18 -4
  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,11 +1,11 @@
1
1
  import React from 'react';
2
- import { Form, Dialog, Switch, CnMessage, Input, Icon } from '@cainiaofe/cn-ui';
3
- import MddTableForm from '@src/components/mdd-table-form';
2
+ import { Form, Dialog, Switch, CnMessage, Input, Icon, NumberPicker } from '@cainiaofe/cn-ui';
3
+ import MddTableForm from '$src/components/mdd-table-form';
4
4
  import MultiAjaxSchemaForm from './MultiAjaxSchemaForm';
5
- import useSwagger from '@src/hooks/useSwagger';
6
- import buildSwaggerApiJson from '@src/utils/buildSwaggerApiJson';
7
- import buildFieldsToCompJson from '@src/utils/buildFieldsToCompJson';
8
- import MddForm from '@src/components/mdd-form';
5
+ import useSwagger from '$src/hooks/useSwagger';
6
+ import buildSwaggerApiJson from '$src/utils/buildSwaggerApiJson';
7
+ import buildFieldsToCompJson from '$src/utils/buildFieldsToCompJson';
8
+ import MddForm from '$src/components/mdd-form';
9
9
  import ActionPanel from './Actions';
10
10
  import { columnsTypeOptionsWithCnTable } from '../../const';
11
11
 
@@ -141,13 +141,18 @@ export default function DetailTable(props) {
141
141
  onChange={({ index, record }) => onPaginationChangeHandle({ index, record })}
142
142
  />
143
143
 
144
- <Form.Item labelAlign="left" label="是否影藏通用顶部操作区:" name="hideCommonToolbar">
144
+ <Form.Item labelAlign="left" label="是否隐藏通用顶部操作区:" name="hideCommonToolbar">
145
145
  <Switch autoWidth size="small" defaultChecked={data.get('hideCommonToolbar')} />
146
146
  </Form.Item>
147
147
 
148
148
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
149
149
  <label>最大高度:</label>
150
- <Input value={data.get('maxHeight')} size="small" onChange={(v) => tablePropsChange('maxHeight', v)} />
150
+ <NumberPicker
151
+ value={data.get('maxHeight')}
152
+ size="small"
153
+ onChange={(v) => tablePropsChange('maxHeight', v)}
154
+ min={0}
155
+ />
151
156
  <span className="mdd-tip">
152
157
  <Icon type="prompt" /> 该属性可以实现一屏展示,支持calc函数,eg: calc(100vh - 100px)
153
158
  </span>
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Icon, Button, Box } from '@cainiaofe/cn-ui';
3
- import AjaxSchemaForm from '@src/components/ajax-schema-form';
3
+ import AjaxSchemaForm from '$src/components/ajax-schema-form';
4
4
 
5
5
  // schema 是 detail-item 对象
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import MddTableForm from '@src/components/mdd-table-form';
2
+ import MddTableForm from '$src/components/mdd-table-form';
3
3
 
4
4
  export default function HeaderToolbarPanel({ schema }) {
5
5
  const mddFormRef = React.useRef();
@@ -19,7 +19,8 @@ export default function HeaderToolbarPanel({ schema }) {
19
19
  const onAddHandle = () => {
20
20
  schema.add(
21
21
  {
22
- type: 'batch-add',
22
+ // type: 'batch-add',
23
+ type: 'editButton',
23
24
  label: '批量新增',
24
25
  action: {
25
26
  type: 'drawer', // 目前必须是 drawer
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Input, Switch, Icon } from '@cainiaofe/cn-ui';
3
- import MddTableForm from '@src/components/mdd-table-form';
2
+ import { Input, Switch, Icon, NumberPicker } from '@cainiaofe/cn-ui';
3
+ import MddTableForm from '$src/components/mdd-table-form';
4
4
  import { columnsTypeOptionsWithEditCnTable } from '../const';
5
5
 
6
6
  export default function TablePanel({ schema, swaggerFields = [] }) {
@@ -15,6 +15,8 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
15
15
  const primaryKey = schema.get('primaryKey');
16
16
  // 批量操作
17
17
  const columns = schema.get('columns');
18
+ // 显示序号
19
+ const showIndex = schema.get('showIndex');
18
20
 
19
21
  const onAddHandle = (key) => {
20
22
  switch (key) {
@@ -47,6 +49,11 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
47
49
  schema.update('', value, 'primaryKey');
48
50
  };
49
51
 
52
+ // 基础属性变更
53
+ const onBaseInfoChange = (key, value) => {
54
+ schema.update('', value, key);
55
+ };
56
+
50
57
  return (
51
58
  <div>
52
59
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
@@ -69,11 +76,57 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
69
76
 
70
77
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
71
78
  <label>最大高度:</label>
72
- <Input value={schema.get('maxHeight')} size="small" onChange={(v) => schema.update('', v, 'maxHeight')} />
79
+ <NumberPicker
80
+ value={schema.get('maxHeight')}
81
+ size="small"
82
+ onChange={(v) => schema.update('', v, 'maxHeight')}
83
+ min={0}
84
+ />
73
85
  <span className="mdd-tip">
74
86
  <Icon type="prompt" /> 该属性可以实现一屏展示,支持calc函数,eg: calc(100vh - 100px)
75
87
  </span>
76
88
  </div>
89
+
90
+ <div style={{ marginLeft: '10px', marginBottom: 8 }}>
91
+ <label>是否显示序号:</label>
92
+ <Switch autoWidth checked={showIndex} size="small" onChange={(v) => onBaseInfoChange('showIndex', v)} />
93
+ <span className="mdd-tip">
94
+ <Icon type="prompt" /> 纯前端自动序号{' '}
95
+ </span>
96
+ </div>
97
+ <div style={{ marginLeft: '10px', marginBottom: 8 }}>
98
+ <label>是否开启虚拟滚动:</label>
99
+ <Switch
100
+ autoWidth
101
+ checked={schema.get('useVirtual')}
102
+ size="small"
103
+ onChange={(v) => onBaseInfoChange('useVirtual', v)}
104
+ />
105
+ </div>
106
+ <div style={{ marginLeft: '10px', marginBottom: 8 }}>
107
+ <label>是否开启自动列宽:</label>
108
+ <Switch
109
+ autoWidth
110
+ checked={schema.get('columnsAutoWidth')}
111
+ size="small"
112
+ onChange={(v) => onBaseInfoChange('columnsAutoWidth', v)}
113
+ />
114
+ <span className="mdd-tip">
115
+ <Icon type="prompt" /> 如果有性能问题可以关闭该属性,同时手动设置列宽
116
+ </span>
117
+ </div>
118
+ <div style={{ marginLeft: '10px', marginBottom: 8 }}>
119
+ <label>是否隐藏通用顶部操作区:</label>
120
+ <Switch
121
+ autoWidth
122
+ checked={schema.get('hideCommonToolbar')}
123
+ size="small"
124
+ onChange={(v) => onBaseInfoChange('hideCommonToolbar', v)}
125
+ />
126
+ <span className="mdd-tip">
127
+ <Icon type="prompt" /> 是否隐藏table顶部操作区的通用操作按钮,比如全屏、斑马线、列设置、尺寸等
128
+ </span>
129
+ </div>
77
130
  </div>
78
131
  );
79
132
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Form, NumberPicker, Select, Switch, Input } from '@cainiaofe/cn-ui';
3
- import MddForm from '@src/components/mdd-form';
3
+ import MddForm from '$src/components/mdd-form';
4
4
 
5
5
  const labelDataSource = [
6
6
  {
@@ -1,11 +1,7 @@
1
1
  import React from 'react';
2
- import MddTableForm, { PenetrateTypes } from '@src/components/mdd-table-form';
3
- import { componentOptions } from '../const';
4
- import { propFields } from '@src/common/comp-schema/fields/propFields';
5
-
6
- const FormComponentOptions = [...componentOptions];
7
- FormComponentOptions.splice(3, 0, { value: 'input-password', label: '密码输入框' });
8
- // FormComponentOptions.splice(8, 1); // 表单去除级联选择器
2
+ import MddTableForm, { PenetrateTypes } from '$src/components/mdd-table-form';
3
+ import { FormComponentOptions } from '../const';
4
+ import { propFields } from '$src/common/comp-schema/fields/propFields';
9
5
 
10
6
  export default function FormItemsPanel({ schema, swaggerFields = [] }) {
11
7
  const mddFormRef = React.useRef();
@@ -56,7 +52,7 @@ export default function FormItemsPanel({ schema, swaggerFields = [] }) {
56
52
  ref={mddFormRef}
57
53
  data={fields || []}
58
54
  penetrateType={PenetrateTypes.FORM}
59
- componentOptions={FormComponentOptions}
55
+ componentOptions={[...FormComponentOptions, , { value: 'blocks-form', label: '表单区块' }]}
60
56
  swaggerFieldDataSource={swaggerFields}
61
57
  title="配置表单项"
62
58
  onAdd={onAddHandle}
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  // import { Modal, Button } from 'antd';
3
3
 
4
- import DataSourceSelect from '@src/components/data-source-select';
4
+ import DataSourceSelect from '$src/components/data-source-select';
5
5
 
6
6
  // const AsyncDataSourceSetter = observer((props) => {
7
7
  // const [visible, setVisible] = useState(false);
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  // import { Modal, Button } from 'antd';
3
3
 
4
- import ParamsSelect from '@src/components/params-select';
4
+ import ParamsSelect from '$src/components/params-select';
5
5
 
6
6
  // const SubmitActionSetter = observer((props) => {
7
7
  // const [visible, setVisible] = useState(false);
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback } from 'react';
2
- import DataSourceSelect from '@src/components/data-source-select';
2
+ import DataSourceSelect from '$src/components/data-source-select';
3
3
 
4
4
  function DataSource({ schema }) {
5
5
  const [_, forceUpdate] = React.useState({});
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Form, NumberPicker, Select, Input, Switch } from '@cainiaofe/cn-ui';
3
- import MddTableForm, { PenetrateTypes } from '@src/components/mdd-table-form';
4
- import MddForm from '@src/components/mdd-form';
3
+ import MddTableForm, { PenetrateTypes } from '$src/components/mdd-table-form';
4
+ import MddForm from '$src/components/mdd-form';
5
5
  import { componentOptions } from '../const';
6
6
 
7
- import { propFields } from '@src/common/comp-schema/fields/propFields';
7
+ import { propFields } from '$src/common/comp-schema/fields/propFields';
8
8
 
9
9
  const labelDataSource = [
10
10
  {
@@ -83,10 +83,14 @@ export default function FilterPanel({ schema, swaggerFields = [] }) {
83
83
  const mddFormRef = React.useRef();
84
84
  const [_, forceUpdate] = React.useState({});
85
85
  React.useEffect(() => {
86
- schema.on('$updated', (changeData, ignoreUpdate) => {
86
+ const handleUpdated = (changeData, ignoreUpdate) => {
87
87
  !ignoreUpdate && forceUpdate({});
88
- });
89
- }, []);
88
+ };
89
+ schema.on('$updated', handleUpdated);
90
+ return () => {
91
+ schema.off('$updated', handleUpdated);
92
+ };
93
+ }, [schema]);
90
94
 
91
95
  const fields = schema.get('fields');
92
96
 
@@ -121,7 +125,7 @@ export default function FilterPanel({ schema, swaggerFields = [] }) {
121
125
  ref={mddFormRef}
122
126
  data={fields}
123
127
  penetrateType={PenetrateTypes.FILTER}
124
- componentOptions={componentOptions}
128
+ componentOptions={[...componentOptions, { value: 'blocks-filter', label: '筛选项区块' }]}
125
129
  title="配置查询条件"
126
130
  onAdd={onAddHandle}
127
131
  onRemove={onRemoveHandle}
@@ -140,6 +144,9 @@ export default function FilterPanel({ schema, swaggerFields = [] }) {
140
144
  schema.set(item.name, item.value);
141
145
  }}
142
146
  >
147
+ <Form.Item label="默认展开:" name="defaultExpand" help="仅在 新版布局中生效">
148
+ <Switch defaultChecked={schema.get('defaultExpand')} />
149
+ </Form.Item>
143
150
  <Form.Item label="文本位置:" name="labelAlign">
144
151
  <Select dataSource={labelDataSource} defaultValue={schema.get('labelAlign')} />
145
152
  </Form.Item>
@@ -1,14 +1,18 @@
1
1
  import React from 'react';
2
- import MddTableForm from '@src/components/mdd-table-form';
2
+ import MddTableForm from '$src/components/mdd-table-form';
3
3
 
4
4
  export default function HeaderToolbarPanel({ schema, moduleMap }) {
5
5
  const mddFormRef = React.useRef();
6
6
  const [_, forceUpdate] = React.useState({});
7
7
  React.useEffect(() => {
8
- schema.on('$updated', (changeData, ignoreUpdate) => {
8
+ const handleUpdated = (changeData, ignoreUpdate) => {
9
9
  !ignoreUpdate && forceUpdate({});
10
- });
11
- }, []);
10
+ };
11
+ schema.on('$updated', handleUpdated);
12
+ return () => {
13
+ schema.off('$updated', handleUpdated);
14
+ };
15
+ }, [schema]);
12
16
 
13
17
  const operationFields = schema.getData();
14
18
 
@@ -2,11 +2,11 @@
2
2
  * 中间模块区
3
3
  */
4
4
  import React from 'react';
5
- import MddTableSimpleArray from '@src/components/mdd-table-simple-array';
6
- import TableFromProxy from '@src/components/ajax-schema-form/table-form-proxy';
5
+ import MddTableSimpleArray from '$src/components/mdd-table-simple-array';
6
+ import TableFromProxy from '$src/components/ajax-schema-form/table-form-proxy';
7
7
  import { Select, Input, Icon } from '@cainiaofe/cn-ui';
8
- import AjaxSchemaForm from '@src/components/ajax-schema-form';
9
- import DynamicValueBase from '@src/components/dynamic-value/base';
8
+ import AjaxSchemaForm from '$src/components/ajax-schema-form';
9
+ import DynamicValueBase from '$src/components/dynamic-value/base';
10
10
 
11
11
  import styles from './index.module.scss';
12
12
 
@@ -23,10 +23,14 @@ export default function Middle(props) {
23
23
  const [_, forceUpdate] = React.useState({});
24
24
 
25
25
  React.useEffect(() => {
26
- schema.on('$updated', (changeData, ignoreUpdate) => {
26
+ const handleUpdated = (changeData, ignoreUpdate) => {
27
27
  !ignoreUpdate && forceUpdate({});
28
- });
29
- }, []);
28
+ };
29
+ schema.on('$updated', handleUpdated);
30
+ return () => {
31
+ schema.off('$updated', handleUpdated);
32
+ };
33
+ }, [schema]);
30
34
 
31
35
  const onAddHandle = () => {
32
36
  schema.addMiddle();
@@ -1,25 +1,30 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { Input, Switch, Icon, NumberPicker } from '@cainiaofe/cn-ui';
3
- import MddTableForm from '@src/components/mdd-table-form';
4
- import MddForm from '@src/components/mdd-form';
5
- import AjaxSchemaForm from '@src/components/ajax-schema-form';
2
+ import { Input, Switch, Icon, NumberPicker, CnSwitch, CnTooltip } from '@cainiaofe/cn-ui';
3
+ import MddTableForm from '$src/components/mdd-table-form';
4
+ import MddForm from '$src/components/mdd-form';
5
+ import AjaxSchemaForm from '$src/components/ajax-schema-form';
6
6
  import { columnsTypeOptionsWithCnTable } from '../const';
7
7
 
8
8
  export default function TablePanel({ schema, swaggerFields = [] }) {
9
9
  const columnMddFormRef = React.useRef();
10
10
  const bulkMddFormRef = React.useRef();
11
11
  const operateMddFormRef = React.useRef();
12
+ const rowDoubleClickRef = React.useRef();
12
13
 
13
14
  const [_, forceUpdate] = useState({});
14
15
  const [visibleRowDetail, setVisibleRowDetail] = useState(!!schema.get('rowDetailModule')?.path);
15
16
  useEffect(() => {
16
- schema.on('$updated', (changeData, ignoreUpdate) => {
17
+ const handleUpdated = (changeData, ignoreUpdate) => {
17
18
  !ignoreUpdate && forceUpdate({});
18
- });
19
+ };
20
+ schema.on('$updated', handleUpdated);
19
21
 
20
22
  // hack处理
21
23
  hackRowDetail(schema);
22
- }, []);
24
+ return () => {
25
+ schema.off('$updated', handleUpdated);
26
+ };
27
+ }, [schema]);
23
28
  // 主键
24
29
  const primaryKey = schema.get('primaryKey');
25
30
  // 批量操作
@@ -27,13 +32,17 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
27
32
  const columns = schema.get('columns');
28
33
  // 操作列
29
34
  const actionColumns = schema.get('actionColumns');
35
+ // 行双击配置
36
+ const rowDoubleClick = schema.get('rowDoubleClick');
30
37
  const pagination = schema.get('pagination');
31
38
  // 树形
32
39
  const tree = schema.get('tree');
33
40
  // 显示序号
34
41
  const showIndex = schema.get('showIndex');
35
- // 影藏底部操作区
42
+ // 隐藏底部操作区
36
43
  const hideCommonToolbar = schema.get('hideCommonToolbar');
44
+ // 操作列按钮最长字符数
45
+ const actionMaxCharNum = schema.get('actionMaxCharNum');
37
46
  // 操作列宽度
38
47
  const actionWidth = schema.get('actionWidth');
39
48
  // 是否显示多选
@@ -42,6 +51,8 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
42
51
  const rowDetailModule = schema.get('rowDetailModule');
43
52
  // 远程排序
44
53
  const remoteSort = schema.get('remoteSort');
54
+ // 父子节点级联勾选
55
+ const treeLinkageCheck = schema.get('treeLinkageCheck');
45
56
 
46
57
  // 加载子节点数据源面板
47
58
  const loadChildrenDataApiPanel = schema.getLoadChildrenDataApiPanel();
@@ -98,6 +109,23 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
98
109
  );
99
110
  operateMddFormRef.current?.updateData(schema.get('actionColumns'));
100
111
  break;
112
+ case 'rowDoubleClick':
113
+ // 操作列,默认带上当前行对象
114
+ schema.add(
115
+ {
116
+ type: 'button',
117
+ action: {
118
+ type: 'url',
119
+ params: {
120
+ record: '$TABLE.RECORD_DATA',
121
+ },
122
+ },
123
+ },
124
+ 'rowDoubleClick',
125
+ true,
126
+ );
127
+ rowDoubleClickRef.current?.updateData(schema.get('rowDoubleClick'));
128
+ break;
101
129
  default:
102
130
  break;
103
131
  }
@@ -111,6 +139,8 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
111
139
  columnMddFormRef.current?.updateData(schema.get('columns'));
112
140
  } else if (key === 'actionColumns') {
113
141
  operateMddFormRef.current?.updateData(schema.get('actionColumns'));
142
+ } else if (key === 'rowDoubleClick') {
143
+ rowDoubleClickRef.current?.updateData(schema.get('rowDoubleClick'));
114
144
  }
115
145
  };
116
146
 
@@ -118,6 +148,10 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
118
148
  schema.update(index, record, key, true);
119
149
  };
120
150
 
151
+ const onActionMaxCharNum = (value) => {
152
+ schema.update('', value ? Number(value) : '', 'actionMaxCharNum');
153
+ };
154
+
121
155
  const onActionWidthChange = (value) => {
122
156
  schema.update('', value ? Number(value) : '', 'actionWidth');
123
157
  };
@@ -132,6 +166,7 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
132
166
  if (!value) {
133
167
  // 关闭直接初始化rowDetailModule字段
134
168
  onChangeHandle({}, 'rowDetailModule');
169
+ onBaseInfoChange('rowDetailDefaultOpenAll', false);
135
170
  }
136
171
  };
137
172
 
@@ -178,6 +213,39 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
178
213
  schema.setItemAll(newList, 'actionColumns', true);
179
214
  }}
180
215
  />
216
+ <MddTableForm
217
+ ref={rowDoubleClickRef}
218
+ data={rowDoubleClick}
219
+ title={() => (
220
+ <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
221
+ 配置行双击事件
222
+ <CnSwitch
223
+ size="small"
224
+ checked={schema.get('rowDoubleClick')?.length > 0}
225
+ onChange={(checked) => {
226
+ if (checked) onAddHandle('rowDoubleClick');
227
+ else onRemoveHandle(0, 'rowDoubleClick');
228
+ }}
229
+ />
230
+ <CnTooltip trigger={<Icon type="prompt" />}>
231
+ 行双击事件 和 操作列按钮 配置保持一致,下面 关于按钮的配置 均会失效,请只关注 双击 要执行的事件本身
232
+ </CnTooltip>
233
+ </div>
234
+ )}
235
+ titleType={[]}
236
+ draggable={false}
237
+ titleRender={() => '行双击 事件配置'}
238
+ onRemove={() => {}}
239
+ onChange={({ index, record }) => onChangeHandle({ index, record }, 'rowDoubleClick')}
240
+ />
241
+ <div style={{ marginLeft: '10px', marginBottom: 8 }}>
242
+ <label>操作列按钮最长字符数:</label>
243
+ <NumberPicker value={actionMaxCharNum} size="small" onChange={onActionMaxCharNum} min={1} max={10} />
244
+ <span className="mdd-tip">
245
+ <Icon type="prompt" /> 超长部分会显示为“...”[注意:需全局开启配置后 此项生效;在低版本 CN-UI 上不生效,如
246
+ 实施工作台;可能会对一码多端效果造成影响,慎用]
247
+ </span>
248
+ </div>
181
249
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
182
250
  <label>操作列宽度:</label>
183
251
  <Input value={actionWidth} size="small" onChange={onActionWidthChange} />
@@ -187,7 +255,12 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
187
255
  </div>
188
256
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
189
257
  <label>最大高度:</label>
190
- <Input value={schema.get('maxHeight')} size="small" onChange={(v) => onBaseInfoChange('maxHeight', v)} />
258
+ <NumberPicker
259
+ value={schema.get('maxHeight')}
260
+ size="small"
261
+ onChange={(v) => onBaseInfoChange('maxHeight', v)}
262
+ min={0}
263
+ />
191
264
  <span className="mdd-tip">
192
265
  <Icon type="prompt" /> 该属性可以实现一屏展示,支持calc函数,eg: calc(100vh - 100px)
193
266
  </span>
@@ -217,6 +290,17 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
217
290
  onChange={({ index, record }) => onChangeHandle({ index, record }, 'rowDetailModule')}
218
291
  />
219
292
  )}
293
+ {visibleRowDetail && (
294
+ <div style={{ marginLeft: '10px', marginBottom: 8 }}>
295
+ <label>行详情是否默认展开全部:</label>
296
+ <Switch
297
+ autoWidth
298
+ checked={schema.get('rowDetailDefaultOpenAll')}
299
+ size="small"
300
+ onChange={(v) => onBaseInfoChange('rowDetailDefaultOpenAll', v)}
301
+ />
302
+ </div>
303
+ )}
220
304
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
221
305
  <label>树形:</label>
222
306
  <Switch autoWidth checked={tree} size="small" onChange={(v) => onBaseInfoChange('tree', v)} />
@@ -225,8 +309,25 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
225
309
  开启后也可通过下面的懒加载设置改成懒加载模式,不配置则需要一次性返回树形数据
226
310
  </span>
227
311
  </div>
312
+
228
313
  {tree && (
229
- <div style={{ marginLeft: '10px', marginBottom: 8, display: 'flex' }}>
314
+ <div style={{ marginLeft: '20px', marginBottom: 8, display: 'flex' }}>
315
+ <label>父子节点级联勾选:</label>
316
+ <Switch
317
+ autoWidth
318
+ checked={treeLinkageCheck}
319
+ size="small"
320
+ onChange={(v) => onBaseInfoChange('treeLinkageCheck', v)}
321
+ />
322
+
323
+ <span className="mdd-tip">
324
+ <Icon type="prompt" />{' '}
325
+ 父节点勾选默认会勾选所有子节点,子节点勾选默认会勾上父节点【必须配置唯一主键,不支持异步数据】
326
+ </span>
327
+ </div>
328
+ )}
329
+ {tree && (
330
+ <div style={{ marginLeft: '20px', marginBottom: 8, display: 'flex' }}>
230
331
  <label>子节点懒加载配置:</label>
231
332
  <div>
232
333
  <AjaxSchemaForm schema={loadChildrenDataApiPanel} isSelectType={false} />
@@ -236,6 +337,7 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
236
337
  </div>
237
338
  </div>
238
339
  )}
340
+
239
341
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
240
342
  <label>是否显示序号:</label>
241
343
  <Switch autoWidth checked={showIndex} size="small" onChange={(v) => onBaseInfoChange('showIndex', v)} />
@@ -244,7 +346,7 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
244
346
  </span>
245
347
  </div>
246
348
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
247
- <label>是否影藏通用顶部操作区:</label>
349
+ <label>是否隐藏通用顶部操作区:</label>
248
350
  <Switch
249
351
  autoWidth
250
352
  checked={hideCommonToolbar}
@@ -252,7 +354,7 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
252
354
  onChange={(v) => onBaseInfoChange('hideCommonToolbar', v)}
253
355
  />
254
356
  <span className="mdd-tip">
255
- <Icon type="prompt" /> 是否影藏table顶部操作区的通用操作按钮,比如全屏、斑马线、列设置、尺寸等
357
+ <Icon type="prompt" /> 是否隐藏table顶部操作区的通用操作按钮,比如全屏、斑马线、列设置、尺寸等
256
358
  </span>
257
359
  </div>
258
360
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
@@ -283,6 +385,35 @@ export default function TablePanel({ schema, swaggerFields = [] }) {
283
385
  <Icon type="prompt" /> 纯前端筛选
284
386
  </span>
285
387
  </div>
388
+
389
+ <div style={{ marginLeft: '10px', marginBottom: 8 }}>
390
+ <label>是否开启多维指标排序:</label>
391
+ <Switch
392
+ autoWidth
393
+ checked={schema.get('customSort')}
394
+ size="small"
395
+ onChange={(v) => {
396
+ onBaseInfoChange('customSort', v);
397
+ !v && onBaseInfoChange('customSortStorage', '');
398
+ }}
399
+ />
400
+ <span className="mdd-tip">
401
+ <Icon type="prompt" /> 纯前端排序
402
+ </span>
403
+
404
+ {schema.get('customSort') && (
405
+ <Input
406
+ style={{ marginLeft: 8 }}
407
+ value={schema.get('customSortStorage')}
408
+ size="small"
409
+ placeholder="跟随页面缓存"
410
+ onChange={(v) => {
411
+ onBaseInfoChange('customSortStorage', v);
412
+ }}
413
+ />
414
+ )}
415
+ </div>
416
+
286
417
  <div style={{ marginLeft: '10px', marginBottom: 8 }}>
287
418
  <label>是否开启列头复制:</label>
288
419
  <Switch autoWidth checked={schema.get('copy')} size="small" onChange={(v) => onBaseInfoChange('copy', v)} />
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { Input, Switch, Icon, NumberPicker } from '@cainiaofe/cn-ui';
3
- import MddTableForm from '@src/components/mdd-table-form';
4
- import MddForm from '@src/components/mdd-form';
3
+ import MddTableForm from '$src/components/mdd-table-form';
4
+ import MddForm from '$src/components/mdd-form';
5
5
  import { columnsTypeOptionsWithCnTable } from '../const';
6
6
 
7
7
  export default function TablePanel({ schema }) {