neo-cmp-cli 1.9.6 → 1.9.7

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:fs"),t=require("node:path"),s=require("lodash"),o=require("akfun"),r=require("ora"),i=require("./neoService.js"),a=require("../utils/common.js"),n=require("../utils/pathUtils.js"),c=require("../utils/projectUtils/createCmpProjectZip.js");var l,p;exports.__require=function(){if(p)return l;p=1;const g=e,u=t,m=s,{getConfigObj:d}=o,w=r,h=i.__require(),{getFramework:y,errorLog:b,successLog:v}=a.__require(),{catchCurPackageJson:C}=n.__require(),f=c.__require(),T=d(C()),$=(e=[])=>e.map(e=>({label:e.label,description:e.description,propSchema:JSON.stringify(e)})),q=(e=[],t)=>e&&0!==e.length?e.map(e=>({...e,componentType:t,eventCategory:e.eventCategory||2,pageType:e.pageType||1,targetDevice:e.targetDevice||1,eventParams:e.eventParams||[]})):[];return l=async(e,t)=>{const s=w("正在发布组件...").start();try{let o,r=new h(e);await r.ensureValidToken(),s.start("[1/4] 打包源码文件(含单个自定义组件源码)...");try{o=f(t,process.cwd(),e.assetsRoot),o?v(`[1/4] 源码文件打包完成: ${u.basename(o)}。`,s):b("[1/4] 源码文件打包失败,未返回 zip 文件路径。",s)}catch(e){b("[1/4] 源码文件打包失败。",s)}s.start("[2/4] 获取自定义组件构建产物...");const i=await r.getCmpAssets(t);let a;s.start("[3/4] 构建组件数据...");try{a=await(async(e,t)=>{if(!t||!t.cmpType)return b("自定义组件信息或组件名称不能为空"),null;const{cmpType:s}=t;if(!e||!g.existsSync(e))return b(`未找到自定义组件目录: ${e}`),null;const o=m.camelCase(s),r=u.join(e,`${o}Model.js`),i=globalThis.window;globalThis.window||(globalThis.window={console:console,neoRequire:()=>{},postMessage:()=>{}});try{g.existsSync(r)?require(r):(b(`未找到自定义组件模型文件,请检查以下路径是否存在:${r}`),process.exit(1)),globalThis.window&&globalThis.window.NEOEditorCustomModels||(b(`模型文件未导出有效模型方法(CatchCustomCmpModelClass),模型文件地址: ${r} `),process.exit(1));const e=globalThis.window.NEOEditorCustomModels[s];e||(b(`未找到自定义组件模型类(${s}),模型文件地址: ${r} `),process.exit(1));const o=new e;o||(b(`未找到自定义组件模型信息(${s}),模型文件地址: ${r} `),process.exit(1));const i={...t,version:T.version||"1.0.0",framework:T.framework?y(T.framework):0,label:o.label||s,description:o.description||"",componentCategory:(o.tags||["自定义组件"]).join(","),targetPage:o.targetPage||["customPage"],targetObject:o.targetObject||["all"],targetApplication:o.targetApplication||["all"],targetDevice:o.targetDevice||"all",iconUrl:o.iconUrl||o.iconUrl,defaultProps:JSON.stringify(o.defaultComProps||{}),previewProps:JSON.stringify(o.previewComProps||{}),props:$(o.propsSchema||[]),events:q(o.events||[],s),functions:o.functions||o.actions||[],exposedToDesigner:void 0===o.exposedToDesigner||o.exposedToDesigner,namespace:o.namespace||"neo-cmp-cli",enableDuplicate:void 0===o.enableDuplicate||o.enableDuplicate};return console.log(`自定义组件模型信息(${s}):`,m.omit(i,["assetFile","modelAssetFile","cssAssetFile","codeLibFile"])),i}catch(e){return b(`自定义组件模型文件解析失败 (${r||"未知路径"}): ${e.message}`),b(e.stack),null}finally{void 0===i?delete globalThis.window:globalThis.window=i}})(e.assetsRoot,i),a?v("[3/4] 组件数据构建完成。",s):b(`[3/4] 未获取到自定义组件模型信息(${t})。`,s)}catch(e){b(`[3/4] 组件数据构建失败: ${e.message}`,s)}s.start("[4/4] 保存组件信息到 NeoCRM 平台...");try{await r.updateCustomComponent(a),v("[4/4] 组件信息保存成功",s)}catch(e){b("[4/4] 组件信息保存失败",s)}const{tenant_id:n,instance_uri:c}=r.tokenCache||{};console.log(`\n✅ 自定义组件发布成功!\n(当前租户 ID: ${n||"未返回"},所在租户的 API 域名: ${c||"未返回"}。)`)}catch(e){try{s&&s.isSpinning&&b(`❌ 自定义组件发布失败: ${e.message}`,s)}catch{b(`\n❌ 自定义组件发布失败: ${e.message}`)}throw e}},l};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:fs"),t=require("node:path"),s=require("lodash"),o=require("akfun"),r=require("ora"),a=require("./neoService.js"),i=require("../utils/common.js"),n=require("../utils/pathUtils.js"),c=require("../utils/projectUtils/createCmpProjectZip.js");var l,p;exports.__require=function(){if(p)return l;p=1;const u=e,g=t,m=s,{getConfigObj:d}=o,w=r,y=a.__require(),{getFramework:f,errorLog:h,successLog:v}=i.__require(),{catchCurPackageJson:b}=n.__require(),T=c.__require(),C=d(b()),$=(e=[])=>e.map(e=>({label:e.label,description:e.description,propSchema:JSON.stringify(e)})),P=(e=[],t)=>e&&0!==e.length?e.map(e=>({...e,componentType:t,eventCategory:e.eventCategory||2,pageType:e.pageType||1,targetDevice:e.targetDevice||1,eventParams:e.eventParams||[]})):[],q=(e=[],t)=>e&&0!==e.length?e.map(e=>({...e,componentType:t,funcScope:e.funcScope||"all",pageType:e.pageType||1,targetDevice:e.targetDevice||1,custom:void 0===e.custom||e.custom,funcInParams:e.funcInParams||[],funcOutParams:e.funcOutParams||[]})):[];return l=async(e,t)=>{const s=w("正在发布组件...").start();try{let o,r=new y(e);await r.ensureValidToken(),s.start("[1/4] 打包源码文件(含单个自定义组件源码)...");try{o=T(t,process.cwd(),e.assetsRoot),o?v(`[1/4] 源码文件打包完成: ${g.basename(o)}。`,s):h("[1/4] 源码文件打包失败,未返回 zip 文件路径。",s)}catch(e){h("[1/4] 源码文件打包失败。",s)}s.start("[2/4] 获取自定义组件构建产物...");const a=await r.getCmpAssets(t);let i;s.start("[3/4] 构建组件数据...");try{i=await(async(e,t)=>{if(!t||!t.cmpType)return h("自定义组件信息或组件名称不能为空"),null;const{cmpType:s}=t;if(!e||!u.existsSync(e))return h(`未找到自定义组件目录: ${e}`),null;const o=m.camelCase(s),r=g.join(e,`${o}Model.js`),a=globalThis.window;globalThis.window||(globalThis.window={console:console,neoRequire:()=>{},postMessage:()=>{}});try{u.existsSync(r)?require(r):(h(`未找到自定义组件模型文件,请检查以下路径是否存在:${r}`),process.exit(1)),globalThis.window&&globalThis.window.NEOEditorCustomModels||(h(`模型文件未导出有效模型方法(CatchCustomCmpModelClass),模型文件地址: ${r} `),process.exit(1));const e=globalThis.window.NEOEditorCustomModels[s];e||(h(`未找到自定义组件模型类(${s}),模型文件地址: ${r} `),process.exit(1));const o=new e;o||(h(`未找到自定义组件模型信息(${s}),模型文件地址: ${r} `),process.exit(1));const a={...t,version:C.version||"1.0.0",framework:C.framework?f(C.framework):0,label:o.label||s,description:o.description||"",componentCategory:(o.tags||["自定义组件"]).join(","),targetPage:o.targetPage||["customPage"],targetObject:o.targetObject||["all"],targetApplication:o.targetApplication||["all"],targetDevice:o.targetDevice||"all",iconUrl:o.iconUrl||o.iconUrl,defaultProps:JSON.stringify(o.defaultComProps||{}),previewProps:JSON.stringify(o.previewComProps||{}),props:$(o.propsSchema||[]),events:P(o.events||[],s),functions:q(o.functions||o.actions||[],s),exposedToDesigner:void 0===o.exposedToDesigner||o.exposedToDesigner,namespace:o.namespace||"neo-cmp-cli",enableDuplicate:void 0===o.enableDuplicate||o.enableDuplicate};return console.log(`自定义组件模型信息(${s}):`,m.omit(a,["assetFile","modelAssetFile","cssAssetFile","codeLibFile"])),a}catch(e){return h(`自定义组件模型文件解析失败 (${r||"未知路径"}): ${e.message}`),h(e.stack),null}finally{void 0===a?delete globalThis.window:globalThis.window=a}})(e.assetsRoot,a),i?v("[3/4] 组件数据构建完成。",s):h(`[3/4] 未获取到自定义组件模型信息(${t})。`,s)}catch(e){h(`[3/4] 组件数据构建失败: ${e.message}`,s)}s.start("[4/4] 保存组件信息到 NeoCRM 平台...");try{await r.updateCustomComponent(i),v("[4/4] 组件信息保存成功",s)}catch(e){h("[4/4] 组件信息保存失败",s)}const{tenant_id:n,instance_uri:c}=r.tokenCache||{};console.log(`\n✅ 自定义组件发布成功!\n(当前租户 ID: ${n||"未返回"},所在租户的 API 域名: ${c||"未返回"}。)`)}catch(e){try{s&&s.isSpinning&&h(`❌ 自定义组件发布失败: ${e.message}`,s)}catch{h(`\n❌ 自定义组件发布失败: ${e.message}`)}throw e}},l};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.9.3";const o={version:e};exports.default=o,exports.version=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.9.7";const o={version:e};exports.default=o,exports.version=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.9.6",
51
+ "neo-cmp-cli": "^1.9.7",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5"
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^9.1.1",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.9.6",
51
+ "neo-cmp-cli": "^1.9.7",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5",
@@ -46,7 +46,7 @@
46
46
  "@commitlint/config-conventional": "^9.1.1",
47
47
  "@types/react": "^16.9.11",
48
48
  "@types/react-dom": "^16.9.15",
49
- "neo-cmp-cli": "^1.9.6",
49
+ "neo-cmp-cli": "^1.9.7",
50
50
  "husky": "^4.2.5",
51
51
  "lint-staged": "^10.2.9",
52
52
  "prettier": "^2.0.5"
@@ -55,7 +55,7 @@
55
55
  "@types/react": "^16.9.11",
56
56
  "@types/react-dom": "^16.9.15",
57
57
  "@types/axios": "^0.14.0",
58
- "neo-cmp-cli": "^1.9.6",
58
+ "neo-cmp-cli": "^1.9.7",
59
59
  "husky": "^4.2.5",
60
60
  "lint-staged": "^10.2.9",
61
61
  "prettier": "^2.0.5"
@@ -29,7 +29,7 @@ export class EntityCardListModel {
29
29
  * customPage: 6 自定义页面
30
30
  * bizPage: 7 业务页面
31
31
  */
32
- // targetPage: string[] = ['customPage'];
32
+ targetPage: string[] = ['all'];
33
33
 
34
34
  // 组件图标,用于设置在编辑器左侧组件面板中展示的图标
35
35
  iconUrl: string = 'https://custom-widgets.bj.bcebos.com/data-list.svg';
@@ -44,6 +44,16 @@ export class EntityCardListModel {
44
44
  },
45
45
  };
46
46
 
47
+ // 当前组件支持的函数列表(其他组件可触发当前组件的函数)
48
+ functions = [
49
+ {
50
+ apiKey: 'loadObjectData',
51
+ label: '重新获取数据列表',
52
+ helpTextKey: '获取实体业务数据列表',
53
+ funcInParams: [],
54
+ },
55
+ ];
56
+
47
57
  /**
48
58
  * 组件面板配置,用于生成编辑器右侧属性配置面板内容
49
59
  */
@@ -238,11 +238,6 @@ export default class EntityForm extends React.PureComponent<
238
238
  console.log('触发了表单提交事件:', this.props);
239
239
  }
240
240
 
241
- @aop
242
- onBeforeSubmit(formValues: any) {
243
- console.log('触发了表单提交前事件:', formValues);
244
- }
245
-
246
241
  /**
247
242
  * 处理表单提交
248
243
  * 执行新增操作
@@ -252,9 +247,6 @@ export default class EntityForm extends React.PureComponent<
252
247
  const { xObjectApiKey } = this.props.xObjectDataApi || {};
253
248
  const { fieldList } = this.state;
254
249
 
255
- // 触发表单提交事件
256
- this.onBeforeSubmit(values);
257
-
258
250
  if (!xObjectApiKey) {
259
251
  message.error('请先选择要操作的对象');
260
252
  return;
@@ -60,13 +60,8 @@ export class EntityFormModel {
60
60
  apiKey: 'onSubmit', // 事件名称
61
61
  // description: '这是一个表单提交事件', // 暂未使用
62
62
  label: '提交表单后', // 事件
63
- helpText: '表单提交后触发该事件', // 信息icon hover 时的提示文本
64
- },
65
- {
66
- apiKey: 'onBeforeSubmit',
67
- label: '提交表单前',
68
- helpText: '表单提交前触发该事件',
69
- },
63
+ helpText: '表单提交后触发该事件' // 信息icon hover 时的提示文本
64
+ }
70
65
  ];
71
66
 
72
67
  /**
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.9.6",
48
+ "neo-cmp-cli": "^1.9.7",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5"
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.9.6",
50
+ "neo-cmp-cli": "^1.9.7",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "^8.3.5",
47
47
  "@commitlint/config-conventional": "^9.1.1",
48
- "neo-cmp-cli": "^1.9.6",
48
+ "neo-cmp-cli": "^1.9.7",
49
49
  "husky": "^4.2.5",
50
50
  "lint-staged": "^10.2.9",
51
51
  "prettier": "^2.0.5",