@oinone/kunlun-meta 6.2.0 → 6.2.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.
|
@@ -493,4 +493,4 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
`;try{return(yield kt.query(U.BASE,e)).data.widgetDefinitionQuery.loadSDK}catch(e){return void console.error("remote plugin load error.",e)}}))}(),e||(e=null),this.cache=e),e){const{javascript:t,css:n}=e,i=[];t&&i.push(xt.loadJavascript(t)),n&&i.push(xt.loadCSS(n)),yield Promise.allSettled(i)}}))}}Pt.INSTANCE=new Pt;class Ft{static load(e,t){return s(this,void 0,void 0,(function*(){const{dependencies:n,mounted:i,usingRemote:r}=e;if(t&&(yield xt.loadDependencies(t)),n&&(yield xt.loadDependencies(n)),i)if(Array.isArray(i))yield xt.loadJavascript(i);else{const{js:e,css:t}=i;e&&(yield xt.loadJavascript(e)),t&&(yield xt.loadCSS(t))}r&&(yield Pt.INSTANCE.load())}))}}class wt{static resister(e){this._config=e}static getConfig(){return this._config}static getConfigByName(e){return"login"===e?this._config.login||this.defaultLoginPath:this._config[e]}}wt.defaultLoginPath="/login",wt._config={};const Bt="runtimeConfigResolve",$t={init:!1,updateTime:new Date,value:{}};class Ut{static init(e){return s(this,void 0,void 0,(function*(){if(!$t.init)return function(){if($t.init)return;if(Reflect.get(window,Bt))return;return new Promise((e=>{Reflect.set(window,Bt,(t=>{e(t),Reflect.deleteProperty(window,Bt)}));const t=document.createElement("script");t.src=`${process.env.RUNTIME_CONFIG_BASE_URL||""}/${process.env.RUNTIME_CONFIG_FILENAME||"manifest"}.js`;const n=function(e){return()=>{e({}),Reflect.deleteProperty(window,Bt)}}(e);t.onload=n,t.onerror=n,document.body.appendChild(t)})).then((e=>s(this,void 0,void 0,(function*(){$t.updateTime=new Date,$t.value=e})))).finally((()=>{$t.init=!0}))}()}))}static get(){return $t.init?$t.value||{}:("development"===process.env.NODE_ENV&&console.warn("runtime config is not init."),{})}static getConfig(e){return Ut.get()[e]}}function Vt(e){return null==e?e:JSON.parse(JSON.stringify(e))}const Yt=e=>e?Array.isArray(e)?null:Vt(e):{},Gt=e=>e&&e.children?e.children.filter((e=>e.tagName===b.PROP)).map((e=>({name:e.name,textContent:e.textContent}))):[],jt=e=>e?Vt(e):{},Ht=e=>e&&e.children?e.children.filter((e=>e.tagName===b.FIELD)).map((e=>({name:e.name,textContent:e.textContent,children:Ht(e)}))):[],Kt=(e,t)=>{if(!t)return{};const n=Vt(e);if(t.children&&t.children.find((e=>e.tagName===b.API&&e.name===n.submitApi))||null){const e=Jt(t,n.submitApi);if(!e)return{};n.api=e}return n},Jt=(e,t,n)=>{const i=e.children&&e.children.find((e=>e.tagName===b.API&&e.name===t))||null;if(!i)return console.warn(`api not fund: ${t}`,e),null;const r=Vt(i);return r.fun||console.warn(`api fun not fund: ${t}`,e),r.type||console.warn(`api type not fund: ${t}`,e),r.context={props:Gt(i.children.find((e=>e.tagName===b.CONTEXT)))},r.request={fields:Wt(Ht(i.children.find((e=>e.tagName===b.REQUEST))),n)},r.response={fields:Wt(Ht(i.children.find((e=>e.tagName===b.RESPONSE))),n)},r.clear={fields:Ht(i.children.find((e=>e.tagName===b.CLEAR)))},r};function Wt(e,t){return e&&e.length?e:(t||[]).map((e=>Xt(e)))}const qt=e=>({name:e.data,ttype:e.ttype,references:e.references,relatedTtype:e.relatedTtype}),Xt=e=>({data:e.name,name:e.name,ttype:e.ttype,references:e.references,relatedTtype:e.relatedTtype});function Qt(e){return!!e&&"function"==typeof e.then}const zt=e=>{switch(e.ttype){case o.Boolean:case o.Integer:case o.Long:case o.Float:case o.Currency:case o.String:case o.Email:case o.Phone:case o.ID:case o.Date:case o.DateTime:case o.Time:case o.Year:case o.Enum:case o.MultiEnum:case o.HTML:case o.Map:case o.Text:return!0;default:return!1}},Zt=e=>[o.OneToOne,o.OneToMany,o.ManyToOne,o.ManyToMany].includes(e),en=e=>[o.Date,o.DateTime,o.Year,o.Time].includes(e),tn=e=>[o.ID,o.UID,o.Integer,o.Long,o.Float,o.Currency].includes(e),nn=e=>[o.String,o.Text,o.HTML,o.Phone,o.Email].includes(e),rn=e=>{if(!1===e||0===e)return!1;if(!e)return!0;if(e instanceof Object){if(0===Object.keys(e||{}).length)return!0;return 0===Object.keys(e||{}).filter((e=>!e.startsWith("_"))).length}return!(!Array.isArray(e)||0!==e.length)},
|
|
496
|
+
`;try{return(yield kt.query(U.BASE,e)).data.widgetDefinitionQuery.loadSDK}catch(e){return void console.error("remote plugin load error.",e)}}))}(),e||(e=null),this.cache=e),e){const{javascript:t,css:n}=e,i=[];t&&i.push(xt.loadJavascript(t)),n&&i.push(xt.loadCSS(n)),yield Promise.allSettled(i)}}))}}Pt.INSTANCE=new Pt;class Ft{static load(e,t){return s(this,void 0,void 0,(function*(){const{dependencies:n,mounted:i,usingRemote:r}=e;if(t&&(yield xt.loadDependencies(t)),n&&(yield xt.loadDependencies(n)),i)if(Array.isArray(i))yield xt.loadJavascript(i);else{const{js:e,css:t}=i;e&&(yield xt.loadJavascript(e)),t&&(yield xt.loadCSS(t))}r&&(yield Pt.INSTANCE.load())}))}}class wt{static resister(e){this._config=e}static getConfig(){return this._config}static getConfigByName(e){return"login"===e?this._config.login||this.defaultLoginPath:this._config[e]}}wt.defaultLoginPath="/login",wt._config={};const Bt="runtimeConfigResolve",$t={init:!1,updateTime:new Date,value:{}};class Ut{static init(e){return s(this,void 0,void 0,(function*(){if(!$t.init)return function(){if($t.init)return;if(Reflect.get(window,Bt))return;return new Promise((e=>{Reflect.set(window,Bt,(t=>{e(t),Reflect.deleteProperty(window,Bt)}));const t=document.createElement("script");t.src=`${process.env.RUNTIME_CONFIG_BASE_URL||""}/${process.env.RUNTIME_CONFIG_FILENAME||"manifest"}.js`;const n=function(e){return()=>{e({}),Reflect.deleteProperty(window,Bt)}}(e);t.onload=n,t.onerror=n,document.body.appendChild(t)})).then((e=>s(this,void 0,void 0,(function*(){$t.updateTime=new Date,$t.value=e})))).finally((()=>{$t.init=!0}))}()}))}static get(){return $t.init?$t.value||{}:("development"===process.env.NODE_ENV&&console.warn("runtime config is not init."),{})}static getConfig(e){return Ut.get()[e]}}function Vt(e){return null==e?e:JSON.parse(JSON.stringify(e))}const Yt=e=>e?Array.isArray(e)?null:Vt(e):{},Gt=e=>e&&e.children?e.children.filter((e=>e.tagName===b.PROP)).map((e=>({name:e.name,textContent:e.textContent}))):[],jt=e=>e?Vt(e):{},Ht=e=>e&&e.children?e.children.filter((e=>e.tagName===b.FIELD)).map((e=>({name:e.name,textContent:e.textContent,children:Ht(e)}))):[],Kt=(e,t)=>{if(!t)return{};const n=Vt(e);if(t.children&&t.children.find((e=>e.tagName===b.API&&e.name===n.submitApi))||null){const e=Jt(t,n.submitApi);if(!e)return{};n.api=e}return n},Jt=(e,t,n)=>{const i=e.children&&e.children.find((e=>e.tagName===b.API&&e.name===t))||null;if(!i)return console.warn(`api not fund: ${t}`,e),null;const r=Vt(i);return r.fun||console.warn(`api fun not fund: ${t}`,e),r.type||console.warn(`api type not fund: ${t}`,e),r.context={props:Gt(i.children.find((e=>e.tagName===b.CONTEXT)))},r.request={fields:Wt(Ht(i.children.find((e=>e.tagName===b.REQUEST))),n)},r.response={fields:Wt(Ht(i.children.find((e=>e.tagName===b.RESPONSE))),n)},r.clear={fields:Ht(i.children.find((e=>e.tagName===b.CLEAR)))},r};function Wt(e,t){return e&&e.length?e:(t||[]).map((e=>Xt(e)))}const qt=e=>({name:e.data,ttype:e.ttype,references:e.references,relatedTtype:e.relatedTtype}),Xt=e=>({data:e.name,name:e.name,ttype:e.ttype,references:e.references,relatedTtype:e.relatedTtype});function Qt(e){return!!e&&"function"==typeof e.then}const zt=e=>{switch(e.ttype){case o.Boolean:case o.Integer:case o.Long:case o.Float:case o.Currency:case o.String:case o.Email:case o.Phone:case o.ID:case o.Date:case o.DateTime:case o.Time:case o.Year:case o.Enum:case o.MultiEnum:case o.HTML:case o.Map:case o.Text:return!0;default:return!1}},Zt=e=>[o.OneToOne,o.OneToMany,o.ManyToOne,o.ManyToMany].includes(e),en=e=>[o.Date,o.DateTime,o.Year,o.Time].includes(e),tn=e=>[o.ID,o.UID,o.Integer,o.Long,o.Float,o.Currency].includes(e),nn=e=>[o.String,o.Text,o.HTML,o.Phone,o.Email].includes(e),rn=e=>e===o.Boolean,on=e=>e===o.Enum,an=e=>{if(!1===e||0===e)return!1;if(!e)return!0;if(e instanceof Object){if(0===Object.keys(e||{}).length)return!0;return 0===Object.keys(e||{}).filter((e=>!e.startsWith("_"))).length}return!(!Array.isArray(e)||0!==e.length)},sn=e=>an(e)||Array.isArray(e)&&0===e.length,cn=e=>null==e||""===e||Array.isArray(e)&&0===e.length||"object"==typeof e&&0===Object.keys(e).length;export{L as ActionCompositionType,T as ActionContextType,O as ActionFunctionType,N as ActionType,C as ActionValidationScope,n as ActiveEnum,d as ApiProtocol,V as BASE_RSQL_QUERY_CONDITION,_ as ClientActionName,x as DataClass,i as DataStatusEnum,f as DataType,b as ElementType,p as EnumOptionState,wt as GlobalConfig,y as IActionTag,h as LoadType,st as MetadataFragment,Tt as MetadataRuntimeFragment,Ot as MetadataRuntimeFragmentName,I as ModelActionType,A as ModelDefaultActionName,M as ModelDefaultActionNames,u as ModelFieldSerializeType,o as ModelFieldType,c as ModelFieldTypeDisplayName,l as ModelFieldTypeOptions,r as ModelType,Ft as PluginsLoader,m as QueryType,Ut as RuntimeConfig,$ as SYSTEM_MODULE,U as SYSTEM_MODULE_NAME,B as SystemSource,R as UserBehaviorEventEnum,E as ValidationScope,w as ViewActionTarget,k as ViewClientType,F as ViewMode,P as ViewType,Kt as createActionElement,Jt as createApiElement,jt as createFieldElement,Ht as createFieldElements,Gt as createPropElements,Yt as createViewElement,Vt as deepClone,qt as fieldElement2ModelField,rn as isBooleanTtype,Zt as isComplexTtype,en as isDateTtype,an as isEmptyKeObject,cn as isEmptyValue,on as isEnumTtype,tn as isNumberTtype,Qt as isPromise,g as isRelatedTtype,D as isRelationTtype,zt as isSimpleField,nn as isStringTtype,S as isToManyTtype,v as isToOneTtype,sn as isValidateEmpty,Xt as modelField2fieldElement};
|
|
@@ -4,4 +4,6 @@ declare const isComplexTtype: (ttype: ModelFieldType) => boolean;
|
|
|
4
4
|
declare const isDateTtype: (ttype: ModelFieldType) => boolean;
|
|
5
5
|
declare const isNumberTtype: (ttype: ModelFieldType) => boolean;
|
|
6
6
|
declare const isStringTtype: (ttype: ModelFieldType) => boolean;
|
|
7
|
-
|
|
7
|
+
declare const isBooleanTtype: (ttype: ModelFieldType) => boolean;
|
|
8
|
+
declare const isEnumTtype: (ttype: ModelFieldType) => boolean;
|
|
9
|
+
export { isSimpleField, isComplexTtype, isDateTtype, isNumberTtype, isStringTtype, isBooleanTtype, isEnumTtype };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/kunlun-meta",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "rimraf dist",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"x-postpublish": "node ../../scripts/postpublish.js"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@oinone/kunlun-request": "6.2.
|
|
14
|
+
"@oinone/kunlun-request": "6.2.1"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "2b4c0c7911626c105ca71c2d41e54af470e2e079"
|
|
17
17
|
}
|
package/src/util/field.ts
CHANGED
|
@@ -60,4 +60,12 @@ const isStringTtype = (ttype: ModelFieldType) => {
|
|
|
60
60
|
ModelFieldType.Email
|
|
61
61
|
].includes(ttype);
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
const isBooleanTtype = (ttype: ModelFieldType) => {
|
|
65
|
+
return ttype === ModelFieldType.Boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const isEnumTtype = (ttype: ModelFieldType) => {
|
|
69
|
+
return ttype === ModelFieldType.Enum;
|
|
70
|
+
};
|
|
71
|
+
export { isSimpleField, isComplexTtype, isDateTtype, isNumberTtype, isStringTtype, isBooleanTtype, isEnumTtype };
|