##// END OF EJS Templates
some fixes after testing
cin -
r5:af2703f9110e default
parent child
Show More
@@ -39,7 +39,9 typescript {
39
39
40 configureTsTest {
40 configureTsTest {
41 compilerOptions {
41 compilerOptions {
42 types = ["../main/typings/dojo/modules","../main/typings/dijit/modules"];
42 types = ["../main/typings/dojo/modules","../main/typings/dijit/modules"]
43 module = "ESNext"
44 it.target = "ESNext"
43 }
45 }
44 }
46 }
45
47
@@ -549,6 +549,10 declare namespace dijit {
549 onClose(): boolean;
549 onClose(): boolean;
550 }
550 }
551
551
552 type Props<T> = {
553 [k in Exclude<keyof T, keyof object>] : T[k] extends (...args: any) => any ? never: k;
554 }[ keyof T];
555
552 interface _WidgetBase {
556 interface _WidgetBase {
553 /**
557 /**
554 * Used across all instances a hash to cache attribute names and their getter
558 * Used across all instances a hash to cache attribute names and their getter
@@ -569,7 +573,7 declare namespace dijit {
569 */
573 */
570 _changeAttrValue(name: string, value: any): this;
574 _changeAttrValue(name: string, value: any): this;
571
575
572 get<K extends keyof this & string>(name: K): this[K];
576 get<K extends keyof this>(name: K): this[K];
573
577
574 /**
578 /**
575 * Helper function to set new value for specified property, and call handlers
579 * Helper function to set new value for specified property, and call handlers
@@ -591,15 +595,15 declare namespace dijit {
591 /**
595 /**
592 * Set a property on a Stateful instance
596 * Set a property on a Stateful instance
593 */
597 */
594 set<K extends keyof this & string>(name: K, value: this[K]): this;
598 set<K extends keyof this>(name: K, value: this[K]): this;
595 set<K extends { [p in keyof this]: this[p] extends any[] ? p : never; }[keyof this & string]>(name: K, ...values: this[K]): this;
599 set<K extends keyof this, V extends this[K] & any[]>(name: K, ...values: V): this;
596 set(values: Partial<this>): this;
600 set<K extends keyof this>(values: {[p in K]: this[p]}): this;
597
601
598 /**
602 /**
599 * Watches a property for changes
603 * Watches a property for changes
600 */
604 */
601 watch(callback: <K extends keyof any>(prop: K, oldValue: any, newValue: any) => void): dojo.WatchHandle;
605 watch(callback: <K extends keyof any>(prop: K, oldValue: any, newValue: any) => void): dojo.WatchHandle;
602 watch<K extends keyof this>(name: K, callback: (prop: K, oldValue: this[K], newValue: this[K]) => void): dojo.WatchHandle;
606 watch<K extends Props<this>>(name: K, callback: (prop: K, oldValue: this[K], newValue: this[K]) => void): dojo.WatchHandle;
603 }
607 }
604
608
605 type EventInitArgs<T extends Event> = {
609 type EventInitArgs<T extends Event> = {
@@ -8,7 +8,7 declare namespace dijit {
8 [prop: string]: any;
8 [prop: string]: any;
9 }
9 }
10
10
11 interface ConstrainedValueFunction<V, C extends Constraints, T> {
11 interface ConstrainedValueFunction<V = any, C extends Constraints = Constraints, T = any> {
12 /**
12 /**
13 * Returns a value that has been constrained by the constraints
13 * Returns a value that has been constrained by the constraints
14 * @param value The value to constrain
14 * @param value The value to constrain
@@ -18,7 +18,7 declare namespace dijit {
18 (value: V, constraints: C): T;
18 (value: V, constraints: C): T;
19 }
19 }
20
20
21 interface ConstrainedValidFunction<C extends Constraints> {
21 interface ConstrainedValidFunction<C extends Constraints = Constraints> {
22 /**
22 /**
23 * Returns true if the value is valid based on the constraints, otherwise
23 * Returns true if the value is valid based on the constraints, otherwise
24 * returns false.
24 * returns false.
@@ -29,7 +29,7 declare namespace dijit {
29 (value: any, constraints: C): boolean;
29 (value: any, constraints: C): boolean;
30 }
30 }
31
31
32 interface ConstraintsToRegExpString<C extends Constraints> {
32 interface ConstraintsToRegExpString<C extends Constraints = Constraints> {
33 /**
33 /**
34 * Takes a set of constraints and returns a RegExpString that can be used
34 * Takes a set of constraints and returns a RegExpString that can be used
35 * to match values against
35 * to match values against
@@ -46,7 +46,7 declare namespace dijit {
46 /* dijit/form/_AutoCompleterMixin */
46 /* dijit/form/_AutoCompleterMixin */
47
47
48 /* tslint:disable:class-name */
48 /* tslint:disable:class-name */
49 interface _AutoCompleterMixin<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> extends _SearchMixin<T, Q, O> {
49 interface _AutoCompleterMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _SearchMixin<T, Q, O> {
50 /**
50 /**
51 * This is the item returned by the dojo/store/api/Store implementation that
51 * This is the item returned by the dojo/store/api/Store implementation that
52 * provides the data for this ComboBox, it's the currently selected item.
52 * provides the data for this ComboBox, it's the currently selected item.
@@ -179,7 +179,7 declare namespace dijit {
179
179
180 /* dijit/form/_ComboBoxMenu */
180 /* dijit/form/_ComboBoxMenu */
181
181
182 interface _ComboBoxMenu<T> extends _WidgetBase, _TemplatedMixin, _ListMouseMixin, _ComboBoxMenuMixin<T> {
182 interface _ComboBoxMenu<T = any> extends _WidgetBase, _TemplatedMixin, _ListMouseMixin, _ComboBoxMenuMixin<T> {
183 templateString: string;
183 templateString: string;
184 baseClass: string;
184 baseClass: string;
185
185
@@ -219,12 +219,12 declare namespace dijit {
219 }
219 }
220
220
221 interface _ComboBoxMenuConstructor extends _WidgetBaseConstructor<_ComboBoxMenu<any>> {
221 interface _ComboBoxMenuConstructor extends _WidgetBaseConstructor<_ComboBoxMenu<any>> {
222 new <T>(params: Object, srcNodeRef: dojo.NodeOrString): _ComboBoxMenu<T>;
222 new <T = any>(params: Object, srcNodeRef: dojo.NodeOrString): _ComboBoxMenu<T>;
223 }
223 }
224
224
225 /* dijit/form/_ComboBoxMenuMixin */
225 /* dijit/form/_ComboBoxMenuMixin */
226
226
227 interface _ComboBoxMenuMixin<T> {
227 interface _ComboBoxMenuMixin<T = any> {
228 /**
228 /**
229 * Holds "next" and "previous" text for paging buttons on drop down
229 * Holds "next" and "previous" text for paging buttons on drop down
230 */
230 */
@@ -468,7 +468,7 declare namespace dijit {
468 disabled?: boolean;
468 disabled?: boolean;
469 }
469 }
470
470
471 interface _FormSelectWidget<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> extends _FormValueWidget {
471 interface _FormSelectWidget<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _FormValueWidget {
472 /**
472 /**
473 * Whether or not we are multi-valued
473 * Whether or not we are multi-valued
474 */
474 */
@@ -862,7 +862,7 declare namespace dijit {
862
862
863 /* dijit/form/_SearchMixin */
863 /* dijit/form/_SearchMixin */
864
864
865 interface _SearchMixin<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> {
865 interface _SearchMixin<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> {
866 /**
866 /**
867 * Argument to data provider.
867 * Argument to data provider.
868 * Specifies maximum number of search results to return per query
868 * Specifies maximum number of search results to return per query
@@ -1006,7 +1006,7 declare namespace dijit {
1006
1006
1007 /* dijit/form/_TextBoxMixin */
1007 /* dijit/form/_TextBoxMixin */
1008
1008
1009 interface _TextBoxMixin<C extends Constraints> {
1009 interface _TextBoxMixin<C extends Constraints = Constraints> {
1010 /**
1010 /**
1011 * Removes leading and trailing whitespace if true. Default is false.
1011 * Removes leading and trailing whitespace if true. Default is false.
1012 */
1012 */
@@ -1163,18 +1163,18 declare namespace dijit {
1163
1163
1164 /* dijit/form/ComboBox */
1164 /* dijit/form/ComboBox */
1165
1165
1166 interface ComboBox<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions, C extends Constraints> extends ValidationTextBox<C>, ComboBoxMixin<T, Q, O> {
1166 interface ComboBox<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions, C extends Constraints = Constraints> extends ValidationTextBox<C>, ComboBoxMixin<T, Q, O> {
1167 // set(name: string, value: any): this;
1167 // set(name: string, value: any): this;
1168 // set(values: Object): this;
1168 // set(values: Object): this;
1169 }
1169 }
1170
1170
1171 interface ComboBoxConstructor extends _WidgetBaseConstructor<ComboBox<any, any, any, any>> {
1171 interface ComboBoxConstructor extends _WidgetBaseConstructor<ComboBox<any>> {
1172 new <T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions, C extends Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ComboBox<T, Q, O, C>;
1172 new <T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions, C extends Constraints = Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ComboBox<T, Q, O, C>;
1173 }
1173 }
1174
1174
1175 /* dijit/form/ComboBoxMixin */
1175 /* dijit/form/ComboBoxMixin */
1176
1176
1177 interface ComboBoxMixin<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> extends _HasDropDown<_ComboBoxMenu<T>>, _AutoCompleterMixin<T, Q, O> {
1177 interface ComboBoxMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _HasDropDown<_ComboBoxMenu<T>>, _AutoCompleterMixin<T, Q, O> {
1178
1178
1179 /**
1179 /**
1180 * Dropdown widget class used to select a date/time.
1180 * Dropdown widget class used to select a date/time.
@@ -1204,7 +1204,7 declare namespace dijit {
1204 buildRendering(): void;
1204 buildRendering(): void;
1205 }
1205 }
1206
1206
1207 interface ComboBoxMixinConstructor<T, U extends dojo.store.api.BaseQueryType, V> extends _WidgetBaseConstructor<ComboBoxMixin<T, U, V>> { }
1207 interface ComboBoxMixinConstructor<T = any, U extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, V = any> extends _WidgetBaseConstructor<ComboBoxMixin<T, U, V>> { }
1208
1208
1209 /* dijit/form/CurrencyTextBox */
1209 /* dijit/form/CurrencyTextBox */
1210
1210
@@ -1840,7 +1840,7 declare namespace dijit {
1840 (isFocused?: boolean): boolean;
1840 (isFocused?: boolean): boolean;
1841 }
1841 }
1842
1842
1843 interface ValidationTextBox<C extends Constraints> extends TextBox {
1843 interface ValidationTextBox<C extends Constraints = Constraints> extends TextBox {
1844 templateString: string;
1844 templateString: string;
1845 required: boolean;
1845 required: boolean;
1846 promptMessage: string;
1846 promptMessage: string;
@@ -204,7 +204,7 declare namespace dijit {
204 * Note that the initialization parameter / argument to set("content", ...
204 * Note that the initialization parameter / argument to set("content", ...
205 * can be a String, DomNode, Nodelist, or _Widget.
205 * can be a String, DomNode, Nodelist, or _Widget.
206 */
206 */
207 content: dojo.ContentSetterContent | dijit._Widget;
207 content: any;
208
208
209 /**
209 /**
210 * Extract visible content from inside of `<body> .... </body>`
210 * Extract visible content from inside of `<body> .... </body>`
@@ -283,7 +283,7 declare module 'dijit/form/ComboBox' {
283 }
283 }
284
284
285 declare module 'dijit/form/ComboBoxMixin' {
285 declare module 'dijit/form/ComboBoxMixin' {
286 type ComboBoxMixin<T, U extends dojo.store.api.BaseQueryType, V> = dijit.form.ComboBoxMixin<T, U, V>;
286 type ComboBoxMixin<T = any, U extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, V = any> = dijit.form.ComboBoxMixin<T, U, V>;
287 const ComboBoxMixin: dijit.form.ComboBoxConstructor;
287 const ComboBoxMixin: dijit.form.ComboBoxConstructor;
288 export = ComboBoxMixin;
288 export = ComboBoxMixin;
289 }
289 }
@@ -343,7 +343,7 declare module 'dijit/form/HorizontalSli
343 }
343 }
344
344
345 declare module 'dijit/form/MappedTextBox' {
345 declare module 'dijit/form/MappedTextBox' {
346 type MappedTextBox<C extends dijit.form.Constraints> = dijit.form.MappedTextBox<C>;
346 type MappedTextBox<C extends dijit.form.Constraints = dijit.form.Constraints> = dijit.form.MappedTextBox<C>;
347 const MappedTextBox: dijit.form.MappedTextBoxConstructor;
347 const MappedTextBox: dijit.form.MappedTextBoxConstructor;
348 export = MappedTextBox;
348 export = MappedTextBox;
349 }
349 }
@@ -373,7 +373,7 declare module 'dijit/form/RangeBoundTex
373 }
373 }
374
374
375 declare module 'dijit/form/Select' {
375 declare module 'dijit/form/Select' {
376 type Select<T, Q extends dojo.store.api.BaseQueryType, O, U extends dijit._WidgetBase> = dijit.form.Select<T, Q, O, U>;
376 type Select<T, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O = any, U extends dijit._WidgetBase = dijit._WidgetBase> = dijit.form.Select<T, Q, O, U>;
377 const Select: dijit.form.SelectConstructor;
377 const Select: dijit.form.SelectConstructor;
378 export = Select;
378 export = Select;
379 }
379 }
@@ -403,7 +403,7 declare module 'dijit/form/ToggleButton'
403 }
403 }
404
404
405 declare module 'dijit/form/ValidationTextBox' {
405 declare module 'dijit/form/ValidationTextBox' {
406 type ValidationTextBox<C extends dijit.form.Constraints> = dijit.form.ValidationTextBox<C>;
406 type ValidationTextBox<C extends dijit.form.Constraints = dijit.form.Constraints> = dijit.form.ValidationTextBox<C>;
407 const ValidationTextBox: dijit.form.ValidationTextBoxConstructor;
407 const ValidationTextBox: dijit.form.ValidationTextBoxConstructor;
408 export = ValidationTextBox;
408 export = ValidationTextBox;
409 }
409 }
@@ -14,14 +14,32 interface ScheduleWidgetEvents {
14 };
14 };
15 }
15 }
16
16
17 declare class ScheduleWidget extends _WidgetBase<ScheduleWidgetAttrs, ScheduleWidgetEvents> {
17 class ScheduleWidget extends _WidgetBase<ScheduleWidgetAttrs, ScheduleWidgetEvents> {
18 data: string[];
18 data: string[];
19
20 _onClick() {
21 this.set("data", "", "");
22
23 const t = this.get("title");
24 this.set({
25 data: ["",""]
26 });
27 }
28
29 render(){
30 watch(this, "title", v => String(v) );
31 }
19 }
32 }
20
33
21 const w = new ScheduleWidget({title: "Year schedule", data: ["a", "b"] });
34 const w = new ScheduleWidget({title: "Year schedule", data: ["a", "b"] });
22
35
23 w.get("data");
36 w.get("data");
24
37
38 w.set("data", "a","b");
39 w.set({
40 data: ["a", "b"]
41 });
42
25 w.watch((p, o, n) => [p,o,n]);
43 w.watch((p, o, n) => [p,o,n]);
26
44
27 w.watch("data", (p, o, n) => [p,o,n]);
45 w.watch("data", (p, o, n) => [p,o,n]);
General Comments 0
You need to be logged in to leave comments. Login now