Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Andrey Shilov
Ngx Bootstrap
Commits
a3236900
Commit
a3236900
authored
8 years ago
by
Dmitriy Schekhovtsov
Browse files
Options
Download
Email Patches
Plain Diff
fix(build): fixed tslint issues
parent
7bfbdd43
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
angular-cli.json
+1
-1
angular-cli.json
demo/e2e/data-provider/data-provider.po.ts
+4
-4
demo/e2e/data-provider/data-provider.po.ts
demo/e2e/tests/modals-demo.e2e-spec.ts
+0
-1
demo/e2e/tests/modals-demo.e2e-spec.ts
demo/e2e/tests/typeahead-demo.e2e-spec.ts
+0
-1
demo/e2e/tests/typeahead-demo.e2e-spec.ts
demo/src/app/app.component.ts
+3
-1
demo/src/app/app.component.ts
demo/src/app/common/main-menu/main-menu.component.ts
+3
-1
demo/src/app/common/main-menu/main-menu.component.ts
demo/src/app/common/top-menu/top-menu.component.ts
+3
-1
demo/src/app/common/top-menu/top-menu.component.ts
demo/src/app/components/datepicker/demos/datepicker-demo.component.ts
+23
-21
.../components/datepicker/demos/datepicker-demo.component.ts
demo/src/app/components/pagination/demos/pagination-demo.component.ts
+2
-2
.../components/pagination/demos/pagination-demo.component.ts
demo/src/app/components/progressbar/demos/progressbar-demo.component.ts
+2
-2
...omponents/progressbar/demos/progressbar-demo.component.ts
demo/src/app/components/tabs/demos/tabs-demo.component.ts
+3
-3
demo/src/app/components/tabs/demos/tabs-demo.component.ts
demo/src/app/components/timepicker/demos/timepicker-demo.component.ts
+4
-4
.../components/timepicker/demos/timepicker-demo.component.ts
demo/src/index-bs4.html
+1
-1
demo/src/index-bs4.html
demo/src/index.html
+1
-1
demo/src/index.html
package.json
+1
-1
package.json
scripts/generate-bs4.js
+2
-2
scripts/generate-bs4.js
src/alert/alert.component.ts
+3
-2
src/alert/alert.component.ts
src/buttons/button-checkbox.directive.ts
+3
-1
src/buttons/button-checkbox.directive.ts
src/buttons/button-radio.directive.ts
+4
-1
src/buttons/button-radio.directive.ts
src/datepicker/datepicker.component.ts
+45
-41
src/datepicker/datepicker.component.ts
with
108 additions
and
92 deletions
+108
-92
angular-cli.json
View file @
a3236900
...
...
@@ -15,7 +15,7 @@
"main"
:
"main.ts"
,
"test"
:
"../../scripts/test.ts"
,
"tsconfig"
:
"tsconfig.json"
,
"prefix"
:
"
app
"
,
"prefix"
:
""
,
"mobile"
:
false
,
"styles"
:
[
],
...
...
This diff is collapsed.
Click to expand it.
demo/e2e/data-provider/data-provider.po.ts
View file @
a3236900
...
...
@@ -105,10 +105,10 @@ export class DataProvider {
'
Grouped results modal text
'
:
{
element
:
():
ElementFinder
=>
$
(
'
.card:nth-child(14)
'
),
actualResult
:
'
Model: ""
'
}
};
public
static
typeaheadInputCityTexts
:
any
=
{
'
California
'
:
{
inputText
:
'
Cal
'
,
expectedResult
:
'
California
'
},
'
Texas
'
:
{
inputText
:
'
xa
'
,
expectedResult
:
'
Texas
'
},
'
Florida
'
:
{
inputText
:
'
rida
'
,
expectedResult
:
'
Florida
'
},
'
Mississippi
'
:
{
inputText
:
'
ssi
'
,
expectedResult
:
'
Mississippi
'
},
California
:
{
inputText
:
'
Cal
'
,
expectedResult
:
'
California
'
},
Texas
:
{
inputText
:
'
xa
'
,
expectedResult
:
'
Texas
'
},
Florida
:
{
inputText
:
'
rida
'
,
expectedResult
:
'
Florida
'
},
Mississippi
:
{
inputText
:
'
ssi
'
,
expectedResult
:
'
Mississippi
'
},
'
New Jersey
'
:
{
inputText
:
'
J
'
,
expectedResult
:
'
New Jersey
'
}
};
}
This diff is collapsed.
Click to expand it.
demo/e2e/tests/modals-demo.e2e-spec.ts
View file @
a3236900
...
...
@@ -2,7 +2,6 @@ import { $, browser } from 'protractor';
import
{
leftPanelTests
}
from
'
./leftPanelTests.po
'
;
import
{
DataProvider
}
from
'
../data-provider/data-provider.po
'
;
const
buttonLargeModal
=
$
(
'
.btn:nth-child(1)
'
);
const
buttonSmallModal
=
$
(
'
.btn:nth-child(3)
'
);
const
buttonChildModal
=
$
(
'
.btn:nth-child(5)
'
);
...
...
This diff is collapsed.
Click to expand it.
demo/e2e/tests/typeahead-demo.e2e-spec.ts
View file @
a3236900
...
...
@@ -2,7 +2,6 @@ import { $, browser } from 'protractor';
import
{
leftPanelTests
}
from
'
./leftPanelTests.po
'
;
import
{
DataProvider
}
from
'
../data-provider/data-provider.po
'
;
let
using
=
require
(
'
jasmine-data-provider
'
);
const
inputStatic
=
$
(
'
.container-fluid>input:nth-of-type(1)
'
);
...
...
This diff is collapsed.
Click to expand it.
demo/src/app/app.component.ts
View file @
a3236900
...
...
@@ -16,7 +16,9 @@ if (w && w.__theme === 'bs4') {
export
class
AppComponent
implements
AfterContentInit
{
public
isBs3
:
boolean
=
Ng2BootstrapConfig
.
theme
===
Ng2BootstrapTheme
.
BS3
;
public
constructor
(
private
router
:
Router
,
componentsHelper
:
ComponentsHelper
,
vcr
:
ViewContainerRef
)
{
private
router
:
Router
;
public
constructor
(
router
:
Router
,
componentsHelper
:
ComponentsHelper
,
vcr
:
ViewContainerRef
)
{
this
.
router
=
router
;
componentsHelper
.
setRootViewContainerRef
(
vcr
);
}
...
...
This diff is collapsed.
Click to expand it.
demo/src/app/common/main-menu/main-menu.component.ts
View file @
a3236900
...
...
@@ -14,7 +14,9 @@ export class MainMenuComponent {
public
search
:
any
=
{};
public
hash
:
string
=
''
;
public
constructor
(
private
router
:
Router
)
{
private
router
:
Router
;
public
constructor
(
router
:
Router
)
{
this
.
router
=
router
;
this
.
routes
=
this
.
routes
.
filter
((
v
:
any
)
=>
v
.
path
!==
'
**
'
);
this
.
router
.
events
.
subscribe
((
event
:
any
)
=>
{
if
(
event
instanceof
NavigationEnd
)
{
...
...
This diff is collapsed.
Click to expand it.
demo/src/app/common/top-menu/top-menu.component.ts
View file @
a3236900
...
...
@@ -12,7 +12,9 @@ export class TopMenuComponent implements AfterViewInit {
private
renderer
:
Renderer
;
private
document
:
any
;
public
constructor
(
renderer
:
Renderer
,
@
Inject
(
DOCUMENT
)
document
:
any
,
private
router
:
Router
)
{
private
router
:
Router
;
public
constructor
(
renderer
:
Renderer
,
@
Inject
(
DOCUMENT
)
document
:
any
,
router
:
Router
)
{
this
.
router
=
router
;
this
.
renderer
=
renderer
;
this
.
document
=
document
;
}
...
...
This diff is collapsed.
Click to expand it.
demo/src/app/components/datepicker/demos/datepicker-demo.component.ts
View file @
a3236900
...
...
@@ -6,19 +6,20 @@ import * as moment from 'moment';
templateUrl
:
'
./datepicker-demo.component.html
'
})
export
class
DatepickerDemoComponent
{
public
dt
:
Date
=
new
Date
();
public
minDate
:
Date
=
void
0
;
public
events
:
any
[];
public
tomorrow
:
Date
;
public
afterTomorrow
:
Date
;
public
dt
:
Date
=
new
Date
();
public
minDate
:
Date
=
void
0
;
public
events
:
any
[];
public
tomorrow
:
Date
;
public
afterTomorrow
:
Date
;
public
dateDisabled
:
{
date
:
Date
,
mode
:
string
}[];
public
formats
:
string
[]
=
[
'
DD-MM-YYYY
'
,
'
YYYY/MM/DD
'
,
'
DD.MM.YYYY
'
,
'
shortDate
'
];
public
format
:
string
=
this
.
formats
[
0
];
public
dateOptions
:
any
=
{
public
formats
:
string
[]
=
[
'
DD-MM-YYYY
'
,
'
YYYY/MM/DD
'
,
'
DD.MM.YYYY
'
,
'
shortDate
'
];
public
format
:
string
=
this
.
formats
[
0
];
public
dateOptions
:
any
=
{
formatYear
:
'
YY
'
,
startingDay
:
1
};
private
opened
:
boolean
=
false
;
private
opened
:
boolean
=
false
;
public
constructor
()
{
(
this
.
tomorrow
=
new
Date
()).
setDate
(
this
.
tomorrow
.
getDate
()
+
1
);
...
...
@@ -31,16 +32,17 @@ export class DatepickerDemoComponent {
];
}
public
getDate
():
number
{
public
getDate
():
number
{
return
this
.
dt
&&
this
.
dt
.
getTime
()
||
new
Date
().
getTime
();
}
public
today
():
void
{
public
today
():
void
{
this
.
dt
=
new
Date
();
}
public
d20090824
():
void
{
this
.
dt
=
moment
(
'
2009-08-24
'
,
'
YYYY-MM-DD
'
).
toDate
();
public
d20090824
():
void
{
this
.
dt
=
moment
(
'
2009-08-24
'
,
'
YYYY-MM-DD
'
)
.
toDate
();
}
public
disableTomorrow
():
void
{
...
...
@@ -48,15 +50,15 @@ export class DatepickerDemoComponent {
}
// todo: implement custom class cases
public
getDayClass
(
date
:
any
,
mode
:
string
):
string
{
public
getDayClass
(
date
:
any
,
mode
:
string
):
string
{
if
(
mode
===
'
day
'
)
{
let
dayToCheck
=
new
Date
(
date
).
setHours
(
0
,
0
,
0
,
0
);
for
(
let
i
=
0
;
i
<
this
.
events
.
length
;
i
++
)
{
let
currentDay
=
new
Date
(
this
.
event
s
[
i
]
.
date
).
setHours
(
0
,
0
,
0
,
0
);
for
(
let
event
of
this
.
events
)
{
let
currentDay
=
new
Date
(
event
.
date
).
setHours
(
0
,
0
,
0
,
0
);
if
(
dayToCheck
===
currentDay
)
{
return
this
.
event
s
[
i
]
.
status
;
return
event
.
status
;
}
}
}
...
...
@@ -64,20 +66,20 @@ export class DatepickerDemoComponent {
return
''
;
}
public
disabled
(
date
:
Date
,
mode
:
string
):
boolean
{
public
disabled
(
date
:
Date
,
mode
:
string
):
boolean
{
return
(
mode
===
'
day
'
&&
(
date
.
getDay
()
===
0
||
date
.
getDay
()
===
6
)
);
}
public
open
():
void
{
public
open
():
void
{
this
.
opened
=
!
this
.
opened
;
}
public
clear
():
void
{
public
clear
():
void
{
this
.
dt
=
void
0
;
this
.
dateDisabled
=
undefined
;
}
public
toggleMin
():
void
{
public
toggleMin
():
void
{
this
.
dt
=
new
Date
(
this
.
minDate
.
valueOf
());
}
}
This diff is collapsed.
Click to expand it.
demo/src/app/components/pagination/demos/pagination-demo.component.ts
View file @
a3236900
...
...
@@ -14,10 +14,10 @@ export class PaginationDemoComponent {
public
setPage
(
pageNo
:
number
):
void
{
this
.
currentPage
=
pageNo
;
}
;
}
public
pageChanged
(
event
:
any
):
void
{
console
.
log
(
'
Page changed to:
'
+
event
.
page
);
console
.
log
(
'
Number items per page:
'
+
event
.
itemsPerPage
);
}
;
}
}
This diff is collapsed.
Click to expand it.
demo/src/app/components/progressbar/demos/progressbar-demo.component.ts
View file @
a3236900
...
...
@@ -44,7 +44,7 @@ export class ProgressbarDemoComponent {
this
.
showWarning
=
(
type
===
'
danger
'
||
type
===
'
warning
'
);
this
.
dynamic
=
value
;
this
.
type
=
type
;
}
;
}
public
randomStacked
():
void
{
let
types
=
[
'
success
'
,
'
info
'
,
'
warning
'
,
'
danger
'
];
...
...
@@ -62,5 +62,5 @@ export class ProgressbarDemoComponent {
type
:
types
[
index
]
});
}
}
;
}
}
This diff is collapsed.
Click to expand it.
demo/src/app/components/tabs/demos/tabs-demo.component.ts
View file @
a3236900
...
...
@@ -17,13 +17,13 @@ export class TabsDemoComponent {
setTimeout
(
function
():
void
{
alert
(
'
You
\'
ve selected the alert tab!
'
);
});
}
;
}
public
setActiveTab
(
index
:
number
):
void
{
this
.
tabs
[
index
].
active
=
true
;
}
;
}
public
removeTabHandler
(
/*tab:any*/
):
void
{
console
.
log
(
'
Remove Tab handler
'
);
}
;
}
}
This diff is collapsed.
Click to expand it.
demo/src/app/components/timepicker/demos/timepicker-demo.component.ts
View file @
a3236900
...
...
@@ -18,20 +18,20 @@ export class TimepickerDemoComponent {
public
toggleMode
():
void
{
this
.
ismeridian
=
!
this
.
ismeridian
;
}
;
}
public
update
():
void
{
let
d
=
new
Date
();
d
.
setHours
(
14
);
d
.
setMinutes
(
0
);
this
.
mytime
=
d
;
}
;
}
public
changed
():
void
{
console
.
log
(
'
Time changed to:
'
+
this
.
mytime
);
}
;
}
public
clear
():
void
{
this
.
mytime
=
void
0
;
}
;
}
}
This diff is collapsed.
Click to expand it.
demo/src/index-bs4.html
View file @
a3236900
...
...
@@ -13,7 +13,7 @@
<link
href=
"https://fonts.googleapis.com/css?family=Roboto:400,300,700"
rel=
"stylesheet"
type=
"text/css"
>
<!--link to bootstrap.css v4.0.0-alpha-->
<link
href=
"
https:
//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css"
rel=
"stylesheet"
>
<link
href=
"//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css"
rel=
"stylesheet"
>
<!--<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">-->
<link
rel=
"stylesheet"
href=
"assets/css/glyphicons.css"
>
<link
rel=
"stylesheet"
href=
"assets/css/style.css"
>
...
...
This diff is collapsed.
Click to expand it.
demo/src/index.html
View file @
a3236900
...
...
@@ -16,7 +16,7 @@
<!--<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">-->
<!--link to bootstrap.css-->
<link
rel=
"stylesheet"
href=
"
https:
//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"assets/css/style.css"
>
<link
rel=
"stylesheet"
href=
"assets/css/prettify-angulario.css"
>
</head>
...
...
This diff is collapsed.
Click to expand it.
package.json
View file @
a3236900
...
...
@@ -17,7 +17,7 @@
"build"
:
"ngm build -p src"
,
"start"
:
"ng serve --aot"
,
"generate-bs4"
:
"node scripts/generate-bs4.js"
,
"pretest"
:
"run-s build link"
,
"pretest"
:
"run-s
link
build link"
,
"test"
:
"ng test -sr"
,
"test-coverage"
:
"ng test -sr -cc"
,
"pree2e"
:
"webdriver-manager update"
,
...
...
This diff is collapsed.
Click to expand it.
scripts/generate-bs4.js
View file @
a3236900
...
...
@@ -7,8 +7,8 @@ const files = {
const
toReplace
=
[
{
from
:
'
<link rel="stylesheet" href="
https:
//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
'
,
to
:
'
<link href="
https:
//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">
'
from
:
'
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
'
,
to
:
'
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">
'
},
{
from
:
'
<script src="assets/js/prettify.min.js"></script>
'
,
to
:
'
<script src="assets/js/prettify.min.js"></script>
\r\n
<!-- Enable bootstrap 4 theme -->
\r\n
<script>window.__theme =
\'
bs4
\'
;</script>
'
...
...
This diff is collapsed.
Click to expand it.
src/alert/alert.component.ts
View file @
a3236900
...
...
@@ -11,7 +11,6 @@ const ALERT_TEMPLATE = `
</div>
`
;
// TODO: templateUrl
@
Component
({
selector
:
'
alert
'
,
template
:
ALERT_TEMPLATE
...
...
@@ -26,7 +25,9 @@ export class AlertComponent implements OnInit {
public
closed
:
boolean
;
protected
classes
:
string
[]
=
[];
public
constructor
(
public
config
:
AlertConfig
)
{
public
config
:
AlertConfig
;
public
constructor
(
config
:
AlertConfig
)
{
this
.
config
=
config
;
this
.
configureOptions
();
}
...
...
This diff is collapsed.
Click to expand it.
src/buttons/button-checkbox.directive.ts
View file @
a3236900
...
...
@@ -8,6 +8,7 @@ import { ControlValueAccessor, NgModel } from '@angular/forms';
@
Directive
({
selector
:
'
[btnCheckbox][ngModel]
'
})
export
class
ButtonCheckboxDirective
implements
ControlValueAccessor
,
OnInit
{
public
cd
:
NgModel
;
public
el
:
ElementRef
;
@
Input
()
public
btnCheckboxTrue
:
any
;
@
Input
()
public
btnCheckboxFalse
:
any
;
...
...
@@ -29,7 +30,8 @@ export class ButtonCheckboxDirective implements ControlValueAccessor, OnInit {
this
.
cd
.
viewToModelUpdate
(
this
.
value
);
}
public
constructor
(@
Self
()
cd
:
NgModel
,
protected
el
:
ElementRef
)
{
public
constructor
(@
Self
()
cd
:
NgModel
,
el
:
ElementRef
)
{
this
.
el
=
el
;
this
.
cd
=
cd
;
// hack !
cd
.
valueAccessor
=
this
;
...
...
This diff is collapsed.
Click to expand it.
src/buttons/button-radio.directive.ts
View file @
a3236900
...
...
@@ -21,6 +21,8 @@ export class ButtonRadioDirective implements ControlValueAccessor, OnInit {
@
Input
()
public
uncheckable
:
boolean
;
@
Input
()
public
value
:
any
;
protected
el
:
ElementRef
;
@
HostBinding
(
'
class.active
'
)
public
get
isActive
():
boolean
{
return
this
.
btnRadio
===
this
.
value
;
...
...
@@ -42,7 +44,8 @@ export class ButtonRadioDirective implements ControlValueAccessor, OnInit {
this
.
onChange
(
this
.
value
);
}
public
constructor
(
protected
el
:
ElementRef
)
{
public
constructor
(
el
:
ElementRef
)
{
this
.
el
=
el
;
}
public
ngOnInit
():
void
{
...
...
This diff is collapsed.
Click to expand it.
src/datepicker/datepicker.component.ts
View file @
a3236900
import
{
Component
,
EventEmitter
,
Input
,
Output
,
Self
,
ViewChild
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
Output
,
Self
,
ViewChild
}
from
'
@angular/core
'
;
import
{
DatePickerInnerComponent
}
from
'
./datepicker-inner.component
'
;
import
{
ControlValueAccessor
,
NgModel
}
from
'
@angular/forms
'
;
import
{
DatepickerConfig
}
from
'
./datepicker.config
'
;
...
...
@@ -40,45 +42,51 @@ import { DatepickerConfig } from './datepicker.config';
})
/* tslint:enable:component-selector-name component-selector-type */
export
class
DatePickerComponent
implements
ControlValueAccessor
{
@
Input
()
public
datepickerMode
:
string
;
@
Input
()
public
initDate
:
Date
;
@
Input
()
public
minDate
:
Date
;
@
Input
()
public
maxDate
:
Date
;
@
Input
()
public
minMode
:
string
;
@
Input
()
public
maxMode
:
string
;
@
Input
()
public
showWeeks
:
boolean
;
@
Input
()
public
formatDay
:
string
;
@
Input
()
public
formatMonth
:
string
;
@
Input
()
public
formatYear
:
string
;
@
Input
()
public
formatDayHeader
:
string
;
@
Input
()
public
formatDayTitle
:
string
;
@
Input
()
public
formatMonthTitle
:
string
;
@
Input
()
public
startingDay
:
number
;
@
Input
()
public
yearRange
:
number
;
@
Input
()
public
onlyCurrentMonth
:
boolean
;
@
Input
()
public
shortcutPropagation
:
boolean
;
@
Input
()
public
customClass
:{
date
:
Date
,
mode
:
string
,
clazz
:
string
}[];
@
Input
()
public
datepickerMode
:
string
;
@
Input
()
public
initDate
:
Date
;
@
Input
()
public
minDate
:
Date
;
@
Input
()
public
maxDate
:
Date
;
@
Input
()
public
minMode
:
string
;
@
Input
()
public
maxMode
:
string
;
@
Input
()
public
showWeeks
:
boolean
;
@
Input
()
public
formatDay
:
string
;
@
Input
()
public
formatMonth
:
string
;
@
Input
()
public
formatYear
:
string
;
@
Input
()
public
formatDayHeader
:
string
;
@
Input
()
public
formatDayTitle
:
string
;
@
Input
()
public
formatMonthTitle
:
string
;
@
Input
()
public
startingDay
:
number
;
@
Input
()
public
yearRange
:
number
;
@
Input
()
public
onlyCurrentMonth
:
boolean
;
@
Input
()
public
shortcutPropagation
:
boolean
;
@
Input
()
public
customClass
:
{
date
:
Date
,
mode
:
string
,
clazz
:
string
}[];
@
Input
()
public
monthColLimit
:
number
;
@
Input
()
public
yearColLimit
:
number
;
@
Input
()
public
dateDisabled
:{
date
:
Date
,
mode
:
string
}[];
@
Input
()
public
dateDisabled
:
{
date
:
Date
,
mode
:
string
}[];
@
Output
()
public
selectionDone
:
EventEmitter
<
Date
>
=
new
EventEmitter
<
Date
>
(
undefined
);
@
Input
()
public
get
activeDate
():
Date
{
return
this
.
_activeDate
||
this
.
_now
;
}
@
ViewChild
(
DatePickerInnerComponent
)
public
_datePicker
:
DatePickerInnerComponent
;
public
set
activeDate
(
value
:
Date
)
{
this
.
_activeDate
=
value
;
}
@
Output
()
public
selectionDone
:
EventEmitter
<
Date
>
=
new
EventEmitter
<
Date
>
(
undefined
);
public
onChange
:
any
=
Function
.
prototype
;
public
onTouched
:
any
=
Function
.
prototype
;
@
ViewChild
(
DatePickerInnerComponent
)
public
_datePicker
:
DatePickerInnerComponent
;
public
cd
:
NgModel
;
protected
_now
:
Date
=
new
Date
();
protected
_activeDate
:
Date
;
public
onChange
:
any
=
Function
.
prototype
;
public
onTouched
:
any
=
Function
.
prototype
;
@
Input
()
p
ublic
get
activeDate
():
Date
{
return
this
.
_activeDate
||
this
.
_now
;
}
public
cd
:
NgModel
;
p
rotected
_now
:
Date
=
new
Date
();
protected
_activeDate
:
Date
;
protected
config
:
DatepickerConfig
;
public
constructor
(@
Self
()
cd
:
NgModel
,
protected
config
:
DatepickerConfig
)
{
public
constructor
(@
Self
()
cd
:
NgModel
,
config
:
DatepickerConfig
)
{
this
.
config
=
config
;
this
.
cd
=
cd
;
// hack
cd
.
valueAccessor
=
this
;
...
...
@@ -89,20 +97,16 @@ export class DatePickerComponent implements ControlValueAccessor {
Object
.
assign
(
this
,
this
.
config
);
}
public
set
activeDate
(
value
:
Date
)
{
this
.
_activeDate
=
value
;
}
public
onUpdate
(
event
:
any
):
void
{
public
onUpdate
(
event
:
any
):
void
{
this
.
cd
.
viewToModelUpdate
(
event
);
}
public
onSelectionDone
(
event
:
Date
):
void
{
public
onSelectionDone
(
event
:
Date
):
void
{
this
.
selectionDone
.
emit
(
event
);
}
// todo: support null value
public
writeValue
(
value
:
any
):
void
{
public
writeValue
(
value
:
any
):
void
{
if
(
this
.
_datePicker
.
compare
(
value
,
this
.
_activeDate
)
===
0
)
{
return
;
}
...
...
@@ -115,11 +119,11 @@ export class DatePickerComponent implements ControlValueAccessor {
this
.
activeDate
=
value
?
new
Date
(
value
)
:
void
0
;
}
public
registerOnChange
(
fn
:(
_
:
any
)
=>
{}):
void
{
public
registerOnChange
(
fn
:
(
_
:
any
)
=>
{}):
void
{
this
.
onChange
=
fn
;
}
public
registerOnTouched
(
fn
:()
=>
{}):
void
{
public
registerOnTouched
(
fn
:
()
=>
{}):
void
{
this
.
onTouched
=
fn
;
}
}
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help