import { ApiSectionsComponent } from '../../docs/demo-section-components/demo-api-section'; import { ContentSection } from '../../docs/models/content-section.model'; import { DatepickerDemoComponent } from './demos/datepicker-demo.component'; import { DemoDatepickerBasicComponent } from './demos/basic/basic'; import { DemoDatepickerByIsOpenPropComponent } from './demos/trigger-by-isopen-property/trigger-by-isopen-property'; import { DemoDatepickerChangeLocaleComponent } from './demos/change-locale/change-locale'; import { DemoDatepickerColorThemingComponent } from './demos/color-theming/color-theming'; import { DemoDatepickerConfigMethodComponent } from './demos/config-method/config-method'; import { DemoDatePickerConfigObjectComponent } from './demos/config-object/config-object'; import { DemoDatePickerCustomFormatComponent } from './demos/custom-format/custom-format'; import { DemoDatepickerDateInitialStateComponent } from './demos/date-initial-state/date-initial-state'; import { DemoDatepickerDatesDisabledComponent } from './demos/disable-dates/disable-dates'; import { DemoDatepickerDaysDisabledComponent } from './demos/disable-days/disable-days'; import { DemoDatepickerDisabledComponent } from './demos/disabled/disabled.component'; import { DemoDatepickerFormsComponent } from './demos/forms/forms.component'; import { DemoDatepickerHideOnScrollComponent } from './demos/hide-on-scroll/hide-on-scroll'; import { DemoDatepickerInlineComponent } from './demos/inline-datepicker/inline-datepicker.component'; import { DemoDatepickerMinMaxComponent } from './demos/min-max/min-max.component'; import { DemoDatepickerMinModeComponent } from './demos/min-mode/min-mode.component'; import { DemoDatepickerOutsideClickComponent } from './demos/outside-click/outside-click'; import { DemoDatepickerPlacementComponent } from './demos/placement/placement'; import { DemoDatepickerReactiveFormsComponent } from './demos/reactive-forms/reactive-forms.component'; import { DemoDatepickerDateCustomClassesComponent } from './demos/date-custom-classes/date-custom-classes'; import { DemoDatePickerSelectDatesFromOtherMonthsComponent } from './demos/select-dates-from-other-months/select-dates-from-other-months'; import { DemoDatePickerAdaptivePositionComponent } from './demos/adaptive-position/adaptive-position'; import { DemoDatePickerAnimatedComponent } from './demos/animated/animated'; import { DemoDatepickerCustomTodayClassComponent } from './demos/custom-today-class/custom-today-class.component'; import { DemoDatePickerSelectWeekComponent } from './demos/select-week/select-week'; import { DemoDatepickerTriggersCustomComponent } from './demos/triggers-custom/triggers-custom'; import { DemoDatepickerTriggersManualComponent } from './demos/triggers-manual/triggers-manual'; import { DemoDatepickerValueChangeEventComponent } from './demos/value-change-event/value-change-event'; import { DemoDatePickerVisibilityEventsComponent } from './demos/visibility-events/visibility-events'; import { DemoTopSectionComponent } from '../../docs/demo-section-components/demo-top-section'; import { ExamplesComponent } from '../../docs/demo-section-components/demo-examples-section'; import { NgApiDocComponent, NgApiDocConfigComponent } from '../../docs/api-docs'; export const demoComponentContent: ContentSection[] = [ { name: 'Usage', anchor: 'usage', outlet: DemoTopSectionComponent, content: { doc: require('!!raw-loader!./docs/usage.md') } }, { name: 'Examples', anchor: 'examples', outlet: ExamplesComponent, content: [ { title: 'Basic', anchor: 'basic', component: require('!!raw-loader!./demos/basic/basic.ts'), html: require('!!raw-loader!./demos/basic/basic.html'), description: `

Note: If you installed ngx-bootstrap not via ng add command, you will need to perform a several actions

Notable change is additional css for it "/datepicker/bs-datepicker.css"

There are two ways of adding css:

`, outlet: DemoDatepickerBasicComponent }, { title: 'Inline', anchor: 'inline-datepicker', component: require('!!raw-loader!./demos/inline-datepicker/inline-datepicker.component.ts'), html: require('!!raw-loader!./demos/inline-datepicker/inline-datepicker.component.html'), description: `

with initial state set by bsInlineValue property

`, outlet: DemoDatepickerInlineComponent }, { title: 'With animation', anchor: 'animated', component: require('!!raw-loader!./demos/animated/animated'), html: require('!!raw-loader!./demos/animated/animated.html'), description: `You can enable animation via isAnimated config option`, outlet: DemoDatePickerAnimatedComponent }, { title: 'Adaptive position', anchor: 'adaptive-position', component: require('!!raw-loader!./demos/adaptive-position/adaptive-position.ts'), html: require('!!raw-loader!./demos/adaptive-position/adaptive-position.html'), description: `

You can enable adaptive position via adaptivePosition option in bsConfig

`, outlet: DemoDatePickerAdaptivePositionComponent }, { title: 'Initial state', anchor: 'date-initial-state', component: require('!!raw-loader!./demos/date-initial-state/date-initial-state.ts'), html: require('!!raw-loader!./demos/date-initial-state/date-initial-state.html'), outlet: DemoDatepickerDateInitialStateComponent }, { title: 'Custom date format', anchor: 'format', component: require('!!raw-loader!./demos/custom-format/custom-format.ts'), html: require('!!raw-loader!./demos/custom-format/custom-format.html'), description: `

You can easily change the date format by specifying the dateInputFormat in [bsConfig]

To set your own date format you can use variety of formats provided by moment.js

The following examples show how to use several date formats inside a form:

`, outlet: DemoDatePickerCustomFormatComponent }, { title: 'Hide on scroll', anchor: 'hide-on-scroll', component: require('!!raw-loader!./demos/hide-on-scroll/hide-on-scroll.ts'), html: require('!!raw-loader!./demos/hide-on-scroll/hide-on-scroll.html'), description: `

Hide the datepicker on page scroll.

`, outlet: DemoDatepickerHideOnScrollComponent }, { title: 'Themes', anchor: 'themes', component: require('!!raw-loader!./demos/color-theming/color-theming.ts'), html: require('!!raw-loader!./demos/color-theming/color-theming.html'), description: `

Datepicker comes with some default color schemes. You can change it by manipulating containerClass property in bsConfig object

There are 6 color schemes: theme-default, theme-green, theme-blue, theme-dark-blue, theme-red, theme-orange

`, outlet: DemoDatepickerColorThemingComponent }, { title: 'Locales', anchor: 'locales', component: require('!!raw-loader!./demos/change-locale/change-locale.ts'), html: require('!!raw-loader!./demos/change-locale/change-locale.html'), description: `

Datepicker can use different locales.
It's possible to change a locale by calling use method of BsLocaleService, list of available locales is in dropdown below.

To use a different locale, you have to import it from ngx-bootstrap/chronos first, then define it in your @NgModule using function defineLocale

Example:

import { defineLocale } from 'ngx-bootstrap/chronos';
import { deLocale } from 'ngx-bootstrap/locale';
defineLocale('de', deLocale);

`, outlet: DemoDatepickerChangeLocaleComponent }, { title: 'Min-max', anchor: 'min-max', component: require('!!raw-loader!./demos/min-max/min-max.component.ts'), html: require('!!raw-loader!./demos/min-max/min-max.component.html'), description: `

You can set min and max date of datepicker/daterangepicker using minDate and maxDate properties

In the following example minDate is set to yesterday and maxDate to the current day in the next week

`, outlet: DemoDatepickerMinMaxComponent }, { title: 'Days disabled', anchor: 'days-disabled', component: require('!!raw-loader!./demos/disable-days/disable-days.ts'), html: require('!!raw-loader!./demos/disable-days/disable-days.html'), description: `

You can set which days of the week should be disabled with daysDisabled

In the following example daysDisabled is set with an array which disabled saturday and sunday. Sunday is considered the first day of the week and thus has the value 0

`, outlet: DemoDatepickerDaysDisabledComponent }, { title: 'Dates disabled', anchor: 'dates-disabled', component: require('!!raw-loader!./demos/disable-dates/disable-dates.ts'), html: require('!!raw-loader!./demos/disable-dates/disable-dates.html'), description: `

You can set which dates should be disabled with datesDisabled

In the following example datesDisabled is set with an array to disable 2019-02-05 and 2019-02-09.

`, outlet: DemoDatepickerDatesDisabledComponent }, { title: 'Min-mode', anchor: 'min-mode', component: require('!!raw-loader!./demos/min-mode/min-mode.component.ts'), html: require('!!raw-loader!./demos/min-mode/min-mode.component.html'), description: `

You can set min view mode of datepicker using minMode property

In the following example minMode is set to 'month'

`, outlet: DemoDatepickerMinModeComponent }, { title: 'Disabled', anchor: 'disabled-datepicker', component: require('!!raw-loader!./demos/disabled/disabled.component.ts'), html: require('!!raw-loader!./demos/disabled/disabled.component.html'), description: `

If you want to disable datepicker's or daterangepicker's content set isDisabled property to true

`, outlet: DemoDatepickerDisabledComponent }, { title: 'Custom today class', anchor: 'today-class', component: require('!!raw-loader!./demos/custom-today-class/custom-today-class.component.ts'), html: require('!!raw-loader!./demos/custom-today-class/custom-today-class.component.html'), description: `

If you want to add custom class to current day datepicker's content set value to customTodayClass option in bsConfig

`, outlet: DemoDatepickerCustomTodayClassComponent }, { title: 'Forms', anchor: 'forms', component: require('!!raw-loader!./demos/forms/forms.component.ts'), html: require('!!raw-loader!./demos/forms/forms.component.html'), description: `

Datepicker and daterangepicker can be used in forms. Keep in mind that value of ngModel is Date object for datepicker and array of 2 Date objects for daterangepicker

`, outlet: DemoDatepickerFormsComponent }, { title: 'Reactive forms', anchor: 'reactive-forms', component: require('!!raw-loader!./demos/reactive-forms/reactive-forms.component.ts'), html: require('!!raw-loader!./demos/reactive-forms/reactive-forms.component.html'), outlet: DemoDatepickerReactiveFormsComponent }, { title: 'Manual triggering', anchor: 'triggers-manual', component: require('!!raw-loader!./demos/triggers-manual/triggers-manual.ts'), html: require('!!raw-loader!./demos/triggers-manual/triggers-manual.html'), description: `

You can manage datepicker's state by using its show(), hide() and toggle() methods

`, outlet: DemoDatepickerTriggersManualComponent }, { title: 'Placement', anchor: 'placement', component: require('!!raw-loader!./demos/placement/placement.ts'), html: require('!!raw-loader!./demos/placement/placement.html'), description: `

Add placement property if you want to change placement

`, outlet: DemoDatepickerPlacementComponent }, { title: 'Config method', anchor: 'config-method', component: require('!!raw-loader!./demos/config-method/config-method.ts'), html: require('!!raw-loader!./demos/config-method/config-method.html'), description: `

You can manage datepicker's options by using its setConfig() method

`, outlet: DemoDatepickerConfigMethodComponent }, { title: 'Visibility Events', anchor: 'visibility-events', component: require('!!raw-loader!./demos/visibility-events/visibility-events.ts'), html: require('!!raw-loader!./demos/visibility-events/visibility-events.html'), description: `

You can subscribe to datepicker's visibility events

`, outlet: DemoDatePickerVisibilityEventsComponent }, { title: 'Value change event', anchor: 'value-change-event', component: require('!!raw-loader!./demos/value-change-event/value-change-event.ts'), html: require('!!raw-loader!./demos/value-change-event/value-change-event.html'), description: `

You can subscribe to datepicker's value change event (bsValueChange).

`, outlet: DemoDatepickerValueChangeEventComponent }, { title: 'Config properties', anchor: 'config-object', component: require('!!raw-loader!./demos/config-object/config-object.ts'), html: require('!!raw-loader!./demos/config-object/config-object.html'), description: `

You can configure the datepicker via its bsConfig option

`, outlet: DemoDatePickerConfigObjectComponent }, { title: 'Select dates from other month', anchor: 'select-dates-from-other-month', component: require('!!raw-loader!./demos/select-dates-from-other-months/select-dates-from-other-months.ts'), html: require('!!raw-loader!./demos/select-dates-from-other-months/select-dates-from-other-months.html'), description: `

You can enable dates from other months via selectFromOtherMonth option in bsConfig

`, outlet: DemoDatePickerSelectDatesFromOtherMonthsComponent }, { title: 'Select week', anchor: 'select-week', component: require('!!raw-loader!./demos/select-week/select-week.ts'), html: require('!!raw-loader!./demos/select-week/select-week.html'), description: `

You can enable ability to select a week number (first day of the week will be selected) via selectWeek option in bsConfig

`, outlet: DemoDatePickerSelectWeekComponent }, { title: 'Outside click', anchor: 'outside-click', component: require('!!raw-loader!./demos/outside-click/outside-click.ts'), html: require('!!raw-loader!./demos/outside-click/outside-click.html'), description: `

Datepicker closes after outside click by default. To change this behavior, use outsideClick property.

`, outlet: DemoDatepickerOutsideClickComponent }, { title: 'Trigger by isOpen property', anchor: 'trigger-by-isopen-property', component: require('!!raw-loader!./demos/trigger-by-isopen-property/trigger-by-isopen-property.ts'), html: require('!!raw-loader!./demos/trigger-by-isopen-property/trigger-by-isopen-property.html'), description: `

Datepicker can be shown or hidden by changing isOpen property

`, outlet: DemoDatepickerByIsOpenPropComponent }, { title: 'Custom triggers', anchor: 'triggers-custom', component: require('!!raw-loader!./demos/triggers-custom/triggers-custom.ts'), html: require('!!raw-loader!./demos/triggers-custom/triggers-custom.html'), description: `

Use different triggers ( for example keydown, mouseenter and dblclick ) to interact with datepicker

`, outlet: DemoDatepickerTriggersCustomComponent }, { title: 'Date custom classes', anchor: 'date-custom-classes', component: require('!!raw-loader!./demos/date-custom-classes/date-custom-classes.ts'), html: require('!!raw-loader!./demos/date-custom-classes/date-custom-classes.html'), style: require('!!raw-loader!./demos/date-custom-classes/date-custom-classes.scss'), description: `

Style dates with custom classes

`, outlet: DemoDatepickerDateCustomClassesComponent } ] }, { name: 'API Reference', anchor: 'api-reference', outlet: ApiSectionsComponent, content: [ { title: 'BsDatepickerDirective', anchor: 'bs-datepicker-component', outlet: NgApiDocComponent }, { title: 'BsDaterangepickerDirective', anchor: 'bs-daterangepicker', outlet: NgApiDocComponent }, { title: 'BsDatepickerInlineDirective', anchor: 'bs-datepicker-inline', outlet: NgApiDocComponent }, { title: 'BsDatepickerConfig', anchor: 'bs-datepicker-config', outlet: NgApiDocConfigComponent } ] } ]; export const demoComponentContentOld: ContentSection[] = [ { name: 'Usage', anchor: 'usage', outlet: DemoTopSectionComponent, content: { doc: require('!!raw-loader!./docs/usageOld.md') } }, { name: 'Examples', anchor: 'examples-old', outlet: ExamplesComponent, content: [ { title: 'Basic', anchor: 'basic-old', component: require('!!raw-loader!./demos/datepicker-demo.component.ts'), html: require('!!raw-loader!./demos/datepicker-demo.component.html'), outlet: DatepickerDemoComponent } ] }, { name: 'API Reference', anchor: 'api-reference', outlet: ApiSectionsComponent, content: [ { title: 'DatePickerComponent', anchor: 'datepicker-component', outlet: NgApiDocComponent } ] } ];