neo-register 1.0.1 → 1.0.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.
- package/dist/demo2/entity-detail/index.d.ts +40 -0
- package/dist/demo2/entity-detail/model.d.ts +77 -0
- package/dist/demo2/entity-detail/register.d.ts +1 -0
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.min.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.LICENSE.txt +2 -2
- package/docs/FormItemType.md +14 -8
- package/docs/NeoEntityApiType/xObjectDataApi.md +35 -0
- package/docs/NeoEntityApiType/xObjectDetailApi.md +35 -0
- package/docs/NeoEntityApiType/xObjectEntityList.md +35 -0
- package/package.json +9 -8
- /package/dist/{function → src/function}/registerNeoCmp.d.ts +0 -0
- /package/dist/{function → src/function}/registerNeoEditorModel.d.ts +0 -0
- /package/dist/{main.d.ts → src/main.d.ts} +0 -0
- /package/dist/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/object.d.ts +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
interface EntityDetailProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
xObjectDetailApi?: {
|
|
6
|
+
xObjectApiKey: string;
|
|
7
|
+
objectId: string;
|
|
8
|
+
fieldDescList?: any[];
|
|
9
|
+
};
|
|
10
|
+
columnCount?: number;
|
|
11
|
+
showTitle?: boolean;
|
|
12
|
+
data?: any;
|
|
13
|
+
entityData?: any;
|
|
14
|
+
}
|
|
15
|
+
interface FieldDescription {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
label: string;
|
|
18
|
+
type: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
interface EntityDetailState {
|
|
22
|
+
detailData: any;
|
|
23
|
+
fieldDescriptions: FieldDescription[];
|
|
24
|
+
loading: boolean;
|
|
25
|
+
error: string | null;
|
|
26
|
+
}
|
|
27
|
+
export default class EntityDetail extends React.PureComponent<EntityDetailProps, EntityDetailState> {
|
|
28
|
+
constructor(props: EntityDetailProps);
|
|
29
|
+
componentDidMount(): void;
|
|
30
|
+
componentDidUpdate(prevProps: EntityDetailProps): void;
|
|
31
|
+
loadData(): Promise<void>;
|
|
32
|
+
loadFieldDescriptions(): Promise<void>;
|
|
33
|
+
loadEntityDetail(): Promise<void>;
|
|
34
|
+
getFieldLabel(apiKey: string): string;
|
|
35
|
+
getFieldType(apiKey: string): string;
|
|
36
|
+
renderFieldValue(value: any, fieldType: string): any;
|
|
37
|
+
renderDetailContent(): React.JSX.Element;
|
|
38
|
+
render(): React.JSX.Element;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file 实体数据详情组件对接编辑器的描述文件
|
|
3
|
+
* @description 定义组件在 Neo 平台编辑器中的配置信息
|
|
4
|
+
*/
|
|
5
|
+
export declare class EntityDetailModel {
|
|
6
|
+
/**
|
|
7
|
+
* 组件类型标识
|
|
8
|
+
* 用于标识组件的唯一性,在构建时根据当前组件目录名称自动生成
|
|
9
|
+
* 注意:此字段在构建时会被自动替换,不需要手动设置
|
|
10
|
+
*/
|
|
11
|
+
cmpType: string;
|
|
12
|
+
/** 组件名称,用于设置在编辑器左侧组件面板中展示的名称 */
|
|
13
|
+
label: string;
|
|
14
|
+
/** 组件描述,用于设置在编辑器左侧组件面板中展示的描述 */
|
|
15
|
+
description: string;
|
|
16
|
+
/** 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签) */
|
|
17
|
+
tags: string[];
|
|
18
|
+
/** 组件图标,用于设置在编辑器左侧组件面板中展示的图标 */
|
|
19
|
+
iconSrc: string;
|
|
20
|
+
/** 初次插入页面的默认属性数据 */
|
|
21
|
+
defaultComProps: {
|
|
22
|
+
title: string;
|
|
23
|
+
xObjectDetailApi: {
|
|
24
|
+
xObjectApiKey: string;
|
|
25
|
+
objectId: string;
|
|
26
|
+
};
|
|
27
|
+
columnCount: number;
|
|
28
|
+
showTitle: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** 设计器端预览时展示的默认数据 */
|
|
31
|
+
previewComProps: {
|
|
32
|
+
title: string;
|
|
33
|
+
columnCount: number;
|
|
34
|
+
showTitle: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 组件属性配置模式
|
|
38
|
+
* 定义组件在编辑器中可配置的属性
|
|
39
|
+
*/
|
|
40
|
+
propsSchema: ({
|
|
41
|
+
type: string;
|
|
42
|
+
name: string;
|
|
43
|
+
label: string;
|
|
44
|
+
value: string;
|
|
45
|
+
placeholder: string;
|
|
46
|
+
description: string;
|
|
47
|
+
options?: undefined;
|
|
48
|
+
} | {
|
|
49
|
+
type: string;
|
|
50
|
+
name: string;
|
|
51
|
+
label: string;
|
|
52
|
+
value: boolean;
|
|
53
|
+
description: string;
|
|
54
|
+
placeholder?: undefined;
|
|
55
|
+
options?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
type: string;
|
|
58
|
+
name: string;
|
|
59
|
+
label: string;
|
|
60
|
+
value?: undefined;
|
|
61
|
+
placeholder?: undefined;
|
|
62
|
+
description?: undefined;
|
|
63
|
+
options?: undefined;
|
|
64
|
+
} | {
|
|
65
|
+
type: string;
|
|
66
|
+
name: string;
|
|
67
|
+
label: string;
|
|
68
|
+
value: number;
|
|
69
|
+
options: {
|
|
70
|
+
label: string;
|
|
71
|
+
value: number;
|
|
72
|
+
}[];
|
|
73
|
+
description: string;
|
|
74
|
+
placeholder?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
}
|
|
77
|
+
export default EntityDetailModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.esm.js
CHANGED
|
@@ -171,6 +171,7 @@ function registerNeoEditorModel(curEditorModel, cmpType) {
|
|
|
171
171
|
custom: true,
|
|
172
172
|
exposedToDesigner: curEditorModelObj.exposedToDesigner ?? true,
|
|
173
173
|
namespace: curEditorModelObj.namespace ?? 'neo-cmp-cli',
|
|
174
|
+
enableDuplicate: curEditorModelObj.enableDuplicate ?? true,
|
|
174
175
|
cmpType: curCmpType,
|
|
175
176
|
});
|
|
176
177
|
// registerEditorModel(curEditorModel); // 不直接注册为 neo-editor 插件
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import o from"vue";function t(e,o,t=!0){const r=function(e,o=!0){const t=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return o&&e&&Object.keys(e).forEach(o=>t[o]=e[o]),t}(e,t);return o&&Object.keys(o).forEach(e=>r[e]=o[e]),r}const r="[neo-register]";var s,n;function i(e,o){if(e&&function(e){let o=!1;if(!e)return!1;const t=new e;return t.label?t.tags?Array.isArray(t.tags)?(t.icon||Object.assign(e.prototype,{icon:"https://neo-widgets.bj.bcebos.com/custom-widget.svg"}),o=!0):console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)格式异常。`):console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)不能为空。`):console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,名称(label)不能为空。`),o}(e)){const t=o||(new e).cmpType;t||console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,cmpType 不能为空。`);const s=new e;if(Object.assign(e.prototype,{custom:!0,exposedToDesigner:s.exposedToDesigner??!0,namespace:s.namespace??"neo-cmp-cli",cmpType:t}),window&&window.postMessage){const o=function(e,o){window&&!window.NEOEditorCustomModels&&(window.NEOEditorCustomModels={});if(!window.NEOEditorCustomModels[e])return window.NEOEditorCustomModels[e]=o,e;console.error(`${r}注册自定义组件模型失败,已存在重名插件(${e})。`);return null}(t,e);o&&(console.info(`${r}触发注册自定义组件模型(${t})事件`),window.postMessage({type:"neo-model-register-event",eventMsg:`${r}注册一个 neo-editor 自定义组件模型`,cmpType:t},"*"))}}}function c(r){if(r&&("function"==typeof r||"object"==typeof r)){class s extends e.Component{domRef;vm;isUnmount;constructor(o,t){super(o),this.domRef=e.createRef(),this.isUnmount=!1,this.resolveNeoProps=this.resolveNeoProps.bind(this)}componentDidMount(){const{neoData:e,neoMSTData:s,neoFunc:n}=this.resolveNeoProps(),{data:i,...c}=r="function"==typeof r?new r:r,a=t("function"==typeof i?i():i,e);this.vm=new o({...c,data:()=>a,props:t(n,{...c.props||{},...s})}),Object.keys(n).forEach(e=>{this.vm.$props[e]=n[e]}),this.domRef.current&&this.domRef.current.appendChild(this.vm.$mount().$el)}componentDidUpdate(){if(!this.isUnmount){const{neoData:e}=this.resolveNeoProps();this.vm&&(Object.keys(e).forEach(o=>{this.vm[o]=e[o]}),this.vm.$forceUpdate())}}componentWillUnmount(){this.isUnmount=!0,this.vm&&this.vm.$destroy()}resolveNeoProps(){let e={},o={},t={};return Object.keys(this.props).forEach(r=>{const s=this.props[r];var n;"function"==typeof s?e[r]=s:(n=s)&&(n.$treenode||n.$mstObservable||n.$modelType||n.$modelId||"[object Proxy]"===Object.prototype.toString.call(n))?t[r]=s:o[r]=s}),{neoData:o,neoMSTData:t,neoFunc:e}}reload(){this.vm&&this.vm.reload?this.vm.reload():console.warn("自定义组件暂不支持reload动作。")}doAction(e,o){this.vm&&this.vm.doAction?this.vm.doAction(e,o):console.warn("自定义组件中不存在 doAction。")}render(){return e.createElement("div",{ref:this.domRef})}}return s}}function a(e,o){if(!e)return;const t={cmpType:"",usage:s.renderer,weight:0};var i;if(o&&(i=o,"String"===Object.prototype.toString.call(i).slice(8,-1))?Object.assign(t,{cmpType:o}):Object.assign(t,o),t&&!t.cmpType)console.error(`${r} / registerNeoCmp: 自定义组件注册失败,cmpType 不能为空。`);else{t.framework=t.framework?function(e){let o=n.react;if(!e)return o;let t=e.toLowerCase().trim();switch(t){case"jquery":case"jq":t=n.jquery;break;case"vue2":case"vue 2":case"vue2.0":case"vue 2.0":t=n.vue2;break;case"vue":case"vue3":case"vue 3":case"vue3.0":case"vue 3.0":t=n.vue3,console.error(`${r} 暂不支持 vue3.0 技术栈。`);break;default:t=n.react}return t}(t.framework):function(e){return"object"==typeof e&&(e._compiled&&e.components||e.__file&&e.__file.endsWith(".vue"))}(e)?"vue2":"react",t.usage=function(e){let o=s.renderer;if(!e)return o;let t=e.toLowerCase().trim();switch(t){case"renderer":case"renderers":default:t=s.renderer;break;case"formitem":case"form-item":case"form item":t=s.formitem}return t}(t.usage);const o={renderer:()=>{},formitem:()=>{}},i={react:e=>e,vue2:c,vue3:c}[t.framework](e);if(o[t.usage]){if(window&&window.postMessage){const e=function(e,o){window&&!window.NeoCustomCmps&&(window.NeoCustomCmps={});if(!window.NeoCustomCmps[e])return window.NeoCustomCmps[e]=o,e;console.error(`${r} / registerNeoCmp: 自定义组件注册失败,已存在重名渲染器(${e})。`);return null}(t.cmpType,{cmpType:t.cmpType,weight:t.weight,usage:t.usage,framework:t.framework,component:i,config:t});e&&(console.info(`${r}触发注册自定义组件(${e})事件`),window.postMessage({type:"neo-cmp-register-event",eventMsg:`${r}注册一个自定义组件`,neoRenderer:{cmpType:e,weight:t.weight,usage:t.usage,config:t}},"*"))}}else console.error(`${r} / registerNeoCmp: 自定义组件注册失败,暂不支持 ${t.usage} 组件类型。`)}}!function(e){e.renderer="renderer",e.formitem="formitem"}(s||(s={})),function(e){e.react="react",e.vue2="vue2",e.vue3="vue3",e.jquery="jquery"}(n||(n={}));export{c as createVue2Component,a as registerNeoCmp,i as registerNeoEditorModel};
|
|
1
|
+
import e from"react";import o from"vue";function t(e,o,t=!0){const r=function(e,o=!0){const t=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return o&&e&&Object.keys(e).forEach(o=>t[o]=e[o]),t}(e,t);return o&&Object.keys(o).forEach(e=>r[e]=o[e]),r}const r="[neo-register]";var s,n;function i(e,o){if(e&&function(e){let o=!1;if(!e)return!1;const t=new e;return t.label?t.tags?Array.isArray(t.tags)?(t.icon||Object.assign(e.prototype,{icon:"https://neo-widgets.bj.bcebos.com/custom-widget.svg"}),o=!0):console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)格式异常。`):console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)不能为空。`):console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,名称(label)不能为空。`),o}(e)){const t=o||(new e).cmpType;t||console.error(`${r} / registerNeoEditorModel: 自定义组件注册失败,cmpType 不能为空。`);const s=new e;if(Object.assign(e.prototype,{custom:!0,exposedToDesigner:s.exposedToDesigner??!0,namespace:s.namespace??"neo-cmp-cli",enableDuplicate:s.enableDuplicate??!0,cmpType:t}),window&&window.postMessage){const o=function(e,o){window&&!window.NEOEditorCustomModels&&(window.NEOEditorCustomModels={});if(!window.NEOEditorCustomModels[e])return window.NEOEditorCustomModels[e]=o,e;console.error(`${r}注册自定义组件模型失败,已存在重名插件(${e})。`);return null}(t,e);o&&(console.info(`${r}触发注册自定义组件模型(${t})事件`),window.postMessage({type:"neo-model-register-event",eventMsg:`${r}注册一个 neo-editor 自定义组件模型`,cmpType:t},"*"))}}}function c(r){if(r&&("function"==typeof r||"object"==typeof r)){class s extends e.Component{domRef;vm;isUnmount;constructor(o,t){super(o),this.domRef=e.createRef(),this.isUnmount=!1,this.resolveNeoProps=this.resolveNeoProps.bind(this)}componentDidMount(){const{neoData:e,neoMSTData:s,neoFunc:n}=this.resolveNeoProps(),{data:i,...c}=r="function"==typeof r?new r:r,a=t("function"==typeof i?i():i,e);this.vm=new o({...c,data:()=>a,props:t(n,{...c.props||{},...s})}),Object.keys(n).forEach(e=>{this.vm.$props[e]=n[e]}),this.domRef.current&&this.domRef.current.appendChild(this.vm.$mount().$el)}componentDidUpdate(){if(!this.isUnmount){const{neoData:e}=this.resolveNeoProps();this.vm&&(Object.keys(e).forEach(o=>{this.vm[o]=e[o]}),this.vm.$forceUpdate())}}componentWillUnmount(){this.isUnmount=!0,this.vm&&this.vm.$destroy()}resolveNeoProps(){let e={},o={},t={};return Object.keys(this.props).forEach(r=>{const s=this.props[r];var n;"function"==typeof s?e[r]=s:(n=s)&&(n.$treenode||n.$mstObservable||n.$modelType||n.$modelId||"[object Proxy]"===Object.prototype.toString.call(n))?t[r]=s:o[r]=s}),{neoData:o,neoMSTData:t,neoFunc:e}}reload(){this.vm&&this.vm.reload?this.vm.reload():console.warn("自定义组件暂不支持reload动作。")}doAction(e,o){this.vm&&this.vm.doAction?this.vm.doAction(e,o):console.warn("自定义组件中不存在 doAction。")}render(){return e.createElement("div",{ref:this.domRef})}}return s}}function a(e,o){if(!e)return;const t={cmpType:"",usage:s.renderer,weight:0};var i;if(o&&(i=o,"String"===Object.prototype.toString.call(i).slice(8,-1))?Object.assign(t,{cmpType:o}):Object.assign(t,o),t&&!t.cmpType)console.error(`${r} / registerNeoCmp: 自定义组件注册失败,cmpType 不能为空。`);else{t.framework=t.framework?function(e){let o=n.react;if(!e)return o;let t=e.toLowerCase().trim();switch(t){case"jquery":case"jq":t=n.jquery;break;case"vue2":case"vue 2":case"vue2.0":case"vue 2.0":t=n.vue2;break;case"vue":case"vue3":case"vue 3":case"vue3.0":case"vue 3.0":t=n.vue3,console.error(`${r} 暂不支持 vue3.0 技术栈。`);break;default:t=n.react}return t}(t.framework):function(e){return"object"==typeof e&&(e._compiled&&e.components||e.__file&&e.__file.endsWith(".vue"))}(e)?"vue2":"react",t.usage=function(e){let o=s.renderer;if(!e)return o;let t=e.toLowerCase().trim();switch(t){case"renderer":case"renderers":default:t=s.renderer;break;case"formitem":case"form-item":case"form item":t=s.formitem}return t}(t.usage);const o={renderer:()=>{},formitem:()=>{}},i={react:e=>e,vue2:c,vue3:c}[t.framework](e);if(o[t.usage]){if(window&&window.postMessage){const e=function(e,o){window&&!window.NeoCustomCmps&&(window.NeoCustomCmps={});if(!window.NeoCustomCmps[e])return window.NeoCustomCmps[e]=o,e;console.error(`${r} / registerNeoCmp: 自定义组件注册失败,已存在重名渲染器(${e})。`);return null}(t.cmpType,{cmpType:t.cmpType,weight:t.weight,usage:t.usage,framework:t.framework,component:i,config:t});e&&(console.info(`${r}触发注册自定义组件(${e})事件`),window.postMessage({type:"neo-cmp-register-event",eventMsg:`${r}注册一个自定义组件`,neoRenderer:{cmpType:e,weight:t.weight,usage:t.usage,config:t}},"*"))}}else console.error(`${r} / registerNeoCmp: 自定义组件注册失败,暂不支持 ${t.usage} 组件类型。`)}}!function(e){e.renderer="renderer",e.formitem="formitem"}(s||(s={})),function(e){e.react="react",e.vue2="vue2",e.vue3="vue3",e.jquery="jquery"}(n||(n={}));export{c as createVue2Component,a as registerNeoCmp,i as registerNeoEditorModel};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.umd.js.LICENSE.txt */
|
|
2
|
-
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.neoRegister=o():e.neoRegister=o()}(this,function(){return function(){"use strict";var e={n:function(o){var r=o&&o.__esModule?function(){return o.default}:function(){return o};return e.d(r,{a:r}),r},d:function(o,r){for(var t in r)e.o(r,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:r[t]})},o:function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{createVue2Component:function(){return y},registerNeoCmp:function(){return b},registerNeoEditorModel:function(){return u}});var r=require("@babel/runtime/helpers/extends"),t=e.n(r);function n(e,o,r){void 0===r&&(r=!0);var t=function(e,o){void 0===o&&(o=!0);var r=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return o&&e&&Object.keys(e).forEach(function(o){return r[o]=e[o]}),r}(e,r);return o&&Object.keys(o).forEach(function(e){return t[e]=o[e]}),t}var i,s,c="[neo-register]";function u(e,o){if(e&&function(e){var o=!1;if(!e)return!1;var r=new e;return r.label?r.tags?Array.isArray(r.tags)?(r.icon||Object.assign(e.prototype,{icon:"https://neo-widgets.bj.bcebos.com/custom-widget.svg"}),o=!0):console.error(c+" / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)格式异常。"):console.error(c+" / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)不能为空。"):console.error(c+" / registerNeoEditorModel: 自定义组件注册失败,名称(label)不能为空。"),o}(e)){var r,t,n=o||(new e).cmpType;
|
|
2
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.neoRegister=o():e.neoRegister=o()}(this,function(){return function(){"use strict";var e={n:function(o){var r=o&&o.__esModule?function(){return o.default}:function(){return o};return e.d(r,{a:r}),r},d:function(o,r){for(var t in r)e.o(r,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:r[t]})},o:function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{createVue2Component:function(){return y},registerNeoCmp:function(){return b},registerNeoEditorModel:function(){return u}});var r=require("@babel/runtime/helpers/extends"),t=e.n(r);function n(e,o,r){void 0===r&&(r=!0);var t=function(e,o){void 0===o&&(o=!0);var r=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return o&&e&&Object.keys(e).forEach(function(o){return r[o]=e[o]}),r}(e,r);return o&&Object.keys(o).forEach(function(e){return t[e]=o[e]}),t}var i,s,c="[neo-register]";function u(e,o){if(e&&function(e){var o=!1;if(!e)return!1;var r=new e;return r.label?r.tags?Array.isArray(r.tags)?(r.icon||Object.assign(e.prototype,{icon:"https://neo-widgets.bj.bcebos.com/custom-widget.svg"}),o=!0):console.error(c+" / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)格式异常。"):console.error(c+" / registerNeoEditorModel: 自定义组件注册失败,组件分类(tags)不能为空。"):console.error(c+" / registerNeoEditorModel: 自定义组件注册失败,名称(label)不能为空。"),o}(e)){var r,t,n,i=o||(new e).cmpType;i||console.error(c+" / registerNeoEditorModel: 自定义组件注册失败,cmpType 不能为空。");var s=new e;if(Object.assign(e.prototype,{custom:!0,exposedToDesigner:null==(r=s.exposedToDesigner)||r,namespace:null!=(t=s.namespace)?t:"neo-cmp-cli",enableDuplicate:null==(n=s.enableDuplicate)||n,cmpType:i}),window&&window.postMessage){var u=function(e,o){return window&&!window.NEOEditorCustomModels&&(window.NEOEditorCustomModels={}),window.NEOEditorCustomModels[e]?(console.error(c+"注册自定义组件模型失败,已存在重名插件("+e+")。"),null):(window.NEOEditorCustomModels[e]=o,e)}(i,e);u&&(console.info(c+"触发注册自定义组件模型("+i+")事件"),window.postMessage({type:"neo-model-register-event",eventMsg:c+"注册一个 neo-editor 自定义组件模型",cmpType:i},"*"))}}}!function(e){e.renderer="renderer",e.formitem="formitem"}(i||(i={})),function(e){e.react="react",e.vue2="vue2",e.vue3="vue3",e.jquery="jquery"}(s||(s={}));var a=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),p=e.n(a),f=require("@babel/runtime/helpers/inheritsLoose"),d=e.n(f),m=require("react"),l=e.n(m),v=require("vue"),w=e.n(v),g=["data"];function y(e){if(e&&("function"==typeof e||"object"==typeof e))return function(o){function r(e,r){var t;return(t=o.call(this,e)||this).domRef=void 0,t.vm=void 0,t.isUnmount=void 0,t.domRef=l().createRef(),t.isUnmount=!1,t.resolveNeoProps=t.resolveNeoProps.bind(t),t}d()(r,o);var i=r.prototype;return i.componentDidMount=function(){var o=this,r=this.resolveNeoProps(),i=r.neoData,s=r.neoMSTData,c=r.neoFunc,u=e="function"==typeof e?new e:e,a=u.data,f=p()(u,g),d=n("function"==typeof a?a():a,i);this.vm=new(w())(t()({},f,{data:function(){return d},props:n(c,t()({},f.props||{},s))})),Object.keys(c).forEach(function(e){o.vm.$props[e]=c[e]}),this.domRef.current&&this.domRef.current.appendChild(this.vm.$mount().$el)},i.componentDidUpdate=function(){var e=this;if(!this.isUnmount){var o=this.resolveNeoProps().neoData;this.vm&&(Object.keys(o).forEach(function(r){e.vm[r]=o[r]}),this.vm.$forceUpdate())}},i.componentWillUnmount=function(){this.isUnmount=!0,this.vm&&this.vm.$destroy()},i.resolveNeoProps=function(){var e=this,o={},r={},t={};return Object.keys(this.props).forEach(function(n){var i,s=e.props[n];"function"==typeof s?o[n]=s:(i=s)&&(i.$treenode||i.$mstObservable||i.$modelType||i.$modelId||"[object Proxy]"===Object.prototype.toString.call(i))?t[n]=s:r[n]=s}),{neoData:r,neoMSTData:t,neoFunc:o}},i.reload=function(){this.vm&&this.vm.reload?this.vm.reload():console.warn("自定义组件暂不支持reload动作。")},i.doAction=function(e,o){this.vm&&this.vm.doAction?this.vm.doAction(e,o):console.warn("自定义组件中不存在 doAction。")},i.render=function(){return l().createElement("div",{ref:this.domRef})},r}(l().Component)}function b(e,o){if(e){var r,t={cmpType:"",usage:i.renderer,weight:0};if(o&&(r=o,"String"===Object.prototype.toString.call(r).slice(8,-1))?Object.assign(t,{cmpType:o}):Object.assign(t,o),t&&!t.cmpType)console.error(c+" / registerNeoCmp: 自定义组件注册失败,cmpType 不能为空。");else{t.framework=t.framework?function(e){var o=s.react;if(!e)return o;var r=e.toLowerCase().trim();switch(r){case"jquery":case"jq":r=s.jquery;break;case"vue2":case"vue 2":case"vue2.0":case"vue 2.0":r=s.vue2;break;case"vue":case"vue3":case"vue 3":case"vue3.0":case"vue 3.0":r=s.vue3,console.error(c+" 暂不支持 vue3.0 技术栈。");break;default:r=s.react}return r}(t.framework):"object"==typeof(f=e)&&(f._compiled&&f.components||f.__file&&f.__file.endsWith(".vue"))?"vue2":"react",t.usage=function(e){var o=i.renderer;if(!e)return o;var r=e.toLowerCase().trim();switch(r){case"renderer":case"renderers":default:r=i.renderer;break;case"formitem":case"form-item":case"form item":r=i.formitem}return r}(t.usage);var n={react:function(e){return e},vue2:y,vue3:y}[t.framework](e);if({renderer:function(){},formitem:function(){}}[t.usage]){if(window&&window.postMessage){var u=(a=t.cmpType,p={cmpType:t.cmpType,weight:t.weight,usage:t.usage,framework:t.framework,component:n,config:t},window&&!window.NeoCustomCmps&&(window.NeoCustomCmps={}),window.NeoCustomCmps[a]?(console.error(c+" / registerNeoCmp: 自定义组件注册失败,已存在重名渲染器("+a+")。"),null):(window.NeoCustomCmps[a]=p,a));u&&(console.info(c+"触发注册自定义组件("+u+")事件"),window.postMessage({type:"neo-cmp-register-event",eventMsg:c+"注册一个自定义组件",neoRenderer:{cmpType:u,weight:t.weight,usage:t.usage,config:t}},"*"))}}else console.error(c+" / registerNeoCmp: 自定义组件注册失败,暂不支持 "+t.usage+" 组件类型。")}}var a,p,f}return o}()});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* neo-register v1.0.
|
|
2
|
+
* neo-register v1.0.3
|
|
3
3
|
* author: wibetter
|
|
4
4
|
* build tool: AKFun
|
|
5
|
-
* build time:
|
|
5
|
+
* build time: Mon Oct 13 2025 10:52:33 GMT+0800 (中国标准时间)
|
|
6
6
|
* build tool info: https://github.com/wibetter/akfun
|
|
7
7
|
*/
|
package/docs/FormItemType.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## 可作为自定义配置项的表单项组件
|
|
2
2
|
|
|
3
|
-
### 1. 基础输入类
|
|
3
|
+
### 1. 基础输入类 / 配置项
|
|
4
4
|
|
|
5
5
|
#### 文本输入
|
|
6
6
|
- **text** - 文本输入框
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
- **date-range** - 日期范围选择器
|
|
28
28
|
- **datetime-range** - 日期时间范围选择器
|
|
29
29
|
|
|
30
|
-
### 2. 选择类
|
|
30
|
+
### 2. 选择类 / 配置项
|
|
31
31
|
|
|
32
32
|
#### 单选/多选
|
|
33
33
|
- **select** - 下拉选择框
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
- **picker** - 选择器
|
|
51
51
|
- **tabs-transfer** - 标签页穿梭框
|
|
52
52
|
|
|
53
|
-
### 3. 特殊输入类
|
|
53
|
+
### 3. 特殊输入类 / 配置项
|
|
54
54
|
|
|
55
55
|
#### 开关
|
|
56
56
|
- **switch** - 开关组件
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
#### 位置
|
|
74
74
|
- **location** - 位置选择器
|
|
75
75
|
|
|
76
|
-
### 4. 文件上传类
|
|
76
|
+
### 4. 文件上传类 / 配置项 (暂不可用)
|
|
77
77
|
|
|
78
78
|
#### 文件上传
|
|
79
79
|
- **file** - 文件上传组件
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
#### 图片上传
|
|
82
82
|
- **image** - 图片上传组件
|
|
83
83
|
|
|
84
|
-
### 5. 富文本编辑类
|
|
84
|
+
### 5. 富文本编辑类 / 配置项
|
|
85
85
|
|
|
86
86
|
#### 编辑器
|
|
87
87
|
- **js-editor** - JavaScript 编辑器
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
#### 标签页
|
|
105
105
|
- **tabs** - 标签页组件
|
|
106
106
|
|
|
107
|
-
### 7. 复合组件类
|
|
107
|
+
### 7. 复合组件类 / 配置项
|
|
108
108
|
|
|
109
109
|
#### 组合
|
|
110
110
|
- **combo** - 组合组件
|
|
@@ -144,14 +144,20 @@
|
|
|
144
144
|
- **condition-builder** - 条件构建器
|
|
145
145
|
|
|
146
146
|
#### 矩阵
|
|
147
|
-
- **matrix** - 矩阵组件
|
|
147
|
+
- **matrix** - 矩阵组件
|
|
148
148
|
|
|
149
149
|
#### UUID
|
|
150
|
-
- **uuid** - UUID 生成器
|
|
150
|
+
- **uuid** - UUID 生成器
|
|
151
151
|
|
|
152
152
|
#### 月份范围
|
|
153
153
|
- **month-range** - 月份范围选择器
|
|
154
154
|
|
|
155
|
+
### 9. NeoCRM 平台数据源相关属性配置
|
|
156
|
+
|
|
157
|
+
#### 实体相关数据源
|
|
158
|
+
- **xObjectEntityList** - 实体列表数据源 [使用文档](./docs/NeoEntityApiType/xObjectEntityList.md)
|
|
159
|
+
- **xObjectDataApi** - 实体业务数据列表数据源 [使用文档](./docs/NeoEntityApiType/xObjectDataApi.md)
|
|
160
|
+
- **xObjectDetailApi** - 实体详情数据源 [使用文档](./docs/NeoEntityApiType/xObjectDetailApi.md)
|
|
155
161
|
|
|
156
162
|
## 使用说明
|
|
157
163
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# xObjectDataApi 实体数据源属性配置组件
|
|
2
|
+
这是一个用于获取实体业务数据列表的属性配置项,支持:
|
|
3
|
+
|
|
4
|
+
1. **输入框展示**:以输入框形式展示当前配置的实体和选择的字段信息
|
|
5
|
+
2. **设置按钮**:右侧设置图标,点击打开配置弹窗
|
|
6
|
+
3. **实体类型选择**:弹窗中支持选择标准实体或自定义实体
|
|
7
|
+
4. **实体选择**:弹窗中支持下拉选择实体
|
|
8
|
+
5. **字段选择**:使用 antd Transfer 组件选择字段,默认选中所有实体字段
|
|
9
|
+
6. **分页配置**:配置页码(默认展示第几页)和每页条数(每页展示多少条数据)
|
|
10
|
+
7. **数据存储**:选择的实体ID存储到 `xObjectApiKey`,选中的字段列表存储到 `fields`,字段信息列表存储到 `fieldDescList`,页码存储到 `page`,每页条数存储到 `pageSize`
|
|
11
|
+
|
|
12
|
+
## 使用方法
|
|
13
|
+
|
|
14
|
+
在 属性配置面板(propsSchema)中使用:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"type": "xObjectDataApi",
|
|
19
|
+
"name": "dataSource",
|
|
20
|
+
"label": "数据源配置"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 组件属性
|
|
25
|
+
|
|
26
|
+
- `name`: 字段名称
|
|
27
|
+
- `label`: 标签文本
|
|
28
|
+
- `disabled`: 是否禁用
|
|
29
|
+
- `value`: 当前值,格式为 `{ xObjectApiKey: string, fields: string[], fieldDescList: object[], page: number, pageSize: number }`
|
|
30
|
+
- `xObjectApiKey`: 选择的实体 API Key
|
|
31
|
+
- `fields`: 选中的字段列表
|
|
32
|
+
- `fieldDescList`: 字段信息列表
|
|
33
|
+
- `page`: 页码,默认为 1(默认展示第几页)
|
|
34
|
+
- `pageSize`: 每页条数,默认为 20(每页展示多少条数据)
|
|
35
|
+
- `onChange`: 值变化回调
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# xObjectDetailApi 实体业务详情数据配置组件
|
|
2
|
+
这是一个用于配置获取实体业务详情数据的属性配置项,支持:
|
|
3
|
+
|
|
4
|
+
1. **输入框展示**:以输入框形式展示当前配置的实体、业务数据ID和字段信息
|
|
5
|
+
2. **设置按钮**:右侧设置图标,点击打开配置弹窗
|
|
6
|
+
3. **实体选择**:弹窗中支持下拉选择实体(标准实体/自定义实体)
|
|
7
|
+
4. **业务数据ID选择**:根据选择的实体,使用 xObject.query 获取业务数据列表,支持选择具体的业务数据ID
|
|
8
|
+
5. **字段选择**:使用 antd Transfer 组件选择字段,默认全部选中
|
|
9
|
+
6. **数据存储**:选择的实体ID存储到 `xObjectApiKey`,业务数据ID存储到 `objectId`,字段列表存储到 `fieldDescList`
|
|
10
|
+
|
|
11
|
+
## 使用方法
|
|
12
|
+
|
|
13
|
+
在 属性配置面板(propsSchema)中使用:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"type": "xObjectDetailApi",
|
|
18
|
+
"name": "dataSource",
|
|
19
|
+
"label": "业务详情数据源配置"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 组件属性
|
|
24
|
+
|
|
25
|
+
- `name`: 字段名称
|
|
26
|
+
- `label`: 标签文本
|
|
27
|
+
- `disabled`: 是否禁用
|
|
28
|
+
- `value`: 当前值,格式为 `{ xObjectApiKey: string, objectId: string }`
|
|
29
|
+
- `onChange`: 值变化回调
|
|
30
|
+
|
|
31
|
+
## 功能特性
|
|
32
|
+
|
|
33
|
+
- **实体类型切换**:支持标准实体和自定义实体的切换
|
|
34
|
+
- **智能联动**:选择实体后自动加载对应的业务数据列表和字段列表
|
|
35
|
+
- **搜索过滤**:所有选择器都支持搜索过滤功能
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# xObjectEntityList 对象实体列表选择配置组件
|
|
2
|
+
这是一个简化的对象实体列表选择配置项,采用直接下拉列表配置方式,专门用于选择对象实体,支持:
|
|
3
|
+
|
|
4
|
+
1. **实体列表展示**:以下拉列表形式展示当前可选择的实体对象
|
|
5
|
+
2. **搜索功能**:支持实体名称搜索
|
|
6
|
+
3. **数据存储**:选择的实体ID存储到 value 中
|
|
7
|
+
4. **实体类型控制**:通过 custom 属性控制使用标准实体还是自定义实体
|
|
8
|
+
|
|
9
|
+
## 使用方法
|
|
10
|
+
|
|
11
|
+
在 属性配置面板(propsSchema) 中使用:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"type": "xObjectEntityList",
|
|
16
|
+
"name": "xObjectApiKey",
|
|
17
|
+
"label": "对象实体列表",
|
|
18
|
+
"custom": false
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 组件属性
|
|
23
|
+
|
|
24
|
+
- `name`: 字段名称
|
|
25
|
+
- `label`: 标签文本
|
|
26
|
+
- `disabled`: 是否禁用
|
|
27
|
+
- `custom`: 是否使用自定义实体,设置为 false 则表示展示标准实体列表,不传则展示标准实体和自定义实体
|
|
28
|
+
- `value`: 当前已选择的实体对象ID(xObjectApiKey)
|
|
29
|
+
- `onChange`: 值变化回调
|
|
30
|
+
|
|
31
|
+
## 功能特性
|
|
32
|
+
|
|
33
|
+
- **实体类型控制**:通过 custom 属性控制实体类型,无需用户手动切换
|
|
34
|
+
- **搜索过滤**:支持按实体名称进行搜索过滤
|
|
35
|
+
- **加载状态**:显示数据加载状态
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo-register",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "neo自定义组件注册器(支持 react 和 vue2.0 技术栈),主要用于注册 neo 自定义组件、neo-editor 自定义组件模型。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neo自定义组件注册器",
|
|
@@ -43,17 +43,18 @@
|
|
|
43
43
|
"vue": "^2.6.14"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"react": "^16.9.0",
|
|
47
|
+
"react-dom": "^16.9.0",
|
|
48
|
+
"antd": "^4.9.4",
|
|
49
|
+
"neo-open-api": "^1.0.11",
|
|
46
50
|
"@commitlint/cli": "^8.3.5",
|
|
47
51
|
"@commitlint/config-conventional": "^9.1.1",
|
|
48
|
-
"@types/react": "^16.
|
|
49
|
-
"@types/react-dom": "^16.9.
|
|
50
|
-
"@types/vue": "^1.0.31",
|
|
52
|
+
"@types/react": "^16.9.11",
|
|
53
|
+
"@types/react-dom": "^16.9.15",
|
|
51
54
|
"husky": "^4.2.5",
|
|
52
55
|
"lint-staged": "^10.2.9",
|
|
53
|
-
"neo-cmp-cli": "^1.
|
|
54
|
-
"prettier": "^2.0.5"
|
|
55
|
-
"react": "^16.9.0",
|
|
56
|
-
"react-dom": "^16.9.0"
|
|
56
|
+
"neo-cmp-cli": "^1.2.19",
|
|
57
|
+
"prettier": "^2.0.5"
|
|
57
58
|
},
|
|
58
59
|
"engines": {
|
|
59
60
|
"node": ">= 10.13.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|