##// END OF EJS Templates
Compatibility with dojo-typings package
cin -
r21:b1e622a3b266 default
parent child
Show More
@@ -1,241 +1,242
1 import declare = require("dojo/_base/declare");
1 import declare = require("dojo/_base/declare");
2 import { each } from "@implab/core-amd/safe";
2 import { each } from "@implab/core-amd/safe";
3 import { Constructor } from "@implab/core-amd/interfaces";
3 import { Constructor } from "@implab/core-amd/interfaces";
4 import dojo = require("dojo/_base/kernel");
4
5
5 // declare const declare: any;
6 // declare const declare: any;
6
7
7 type DeclareConstructor<T> = declare.DeclareConstructor<T>;
8 type DeclareConstructor<T> = dojo._base.DeclareConstructor<T>;
8
9
9 export interface AbstractConstructor<T = {}> {
10 export interface AbstractConstructor<T = {}> {
10 prototype: T;
11 prototype: T;
11 }
12 }
12
13
13 interface DjMockConstructor<T = {}> {
14 interface DjMockConstructor<T = {}> {
14 new(...args: any[]): T;
15 new(...args: any[]): T;
15 mock: boolean;
16 mock: boolean;
16 base: AbstractConstructor;
17 base: AbstractConstructor;
17 }
18 }
18
19
19 export function djbase<T>(
20 export function djbase<T>(
20 b0: AbstractConstructor<T>
21 b0: AbstractConstructor<T>
21 ): DeclareConstructor<T>;
22 ): DeclareConstructor<T>;
22
23
23 export function djbase<T0, T1>(
24 export function djbase<T0, T1>(
24 b0: AbstractConstructor<T0>,
25 b0: AbstractConstructor<T0>,
25 b1: AbstractConstructor<T1>
26 b1: AbstractConstructor<T1>
26 ): DeclareConstructor<T0 & T1>;
27 ): DeclareConstructor<T0 & T1>;
27
28
28 export function djbase<T0, T1, T2>(
29 export function djbase<T0, T1, T2>(
29 b0: AbstractConstructor<T0>,
30 b0: AbstractConstructor<T0>,
30 b1: AbstractConstructor<T1>,
31 b1: AbstractConstructor<T1>,
31 b2: AbstractConstructor<T2>
32 b2: AbstractConstructor<T2>
32 ): DeclareConstructor<T0 & T1 & T2>;
33 ): DeclareConstructor<T0 & T1 & T2>;
33
34
34 export function djbase<T0, T1, T2, T3>(
35 export function djbase<T0, T1, T2, T3>(
35 b0: AbstractConstructor<T0>,
36 b0: AbstractConstructor<T0>,
36 b1: AbstractConstructor<T1>,
37 b1: AbstractConstructor<T1>,
37 b2: AbstractConstructor<T2>,
38 b2: AbstractConstructor<T2>,
38 b3: AbstractConstructor<T3>
39 b3: AbstractConstructor<T3>
39 ): DeclareConstructor<T0 & T1 & T2 & T3>;
40 ): DeclareConstructor<T0 & T1 & T2 & T3>;
40
41
41 export function djbase<T0, T1, T2, T3, T4>(
42 export function djbase<T0, T1, T2, T3, T4>(
42 b0: AbstractConstructor<T0>,
43 b0: AbstractConstructor<T0>,
43 b1: AbstractConstructor<T1>,
44 b1: AbstractConstructor<T1>,
44 b2: AbstractConstructor<T2>,
45 b2: AbstractConstructor<T2>,
45 b3: AbstractConstructor<T3>,
46 b3: AbstractConstructor<T3>,
46 b4: AbstractConstructor<T4>
47 b4: AbstractConstructor<T4>
47 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4>;
48 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4>;
48
49
49 export function djbase<T0, T1, T2, T3, T4, T5>(
50 export function djbase<T0, T1, T2, T3, T4, T5>(
50 b0: AbstractConstructor<T0>,
51 b0: AbstractConstructor<T0>,
51 b1: AbstractConstructor<T1>,
52 b1: AbstractConstructor<T1>,
52 b2: AbstractConstructor<T2>,
53 b2: AbstractConstructor<T2>,
53 b3: AbstractConstructor<T3>,
54 b3: AbstractConstructor<T3>,
54 b4: AbstractConstructor<T4>,
55 b4: AbstractConstructor<T4>,
55 b5: AbstractConstructor<T5>
56 b5: AbstractConstructor<T5>
56 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5>;
57 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5>;
57
58
58 export function djbase<T0, T1, T2, T3, T4, T5, T6>(
59 export function djbase<T0, T1, T2, T3, T4, T5, T6>(
59 b0: AbstractConstructor<T0>,
60 b0: AbstractConstructor<T0>,
60 b1: AbstractConstructor<T1>,
61 b1: AbstractConstructor<T1>,
61 b2: AbstractConstructor<T2>,
62 b2: AbstractConstructor<T2>,
62 b3: AbstractConstructor<T3>,
63 b3: AbstractConstructor<T3>,
63 b4: AbstractConstructor<T4>,
64 b4: AbstractConstructor<T4>,
64 b5: AbstractConstructor<T5>,
65 b5: AbstractConstructor<T5>,
65 b6: AbstractConstructor<T6>
66 b6: AbstractConstructor<T6>
66 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6>;
67 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6>;
67
68
68 export function djbase<T0, T1, T2, T3, T4, T5, T6, T7>(
69 export function djbase<T0, T1, T2, T3, T4, T5, T6, T7>(
69 b0: AbstractConstructor<T0>,
70 b0: AbstractConstructor<T0>,
70 b1: AbstractConstructor<T1>,
71 b1: AbstractConstructor<T1>,
71 b2: AbstractConstructor<T2>,
72 b2: AbstractConstructor<T2>,
72 b3: AbstractConstructor<T3>,
73 b3: AbstractConstructor<T3>,
73 b4: AbstractConstructor<T4>,
74 b4: AbstractConstructor<T4>,
74 b5: AbstractConstructor<T5>,
75 b5: AbstractConstructor<T5>,
75 b6: AbstractConstructor<T6>,
76 b6: AbstractConstructor<T6>,
76 b7: AbstractConstructor<T7>
77 b7: AbstractConstructor<T7>
77 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7>;
78 ): DeclareConstructor<T0 & T1 & T2 & T3 & T4 & T5 & T6 & T7>;
78
79
79 /** Π‘ΠΎΠ·Π΄Π°Π΅Ρ‚ конструктор-Π·Π°Π³Π»ΡƒΡˆΠΊΡƒ ΠΈΠ· списка Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классов, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ
80 /** Π‘ΠΎΠ·Π΄Π°Π΅Ρ‚ конструктор-Π·Π°Π³Π»ΡƒΡˆΠΊΡƒ ΠΈΠ· списка Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классов, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ
80 * для объявлСния классов ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`.
81 * для объявлСния классов ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`.
81 *
82 *
82 * Π‘ΠΎΠ·Π΄Π°Π΅Ρ‚ пустой конструтор, с пустым стандартным ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏΠΎΠΌ, это Π½ΡƒΠΆΠ½ΠΎ,
83 * Π‘ΠΎΠ·Π΄Π°Π΅Ρ‚ пустой конструтор, с пустым стандартным ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏΠΎΠΌ, это Π½ΡƒΠΆΠ½ΠΎ,
83 * ΠΏΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ Π² унаслСдованном классС конструктор ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎ Π΄ΠΎΠ»ΠΆΠ΅Π½ Π²Ρ‹Π·Π²Π°Ρ‚ΡŒ
84 * ΠΏΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ Π² унаслСдованном классС конструктор ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎ Π΄ΠΎΠ»ΠΆΠ΅Π½ Π²Ρ‹Π·Π²Π°Ρ‚ΡŒ
84 * `super(...)`, Ρ‚Π°ΠΊΠΈΠΌ ΠΎΠ±Ρ€Π°Π·ΠΎΠΌ ΠΎΠ½ Π²Ρ‹Π·ΠΎΠ²Π΅Ρ‚ ΠΏΡƒΡΡ‚ΡƒΡŽ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ.
85 * `super(...)`, Ρ‚Π°ΠΊΠΈΠΌ ΠΎΠ±Ρ€Π°Π·ΠΎΠΌ ΠΎΠ½ Π²Ρ‹Π·ΠΎΠ²Π΅Ρ‚ ΠΏΡƒΡΡ‚ΡƒΡŽ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ.
85 *
86 *
86 * Π‘ΠΎΠ·Π΄Π°Π½Π½Ρ‹ΠΉ конструтор Ρ…Ρ€Π°Π½ΠΈΡ‚ Π² сСбС список Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классов, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π±ΡƒΠ΄Π΅Ρ‚
87 * Π‘ΠΎΠ·Π΄Π°Π½Π½Ρ‹ΠΉ конструтор Ρ…Ρ€Π°Π½ΠΈΡ‚ Π² сСбС список Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классов, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π±ΡƒΠ΄Π΅Ρ‚
87 * использован Π΄Π΅ΠΊΠΎΡ€Π°Ρ‚ΠΎΡ€ΠΎΠΌ `djclass`, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π²Π΅Ρ€Π½Π΅Ρ‚ класс, ΠΎΠ±ΡŠΡΠ²Π»Π΅Π½Π½Ρ‹ΠΉ ΠΏΡ€ΠΈ
88 * использован Π΄Π΅ΠΊΠΎΡ€Π°Ρ‚ΠΎΡ€ΠΎΠΌ `djclass`, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π²Π΅Ρ€Π½Π΅Ρ‚ класс, ΠΎΠ±ΡŠΡΠ²Π»Π΅Π½Π½Ρ‹ΠΉ ΠΏΡ€ΠΈ
88 * ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`.
89 * ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`.
89 *
90 *
90 * @param bases список Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классов, ΠΎΡ‚ ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… трСбуСтся ΡƒΠ½Π°ΡΠ»Π΅Π΄ΠΎΠ²Π°Ρ‚ΡŒ
91 * @param bases список Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классов, ΠΎΡ‚ ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… трСбуСтся ΡƒΠ½Π°ΡΠ»Π΅Π΄ΠΎΠ²Π°Ρ‚ΡŒ
91 * Π½ΠΎΠ²Ρ‹ΠΉ класс.
92 * Π½ΠΎΠ²Ρ‹ΠΉ класс.
92 *
93 *
93 */
94 */
94 export function djbase(...bases: any[]): Constructor {
95 export function djbase(...bases: any[]): Constructor {
95
96
96 const t = class {
97 const t = class {
97 static mock: boolean;
98 static mock: boolean;
98 static base: AbstractConstructor;
99 static base: AbstractConstructor;
99 };
100 };
100
101
101 t.mock = true;
102 t.mock = true;
102 t.base = declare(bases);
103 t.base = declare(bases);
103
104
104 return t as any;
105 return t as any;
105 }
106 }
106
107
107 function isMockConstructor<T extends {}>(v: AbstractConstructor<T>): v is DjMockConstructor<T> {
108 function isMockConstructor<T extends {}>(v: AbstractConstructor<T>): v is DjMockConstructor<T> {
108 return v && "mock" in v;
109 return v && "mock" in v;
109 }
110 }
110
111
111 /** Π‘ΠΎΠ·Π΄Π°Π΅Ρ‚ класс ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`. Для этого исходный класс
112 /** Π‘ΠΎΠ·Π΄Π°Π΅Ρ‚ класс ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`. Для этого исходный класс
112 * Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±Ρ‹Ρ‚ΡŒ унаслСдован ΠΎΡ‚ `djbase(...)`.
113 * Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±Ρ‹Ρ‚ΡŒ унаслСдован ΠΎΡ‚ `djbase(...)`.
113 *
114 *
114 * @param target Класс, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π½ΡƒΠΆΠ½ΠΎ ΠΎΠ±ΡŠΡΠ²ΠΈΡ‚ΡŒ ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`
115 * @param target Класс, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π½ΡƒΠΆΠ½ΠΎ ΠΎΠ±ΡŠΡΠ²ΠΈΡ‚ΡŒ ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ `dojo/_base/declare`
115 */
116 */
116 export function djclass<T extends AbstractConstructor>(target: T): T {
117 export function djclass<T extends AbstractConstructor>(target: T): T {
117 // ΠΏΠΎΠ»ΡƒΡ‡Π°Π΅ΠΌ Π±Π°Π·ΠΎΠ²Ρ‹ΠΉ конструктор ΠΈ Π΅Π³ΠΎ ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏ
118 // ΠΏΠΎΠ»ΡƒΡ‡Π°Π΅ΠΌ Π±Π°Π·ΠΎΠ²Ρ‹ΠΉ конструктор ΠΈ Π΅Π³ΠΎ ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏ
118 let bp = target && target.prototype && Object.getPrototypeOf(target.prototype);
119 let bp = target && target.prototype && Object.getPrototypeOf(target.prototype);
119 const bc = bp && bp.constructor;
120 const bc = bp && bp.constructor;
120
121
121 // ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Ρ‚ΠΎΠ³ΠΎ, Ρ‡Ρ‚ΠΎ класс унаслСдован ΠΎΡ‚ ΡΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½ΠΎΠΉ Π·Π°Π³Π»ΡƒΡˆΠΊΠΈ
122 // ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Ρ‚ΠΎΠ³ΠΎ, Ρ‡Ρ‚ΠΎ класс унаслСдован ΠΎΡ‚ ΡΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½ΠΎΠΉ Π·Π°Π³Π»ΡƒΡˆΠΊΠΈ
122 if (isMockConstructor(bc)) {
123 if (isMockConstructor(bc)) {
123 // t - Π±Π°Π·ΠΎΠ²Ρ‹ΠΉ класс, ΠΎΠ±ΡŠΡΠ²Π»Π΅Π½Π½Ρ‹ΠΉ ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ dojo/_base/declare
124 // t - Π±Π°Π·ΠΎΠ²Ρ‹ΠΉ класс, ΠΎΠ±ΡŠΡΠ²Π»Π΅Π½Π½Ρ‹ΠΉ ΠΏΡ€ΠΈ ΠΏΠΎΠΌΠΎΡ‰ΠΈ dojo/_base/declare
124 const t = bc.base;
125 const t = bc.base;
125
126
126 // bc - Π±Π°Π·ΠΎΠ²Ρ‹ΠΉ класс, bc.prototype ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ ΠΊΠ°ΠΊ super
127 // bc - Π±Π°Π·ΠΎΠ²Ρ‹ΠΉ класс, bc.prototype ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ ΠΊΠ°ΠΊ super
127 // ΠΏΡ€ΠΈ Π²Ρ‹Π·ΠΎΠ²Π΅ Π±Π°Π·ΠΎΠ²Ρ‹Ρ… ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ². НуТно ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ bc.prototype
128 // ΠΏΡ€ΠΈ Π²Ρ‹Π·ΠΎΠ²Π΅ Π±Π°Π·ΠΎΠ²Ρ‹Ρ… ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ². НуТно ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ bc.prototype
128 // Ρ‚Π°ΠΊΠΈΠΌ ΠΎΠ±Ρ€Π°Π·ΠΎΠΌ, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΎΠ½ Π²Ρ‹Π·Ρ‹Π²Π°Π» this.inherited().
129 // Ρ‚Π°ΠΊΠΈΠΌ ΠΎΠ±Ρ€Π°Π·ΠΎΠΌ, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΎΠ½ Π²Ρ‹Π·Ρ‹Π²Π°Π» this.inherited().
129
130
130 // создаСм Π½ΠΎΠ²Ρ‹ΠΉ ΠΏΠΎΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏ, ΠΎΠ½ Π½Π΅ Π² Ρ†Π΅ΠΏΠΎΡ‡ΠΊΠ΅ ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏΠΎΠ² Ρƒ Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ
131 // создаСм Π½ΠΎΠ²Ρ‹ΠΉ ΠΏΠΎΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏ, ΠΎΠ½ Π½Π΅ Π² Ρ†Π΅ΠΏΠΎΡ‡ΠΊΠ΅ ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏΠΎΠ² Ρƒ Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ
131 // класса, Π½ΠΎ super.some_method Π±ΡƒΠ΄Π΅Ρ‚ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ ΠΈΠΌΠ΅Π½Π½ΠΎ Π΅Π³ΠΎ.
132 // класса, Π½ΠΎ super.some_method Π±ΡƒΠ΄Π΅Ρ‚ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ ΠΈΠΌΠ΅Π½Π½ΠΎ Π΅Π³ΠΎ.
132 // Π² этом ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π΅ Π±ΡƒΠ΄ΡƒΡ‚ Ρ€Π°Π·ΠΌΠ΅Ρ‰Π΅Π½Ρ‹ прокси для ΠΏΠ΅Ρ€Π΅ΠΎΠΏΡ€Π΅Π΄Π΅Π»Π΅Π½Π½Ρ‹Ρ…
133 // Π² этом ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π΅ Π±ΡƒΠ΄ΡƒΡ‚ Ρ€Π°Π·ΠΌΠ΅Ρ‰Π΅Π½Ρ‹ прокси для ΠΏΠ΅Ρ€Π΅ΠΎΠΏΡ€Π΅Π΄Π΅Π»Π΅Π½Π½Ρ‹Ρ…
133 // ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ².
134 // ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ².
134 bp = bc.prototype = Object.create(t.prototype);
135 bp = bc.prototype = Object.create(t.prototype);
135 bp.constructor = bc;
136 bp.constructor = bc;
136
137
137 // proxy - Ρ„Π°Π±Ρ€ΠΈΠΊΠ° для создания прокси-ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π²Π½ΡƒΡ‚Ρ€ΠΈ
138 // proxy - Ρ„Π°Π±Ρ€ΠΈΠΊΠ° для создания прокси-ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π²Π½ΡƒΡ‚Ρ€ΠΈ
138 // сСбя Π²Ρ‹Π·ΠΎΠ²ΡƒΡ‚ this.inherited с ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½Ρ‹ΠΌΠΈ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Π°ΠΌΠΈ.
139 // сСбя Π²Ρ‹Π·ΠΎΠ²ΡƒΡ‚ this.inherited с ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½Ρ‹ΠΌΠΈ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Π°ΠΌΠΈ.
139 const proxy = (m: (...args: any[]) => any) => function (this: any) {
140 const proxy = (m: (...args: any[]) => any) => function (this: any) {
140 const f = this.getInherited({ callee: m });
141 const f = this.getInherited({ callee: m });
141 return f && f.apply(this, arguments);
142 return f && f.apply(this, arguments);
142
143
143 // Ρ‚Π°ΠΊ ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ ΠΌΠΎΠΆΠ½ΠΎ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ dojo 1.15+
144 // Ρ‚Π°ΠΊ ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ ΠΌΠΎΠΆΠ½ΠΎ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ dojo 1.15+
144 // return this.inherited(m, arguments);
145 // return this.inherited(m, arguments);
145 };
146 };
146
147
147 // Ρƒ Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ класса ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏ содСрТит ΠΌΠ΅Ρ‚ΠΎΠ΄Ρ‹, ΠΎΠ±ΡŠΡΠ²Π»Π΅Π½Π½Ρ‹Π΅ Π² этом
148 // Ρƒ Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ класса ΠΏΡ€ΠΎΡ‚ΠΎΡ‚ΠΈΠΏ содСрТит ΠΌΠ΅Ρ‚ΠΎΠ΄Ρ‹, ΠΎΠ±ΡŠΡΠ²Π»Π΅Π½Π½Ρ‹Π΅ Π² этом
148 // классС ΠΈ Π΅Π³ΠΎ конструктор. НуТно ΠΏΡ€ΠΎΠΉΡ‚ΠΈ ΠΏΠΎ всСм ΠΌΠ΅Ρ‚ΠΎΠ΄Π°ΠΌ ΠΈ
149 // классС ΠΈ Π΅Π³ΠΎ конструктор. НуТно ΠΏΡ€ΠΎΠΉΡ‚ΠΈ ΠΏΠΎ всСм ΠΌΠ΅Ρ‚ΠΎΠ΄Π°ΠΌ ΠΈ
149 // ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ для Π½ΠΈΡ… прокси.
150 // ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ для Π½ΠΈΡ… прокси.
150 // ΠŸΡ€ΠΈ этом Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Ρ‚Π΅, ΠΌΠ΅Ρ‚ΠΎΠ΄Ρ‹, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π΅ΡΡ‚ΡŒ Π² Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классах
151 // ΠŸΡ€ΠΈ этом Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Ρ‚Π΅, ΠΌΠ΅Ρ‚ΠΎΠ΄Ρ‹, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π΅ΡΡ‚ΡŒ Π² Π±Π°Π·ΠΎΠ²Ρ‹Ρ… классах
151 // ΠΌΠΎΠ³ΡƒΡ‚ Π±Ρ‹Ρ‚ΡŒ ΠΏΠ΅Ρ€Π΅ΠΎΠΏΡ€Π΅Π΄Π΅Π»Π΅Π½Ρ‹.
152 // ΠΌΠΎΠ³ΡƒΡ‚ Π±Ρ‹Ρ‚ΡŒ ΠΏΠ΅Ρ€Π΅ΠΎΠΏΡ€Π΅Π΄Π΅Π»Π΅Π½Ρ‹.
152 each(target.prototype, (m: any, p: string | number | symbol) => {
153 each(target.prototype, (m: any, p: string | number | symbol) => {
153 if (typeof m === "function" &&
154 if (typeof m === "function" &&
154 p !== "constructor" &&
155 p !== "constructor" &&
155 target.prototype.hasOwnProperty(p) &&
156 target.prototype.hasOwnProperty(p) &&
156 p in t.prototype
157 p in t.prototype
157 ) {
158 ) {
158 bp[p] = proxy(m);
159 bp[p] = proxy(m);
159 }
160 }
160 });
161 });
161
162
162 const cls = declare(t, target.prototype);
163 const cls = declare(t, target.prototype);
163 // TODO mixin static members
164 // TODO mixin static members
164 return cls as any;
165 return cls as any;
165 } else {
166 } else {
166 return target as any;
167 return target as any;
167 }
168 }
168 }
169 }
169
170
170 function makeSetterName(prop: string) {
171 function makeSetterName(prop: string) {
171 return [
172 return [
172 "_set",
173 "_set",
173 prop.replace(/^./, x => x.toUpperCase()),
174 prop.replace(/^./, x => x.toUpperCase()),
174 "Attr"
175 "Attr"
175 ].join("");
176 ].join("");
176 }
177 }
177
178
178 function makeGetterName(prop: string) {
179 function makeGetterName(prop: string) {
179 return [
180 return [
180 "_get",
181 "_get",
181 prop.replace(/^./, x => x.toUpperCase()),
182 prop.replace(/^./, x => x.toUpperCase()),
182 "Attr"
183 "Attr"
183 ].join("");
184 ].join("");
184 }
185 }
185
186
186 interface NodeBindSpec {
187 interface NodeBindSpec {
187 node: string;
188 node: string;
188 type: string;
189 type: string;
189 }
190 }
190
191
191 /**
192 /**
192 * ОписаниС привязки свойства Π²ΠΈΠ΄ΠΆΠ΅Ρ‚Π° ΠΊ свойству Π²Π½ΡƒΡ‚Ρ€Π΅Π½Π½Π΅Π³ΠΎ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π°.
193 * ОписаниС привязки свойства Π²ΠΈΠ΄ΠΆΠ΅Ρ‚Π° ΠΊ свойству Π²Π½ΡƒΡ‚Ρ€Π΅Π½Π½Π΅Π³ΠΎ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π°.
193 */
194 */
194 interface MemberBindSpec {
195 interface MemberBindSpec {
195 /**
196 /**
196 * Имя свойства со ссылкой Π½Π° ΠΎΠ±ΡŠΠ΅ΠΊΡ‚, ΠΊ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΌΡƒ .
197 * Имя свойства со ссылкой Π½Π° ΠΎΠ±ΡŠΠ΅ΠΊΡ‚, ΠΊ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΌΡƒ .
197 */
198 */
198 member: string;
199 member: string;
199 /**
200 /**
200 * Бвойство ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π° ΠΊ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΌΡƒ Π½ΡƒΠΆΠ½ΠΎ ΠΎΡΡƒΡ‰Π΅ΡΡ‚Π²ΠΈΡ‚ΡŒ привязку.
201 * Бвойство ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π° ΠΊ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΌΡƒ Π½ΡƒΠΆΠ½ΠΎ ΠΎΡΡƒΡ‰Π΅ΡΡ‚Π²ΠΈΡ‚ΡŒ привязку.
201 */
202 */
202 property: string;
203 property: string;
203
204
204 /**
205 /**
205 * ΠŸΡ€ΠΈΠ²ΡΠ·ΠΊΠ° осущСствляСтся Π½Π΅ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π½Π° запись Π½ΠΎ ΠΈ Π½Π° Ρ‡Ρ‚Π΅Π½ΠΈΠ΅ свойства.
206 * ΠŸΡ€ΠΈΠ²ΡΠ·ΠΊΠ° осущСствляСтся Π½Π΅ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π½Π° запись Π½ΠΎ ΠΈ Π½Π° Ρ‡Ρ‚Π΅Π½ΠΈΠ΅ свойства.
206 */
207 */
207 getter?: boolean;
208 getter?: boolean;
208 }
209 }
209
210
210 function isNodeBindSpec(v: any): v is NodeBindSpec {
211 function isNodeBindSpec(v: any): v is NodeBindSpec {
211 return "node" in v;
212 return "node" in v;
212 }
213 }
213
214
214 function isMemberBindSpec(v: any): v is MemberBindSpec {
215 function isMemberBindSpec(v: any): v is MemberBindSpec {
215 return "member" in v;
216 return "member" in v;
216 }
217 }
217
218
218 /** Π”Π΅ΠΊΠΎΡ€ΠΈΡ€ΡƒΠ΅Ρ‚ свойства Π²ΠΈΠ΄ΠΆΠ΅Ρ‚Π° для привязки ΠΈΡ… ΠΊ Π²Π½ΡƒΡ‚Ρ€Π΅Π½Π½ΠΈΠΌ Ρ‡Π»Π΅Π½Π°ΠΌ, Π»ΠΈΠ±ΠΎ DOM
219 /** Π”Π΅ΠΊΠΎΡ€ΠΈΡ€ΡƒΠ΅Ρ‚ свойства Π²ΠΈΠ΄ΠΆΠ΅Ρ‚Π° для привязки ΠΈΡ… ΠΊ Π²Π½ΡƒΡ‚Ρ€Π΅Π½Π½ΠΈΠΌ Ρ‡Π»Π΅Π½Π°ΠΌ, Π»ΠΈΠ±ΠΎ DOM
219 * элСмСнтам, Π»ΠΈΠ±ΠΎ свойству Π²Π½ΡƒΡ‚Ρ€Π΅Π½Π½Π΅Π³ΠΎ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π°.
220 * элСмСнтам, Π»ΠΈΠ±ΠΎ свойству Π²Π½ΡƒΡ‚Ρ€Π΅Π½Π½Π΅Π³ΠΎ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π°.
220 *
221 *
221 * @param {NodeBindSpec | MemberBindSpec} params ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ связывания.
222 * @param {NodeBindSpec | MemberBindSpec} params ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ связывания.
222 */
223 */
223 export function bind(params: NodeBindSpec | MemberBindSpec) {
224 export function bind(params: NodeBindSpec | MemberBindSpec) {
224 if (isNodeBindSpec(params))
225 if (isNodeBindSpec(params))
225 return (target: any, name: string) => {
226 return (target: any, name: string) => {
226 target[makeSetterName(name)] = params;
227 target[makeSetterName(name)] = params;
227 };
228 };
228 else if (isMemberBindSpec(params)) {
229 else if (isMemberBindSpec(params)) {
229 return (target: any, name: string) => {
230 return (target: any, name: string) => {
230 target[name] = null;
231 target[name] = null;
231 target[makeSetterName(name)] = function (v: any) {
232 target[makeSetterName(name)] = function (v: any) {
232 this._set(name, v);
233 this._set(name, v);
233 this[params.member].set(params.property, v);
234 this[params.member].set(params.property, v);
234 };
235 };
235 if (params.getter)
236 if (params.getter)
236 target[makeGetterName(name)] = function () {
237 target[makeGetterName(name)] = function () {
237 return this[params.member].get(params.property);
238 return this[params.member].get(params.property);
238 };
239 };
239 };
240 };
240 }
241 }
241 }
242 }
@@ -1,87 +1,88
1 import { Handle } from "dojo/interfaces";
1 import { Handle } from "dojo/interfaces";
2 import _WidgetBase = require("./_WidgetBase");
2 import _WidgetBase = require("./_WidgetBase");
3 import declare = require("dojo/_base/declare");
3 import declare = require("dojo/_base/declare");
4 import dojo = require("dojo/_base/html");
4
5
5 declare module "./_WidgetBase" {
6 declare module "./_WidgetBase" {
6 interface _WidgetBase {
7 interface _WidgetBase {
7 dojoAttachEvent: string;
8 dojoAttachEvent: string;
8 dojoAttachPoint: string;
9 dojoAttachPoint: string;
9 }
10 }
10 }
11 }
11
12
12 declare module "dojo/_base/kernel" {
13 declare module "dojo/_base/kernel" {
13 interface Dijit {
14 interface Dijit {
14 _AttachMixin: _AttachMixinConstructor;
15 _AttachMixin: _AttachMixinConstructor;
15 }
16 }
16 }
17 }
17
18
18 interface _AttachMixin {
19 interface _AttachMixin {
19 /**
20 /**
20 * List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
21 * List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
21 */
22 */
22 _attachPoints: string[];
23 _attachPoints: string[];
23
24
24 /**
25 /**
25 * List of connections associated with data-dojo-attach-event=... in the template
26 * List of connections associated with data-dojo-attach-event=... in the template
26 */
27 */
27 _attachEvents: Handle[];
28 _attachEvents: Handle[];
28
29
29 /**
30 /**
30 * Object to which attach points and events will be scoped. Defaults to 'this'.
31 * Object to which attach points and events will be scoped. Defaults to 'this'.
31 */
32 */
32 attachScope: any;
33 attachScope: any;
33
34
34 /**
35 /**
35 * Search descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event.
36 * Search descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event.
36 *
37 *
37 * Should generally be left false (the default value) both for performance and to avoid failures when this.containerNode holds other _AttachMixin instances with their own attach points and events.
38 * Should generally be left false (the default value) both for performance and to avoid failures when this.containerNode holds other _AttachMixin instances with their own attach points and events.
38 */
39 */
39 searchContainerNode: boolean;
40 searchContainerNode: boolean;
40
41
41 /**
42 /**
42 * Attach to DOM nodes marked with special attributes.
43 * Attach to DOM nodes marked with special attributes.
43 */
44 */
44 buildRendering(): void;
45 buildRendering(): void;
45
46
46 /**
47 /**
47 * hook for _WidgetsInTemplateMixin
48 * hook for _WidgetsInTemplateMixin
48 */
49 */
49 _beforeFillContent(): void;
50 _beforeFillContent(): void;
50
51
51 /**
52 /**
52 * Iterate through the dom nodes and attach functions and nodes accordingly.
53 * Iterate through the dom nodes and attach functions and nodes accordingly.
53 *
54 *
54 * Map widget properties and functions to the handlers specified in the dom node and it's descendants. This function iterates over all nodes and looks for these properties:
55 * Map widget properties and functions to the handlers specified in the dom node and it's descendants. This function iterates over all nodes and looks for these properties:
55 * - dojoAttachPoint/data-dojo-attach-point
56 * - dojoAttachPoint/data-dojo-attach-point
56 * - dojoAttachEvent/data-dojo-attach-event
57 * - dojoAttachEvent/data-dojo-attach-event
57 */
58 */
58 _attachTemplateNodes(rootNode: Element | Node): void;
59 _attachTemplateNodes(rootNode: Element | Node): void;
59
60
60 /**
61 /**
61 * Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
62 * Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
62 *
63 *
63 * Returns true if caller should process baseNode's children too.
64 * Returns true if caller should process baseNode's children too.
64 */
65 */
65 _processTemplateNode<T extends (Element | Node | _WidgetBase)>(
66 _processTemplateNode<T extends (Element | Node | _WidgetBase)>(
66 baseNode: T,
67 baseNode: T,
67 getAttrFunc: (baseNode: T, attr: string) => string,
68 getAttrFunc: (baseNode: T, attr: string) => string,
68 attachFunc: (node: T, type: string, func?: Function) => Handle
69 attachFunc: (node: T, type: string, func?: Function) => Handle
69 ): boolean;
70 ): boolean;
70
71
71 /**
72 /**
72 * Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.
73 * Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.
73 */
74 */
74 _attach(node: Element | Node, type: string, func?: Function): Handle;
75 _attach(node: Element | Node, type: string, func?: Function): Handle;
75
76
76 /**
77 /**
77 * Detach and clean up the attachments made in _attachtempalteNodes.
78 * Detach and clean up the attachments made in _attachtempalteNodes.
78 */
79 */
79 _detachTemplateNodes(): void;
80 _detachTemplateNodes(): void;
80
81
81 destroyRendering(preserveDom?: boolean): void;
82 destroyRendering(preserveDom?: boolean): void;
82 }
83 }
83
84
84 interface _AttachMixinConstructor extends declare.DeclareConstructor<_AttachMixin> { }
85 interface _AttachMixinConstructor extends dojo._base.DeclareConstructor<_AttachMixin> { }
85
86
86 declare const _AttachMixin: _AttachMixinConstructor;
87 declare const _AttachMixin: _AttachMixinConstructor;
87 export = _AttachMixin;
88 export = _AttachMixin;
@@ -1,138 +1,142
1 import dojo = require("./kernel");
2
1 declare module "./kernel" {
3 declare module "./kernel" {
2 interface Dojo {
4 interface Dojo {
3 declare: declare.Declare;
5 declare: dojo._base.Declare;
4 safeMixin: typeof declare.safeMixin;
6 safeMixin: typeof declare.safeMixin;
5 }
7 }
6 }
7
8
8 declare namespace declare {
9 namespace _base {
9 interface DeclareCreatedObject {
10 interface DeclareCreatedObject {
10 declaredClass: string;
11 declaredClass: string;
11
12
12 /**
13 /**
13 * Calls a super method.
14 * Calls a super method.
14 *
15 *
15 * This method is used inside method of classes produced with
16 * This method is used inside method of classes produced with
16 * declare() to call a super method (next in the chain). It is
17 * declare() to call a super method (next in the chain). It is
17 * used for manually controlled chaining. Consider using the regular
18 * used for manually controlled chaining. Consider using the regular
18 * chaining, because it is faster. Use "this.inherited()" only in
19 * chaining, because it is faster. Use "this.inherited()" only in
19 * complex cases.
20 * complex cases.
20 *
21 *
21 * This method cannot me called from automatically chained
22 * This method cannot me called from automatically chained
22 * constructors including the case of a special (legacy)
23 * constructors including the case of a special (legacy)
23 * constructor chaining. It cannot be called from chained methods.
24 * constructor chaining. It cannot be called from chained methods.
24 *
25 *
25 * If "this.inherited()" cannot find the next-in-chain method, it
26 * If "this.inherited()" cannot find the next-in-chain method, it
26 * does nothing and returns "undefined". The last method in chain
27 * does nothing and returns "undefined". The last method in chain
27 * can be a default method implemented in Object, which will be
28 * can be a default method implemented in Object, which will be
28 * called last.
29 * called last.
29 *
30 *
30 * If "name" is specified, it is assumed that the method that
31 * If "name" is specified, it is assumed that the method that
31 * received "args" is the parent method for this call. It is looked
32 * received "args" is the parent method for this call. It is looked
32 * up in the chain list and if it is found the next-in-chain method
33 * up in the chain list and if it is found the next-in-chain method
33 * is called. If it is not found, the first-in-chain method is
34 * is called. If it is not found, the first-in-chain method is
34 * called.
35 * called.
35 *
36 *
36 * If "name" is not specified, it will be derived from the calling
37 * If "name" is not specified, it will be derived from the calling
37 * method (using a methoid property "nom").
38 * method (using a methoid property "nom").
38 */
39 */
39 inherited<U>(args: IArguments, newArgs?: any[]): U;
40 inherited<U>(args: IArguments, newArgs?: any[]): U;
40 inherited(args: IArguments, newArgs?: true): Function | void;
41 inherited(args: IArguments, newArgs?: true): Function | void;
41 inherited<U>(name: string, args: IArguments, newArgs?: any[]): U;
42 inherited<U>(name: string, args: IArguments, newArgs?: any[]): U;
42 inherited(name: string, args: IArguments, newArgs?: true): Function | void;
43 inherited(name: string, args: IArguments, newArgs?: true): Function | void;
43
44
44 /**
45 /**
45 * Returns a super method.
46 * Returns a super method.
46 *
47 *
47 * This method is a convenience method for "this.inherited()".
48 * This method is a convenience method for "this.inherited()".
48 * It uses the same algorithm but instead of executing a super
49 * It uses the same algorithm but instead of executing a super
49 * method, it returns it, or "undefined" if not found.
50 * method, it returns it, or "undefined" if not found.
50 */
51 */
51 getInherited(args: IArguments): Function | void;
52 getInherited(args: IArguments): Function | void;
52 getInherited(name: string, args: IArguments): Function | void;
53 getInherited(name: string, args: IArguments): Function | void;
53
54
54 /**
55 /**
55 * Checks the inheritance chain to see if it is inherited from this class.
56 * Checks the inheritance chain to see if it is inherited from this class.
56 *
57 *
57 * This method is used with instances of classes produced with
58 * This method is used with instances of classes produced with
58 * declare() to determine of they support a certain interface or
59 * declare() to determine of they support a certain interface or
59 * not. It models "instanceof" operator.
60 * not. It models "instanceof" operator.
60 */
61 */
61 isInstanceOf(cls: any): boolean;
62 isInstanceOf(cls: any): boolean;
62 }
63 }
63
64
64 interface DeclareConstructor<T> {
65 interface DeclareConstructor<T> {
65 new(...args: any[]): T & DeclareCreatedObject;
66 new(...args: any[]): T & DeclareCreatedObject;
66 prototype: T;
67 prototype: T;
67
68
68 /**
69 /**
69 * Adds all properties and methods of source to constructor's
70 * Adds all properties and methods of source to constructor's
70 * prototype, making them available to all instances created with
71 * prototype, making them available to all instances created with
71 * constructor. This method is specific to constructors created with
72 * constructor. This method is specific to constructors created with
72 * declare().
73 * declare().
73 *
74 *
74 * Adds source properties to the constructor's prototype. It can
75 * Adds source properties to the constructor's prototype. It can
75 * override existing properties.
76 * override existing properties.
76 *
77 *
77 * This method is similar to dojo.extend function, but it is specific
78 * This method is similar to dojo.extend function, but it is specific
78 * to constructors produced by declare(). It is implemented
79 * to constructors produced by declare(). It is implemented
79 * using dojo.safeMixin, and it skips a constructor property,
80 * using dojo.safeMixin, and it skips a constructor property,
80 * and properly decorates copied functions.
81 * and properly decorates copied functions.
81 */
82 */
82 extend<U>(source: U): DeclareConstructor<T & U>;
83 extend<U>(source: U): DeclareConstructor<T & U>;
83
84
84 /**
85 /**
85 * Create a subclass of the declared class from a list of base classes.
86 * Create a subclass of the declared class from a list of base classes.
86 *
87 *
87 * Create a constructor using a compact notation for inheritance and
88 * Create a constructor using a compact notation for inheritance and
88 * prototype extension.
89 * prototype extension.
89 *
90 *
90 * Mixin ancestors provide a type of multiple inheritance.
91 * Mixin ancestors provide a type of multiple inheritance.
91 * Prototypes of mixin ancestors are copied to the new class:
92 * Prototypes of mixin ancestors are copied to the new class:
92 * changes to mixin prototypes will not affect classes to which
93 * changes to mixin prototypes will not affect classes to which
93 * they have been mixed in.
94 * they have been mixed in.
94 */
95 */
95 createSubclass<U, V, X>(mixins: [DeclareConstructor<U>, DeclareConstructor<V>], props: X): DeclareConstructor<T & U & V & X>;
96 createSubclass<U, V, X>(mixins: [DeclareConstructor<U>, DeclareConstructor<V>], props: X): DeclareConstructor<T & U & V & X>;
96 createSubclass<U, V>(mixins: [DeclareConstructor<U>], props: V): DeclareConstructor<T & U & V>;
97 createSubclass<U, V>(mixins: [DeclareConstructor<U>], props: V): DeclareConstructor<T & U & V>;
97 createSubclass<U, V>(mixins: DeclareConstructor<U>, props: V): DeclareConstructor<T & U & V>;
98 createSubclass<U, V>(mixins: DeclareConstructor<U>, props: V): DeclareConstructor<T & U & V>;
98 createSubclass<U>(mixins: [DeclareConstructor<U>]): DeclareConstructor<T & U>;
99 createSubclass<U>(mixins: [DeclareConstructor<U>]): DeclareConstructor<T & U>;
99 createSubclass<U>(mixins: DeclareConstructor<U>): DeclareConstructor<T & U>;
100 createSubclass<U>(mixins: DeclareConstructor<U>): DeclareConstructor<T & U>;
100 createSubclass<U>(mixins: any, props: U): DeclareConstructor<T & U>;
101 createSubclass<U>(mixins: any, props: U): DeclareConstructor<T & U>;
101 }
102 }
102
103
103 interface Declare {
104 interface Declare {
104 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
105 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
105 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
106 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
106 <A, B>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
107 <A, B>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
107 <A>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
108 <A>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
108
109
109 <A, B, C, D, E>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
110 <A, B, C, D, E>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
110 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
111 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
111 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
112 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
112 <A, B>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
113 <A, B>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
113
114
114 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
115 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
115 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
116 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
116 <A, B>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
117 <A, B>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>]): DeclareConstructor<A & B>;
117 <A>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
118 <A>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>]): DeclareConstructor<A>;
118
119
119 <A, B, C, D, E>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
120 <A, B, C, D, E>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>], props: E): DeclareConstructor<A & B & C & D & E>;
120 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
121 <A, B, C, D>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>], props: D): DeclareConstructor<A & B & C & D>;
121 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
122 <A, B, C>(className: string, superClass: [DeclareConstructor<A>, DeclareConstructor<B>], props: C): DeclareConstructor<A & B & C>;
122 <A, B>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
123 <A, B>(className: string, superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B): DeclareConstructor<A & B>;
123
124
124 <A>(className: string, superClass: any, props: A): DeclareConstructor<A>;
125 <A>(className: string, superClass: any, props: A): DeclareConstructor<A>;
125 (className: string, superClass: any): DeclareConstructor<any>;
126 (className: string, superClass: any): DeclareConstructor<any>;
126 <A>(superClass: any, props: A): DeclareConstructor<A>;
127 <A>(superClass: any, props: A): DeclareConstructor<A>;
127 (superClass: any): DeclareConstructor<any>;
128 (superClass: any): DeclareConstructor<any>;
128
129
129 /**
130 /**
130 * Mix in properties skipping a constructor and decorating functions
131 * Mix in properties skipping a constructor and decorating functions
131 * like it is done by declare().
132 * like it is done by declare().
132 */
133 */
133 safeMixin<A, B>(target: A, source: B): A & B;
134 safeMixin<A, B>(target: A, source: B): A & B;
134 }
135 }
135 }
136 }
136
137
137 declare const declare: declare.Declare;
138 }
139
140
141 declare const declare: dojo._base.Declare;
138 export = declare;
142 export = declare;
General Comments 0
You need to be logged in to leave comments. Login now