neo-cmp-cli 1.13.1 → 1.13.3

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 (73) hide show
  1. package/README.md +3 -3
  2. package/dist/index2.js +1 -1
  3. package/dist/module/neoInitByCopy.js +1 -1
  4. package/dist/neo/env.js +1 -1
  5. package/dist/neo/neoService.js +1 -1
  6. package/dist/package.json.js +1 -1
  7. package/dist/utils/projectUtils/getEntries.js +1 -1
  8. package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +1 -1
  9. package/docs/Web/347/253/257 NeoEntityGrid /344/275/277/347/224/250/350/257/264/346/230/216.md" +4 -0
  10. package/package.json +2 -2
  11. package/template/antd-custom-cmp-template/package.json +1 -1
  12. package/template/asset-manage-template/package.json +2 -2
  13. package/template/echarts-custom-cmp-template/package.json +1 -1
  14. package/template/empty-custom-cmp-template/package.json +1 -1
  15. package/template/map-custom-cmp-template/package.json +1 -1
  16. package/template/neo-bi-cmps/.npmrc copy +1 -0
  17. package/template/neo-bi-cmps/package.json +1 -1
  18. package/template/neo-custom-cmp-template/package.json +1 -1
  19. package/template/neo-custom-cmp-template/src/components/entityTable__c/index.tsx +2 -1
  20. package/template/neo-h5-cmps/package.json +1 -1
  21. package/template/neo-order-cmps/package.json +1 -1
  22. package/template/{neo-web-cmps → neo-web-entity-grid}/neo.config.js +4 -0
  23. package/template/{neo-web-cmps → neo-web-entity-grid}/package.json +2 -2
  24. package/template/neo-web-entity-grid/src/components/createForm__c/README.md +176 -0
  25. package/template/neo-web-entity-grid/src/components/createForm__c/index.tsx +786 -0
  26. package/template/neo-web-entity-grid/src/components/createForm__c/model.ts +130 -0
  27. package/template/neo-web-entity-grid/src/components/createForm__c/style.scss +370 -0
  28. package/template/neo-web-entity-grid/src/components/entityGrid2__c/index.tsx +139 -0
  29. package/template/{neo-web-cmps/src/components/entityGrid4__c → neo-web-entity-grid/src/components/entityGrid2__c}/model.ts +20 -3
  30. package/template/{neo-web-cmps/src/components/entityGrid4__c → neo-web-entity-grid/src/components/entityGrid2__c}/style.scss +1 -1
  31. package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid3__c/index.tsx +17 -6
  32. package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid3__c/model.ts +3 -2
  33. package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid4__c/index.tsx +57 -8
  34. package/template/{neo-web-cmps/src/components/entityGrid2__c → neo-web-entity-grid/src/components/entityGrid4__c}/style.scss +9 -13
  35. package/template/{neo-web-cmps/src/components/entityGrid2__c → neo-web-entity-grid/src/components/entityGrid__c}/index.tsx +6 -4
  36. package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid__c/model.ts +1 -1
  37. package/template/neo-web-entity-grid/src/components/searchForm__c/README.md +144 -0
  38. package/template/neo-web-entity-grid/src/components/searchForm__c/index.tsx +667 -0
  39. package/template/neo-web-entity-grid/src/components/searchForm__c/model.ts +135 -0
  40. package/template/neo-web-entity-grid/src/components/searchForm__c/style.scss +370 -0
  41. package/template/react-custom-cmp-template/package.json +1 -1
  42. package/template/react-ts-custom-cmp-template/package.json +1 -1
  43. package/template/vue2-custom-cmp-template/package.json +1 -1
  44. package/template/neo-web-cmps/src/components/entityGrid__c/index.tsx +0 -77
  45. /package/template/{neo-web-cmps → neo-web-entity-grid}/.prettierrc.js +0 -0
  46. /package/template/{neo-web-cmps → neo-web-entity-grid}/@types/neo-ui-common.d.ts +0 -0
  47. /package/template/{neo-web-cmps → neo-web-entity-grid}/README.md +0 -0
  48. /package/template/{neo-web-cmps → neo-web-entity-grid}/commitlint.config.js +0 -0
  49. /package/template/{neo-web-cmps → neo-web-entity-grid}/public/css/base.css +0 -0
  50. /package/template/{neo-web-cmps → neo-web-entity-grid}/public/scripts/app/bluebird.js +0 -0
  51. /package/template/{neo-web-cmps → neo-web-entity-grid}/public/template.html +0 -0
  52. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/css/common.scss +0 -0
  53. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/css/mixin.scss +0 -0
  54. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/AIBtn.gif +0 -0
  55. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/NeoCRM.jpg +0 -0
  56. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/aiLogo.png +0 -0
  57. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/card-list.svg +0 -0
  58. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/contact-form.svg +0 -0
  59. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/custom-form.svg +0 -0
  60. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/custom-widget.svg +0 -0
  61. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/data-list.svg +0 -0
  62. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/detail.svg +0 -0
  63. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/favicon.png +0 -0
  64. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/map.svg +0 -0
  65. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/search.svg +0 -0
  66. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/assets/img/table.svg +0 -0
  67. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid3__c/style.scss +0 -0
  68. /package/template/{neo-web-cmps/src/components/entityGrid2__c → neo-web-entity-grid/src/components/entityGrid4__c}/model.ts +0 -0
  69. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/components/entityGrid__c/style.scss +0 -0
  70. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/utils/axiosFetcher.ts +0 -0
  71. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/utils/queryObjectData.ts +0 -0
  72. /package/template/{neo-web-cmps → neo-web-entity-grid}/src/utils/xobjects.ts +0 -0
  73. /package/template/{neo-web-cmps → neo-web-entity-grid}/tsconfig.json +0 -0
@@ -38,23 +38,31 @@ export default class NeoEntityGridCmp extends React.PureComponent<NeoEntityGridP
38
38
  autoHeight,
39
39
  height,
40
40
  additionalConditions,
41
+ selectionMode,
41
42
  onRecordChange,
43
+ selectedCount,
44
+ onSelectedCall,
45
+ onCancel,
42
46
  ...restProps
43
47
  } = this.props;
44
48
  console.log('entityGrid3__c: ', this.props, this);
45
49
 
50
+ // 关联表信息
51
+ const referData = this.props.referData || {
52
+ referObjectApiKey: 'opportunity', // 关联表: 销售机会
53
+ referItemApiKey: 'accountId', // 关联表对应的外键字段: 客户ID
54
+ };
55
+
46
56
  return (
47
57
  <div className={`entityGrid3__c ${className}`}>
48
58
  <NeoEntityGrid
59
+ // {...restProps}
49
60
  render={this.props.render}
50
61
  objectApiKey={objectApiKey || 'account'}
51
62
  pattern={'pickView'} // Picker 列表(选择器)
52
- referData={{
53
- referObjectApiKey: 'opportunity', // 关联表
54
- referItemApiKey: 'accountId', // 关联表对应的外键字段
55
- }}
56
- selectionMode="multiple" // 多选模式
57
- shouldCloseDialog={true}
63
+ referData={referData}
64
+ selectionMode={selectionMode ?? "single"} // 多选模式
65
+ shouldCloseDialog={restProps.shouldCloseDialog ?? true}
58
66
  onRowSelected={(data: any, event: any) => {
59
67
  const selectedIds = data.map(({ data }: any) => data.id);
60
68
  const selectedNames = data.map(({ data }: any) => data.name);
@@ -72,6 +80,9 @@ export default class NeoEntityGridCmp extends React.PureComponent<NeoEntityGridP
72
80
  paginationPageSize={paginationPageSize ?? 20}
73
81
  autoHeight={autoHeight ?? false}
74
82
  height={height ?? '500px'}
83
+ selectedCount={selectedCount ?? 3}
84
+ onCancel={onCancel}
85
+ onSelectedCall={onSelectedCall}
75
86
  />
76
87
  </div>
77
88
  );
@@ -9,10 +9,11 @@ export class NeoEntityGridModel {
9
9
  // cmpType: string = 'entityList__c';
10
10
 
11
11
  // 组件名称,用于设置在编辑器左侧组件面板中展示的名称
12
- label: string = 'Picker 列表';
12
+ label: string = 'Picker列表弹窗';
13
13
 
14
14
  // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
- description: string = '数据列表示例: Picker 列表';
15
+ description: string =
16
+ '自定义Picker列表弹窗: 自定义 Picker 列表模式的数据选择弹窗,支持在其他自定义组件中使用。';
16
17
 
17
18
  // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示
18
19
  // tags: string[] = ['自定义组件'];
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { Tooltip } from 'antd';
3
+ import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons';
2
4
  import './style.scss'; // 组件内容样式
3
5
  // @ts-ignore
4
6
  import { NeoEntityGrid } from 'neo-ui-component-web';
@@ -67,14 +69,61 @@ export default class NeoEntityGridCmp extends React.PureComponent<NeoEntityGridP
67
69
  autoHeight={autoHeight ?? false}
68
70
  height={height ?? '500px'}
69
71
  customEmptyMsg="暂无数据,请点击「新建」按钮创建"
70
- additionalConditions={[
71
- {
72
- apiKey: 'accountName',
73
- value: '测试客户',
74
- type: 3, // 筛选条件/操作类型(3: 包含,1: 等于)
75
- // item: -11100000100014, // 筛选条件ID
76
- },
77
- ]}
72
+ customToolbarButtons={{
73
+ header: [
74
+ {
75
+ id: 'approve-btn',
76
+ label: '批量审批',
77
+ icon: 'CheckOne',
78
+ tooltip: '对选中记录批量审批',
79
+ onClick: () => {
80
+ console.log('批量审批');
81
+ },
82
+ },
83
+ ],
84
+ footer: [
85
+ {
86
+ id: 'export-pdf-btn',
87
+ label: '导出 PDF',
88
+ icon: 'FilePdf',
89
+ onClick: () => console.log('导出 PDF'),
90
+ },
91
+ {
92
+ id: 'status-indicator',
93
+ label: '同步状态',
94
+ customRender: (button: any = { syncStatus: 'ok' }) => {
95
+ const ok = button.syncStatus === 'ok';
96
+ const tip = ok ? '已同步' : '同步失败';
97
+ const Icon = ok ? CheckCircleOutlined : CloseCircleOutlined;
98
+ return (
99
+ <li
100
+ key={button.id}
101
+ className="entityGrid4__c-status-indicator"
102
+ >
103
+ <Tooltip
104
+ title={tip}
105
+ placement="top"
106
+ mouseEnterDelay={0.1}
107
+ >
108
+ <button
109
+ type="button"
110
+ className={`entityGrid4__c-status-indicator__btn entityGrid4__c-status-indicator__btn--${
111
+ ok ? 'ok' : 'error'
112
+ }`}
113
+ aria-label={`同步状态:${tip}`}
114
+ >
115
+ <Icon
116
+ className="entityGrid4__c-status-indicator__icon"
117
+ aria-hidden
118
+ />
119
+ </button>
120
+ </Tooltip>
121
+ </li>
122
+ );
123
+ },
124
+ },
125
+ ],
126
+ }}
78
127
  />
79
128
  </div>
80
129
  );
@@ -1,8 +1,4 @@
1
- :root {
2
- --padding-bottom: 12px;
3
- }
4
-
5
- .entityGrid2__c {
1
+ .entityGrid4__c {
6
2
  position: relative;
7
3
  box-sizing: border-box;
8
4
 
@@ -13,7 +9,7 @@
13
9
  }
14
10
 
15
11
  /* 底部工具栏「同步状态」:antd Tooltip + Icon,文案在悬浮时由 Tooltip 展示 */
16
- .entityGrid2__c .entityGrid2__c-status-indicator {
12
+ .entityGrid4__c .entityGrid4__c-status-indicator {
17
13
  display: inline-flex;
18
14
  align-items: center;
19
15
  margin: 0;
@@ -22,7 +18,7 @@
22
18
  vertical-align: middle;
23
19
  }
24
20
 
25
- .entityGrid2__c .entityGrid2__c-status-indicator__btn {
21
+ .entityGrid4__c .entityGrid4__c-status-indicator__btn {
26
22
  position: relative;
27
23
  display: inline-flex;
28
24
  align-items: center;
@@ -41,26 +37,26 @@
41
37
  box-shadow 0.15s ease;
42
38
  }
43
39
 
44
- .entityGrid2__c .entityGrid2__c-status-indicator__btn--ok {
40
+ .entityGrid4__c .entityGrid4__c-status-indicator__btn--ok {
45
41
  color: #16a34a;
46
42
  }
47
43
 
48
- .entityGrid2__c .entityGrid2__c-status-indicator__btn--error {
44
+ .entityGrid4__c .entityGrid4__c-status-indicator__btn--error {
49
45
  color: #dc2626;
50
46
  }
51
47
 
52
- .entityGrid2__c .entityGrid2__c-status-indicator__btn:hover,
53
- .entityGrid2__c .entityGrid2__c-status-indicator__btn:focus-visible {
48
+ .entityGrid4__c .entityGrid4__c-status-indicator__btn:hover,
49
+ .entityGrid4__c .entityGrid4__c-status-indicator__btn:focus-visible {
54
50
  background: #f9fafb;
55
51
  border-color: #d1d5db;
56
52
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
57
53
  }
58
54
 
59
- .entityGrid2__c .entityGrid2__c-status-indicator__btn:focus-visible {
55
+ .entityGrid4__c .entityGrid4__c-status-indicator__btn:focus-visible {
60
56
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(59, 130, 246, 0.45);
61
57
  }
62
58
 
63
- .entityGrid2__c .entityGrid2__c-status-indicator__icon {
59
+ .entityGrid4__c .entityGrid4__c-status-indicator__icon {
64
60
  display: block;
65
61
  flex-shrink: 0;
66
62
  font-size: 18px;
@@ -1,6 +1,4 @@
1
1
  import * as React from 'react';
2
- import { Tooltip } from 'antd';
3
- import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons';
4
2
  import './style.scss'; // 组件内容样式
5
3
  // @ts-ignore
6
4
  import { NeoEntityGrid } from 'neo-ui-component-web';
@@ -43,10 +41,10 @@ export default class NeoEntityGridCmp extends React.PureComponent<NeoEntityGridP
43
41
  onRecordChange,
44
42
  ...restProps
45
43
  } = this.props;
46
- console.log('entityGrid2__c: ', this.props, this);
44
+ console.log('entityGrid__c: ', this.props, this);
47
45
 
48
46
  return (
49
- <div className={`entityGrid2__c ${className}`}>
47
+ <div className={`entityGrid__c ${className}`}>
50
48
  <NeoEntityGrid
51
49
  render={this.props.render}
52
50
  objectApiKey={objectApiKey || 'account'}
@@ -69,6 +67,10 @@ export default class NeoEntityGridCmp extends React.PureComponent<NeoEntityGridP
69
67
  autoHeight={autoHeight ?? false}
70
68
  height={height ?? '500px'}
71
69
  customEmptyMsg="暂无数据,请点击「新建」按钮创建"
70
+ onSinglerClick={(clickData: any) => {
71
+ console.log('点击了列表项', clickData);
72
+ }}
73
+ // 工具栏中补充自定义功能按钮
72
74
  customToolbarButtons={{
73
75
  header: [
74
76
  {
@@ -13,7 +13,7 @@ export class NeoEntityGridModel {
13
13
 
14
14
  // 组件描述,用于设置在编辑器左侧组件面板中展示的描述
15
15
  description: string =
16
- '数据列表示例: 基础大列表,支持搜索、排序、导出、分页等操作';
16
+ '数据列表示例: 支持 视图切换、搜索、新增、导出、分页等显隐控制,支持自定义工具栏和空占位等配置';
17
17
 
18
18
  // 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示
19
19
  // tags: string[] = ['自定义组件'];
@@ -0,0 +1,144 @@
1
+ # SearchFormModel 自定义表单组件
2
+
3
+ 基于 XObject 的对象自定义搜索表单组件,支持动态字段渲染和多种字段类型。
4
+
5
+ ## 功能特性
6
+
7
+ - 📝 **动态表单渲染**:根据 XObject 字段描述自动生成表单项
8
+ - 🎨 **多种字段类型**:支持文本、数字、日期、下拉选择等多种字段类型
9
+ - 📐 **响应式布局**:支持单列和双列布局,适配不同屏幕尺寸
10
+ - ✅ **表单验证**:自动根据字段配置进行必填验证
11
+ - 🔄 **表单重置**:支持快速重置表单内容
12
+ - 🎯 **成功提示**:提交成功后显示友好的提示信息
13
+ - ⚙️ **属性配置**:支持通过编辑器配置组件属性
14
+
15
+ ## 组件属性
16
+
17
+ | 属性名 | 类型 | 默认值 | 说明 |
18
+ |--------|------|--------|------|
19
+ | formTitle | string | '新增数据' | 表单标题 |
20
+ | xObjectDataApi | object | - | 实体数据源配置,包含 xObjectApiKey 和 fields |
21
+ | xObjectDataApi.xObjectApiKey | string | '' | 数据对象的 API Key |
22
+ | xObjectDataApi.fields | string[] | [] | 要显示的字段列表(可选,不传则显示所有字段) |
23
+ | columnCount | 1 \| 2 | 1 | 表单列数(1列或2列) |
24
+ | showResetButton | boolean | true | 是否显示重置按钮 |
25
+ | onSuccess | function | - | 提交成功后的回调函数 |
26
+
27
+ ## 使用方法
28
+
29
+ ### 1. 在编辑器中使用
30
+
31
+ 1. 从组件面板拖拽 "对象表单" 组件到页面
32
+ 2. 在右侧属性面板中选择要操作的数据对象
33
+ 3. 选择要在表单中显示的字段
34
+ 4. 配置表单标题、列数等属性
35
+ 5. 保存并预览
36
+
37
+ ### 2. 代码中使用
38
+
39
+ ```tsx
40
+ import SearchForm from './components/searchForm__c';
41
+
42
+ // 基础使用
43
+ <SearchForm
44
+ formTitle="搜索联系人"
45
+ xObjectDataApi={{
46
+ xObjectApiKey: 'customContact__c',
47
+ fields: ['name', 'phone__c', 'email__c'],
48
+ }}
49
+ columnCount={2}
50
+ showResetButton={true}
51
+ onSuccess={(data) => {
52
+ console.log('提交成功:', data);
53
+ }}
54
+ />
55
+ ```
56
+
57
+ ## 支持的字段类型
58
+
59
+ 组件支持以下字段类型,并自动渲染对应的输入组件:
60
+
61
+ | 字段类型 | 输入组件 | 说明 |
62
+ |---------|---------|------|
63
+ | text | Input | 单行文本输入框 |
64
+ | textarea | TextArea | 多行文本输入框 |
65
+ | int / float | InputNumber | 数字输入框 |
66
+ | email | Input (email) | 邮箱输入框 |
67
+ | phone | Input (tel) | 电话号码输入框 |
68
+ | url | Input (url) | URL 输入框 |
69
+ | date | DatePicker | 日期选择器 |
70
+ | datetime | DatePicker | 日期时间选择器 |
71
+ | time | DatePicker | 时间选择器 |
72
+ | picklist | Select | 单选下拉框 |
73
+ | multipicklist | Select (multiple) | 多选下拉框 |
74
+ | entityType | Select | 业务类型选择器 |
75
+
76
+ ## 技术实现
77
+
78
+ ### 核心依赖
79
+
80
+ - **Ant Design**:UI 组件库
81
+ - **React**:前端框架
82
+ - **TypeScript**:类型支持
83
+ - **Neo Open API**:数据操作 SDK
84
+
85
+ ### 数据流程
86
+
87
+ 1. **初始化**:组件挂载时获取字段描述和业务类型列表
88
+ 2. **表单生成**:根据字段描述动态生成表单项
89
+ 3. **数据验证**:提交前进行必填字段验证
90
+ 4. **数据提交**:使用 `xObject.create` 创建新记录
91
+ 5. **结果反馈**:显示成功或失败提示
92
+
93
+ ### 表单布局
94
+
95
+ 组件支持两种布局模式:
96
+
97
+ - **单列布局**:适合字段较多或需要宽输入框的场景
98
+ - **双列布局**:适合字段较少或需要紧凑布局的场景
99
+
100
+ ## 样式定制
101
+
102
+ 组件提供了完整的 SCSS 样式文件,支持以下定制:
103
+
104
+ - 表单样式(标签、输入框、间距等)
105
+ - 按钮样式(颜色、大小、位置等)
106
+ - 成功提示样式(动画、颜色等)
107
+ - 响应式设计(移动端适配)
108
+
109
+ ## 注意事项
110
+
111
+ 1. **权限要求**:确保用户有对应 XObject 的写入权限
112
+ 2. **必填字段**:表单会根据字段的 required 属性进行验证
113
+ 3. **日期格式**:日期类型字段会自动转换为时间戳格式提交
114
+ 4. **错误处理**:组件内置了完善的错误处理和用户提示
115
+ 5. **字段过滤**:如果指定了 fields 参数,只会显示指定的字段
116
+
117
+ ## 扩展开发
118
+
119
+ 如需扩展功能,可以:
120
+
121
+ 1. **添加字段类型支持**:在 `renderForm()` 方法中添加新的字段类型
122
+ 2. **自定义验证规则**:在表单项的 rules 中添加自定义验证
123
+ 3. **添加提交前处理**:在 `handleSubmit()` 方法中添加数据预处理逻辑
124
+ 4. **自定义样式**:修改 `style.scss` 文件定制组件外观
125
+ 5. **添加回调事件**:扩展组件 props 支持更多回调事件
126
+
127
+ ## 示例场景
128
+
129
+ ### 场景一:客户信息录入
130
+
131
+ ```tsx
132
+ <SearchForm
133
+ formTitle="查询客户信息"
134
+ xObjectDataApi={{
135
+ xObjectApiKey: 'account',
136
+ fields: ['name', 'industry', 'phone', 'email', 'website'],
137
+ }}
138
+ columnCount={2}
139
+ onSuccess={(data) => {
140
+ message.success('xxx');
141
+ // 跳转到客户详情页
142
+ }}
143
+ />
144
+ ```