@smallstack/components
Advanced tools
Comparing version 0.3.23 to 0.3.24
import { IConfigurationField } from "@smallstack/common"; | ||
import { EventSocket } from "@smallstack/events"; | ||
import { Navigation } from "@smallstack/navigation"; | ||
export interface PossibleValues { | ||
@@ -16,3 +15,2 @@ value: any; | ||
configurations?: IConfigurationField[]; | ||
navigation?: Navigation[]; | ||
}): any; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@smallstack/common"),require("@smallstack/events"),require("rxjs"),require("underscore")):"function"==typeof define&&define.amd?define(["exports","@smallstack/common","@smallstack/events","rxjs","underscore"],e):e(t["@smallstack/common"]={},t["@smallstack/common"],t.events,t.rxjs,t._)}(this,function(t,e,n,o,i){"use strict";function r(t){void 0===t&&(t={createCollections:!0,registerModels:!0,registerServices:!0,registerTypes:!0}),e.IOC.onRegister("typesystem",function(n){!0===t.registerTypes&&n.addType(e.Type.fromDocument({model:{name:"ComponentInstance",schema:[{name:"name",type:"string"},{name:"children",type:"ComponentInstance[]",optional:!0,defaultValue:[]},{name:"data",type:"any",optional:!0}]},packageName:"@smallstack/components"})),!0===t.registerModels&&e.IOC.register("ComponentInstance",l)})}var s=function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};!function(t){t.VIEW="view",t.EDITABLE="editable"}(t.ComponentRenderMode||(t.ComponentRenderMode={}));var a=function(){function i(){var e=this;this.componentInstance$=new o.BehaviorSubject(void 0),this.renderMode=t.ComponentRenderMode.VIEW,this.renderMode$=new o.BehaviorSubject(t.ComponentRenderMode.VIEW),this.initialized=!1,this.componentInstance$.subscribe(function(t){return e.componentInstance=t}),this.renderMode$.subscribe(function(t){return e.renderMode=t})}return i.prototype.init=function(t){var o=this;this.initialized&&e.Logger.warning("BaseComponent","Initializing BaseComponentController twice!"),this.componentInstance$.next(t);var i=this.getComponentSockets();if(i instanceof Array&&i.length>0)for(var r=function(t){t.direction===n.EventSocket.enums.direction.IN&&s.eventService.registerSocketConnectionHandler(s.componentInstance._id,t.name,function(e){o.onSocketEvent(t.name,e)})},s=this,c=0,a=i;c<a.length;c++){r(a[c])}this.initialized=!0,"function"==typeof this.afterInitialization?(e.Logger.info("BaseComponent","Executing afterInitialization method!"),this.afterInitialization()):e.Logger.warning("BaseComponent","No afterInitialization method found!"),e.Logger.info("BaseComponent","Initialized component : "+this.getComponentName()+"["+this.componentInstance._id+"]")},i.prototype.getData=function(t){if(this.componentInstance&&this.componentInstance.data&&void 0!==this.componentInstance.data[t])return this.componentInstance.data[t]},i.prototype.setData=function(t,e){if(void 0===this.componentInstance)throw new Error("componentInstance not set in BaseComponent!");void 0===this.componentInstance.data&&(this.componentInstance.data={}),this.componentInstance.data[t]=e},i.prototype.sendOutput=function(t,n){e.Logger.info("BaseComponent","Sending data:",{componentInstanceId:this.componentInstance._id,socketName:t,socketData:n}),this.eventService.dispatchSocketEvent(this.componentInstance._id,t,n)},i.prototype.getComponentSockets=function(){return this.constructor.componentSockets},i.prototype.getComponentName=function(){return this.constructor.componentName},i.prototype.getComponentConfigurations=function(){return this.constructor.componentConfigurations},s([e.Autowired(),c("design:type",n.EventService)],i.prototype,"eventService",void 0),i}(),p=function(){function t(){this.components={}}return t.instance=function(){return e.IOC.get("componentsRegistry")},t.register=function(t,n){e.IOC.onRegister("componentsRegistry",function(e){e.register(t,n)})},t.prototype.register=function(t,n){e.Logger.debug("ComponentsRegistry","Registered component: "+t),this.components[t]=n},t.prototype.getAllComponentNames=function(){return i.keys(this.components)},t.prototype.getAllComponents=function(){return i.values(this.components)},t.prototype.getComponentByName=function(t){var e=this.components[t];if(e)return e;throw new Error("ComponentsRegistry - Could not find component by name: "+t)},t.prototype.isRegistered=function(t){return void 0!==this.components[t]},t.prototype.getComponentsByType=function(t){return i.reject(this.components,function(e){return e.getType()!==t})},t.prototype.getComponentsByTypes=function(t){return i.filter(this.components,function(e){return-1!==t.indexOf(e.getType())})},t}();!function(t){t[t.ANGULAR=0]="ANGULAR",t[t.REACT=1]="REACT",t[t.INVISIBLE=2]="INVISIBLE",t[t.CMS=3]="CMS"}(t.ComponentType||(t.ComponentType={}));var u=function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f=function(){function t(){this.children=[],this._hasSubDocuments=!1,this._isStored=!1}return t.fromDocument=function(t){if(void 0===t||null===t)throw new Error("doc cannot be undefined/null while calling GeneratedComponentInstance.fromDocument(doc)!");var e=new l;return void 0!==t._id&&(e._isStored=!0,e._id=t._id),void 0!==t.name&&(e.name=t.name),t.children instanceof Array&&(e.children=[],i.each(t.children,function(t){e.children.push(l.fromDocument(t))})),void 0!==t.data&&(e.data=t.data),e},t.prototype.toDocument=function(){var t={};return t.name=this.name,t.children=[],i.each(this.children,function(e){"function"==typeof e.toDocument?t.children.push(e.toDocument()):t.children.push(e)}),t.data=this.data,this.isStored()&&(t._id=this._id),JSON.parse(JSON.stringify(t))},t.prototype.clone=function(){return l.fromDocument(this.toDocument())},t.prototype.saveSnapshot=function(){this._snapshot=this.toDocument()},t.prototype.restoreSnapshot=function(){if(!this._snapshot)throw new Error("Could not restore snapshot of model since no snapshot was saved before!");i.extend(this,this._snapshot)},t.prototype.hasSubDocuments=function(){return this._hasSubDocuments},t.prototype.isStored=function(){return this._isStored},t.getModelName=function(){return"ComponentInstance"},t.prototype.getModelName=function(){return"ComponentInstance"},t.prototype.getForeignLabel=function(){return this.getModelName()+" ID:"+this._id},t.getModelClass=function(){return e.IOC.get("ComponentInstance")},t.prototype.getModelClass=function(){return e.IOC.get("ComponentInstance")},t.asType=function(){return e.Typesystem.instance().getTypeByModelName("ComponentInstance")},u([e.Autowired(),m("design:type",Object)],t.prototype,"dataBridge",void 0),t}(),d=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return d(e,t),e}(f);t.BaseComponent=a,t.ComponentConfiguration=function(t){return function(o,i){if(t){if(!t.componentName)throw new Error("No componentName given in @ComponentConfiguration decorator!");if(!new RegExp(/^[A-Z]{1}[a-zA-Z]{3,}$/g).test(t.componentName))throw new Error("ComponentName must start with a capital letter, has to be at least 4 characters long and can only contain characters, got: "+t.componentName);if(o.componentName=t.componentName,e.IOC.onRegister("componentsRegistry",function(e){e.register(t.componentName,o)}),t.sockets||(t.sockets=[]),o.componentSockets=t.sockets,"function"==typeof o.prototype.setComponentSockets&&o.prototype.setComponentSockets(t.sockets),t.configurations||(t.configurations=[]),o.componentConfigurations=t.configurations,void 0!==o.__annotations__&&o.__annotations__ instanceof Array&&o.__annotations__.length>0)for(var r=0,s=o.__annotations__;r<s.length;r++){var c=s[r];if(c&&"Component"===c.ngMetadataName){if(t.sockets instanceof Array&&t.sockets.length>0){void 0===c.inputs&&(c.inputs=[]),void 0===c.outputs&&(c.outputs=[]);for(var a=0,p=t.sockets;a<p.length;a++){var u=p[a];u.direction===n.EventSocket.enums.direction.IN?c.inputs.push("sockets_input_"+u.name+":"+u.name):u.direction===n.EventSocket.enums.direction.OUT&&c.outputs.push("sockets_output_"+u.name+":"+u.name)}}void 0===c.selector&&(c.selector=t.componentName)}}}else e.Logger.warning("ComponentConfiguration","No options given!")}},t.ComponentsRegistry=p,t.initComponentsPackage=function(){e.IOC.register("componentsRegistry",new p)},t.initializeSmallstackComponentsPackage=function(t){void 0===t&&(t={createCollections:!0,registerModels:!0,registerServices:!0,registerTypes:!0}),r(t)},t.initializeComponentInstances=r,t.ComponentInstance=l,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@smallstack/common"),require("@smallstack/events"),require("rxjs"),require("underscore")):"function"==typeof define&&define.amd?define(["exports","@smallstack/common","@smallstack/events","rxjs","underscore"],e):e(t["@smallstack/common"]={},t["@smallstack/common"],t.events,t.rxjs,t._)}(this,function(n,p,u,o,i){"use strict";var t,e=function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;0<=c;c--)(i=t[c])&&(s=(r<3?i(s):3<r?i(e,n,s):i(e,n))||s);return 3<r&&s&&Object.defineProperty(e,n,s),s},r=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};(t=n.ComponentRenderMode||(n.ComponentRenderMode={})).VIEW="view",t.EDITABLE="editable";var s=function(){function t(){var e=this;this.componentInstance$=new o.BehaviorSubject(void 0),this.renderMode=n.ComponentRenderMode.VIEW,this.renderMode$=new o.BehaviorSubject(n.ComponentRenderMode.VIEW),this.initialized=!1,this.componentInstance$.subscribe(function(t){return e.componentInstance=t}),this.renderMode$.subscribe(function(t){return e.renderMode=t})}return t.prototype.init=function(t){var n=this;this.initialized&&p.Logger.warning("BaseComponent","Initializing BaseComponentController twice!"),this.componentInstance$.next(t);var e=this.getComponentSockets();if(e instanceof Array&&0<e.length)for(var o=function(e){e.direction===u.EventSocket.enums.direction.IN&&i.eventService.registerSocketConnectionHandler(i.componentInstance._id,e.name,function(t){n.onSocketEvent(e.name,t)})},i=this,r=0,s=e;r<s.length;r++){o(s[r])}this.initialized=!0,"function"==typeof this.afterInitialization?(p.Logger.info("BaseComponent","Executing afterInitialization method!"),this.afterInitialization()):p.Logger.warning("BaseComponent","No afterInitialization method found!"),p.Logger.info("BaseComponent","Initialized component : "+this.getComponentName()+"["+this.componentInstance._id+"]")},t.prototype.getData=function(t){if(this.componentInstance&&this.componentInstance.data&&void 0!==this.componentInstance.data[t])return this.componentInstance.data[t]},t.prototype.setData=function(t,e){if(void 0===this.componentInstance)throw new Error("componentInstance not set in BaseComponent!");void 0===this.componentInstance.data&&(this.componentInstance.data={}),this.componentInstance.data[t]=e},t.prototype.sendOutput=function(t,e){p.Logger.info("BaseComponent","Sending data:",{componentInstanceId:this.componentInstance._id,socketName:t,socketData:e}),this.eventService.dispatchSocketEvent(this.componentInstance._id,t,e)},t.prototype.getComponentSockets=function(){return this.constructor.componentSockets},t.prototype.getComponentName=function(){return this.constructor.componentName},t.prototype.getComponentConfigurations=function(){return this.constructor.componentConfigurations},e([p.Autowired(),r("design:type",u.EventService)],t.prototype,"eventService",void 0),t}();var c,a=function(){function t(){this.components={}}return t.instance=function(){return p.IOC.get("componentsRegistry")},t.register=function(e,n){p.IOC.onRegister("componentsRegistry",function(t){t.register(e,n)})},t.prototype.register=function(t,e){p.Logger.debug("ComponentsRegistry","Registered component: "+t),this.components[t]=e},t.prototype.getAllComponentNames=function(){return i.keys(this.components)},t.prototype.getAllComponents=function(){return i.values(this.components)},t.prototype.getComponentByName=function(t){var e=this.components[t];if(e)return e;throw new Error("ComponentsRegistry - Could not find component by name: "+t)},t.prototype.isRegistered=function(t){return void 0!==this.components[t]},t.prototype.getComponentsByType=function(e){return i.reject(this.components,function(t){return t.getType()!==e})},t.prototype.getComponentsByTypes=function(e){return i.filter(this.components,function(t){return-1!==e.indexOf(t.getType())})},t}();(c=n.ComponentType||(n.ComponentType={}))[c.ANGULAR=0]="ANGULAR",c[c.REACT=1]="REACT",c[c.INVISIBLE=2]="INVISIBLE",c[c.CMS=3]="CMS";var m,f=function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;0<=c;c--)(i=t[c])&&(s=(r<3?i(s):3<r?i(e,n,s):i(e,n))||s);return 3<r&&s&&Object.defineProperty(e,n,s),s},d=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l=function(){function t(){this.children=[],this._hasSubDocuments=!1,this._isStored=!1}return t.fromDocument=function(t){if(null==t)throw new Error("doc cannot be undefined/null while calling GeneratedComponentInstance.fromDocument(doc)!");var e=new g;return void 0!==t._id&&(e._isStored=!0,e._id=t._id),void 0!==t.name&&(e.name=t.name),t.children instanceof Array&&(e.children=[],i.each(t.children,function(t){e.children.push(g.fromDocument(t))})),void 0!==t.data&&(e.data=t.data),e},t.prototype.toDocument=function(){var e={};return e.name=this.name,e.children=[],i.each(this.children,function(t){"function"==typeof t.toDocument?e.children.push(t.toDocument()):e.children.push(t)}),e.data=this.data,this.isStored()&&(e._id=this._id),JSON.parse(JSON.stringify(e))},t.prototype.clone=function(){return g.fromDocument(this.toDocument())},t.prototype.saveSnapshot=function(){this._snapshot=this.toDocument()},t.prototype.restoreSnapshot=function(){if(!this._snapshot)throw new Error("Could not restore snapshot of model since no snapshot was saved before!");i.extend(this,this._snapshot)},t.prototype.hasSubDocuments=function(){return this._hasSubDocuments},t.prototype.isStored=function(){return this._isStored},t.getModelName=function(){return"ComponentInstance"},t.prototype.getModelName=function(){return"ComponentInstance"},t.prototype.getForeignLabel=function(){return this.getModelName()+" ID:"+this._id},t.getModelClass=function(){return p.IOC.get("ComponentInstance")},t.prototype.getModelClass=function(){return p.IOC.get("ComponentInstance")},t.asType=function(){return p.Typesystem.instance().getTypeByModelName("ComponentInstance")},f([p.Autowired(),d("design:type",Object)],t.prototype,"dataBridge",void 0),t}(),h=(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},function(t,e){function n(){this.constructor=t}m(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e}(l);function y(e){void 0===e&&(e={createCollections:!0,registerModels:!0,registerServices:!0,registerTypes:!0}),p.IOC.onRegister("typesystem",function(t){!0===e.registerTypes&&t.addType(p.Type.fromDocument({model:{name:"ComponentInstance",schema:[{name:"name",type:"string"},{name:"children",type:"ComponentInstance[]",optional:!0,defaultValue:[]},{name:"data",type:"any",optional:!0}]},packageName:"@smallstack/components"})),!0===e.registerModels&&p.IOC.register("ComponentInstance",g)})}n.BaseComponent=s,n.ComponentConfiguration=function(a){return function(e,t){if(a){if(!a.componentName)throw new Error("No componentName given in @ComponentConfiguration decorator!");if(!new RegExp(/^[A-Z]{1}[a-zA-Z]{3,}$/g).test(a.componentName))throw new Error("ComponentName must start with a capital letter, has to be at least 4 characters long and can only contain characters, got: "+a.componentName);if(e.componentName=a.componentName,p.IOC.onRegister("componentsRegistry",function(t){t.register(a.componentName,e)}),a.sockets||(a.sockets=[]),e.componentSockets=a.sockets,"function"==typeof e.prototype.setComponentSockets&&e.prototype.setComponentSockets(a.sockets),a.configurations||(a.configurations=[]),e.componentConfigurations=a.configurations,void 0!==e.__annotations__&&e.__annotations__ instanceof Array&&0<e.__annotations__.length)for(var n=0,o=e.__annotations__;n<o.length;n++){var i=o[n];if(i&&"Component"===i.ngMetadataName){if(a.sockets instanceof Array&&0<a.sockets.length){void 0===i.inputs&&(i.inputs=[]),void 0===i.outputs&&(i.outputs=[]);for(var r=0,s=a.sockets;r<s.length;r++){var c=s[r];c.direction===u.EventSocket.enums.direction.IN?i.inputs.push("sockets_input_"+c.name+":"+c.name):c.direction===u.EventSocket.enums.direction.OUT&&i.outputs.push("sockets_output_"+c.name+":"+c.name)}}void 0===i.selector&&(i.selector=a.componentName)}}}else p.Logger.warning("ComponentConfiguration","No options given!")}},n.ComponentsRegistry=a,n.initComponentsPackage=function(){p.IOC.register("componentsRegistry",new a)},n.initializeSmallstackComponentsPackage=function(t){void 0===t&&(t={createCollections:!0,registerModels:!0,registerServices:!0,registerTypes:!0}),y(t)},n.initializeComponentInstances=y,n.ComponentInstance=g,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@smallstack/components", | ||
"version": "0.3.23", | ||
"version": "0.3.24", | ||
"description": "Base functionality for smallstack components", | ||
@@ -36,8 +36,7 @@ "main": "dist/bundle/index.umd.js", | ||
"dependencies": { | ||
"@smallstack/common": "^0.7.73", | ||
"@smallstack/common": "^0.7.110", | ||
"@smallstack/events": "^0.1.1", | ||
"@smallstack/i18n": "^0.4.18", | ||
"@smallstack/navigation": "0.0.4", | ||
"rxjs": "^6.3.3", | ||
"underscore": "^1.9.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
4
45216
201
+ Addedrxjs@^6.3.3
- Removed@smallstack/i18n@^0.4.18
- Removed@smallstack/navigation@0.0.4
- Removed@smallstack/files@0.3.3(transitive)
- Removed@smallstack/i18n@0.4.380.5.1(transitive)
- Removed@smallstack/oms-common@0.3.14(transitive)
- Removed@smallstack/user@0.3.47(transitive)
- Removedrxjs-compat@6.6.7(transitive)
Updated@smallstack/common@^0.7.110