| @@ -1,35 +1,35 | |||
| 
             | 
        1 | 1 | { | 
| 
             | 
        2 | 2 | "name": "@implab/djx", | 
| 
             | 
        3 | 3 | "version": "0.0.1-dev", | 
| 
             | 
        4 | 4 | "description": "Supports using dojo version 1 with typescript and .tsx files", | 
| 
             | 
        5 | 5 | "keywords": [ | 
| 
             | 
        6 | 6 | "dojo", | 
| 
             | 
        7 | 7 | "tsx", | 
| 
             | 
        8 | 8 | "typescript", | 
| 
             | 
        9 | 9 | "widgets" | 
| 
             | 
        10 | 10 | ], | 
| 
             | 
        11 | 11 | "author": "Implab team", | 
| 
             | 
        12 | 12 | "license": "BSD-2-Clause", | 
| 
             | 
        13 | 13 | "repository": "https://code.implab.org/implab/implabjs-djx", | 
| 
             | 
        14 | 14 | "publishConfig": { | 
| 
             | 
        15 | 15 | "access": "public" | 
| 
             | 
        16 | 16 | }, | 
| 
             | 
        17 | 17 | "peerDependencies": { | 
| 
             | 
        18 | 18 | "@implab/core-amd": "^1.4.0", | 
| 
             | 
        19 | 19 | "dojo": "^1.10.0" | 
| 
             | 
        20 | 20 | }, | 
| 
             | 
        21 | 21 | "devDependencies": { | 
| 
             | 
        22 | 22 | "@implab/core-amd": "^1.4.0", | 
| 
             | 
        23 | 23 | "@types/chai": "4.1.3", | 
| 
             | 
        24 | 24 | "@types/requirejs": "2.1.31", | 
| 
             | 
        25 | 25 | "@types/yaml": "1.2.0", | 
| 
             | 
        26 | 26 | "chai": "4.2.0", | 
| 
             | 
        27 | 27 | "dojo": "1.16.0", | 
| 
             | 
        28 | 28 | "dojo-typings": "~1.11.9", | 
| 
             | 
        29 | 29 | "eslint": "6.8.0", | 
| 
             | 
        30 | 30 | "requirejs": "2.3.6", | 
| 
             | 
        31 | 31 | "tslint": "^6.1.3", | 
| 
             | 
        32 | 
            
                     "typescript": "4. | 
    |
| 
             | 
        32 | "typescript": "4.2.4", | |
| 
             | 
        33 | 33 | "yaml": "~1.7.2" | 
| 
             | 
        34 | 34 | } | 
| 
             | 
        35 | 35 | } | 
| @@ -1,29 +1,32 | |||
| 
             | 
        1 | 1 | import { argumentNotNull } from "@implab/core-amd/safe"; | 
| 
             | 
        2 | 2 | import { RenditionBase } from "./RenditionBase"; | 
| 
             | 
        3 | 3 | |
| 
             | 
        4 | 4 | export class FunctionRendition extends RenditionBase<Node> { | 
| 
             | 
        5 | 
            
                 private _component: ( | 
    |
| 
             | 
        5 | private _component: (...args: any[]) => any; | |
| 
             | 
        6 | 6 | |
| 
             | 
        7 | 7 | private _node: Node | undefined; | 
| 
             | 
        8 | 8 | |
| 
             | 
        9 | 
            
                 constructor(component: ( | 
    |
| 
             | 
        9 | constructor(component: (...args: any[]) => any) { | |
| 
             | 
        10 | 10 | super(); | 
| 
             | 
        11 | 11 | argumentNotNull(component, "component"); | 
| 
             | 
        12 | 12 | |
| 
             | 
        13 | 13 | this._component = component; | 
| 
             | 
        14 | 14 | } | 
| 
             | 
        15 | 15 | |
| 
             | 
        16 | _create(attrs: object, children: any[]) { | |
| 
             | 
        16 | protected _create(attrs: object, children: any[]) { | |
| 
             | 
        17 | 17 | const _attrs: any = attrs || {}; | 
| 
             | 
        18 | 
            
                      | 
    |
| 
             | 
        19 | ||
| 
             | 
        20 | this._node = this.getItemDom(this._component.call(null, _attrs)); | |
| 
             | 
        18 | const _children = children.map(x => this.getItemDom(x)); | |
| 
             | 
        19 | this._node = this.getItemDom( | |
| 
             | 
        20 | this._component.length === 2 ? | |
| 
             | 
        21 | this._component.call(null, { ..._attrs }, _children) : | |
| 
             | 
        22 | this._component.call(null, { ..._attrs, children: _children }) | |
| 
             | 
        23 | ); | |
| 
             | 
        21 | 24 | } | 
| 
             | 
        22 | 25 | |
| 
             | 
        23 | _getDomNode() { | |
| 
             | 
        26 | protected _getDomNode() { | |
| 
             | 
        24 | 27 | if (!this._node) | 
| 
             | 
        25 | 28 | throw new Error("The instance of the widget isn't created"); | 
| 
             | 
        26 | 29 | return this._node; | 
| 
             | 
        27 | 30 | } | 
| 
             | 
        28 | 31 | |
| 
             | 
        29 | 32 | } | 
        
        General Comments 0
    
    
  
  
                      You need to be logged in to leave comments.
                      Login now
                    
                