import { ApiSectionsComponent } from '@ngx-bootstrap-doc/docs'; import { ContentSection } from '@ngx-bootstrap-doc/docs'; 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 { DemoDatepickerDatesEnabledComponent } from './demos/enable-dates/enable-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 { DemoDatePickerReturnFocusToInputComponent } from './demos/return-focus-to-input/return-focus-to-input.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 { ExamplesComponent } from '@ngx-bootstrap-doc/docs'; import { NgApiDocComponent, NgApiDocConfigComponent } from '@ngx-bootstrap-doc/docs'; import { DemoDatePickerQuickSelectRangesComponent } from './demos/quick-select-ranges/quick-select-ranges'; import { DemoDateRangePickerShowPreviousMonth } from './demos/daterangepicker-show-previous-month/show-previous-month'; import { DemoDatePickerSelectWeekRangeComponent } from './demos/select-week-range/select-week-range'; import { DemoDatePickerTooltipToSelectedDates } from './demos/tooltip-to-selected-dates/tooltip-to-selected-dates'; import { DemoDateRangePickerMaxDateRangeComponent } from './demos/max-date-range/max-date-range'; import { DemoDateRangePickerDisplayOneMonth } from './demos/daterangepicker-display-one-month/display-one-month'; import { DemoDatepickerTodayButtonComponent } from './demos/today-button/today-button'; import { DemoDatepickerClearButtonComponent } from './demos/clear-button/clear-button'; import { DemoDatepickerStartViewComponent } from "./demos/start-view/start-view"; import { DemoDatepickerPreventChangeToNextMonthComponent } from './demos/prevent-change-to-next-month/prevent-change-to-next-month.component'; import { DemoDatepickerWithTimepickerComponent } from './demos/with-timepicker/with-timepicker'; export const demoComponentContent: ContentSection[] = [ { name: 'Overview', anchor: 'overview', tabName: 'overview', 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:
<link rel="stylesheet"
href="https://unpkg.com/ngx-bootstrap/datepicker/bs-datepicker.css"> to your
index.htmldist/ngx-bootstrap/datepicker/bs-datepicker.css via package bundler
like Angular CLI, if you're using one.
with initial state set by bsInlineValue property
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
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:
YYYY-MM-DDMM/DD/YYYYMMMM Do YYYY,h:mm:ss aHide 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
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);
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
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
You can set which dates should be disabled with datesDisabled
In the following example datesDisabled is set with an array to disable 2020-02-05 and 2020-02-09.
NOTE: DO NOT USE this functionality with datesEnabled at the same time
You can set which dates should be enable with datesEnabled
In the following example datesEnabled is set with an array to enable 2020-02-06, 2020-02-08 and 2020-02-11. All other dates are disabled
NOTE: DO NOT USE this functionality with datesDisabled at the same time
You can configure, how many months you want to show for daterangepicker via displayMonths in BsDaterangepickerConfig.
With displayOneMonthRange you can show only one month for two cases
You can set min view mode of datepicker using minMode property
In the following example minMode is set to 'month'
If you want to disable datepicker's or daterangepicker's content set isDisabled property to true
If you want to add custom class to current day datepicker's content set value to customTodayClass option in bsConfig
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
Allows to return focus to input of datepicker or daterangepicker after the date or daterange selection
`, outlet: DemoDatePickerReturnFocusToInputComponent }, { 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
Add placement property if you want to change placement
You can manage datepicker's options by using its setConfig() method
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).
You can configure the datepicker via its bsConfig option
You can enable dates from other months via selectFromOtherMonth option in bsConfig
You can enable ability to select a week number (first day of the week will be selected) via selectWeek option in bsConfig
You can enable ability to select a week number (range with first weekday - last weekday will be selected) via selectWeekRange option in bsConfig
Datepicker closes after outside click by default. To change
this behavior, use outsideClick property.
Datepicker can be shown or hidden by changing isOpen property
Use different triggers ( for example keydown, mouseenter and
dblclick ) to interact with datepicker
Style dates with custom classes
`, outlet: DemoDatepickerDateCustomClassesComponent }, { title: 'Tooltip for selected dates', anchor: 'tooltip-for-selected-dates', component: require('!!raw-loader!./demos/tooltip-to-selected-dates/tooltip-to-selected-dates.ts'), html: require('!!raw-loader!./demos/tooltip-to-selected-dates/tooltip-to-selected-dates.html'), description: ``, outlet: DemoDatePickerTooltipToSelectedDates }, { title: 'Quick select ranges', anchor: 'quick-select-ranges', component: require('!!raw-loader!./demos/quick-select-ranges/quick-select-ranges.ts'), html: require('!!raw-loader!./demos/quick-select-ranges/quick-select-ranges.html'), description: `Quick select ranges can be added to Daterangepicker using ranges
Pick some date from second month and it wont change to the next month
`, outlet: DemoDatepickerPreventChangeToNextMonthComponent }, { title: 'Previous month in Daterangepicker', anchor: 'daterangepicker-previous-month', component: require('!!raw-loader!./demos/daterangepicker-show-previous-month/show-previous-month.ts'), html: require('!!raw-loader!./demos/daterangepicker-show-previous-month/show-previous-month.html'), description: `Pick previous & current month instead of current & next month.When daterange selected and related to current month, daterangepicker will works by default, with current & next month
`, outlet: DemoDateRangePickerShowPreviousMonth }, { title: 'Show Today Button', anchor: 'datepicker-show-today-button', component: require('!!raw-loader!./demos/today-button/today-button.ts'), html: require('!!raw-loader!./demos/today-button/today-button.html'), description: `Display an optional 'Today' button that will automatically select today's date.
`, outlet: DemoDatepickerTodayButtonComponent, }, { title: 'Show Clear Button', anchor: 'datepicker-show-clear-button', component: require('!!raw-loader!./demos/clear-button/clear-button.ts'), html: require('!!raw-loader!./demos/clear-button/clear-button.html'), description: `Display an optional 'Clear' button that will automatically clear date.
`, outlet: DemoDatepickerClearButtonComponent }, { title: 'Start view', anchor: 'start-view', component: require('!!raw-loader!./demos/start-view/start-view.ts'), html: require('!!raw-loader!./demos/start-view/start-view.html'), description: `Add startView property if you want to change start view
Max date range after first date selection can be added to Daterangepicker using maxDateRange.
If you also use maxDate property, you can't select second date, which exceeds value of maxDate.
withTimepicker config option`,
outlet: DemoDatepickerWithTimepickerComponent
},
]
},
{
name: 'Installation',
anchor: 'api-reference',
tabName: 'api',
usage: require('!!raw-loader!./docs/usage.md'),
importInfo: 'ng add ngx-bootstrap --component datepicker',
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
}
]
},
{
name: 'Examples',
anchor: 'examples',
tabName: 'examples',
outlet: ExamplesComponent,
content: [
{
title: 'Basic',
anchor: 'basic-ex',
outlet: DemoDatepickerBasicComponent
},
{
title: 'Inline',
anchor: 'inline-datepicker-ex',
outlet: DemoDatepickerInlineComponent
},
{
title: 'With animation',
anchor: 'animated-ex',
outlet: DemoDatePickerAnimatedComponent
},
{
title: 'Adaptive position',
anchor: 'adaptive-position-ex',
outlet: DemoDatePickerAdaptivePositionComponent
},
{
title: 'Initial state',
anchor: 'date-initial-state-ex',
outlet: DemoDatepickerDateInitialStateComponent
},
{
title: 'Custom date format',
anchor: 'format-ex',
outlet: DemoDatePickerCustomFormatComponent
},
{
title: 'Hide on scroll',
anchor: 'hide-on-scroll-ex',
outlet: DemoDatepickerHideOnScrollComponent
},
{
title: 'Themes',
anchor: 'themes-ex',
outlet: DemoDatepickerColorThemingComponent
},
{
title: 'Locales',
anchor: 'locales-ex',
outlet: DemoDatepickerChangeLocaleComponent
},
{
title: 'Min-max',
anchor: 'min-max-ex',
outlet: DemoDatepickerMinMaxComponent
},
{
title: 'Days disabled',
anchor: 'days-disabled-ex',
outlet: DemoDatepickerDaysDisabledComponent
},
{
title: 'Dates disabled',
anchor: 'dates-disabled-ex',
outlet: DemoDatepickerDatesDisabledComponent
},
{
title: 'Dates enabled',
anchor: 'dates-enabled-ex',
outlet: DemoDatepickerDatesEnabledComponent
},
{
title: 'Display one month',
anchor: 'display-one-month-ex',
outlet: DemoDateRangePickerDisplayOneMonth
},
{
title: 'Min-mode',
anchor: 'min-mode-ex',
outlet: DemoDatepickerMinModeComponent
},
{
title: 'Disabled',
anchor: 'disabled-datepicker-ex',
outlet: DemoDatepickerDisabledComponent
},
{
title: 'Custom today class',
anchor: 'today-class-ex',
outlet: DemoDatepickerCustomTodayClassComponent
},
{
title: 'Forms',
anchor: 'forms-ex',
outlet: DemoDatepickerFormsComponent
},
{
title: 'Reactive forms',
anchor: 'reactive-forms-ex',
outlet: DemoDatepickerReactiveFormsComponent
},
{
title: 'Return focus to input',
anchor: 'return-focus-to-input-ex',
outlet: DemoDatePickerReturnFocusToInputComponent
},
{
title: 'Manual triggering',
anchor: 'triggers-manual-ex',
outlet: DemoDatepickerTriggersManualComponent
},
{
title: 'Placement',
anchor: 'placement-ex',
outlet: DemoDatepickerPlacementComponent
},
{
title: 'Config method',
anchor: 'config-method-ex',
outlet: DemoDatepickerConfigMethodComponent
},
{
title: 'Visibility Events',
anchor: 'visibility-events-ex',
outlet: DemoDatePickerVisibilityEventsComponent
},
{
title: 'Value change event',
anchor: 'value-change-event-ex',
outlet: DemoDatepickerValueChangeEventComponent
},
{
title: 'Config properties',
anchor: 'config-object-ex',
outlet: DemoDatePickerConfigObjectComponent
},
{
title: 'Select dates from other month',
anchor: 'select-dates-from-other-month-ex',
outlet: DemoDatePickerSelectDatesFromOtherMonthsComponent
},
{
title: 'Select week',
anchor: 'select-week-ex',
outlet: DemoDatePickerSelectWeekComponent
},
{
title: 'Select week range',
anchor: 'select-week-range-ex',
outlet: DemoDatePickerSelectWeekRangeComponent
},
{
title: 'Outside click',
anchor: 'outside-click-ex',
outlet: DemoDatepickerOutsideClickComponent
},
{
title: 'Trigger by isOpen property',
anchor: 'trigger-by-isopen-property-ex',
outlet: DemoDatepickerByIsOpenPropComponent
},
{
title: 'Custom triggers',
anchor: 'triggers-custom-ex',
outlet: DemoDatepickerTriggersCustomComponent
},
{
title: 'Date custom classes',
anchor: 'date-custom-classes-ex',
outlet: DemoDatepickerDateCustomClassesComponent
},
{
title: 'Tooltip for selected dates',
anchor: 'tooltip-for-selected-dates-ex',
outlet: DemoDatePickerTooltipToSelectedDates
},
{
title: 'Quick select ranges',
anchor: 'quick-select-ranges-ex',
outlet: DemoDatePickerQuickSelectRangesComponent
},
{
title: 'Prevent change to next month',
anchor: 'prevent-change-to-next-month-ex',
outlet: DemoDatepickerPreventChangeToNextMonthComponent
},
{
title: 'Previous month in Daterangepicker',
anchor: 'daterangepicker-previous-month-ex',
outlet: DemoDateRangePickerShowPreviousMonth
},
{
title: 'Show Today Button',
anchor: 'datepicker-show-today-button-ex',
outlet: DemoDatepickerTodayButtonComponent,
},
{
title: 'Show Clear Button',
anchor: 'datepicker-show-clear-button-ex',
outlet: DemoDatepickerClearButtonComponent
},
{
title: 'Start view',
anchor: 'start-view-ex',
outlet: DemoDatepickerStartViewComponent
},
{
title: 'Max Date Range in Daterangepicker',
anchor: 'daterangepicker-max-date-range-ex',
outlet: DemoDateRangePickerMaxDateRangeComponent
},
{
title: 'With timepicker',
anchor: 'with-timepicker-ex',
outlet: DemoDatepickerWithTimepickerComponent
},
]
}
];