@oinone/kunlun-vue-widget 7.1.0 → 7.2.0
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/oinone-kunlun-vue-widget.esm.js +1 -1
- package/dist/types/src/basic/VueWidget.d.ts +4 -0
- package/dist/types/src/data/ActiveRecordsWidget.d.ts +11 -1
- package/dist/types/src/state/typing.d.ts +2 -0
- package/package.json +11 -11
- package/src/basic/VueWidget.ts +13 -0
- package/src/data/ActiveRecordsWidget.ts +34 -4
- package/src/shim-translate.d.ts +4 -1
- package/src/state/context.ts +5 -1
- package/src/state/typing.ts +2 -0
- package/src/state/view.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{instantiate as e,uniqueKeyGenerator as t,StringHelper as i,CastHelper as n,BooleanHelper as o}from"@oinone/kunlun-shared";import{BehaviorSubject as r,Subject as s}from"@oinone/kunlun-state";import{translateValueByKey as d,genStaticPath as a,RuntimeContextManager as c,ComputeContextManager as l,ROOT_HANDLE as u,ActiveRecordsOperator as p,ViewVM as h}from"@oinone/kunlun-engine";import{defineComponent as g,createVNode as v,Fragment as f,effectScope as y,computed as m,ref as W,watch as b,isRef as R,toRaw as D,withCtx as S,nextTick as C,h as w,Suspense as A,resolveDynamicComponent as $,inject as O,provide as M,reactive as j,onBeforeMount as P,onMounted as N,onUnmounted as V}from"vue";import{isNil as I,isBoolean as H,isString as _,intersection as E,isFunction as x}from"lodash-es";import{XMLTemplateParser as B,DEFAULT_SLOT_NAME as k,DslDefinitionHelper as U,DslSlotUtils as T,DslDefinitionType as F,UnknownDslDefinition as z}from"@oinone/kunlun-dsl";import{PropRecordHelper as L,StyleHelper as G}from"@oinone/kunlun-vue-ui-common";import{getMergeConfig as K}from"@oinone/kunlun-config";import{isDev as Q,useMatched as Z}from"@oinone/kunlun-router";import{ViewType as q,createViewElement as J}from"@oinone/kunlun-meta";import{InjectionToken as X,SPI as Y}from"@oinone/kunlun-spi";import{LifeCycleTypes as ee}from"@oinone/kunlun-event";class Widget{static createHandle(e=""){return`${e||"oio-widget"}-${this.widgetCount++}`}static Attribute(e){return(t,i,n)=>{const o=t.constructor,r=this.attributeMap.get(o)||new Map;r.set(e&&e.displayName||i,i),this.attributeMap.set(o,r),n&&n.get&&(t[`$compute$${i}`]={get:n.get,set:n.set});const s=o.prototype.$$props||[];e&&!1===e.render||s.push(e&&e.displayName||i),t.$$props=s}}static Watch(e,t){return(i,n,o)=>{const r=i.constructor,s=Widget.watchMap.get(r)||[];s.push({path:e,handler:o.value,options:t}),Widget.watchMap.set(r,s)}}static Sub(e,t,i,n){return(o,r)=>{const s=this.nameContextMap.get(e);if(s)s&&!s.paramName_NameMap.get(r)&&s.paramName_NameMap.set(r,e);else{const o=new t(i),s=new Map;s.set(r,e),this.nameContextMap.set(e,{paramName_NameMap:s,subject:o,value:i,option:n})}const d=o.constructor.prototype.$$subNames||[];d.includes(r)||d.push(r),o.$$subNames=d}}static BehaviorSubContext(e,t,i){return Widget.Sub(e,r,t,i)}static SubContext(e,t,i){return Widget.Sub(e,s,t,i)}static Reactive(e){return Widget.Attribute(e)}static Method(e){return Widget.Attribute(e?{displayName:e}:void 0)}static select(e){return Widget.widgetMap.get(e)}static Inject(e){return(t,i)=>{let n=Reflect.get(t,"injection")||{name:this,list:new Map};if(n.name!==t.constructor){const e=n;n={name:t.constructor,list:new Map},e.list.forEach((e,t)=>n.list.set(t,e)),Reflect.set(t,"injection",n)}n.list.get(e||i)||n.list.set(e||i,i)}}static Provide(e){return(t,i)=>{let n=Reflect.get(t,"provider")||{name:this,list:new Map};if(n.name!==t.constructor){const e=n;n={name:t.constructor,list:new Map},e.list.forEach((e,t)=>n.list.set(t,e)),Reflect.set(t,"provider",n)}n.list.get(e||i)||n.list.set(e||i,i)}}constructor(e){this.subscriptionMap=new Map,this.childrenInstance=[],this.children=[],this.childrenWidget=[],this.config={},this.initialized=!1,this.parent=null,this.childrenInstance=[],this.handle=e||Widget.createHandle(this.constructor.name),this.name="default",this.self=this}getSelf(){return this.self}getOperator(){return this}initialize(e={}){if(this.initialized)throw new Error(`error: reInitializeWidget:${this.getWidgetType()}:${this.getHandle()}`);const t={},i=(Reflect.get(this,"injection")||{list:new Map}).list,n=this.getAttributes();if(i&&i.forEach((e,i)=>{if(void 0!==this.getShared(i).host){Reflect.set(t,e,{get:()=>this.getShared(i).value,configurable:!0});let o="";n.forEach((t,i)=>t===e?o=i:""),""!==o&&Reflect.set(this,`$compute$${e}`,{get:()=>this.getShared(i).value})}}),Object.defineProperties(this,t),this.initialized=!0,this.config=e,Widget.widgetMap.set(this.getHandle(),this),this.$$innerWidgetType){const e=this.getParentWidget();e&&e.$$innerWidgetType&&e.childrenWidget.push(this)}return this.startSubscription(),this}startSubscription(){var e,t;if(null===(e=this.$$subNames)||void 0===e?void 0:e.length)for(const[,e]of Widget.nameContextMap)for(const[i]of e.paramName_NameMap)(null===(t=this.$$subNames)||void 0===t?void 0:t.includes(i))&&(this[i]=this.createWidgetSubjection(e))}wrapSubjectWithScope(e,t){if(!t)return e;const i=e.next,n=this;e.next=function(t){i.call(e,t.__publisherWidget?t:{payload:t,__publisherWidget:n})};const o=e;if(o.getValue){const e=o.getValue;o.getValue=function(){const t=e.call(o);return t.__publisherWidget?t.payload:t}}return e}createWidgetSubjection(e){const{subject:t,option:i}=e;return{subscribe:e=>{const n=t.subscribe(t=>{(null==i?void 0:i.scope)&&(null==t?void 0:t.__publisherWidget)?this.isSameScopeWidget(t.__publisherWidget,null==i?void 0:i.scope)&&e(t.payload):e((null==i?void 0:i.scope)&&(null==t?void 0:t.__publisherWidget)?t.payload:t)});return this.subscriptionMap.set(Symbol("random"),n),n},subject:this.wrapSubjectWithScope(t,null==i?void 0:i.scope)}}isSameScopeWidget(e,t){const i=this.getParentWidgetByType(t),n=e.getParentWidgetByType(t);return i===n&&null!==i||this.getHandle()===(null==n?void 0:n.getHandle())}dispose(e=!1){var t,i;this.releaseInjection();const n=null===(t=this.parent)||void 0===t?void 0:t.children;if(n){const e=n.findIndex(e=>e.getHandle()===this.getHandle());-1!==e&&(n.splice(e,1),null===(i=this.parent)||void 0===i||i.childrenInstance.splice(e,1))}for(;this.children.length;)this.children[0].dispose(e);Widget.widgetMap.delete(this.getHandle()),this.subscriptionMap.forEach(e=>{e.unsubscribe()}),this.subscriptionMap.clear(),this.self=null,this.childrenInstance=[],this.children=[],this.childrenWidget=[],this.parent=null,e&&(this.$$props=void 0)}createWidget(t,i,n,o){const r=e(t);r.parent=this;const s=r.initialize(n),d=s&&s.getOperator();return void 0!==o&&o>=0?this.children[o]=d:this.children.push(d),i&&(r.name=i),d}getHandle(){return this.handle}deleteWidget(e){const{length:t}=this.children;return this.children.forEach((t,i)=>{t.getHandle()===e&&t.dispose()}),this.children.length!==t}moveChildWidget(e,t){this.parent&&(this.children[e]=this.children.splice(t,1,this.children[e])[0],this.childrenInstance[e]=this.childrenInstance.splice(t,1,this.childrenInstance[e])[0])}insertWidget(e,t){this.parent&&(this.children.splice(t,0,e),this.childrenInstance.splice(t,0,e))}deleteWidgetByIndex(e,t){const{length:i}=this.children,n=t||this.children[e].getHandle();return this.children.forEach((t,i)=>{t.getHandle()===n&&i===e&&t.dispose()}),this.children.length!==i}getConfig(e){return this.config[e]}getAllConfig(){return this.config}getSibling(){if(!this.$$innerWidgetType)return null;const e=this.getParentWidget();return e?e.getChildrenWidget():null}previousWidgetSibling(){const e=this.getSibling();if(!e)return null;const t=e.findIndex(e=>e.getHandle()===this.getHandle());return t>0?e[t-1]:null}nextWidgetSibling(){const e=this.getSibling();if(!e)return null;const t=e.findIndex(e=>e.getHandle()===this.getHandle());return t>=0&&t<e.length-1?e[t+1]:null}getParentWidget(){if(this.$$innerWidgetType){let e=this.parent;if(!e)return null;for(;e;){if(e.$$innerWidgetType)return e;e=e.parent}}return this.parent}getParentWidgetByType(e){let t=this.parent;for(;t;){if(t.$$innerWidgetType===e)return t;t=t.parent}return null}getChildrenWidget(){return this.childrenWidget.length?this.childrenWidget:this.getChildrenInstance()}getParent(){return this.parent}getName(){return this.name}getWidgetType(){return this.constructor.name}static getProtoChains(e){let t=Widget.protoChainsCache.get(e);if(t)return t;t=[];let i=e;for(;""!==i.name;)t.push(i),i=Object.getPrototypeOf(i);return Widget.protoChainsCache.set(e,t),t}getAttributes(){if(this.currentAttributeMapCache)return this.currentAttributeMapCache;const e=Widget.getProtoChains(this.constructor),t=new Map;return e.forEach(e=>{const i=Widget.attributeMap.get(e);i&&i.forEach((e,i)=>{t.set(i,e)})}),this.currentAttributeMapCache=t}getWatchers(){const e=[];return Widget.getProtoChains(this.constructor).forEach(t=>{const i=Widget.watchMap.get(t);i&&i.forEach(t=>e.push(t))}),e}getChildren(){return this.children}getChildrenInstance(){return this.childrenInstance}addChildrenInstance(e){this.childrenInstance.push(e)}getShared(e){let t=this.getParent(),i="";for(;t;){const n=(Reflect.get(t,"provider")||{list:new Map}).list;if(n&&n.get(e)){i=n.get(e);break}t=t.getParent()}if(t){let e=Reflect.get(t,i);return"function"==typeof e&&(e=e.bind(t)),{host:t,value:e}}return{}}releaseInjection(){const e=Reflect.get(this,"injection");e&&(e.list.forEach(e=>{const t=this.getSelf();t&&Reflect.deleteProperty(t,e)}),Reflect.set(this,"injection",null))}getComputeHandler(e){return Reflect.get(this,`$compute$${e}`)}getProps(){return this.$$props||[]}}function te(e,t,i,n){var o,r=arguments.length,s=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var d=e.length-1;d>=0;d--)(o=e[d])&&(s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s}function ie(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function ne(e,t,i,n){return new(i||(i=Promise))(function(o,r){function s(e){try{a(n.next(e))}catch(e){r(e)}}function d(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,d)}a((n=n.apply(e,t||[])).next())})}Widget.widgetCount=0,Widget.widgetMap=new Map,Widget.attributeMap=new Map,Widget.protoChainsCache=new WeakMap,Widget.watchMap=new Map,Widget.nameContextMap=new Map,"function"==typeof SuppressedError&&SuppressedError;var oe,re=g({name:"VueFragment",inheritAttrs:!1,render(){var e,t;return v(f,void 0,(null===(t=(e=this.$slots).default)||void 0===t?void 0:t.call(e))||[])}});re.__file="src/basic/VueFragment.vue",function(e){e.beforeCreated="beforeCreated",e.created="created",e.beforeMount="beforeMount",e.mounted="mounted",e.beforeUpdate="beforeUpdate",e.updated="updated",e.activated="activated",e.deactivated="deactivated",e.beforeUnmount="beforeUnmount",e.unmounted="unmounted"}(oe||(oe={}));class VueWidget extends Widget{constructor(){super(...arguments),this.behaviorGroup={},this.node_code=this.revolveNodeCode()}revolveNodeCode(){return t()}setup(e){return(t,i)=>{this.__scope&&(this.__scope.stop(),this.__scope=null),this.__scope=y();let n={};return this.__scope.run(()=>{const{opt:o}=this;this.getAttributes().forEach((e,t)=>{const i=this.getComputeHandler(t);if(i)i.get&&(i.set?Reflect.set(n,t,m({get:i.get.bind(o),set:i.set.bind(o)})):Reflect.set(n,t,m(i.get.bind(o))));else{const i=Reflect.get(this,e);"function"==typeof i?Reflect.set(n,t,i.bind(o)):Reflect.set(n,t,W(i))}});this.getWatchers().forEach(e=>{const t=e.path.split("."),i=n[t[0]];i&&(1===t.length?b(i,e.handler.bind(o),e.options):b(()=>{let e=i.value||{};for(let i=1;i<t.length&&(e=e[t[i]],e);i++);return e},e.handler.bind(o),e.options))});const r=e&&e(t,i,n);r&&(n=Object.assign(Object.assign({},n),r)),this.res=n}),n}}static HookHost(){return(e,t)=>{const i=VueWidget.hookHosts.get(e.constructor)||[];i.push(t),VueWidget.hookHosts.set(e.constructor,i)}}static getHookHosts(e){const t=[];return(()=>{const t=[];let i=e.constructor,{name:n}=i;for(;""!==n;)n=i.name,t.push(i),i=Object.getPrototypeOf(i);return t})().forEach(e=>{const i=VueWidget.hookHosts.get(e);i&&i.forEach(e=>t.push(e))}),t}static getHooks(e,t,i){const n=(e=>{const t=[];let i=e;for(;""!==i.name;)t.push(i.name),i=Object.getPrototypeOf(i);return t})(Widget.select(e).constructor),o=[];return n.forEach(e=>{let n;n="after"===i?VueWidget.afterHooks.get(e):VueWidget.beforeHooks.get(e);(n&&n.get(t)||[]).forEach(e=>o.push(e))}),o}static BeforeHook(e){return(t,i,n)=>{const o=VueWidget.beforeHooks.get(t.constructor.name)||new Map,r=o.get(e)||[];r.push(n.value),o.set(e,r),VueWidget.beforeHooks.set(t.constructor.name,o)}}static AfterHook(e){return(t,i,n)=>{const o=VueWidget.afterHooks.get(t.constructor.name)||new Map,r=o.get(e)||[];r.push(n.value),o.set(e,r),VueWidget.afterHooks.set(t.constructor.name,o)}}getNodeCode(){return this.node_code}getNodeCodeRef(){return this.res.node_code}getOperator(){const{opt:e}=this;return e||this}createWidget(e,t,i,n,o=!1){const r=this.getOperator(),s=super.createWidget.bind(r)(e,t,i||{},n);o&&(r.node_code=this.revolveNodeCode());const d=s&&s.getOperator();return void 0!==n&&n>=0?this.getChildrenInstance()[n]=s.getOperator():this.addChildrenInstance(d),d}deleteWidget(e){const t=super.deleteWidget(e);return this.getOperator().node_code=this.revolveNodeCode(),t}insertWidget(e,t){super.insertWidget(e,t);this.getOperator().node_code=this.revolveNodeCode()}moveChildWidget(e,t){super.moveChildWidget(e,t);this.getOperator().node_code=this.revolveNodeCode()}deleteWidgetByIndex(e,t){const i=super.deleteWidgetByIndex(e,t);return this.getOperator().node_code=this.revolveNodeCode(),i}initialize(e={}){return super.initialize(e),this.component=re,this.buildOperator(),this}buildOperator(){const e=new Proxy(this,{get:(e,t)=>{if("isProxy"===t)return!0;if("constructor"===t)return this.constructor;const i=this.res||{},n=Reflect.get(i,t);return n?R(n)?(n.value,n.value):n:Reflect.get(e,t)},set:(e,t,i)=>{const n=this.res||{},o=Reflect.get(n,t);return"function"==typeof o?Reflect.set(n,t,i):R(o)?(o.value=i,!0):Reflect.set(e,t,i)}});this.opt=e,this.initialize=this.initialize.bind(e);return VueWidget.getHookHosts(this).forEach(t=>{const i=Reflect.get(this,t);Reflect.set(this,t,(...n)=>{if("render"===t)return i.apply(e,n);const o=e.executeBeforeHooks(t,n),r=i.apply(e,o);return e.executeAfterHooks(t,r)})}),e}getWidgetComponent(e=!1){let t=this.widgetComponent;return!t&&e&&(t=this.buildWidgetComponent(),this.widgetComponent=t),t}setWidgetComponent(e){this.widgetComponent=e}renderExpandComponent(){}getMixinComponent(){return this.mixinComponent}setMixinComponent(e){e&&(e=Object.assign({inheritAttrs:!1},e)),this.mixinComponent=e}render(e,t){return this.widgetComponent||(this.widgetComponent=this.buildWidgetComponent()),this.widgetComponent?this.renderWidgetComponent(this.widgetComponent,e,t):[]}getWidgetComponentName(){const{name:e}=this.constructor;return e}buildWidgetComponent(){let e=this.getComponent();if(!e)return;e=D(e);const t=this.getOperator(),i=this.getUsingComponents();return g({name:this.getWidgetComponentName(),components:i,inheritAttrs:!1,setup:this.setup(this.setupHook.bind(this)),beforeMount:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.beforeMount])||void 0===i||i.call(e),this.$$beforeMount.call(t),this.beforeMount.call(t)},mounted:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.mounted])||void 0===i||i.call(e),this.$$mounted.call(t),this.mounted.call(t),this.$$mountedAfterProperties.call(t)},beforeUpdate:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.beforeUpdate])||void 0===i||i.call(e),this.$$beforeUpdate.call(t),this.beforeUpdate.call(t)},updated:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.updated])||void 0===i||i.call(e),this.$$updated.call(t),this.updated.call(t)},activated:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.activated])||void 0===i||i.call(e),this.$$activated.call(t),this.activated.call(t)},deactivated:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.deactivated])||void 0===i||i.call(e),this.$$deactivated.call(t),this.deactivated.call(t)},beforeUnmount:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.beforeUnmount])||void 0===i||i.call(e),this.$$beforeUnmount.call(t),this.beforeUnmount.call(t)},unmounted:()=>{var e,i;null===(i=(e=this.behaviorGroup)[oe.unmounted])||void 0===i||i.call(e),this.unmounted.call(t),this.$$unmounted.call(t),this.$$unmountedAfterProperties.call(t)},render:t=>{const i=this.buildProps(t),{$slots:n}=t,o=this.resolveProps(e,i),r=Object.assign(Object.assign({},this.resolveChildren()),n),s=this.renderExpandComponent(),d={};if(s){const e=r.default?r.default():[];d.default=()=>[...e,s]}return this.renderMixinComponent(v(e,o,Object.assign(Object.assign({},r),d)),i)}})}resolveProps(e,t){return t}renderMixinComponent(e,t){const i=this.getMixinComponent();if(i){const n=e,o=this.resolveProps(i,t);e=v(i,o,{default:()=>n})}return e}renderWidgetComponent(e,t,i){return v(e,{},i)}buildProps(e){const t={},i=this.getAttributes(),n=this.getProps();return i.forEach((i,o)=>{n.includes(i)&&Reflect.set(t,i,Reflect.get(e,o))}),t["data-handle"]=this.getHandle(),t}buildPropsStrs(){const e=this.getProps(),t=[];return e.forEach(e=>t.push(e)),t}resolveChildren(){const e={},t=this.getChildren();for(const i of t){const t=i.getName();let n=e[t];n||(n=[],e[t]=n),n.push(i)}const i={};for(const[t,n]of Object.entries(e))i[t]=S(e=>{const t=[];for(const i of n){const n=i.render(e);Array.isArray(n)?t.push(...n):t.push(n)}return t});return i}setupHook(e,t,i){var n,o,r,s;return null===(o=(n=this.behaviorGroup)[oe.beforeCreated])||void 0===o||o.call(n),this.$$beforeCreated(),this.beforeCreated(),null===(s=(r=this.behaviorGroup)[oe.created])||void 0===s||s.call(r),this.$$created(),this.created(),{}}setComponent(e){this.component=Object.assign({inheritAttrs:!1},e)}dispose(e=!1){super.dispose(e),this.opt=void 0;const t=null;this.__scope&&(this.__scope.stop(),this.__scope=t),this.component=t,this.mixinComponent=t,this.widgetComponent=t,e&&C(()=>{this.res={},this.__proto__=null})}getComponent(){const{name:e,__render__:t,__name__:i}=this.constructor;return t&&(this.component=g({name:i||e,props:this.buildPropsStrs(),render:t,components:this.getUsingComponents()})),this.component}getUsingComponents(){return{}}executeAfterHooks(e,t){const i=VueWidget.getHooks(this.getHandle(),e,"after");let n=0;const o={result:t},r=()=>{n<i.length&&i[n++].apply(this,[r,o])};return r(),o.result}executeBeforeHooks(e,...t){const i=VueWidget.getHooks(this.getHandle(),e,"before");let n=0;const o={args:t},r=()=>{n<i.length&&i[n++].apply(this,[r,o])};return r(),o.args}beforeCreated(){}$$beforeCreated(){}created(){}$$created(){}beforeMount(){}$$beforeMount(){}mounted(){}$$mounted(){}$$mountedAfterProperties(){}beforeUpdate(){}$$beforeUpdate(){}updated(){}$$updated(){}activated(){}$$activated(){}deactivated(){}$$deactivated(){}beforeUnmount(){}$$beforeUnmount(){}unmounted(){}$$unmounted(){}$$unmountedAfterProperties(){this.dispose()}registryBehavior(e,t){this.behaviorGroup[e]=t}reset(){this.widgetComponent=void 0,this.getParent().node_code=this.revolveNodeCode()}translate(e,t={}){const i=Reflect.get(window,"translate"),n=i?i(e):"";if(n===e||0===Object.keys(t).length)return n;return n.replace(/\{\s*([A-Z0-9_]+)\s*\}/gi,(e,i)=>t[i])}translateByI18n(e){return d(e)||e}genStaticPath(e){return a(e)}forceUpdate(){const e=this.getOperator();e&&(e.node_code=this.revolveNodeCode())}}VueWidget.beforeHooks=new Map,VueWidget.afterHooks=new Map,VueWidget.hookHosts=new Map,te([Widget.Reactive(),ie("design:type",String)],VueWidget.prototype,"node_code",void 0),te([VueWidget.HookHost(),ie("design:type",Function),ie("design:paramtypes",[Object,Object]),ie("design:returntype",Object)],VueWidget.prototype,"render",null),te([Widget.Reactive(),ie("design:type",Function),ie("design:paramtypes",[Object,Object]),ie("design:returntype",String)],VueWidget.prototype,"translate",null),te([Widget.Reactive(),ie("design:type",Function),ie("design:paramtypes",[String]),ie("design:returntype",String)],VueWidget.prototype,"translateByI18n",null),te([Widget.Method(),ie("design:type",Function),ie("design:paramtypes",[String]),ie("design:returntype",void 0)],VueWidget.prototype,"genStaticPath",null);class AsyncVueWidget extends VueWidget{setup(e){const t=super.setup();return(i,n)=>ne(this,void 0,void 0,function*(){const o=t(i,n),r=e&&(yield e(i,n))||{};for(const e in r)Reflect.set(o,e,Reflect.get(r,e));return o})}render(e){return w("div",w(A,super.render(e)))}setupHook(e,t,i){return ne(this,void 0,void 0,function*(){return yield this.beforeCreated(),yield this.created(),{}})}}class DslNodeWidget extends VueWidget{get widgetPath(){let e=this.parentPath||"";const{subPath:t,subIndex:i}=this;return t&&(e=e?`${e}.${t}`:t),null!=i&&(e=`${e}[${i}]`),e}get variables(){return B.resolveVariables(this.getDsl())}initialize(e){var t;super.initialize(e),this.dslNode=e.dslNode,this.metadataHandle=e.metadataHandle,this.rootHandle=e.rootHandle,this.template=e.template,this.slotName=e.slotName,this.widgetInline=e.widgetInline,this.currentHandle=this.getHandle();const{subPath:i,subIndex:n}=e;return this.subPath=i||(null===(t=this.template)||void 0===t?void 0:t.dslNodeType)||"",I(n)?this.subIndex=e.__index:this.subIndex=n,this}getDsl(){return this.dslNode||{}}getSlotName(){return this.slotName}getDslChildrenByLabel(e){return this.dslNode?(this.dslNode.children||[]).find(t=>t.tagName===e.toUpperCase()):null}get metadataRuntimeContext(){const{metadataHandle:e}=this;if(e)return c.get(e)}get rootRuntimeContext(){const{rootHandle:e}=this;if(e)return c.get(e)}}function se(e){const t=null==e?void 0:e.invisible;return!I(t)&&(H(t)?t:t())}function de(e){return!e||!e.length||e.every(e=>se(e))}te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"metadataHandle",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"rootHandle",void 0),te([Widget.Reactive(),ie("design:type",String)],DslNodeWidget.prototype,"currentHandle",void 0),te([Widget.Reactive({render:!1}),ie("design:type",Object)],DslNodeWidget.prototype,"dslNode",void 0),te([Widget.Reactive({render:!1}),ie("design:type",Object)],DslNodeWidget.prototype,"template",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"slotName",void 0),te([Widget.Reactive(),Widget.Inject("path"),ie("design:type",Object)],DslNodeWidget.prototype,"parentPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"subPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"subIndex",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[])],DslNodeWidget.prototype,"widgetPath",null),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"widgetInline",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslNodeWidget.prototype,"variables",null);const ae="oinone",ce="__slots",le="__render__options",ue="slotContext",pe=["div","a","span","table","form","detail","ul","li","h1","h2","h3","h4","h5","h6","p","thead","tbody","tr","th","td"];function he(e,t,i){let n=e[t];if(delete e[t],!n&&i){n=i;const{dslDefinition:o}=e;o&&(o[t]=i)}return n}class DslRender{static render(e,t=k,i,n){const o=DslRender.fetchComponent(e);if(o)return DslRender.createVNodeWithDslDefinition(o,e,t,i,n)}static renderSlots(e){const t={};for(const i in e)t[i]=S(t=>{var n;return DslRender.createVNodeChildren(null===(n=e[i])||void 0===n?void 0:n.widgets,i,t)});return t}static fetchVNodeSlots(e,t){var i;if(!e)return;const n=e[ce];if(n)return n;if(!t){const n=[k];null===(i=e.widgets)||void 0===i||i.forEach(e=>{if(U.isTemplate(e)){let t=e.slot;t||(t=k),n.push(t)}}),t=[...new Set(n)]}const o=T.fetchSlotsBySlotNames(e,t);return DslRender.renderSlots(o)}static fetchComponent(e){let t,{dslNodeType:i}=e||{};switch(i||(i=F.ELEMENT),i){case F.VIEW:t=$(`${ae}-${e.dslNodeType}`);break;case F.PACK:{const i=e;t=DslRender.resolveWidgetComponent(`${i.widget||"group"}`),"string"==typeof t&&(t=DslRender.resolveWidgetComponent(`${e.dslNodeType}`));break}case F.ELEMENT:{const i=e;t=DslRender.resolveWidgetComponent(`${i.widget}`),"string"==typeof t&&(t=DslRender.resolveWidgetComponent(`${e.dslNodeType}`));break}case F.ACTION:case F.FIELD:t=DslRender.resolveWidgetComponent(`${e.dslNodeType}`);break;case F.UNKNOWN:case F.SLOT:case F.TEMPLATE:t=null;break;default:t=DslRender.resolveCommonWidgetComponent(i)}return t}static createVNodeChildren(e,t,i,n){const o=[];if(!e)return o;t||(t=k),I(n)&&(n=0);const{length:r}=e;for(let s=0;s<r;s++){const r=e[s],d=DslRender.fetchComponent(r);if(d)o.push(DslRender.createVNodeWithDslDefinition(d,r,t,_(d)?DslRender.fetchVNodeSlots(r):void 0,i?{slotContext:i}:void 0,s+n));else if(null===d){const{dslNodeType:e}=r;switch(e){case F.SLOT:{const e=DslRender.createVNodeChildren(r.widgets,t,i,s+n);n+=e.length,e.forEach(e=>o.push(e));break}case F.UNKNOWN:case F.TEMPLATE:continue;default:console.error("Invalid component.")}}}return o}static createVNodeWithDslDefinition(e,i,n,o,r,s){var d;I(s)||i.__index===s||(i.__index=s);const a=_(e),c=a?L.collectionBasicProps(i):Object.assign(Object.assign({},i),{dslDefinition:Object.assign({},i),slotName:n});let l;l=a&&i.__content||he(c,ce,o);const u=he(c,le,r),p=null==u?void 0:u.slotContext;if(p){const e=null==r?void 0:r.slotContext;e&&(u.slotContext=e),c.slotContext=p}if(DslRenderHelper.predictIsUpdateKey(i,u)){const e=t();i.key=e,c.key=e}DslRenderHelper.predictIsRecursion(u)&&!l&&(null===(d=i.widgets)||void 0===d?void 0:d.length)&&(l=DslRender.fetchVNodeSlots(i));let h=null==u?void 0:u.dynamicProps;return p&&(h=E(h||[],[ue])),v(e,c,l,null==u?void 0:u.patchFlag,h,null==u?void 0:u.isBlockNode)}static resolveCommonWidgetComponent(e){let t=DslRender.resolveCommonComponentCache[e];return t||(pe.includes(e)?e:(t=$(`${ae}-${i.camelCaseToKebabCase(e)}`),"string"==typeof t&&(t=$(e)),DslRender.resolveCommonComponentCache[e]=t,t))}static resolveWidgetComponent(e){let t=DslRender.resolveComponentCache[e];if(t)return t;if(pe.includes(e))return e;if(t=$(e),"string"==typeof t)for(const i of DslRender.resolveMethods){const n=i(e);if(n){const e=$(n);if("string"!=typeof e){t=e;break}}}return DslRender.resolveComponentCache[e]=t,t}}DslRender.resolveComponentCache={},DslRender.resolveCommonComponentCache={},DslRender.resolveMethods=[e=>{if(-1===e.indexOf("-")){const t=e.charCodeAt(0);if(t>=i.UPPER_A_ASCLL&&t<=i.UPPER_Z_ASCLL)return`${e[0].toLowerCase()}${e.substring(1)}`}},e=>{if(-1===e.indexOf("-")){const t=e.charCodeAt(0);if(t>=i.LOWER_A_ASCLL&&t<=i.LOWER_Z_ASCLL)return`${e[0].toUpperCase()}${e.substring(1)}`}},e=>i.camelCaseToKebabCase(e)];class DslRenderHelper{static predictIsUpdateKey(e,t){const i=(null==t?void 0:t.dynamicKey)||!1,n=(null==t?void 0:t.focusUpdate)||!1;if(e.key){if(n)return!0}else if(i)return!0;return!1}static predictIsRecursion(e){return(null==e?void 0:e.recursion)||!1}}function ge(e,t){t||(t=e.name);const i=c.createOrReplace().frameworkInstance;t?"string"==typeof t?i.component(t,e):t.forEach(t=>i.component(t,e)):Q()&&console.warn("component install error. reason: name is blank.",e)}function ve(e,t){c.createOrReplace().frameworkInstance.directive(t,e)}function fe(e,...t){c.createOrReplace().frameworkInstance.use(e,...t)}function ye(e,t,i){let n;const{length:o}=e;for(let r=o-1;r>=0;r--){const o=e[r];if(n){const e=Array.isArray(n)?n:[n];n=o.render(t,{default:()=>e})}else n=o.render(t,i)}return n}function me(){return new VueWidget}function We(e){return n.cast(Widget.select(e))}function be(e){return We(e)||me()}class DslRenderWidget extends VueWidget{constructor(){super(...arguments),this.internal=!1}initialize(e){return super.initialize(e),this.renderProps=e,this.internal=e.internal||!1,this.template=e.template,this.slotName=e.slotName,this.supportedSlotNames=e.slotNames||[],this.template&&this.supportedSlotNames.length&&(this.dslSlots=T.fetchSlotsBySlotNames(this.template,this.supportedSlotNames)),this}getDsl(){return this.template||z}getMergeConfig(...e){if(this.cacheConfigProxy)return this.cacheConfigProxy;const t=K(e,{defaultValue:void 0});return this.cacheConfigProxy=new Proxy(this.getDsl(),{get:(e,i)=>i in e?e[i]:t[i]}),this.cacheConfigProxy}getSlotName(){return this.slotName}render(e,t){return this.template&&(void 0===this.slots&&(this.internal?this.slots=this.internalRender(t)||null:this.slots=this.commonRender(t)||null),this.slots)?this.rawRender(e,this.slots):this.rawRender(e,t)}rawRender(e,t){return super.render(e,t)}internalRender(e){return e&&Object.keys(e).length?e:this.dslSlots&&Object.keys(this.dslSlots).length?DslRender.renderSlots(this.dslSlots):void 0}commonRender(e){return this.dslSlots&&Object.keys(this.dslSlots).length?DslRender.renderSlots(this.dslSlots):e&&Object.keys(e).length?e:void 0}}te([Widget.Reactive(),ie("design:type",Object)],DslRenderWidget.prototype,"internal",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslRenderWidget.prototype,"template",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslRenderWidget.prototype,"slotName",void 0);class DslDefinitionWidget extends DslRenderWidget{getMetadataHandle(){return this.metadataHandle}get class(){return this.getDsl().class}get style(){return G.convertStyleByDslDefinition(this.getDsl())}getRootHandle(){return this.rootHandle}getCurrentHandle(){return this.currentHandle}get allInvisible(){const{allInvisible:e}=this.getDsl();return I(e)?this.defaultAllInvisible:o.toBoolean(e)}get invisible(){let{invisible:e}=this.getDsl();return e=!I(e)&&this.invisibleProcess(e),e||!!this.allInvisible&&(this.invisibleState=this.childrenInvisibleProcess(),this.invisibleState)}get parentInvisibleProvider(){return this.parentInvisible||this.invisible}constructor(e){super(e),this.automatic=!1,this.defaultAllInvisible=!1,this.invisibleState=!1,this.currentHandle=this.getHandle()}initialize(e){return super.initialize(e),this.metadataHandle=e.metadataHandle,this.rootHandle=e.rootHandle,this.automatic=e.automatic||!1,this.inline=e.inline,this}get metadataRuntimeContext(){const e=this.metadataRuntimeContextNullable;if(!e)throw new Error("Invalid metadata runtime context.");return e}get metadataRuntimeContextNullable(){const{metadataHandle:e}=this;let t;return e&&(t=c.get(e)),t}get rootRuntimeContext(){const e=this.rootRuntimeContextNullable;if(!e)throw new Error("Invalid root runtime context.");return e}get rootRuntimeContextNullable(){const{rootHandle:e}=this;let t;return e&&(t=c.get(e)),t}get rootComputeContext(){const{rootHandle:e}=this;let t;return e&&(t=l.get(e)),t}get rootViewRuntimeContext(){var e,t,i;const n=[];let o=this.rootRuntimeContext,r=null===(e=null==o?void 0:o.parentContext)||void 0===e?void 0:e.field;for(;r&&o;){n.push(r);const e=null===(t=null==o?void 0:o.parentContext)||void 0===t?void 0:t.handle;if(!e)throw new Error("Invalid field runtime context handle");const s=null===(i=Widget.select(e))||void 0===i?void 0:i.rootRuntimeContext,d=null==s?void 0:s.parentContext;if(!d||d.handle===u)break;r=d.field,o=s}if(!o)throw new Error("Invalid target runtime context.");return{runtimeContext:o,fields:n}}invisibleProcess(e){return o.toBoolean(e)}childrenInvisibleProcess(){return de(this.getChildren())}resetInvisible(){this.allInvisible&&(this.invisibleState=this.childrenInvisibleProcess())}resetParentInvisible(){var e,t;null===(t=null===(e=this.getParent())||void 0===e?void 0:e.resetInvisible)||void 0===t||t.call(e)}$$mounted(){super.$$mounted(),this.resetInvisible(),this.lastedInvisibleState=this.invisible}$$updated(){super.$$updated();const{lastedInvisibleState:e,invisible:t}=this;this.lastedInvisibleState=t,e!==t&&this.resetParentInvisible()}$$unmountedAfterProperties(){super.$$unmountedAfterProperties(),this.automatic||this.metadataHandle!==this.rootHandle||c.delete(this.metadataHandle)}allMounted(){this.resetInvisible()}}te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"automatic",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"metadataHandle",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"class",null),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"style",null),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"rootHandle",void 0),te([Widget.Reactive(),ie("design:type",String)],DslDefinitionWidget.prototype,"currentHandle",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"inline",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"allInvisible",null),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"invisibleState",void 0),te([Widget.Reactive(),Widget.Inject(),ie("design:type",Object)],DslDefinitionWidget.prototype,"parentInvisible",void 0),te([Widget.Reactive(),ie("design:type",Boolean),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"invisible",null),te([Widget.Reactive(),Widget.Provide("parentInvisible"),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"parentInvisibleProvider",null),te([Widget.Method(),ie("design:type",Function),ie("design:paramtypes",[]),ie("design:returntype",void 0)],DslDefinitionWidget.prototype,"allMounted",null);class PathWidget extends DslDefinitionWidget{get path(){const{parentPath:e,subPath:t,subIndex:i,currentPath:n}=this;if(I(n)){let n=e||"";return this.internal||t&&(n=n?`${n}.${t}`:t,null!=i&&(n=`${n}[${i}]`)),n}return n}initialize(e){var t;super.initialize(e);const{subPath:i,subIndex:n,path:o}=e;return this.currentPath=o,this.subPath=i||(null===(t=this.template)||void 0===t?void 0:t.dslNodeType)||"",I(n)?this.subIndex=e.__index:this.subIndex=n,this}}function Re(e){return e.viewType===q.Table}function De(e){return e.viewType===q.Search}function Se(e){return e.viewType===q.Form}function Ce(e){return e.viewType===q.Detail}function we(e){return e.viewType===q.Gallery}function Ae(e){return e.viewType===q.Tree}function $e(e){return e.viewType===q.Table||e.viewType===q.Gallery}function Oe(e){return e.viewType===q.Form||e.viewType===q.Detail||e.viewType===q.Search}function Me(e){const{viewType:t}=e;return!!t&&(t===q.Table||t===q.Form||t===q.Detail)}function je(e){const{viewType:t}=e;return!!t&&t!==q.Search}function Pe(e){const{viewType:t}=e;return!!t&&(t===q.Table||t===q.Gallery)}te([Widget.Reactive(),Widget.Inject("path"),ie("design:type",Object)],PathWidget.prototype,"parentPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],PathWidget.prototype,"subPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],PathWidget.prototype,"subIndex",void 0),te([Widget.Reactive(),ie("design:type",Object)],PathWidget.prototype,"currentPath",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[])],PathWidget.prototype,"path",null);const Ne={viewType:m(()=>q.Form),model:m(()=>""),modelName:m(()=>""),module:m(()=>""),moduleName:m(()=>""),metadataHandle:m(()=>""),rootHandle:m(()=>""),parentHandle:m(()=>""),slotName:m(()=>{}),inline:m(()=>!1)},Ve=Symbol("MetaContext"),Ie=e=>{M(Ve,Object.assign(Object.assign({},Ne),e))},He=()=>O(Ve,Ne);function _e(e,t){var i;if(null==t){if(Me(e))return e}else if(we(e))return null===(i=e.cards)||void 0===i?void 0:i[t]}const Ee={},xe={pushField:function(e,t){const i=_e(this,t);if(!i)return;const{fields:n,fieldWidgets:o}=i;n&&(n.some(t=>t===e)||(n.push(e),i.fields=[...n]))},popField:function(e,t){const i=_e(this,t);if(!i)return;const{fields:n}=i;if(!n)return;const o=n.findIndex(t=>t===e);-1!==o&&(n.splice(o,1),i.fields=[...n])},createActionBarState:function(e){const t=Object.assign({actions:[],visibleActions:[]},e);return Object.defineProperty(t,"visibleActions",{get(){return this.actions.filter(e=>{const t=Widget.select(e);return!!t&&!se(t)})}}),j(t)},getActionBarState:function(e){var t;if(null==e){const e=this.__position[this.__position.length-1];if(null==e)return console.warn("Please call getActionBarState method in the vue lifecycle."),this.actionBar;const{slotName:t}=e;if(t&&t!==k){if(je(this))return this.actionBars[t]}else if(je(this))return this.actionBar}else if(Pe(this))return null===(t=this.inlineActionBars)||void 0===t?void 0:t[e]},pushAction:function(e,t){const i=this.getActionBarState(t);if(!i)return;const{actions:n}=i;n&&(n.some(t=>t===e)||(n.push(e),i.actions=[...n]))},popAction:function(e,t){const i=this.getActionBarState(t);if(!i)return;const{actions:n}=i;if(!n)return;const o=n.findIndex(t=>t===e);-1!==o&&(n.splice(o,1),i.actions=[...n])}};function Be(e){const t={get handle(){return e},fullscreen:!1,__position:[]},i=j(t);for(const[e,n]of Object.entries(xe))t[e]=n.bind(i);return i}function ke(e){var t;if(e||(e=null===(t=He())||void 0===t?void 0:t.rootHandle.value))return Ee[e];console.warn("Invalid root handle.")}function Ue(e){var t;if(!e&&!(e=null===(t=He())||void 0===t?void 0:t.rootHandle.value))return void console.warn("Invalid root handle.");const i=Ee[e];return delete Ee[e],i}const Te={getMainViewState:function(){return ke(this.mainViewHandle)}};const Fe=function(){const e={fullscreen:!1},t=j(e);for(const[i,n]of Object.entries(Te))e[i]=n.bind(t);return t}();function ze(e){return e?{globalState:Fe,viewState:ke(e),createViewState:()=>{const t=Be(e);return function(e){Ee[e.handle]=e}(t),t},getViewState:()=>ke(e),clearViewState:()=>Ue(e)}:{globalState:Fe,viewState:ke(),createViewState:Be,getViewState:ke,clearViewState:Ue}}class ActiveRecordsWidget extends PathWidget{getViewState(){return this.viewState}setViewState(e){this.viewState=e}initialize(e){super.initialize(e);const{dataSource:t,activeRecords:i}=e;return this.setCurrentDataSource(t),this.setCurrentActiveRecords(i),this}get submitCache(){var e;return null===(e=this.metadataRuntimeContext.field)||void 0===e?void 0:e.submitCache}get rootData(){return this.currentRootData||this.parentRootData}set rootData(e){this.currentRootData=e}getCurrentRootData(){return this.currentRootData}setCurrentRootData(e){this.currentRootData=p.repairRecordsNullable(e)}reloadRootData(e){this.parentReloadRootData&&void 0===this.currentRootData?this.parentReloadRootData(e):this.setCurrentRootData(e)}get dataSource(){return this.currentDataSource||this.parentDataSource}set dataSource(e){this.currentDataSource=e}getCurrentDataSource(){return this.currentDataSource}setCurrentDataSource(e){this.currentDataSource=p.repairRecordsNullable(e),this.parentRootData||(this.currentRootData=this.currentDataSource||void 0)}reloadDataSource(e){this.parentReloadDataSource&&void 0===this.getCurrentDataSource()?this.parentReloadDataSource(e):this.setCurrentDataSource(e)}pushDataSource(e,t,i){if(this.parentPushDataSource&&void 0===this.getCurrentDataSource())this.parentPushDataSource(e,t);else{let n=t;const{submitCache:o}=this;o&&!n&&(n=p.defaultPushPredict.bind(o));const r=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).push(e,n,i).get();o||this.setCurrentDataSource(r)}}updateDataSource(e){if(this.parentUpdateDataSource&&void 0===this.getCurrentDataSource())this.parentUpdateDataSource(e);else{const t=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).update(e).get();this.submitCache||this.setCurrentDataSource(t)}}updateDataSourceByEntity(e,t){if(this.parentUpdateDataSourceByEntity&&void 0===this.getCurrentDataSource())this.parentUpdateDataSourceByEntity(e,t);else{const i=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).updateByEntity(e,t).get();this.submitCache||this.setCurrentDataSource(i)}}deleteDataSource(e){if(this.parentDeleteDataSource&&void 0===this.getCurrentDataSource())this.parentDeleteDataSource(e);else{const t=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).delete(e).get();this.submitCache||this.setCurrentDataSource(t)}}deleteDataSourceByEntity(e,t){if(this.parentDeleteDataSourceByEntity&&void 0===this.getCurrentDataSource())this.parentDeleteDataSourceByEntity(e,t);else{const i=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).deleteByEntity(e,t).get();this.submitCache||this.setCurrentDataSource(i)}}flushDataSource(){var e;null===(e=this.parentFlushDataSource)||void 0===e||e.call(this)}get activeRecords(){return this.currentActiveRecords||this.parentActiveRecords}set activeRecords(e){this.currentActiveRecords=e}getCurrentActiveRecords(){return this.currentActiveRecords}setCurrentActiveRecords(e){e!==this.currentActiveRecords&&(this.currentActiveRecords=p.repairRecordsNullable(e))}reloadActiveRecords(e){this.parentReloadActiveRecords&&void 0===this.getCurrentDataSource()?this.parentReloadActiveRecords(e):this.setCurrentActiveRecords(e)}pushActiveRecords(e,t){this.parentPushActiveRecords&&void 0===this.getCurrentDataSource()?this.parentPushActiveRecords(e,t):this.currentActiveRecords=p.operator(this.currentActiveRecords).push(e,t).get()}updateActiveRecords(e){this.parentUpdateActiveRecords&&void 0===this.getCurrentDataSource()?this.parentUpdateActiveRecords(e):this.currentActiveRecords=p.operator(this.currentActiveRecords).update(e).get()}updateActiveRecordsByEntity(e,t){this.parentUpdateActiveRecordsByEntity&&void 0===this.getCurrentDataSource()?this.parentUpdateActiveRecordsByEntity(e,t):this.currentActiveRecords=p.operator(this.currentActiveRecords).updateByEntity(e,t).get()}deleteActiveRecords(e){this.parentDeleteActiveRecords&&void 0===this.getCurrentDataSource()?this.parentDeleteActiveRecords(e):this.currentActiveRecords=p.operator(this.currentActiveRecords).delete(e).get()}deleteActiveRecordsByEntity(e,t){this.parentDeleteActiveRecordsByEntity&&void 0===this.getCurrentDataSource()?this.parentDeleteActiveRecordsByEntity(e,t):this.currentActiveRecords=p.operator(this.currentActiveRecords).deleteByEntity(e,t).get()}flushActiveRecords(){this.parentFlushActiveRecords&&void 0===this.getCurrentDataSource()?this.parentFlushActiveRecords():this.currentActiveRecords=[]}$$initViewStatePosition(e){}$$clearViewStatePosition(e){}$$initViewState(e){}$$clearViewState(e){}$$beforeMount(){super.$$beforeMount();let e=!1;this.viewState||(this.viewState=ze().viewState,this.viewState&&(e=!0,this.$$initViewStatePosition(this.viewState),this.$$initViewState(this.viewState))),this.viewState&&!e&&this.$$initViewStatePosition(this.viewState)}$$mountedAfterProperties(){super.$$mountedAfterProperties(),this.viewState&&(this.$$clearViewStatePosition(this.viewState),this.$$clearViewState(this.viewState))}$$beforeUnmount(){super.$$beforeUnmount(),this.viewState&&this.$$initViewStatePosition(this.viewState)}$$unmounted(){super.$$unmounted(),this.viewState&&this.$$clearViewStatePosition(this.viewState)}}te([Widget.Reactive(),Widget.Inject("rootData"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentRootData",void 0),te([Widget.Reactive(),ie("design:type",Object)],ActiveRecordsWidget.prototype,"currentRootData",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[Object])],ActiveRecordsWidget.prototype,"rootData",null),te([Widget.Method(),Widget.Inject("reloadRootData"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentReloadRootData",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"reloadRootData",null),te([Widget.Reactive(),Widget.Inject("dataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDataSource",void 0),te([Widget.Reactive(),ie("design:type",Object)],ActiveRecordsWidget.prototype,"currentDataSource",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[Object])],ActiveRecordsWidget.prototype,"dataSource",null),te([Widget.Method(),Widget.Inject("reloadDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentReloadDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"reloadDataSource",null),te([Widget.Method(),Widget.Inject("pushDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentPushDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function,Number]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"pushDataSource",null),te([Widget.Method(),Widget.Inject("updateDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateDataSource",null),te([Widget.Method(),Widget.Inject("updateDataSourceByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateDataSourceByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateDataSourceByEntity",null),te([Widget.Method(),Widget.Inject("deleteDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteDataSource",null),te([Widget.Method(),Widget.Inject("deleteDataSourceByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteDataSourceByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteDataSourceByEntity",null),te([Widget.Method(),Widget.Inject("flushDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentFlushDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"flushDataSource",null),te([Widget.Reactive(),Widget.Inject("activeRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentActiveRecords",void 0),te([Widget.Reactive(),Widget.Inject("parentViewActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentViewActiveRecords",void 0),te([Widget.Reactive(),ie("design:type",Object)],ActiveRecordsWidget.prototype,"currentActiveRecords",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[Object])],ActiveRecordsWidget.prototype,"activeRecords",null),te([Widget.Method(),Widget.Inject("reloadActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentReloadActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"reloadActiveRecords",null),te([Widget.Method(),Widget.Inject("pushActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentPushActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"pushActiveRecords",null),te([Widget.Method(),Widget.Inject("updateActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateActiveRecords",null),te([Widget.Method(),Widget.Inject("updateActiveRecordsByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateActiveRecordsByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateActiveRecordsByEntity",null),te([Widget.Method(),Widget.Inject("deleteActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteActiveRecords",null),te([Widget.Method(),Widget.Inject("deleteActiveRecordsByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteActiveRecordsByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteActiveRecordsByEntity",null),te([Widget.Method(),Widget.Inject("flushActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentFlushActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"flushActiveRecords",null);const Le={reportBeforeMount:()=>{},reportMounted:()=>{},reportUnmounted:()=>{},reportAllBeforeMount:()=>{},reportAllMounted:()=>{},reportAllUnmounted:()=>{}},Ge=Symbol("AllMountedContext"),Ke=e=>{M(Ge,Object.assign(Object.assign({},Le),e))},Qe=()=>O(Ge,Le);function Ze(e,t){return!!Object.values(e).every(e=>e)&&(t(),!0)}let qe=0;function Je(e){if(!e)return void console.warn("all mounted method or object is required.");let t,i;x(e)?t=e:i=e;const{reportAllBeforeMount:n,reportAllMounted:o,reportAllUnmounted:r}=Qe(),s="all-mounted#"+qe++,d={},a={};Ke({reportBeforeMount:e=>{const t=d[e];I(t)&&(d[e]=!1),null==n||n(s)},reportMounted:e=>{const n=d[e];I(n)||n||(d[e]=!0,Ze(d,(null==i?void 0:i.allMounted)||t||(()=>({})))&&(null==o||o(s)))},reportUnmounted:e=>{delete d[e],null==r||r(s)},reportAllBeforeMount:e=>{const t=a[e];I(t)&&(a[e]=!1)},reportAllMounted:e=>{const t=a[e];I(t)||t||(a[e]=!0,Ze(a,(null==i?void 0:i.allMountedUpdate)||(()=>({}))))},reportAllUnmounted:e=>{delete a[e]}})}let Xe=0;function Ye(e){const{reportBeforeMount:t,reportMounted:i,reportUnmounted:n}=Qe(),o="mounted-#"+Xe++;P(()=>{var i;const n=null===(i=null==e?void 0:e.onBeforeMount)||void 0===i?void 0:i.call(e);n instanceof Promise?n.then(()=>{null==t||t(o)}):null==t||t(o)}),N(()=>{var t;const n=null===(t=null==e?void 0:e.onMounted)||void 0===t?void 0:t.call(e);n instanceof Promise?n.then(()=>{null==i||i(o)}):null==i||i(o)}),V(()=>{var t;const i=null===(t=null==e?void 0:e.onUnmounted)||void 0===t?void 0:t.call(e);i instanceof Promise?i.then(()=>{null==n||n(o)}):null==n||n(o)}),Ke({})}const et=e=>X(`[vue-kunlun]: ${e}`),tt={handle:{type:String},dslDefinition:{type:Object},slotName:{type:String},inline:{type:Boolean,default:void 0},slotContext:{type:Object}};var it;!function(e){e.Action="Action",e.Field="Field",e.Element="Element",e.View="View",e.Mask="Mask"}(it||(it={}));let nt=class ViewWidget extends DslNodeWidget{constructor(){super(...arguments),this.loading=!1,this.currentRoute={},this.domain="",this.isRootView=!0,this.isDialogView=!1,this.selfHandleStr="",this.model=null,this.type="UNKNOWN",this.initQueryParams=null}getVM(){return this.$$vm}setVM(e){this.$$vm=e}setBusy(e){this.getVM().setBusy(e)}getUrlParams(){const{page:e={}}=Z().matched.segmentParams;return e}getBusy(){return this.loading}initialize(e){return null==e.isRootView&&(e.isRootView=!0),super.initialize(e),this.isRootView=e.isRootView||!1,e.view&&(this.view=e.view),null==this.rootHandleStr&&e.isRootWidget&&(this.currentRootHandlerStr=this.getHandle()),this.selfHandleStr=this.getHandle(),this.isDialogView=e.isDialogView||!1,this.model=e.model,this.setVM(new h({view:e.view,dslNode:e.dslNode,model:e.model,isRootWidget:!1!==e.isRootWidget||e.isRootWidget,isDialogView:e.isDialogView||!1,isRootView:e.isRootView})),this.getVM().isRootWidget=this.isRoot,this.getVM().isDialogView=this.isDialogView,this}get rootHandleStr(){return this.currentRootHandlerStr||this.parentRootHandlerStr}on(e,t){this.getVM().on(e,t)}watch(e,t){this.getVM().watch(e,t)}filterWatchData(e,t,i){return this.getVM().filterWatchData(e,t,i)}get isRoot(){return this.rootHandleStr===this.getHandle()}get useConstruct(){return this.isRoot||this.isDialogView}get viewElement(){return J(this.dslNode)}resolveTemplate(){}fetchData(e,t,i){return{}}onRowsChange(e){}loadData(e,t){return{}}loadRootData(e){this.getVM().setRootData(e)}setRootDataByKey(e,t){const i=this.getVM().getRootData();i&&(i[e]=t,this.getVM().setRootData(i))}submit(){return{}}getData(){return this.getVM().getData()}setData(e){this.getVM().setData(e)}validator(){return ne(this,void 0,void 0,function*(){return[]})}loadMetadata(e,t,i,n){this.getVM().loadMetadata(e,t,i,n),this.model=this.getVM().getModel(),this.view=this.getVM().getView(),this.dslNode||(this.dslNode=t||this.getVM().getDslNode())}getActiveRecords(){return[]}setDomain(e){this.domain=e}getDomain(){return this.domain}setFilter(e){this.filter=e}getFilter(){return this.filter}getModel(){return this.getVM().getModel()}getView(){return this.getVM().getView()}getPath(){return this.path}notify(e){this.getVM().notify(e)}$$beforeCreated(){const{initQueryParams:e="{}"}=this.getUrlParams();try{const t=JSON.parse(e);this.initQueryParams=Object.keys(t).length?t:null}catch(e){this.initQueryParams=null}this.notify(ee.ON_VIEW_BEFORE_CREATED)}$$created(){this.notify(ee.ON_VIEW_CREATED)}$$beforeMount(){this.notify(ee.ON_VIEW_BEFORE_MOUNT)}$$mounted(){this.getVM().setPageViewState("mount"),this.getVM().watchLoading(e=>{this.loading=e});const{getMatched$:e}=Z();this.subjectRoute$=e().subscribe(e=>{this.currentRoute=e}),this.notify(ee.ON_VIEW_MOUNTED)}$$beforeUpdate(){this.notify(ee.ON_VIEW_BEFORE_UPDATE)}$$updated(){this.notify(ee.ON_VIEW_UPDATED)}$$beforeUnmount(){this.notify(ee.ON_VIEW_BEFORE_UNMOUNT)}$$unmounted(){this.getVM().setPageViewState("unmount");const e=setTimeout(()=>{"unmount"===this.getVM().getPageViewState()&&(this.notify(ee.ON_VIEW_UNMOUNTED),this.getVM().unsubscribe()),clearTimeout(e)})}};te([Widget.Reactive(),ie("design:type",Object)],nt.prototype,"loading",void 0),te([Widget.Inject(),Widget.Reactive(),ie("design:type",String)],nt.prototype,"filter",void 0),te([Widget.Reactive(),Widget.Inject("rootHandleStr"),ie("design:type",Object)],nt.prototype,"parentRootHandlerStr",void 0),te([Widget.Reactive(),ie("design:type",Object)],nt.prototype,"currentRootHandlerStr",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[])],nt.prototype,"rootHandleStr",null),te([Widget.Reactive(),ie("design:type",Object)],nt.prototype,"isRootView",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],nt.prototype,"isRoot",null),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],nt.prototype,"useConstruct",null),te([Widget.Provide(),ie("design:type",Object)],nt.prototype,"selfHandleStr",void 0),te([Widget.Reactive(),Widget.Provide("view"),ie("design:type",Object)],nt.prototype,"view",void 0),te([Widget.Reactive(),Widget.Provide("viewModel"),ie("design:type",Object)],nt.prototype,"model",void 0),te([Widget.Reactive(),ie("design:type",String)],nt.prototype,"path",void 0),nt=te([Y.Base("View",["id","name","type","model","widget","tagName"])],nt);const ot=Symbol("view");export{ActiveRecordsWidget,AsyncVueWidget,ae as DEFAULT_TAG_PREFIX,DslDefinitionWidget,DslNodeWidget,DslRender,DslRenderWidget,it as InnerWidgetType,PathWidget,le as RENDER_OPTIONS_KEY,ce as SLOTS_KEY,ue as SLOT_CONTEXT_KEY,ot as ViewSubSymbol,nt as ViewWidget,VueWidget,Widget,tt as WidgetTagProps,ge as componentInstall,Ne as defaultMetaContext,ve as directiveInstall,se as executeInvisible,et as genToken,We as getWidget,be as getWidgetNotNull,je as hasActionBarViewState,Me as hasFieldsViewState,Pe as hasRowActionBarViewState,de as isAllInvisible,Ce as isDetailViewState,Se as isFormViewState,we as isGalleryViewState,$e as isListViewState,Oe as isObjectViewState,De as isSearchViewState,Re as isTableViewState,Ae as isTreeViewState,me as newVueWidget,Je as onAllMounted,fe as pluginInstall,ye as renderWidgets,Ye as reportAllMounted,He as useInjectMetaContext,ze as useOioState,Ie as useProviderMetaContext};
|
|
1
|
+
import{instantiate as e,uniqueKeyGenerator as t,StringHelper as i,CastHelper as n,BooleanHelper as o}from"@oinone/kunlun-shared";import{BehaviorSubject as r,Subject as s}from"@oinone/kunlun-state";import{translateValueByKey as d,genStaticPath as a,RuntimeContextManager as c,ComputeContextManager as l,ROOT_HANDLE as u,ActiveRecordsOperator as p,ViewVM as h}from"@oinone/kunlun-engine";import{computed as g,inject as v,provide as f,reactive as y,defineComponent as m,createVNode as W,Fragment as b,effectScope as R,ref as D,watch as S,isRef as C,toRaw as w,withCtx as $,nextTick as A,h as O,Suspense as M,resolveDynamicComponent as j,onBeforeMount as P,onMounted as V,onUnmounted as N}from"vue";import{ViewType as I,createViewElement as H}from"@oinone/kunlun-meta";import{DEFAULT_SLOT_NAME as _,XMLTemplateParser as E,DslDefinitionHelper as x,DslSlotUtils as B,DslDefinitionType as k,UnknownDslDefinition as U}from"@oinone/kunlun-dsl";import{isNil as T,isBoolean as F,isString as z,intersection as L,isFunction as G}from"lodash-es";import{PropRecordHelper as K,StyleHelper as Q}from"@oinone/kunlun-vue-ui-common";import{getMergeConfig as Z}from"@oinone/kunlun-config";import{isDev as q,useMatched as J}from"@oinone/kunlun-router";import{InjectionToken as X,SPI as Y}from"@oinone/kunlun-spi";import{LifeCycleTypes as ee}from"@oinone/kunlun-event";class Widget{static createHandle(e=""){return`${e||"oio-widget"}-${this.widgetCount++}`}static Attribute(e){return(t,i,n)=>{const o=t.constructor,r=this.attributeMap.get(o)||new Map;r.set(e&&e.displayName||i,i),this.attributeMap.set(o,r),n&&n.get&&(t[`$compute$${i}`]={get:n.get,set:n.set});const s=o.prototype.$$props||[];e&&!1===e.render||s.push(e&&e.displayName||i),t.$$props=s}}static Watch(e,t){return(i,n,o)=>{const r=i.constructor,s=Widget.watchMap.get(r)||[];s.push({path:e,handler:o.value,options:t}),Widget.watchMap.set(r,s)}}static Sub(e,t,i,n){return(o,r)=>{const s=this.nameContextMap.get(e);if(s)s&&!s.paramName_NameMap.get(r)&&s.paramName_NameMap.set(r,e);else{const o=new t(i),s=new Map;s.set(r,e),this.nameContextMap.set(e,{paramName_NameMap:s,subject:o,value:i,option:n})}const d=o.constructor.prototype.$$subNames||[];d.includes(r)||d.push(r),o.$$subNames=d}}static BehaviorSubContext(e,t,i){return Widget.Sub(e,r,t,i)}static SubContext(e,t,i){return Widget.Sub(e,s,t,i)}static Reactive(e){return Widget.Attribute(e)}static Method(e){return Widget.Attribute(e?{displayName:e}:void 0)}static select(e){return Widget.widgetMap.get(e)}static Inject(e){return(t,i)=>{let n=Reflect.get(t,"injection")||{name:this,list:new Map};if(n.name!==t.constructor){const e=n;n={name:t.constructor,list:new Map},e.list.forEach((e,t)=>n.list.set(t,e)),Reflect.set(t,"injection",n)}n.list.get(e||i)||n.list.set(e||i,i)}}static Provide(e){return(t,i)=>{let n=Reflect.get(t,"provider")||{name:this,list:new Map};if(n.name!==t.constructor){const e=n;n={name:t.constructor,list:new Map},e.list.forEach((e,t)=>n.list.set(t,e)),Reflect.set(t,"provider",n)}n.list.get(e||i)||n.list.set(e||i,i)}}constructor(e){this.subscriptionMap=new Map,this.childrenInstance=[],this.children=[],this.childrenWidget=[],this.config={},this.initialized=!1,this.parent=null,this.childrenInstance=[],this.handle=e||Widget.createHandle(this.constructor.name),this.name="default",this.self=this}getSelf(){return this.self}getOperator(){return this}initialize(e={}){if(this.initialized)throw new Error(`error: reInitializeWidget:${this.getWidgetType()}:${this.getHandle()}`);const t={},i=(Reflect.get(this,"injection")||{list:new Map}).list,n=this.getAttributes();if(i&&i.forEach((e,i)=>{if(void 0!==this.getShared(i).host){Reflect.set(t,e,{get:()=>this.getShared(i).value,configurable:!0});let o="";n.forEach((t,i)=>t===e?o=i:""),""!==o&&Reflect.set(this,`$compute$${e}`,{get:()=>this.getShared(i).value})}}),Object.defineProperties(this,t),this.initialized=!0,this.config=e,Widget.widgetMap.set(this.getHandle(),this),this.$$innerWidgetType){const e=this.getParentWidget();e&&e.$$innerWidgetType&&e.childrenWidget.push(this)}return this.startSubscription(),this}startSubscription(){var e,t;if(null===(e=this.$$subNames)||void 0===e?void 0:e.length)for(const[,e]of Widget.nameContextMap)for(const[i]of e.paramName_NameMap)(null===(t=this.$$subNames)||void 0===t?void 0:t.includes(i))&&(this[i]=this.createWidgetSubjection(e))}wrapSubjectWithScope(e,t){if(!t)return e;const i=e.next,n=this;e.next=function(t){i.call(e,t.__publisherWidget?t:{payload:t,__publisherWidget:n})};const o=e;if(o.getValue){const e=o.getValue;o.getValue=function(){const t=e.call(o);return t.__publisherWidget?t.payload:t}}return e}createWidgetSubjection(e){const{subject:t,option:i}=e;return{subscribe:e=>{const n=t.subscribe(t=>{(null==i?void 0:i.scope)&&(null==t?void 0:t.__publisherWidget)?this.isSameScopeWidget(t.__publisherWidget,null==i?void 0:i.scope)&&e(t.payload):e((null==i?void 0:i.scope)&&(null==t?void 0:t.__publisherWidget)?t.payload:t)});return this.subscriptionMap.set(Symbol("random"),n),n},subject:this.wrapSubjectWithScope(t,null==i?void 0:i.scope)}}isSameScopeWidget(e,t){const i=this.getParentWidgetByType(t),n=e.getParentWidgetByType(t);return i===n&&null!==i||this.getHandle()===(null==n?void 0:n.getHandle())}dispose(e=!1){var t,i;this.releaseInjection();const n=null===(t=this.parent)||void 0===t?void 0:t.children;if(n){const e=n.findIndex(e=>e.getHandle()===this.getHandle());-1!==e&&(n.splice(e,1),null===(i=this.parent)||void 0===i||i.childrenInstance.splice(e,1))}for(;this.children.length;)this.children[0].dispose(e);Widget.widgetMap.delete(this.getHandle()),this.subscriptionMap.forEach(e=>{e.unsubscribe()}),this.subscriptionMap.clear(),this.self=null,this.childrenInstance=[],this.children=[],this.childrenWidget=[],this.parent=null,e&&(this.$$props=void 0)}createWidget(t,i,n,o){const r=e(t);r.parent=this;const s=r.initialize(n),d=s&&s.getOperator();return void 0!==o&&o>=0?this.children[o]=d:this.children.push(d),i&&(r.name=i),d}getHandle(){return this.handle}deleteWidget(e){const{length:t}=this.children;return this.children.forEach((t,i)=>{t.getHandle()===e&&t.dispose()}),this.children.length!==t}moveChildWidget(e,t){this.parent&&(this.children[e]=this.children.splice(t,1,this.children[e])[0],this.childrenInstance[e]=this.childrenInstance.splice(t,1,this.childrenInstance[e])[0])}insertWidget(e,t){this.parent&&(this.children.splice(t,0,e),this.childrenInstance.splice(t,0,e))}deleteWidgetByIndex(e,t){const{length:i}=this.children,n=t||this.children[e].getHandle();return this.children.forEach((t,i)=>{t.getHandle()===n&&i===e&&t.dispose()}),this.children.length!==i}getConfig(e){return this.config[e]}getAllConfig(){return this.config}getSibling(){if(!this.$$innerWidgetType)return null;const e=this.getParentWidget();return e?e.getChildrenWidget():null}previousWidgetSibling(){const e=this.getSibling();if(!e)return null;const t=e.findIndex(e=>e.getHandle()===this.getHandle());return t>0?e[t-1]:null}nextWidgetSibling(){const e=this.getSibling();if(!e)return null;const t=e.findIndex(e=>e.getHandle()===this.getHandle());return t>=0&&t<e.length-1?e[t+1]:null}getParentWidget(){if(this.$$innerWidgetType){let e=this.parent;if(!e)return null;for(;e;){if(e.$$innerWidgetType)return e;e=e.parent}}return this.parent}getParentWidgetByType(e){let t=this.parent;for(;t;){if(t.$$innerWidgetType===e)return t;t=t.parent}return null}getChildrenWidget(){return this.childrenWidget.length?this.childrenWidget:this.getChildrenInstance()}getParent(){return this.parent}getName(){return this.name}getWidgetType(){return this.constructor.name}static getProtoChains(e){let t=Widget.protoChainsCache.get(e);if(t)return t;t=[];let i=e;for(;""!==i.name;)t.push(i),i=Object.getPrototypeOf(i);return Widget.protoChainsCache.set(e,t),t}getAttributes(){if(this.currentAttributeMapCache)return this.currentAttributeMapCache;const e=Widget.getProtoChains(this.constructor),t=new Map;return e.forEach(e=>{const i=Widget.attributeMap.get(e);i&&i.forEach((e,i)=>{t.set(i,e)})}),this.currentAttributeMapCache=t}getWatchers(){const e=[];return Widget.getProtoChains(this.constructor).forEach(t=>{const i=Widget.watchMap.get(t);i&&i.forEach(t=>e.push(t))}),e}getChildren(){return this.children}getChildrenInstance(){return this.childrenInstance}addChildrenInstance(e){this.childrenInstance.push(e)}getShared(e){let t=this.getParent(),i="";for(;t;){const n=(Reflect.get(t,"provider")||{list:new Map}).list;if(n&&n.get(e)){i=n.get(e);break}t=t.getParent()}if(t){let e=Reflect.get(t,i);return"function"==typeof e&&(e=e.bind(t)),{host:t,value:e}}return{}}releaseInjection(){const e=Reflect.get(this,"injection");e&&(e.list.forEach(e=>{const t=this.getSelf();t&&Reflect.deleteProperty(t,e)}),Reflect.set(this,"injection",null))}getComputeHandler(e){return Reflect.get(this,`$compute$${e}`)}getProps(){return this.$$props||[]}}function te(e,t,i,n){var o,r=arguments.length,s=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var d=e.length-1;d>=0;d--)(o=e[d])&&(s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s}function ie(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function ne(e,t,i,n){return new(i||(i=Promise))(function(o,r){function s(e){try{a(n.next(e))}catch(e){r(e)}}function d(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,d)}a((n=n.apply(e,t||[])).next())})}function oe(e){return e.viewType===I.Table}function re(e){return e.viewType===I.Search}function se(e){return e.viewType===I.Form}function de(e){return e.viewType===I.Detail}function ae(e){return e.viewType===I.Gallery}function ce(e){return e.viewType===I.Tree}function le(e){return e.viewType===I.Table||e.viewType===I.Gallery}function ue(e){return e.viewType===I.Form||e.viewType===I.Detail||e.viewType===I.Search}function pe(e){const{viewType:t}=e;return!!t&&(t===I.Table||t===I.Form||t===I.Detail)}function he(e){const{viewType:t}=e;return!!t&&t!==I.Search}function ge(e){const{viewType:t}=e;return!!t&&(t===I.Table||t===I.Gallery)}Widget.widgetCount=0,Widget.widgetMap=new Map,Widget.attributeMap=new Map,Widget.protoChainsCache=new WeakMap,Widget.watchMap=new Map,Widget.nameContextMap=new Map,"function"==typeof SuppressedError&&SuppressedError;const ve={viewType:g(()=>I.Form),model:g(()=>""),modelName:g(()=>""),module:g(()=>""),moduleName:g(()=>""),metadataHandle:g(()=>""),rootHandle:g(()=>""),parentHandle:g(()=>""),slotName:g(()=>{}),inline:g(()=>!1)},fe=Symbol("MetaContext"),ye=e=>{f(fe,Object.assign(Object.assign({},ve),e))},me=()=>{const e=v(fe,ve);return e||Object.assign({},ve)};function We(e){const t=null==e?void 0:e.invisible;return!T(t)&&(F(t)?t:t())}function be(e){return!e||!e.length||e.every(e=>We(e))}function Re(e,t){var i;if(null==t){if(pe(e))return e}else if(ae(e))return null===(i=e.cards)||void 0===i?void 0:i[t]}const De={},Se={pushField:function(e,t){const i=Re(this,t);if(!i)return;const{fields:n,fieldWidgets:o}=i;n&&(n.some(t=>t===e)||(n.push(e),i.fields=[...n]))},popField:function(e,t){const i=Re(this,t);if(!i)return;const{fields:n}=i;if(!n)return;const o=n.findIndex(t=>t===e);-1!==o&&(n.splice(o,1),i.fields=[...n])},createActionBarState:function(e){const t=Object.assign({actions:[],visibleActions:[]},e);return Object.defineProperty(t,"visibleActions",{get(){return this.actions.filter(e=>{const t=Widget.select(e);return!!t&&!We(t)})}}),y(t)},getActionBarState:function(e){var t;if(null==e){const e=this.__position[this.__position.length-1];if(null==e)return console.warn("Please call getActionBarState method in the vue lifecycle."),this.actionBar;const{slotName:t}=e;if(t&&t!==_){if(he(this))return this.actionBars[t]}else if(he(this))return this.actionBar}else if(ge(this))return null===(t=this.inlineActionBars)||void 0===t?void 0:t[e]},pushAction:function(e,t){const i=this.getActionBarState(t);if(!i)return;const{actions:n}=i;n&&(n.some(t=>t===e)||(n.push(e),i.actions=[...n]))},popAction:function(e,t){const i=this.getActionBarState(t);if(!i)return;const{actions:n}=i;if(!n)return;const o=n.findIndex(t=>t===e);-1!==o&&(n.splice(o,1),i.actions=[...n])}};function Ce(e){const t={get handle(){return e},fullscreen:!1,__position:[]},i=y(t);for(const[e,n]of Object.entries(Se))t[e]=n.bind(i);return i}function we(e){if(e||(e=me().rootHandle.value))return De[e];console.warn("Invalid root handle.")}function $e(e){if(!e&&!(e=me().rootHandle.value))return void console.warn("Invalid root handle.");const t=De[e];return delete De[e],t}const Ae={getMainViewState:function(){return we(this.mainViewHandle)}};const Oe=function(){const e={fullscreen:!1},t=y(e);for(const[i,n]of Object.entries(Ae))e[i]=n.bind(t);return t}();function Me(e){return e?{globalState:Oe,viewState:we(e),createViewState:()=>{const t=Ce(e);return function(e){De[e.handle]=e}(t),t},getViewState:()=>we(e),clearViewState:()=>$e(e)}:{globalState:Oe,viewState:we(),createViewState:Ce,getViewState:we,clearViewState:$e}}var je,Pe=m({name:"VueFragment",inheritAttrs:!1,render(){var e,t;return W(b,void 0,(null===(t=(e=this.$slots).default)||void 0===t?void 0:t.call(e))||[])}});Pe.__file="src/basic/VueFragment.vue",function(e){e.beforeCreated="beforeCreated",e.created="created",e.beforeMount="beforeMount",e.mounted="mounted",e.beforeUpdate="beforeUpdate",e.updated="updated",e.activated="activated",e.deactivated="deactivated",e.beforeUnmount="beforeUnmount",e.unmounted="unmounted"}(je||(je={}));class VueWidget extends Widget{constructor(){super(...arguments),this.behaviorGroup={},this.node_code=this.revolveNodeCode()}revolveNodeCode(){return t()}setup(e){return(t,i)=>{this.__scope&&(this.__scope.stop(),this.__scope=null),this.__scope=R();let n={};return this.__scope.run(()=>{const{opt:o}=this;this.getAttributes().forEach((e,t)=>{const i=this.getComputeHandler(t);if(i)i.get&&(i.set?Reflect.set(n,t,g({get:i.get.bind(o),set:i.set.bind(o)})):Reflect.set(n,t,g(i.get.bind(o))));else{const i=Reflect.get(this,e);"function"==typeof i?Reflect.set(n,t,i.bind(o)):Reflect.set(n,t,D(i))}});this.getWatchers().forEach(e=>{const t=e.path.split("."),i=n[t[0]];i&&(1===t.length?S(i,e.handler.bind(o),e.options):S(()=>{let e=i.value||{};for(let i=1;i<t.length&&(e=e[t[i]],e);i++);return e},e.handler.bind(o),e.options))});const r=e&&e(t,i,n);r&&(n=Object.assign(Object.assign({},n),r)),this.res=n}),n}}static HookHost(){return(e,t)=>{const i=VueWidget.hookHosts.get(e.constructor)||[];i.push(t),VueWidget.hookHosts.set(e.constructor,i)}}static getHookHosts(e){const t=[];return(()=>{const t=[];let i=e.constructor,{name:n}=i;for(;""!==n;)n=i.name,t.push(i),i=Object.getPrototypeOf(i);return t})().forEach(e=>{const i=VueWidget.hookHosts.get(e);i&&i.forEach(e=>t.push(e))}),t}static getHooks(e,t,i){const n=(e=>{const t=[];let i=e;for(;""!==i.name;)t.push(i.name),i=Object.getPrototypeOf(i);return t})(Widget.select(e).constructor),o=[];return n.forEach(e=>{let n;n="after"===i?VueWidget.afterHooks.get(e):VueWidget.beforeHooks.get(e);(n&&n.get(t)||[]).forEach(e=>o.push(e))}),o}static BeforeHook(e){return(t,i,n)=>{const o=VueWidget.beforeHooks.get(t.constructor.name)||new Map,r=o.get(e)||[];r.push(n.value),o.set(e,r),VueWidget.beforeHooks.set(t.constructor.name,o)}}static AfterHook(e){return(t,i,n)=>{const o=VueWidget.afterHooks.get(t.constructor.name)||new Map,r=o.get(e)||[];r.push(n.value),o.set(e,r),VueWidget.afterHooks.set(t.constructor.name,o)}}getNodeCode(){return this.node_code}getNodeCodeRef(){return this.res.node_code}getOperator(){const{opt:e}=this;return e||this}createWidget(e,t,i,n,o=!1){const r=this.getOperator(),s=super.createWidget.bind(r)(e,t,i||{},n);o&&(r.node_code=this.revolveNodeCode());const d=s&&s.getOperator();return void 0!==n&&n>=0?this.getChildrenInstance()[n]=s.getOperator():this.addChildrenInstance(d),d}deleteWidget(e){const t=super.deleteWidget(e);return this.getOperator().node_code=this.revolveNodeCode(),t}insertWidget(e,t){super.insertWidget(e,t);this.getOperator().node_code=this.revolveNodeCode()}moveChildWidget(e,t){super.moveChildWidget(e,t);this.getOperator().node_code=this.revolveNodeCode()}deleteWidgetByIndex(e,t){const i=super.deleteWidgetByIndex(e,t);return this.getOperator().node_code=this.revolveNodeCode(),i}initialize(e={}){return super.initialize(e),this.component=Pe,this.buildOperator(),this}buildOperator(){const e=new Proxy(this,{get:(e,t)=>{if("isProxy"===t)return!0;if("constructor"===t)return this.constructor;const i=this.res||{},n=Reflect.get(i,t);return n?C(n)?(n.value,n.value):n:Reflect.get(e,t)},set:(e,t,i)=>{const n=this.res||{},o=Reflect.get(n,t);return"function"==typeof o?Reflect.set(n,t,i):C(o)?(o.value=i,!0):Reflect.set(e,t,i)}});this.opt=e,this.initialize=this.initialize.bind(e);return VueWidget.getHookHosts(this).forEach(t=>{const i=Reflect.get(this,t);Reflect.set(this,t,(...n)=>{if("render"===t)return i.apply(e,n);const o=e.executeBeforeHooks(t,n),r=i.apply(e,o);return e.executeAfterHooks(t,r)})}),e}getWidgetComponent(e=!1){let t=this.widgetComponent;return!t&&e&&(t=this.buildWidgetComponent(),this.widgetComponent=t),t}setWidgetComponent(e){this.widgetComponent=e}renderExpandComponent(){}getMixinComponent(){return this.mixinComponent}setMixinComponent(e){e&&(e=Object.assign({inheritAttrs:!1},e)),this.mixinComponent=e}render(e,t){return this.widgetComponent||(this.widgetComponent=this.buildWidgetComponent()),this.widgetComponent?this.renderWidgetComponent(this.widgetComponent,e,t):[]}getWidgetComponentName(){const{name:e}=this.constructor;return e}buildWidgetComponent(){let e=this.getComponent();if(!e)return;e=w(e);const t=this.getOperator(),i=this.getUsingComponents();return m({name:this.getWidgetComponentName(),components:i,inheritAttrs:!1,setup:this.setup(this.setupHook.bind(this)),beforeMount:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.beforeMount])||void 0===i||i.call(e),this.$$beforeMount.call(t),this.beforeMount.call(t)},mounted:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.mounted])||void 0===i||i.call(e),this.$$mounted.call(t),this.mounted.call(t),this.$$mountedAfterProperties.call(t)},beforeUpdate:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.beforeUpdate])||void 0===i||i.call(e),this.$$beforeUpdate.call(t),this.beforeUpdate.call(t)},updated:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.updated])||void 0===i||i.call(e),this.$$updated.call(t),this.updated.call(t)},activated:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.activated])||void 0===i||i.call(e),this.$$activated.call(t),this.activated.call(t)},deactivated:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.deactivated])||void 0===i||i.call(e),this.$$deactivated.call(t),this.deactivated.call(t)},beforeUnmount:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.beforeUnmount])||void 0===i||i.call(e),this.$$beforeUnmount.call(t),this.beforeUnmount.call(t)},unmounted:()=>{var e,i;null===(i=(e=this.behaviorGroup)[je.unmounted])||void 0===i||i.call(e),this.unmounted.call(t),this.$$unmounted.call(t),this.$$unmountedAfterProperties.call(t)},render:t=>{const i=this.buildProps(t),{$slots:n}=t,o=this.resolveProps(e,i),r=Object.assign(Object.assign({},this.resolveChildren()),n),s=this.renderExpandComponent(),d={};if(s){const e=r.default?r.default():[];d.default=()=>[...e,s]}return this.renderMixinComponent(W(e,o,Object.assign(Object.assign({},r),d)),i)}})}resolveProps(e,t){return t}renderMixinComponent(e,t){const i=this.getMixinComponent();if(i){const n=e,o=this.resolveProps(i,t);e=W(i,o,{default:()=>n})}return e}renderWidgetComponent(e,t,i){return W(e,{},i)}buildProps(e){const t={},i=this.getAttributes(),n=this.getProps();return i.forEach((i,o)=>{n.includes(i)&&Reflect.set(t,i,Reflect.get(e,o))}),t["data-handle"]=this.getHandle(),t}buildPropsStrs(){const e=this.getProps(),t=[];return e.forEach(e=>t.push(e)),t}resolveChildren(){const e={},t=this.getChildren();for(const i of t){const t=i.getName();let n=e[t];n||(n=[],e[t]=n),n.push(i)}const i={};for(const[t,n]of Object.entries(e))i[t]=$(e=>{const t=[];for(const i of n){const n=i.render(e);Array.isArray(n)?t.push(...n):t.push(n)}return t});return i}setupHook(e,t,i){var n,o,r,s;return null===(o=(n=this.behaviorGroup)[je.beforeCreated])||void 0===o||o.call(n),this.$$beforeCreated(),this.beforeCreated(),null===(s=(r=this.behaviorGroup)[je.created])||void 0===s||s.call(r),this.$$metaContextProvide(),this.$$created(),this.created(),{}}setComponent(e){this.component=Object.assign({inheritAttrs:!1},e)}dispose(e=!1){super.dispose(e),this.opt=void 0;const t=null;this.__scope&&(this.__scope.stop(),this.__scope=t),this.component=t,this.mixinComponent=t,this.widgetComponent=t,e&&A(()=>{this.res={},this.__proto__=null})}getComponent(){const{name:e,__render__:t,__name__:i}=this.constructor;return t&&(this.component=m({name:i||e,props:this.buildPropsStrs(),render:t,components:this.getUsingComponents()})),this.component}getUsingComponents(){return{}}executeAfterHooks(e,t){const i=VueWidget.getHooks(this.getHandle(),e,"after");let n=0;const o={result:t},r=()=>{n<i.length&&i[n++].apply(this,[r,o])};return r(),o.result}executeBeforeHooks(e,...t){const i=VueWidget.getHooks(this.getHandle(),e,"before");let n=0;const o={args:t},r=()=>{n<i.length&&i[n++].apply(this,[r,o])};return r(),o.args}beforeCreated(){}$$beforeCreated(){}created(){}$$metaContextProvide(){const e=me();ye(Object.assign(Object.assign({},e),{parentHandle:g(()=>this.getHandle())}))}$$created(){}beforeMount(){}$$beforeMount(){}mounted(){}$$mounted(){}$$mountedAfterProperties(){}beforeUpdate(){}$$beforeUpdate(){}updated(){}$$updated(){}activated(){}$$activated(){}deactivated(){}$$deactivated(){}beforeUnmount(){}$$beforeUnmount(){}unmounted(){}$$unmounted(){}$$unmountedAfterProperties(){this.dispose()}registryBehavior(e,t){this.behaviorGroup[e]=t}reset(){this.widgetComponent=void 0,this.getParent().node_code=this.revolveNodeCode()}translate(e,t={}){const i=Reflect.get(window,"translate"),n=i?i(e):"";if(n===e||0===Object.keys(t).length)return n;return n.replace(/\{\s*([A-Z0-9_]+)\s*\}/gi,(e,i)=>t[i])}translateByI18n(e){return d(e)||e}genStaticPath(e){return a(e)}forceUpdate(){const e=this.getOperator();e&&(e.node_code=this.revolveNodeCode())}}VueWidget.beforeHooks=new Map,VueWidget.afterHooks=new Map,VueWidget.hookHosts=new Map,te([Widget.Reactive(),ie("design:type",String)],VueWidget.prototype,"node_code",void 0),te([VueWidget.HookHost(),ie("design:type",Function),ie("design:paramtypes",[Object,Object]),ie("design:returntype",Object)],VueWidget.prototype,"render",null),te([Widget.Reactive(),ie("design:type",Function),ie("design:paramtypes",[Object,Object]),ie("design:returntype",String)],VueWidget.prototype,"translate",null),te([Widget.Reactive(),ie("design:type",Function),ie("design:paramtypes",[String]),ie("design:returntype",String)],VueWidget.prototype,"translateByI18n",null),te([Widget.Method(),ie("design:type",Function),ie("design:paramtypes",[String]),ie("design:returntype",void 0)],VueWidget.prototype,"genStaticPath",null);class AsyncVueWidget extends VueWidget{setup(e){const t=super.setup();return(i,n)=>ne(this,void 0,void 0,function*(){const o=t(i,n),r=e&&(yield e(i,n))||{};for(const e in r)Reflect.set(o,e,Reflect.get(r,e));return o})}render(e){return O("div",O(M,super.render(e)))}setupHook(e,t,i){return ne(this,void 0,void 0,function*(){return yield this.beforeCreated(),yield this.created(),{}})}}class DslNodeWidget extends VueWidget{get widgetPath(){let e=this.parentPath||"";const{subPath:t,subIndex:i}=this;return t&&(e=e?`${e}.${t}`:t),null!=i&&(e=`${e}[${i}]`),e}get variables(){return E.resolveVariables(this.getDsl())}initialize(e){var t;super.initialize(e),this.dslNode=e.dslNode,this.metadataHandle=e.metadataHandle,this.rootHandle=e.rootHandle,this.template=e.template,this.slotName=e.slotName,this.widgetInline=e.widgetInline,this.currentHandle=this.getHandle();const{subPath:i,subIndex:n}=e;return this.subPath=i||(null===(t=this.template)||void 0===t?void 0:t.dslNodeType)||"",T(n)?this.subIndex=e.__index:this.subIndex=n,this}getDsl(){return this.dslNode||{}}getSlotName(){return this.slotName}getDslChildrenByLabel(e){return this.dslNode?(this.dslNode.children||[]).find(t=>t.tagName===e.toUpperCase()):null}get metadataRuntimeContext(){const{metadataHandle:e}=this;if(e)return c.get(e)}get rootRuntimeContext(){const{rootHandle:e}=this;if(e)return c.get(e)}}te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"metadataHandle",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"rootHandle",void 0),te([Widget.Reactive(),ie("design:type",String)],DslNodeWidget.prototype,"currentHandle",void 0),te([Widget.Reactive({render:!1}),ie("design:type",Object)],DslNodeWidget.prototype,"dslNode",void 0),te([Widget.Reactive({render:!1}),ie("design:type",Object)],DslNodeWidget.prototype,"template",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"slotName",void 0),te([Widget.Reactive(),Widget.Inject("path"),ie("design:type",Object)],DslNodeWidget.prototype,"parentPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"subPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"subIndex",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[])],DslNodeWidget.prototype,"widgetPath",null),te([Widget.Reactive(),ie("design:type",Object)],DslNodeWidget.prototype,"widgetInline",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslNodeWidget.prototype,"variables",null);const Ve="oinone",Ne="__slots",Ie="__render__options",He="slotContext",_e=["div","a","span","table","form","detail","ul","li","h1","h2","h3","h4","h5","h6","p","thead","tbody","tr","th","td"];function Ee(e,t,i){let n=e[t];if(delete e[t],!n&&i){n=i;const{dslDefinition:o}=e;o&&(o[t]=i)}return n}class DslRender{static render(e,t=_,i,n){const o=DslRender.fetchComponent(e);if(o)return DslRender.createVNodeWithDslDefinition(o,e,t,i,n)}static renderSlots(e){const t={};for(const i in e)t[i]=$(t=>{var n;return DslRender.createVNodeChildren(null===(n=e[i])||void 0===n?void 0:n.widgets,i,t)});return t}static fetchVNodeSlots(e,t){var i;if(!e)return;const n=e[Ne];if(n)return n;if(!t){const n=[_];null===(i=e.widgets)||void 0===i||i.forEach(e=>{if(x.isTemplate(e)){let t=e.slot;t||(t=_),n.push(t)}}),t=[...new Set(n)]}const o=B.fetchSlotsBySlotNames(e,t);return DslRender.renderSlots(o)}static fetchComponent(e){let t,{dslNodeType:i}=e||{};switch(i||(i=k.ELEMENT),i){case k.VIEW:t=j(`${Ve}-${e.dslNodeType}`);break;case k.PACK:{const i=e;t=DslRender.resolveWidgetComponent(`${i.widget||"group"}`),"string"==typeof t&&(t=DslRender.resolveWidgetComponent(`${e.dslNodeType}`));break}case k.ELEMENT:{const i=e;t=DslRender.resolveWidgetComponent(`${i.widget}`),"string"==typeof t&&(t=DslRender.resolveWidgetComponent(`${e.dslNodeType}`));break}case k.ACTION:case k.FIELD:t=DslRender.resolveWidgetComponent(`${e.dslNodeType}`);break;case k.UNKNOWN:case k.SLOT:case k.TEMPLATE:t=null;break;default:t=DslRender.resolveCommonWidgetComponent(i)}return t}static createVNodeChildren(e,t,i,n){const o=[];if(!e)return o;t||(t=_),T(n)&&(n=0);const{length:r}=e;for(let s=0;s<r;s++){const r=e[s],d=DslRender.fetchComponent(r);if(d)o.push(DslRender.createVNodeWithDslDefinition(d,r,t,z(d)?DslRender.fetchVNodeSlots(r):void 0,i?{slotContext:i}:void 0,s+n));else if(null===d){const{dslNodeType:e}=r;switch(e){case k.SLOT:{const e=DslRender.createVNodeChildren(r.widgets,t,i,s+n);n+=e.length,e.forEach(e=>o.push(e));break}case k.UNKNOWN:case k.TEMPLATE:continue;default:console.error("Invalid component.")}}}return o}static createVNodeWithDslDefinition(e,i,n,o,r,s){var d;T(s)||i.__index===s||(i.__index=s);const a=z(e),c=a?K.collectionBasicProps(i):Object.assign(Object.assign({},i),{dslDefinition:Object.assign({},i),slotName:n});let l;l=a&&i.__content||Ee(c,Ne,o);const u=Ee(c,Ie,r),p=null==u?void 0:u.slotContext;if(p){const e=null==r?void 0:r.slotContext;e&&(u.slotContext=e),c.slotContext=p}if(DslRenderHelper.predictIsUpdateKey(i,u)){const e=t();i.key=e,c.key=e}DslRenderHelper.predictIsRecursion(u)&&!l&&(null===(d=i.widgets)||void 0===d?void 0:d.length)&&(l=DslRender.fetchVNodeSlots(i));let h=null==u?void 0:u.dynamicProps;return p&&(h=L(h||[],[He])),W(e,c,l,null==u?void 0:u.patchFlag,h,null==u?void 0:u.isBlockNode)}static resolveCommonWidgetComponent(e){let t=DslRender.resolveCommonComponentCache[e];return t||(_e.includes(e)?e:(t=j(`${Ve}-${i.camelCaseToKebabCase(e)}`),"string"==typeof t&&(t=j(e)),DslRender.resolveCommonComponentCache[e]=t,t))}static resolveWidgetComponent(e){let t=DslRender.resolveComponentCache[e];if(t)return t;if(_e.includes(e))return e;if(t=j(e),"string"==typeof t)for(const i of DslRender.resolveMethods){const n=i(e);if(n){const e=j(n);if("string"!=typeof e){t=e;break}}}return DslRender.resolveComponentCache[e]=t,t}}DslRender.resolveComponentCache={},DslRender.resolveCommonComponentCache={},DslRender.resolveMethods=[e=>{if(-1===e.indexOf("-")){const t=e.charCodeAt(0);if(t>=i.UPPER_A_ASCLL&&t<=i.UPPER_Z_ASCLL)return`${e[0].toLowerCase()}${e.substring(1)}`}},e=>{if(-1===e.indexOf("-")){const t=e.charCodeAt(0);if(t>=i.LOWER_A_ASCLL&&t<=i.LOWER_Z_ASCLL)return`${e[0].toUpperCase()}${e.substring(1)}`}},e=>i.camelCaseToKebabCase(e)];class DslRenderHelper{static predictIsUpdateKey(e,t){const i=(null==t?void 0:t.dynamicKey)||!1,n=(null==t?void 0:t.focusUpdate)||!1;if(e.key){if(n)return!0}else if(i)return!0;return!1}static predictIsRecursion(e){return(null==e?void 0:e.recursion)||!1}}function xe(e,t){t||(t=e.name);const i=c.createOrReplace().frameworkInstance;t?"string"==typeof t?i.component(t,e):t.forEach(t=>i.component(t,e)):q()&&console.warn("component install error. reason: name is blank.",e)}function Be(e,t){c.createOrReplace().frameworkInstance.directive(t,e)}function ke(e,...t){c.createOrReplace().frameworkInstance.use(e,...t)}function Ue(e,t,i){let n;const{length:o}=e;for(let r=o-1;r>=0;r--){const o=e[r];if(n){const e=Array.isArray(n)?n:[n];n=o.render(t,{default:()=>e})}else n=o.render(t,i)}return n}function Te(){return new VueWidget}function Fe(e){return n.cast(Widget.select(e))}function ze(e){return Fe(e)||Te()}class DslRenderWidget extends VueWidget{constructor(){super(...arguments),this.internal=!1}initialize(e){return super.initialize(e),this.renderProps=e,this.internal=e.internal||!1,this.template=e.template,this.slotName=e.slotName,this.supportedSlotNames=e.slotNames||[],this.template&&this.supportedSlotNames.length&&(this.dslSlots=B.fetchSlotsBySlotNames(this.template,this.supportedSlotNames)),this}getDsl(){return this.template||U}getMergeConfig(...e){if(this.cacheConfigProxy)return this.cacheConfigProxy;const t=Z(e,{defaultValue:void 0});return this.cacheConfigProxy=new Proxy(this.getDsl(),{get:(e,i)=>i in e?e[i]:t[i]}),this.cacheConfigProxy}getSlotName(){return this.slotName}render(e,t){return this.template&&(void 0===this.slots&&(this.internal?this.slots=this.internalRender(t)||null:this.slots=this.commonRender(t)||null),this.slots)?this.rawRender(e,this.slots):this.rawRender(e,t)}rawRender(e,t){return super.render(e,t)}internalRender(e){return e&&Object.keys(e).length?e:this.dslSlots&&Object.keys(this.dslSlots).length?DslRender.renderSlots(this.dslSlots):void 0}commonRender(e){return this.dslSlots&&Object.keys(this.dslSlots).length?DslRender.renderSlots(this.dslSlots):e&&Object.keys(e).length?e:void 0}}te([Widget.Reactive(),ie("design:type",Object)],DslRenderWidget.prototype,"internal",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslRenderWidget.prototype,"template",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslRenderWidget.prototype,"slotName",void 0);class DslDefinitionWidget extends DslRenderWidget{getMetadataHandle(){return this.metadataHandle}get class(){return this.getDsl().class}get style(){return Q.convertStyleByDslDefinition(this.getDsl())}getRootHandle(){return this.rootHandle}getCurrentHandle(){return this.currentHandle}get allInvisible(){const{allInvisible:e}=this.getDsl();return T(e)?this.defaultAllInvisible:o.toBoolean(e)}get invisible(){let{invisible:e}=this.getDsl();return e=!T(e)&&this.invisibleProcess(e),e||!!this.allInvisible&&(this.invisibleState=this.childrenInvisibleProcess(),this.invisibleState)}get parentInvisibleProvider(){return this.parentInvisible||this.invisible}constructor(e){super(e),this.automatic=!1,this.defaultAllInvisible=!1,this.invisibleState=!1,this.currentHandle=this.getHandle()}initialize(e){return super.initialize(e),this.metadataHandle=e.metadataHandle,this.rootHandle=e.rootHandle,this.automatic=e.automatic||!1,this.inline=e.inline,this}get metadataRuntimeContext(){const e=this.metadataRuntimeContextNullable;if(!e)throw new Error("Invalid metadata runtime context.");return e}get metadataRuntimeContextNullable(){const{metadataHandle:e}=this;let t;return e&&(t=c.get(e)),t}get rootRuntimeContext(){const e=this.rootRuntimeContextNullable;if(!e)throw new Error("Invalid root runtime context.");return e}get rootRuntimeContextNullable(){const{rootHandle:e}=this;let t;return e&&(t=c.get(e)),t}get rootComputeContext(){const{rootHandle:e}=this;let t;return e&&(t=l.get(e)),t}get rootViewRuntimeContext(){var e,t,i;const n=[];let o=this.rootRuntimeContext,r=null===(e=null==o?void 0:o.parentContext)||void 0===e?void 0:e.field;for(;r&&o;){n.push(r);const e=null===(t=null==o?void 0:o.parentContext)||void 0===t?void 0:t.handle;if(!e)throw new Error("Invalid field runtime context handle");const s=null===(i=Widget.select(e))||void 0===i?void 0:i.rootRuntimeContext,d=null==s?void 0:s.parentContext;if(!d||d.handle===u)break;r=d.field,o=s}if(!o)throw new Error("Invalid target runtime context.");return{runtimeContext:o,fields:n}}invisibleProcess(e){return o.toBoolean(e)}childrenInvisibleProcess(){return be(this.getChildren())}resetInvisible(){this.allInvisible&&(this.invisibleState=this.childrenInvisibleProcess())}resetParentInvisible(){var e,t;null===(t=null===(e=this.getParent())||void 0===e?void 0:e.resetInvisible)||void 0===t||t.call(e)}$$mounted(){super.$$mounted(),this.resetInvisible(),this.lastedInvisibleState=this.invisible}$$updated(){super.$$updated();const{lastedInvisibleState:e,invisible:t}=this;this.lastedInvisibleState=t,e!==t&&this.resetParentInvisible()}$$unmountedAfterProperties(){super.$$unmountedAfterProperties(),this.automatic||this.metadataHandle!==this.rootHandle||c.delete(this.metadataHandle)}allMounted(){this.resetInvisible()}}te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"automatic",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"metadataHandle",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"class",null),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"style",null),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"rootHandle",void 0),te([Widget.Reactive(),ie("design:type",String)],DslDefinitionWidget.prototype,"currentHandle",void 0),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"inline",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"allInvisible",null),te([Widget.Reactive(),ie("design:type",Object)],DslDefinitionWidget.prototype,"invisibleState",void 0),te([Widget.Reactive(),Widget.Inject(),ie("design:type",Object)],DslDefinitionWidget.prototype,"parentInvisible",void 0),te([Widget.Reactive(),ie("design:type",Boolean),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"invisible",null),te([Widget.Reactive(),Widget.Provide("parentInvisible"),ie("design:type",Object),ie("design:paramtypes",[])],DslDefinitionWidget.prototype,"parentInvisibleProvider",null),te([Widget.Method(),ie("design:type",Function),ie("design:paramtypes",[]),ie("design:returntype",void 0)],DslDefinitionWidget.prototype,"allMounted",null);class PathWidget extends DslDefinitionWidget{get path(){const{parentPath:e,subPath:t,subIndex:i,currentPath:n}=this;if(T(n)){let n=e||"";return this.internal||t&&(n=n?`${n}.${t}`:t,null!=i&&(n=`${n}[${i}]`)),n}return n}initialize(e){var t;super.initialize(e);const{subPath:i,subIndex:n,path:o}=e;return this.currentPath=o,this.subPath=i||(null===(t=this.template)||void 0===t?void 0:t.dslNodeType)||"",T(n)?this.subIndex=e.__index:this.subIndex=n,this}}te([Widget.Reactive(),Widget.Inject("path"),ie("design:type",Object)],PathWidget.prototype,"parentPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],PathWidget.prototype,"subPath",void 0),te([Widget.Reactive(),ie("design:type",Object)],PathWidget.prototype,"subIndex",void 0),te([Widget.Reactive(),ie("design:type",Object)],PathWidget.prototype,"currentPath",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[])],PathWidget.prototype,"path",null);class ActiveRecordsWidget extends PathWidget{getGlobalState(){return this.globalState}setGlobalState(e){this.globalState=e}getViewState(){return this.viewState}setViewState(e){this.viewState=e}initialize(e){var t;super.initialize(e);const{dataSource:i,activeRecords:n,viewState:o}=e;return this.setCurrentDataSource(i),this.setCurrentActiveRecords(n),o&&(this.isInitViewState=null===(t=e.isInitViewState)||void 0===t||t,this.setViewState(o)),this}get submitCache(){var e;return null===(e=this.metadataRuntimeContext.field)||void 0===e?void 0:e.submitCache}get rootData(){return this.currentRootData||this.parentRootData}set rootData(e){this.currentRootData=e}getCurrentRootData(){return this.currentRootData}setCurrentRootData(e){this.currentRootData=p.repairRecordsNullable(e)}reloadRootData(e){this.parentReloadRootData&&void 0===this.currentRootData?this.parentReloadRootData(e):this.setCurrentRootData(e)}get dataSource(){return this.currentDataSource||this.parentDataSource}set dataSource(e){this.currentDataSource=e}getCurrentDataSource(){return this.currentDataSource}setCurrentDataSource(e){this.currentDataSource=p.repairRecordsNullable(e),this.parentRootData||(this.currentRootData=this.currentDataSource||void 0)}reloadDataSource(e){this.parentReloadDataSource&&void 0===this.getCurrentDataSource()?this.parentReloadDataSource(e):this.setCurrentDataSource(e)}pushDataSource(e,t,i){if(this.parentPushDataSource&&void 0===this.getCurrentDataSource())this.parentPushDataSource(e,t);else{let n=t;const{submitCache:o}=this;o&&!n&&(n=p.defaultPushPredict.bind(o));const r=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).push(e,n,i).get();o||this.setCurrentDataSource(r)}}updateDataSource(e){if(this.parentUpdateDataSource&&void 0===this.getCurrentDataSource())this.parentUpdateDataSource(e);else{const t=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).update(e).get();this.submitCache||this.setCurrentDataSource(t)}}updateDataSourceByEntity(e,t){if(this.parentUpdateDataSourceByEntity&&void 0===this.getCurrentDataSource())this.parentUpdateDataSourceByEntity(e,t);else{const i=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).updateByEntity(e,t).get();this.submitCache||this.setCurrentDataSource(i)}}deleteDataSource(e){if(this.parentDeleteDataSource&&void 0===this.getCurrentDataSource())this.parentDeleteDataSource(e);else{const t=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).delete(e).get();this.submitCache||this.setCurrentDataSource(t)}}deleteDataSourceByEntity(e,t){if(this.parentDeleteDataSourceByEntity&&void 0===this.getCurrentDataSource())this.parentDeleteDataSourceByEntity(e,t);else{const i=p.operator(this.getCurrentDataSource()||void 0,this.submitCache).deleteByEntity(e,t).get();this.submitCache||this.setCurrentDataSource(i)}}flushDataSource(){var e;null===(e=this.parentFlushDataSource)||void 0===e||e.call(this)}get activeRecords(){return this.currentActiveRecords||this.parentActiveRecords}set activeRecords(e){this.currentActiveRecords=e}getCurrentActiveRecords(){return this.currentActiveRecords}setCurrentActiveRecords(e){e!==this.currentActiveRecords&&(this.currentActiveRecords=p.repairRecordsNullable(e))}reloadActiveRecords(e){this.parentReloadActiveRecords&&void 0===this.getCurrentDataSource()?this.parentReloadActiveRecords(e):this.setCurrentActiveRecords(e)}pushActiveRecords(e,t){this.parentPushActiveRecords&&void 0===this.getCurrentDataSource()?this.parentPushActiveRecords(e,t):this.currentActiveRecords=p.operator(this.currentActiveRecords).push(e,t).get()}updateActiveRecords(e){this.parentUpdateActiveRecords&&void 0===this.getCurrentDataSource()?this.parentUpdateActiveRecords(e):this.currentActiveRecords=p.operator(this.currentActiveRecords).update(e).get()}updateActiveRecordsByEntity(e,t){this.parentUpdateActiveRecordsByEntity&&void 0===this.getCurrentDataSource()?this.parentUpdateActiveRecordsByEntity(e,t):this.currentActiveRecords=p.operator(this.currentActiveRecords).updateByEntity(e,t).get()}deleteActiveRecords(e){this.parentDeleteActiveRecords&&void 0===this.getCurrentDataSource()?this.parentDeleteActiveRecords(e):this.currentActiveRecords=p.operator(this.currentActiveRecords).delete(e).get()}deleteActiveRecordsByEntity(e,t){this.parentDeleteActiveRecordsByEntity&&void 0===this.getCurrentDataSource()?this.parentDeleteActiveRecordsByEntity(e,t):this.currentActiveRecords=p.operator(this.currentActiveRecords).deleteByEntity(e,t).get()}flushActiveRecords(){this.parentFlushActiveRecords&&void 0===this.getCurrentDataSource()?this.parentFlushActiveRecords():this.currentActiveRecords=[]}$$initViewStatePosition(e){}$$clearViewStatePosition(e){}$$initViewState(e){}$$clearViewState(e){}$$beforeMount(){super.$$beforeMount();let e=!1;if(this.viewState)this.isInitViewState&&(e=!0,this.$$initViewStatePosition(this.viewState),this.$$initViewState(this.viewState));else{const{globalState:t,viewState:i}=Me();this.globalState=t,this.viewState=i,this.viewState&&(e=!0,this.$$initViewStatePosition(this.viewState),this.$$initViewState(this.viewState))}this.viewState&&!e&&this.$$initViewStatePosition(this.viewState)}$$mountedAfterProperties(){super.$$mountedAfterProperties(),this.viewState&&(this.$$clearViewStatePosition(this.viewState),this.$$clearViewState(this.viewState))}$$beforeUnmount(){super.$$beforeUnmount(),this.viewState&&this.$$initViewStatePosition(this.viewState)}$$unmounted(){super.$$unmounted(),this.viewState&&this.$$clearViewStatePosition(this.viewState)}}te([Widget.Reactive(),Widget.Inject("rootData"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentRootData",void 0),te([Widget.Reactive(),ie("design:type",Object)],ActiveRecordsWidget.prototype,"currentRootData",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[Object])],ActiveRecordsWidget.prototype,"rootData",null),te([Widget.Method(),Widget.Inject("reloadRootData"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentReloadRootData",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"reloadRootData",null),te([Widget.Reactive(),Widget.Inject("dataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDataSource",void 0),te([Widget.Reactive(),ie("design:type",Object)],ActiveRecordsWidget.prototype,"currentDataSource",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[Object])],ActiveRecordsWidget.prototype,"dataSource",null),te([Widget.Method(),Widget.Inject("reloadDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentReloadDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"reloadDataSource",null),te([Widget.Method(),Widget.Inject("pushDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentPushDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function,Number]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"pushDataSource",null),te([Widget.Method(),Widget.Inject("updateDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateDataSource",null),te([Widget.Method(),Widget.Inject("updateDataSourceByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateDataSourceByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateDataSourceByEntity",null),te([Widget.Method(),Widget.Inject("deleteDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteDataSource",null),te([Widget.Method(),Widget.Inject("deleteDataSourceByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteDataSourceByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteDataSourceByEntity",null),te([Widget.Method(),Widget.Inject("flushDataSource"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentFlushDataSource",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"flushDataSource",null),te([Widget.Reactive(),Widget.Inject("activeRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentActiveRecords",void 0),te([Widget.Reactive(),Widget.Inject("parentViewActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentViewActiveRecords",void 0),te([Widget.Reactive(),ie("design:type",Object)],ActiveRecordsWidget.prototype,"currentActiveRecords",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[Object])],ActiveRecordsWidget.prototype,"activeRecords",null),te([Widget.Method(),Widget.Inject("reloadActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentReloadActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"reloadActiveRecords",null),te([Widget.Method(),Widget.Inject("pushActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentPushActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"pushActiveRecords",null),te([Widget.Method(),Widget.Inject("updateActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateActiveRecords",null),te([Widget.Method(),Widget.Inject("updateActiveRecordsByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentUpdateActiveRecordsByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"updateActiveRecordsByEntity",null),te([Widget.Method(),Widget.Inject("deleteActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Array]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteActiveRecords",null),te([Widget.Method(),Widget.Inject("deleteActiveRecordsByEntity"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentDeleteActiveRecordsByEntity",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[Object,Function]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"deleteActiveRecordsByEntity",null),te([Widget.Method(),Widget.Inject("flushActiveRecords"),ie("design:type",Object)],ActiveRecordsWidget.prototype,"parentFlushActiveRecords",void 0),te([Widget.Method(),Widget.Provide(),ie("design:type",Function),ie("design:paramtypes",[]),ie("design:returntype",void 0)],ActiveRecordsWidget.prototype,"flushActiveRecords",null);const Le={reportBeforeMount:()=>{},reportMounted:()=>{},reportUnmounted:()=>{},reportAllBeforeMount:()=>{},reportAllMounted:()=>{},reportAllUnmounted:()=>{}},Ge=Symbol("AllMountedContext"),Ke=e=>{f(Ge,Object.assign(Object.assign({},Le),e))},Qe=()=>v(Ge,Le);function Ze(e,t){return!!Object.values(e).every(e=>e)&&(t(),!0)}let qe=0;function Je(e){if(!e)return void console.warn("all mounted method or object is required.");let t,i;G(e)?t=e:i=e;const{reportAllBeforeMount:n,reportAllMounted:o,reportAllUnmounted:r}=Qe(),s="all-mounted#"+qe++,d={},a={};Ke({reportBeforeMount:e=>{const t=d[e];T(t)&&(d[e]=!1),null==n||n(s)},reportMounted:e=>{const n=d[e];T(n)||n||(d[e]=!0,Ze(d,(null==i?void 0:i.allMounted)||t||(()=>({})))&&(null==o||o(s)))},reportUnmounted:e=>{delete d[e],null==r||r(s)},reportAllBeforeMount:e=>{const t=a[e];T(t)&&(a[e]=!1)},reportAllMounted:e=>{const t=a[e];T(t)||t||(a[e]=!0,Ze(a,(null==i?void 0:i.allMountedUpdate)||(()=>({}))))},reportAllUnmounted:e=>{delete a[e]}})}let Xe=0;function Ye(e){const{reportBeforeMount:t,reportMounted:i,reportUnmounted:n}=Qe(),o="mounted-#"+Xe++;P(()=>{var i;const n=null===(i=null==e?void 0:e.onBeforeMount)||void 0===i?void 0:i.call(e);n instanceof Promise?n.then(()=>{null==t||t(o)}):null==t||t(o)}),V(()=>{var t;const n=null===(t=null==e?void 0:e.onMounted)||void 0===t?void 0:t.call(e);n instanceof Promise?n.then(()=>{null==i||i(o)}):null==i||i(o)}),N(()=>{var t;const i=null===(t=null==e?void 0:e.onUnmounted)||void 0===t?void 0:t.call(e);i instanceof Promise?i.then(()=>{null==n||n(o)}):null==n||n(o)}),Ke({})}const et=e=>X(`[vue-kunlun]: ${e}`),tt={handle:{type:String},dslDefinition:{type:Object},slotName:{type:String},inline:{type:Boolean,default:void 0},slotContext:{type:Object}};var it;!function(e){e.Action="Action",e.Field="Field",e.Element="Element",e.View="View",e.Mask="Mask"}(it||(it={}));let nt=class ViewWidget extends DslNodeWidget{constructor(){super(...arguments),this.loading=!1,this.currentRoute={},this.domain="",this.isRootView=!0,this.isDialogView=!1,this.selfHandleStr="",this.model=null,this.type="UNKNOWN",this.initQueryParams=null}getVM(){return this.$$vm}setVM(e){this.$$vm=e}setBusy(e){this.getVM().setBusy(e)}getUrlParams(){const{page:e={}}=J().matched.segmentParams;return e}getBusy(){return this.loading}initialize(e){return null==e.isRootView&&(e.isRootView=!0),super.initialize(e),this.isRootView=e.isRootView||!1,e.view&&(this.view=e.view),null==this.rootHandleStr&&e.isRootWidget&&(this.currentRootHandlerStr=this.getHandle()),this.selfHandleStr=this.getHandle(),this.isDialogView=e.isDialogView||!1,this.model=e.model,this.setVM(new h({view:e.view,dslNode:e.dslNode,model:e.model,isRootWidget:!1!==e.isRootWidget||e.isRootWidget,isDialogView:e.isDialogView||!1,isRootView:e.isRootView})),this.getVM().isRootWidget=this.isRoot,this.getVM().isDialogView=this.isDialogView,this}get rootHandleStr(){return this.currentRootHandlerStr||this.parentRootHandlerStr}on(e,t){this.getVM().on(e,t)}watch(e,t){this.getVM().watch(e,t)}filterWatchData(e,t,i){return this.getVM().filterWatchData(e,t,i)}get isRoot(){return this.rootHandleStr===this.getHandle()}get useConstruct(){return this.isRoot||this.isDialogView}get viewElement(){return H(this.dslNode)}resolveTemplate(){}fetchData(e,t,i){return{}}onRowsChange(e){}loadData(e,t){return{}}loadRootData(e){this.getVM().setRootData(e)}setRootDataByKey(e,t){const i=this.getVM().getRootData();i&&(i[e]=t,this.getVM().setRootData(i))}submit(){return{}}getData(){return this.getVM().getData()}setData(e){this.getVM().setData(e)}validator(){return ne(this,void 0,void 0,function*(){return[]})}loadMetadata(e,t,i,n){this.getVM().loadMetadata(e,t,i,n),this.model=this.getVM().getModel(),this.view=this.getVM().getView(),this.dslNode||(this.dslNode=t||this.getVM().getDslNode())}getActiveRecords(){return[]}setDomain(e){this.domain=e}getDomain(){return this.domain}setFilter(e){this.filter=e}getFilter(){return this.filter}getModel(){return this.getVM().getModel()}getView(){return this.getVM().getView()}getPath(){return this.path}notify(e){this.getVM().notify(e)}$$beforeCreated(){const{initQueryParams:e="{}"}=this.getUrlParams();try{const t=JSON.parse(e);this.initQueryParams=Object.keys(t).length?t:null}catch(e){this.initQueryParams=null}this.notify(ee.ON_VIEW_BEFORE_CREATED)}$$created(){this.notify(ee.ON_VIEW_CREATED)}$$beforeMount(){this.notify(ee.ON_VIEW_BEFORE_MOUNT)}$$mounted(){this.getVM().setPageViewState("mount"),this.getVM().watchLoading(e=>{this.loading=e});const{getMatched$:e}=J();this.subjectRoute$=e().subscribe(e=>{this.currentRoute=e}),this.notify(ee.ON_VIEW_MOUNTED)}$$beforeUpdate(){this.notify(ee.ON_VIEW_BEFORE_UPDATE)}$$updated(){this.notify(ee.ON_VIEW_UPDATED)}$$beforeUnmount(){this.notify(ee.ON_VIEW_BEFORE_UNMOUNT)}$$unmounted(){this.getVM().setPageViewState("unmount");const e=setTimeout(()=>{"unmount"===this.getVM().getPageViewState()&&(this.notify(ee.ON_VIEW_UNMOUNTED),this.getVM().unsubscribe()),clearTimeout(e)})}};te([Widget.Reactive(),ie("design:type",Object)],nt.prototype,"loading",void 0),te([Widget.Inject(),Widget.Reactive(),ie("design:type",String)],nt.prototype,"filter",void 0),te([Widget.Reactive(),Widget.Inject("rootHandleStr"),ie("design:type",Object)],nt.prototype,"parentRootHandlerStr",void 0),te([Widget.Reactive(),ie("design:type",Object)],nt.prototype,"currentRootHandlerStr",void 0),te([Widget.Reactive(),Widget.Provide(),ie("design:type",Object),ie("design:paramtypes",[])],nt.prototype,"rootHandleStr",null),te([Widget.Reactive(),ie("design:type",Object)],nt.prototype,"isRootView",void 0),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],nt.prototype,"isRoot",null),te([Widget.Reactive(),ie("design:type",Object),ie("design:paramtypes",[])],nt.prototype,"useConstruct",null),te([Widget.Provide(),ie("design:type",Object)],nt.prototype,"selfHandleStr",void 0),te([Widget.Reactive(),Widget.Provide("view"),ie("design:type",Object)],nt.prototype,"view",void 0),te([Widget.Reactive(),Widget.Provide("viewModel"),ie("design:type",Object)],nt.prototype,"model",void 0),te([Widget.Reactive(),ie("design:type",String)],nt.prototype,"path",void 0),nt=te([Y.Base("View",["id","name","type","model","widget","tagName"])],nt);const ot=Symbol("view");export{ActiveRecordsWidget,AsyncVueWidget,Ve as DEFAULT_TAG_PREFIX,DslDefinitionWidget,DslNodeWidget,DslRender,DslRenderWidget,it as InnerWidgetType,PathWidget,Ie as RENDER_OPTIONS_KEY,Ne as SLOTS_KEY,He as SLOT_CONTEXT_KEY,ot as ViewSubSymbol,nt as ViewWidget,VueWidget,Widget,tt as WidgetTagProps,xe as componentInstall,ve as defaultMetaContext,Be as directiveInstall,We as executeInvisible,et as genToken,Fe as getWidget,ze as getWidgetNotNull,he as hasActionBarViewState,pe as hasFieldsViewState,ge as hasRowActionBarViewState,be as isAllInvisible,de as isDetailViewState,se as isFormViewState,ae as isGalleryViewState,le as isListViewState,ue as isObjectViewState,re as isSearchViewState,oe as isTableViewState,ce as isTreeViewState,Te as newVueWidget,Je as onAllMounted,ke as pluginInstall,Ue as renderWidgets,Ye as reportAllMounted,me as useInjectMetaContext,Me as useOioState,ye as useProviderMetaContext};
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { type ActiveRecord, type ActiveRecords, type DeleteActiveRecordsByEntityFunction, type DeleteActiveRecordsByEntityPredict, type DeleteActiveRecordsFunction, type FlushActiveRecordsFunction, type PushActiveRecordsFunction, type PushActiveRecordsPredict, type ReloadActiveRecordsFunction, SubmitCacheManager, type UpdateActiveRecordsByEntityFunction, type UpdateActiveRecordsByEntityPredict, type UpdateActiveRecordsFunction, type UpdateEntity } from '@oinone/kunlun-engine';
|
|
2
|
-
import { type OioAnyViewState } from '../state';
|
|
2
|
+
import { type OioAnyViewState, OioGlobalState } from '../state';
|
|
3
3
|
import { PathWidget, type PathWidgetProps } from './PathWidget';
|
|
4
4
|
export interface ActiveRecordsWidgetProps extends PathWidgetProps {
|
|
5
5
|
dataSource?: ActiveRecords | null;
|
|
6
6
|
activeRecords?: ActiveRecords;
|
|
7
|
+
isInitViewState?: boolean;
|
|
8
|
+
viewState?: OioAnyViewState;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* 数据记录组件
|
|
10
12
|
*/
|
|
11
13
|
export declare class ActiveRecordsWidget<Props extends ActiveRecordsWidgetProps = ActiveRecordsWidgetProps> extends PathWidget<Props> {
|
|
14
|
+
/**
|
|
15
|
+
* 全局状态,在 beforeMounted 后可获取到有效值
|
|
16
|
+
* @protected
|
|
17
|
+
*/
|
|
18
|
+
protected globalState: OioGlobalState | undefined;
|
|
19
|
+
getGlobalState(): OioGlobalState | undefined;
|
|
20
|
+
setGlobalState(state: OioGlobalState): void;
|
|
21
|
+
protected isInitViewState?: boolean;
|
|
12
22
|
/**
|
|
13
23
|
* 视图级别状态, 在 beforeMounted 后可获取到有效值
|
|
14
24
|
* @protected
|
|
@@ -11,6 +11,7 @@ export interface RenderPosition {
|
|
|
11
11
|
}
|
|
12
12
|
export interface OioGlobalState {
|
|
13
13
|
fullscreen: boolean;
|
|
14
|
+
disabledRelationQuery?: boolean;
|
|
14
15
|
mainViewHandle?: string;
|
|
15
16
|
getMainViewState(): OioAnyViewState | undefined;
|
|
16
17
|
}
|
|
@@ -70,6 +71,7 @@ export interface OioDetailViewState extends OioViewState {
|
|
|
70
71
|
actionBar?: OioActionBarState;
|
|
71
72
|
actionBars?: Record<string, OioActionBarState>;
|
|
72
73
|
detail?: string;
|
|
74
|
+
disabledRelationQuery?: boolean;
|
|
73
75
|
fields?: string[];
|
|
74
76
|
fieldWidgets?: Record<string, string>;
|
|
75
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/kunlun-vue-widget",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/oinone-kunlun-vue-widget.esm.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"postpublish": "node ../../../../scripts/postpublish.cjs"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@oinone/kunlun-vue-ui-common": "7.
|
|
18
|
+
"@oinone/kunlun-vue-ui-common": "7.2.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@oinone/kunlun-config": "~7.
|
|
22
|
-
"@oinone/kunlun-dsl": "~7.
|
|
23
|
-
"@oinone/kunlun-engine": "~7.
|
|
24
|
-
"@oinone/kunlun-event": "~7.
|
|
25
|
-
"@oinone/kunlun-meta": "~7.
|
|
26
|
-
"@oinone/kunlun-router": "~7.
|
|
27
|
-
"@oinone/kunlun-shared": "~7.
|
|
28
|
-
"@oinone/kunlun-spi": "~7.
|
|
29
|
-
"@oinone/kunlun-state": "~7.
|
|
21
|
+
"@oinone/kunlun-config": "~7.2.0",
|
|
22
|
+
"@oinone/kunlun-dsl": "~7.2.0",
|
|
23
|
+
"@oinone/kunlun-engine": "~7.2.0",
|
|
24
|
+
"@oinone/kunlun-event": "~7.2.0",
|
|
25
|
+
"@oinone/kunlun-meta": "~7.2.0",
|
|
26
|
+
"@oinone/kunlun-router": "~7.2.0",
|
|
27
|
+
"@oinone/kunlun-shared": "~7.2.0",
|
|
28
|
+
"@oinone/kunlun-spi": "~7.2.0",
|
|
29
|
+
"@oinone/kunlun-state": "~7.2.0",
|
|
30
30
|
"@types/lodash": "4.17.21",
|
|
31
31
|
"@types/lodash-es": "4.17.6",
|
|
32
32
|
"lodash": "4.17.21",
|
package/src/basic/VueWidget.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
watch,
|
|
22
22
|
withCtx
|
|
23
23
|
} from 'vue';
|
|
24
|
+
import { useInjectMetaContext, useProviderMetaContext } from '../state';
|
|
24
25
|
import VueFragment from './VueFragment.vue';
|
|
25
26
|
import { Widget } from './Widget';
|
|
26
27
|
|
|
@@ -767,6 +768,7 @@ export class VueWidget<Props extends WidgetProps = WidgetProps> extends Widget<P
|
|
|
767
768
|
this.$$beforeCreated();
|
|
768
769
|
this.beforeCreated();
|
|
769
770
|
this.behaviorGroup[BehaviorName.created]?.();
|
|
771
|
+
this.$$metaContextProvide();
|
|
770
772
|
this.$$created();
|
|
771
773
|
this.created();
|
|
772
774
|
return {};
|
|
@@ -875,6 +877,17 @@ export class VueWidget<Props extends WidgetProps = WidgetProps> extends Widget<P
|
|
|
875
877
|
*/
|
|
876
878
|
protected created() {}
|
|
877
879
|
|
|
880
|
+
/**
|
|
881
|
+
* @internal
|
|
882
|
+
*/
|
|
883
|
+
protected $$metaContextProvide() {
|
|
884
|
+
const metaContext = useInjectMetaContext();
|
|
885
|
+
useProviderMetaContext({
|
|
886
|
+
...metaContext,
|
|
887
|
+
parentHandle: computed(() => this.getHandle())
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
|
|
878
891
|
/**
|
|
879
892
|
* @internal
|
|
880
893
|
*/
|
|
@@ -17,12 +17,14 @@ import {
|
|
|
17
17
|
type UpdateEntity
|
|
18
18
|
} from '@oinone/kunlun-engine';
|
|
19
19
|
import { Widget } from '../basic';
|
|
20
|
-
import { type OioAnyViewState, useOioState } from '../state';
|
|
20
|
+
import { type OioAnyViewState, OioGlobalState, useOioState } from '../state';
|
|
21
21
|
import { PathWidget, type PathWidgetProps } from './PathWidget';
|
|
22
22
|
|
|
23
23
|
export interface ActiveRecordsWidgetProps extends PathWidgetProps {
|
|
24
24
|
dataSource?: ActiveRecords | null;
|
|
25
25
|
activeRecords?: ActiveRecords;
|
|
26
|
+
isInitViewState?: boolean;
|
|
27
|
+
viewState?: OioAnyViewState;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -31,6 +33,22 @@ export interface ActiveRecordsWidgetProps extends PathWidgetProps {
|
|
|
31
33
|
export class ActiveRecordsWidget<
|
|
32
34
|
Props extends ActiveRecordsWidgetProps = ActiveRecordsWidgetProps
|
|
33
35
|
> extends PathWidget<Props> {
|
|
36
|
+
/**
|
|
37
|
+
* 全局状态,在 beforeMounted 后可获取到有效值
|
|
38
|
+
* @protected
|
|
39
|
+
*/
|
|
40
|
+
protected globalState: OioGlobalState | undefined;
|
|
41
|
+
|
|
42
|
+
public getGlobalState(): OioGlobalState | undefined {
|
|
43
|
+
return this.globalState;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public setGlobalState(state: OioGlobalState) {
|
|
47
|
+
this.globalState = state;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
protected isInitViewState?: boolean;
|
|
51
|
+
|
|
34
52
|
/**
|
|
35
53
|
* 视图级别状态, 在 beforeMounted 后可获取到有效值
|
|
36
54
|
* @protected
|
|
@@ -47,9 +65,13 @@ export class ActiveRecordsWidget<
|
|
|
47
65
|
|
|
48
66
|
public initialize(props: Props) {
|
|
49
67
|
super.initialize(props);
|
|
50
|
-
const { dataSource, activeRecords } = props;
|
|
68
|
+
const { dataSource, activeRecords, viewState } = props;
|
|
51
69
|
this.setCurrentDataSource(dataSource);
|
|
52
70
|
this.setCurrentActiveRecords(activeRecords);
|
|
71
|
+
if (viewState) {
|
|
72
|
+
this.isInitViewState = props.isInitViewState ?? true;
|
|
73
|
+
this.setViewState(viewState);
|
|
74
|
+
}
|
|
53
75
|
return this;
|
|
54
76
|
}
|
|
55
77
|
|
|
@@ -587,8 +609,16 @@ export class ActiveRecordsWidget<
|
|
|
587
609
|
protected $$beforeMount() {
|
|
588
610
|
super.$$beforeMount();
|
|
589
611
|
let isInitStatePosition = false;
|
|
590
|
-
if (
|
|
591
|
-
this.
|
|
612
|
+
if (this.viewState) {
|
|
613
|
+
if (this.isInitViewState) {
|
|
614
|
+
isInitStatePosition = true;
|
|
615
|
+
this.$$initViewStatePosition(this.viewState);
|
|
616
|
+
this.$$initViewState(this.viewState);
|
|
617
|
+
}
|
|
618
|
+
} else {
|
|
619
|
+
const { globalState, viewState } = useOioState();
|
|
620
|
+
this.globalState = globalState;
|
|
621
|
+
this.viewState = viewState;
|
|
592
622
|
if (this.viewState) {
|
|
593
623
|
isInitStatePosition = true;
|
|
594
624
|
this.$$initViewStatePosition(this.viewState);
|
package/src/shim-translate.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export {};
|
|
|
2
2
|
|
|
3
3
|
declare module 'vue' {
|
|
4
4
|
interface ComponentCustomProperties {
|
|
5
|
-
$translate<T extends string | null | undefined = string | null | undefined>(
|
|
5
|
+
$translate<T extends string | null | undefined = string | null | undefined>(
|
|
6
|
+
text: T,
|
|
7
|
+
context?: Record<string, unknown>
|
|
8
|
+
): T;
|
|
6
9
|
}
|
|
7
10
|
}
|
package/src/state/context.ts
CHANGED
|
@@ -53,5 +53,9 @@ export const useProviderMetaContext = (state: Partial<MetaContext>): void => {
|
|
|
53
53
|
* 获取元数据上下文
|
|
54
54
|
*/
|
|
55
55
|
export const useInjectMetaContext = (): MetaContext => {
|
|
56
|
-
|
|
56
|
+
const res = inject(MetaContextKey, defaultMetaContext);
|
|
57
|
+
if (!res) {
|
|
58
|
+
return { ...defaultMetaContext };
|
|
59
|
+
}
|
|
60
|
+
return res;
|
|
57
61
|
};
|
package/src/state/typing.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface RenderPosition {
|
|
|
15
15
|
|
|
16
16
|
export interface OioGlobalState {
|
|
17
17
|
fullscreen: boolean;
|
|
18
|
+
disabledRelationQuery?: boolean;
|
|
18
19
|
|
|
19
20
|
mainViewHandle?: string;
|
|
20
21
|
|
|
@@ -85,6 +86,7 @@ export interface OioDetailViewState extends OioViewState {
|
|
|
85
86
|
actionBar?: OioActionBarState;
|
|
86
87
|
actionBars?: Record<string, OioActionBarState>;
|
|
87
88
|
detail?: string;
|
|
89
|
+
disabledRelationQuery?: boolean;
|
|
88
90
|
fields?: string[];
|
|
89
91
|
fieldWidgets?: Record<string, string>;
|
|
90
92
|
}
|
package/src/state/view.ts
CHANGED
|
@@ -31,7 +31,7 @@ export function createViewState(handle: string): OioAnyViewState {
|
|
|
31
31
|
|
|
32
32
|
export function getViewState(handle?: string): OioAnyViewState | undefined {
|
|
33
33
|
if (!handle) {
|
|
34
|
-
handle = useInjectMetaContext()
|
|
34
|
+
handle = useInjectMetaContext().rootHandle.value;
|
|
35
35
|
if (!handle) {
|
|
36
36
|
console.warn('Invalid root handle.');
|
|
37
37
|
return undefined;
|
|
@@ -46,7 +46,7 @@ export function setViewState(state: OioAnyViewState): void {
|
|
|
46
46
|
|
|
47
47
|
export function clearViewState(handle?: string): OioAnyViewState | undefined {
|
|
48
48
|
if (!handle) {
|
|
49
|
-
handle = useInjectMetaContext()
|
|
49
|
+
handle = useInjectMetaContext().rootHandle.value;
|
|
50
50
|
if (!handle) {
|
|
51
51
|
console.warn('Invalid root handle.');
|
|
52
52
|
return undefined;
|