neo-cmp-cli 1.1.11 → 1.1.13
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/package.json +1 -1
- package/src/cmpUtils/createCommonModulesCode.js +32 -3
- package/src/cmpUtils/getEntries.js +10 -8
- package/src/cmpUtils/getEntriesWithAutoRegister.js +10 -7
- package/src/module/index.js +2 -0
- package/src/module/main.js +37 -36
- package/src/neo/neoRequire.js +19 -8
- package/src/template/antd-custom-cmp-template/neo.config.js +2 -1
- package/src/template/antd-custom-cmp-template/package.json +1 -1
- package/src/template/antd-custom-cmp-template/src/components/{info-card2 → info-card}/model.ts +1 -1
- package/src/template/echarts-custom-cmp-template/neo.config.js +4 -1
- package/src/template/echarts-custom-cmp-template/package.json +1 -1
- package/src/template/neo-custom-cmp-template/package.json +1 -1
- package/src/template/neo-custom-cmp-template/src/components/neo-entity-grid/README.md +0 -13
- package/src/template/react-custom-cmp-template/package.json +1 -1
- package/src/template/react-ts-custom-cmp-template/package.json +1 -1
- package/src/template/vue2-custom-cmp-template/package.json +1 -1
- /package/src/template/antd-custom-cmp-template/src/components/{info-card2 → info-card}/index.tsx +0 -0
- /package/src/template/antd-custom-cmp-template/src/components/{info-card2 → info-card}/style.scss +0 -0
package/package.json
CHANGED
|
@@ -8,11 +8,16 @@ const { isPlainObject } = require('lodash');
|
|
|
8
8
|
* @param {*} cmpName 自定义组件名称
|
|
9
9
|
* @returns 组件预览代码
|
|
10
10
|
*/
|
|
11
|
-
const createCommonModulesCode = (
|
|
12
|
-
|
|
11
|
+
const createCommonModulesCode = (neoCommonModule, cmpTypes) => {
|
|
12
|
+
const {neoExports, remotes} = neoCommonModule;
|
|
13
|
+
|
|
14
|
+
if (!neoExports && !remotes) {
|
|
13
15
|
return '';
|
|
14
16
|
}
|
|
17
|
+
// 记录当前自定义组件共享出去的模块
|
|
15
18
|
const CustomCmpCommonModules = {};
|
|
19
|
+
// 记录当前自定义组件需要的远程组件
|
|
20
|
+
const CustomCmpRemotes = {};
|
|
16
21
|
|
|
17
22
|
// 根据 neoExports 获取共享的依赖模块
|
|
18
23
|
if (Array.isArray(neoExports) && neoExports.length > 0) {
|
|
@@ -30,6 +35,13 @@ const createCommonModulesCode = (neoExports) => {
|
|
|
30
35
|
process.exit(1);
|
|
31
36
|
}
|
|
32
37
|
|
|
38
|
+
// 根据 cmpTypes 和 remotes 设置远程组件信息
|
|
39
|
+
if (Array.isArray(cmpTypes) && cmpTypes.length > 0) {
|
|
40
|
+
cmpTypes.forEach((cmpType) => {
|
|
41
|
+
CustomCmpRemotes[cmpType] = remotes;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
// 构建 CustomCmpCommonModules 对象的代码字符串
|
|
34
46
|
let customCmpCommonModulesCode = '{\n';
|
|
35
47
|
const moduleEntries = Object.entries(CustomCmpCommonModules);
|
|
@@ -44,16 +56,33 @@ const createCommonModulesCode = (neoExports) => {
|
|
|
44
56
|
* 自定义组件 共享出来的依赖模块
|
|
45
57
|
* 备注:可在其他模块中通过 neoRequire 中使用
|
|
46
58
|
*/
|
|
59
|
+
import { isPlainObject } from 'lodash';
|
|
47
60
|
const CustomCmpCommonModules = ${customCmpCommonModulesCode};
|
|
61
|
+
const CustomCmpRemotes = ${JSON.stringify(CustomCmpRemotes)};
|
|
48
62
|
|
|
49
63
|
// 用于添加共享的依赖模块
|
|
50
64
|
const addNeoCommonModules = (modules) => {
|
|
51
65
|
if (!window.__NeoCommonModules) {
|
|
52
66
|
window.__NeoCommonModules = {};
|
|
53
67
|
}
|
|
54
|
-
|
|
68
|
+
if (isPlainObject(modules)) {
|
|
69
|
+
window.__NeoCommonModules = Object.assign(window.__NeoCommonModules, modules)
|
|
70
|
+
}
|
|
55
71
|
};
|
|
56
72
|
|
|
73
|
+
// 用于添加自定义组件的远程组件(关联使用)
|
|
74
|
+
const addNeoRemotes = (remotes) => {
|
|
75
|
+
if (!window.__NeoCommonModules) {
|
|
76
|
+
window.__NeoCommonModules = {}
|
|
77
|
+
}
|
|
78
|
+
if (!window.__NeoCommonModules.remotes) {
|
|
79
|
+
window.__NeoCommonModules.remotes = {}
|
|
80
|
+
}
|
|
81
|
+
if (isPlainObject(remotes)) {
|
|
82
|
+
window.__NeoCommonModules.remotes = Object.assign(window.__NeoCommonModules.remotes, remotes)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
57
86
|
addNeoCommonModules(CustomCmpCommonModules);
|
|
58
87
|
`;
|
|
59
88
|
|
|
@@ -5,15 +5,15 @@ const { resolveToCurrentRoot } = require('../utils/pathUtils');
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 从指定目录获取组件入口文件
|
|
8
|
-
* @param {*} buildType 构建类型
|
|
9
8
|
* @param {*} defaultComponentsDir 默认组件目录
|
|
10
9
|
* @returns 组件入口文件
|
|
11
10
|
*/
|
|
12
|
-
module.exports = (
|
|
11
|
+
module.exports = (defaultComponentsDir = './src/components') => {
|
|
13
12
|
const widgetEntries = {};
|
|
14
13
|
const linkDebugEntries = {
|
|
15
14
|
index: []
|
|
16
15
|
};
|
|
16
|
+
const cmpTypes = []; // 用于记录组件名称
|
|
17
17
|
const componentsBaseDir = resolveToCurrentRoot(defaultComponentsDir);
|
|
18
18
|
if (!fs.existsSync(componentsBaseDir)) {
|
|
19
19
|
console.error(`未找到组件目录,请检查 ${defaultComponentsDir} 目录是否存在`);
|
|
@@ -37,11 +37,13 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
37
37
|
const curCmpName = dir; // _.camelCase(dir);
|
|
38
38
|
const cmpNameKey = _.camelCase(curCmpName);
|
|
39
39
|
|
|
40
|
+
// 记录组件类型
|
|
41
|
+
cmpTypes.push(curCmpName);
|
|
42
|
+
|
|
40
43
|
fs.readdirSync(curCmpPath)
|
|
41
44
|
.filter((file) => file.match(/[register|model]\.[tj]sx?$/))
|
|
42
45
|
.map((file) => path.join(defaultComponentsDir, curCmpName, file))
|
|
43
46
|
.forEach((filePath) => {
|
|
44
|
-
console.log(filePath);
|
|
45
47
|
const curPath = `./${filePath}`;
|
|
46
48
|
if (filePath.match(/register\.[tj]sx?$/)) {
|
|
47
49
|
widgetEntries[cmpNameKey] = curPath;
|
|
@@ -52,10 +54,6 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
|
-
|
|
56
|
-
if (buildType === 'linkDebug') {
|
|
57
|
-
return linkDebugEntries;
|
|
58
|
-
}
|
|
59
57
|
} catch (error) {
|
|
60
58
|
console.error('获取自定义组件入口文件失败(getEntries):', error);
|
|
61
59
|
|
|
@@ -63,5 +61,9 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
63
61
|
process.exit(1);
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
widgetEntries,
|
|
66
|
+
linkDebugEntries,
|
|
67
|
+
cmpTypes,
|
|
68
|
+
};
|
|
67
69
|
};
|
|
@@ -6,15 +6,15 @@ const getCmpRegister = require('./getCmpRegister');
|
|
|
6
6
|
const getCmpModelRegister = require('./getCmpModelRegister');
|
|
7
7
|
/**
|
|
8
8
|
* 从指定目录获取组件入口文件,并自动创建对应的注册文件
|
|
9
|
-
* @param {*} buildType 构建类型
|
|
10
9
|
* @param {*} defaultComponentsDir 默认组件目录
|
|
11
10
|
* @returns 组件入口文件
|
|
12
11
|
*/
|
|
13
|
-
module.exports = (
|
|
12
|
+
module.exports = (defaultComponentsDir = './src/components') => {
|
|
14
13
|
const widgetEntries = {};
|
|
15
14
|
const linkDebugEntries = {
|
|
16
15
|
index: []
|
|
17
16
|
};
|
|
17
|
+
const cmpTypes = []; // 用于记录组件名称
|
|
18
18
|
const componentsBaseDir = resolveToCurrentRoot(defaultComponentsDir);
|
|
19
19
|
if (!fs.existsSync(componentsBaseDir)) {
|
|
20
20
|
console.error(`未找到组件目录,请检查 ${defaultComponentsDir} 目录是否存在`);
|
|
@@ -47,6 +47,9 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
47
47
|
const curCmpName = dir; // _.camelCase(dir);
|
|
48
48
|
const cmpNameKey = _.camelCase(curCmpName);
|
|
49
49
|
|
|
50
|
+
// 记录组件类型
|
|
51
|
+
cmpTypes.push(curCmpName);
|
|
52
|
+
|
|
50
53
|
// 当前自定义组件临时目录
|
|
51
54
|
const cmpTempDir = `${cliTempDir}/${curCmpName}`;
|
|
52
55
|
if (!fs.existsSync(cmpTempDir)) {
|
|
@@ -81,10 +84,6 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
81
84
|
});
|
|
82
85
|
}
|
|
83
86
|
});
|
|
84
|
-
|
|
85
|
-
if (buildType === 'linkDebug') {
|
|
86
|
-
return linkDebugEntries;
|
|
87
|
-
}
|
|
88
87
|
} catch (error) {
|
|
89
88
|
console.error('获取自定义组件入口文件失败(getEntriesWithAutoRegister):', error);
|
|
90
89
|
|
|
@@ -92,5 +91,9 @@ module.exports = (buildType = 'build2lib', defaultComponentsDir = './src/compone
|
|
|
92
91
|
process.exit(1);
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
return
|
|
94
|
+
return {
|
|
95
|
+
widgetEntries,
|
|
96
|
+
linkDebugEntries,
|
|
97
|
+
cmpTypes,
|
|
98
|
+
};
|
|
96
99
|
};
|
package/src/module/index.js
CHANGED
package/src/module/main.js
CHANGED
|
@@ -21,8 +21,6 @@ const getValue = (originValue, defaultValue) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const neoCommonModule = curConfig.neoCommonModule || {};
|
|
24
|
-
// 自定义组件 共享出来的依赖模块
|
|
25
|
-
const cmpNeoExports = neoCommonModule.neoExports || [];
|
|
26
24
|
// 自定义组件 需要剔除的依赖模块
|
|
27
25
|
const cmpNeoExternals = neoCommonModule.neoExternals || [];
|
|
28
26
|
|
|
@@ -72,16 +70,21 @@ module.exports = {
|
|
|
72
70
|
curConfig.webpack.ignoreNodeModules = false;
|
|
73
71
|
|
|
74
72
|
const curEntry = curConfig.dev.entry;
|
|
73
|
+
let curCmpTypes = [];
|
|
75
74
|
|
|
76
75
|
if (!curEntry || Object.keys(curEntry).length === 0) {
|
|
77
76
|
// 如果未配置 entry,则自动生成 entry
|
|
78
77
|
let entries = {};
|
|
79
78
|
if (curConfig.dev.disableAutoRegister) {
|
|
80
79
|
// disableAutoRegister 为 true 时,仅自动生成入口文件(不自动注册)
|
|
81
|
-
|
|
80
|
+
const { linkDebugEntries, cmpTypes } = getEntries(curConfig.componentsDir);
|
|
81
|
+
entries = linkDebugEntries;
|
|
82
|
+
curCmpTypes = cmpTypes;
|
|
82
83
|
} else {
|
|
83
84
|
// 自动生成入口文件(并自动创建对应的注册文件)
|
|
84
|
-
|
|
85
|
+
const { linkDebugEntries, cmpTypes } = getEntriesWithAutoRegister(curConfig.componentsDir);
|
|
86
|
+
entries = linkDebugEntries;
|
|
87
|
+
curCmpTypes = cmpTypes;
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
// 注入 webpack/entry
|
|
@@ -125,21 +128,14 @@ module.exports = {
|
|
|
125
128
|
curConfig.dev.externals = neoExternals;
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
((Array.isArray(cmpNeoExports) && cmpNeoExports.length > 0) ||
|
|
131
|
-
(_.isPlainObject(cmpNeoExports) && Object.keys(cmpNeoExports).length > 0))
|
|
132
|
-
) {
|
|
133
|
-
const commonModulesFilePath = createCommonModulesCode(cmpNeoExports);
|
|
131
|
+
// 写入自定义组件的共享模块和远程模块相关信息
|
|
132
|
+
const commonModulesFilePath = createCommonModulesCode(neoCommonModule, curCmpTypes);
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
134
|
+
// 所有入口文件添加 commonModulesFile
|
|
135
|
+
if (commonModulesFilePath && curConfig.dev.entry) {
|
|
136
|
+
Object.keys(curConfig.dev.entry).forEach((name) => {
|
|
137
|
+
curConfig.dev.entry[name] = [commonModulesFilePath].concat(curConfig.dev.entry[name]);
|
|
138
|
+
});
|
|
143
139
|
}
|
|
144
140
|
|
|
145
141
|
akfun.dev(curConfig, consoleTag);
|
|
@@ -147,16 +143,21 @@ module.exports = {
|
|
|
147
143
|
build: () => akfun.build('build', curConfig, consoleTag), // 构建脚本:生产环境
|
|
148
144
|
build2lib: () => {
|
|
149
145
|
const curEntry = curConfig.build2lib.entry;
|
|
146
|
+
let curCmpTypes = [];
|
|
150
147
|
|
|
151
148
|
if (!curEntry || Object.keys(curEntry).length === 0) {
|
|
152
149
|
// 如果未配置 entry,则自动生成 entry
|
|
153
150
|
let entries = {};
|
|
154
151
|
if (curConfig.build2lib.disableAutoRegister) {
|
|
155
152
|
// disableAutoRegister 为 true 时,仅自动生成入口文件(不自动注册)
|
|
156
|
-
|
|
153
|
+
const { widgetEntries, cmpTypes } = getEntries(curConfig.componentsDir);
|
|
154
|
+
entries = widgetEntries;
|
|
155
|
+
curCmpTypes = cmpTypes;
|
|
157
156
|
} else {
|
|
158
157
|
// 自动生成入口文件(并自动创建对应的注册文件)
|
|
159
|
-
|
|
158
|
+
const { widgetEntries, cmpTypes } = getEntriesWithAutoRegister(curConfig.componentsDir);
|
|
159
|
+
entries = widgetEntries;
|
|
160
|
+
curCmpTypes = cmpTypes;
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
// 注入 webpack/entry
|
|
@@ -189,16 +190,21 @@ module.exports = {
|
|
|
189
190
|
curConfig.build2lib = Object.assign(curConfig.build2lib, publish2ossConfig);
|
|
190
191
|
|
|
191
192
|
const curEntry = curConfig.build2lib.entry;
|
|
193
|
+
let curCmpTypes = [];
|
|
192
194
|
|
|
193
195
|
if (!curEntry || Object.keys(curEntry).length === 0) {
|
|
194
196
|
// 如果未配置 entry,则自动生成 entry
|
|
195
197
|
let entries = {};
|
|
196
198
|
if (curConfig.build2lib.disableAutoRegister) {
|
|
197
199
|
// disableAutoRegister 为 true 时,仅自动生成入口文件(不自动注册)
|
|
198
|
-
|
|
200
|
+
const { widgetEntries, cmpTypes } = getEntries(curConfig.componentsDir);
|
|
201
|
+
entries = widgetEntries;
|
|
202
|
+
curCmpTypes = cmpTypes;
|
|
199
203
|
} else {
|
|
200
204
|
// 自动生成入口文件(并自动创建对应的注册文件)
|
|
201
|
-
|
|
205
|
+
const { widgetEntries, cmpTypes } = getEntriesWithAutoRegister(curConfig.componentsDir);
|
|
206
|
+
entries = widgetEntries;
|
|
207
|
+
curCmpTypes = cmpTypes;
|
|
202
208
|
}
|
|
203
209
|
|
|
204
210
|
// 注入 webpack/entry
|
|
@@ -242,21 +248,16 @@ module.exports = {
|
|
|
242
248
|
curConfig.build2lib.externals = neoExternals;
|
|
243
249
|
}
|
|
244
250
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
((Array.isArray(cmpNeoExports) && cmpNeoExports.length > 0) ||
|
|
248
|
-
(_.isPlainObject(cmpNeoExports) && Object.keys(cmpNeoExports).length > 0))
|
|
249
|
-
) {
|
|
250
|
-
const commonModulesFilePath = createCommonModulesCode(cmpNeoExports);
|
|
251
|
+
// 写入自定义组件的共享模块和远程模块相关信息
|
|
252
|
+
const commonModulesFilePath = createCommonModulesCode(neoCommonModule, curCmpTypes);
|
|
251
253
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
254
|
+
// 所有入口文件添加 commonModulesFile
|
|
255
|
+
if (commonModulesFilePath && curConfig.build2lib.entry) {
|
|
256
|
+
Object.keys(curConfig.build2lib.entry).forEach((name) => {
|
|
257
|
+
curConfig.build2lib.entry[name] = [commonModulesFilePath].concat(
|
|
258
|
+
curConfig.build2lib.entry[name]
|
|
259
|
+
);
|
|
260
|
+
});
|
|
260
261
|
}
|
|
261
262
|
|
|
262
263
|
akfun.build('lib', curConfig, consoleTag, () => {
|
package/src/neo/neoRequire.js
CHANGED
|
@@ -37,18 +37,28 @@ const getExternalsByNeoCommonModules = (cmpNeoExternals) => {
|
|
|
37
37
|
return neoExternals;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
// 数组方式的 externals 失效,需要使用对象方式的 externals
|
|
41
|
-
const getExternalsByNeoCommonModulesV2 = () => {
|
|
42
|
-
return Object.keys(NeoCommonModules).map(moduleName => `commonjs ${moduleName}`);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
40
|
// 用于添加共享的依赖模块
|
|
46
41
|
const addNeoCommonModules = (modules) => {
|
|
47
42
|
if (!window.__NeoCommonModules) {
|
|
48
|
-
window.__NeoCommonModules = {}
|
|
43
|
+
window.__NeoCommonModules = {}
|
|
49
44
|
}
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
if (_.isPlainObject(modules)) {
|
|
46
|
+
window.__NeoCommonModules = Object.assign(window.__NeoCommonModules, modules);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 用于添加自定义组件的远程组件
|
|
51
|
+
const addNeoRemotes = (remotes) => {
|
|
52
|
+
if (!window.__NeoCommonModules) {
|
|
53
|
+
window.__NeoCommonModules = {}
|
|
54
|
+
}
|
|
55
|
+
if (!window.__NeoCommonModules.remotes) {
|
|
56
|
+
window.__NeoCommonModules.remotes = {}
|
|
57
|
+
}
|
|
58
|
+
if (_.isPlainObject(remotes)) {
|
|
59
|
+
window.__NeoCommonModules.remotes = Object.assign(window.__NeoCommonModules.remotes, remotes);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
52
62
|
|
|
53
63
|
const initNeoRequire = () => {
|
|
54
64
|
if (!window.neoRequire) {
|
|
@@ -62,5 +72,6 @@ const initNeoRequire = () => {
|
|
|
62
72
|
module.exports = {
|
|
63
73
|
initNeoRequire,
|
|
64
74
|
addNeoCommonModules,
|
|
75
|
+
addNeoRemotes,
|
|
65
76
|
getExternalsByNeoCommonModules
|
|
66
77
|
};
|
|
@@ -40,9 +40,10 @@ module.exports = {
|
|
|
40
40
|
},
|
|
41
41
|
// Neo 共享依赖模块
|
|
42
42
|
neoCommonModule: {
|
|
43
|
-
// neoExports: ['echarts'], // 自定义组件
|
|
43
|
+
// neoExports: ['echarts'], // 自定义组件 共享出来的模块,支持数组和对象形式
|
|
44
44
|
// neoExports: {}, // 对象写法
|
|
45
45
|
// neoExternals: ['neo-register', 'chart-widget'], // 自定义组件 需要剔除的模块,仅支持数组写法
|
|
46
|
+
remotes: ['chart-widget'], // 远程组件,表示当前自定义组件会用到远程组件的导出模块,需要和 neoExternals 配合使用
|
|
46
47
|
},
|
|
47
48
|
preview: {
|
|
48
49
|
// 用于开启本地预览模式的相关配置信息
|
|
@@ -38,14 +38,17 @@ module.exports = {
|
|
|
38
38
|
// plugins: [],
|
|
39
39
|
// babelPlugins: [],
|
|
40
40
|
},
|
|
41
|
+
// 用于添加 Neo 共享依赖模块的配置信息
|
|
42
|
+
/*
|
|
41
43
|
neoCommonModule: {
|
|
42
|
-
// neoExports: [], // 自定义组件
|
|
44
|
+
// neoExports: [], // 自定义组件 共享出来的模块,支持数组和对象形式
|
|
43
45
|
neoExports: {
|
|
44
46
|
'chart-widget': path.resolve('./src/components/chart-widget'), // 导出图表自定义组件
|
|
45
47
|
'neo-register': 'neo-register', // 导出 Neo 注册模块
|
|
46
48
|
},
|
|
47
49
|
// neoExternals: [], // 自定义组件 需要剔除的模块,仅支持数组写法
|
|
48
50
|
},
|
|
51
|
+
*/
|
|
49
52
|
preview: {
|
|
50
53
|
// 用于开启本地预览模式的相关配置信息
|
|
51
54
|
/*
|
|
@@ -35,16 +35,9 @@ import NeoEntityGrid from './components/neo-entity-grid';
|
|
|
35
35
|
| objectApiKey | string | 'account' | 实体API Key |
|
|
36
36
|
| tableType | string | 'lookup' | 表格类型 (lookup/list/related) |
|
|
37
37
|
| selectionMode | string | 'multiple' | 选择模式 (single/multiple/none) |
|
|
38
|
-
| showFooter | boolean | true | 是否显示底部 (分页、操作按钮等) |
|
|
39
38
|
| showHeader | boolean | true | 是否显示头部 (工具栏、筛选等) |
|
|
40
39
|
| data | any | - | 组件数据 |
|
|
41
40
|
|
|
42
|
-
### 表格类型说明
|
|
43
|
-
|
|
44
|
-
- **lookup**: 查找模式,用于选择数据
|
|
45
|
-
- **list**: 列表模式,用于展示数据列表
|
|
46
|
-
- **related**: 关联模式,用于展示关联数据
|
|
47
|
-
|
|
48
41
|
### 选择模式说明
|
|
49
42
|
|
|
50
43
|
- **single**: 单选模式
|
|
@@ -52,8 +45,6 @@ import NeoEntityGrid from './components/neo-entity-grid';
|
|
|
52
45
|
- **none**: 无选择模式
|
|
53
46
|
|
|
54
47
|
### 显示控制说明
|
|
55
|
-
|
|
56
|
-
- **showFooter**: 控制是否显示表格底部,包括分页信息、操作按钮等
|
|
57
48
|
- **showHeader**: 控制是否显示表格头部,包括工具栏、筛选条件等
|
|
58
49
|
|
|
59
50
|
### 使用示例
|
|
@@ -65,7 +56,6 @@ import NeoEntityGrid from './components/neo-entity-grid';
|
|
|
65
56
|
objectApiKey="account"
|
|
66
57
|
tableType="lookup"
|
|
67
58
|
selectionMode="multiple"
|
|
68
|
-
showFooter={true}
|
|
69
59
|
showHeader={true}
|
|
70
60
|
/>
|
|
71
61
|
```
|
|
@@ -77,7 +67,6 @@ import NeoEntityGrid from './components/neo-entity-grid';
|
|
|
77
67
|
objectApiKey="account"
|
|
78
68
|
tableType="list"
|
|
79
69
|
selectionMode="none"
|
|
80
|
-
showFooter={false}
|
|
81
70
|
showHeader={true}
|
|
82
71
|
/>
|
|
83
72
|
```
|
|
@@ -89,7 +78,6 @@ import NeoEntityGrid from './components/neo-entity-grid';
|
|
|
89
78
|
objectApiKey="account"
|
|
90
79
|
tableType="list"
|
|
91
80
|
selectionMode="none"
|
|
92
|
-
showFooter={false}
|
|
93
81
|
showHeader={false}
|
|
94
82
|
/>
|
|
95
83
|
```
|
|
@@ -124,5 +112,4 @@ const entityGridStore = EntityGridStore.create({
|
|
|
124
112
|
|
|
125
113
|
## 注意事项
|
|
126
114
|
1. 组件需要在 Neo 环境中使用,需要相应的上下文支持
|
|
127
|
-
2. EntityGrid 组件需要 render 函数来渲染 amis 组件
|
|
128
115
|
3. 确保有相应的权限配置
|
/package/src/template/antd-custom-cmp-template/src/components/{info-card2 → info-card}/index.tsx
RENAMED
|
File without changes
|
/package/src/template/antd-custom-cmp-template/src/components/{info-card2 → info-card}/style.scss
RENAMED
|
File without changes
|