@smallstack/components
Advanced tools
Comparing version 0.3.20 to 0.3.21
@@ -1,3 +0,4 @@ | ||
import { IConfigurationField, NavigationEntry } from "@smallstack/common"; | ||
import { IConfigurationField } from "@smallstack/common"; | ||
import { EventSocket } from "@smallstack/events"; | ||
import { Navigation } from "@smallstack/navigation"; | ||
export interface PossibleValues { | ||
@@ -15,3 +16,3 @@ value: any; | ||
configurations?: IConfigurationField[]; | ||
navigation?: NavigationEntry[]; | ||
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("@smallstack/i18n"),require("underscore")):"function"==typeof define&&define.amd?define(["exports","@smallstack/common","@smallstack/events","@smallstack/i18n","underscore"],e):e(t["@smallstack/common"]={},t["@smallstack/common"],t.events,t.i18n,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)},a=function(){function t(){this.data={},this.initialized=!1}return t.prototype.init=function(t){var o=this;this.initialized&&e.Logger.warning("BaseComponent","Initializing BaseComponentController twice!"),t&&(t.componentId&&(this.componentId=t.componentId),t.data&&(this.data=t.data));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.componentId,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.componentId+"]")},t.prototype.getData=function(t){if(this.data&&void 0!==this.data[t])return this.data[t]},t.prototype.sendOutput=function(t,n){e.Logger.info("BaseComponent","Sending data:",{componentInstanceId:this.componentId,socketName:t,socketData:n}),this.eventService.dispatchSocketEvent(this.componentId,t,n)},t.prototype.t=function(t,e){return this.localizationService.t(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},s([e.Autowired(),c("design:type",Object)],t.prototype,"notificationService",void 0),s([e.Autowired(),c("design:type",n.EventService)],t.prototype,"eventService",void 0),s([e.Autowired(),c("design:type",Object)],t.prototype,"dataBridge",void 0),s([e.Autowired(),c("design:type",o.LocalizationService)],t.prototype,"localizationService",void 0),t}(),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,t.navigation instanceof Array&&t.navigation.length>0&&e.IOC.onRegister("navigationService",function(e){for(var n=0,i=t.navigation;n<i.length;n++){var r=i[n];void 0===r.getComponent()&&r.setComponent(o),e.addNavigationEntry(r)}}),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("@smallstack/i18n"),require("underscore")):"function"==typeof define&&define.amd?define(["exports","@smallstack/common","@smallstack/events","@smallstack/i18n","underscore"],e):e(t["@smallstack/common"]={},t["@smallstack/common"],t.events,t.i18n,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)},a=function(){function t(){this.data={},this.initialized=!1}return t.prototype.init=function(t){var o=this;this.initialized&&e.Logger.warning("BaseComponent","Initializing BaseComponentController twice!"),t&&(t.componentId&&(this.componentId=t.componentId),t.data&&(this.data=t.data));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.componentId,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.componentId+"]")},t.prototype.getData=function(t){if(this.data&&void 0!==this.data[t])return this.data[t]},t.prototype.sendOutput=function(t,n){e.Logger.info("BaseComponent","Sending data:",{componentInstanceId:this.componentId,socketName:t,socketData:n}),this.eventService.dispatchSocketEvent(this.componentId,t,n)},t.prototype.t=function(t,e){return this.localizationService.t(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},s([e.Autowired(),c("design:type",Object)],t.prototype,"notificationService",void 0),s([e.Autowired(),c("design:type",n.EventService)],t.prototype,"eventService",void 0),s([e.Autowired(),c("design:type",Object)],t.prototype,"dataBridge",void 0),s([e.Autowired(),c("design:type",o.LocalizationService)],t.prototype,"localizationService",void 0),t}(),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})}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@smallstack/components", | ||
"version": "0.3.20", | ||
"version": "0.3.21", | ||
"description": "Base functionality for smallstack components", | ||
@@ -36,7 +36,8 @@ "main": "dist/bundle/index.umd.js", | ||
"dependencies": { | ||
"@smallstack/common": "^0.7.57", | ||
"@smallstack/common": "^0.7.73", | ||
"@smallstack/events": "^0.1.1", | ||
"@smallstack/i18n": "^0.4.12", | ||
"underscore": "^1.8.3" | ||
"@smallstack/i18n": "^0.4.18", | ||
"@smallstack/navigation": "0.0.4", | ||
"underscore": "^1.9.1" | ||
} | ||
} |
@@ -16,3 +16,3 @@ { | ||
"name": "data", | ||
"type": "any", | ||
"type": "ObjectDictionary", | ||
"optional": true | ||
@@ -19,0 +19,0 @@ } |
Sorry, the diff of this file is not supported yet
45537
5
+ Added@smallstack/navigation@0.0.4
Updated@smallstack/common@^0.7.73
Updated@smallstack/i18n@^0.4.18
Updatedunderscore@^1.9.1