@@ -58,9 +58,9 | |||
|
58 | 58 | "dev": true |
|
59 | 59 | }, |
|
60 | 60 | "acorn": { |
|
61 |
"version": "7. |
|
|
62 |
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7. |
|
|
63 | "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", | |
|
61 | "version": "7.4.0", | |
|
62 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", | |
|
63 | "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", | |
|
64 | 64 | "dev": true |
|
65 | 65 | }, |
|
66 | 66 | "acorn-jsx": { |
@@ -697,9 +697,9 | |||
|
697 | 697 | } |
|
698 | 698 | }, |
|
699 | 699 | "lodash": { |
|
700 |
"version": "4.17. |
|
|
701 |
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17. |
|
|
702 | "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", | |
|
700 | "version": "4.17.20", | |
|
701 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", | |
|
702 | "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", | |
|
703 | 703 | "dev": true |
|
704 | 704 | }, |
|
705 | 705 | "mimic-fn": { |
@@ -717,19 +717,21 | |||
|
717 | 717 | "brace-expansion": "^1.1.7" |
|
718 | 718 | } |
|
719 | 719 | }, |
|
720 | "minimist": { | |
|
721 | "version": "0.0.8", | |
|
722 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", | |
|
723 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", | |
|
724 | "dev": true | |
|
725 | }, | |
|
726 | 720 | "mkdirp": { |
|
727 |
"version": "0.5. |
|
|
728 |
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5. |
|
|
729 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", | |
|
721 | "version": "0.5.5", | |
|
722 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", | |
|
723 | "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", | |
|
730 | 724 | "dev": true, |
|
731 | 725 | "requires": { |
|
732 |
"minimist": " |
|
|
726 | "minimist": "^1.2.5" | |
|
727 | }, | |
|
728 | "dependencies": { | |
|
729 | "minimist": { | |
|
730 | "version": "1.2.5", | |
|
731 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | |
|
732 | "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | |
|
733 | "dev": true | |
|
734 | } | |
|
733 | 735 | } |
|
734 | 736 | }, |
|
735 | 737 | "ms": { |
@@ -858,9 +860,9 | |||
|
858 | 860 | "dev": true |
|
859 | 861 | }, |
|
860 | 862 | "resolve": { |
|
861 |
"version": "1.1 |
|
|
862 |
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1 |
|
|
863 | "integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==", | |
|
863 | "version": "1.17.0", | |
|
864 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", | |
|
865 | "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", | |
|
864 | 866 | "dev": true, |
|
865 | 867 | "requires": { |
|
866 | 868 | "path-parse": "^1.0.6" |
@@ -1086,9 +1088,9 | |||
|
1086 | 1088 | "dev": true |
|
1087 | 1089 | }, |
|
1088 | 1090 | "tslint": { |
|
1089 |
"version": "6. |
|
|
1090 |
"resolved": "https://registry.npmjs.org/tslint/-/tslint-6. |
|
|
1091 | "integrity": "sha512-9nLya8GBtlFmmFMW7oXXwoXS1NkrccqTqAtwXzdPV9e2mqSEvCki6iHL/Fbzi5oqbugshzgGPk7KBb2qNP1DSA==", | |
|
1091 | "version": "6.1.3", | |
|
1092 | "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", | |
|
1093 | "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", | |
|
1092 | 1094 | "dev": true, |
|
1093 | 1095 | "requires": { |
|
1094 | 1096 | "@babel/code-frame": "^7.0.0", |
@@ -1099,10 +1101,10 | |||
|
1099 | 1101 | "glob": "^7.1.1", |
|
1100 | 1102 | "js-yaml": "^3.13.1", |
|
1101 | 1103 | "minimatch": "^3.0.4", |
|
1102 |
"mkdirp": "^0.5. |
|
|
1104 | "mkdirp": "^0.5.3", | |
|
1103 | 1105 | "resolve": "^1.3.2", |
|
1104 | 1106 | "semver": "^5.3.0", |
|
1105 |
"tslib": "^1.1 |
|
|
1107 | "tslib": "^1.13.0", | |
|
1106 | 1108 | "tsutils": "^2.29.0" |
|
1107 | 1109 | }, |
|
1108 | 1110 | "dependencies": { |
@@ -1111,6 +1113,12 | |||
|
1111 | 1113 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", |
|
1112 | 1114 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", |
|
1113 | 1115 | "dev": true |
|
1116 | }, | |
|
1117 | "tslib": { | |
|
1118 | "version": "1.13.0", | |
|
1119 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", | |
|
1120 | "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", | |
|
1121 | "dev": true | |
|
1114 | 1122 | } |
|
1115 | 1123 | } |
|
1116 | 1124 | }, |
@@ -1145,9 +1153,9 | |||
|
1145 | 1153 | "dev": true |
|
1146 | 1154 | }, |
|
1147 | 1155 | "typescript": { |
|
1148 |
"version": " |
|
|
1149 |
"resolved": "https://registry.npmjs.org/typescript/-/typescript- |
|
|
1150 | "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", | |
|
1156 | "version": "4.0.2", | |
|
1157 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz", | |
|
1158 | "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==", | |
|
1151 | 1159 | "dev": true |
|
1152 | 1160 | }, |
|
1153 | 1161 | "uri-js": { |
@@ -19,16 +19,16 | |||
|
19 | 19 | "@implab/core-amd": "^1.3.2" |
|
20 | 20 | }, |
|
21 | 21 | "devDependencies": { |
|
22 | "@implab/core-amd": "^1.3.2", | |
|
23 | "@types/chai": "4.1.3", | |
|
22 | 24 | "@types/requirejs": "2.1.31", |
|
23 | "dojo": "1.16.0", | |
|
24 | "typescript": "~3.8.3", | |
|
25 | "eslint": "6.8.0", | |
|
26 | "tslint": "6.0.0", | |
|
27 | "@implab/core-amd": "^1.3.2", | |
|
28 | "yaml": "~1.7.2", | |
|
29 | 25 | "@types/yaml": "1.2.0", |
|
30 | 26 | "chai": "4.2.0", |
|
31 |
" |
|
|
32 | "dojo-typings": "~1.11.9" | |
|
27 | "dojo": "1.16.0", | |
|
28 | "dojo-typings": "~1.11.9", | |
|
29 | "eslint": "6.8.0", | |
|
30 | "tslint": "^6.1.3", | |
|
31 | "typescript": "4.0.2", | |
|
32 | "yaml": "~1.7.2" | |
|
33 | 33 | } |
|
34 | 34 | } |
@@ -6,8 +6,26 import registry = require("dijit/registr | |||
|
6 | 6 | |
|
7 | 7 | // type Handle = dojo.Handle; |
|
8 | 8 | |
|
9 | export interface EventArgs { | |
|
10 | bubbles?: boolean; | |
|
11 | ||
|
12 | cancelable?: boolean; | |
|
13 | ||
|
14 | composed?: boolean; | |
|
15 | } | |
|
16 | ||
|
17 | export interface DjxWidgetBase<Attrs = any, Events extends { [name in keyof Events]: Event } = any> { | |
|
18 | set<K extends keyof Attrs & string>(key: K, value: Attrs[K]): this; | |
|
19 | set(props: Partial<Attrs>): this; | |
|
20 | get<K extends keyof Attrs & string>(key: K): Attrs[K]; | |
|
21 | ||
|
22 | on<K extends keyof Events & string>(eventName: K, cb: (evt: Events[K]) => void): dojo.WatchHandle; | |
|
23 | ||
|
24 | emit<K extends keyof Events & string>(eventName: K, evt: Omit<Events[K], keyof Event> & EventArgs ): void; | |
|
25 | } | |
|
26 | ||
|
9 | 27 | @djclass |
|
10 | export abstract class DjxWidgetBase extends djbase(_WidgetBase, _AttachMixin) { | |
|
28 | export abstract class DjxWidgetBase<Attrs = any, Events = any> extends djbase(_WidgetBase, _AttachMixin) { | |
|
11 | 29 | |
|
12 | 30 | buildRendering() { |
|
13 | 31 | this.domNode = this.render().getDomNode(); |
@@ -8,3 +8,18 declare namespace JSX { | |||
|
8 | 8 | [name: string]: any; |
|
9 | 9 | } |
|
10 | 10 | } |
|
11 | ||
|
12 | declare namespace dijit { | |
|
13 | interface _WidgetBase { | |
|
14 | ||
|
15 | _started?: boolean; | |
|
16 | ||
|
17 | _set<K extends keyof this>(key: K, value: this[K]): void; | |
|
18 | } | |
|
19 | ||
|
20 | interface TooltipDialog { | |
|
21 | ||
|
22 | content: any; | |
|
23 | ||
|
24 | } | |
|
25 | } No newline at end of file |
@@ -1,11 +1,23 | |||
|
1 | import { djbase, djclass, bind, prototype } from "../declare"; | |
|
1 | import { djbase, djclass, bind, prototype, AbstractConstructor } from "../declare"; | |
|
2 | 2 | |
|
3 | 3 | import { DjxWidgetBase } from "../tsx/DjxWidgetBase"; |
|
4 | 4 | import { createElement } from "../tsx"; |
|
5 | 5 | |
|
6 | interface MyWidgetAttrs { | |
|
7 | title: string; | |
|
8 | ||
|
9 | counter: number; | |
|
10 | } | |
|
11 | ||
|
12 | interface MyWidgetEvents { | |
|
13 | "count-inc": Event; | |
|
14 | ||
|
15 | "count-dec": Event; | |
|
16 | } | |
|
17 | ||
|
6 | 18 | |
|
7 | 19 | @djclass |
|
8 | export class MyWidget extends djbase(DjxWidgetBase) { | |
|
20 | export class MyWidget extends djbase(DjxWidgetBase as AbstractConstructor<DjxWidgetBase<MyWidgetAttrs, MyWidgetEvents>>) { | |
|
9 | 21 | |
|
10 | 22 | @bind({node: "titleNode", type:"innerHTML"}) |
|
11 | 23 | title = ""; |
@@ -16,7 +28,16 export class MyWidget extends djbase(Djx | |||
|
16 | 28 | render() { |
|
17 | 29 | return <div> |
|
18 | 30 | <h1 data-dojo-attach-point="titleNode"></h1> |
|
31 | <span onclick={() => this._onIncClick()}>[+]</span> | |
|
32 | <span onclick={() => this._onDecClick()}>[-]</span> | |
|
19 | 33 | </div>; |
|
20 | 34 | } |
|
21 | 35 | |
|
36 | _onIncClick() { | |
|
37 | this.emit("count-inc", { bubbles: false } ); | |
|
22 | 38 | } |
|
39 | ||
|
40 | _onDecClick() { | |
|
41 | this.emit("count-dec", { bubbles: false } ); | |
|
42 | } | |
|
43 | } |
General Comments 0
You need to be logged in to leave comments.
Login now