Skip to content

Commit 704545f

Browse files
author
Anatoly Ostrovsky
committed
Refactor input away from Dates
1 parent afe832f commit 704545f

File tree

10 files changed

+98
-513
lines changed

10 files changed

+98
-513
lines changed

@types/angular.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
export class Angular extends EventTarget {
2+
constructor(submodule?: boolean);
3+
/** @private @type {boolean} */
4+
private _submodule;
25
/** @private @type {!Array<string|any>} */
36
private _bootsrappedModules;
47
/** @public @type {ng.PubSubService} */

@types/directive/input/input.d.ts

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
export function weekParser(isoWeek: any, existingDate: any): any;
2-
export function createDateParser(
3-
regexp: any,
4-
mapping: any,
5-
): (iso: any, previousDate: any) => any;
6-
export function createDateInputType(
7-
type: any,
8-
regexp: any,
9-
parseDate: any,
10-
): (
11-
scope: any,
12-
element: any,
13-
attr: any,
14-
ctrl: any,
15-
$filter: any,
16-
$parse: any,
17-
) => void;
1+
/**
2+
* @param {string} type
3+
* @param {RegExp} regexp
4+
* @returns {*}
5+
*/
6+
export function createStringDateInputType(type: string, regexp: RegExp): any;
187
export function badInputChecker(
198
scope: any,
209
element: any,
@@ -59,27 +48,11 @@ export namespace inputDirective {
5948
/**
6049
* @returns {ng.Directive}
6150
*/
62-
export function hiddenInputBrowserCacheDirective(): ng.Directive;
51+
export function hiddenInputDirective(): ng.Directive;
6352
/**
6453
* @returns {ng.Directive}
6554
*/
6655
export function ngValueDirective(): ng.Directive;
67-
/**
68-
* @param {Date} date
69-
* @param {any} timezone
70-
* @param {undefined} [reverse]
71-
*/
72-
export function convertTimezoneToLocal(
73-
date: Date,
74-
timezone: any,
75-
reverse?: undefined,
76-
): Date;
77-
/**
78-
* @param {any} timezone
79-
* @param {number} [fallback]
80-
* @returns {number}
81-
*/
82-
export function timezoneToOffset(timezone: any, fallback?: number): number;
8356
export const ISO_DATE_REGEXP: RegExp;
8457
export const URL_REGEXP: RegExp;
8558
export const EMAIL_REGEXP: RegExp;

@types/shared/utils.d.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,6 @@ export function isBoolean(value: any): boolean;
195195
* @returns {boolean}
196196
*/
197197
export function isPromiseLike(obj: any): boolean;
198-
/**
199-
* @param {*} value
200-
* @returns {boolean}
201-
*/
202-
export function isTypedArray(value: any): boolean;
203-
/**
204-
* @param {*} obj
205-
* @returns {boolean}
206-
*/
207-
export function isArrayBuffer(obj: any): boolean;
208198
/**
209199
* @param {*} value
210200
* @returns {string | *}

src/angular.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ const STRICT_DI = "strict-di";
3232
const moduleRegistry = {};
3333

3434
export class Angular extends EventTarget {
35-
constructor() {
35+
constructor(submodule = false) {
3636
super();
3737

38+
/** @private @type {boolean} */
39+
this._submodule = submodule;
40+
3841
/** @private @type {!Array<string|any>} */
3942
this._bootsrappedModules = [];
4043

@@ -78,7 +81,9 @@ export class Angular extends EventTarget {
7881
/** @type {any} */ (this.$t)[i] = i;
7982
});
8083

81-
window.angular = this;
84+
if (!submodule) {
85+
window.angular = this;
86+
}
8287
registerNgModule(this);
8388
}
8489

src/core/scope/scope.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ export function isNonScope(target) {
123123
target instanceof Promise ||
124124
target instanceof HTMLCollection ||
125125
target instanceof NodeList ||
126-
target instanceof Event
126+
target instanceof Event ||
127+
target instanceof Date
127128
) {
128129
return true;
129130
}

src/directive/channel/channel.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export function ngChannelDirective($eventBus) {
2222
}
2323
} else if (isString(value)) {
2424
element.innerHTML = value;
25+
} else {
26+
element.innerHTML = value.toString();
2527
}
2628
},
2729
);

0 commit comments

Comments
 (0)