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AAI,OAAA,CAAC,CAAC,OAAO,EAAE,EAAX,CAAW,CAAC,CAAC;QACxC,CAAC;QAAA,CAAC;QACN,qBAAC;IAAD,CA7UA,AA6UC,IAAA;;IAED,IAAM,iBAAiB,GAAG,iBAAiB,CAAC;IAC5C,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC5C,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,iBAAiB,EAAE;QACtC,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,EAAE,OAAO,EAAE,mDAA4C,iBAAiB,UAAO,EAAE;KAC9F,CAAC,CAAC;IAEH,IAAM,2BAA2B,GAAG,sBAAsB,CAAC;IAC3D,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;IACtD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,2BAA2B,EAAE;QAChD,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,EAAE,OAAO,EAAE,mDAA4C,2BAA2B,UAAO,EAAE;KACxG,CAAC,CAAC;IAEH,IAAM,OAAO,GAAE,qBAAqB,CAAC;IACrC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC5B,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,EAAE,OAAO,EAAE,mDAA4C,OAAO,UAAO,EAAE;KACpF,CAAC,CAAC","file":"datetime-picker.js","sourcesContent":["import * as ko from \"knockout\";\r\nimport * as moment from \"moment\";\r\nimport * as localisationHelper from \"localisationHelper\";\r\nimport * as _ from \"underscore\";\r\n\r\n// Types\r\nimport Moment = moment.Moment;\r\n\r\n// Helpers\r\nimport \"dateTimeBindings\";\r\nimport \"fontAwesomeBindings\";\r\nimport \"knockout.validation\";\r\nimport \"tooltipPopoverBindings\";\r\n\r\n// Enums\r\nimport { DateTimeWorkflowStates } from \"Content/ts/Shared/Controls/DateTime/Services/workflowStates\";\r\n\r\n// Models\r\nimport { DateTimeConfiguration, DateTimeValidationConfiguration } from \"Content/ts/Models/Shared/DateTime/dateTimePickerConfiguration\";\r\n\r\n// Services\r\nimport { ValidationService } from \"Content/ts/Shared/Services/Validation/validationService\";\r\nimport { TimePickerServices } from \"Content/ts/Shared/KnockoutBindings/DateTime/Services/timePickerServices\";\r\nimport { DateTimePickerServices } from \"Content/ts/Shared/Controls/DateTime/Services/dateTimePickerServices\";\r\nimport { UniqueIdentifierServices } from \"Content/ts/Shared/KnockoutBindings/Services/uniqueIdentifierServices\";\r\nimport { DateTimeFormatterService } from \"Content/ts/Shared/Controls/DateTime/Services/dateTimeFormatterService\";\r\nimport { DateTimePickerValidationServices } from \"Content/ts/Shared/Controls/DateTime/Services/dateTimePickerValidationServices\";\r\n\r\n// Components\r\nimport \"Content/ts/Shared/Buttons/StandardButtons/StandardButtonsBase\";\r\nimport \"Content/ts/Shared/BootstrapAlerts/AlertValidation/alert-validation\";\r\n\r\nexport const Deps = {\r\n LocalisationHelper: localisationHelper,\r\n TimePickerServices: TimePickerServices\r\n}\r\n\r\nexport interface IDateTimePicker {\r\n Value: KnockoutObservable; // Required\r\n Configuration: KnockoutObservable | DateTimeConfiguration; // Required\r\n\r\n ValidationFields?: KnockoutObservable[]; // Optional\r\n DisplayCondition?: boolean | KnockoutObservable; // Optional\r\n TabToCalendarButton: boolean; // Optional\r\n}\r\n\r\nexport default class DateTimePicker {\r\n CustomMessages: {\r\n ClearDateTime: string;\r\n };\r\n\r\n private defaultTime: string;\r\n private defaultDate: string;\r\n\r\n datePickerIdentifier: string;\r\n timePickerIdentifier: string;\r\n DateFormatPlaceholder: string;\r\n TimeFormatPlaceholder: string;\r\n fullLengthRemoveButton: boolean;\r\n hasDateConfigurationProvided: boolean;\r\n hasTimeConfigurationProvided: boolean;\r\n\r\n dateLabel: string | KnockoutObservable;\r\n timeLabel: string | KnockoutObservable;\r\n isTimeRequired: boolean | KnockoutObservable;\r\n isDateRequired: boolean | KnockoutObservable;\r\n DisplayCondition: boolean | KnockoutObservable;\r\n\r\n configuration: DateTimeConfiguration;\r\n\r\n hasSetDateProperty: KnockoutObservable;\r\n hasSetTimeProperty: KnockoutObservable;\r\n\r\n value: KnockoutObservable;\r\n validationFields: KnockoutObservable[];\r\n ReadonlyDateValue: KnockoutObservable;\r\n ReadonlyTimeValue: KnockoutObservable;\r\n\r\n dateValue: KnockoutComputed;\r\n timeValue: KnockoutComputed;\r\n isDateReadOnly: KnockoutComputed;\r\n isTimeReadOnly: KnockoutComputed;\r\n displayRemoveTime: KnockoutComputed;\r\n displayDatePicker: KnockoutComputed;\r\n displayTimePicker: KnockoutComputed;\r\n isDateTimePickerMode: KnockoutComputed;\r\n displayRemoveDateTime: KnockoutComputed;\r\n formattedDatePlaceholderLabel: KnockoutComputed;\r\n formattedTimePlaceholderLabel: KnockoutComputed;\r\n\r\n dateTimeFormat: string;\r\n\r\n subs: KnockoutSubscription[];\r\n\r\n constructor(params: IDateTimePicker) {\r\n // Component Validation\r\n let config = ko.unwrap(params.Configuration);\r\n if (!params.Value || !config) {\r\n throw new Error(\"Please ensure all required properties are provided when referencing the 'datetime-picker' component\");\r\n }\r\n\r\n // Provided Component Properties\r\n this.value = params.Value;\r\n this.dateLabel = config.DateLabel;\r\n this.timeLabel = config.TimeLabel;\r\n this.validationFields = params.ValidationFields || [];\r\n this.DisplayCondition = params.DisplayCondition || true; \r\n\r\n this.configuration = DateTimePickerServices.ConfigureConfigurationProperties(config);\r\n this.configuration.DateConfiguration.TabToCalendarButton = params.TabToCalendarButton || false;\r\n\r\n this.subs = [];\r\n\r\n // Standard Component Properties\r\n const today = moment().startOf(\"date\");\r\n this.defaultTime = today.format(DateTimeFormatterService.InternalMomentTimeFormat);\r\n this.defaultDate = today.format(DateTimeFormatterService.InternalMomentDateFormat);\r\n\r\n this.fullLengthRemoveButton = true;\r\n this.isDateRequired = this.configuration.DateConfiguration.IsRequired;\r\n this.isTimeRequired = this.configuration.TimeConfiguration.IsRequired;\r\n\r\n this.ReadonlyDateValue = ko.observable(null);\r\n this.ReadonlyTimeValue = ko.observable(null);\r\n this.hasSetDateProperty = ko.observable(false);\r\n this.hasSetTimeProperty = ko.observable(false);\r\n\r\n this.TimeFormatPlaceholder = DateTimeFormatterService.LocalisedMomentTimeFormat;\r\n this.DateFormatPlaceholder = DateTimeFormatterService.LocalisedMomentShortDateFormat;\r\n this.hasDateConfigurationProvided = DateTimePickerServices.HasDateConfigurationProvided(this.configuration);\r\n this.hasTimeConfigurationProvided = DateTimePickerServices.HasTimeConfigurationProvided(this.configuration);\r\n\r\n // Initialisation Methods\r\n this.RetrieveCustomMessages();\r\n\r\n this.ComputedMethods();\r\n this.SetupValidation();\r\n this.SubscribeMethods();\r\n this.ConfigureUniqueIdentifiers();\r\n this.ConfigureDateTimeProperties();\r\n\r\n // Important : Value needs to be updated after the computed and subscribe methods have been configured. If they aren't \r\n // then the dependencies won't work correctly and will subsequently throw exceptions in the console.\r\n this.ReadonlyDateValue(this.ParseDateToReadOnlyValue(this.dateValue()));\r\n this.ReadonlyTimeValue(this.ParseTimeToReadOnlyValue(this.timeValue()));\r\n\r\n this.dateTimeFormat = `${DateTimeFormatterService.InternalMomentDateFormat} ${DateTimeFormatterService.InternalMomentTimeFormat}`;\r\n }\r\n\r\n public ClearDateTime(): void {\r\n this.value(null);\r\n\r\n this.hasSetDateProperty(false);\r\n this.hasSetTimeProperty(false);\r\n };\r\n\r\n // Purpose : When navigating into the workflow for the first time ensure the overrides are configured\r\n // correctly.If this doesn't happen the read/write computeds will return null when a value\r\n // has already been predefined.\r\n private ConfigureDateTimeProperties(): void {\r\n const hasValue = this.value() != null && this.value() != undefined;\r\n\r\n if (this.configuration.ComponentState == DateTimeWorkflowStates.DateTimeMode) {\r\n this.hasSetDateProperty(hasValue);\r\n this.hasSetTimeProperty(hasValue);\r\n }\r\n\r\n if (this.configuration.ComponentState == DateTimeWorkflowStates.DateMode) {\r\n this.hasSetDateProperty(hasValue);\r\n }\r\n\r\n if (this.configuration.ComponentState == DateTimeWorkflowStates.TimeMode) {\r\n this.hasSetTimeProperty(hasValue);\r\n }\r\n };\r\n\r\n // Purpose : Both the date and time picker values are bound to the same object but the UI\r\n // will render both options. It's not possible to assign them through the UID\r\n // binding without causing a race condition. With that in mind the TS side of the\r\n // component will need to be in charge of handling the unique identifiers.\r\n private ConfigureUniqueIdentifiers(): void {\r\n this.datePickerIdentifier = UniqueIdentifierServices.AddNewIdentifier(this.value);\r\n UniqueIdentifierServices.RemoveLinkHash(this.value);\r\n\r\n this.timePickerIdentifier = UniqueIdentifierServices.AddNewIdentifier(this.value);\r\n UniqueIdentifierServices.RemoveLinkHash(this.value);\r\n }\r\n\r\n private ParseDateToReadOnlyValue(datePickerValue: Moment): string {\r\n if (datePickerValue == null || datePickerValue == undefined) {\r\n return null;\r\n }\r\n\r\n return datePickerValue.format(DateTimeFormatterService.LocalisedMomentShortDateFormat);\r\n }\r\n\r\n\r\n private ParseTimeToReadOnlyValue(datePickerValue: Moment): string {\r\n if (datePickerValue == null || datePickerValue === undefined) {\r\n return null;\r\n }\r\n\r\n return datePickerValue.format(DateTimeFormatterService.LocalisedMomentTimeFormat);\r\n }\r\n\r\n private ComputedMethods(): void {\r\n this.displayDatePicker = ko.pureComputed(() => {\r\n return this.configuration.ComponentState == DateTimeWorkflowStates.DateMode || this.configuration.ComponentState == DateTimeWorkflowStates.DateTimeMode;\r\n });\r\n\r\n this.displayTimePicker = ko.pureComputed(() => {\r\n return this.configuration.ComponentState == DateTimeWorkflowStates.TimeMode || this.configuration.ComponentState == DateTimeWorkflowStates.DateTimeMode;\r\n });\r\n\r\n this.displayRemoveDateTime = ko.pureComputed(() => {\r\n return ko.unwrap(this.configuration.AllowDateTimeClear) && this.configuration.ComponentState == DateTimeWorkflowStates.DateTimeMode && this.value() != null;\r\n });\r\n\r\n this.displayRemoveTime = ko.pureComputed(() => {\r\n return this.configuration.ComponentState == DateTimeWorkflowStates.TimeMode && this.value() && this.hasTimeConfigurationProvided &&\r\n this.configuration.TimeConfiguration.AllowClear && this.value() != null;\r\n });\r\n\r\n this.isDateTimePickerMode = ko.pureComputed(() => {\r\n return this.configuration.ComponentState == DateTimeWorkflowStates.DateTimeMode;\r\n });\r\n\r\n this.isDateReadOnly = ko.pureComputed(() => {\r\n return ko.unwrap(this.configuration.DateConfiguration.IsReadonly);\r\n });\r\n\r\n this.isTimeReadOnly = ko.pureComputed(() => {\r\n return ko.unwrap(this.configuration.TimeConfiguration.IsReadonly);\r\n });\r\n\r\n this.timeValue = ko.computed({\r\n owner: this,\r\n read: (): Moment => {\r\n return DateTimePickerServices.FormatDateTimeComputedRead(this.value, this.hasSetTimeProperty, this.configuration.ComponentState);\r\n },\r\n write: (value: Moment) => {\r\n this.hasSetTimeProperty(value != null);\r\n\r\n let currentDateValue = this.defaultDate,\r\n currentTimeValue = value ? value.format(DateTimeFormatterService.InternalMomentTimeFormat) : this.defaultTime;\r\n\r\n if (this.value()) {\r\n currentDateValue = moment(this.value()).format(DateTimeFormatterService.InternalMomentDateFormat);\r\n }\r\n\r\n if (value) {\r\n switch (this.configuration.ComponentState) {\r\n case DateTimeWorkflowStates.DateMode:\r\n // Important : Don't need to set the time, just autofill it as the start of current day\r\n this.value(moment(`${currentDateValue} ${this.defaultTime}`, this.dateTimeFormat));\r\n break;\r\n case DateTimeWorkflowStates.TimeMode:\r\n // Important : Don't need to set the date, just autofill it as today's date.\r\n this.value(moment(`${this.defaultDate} ${currentTimeValue}`, this.dateTimeFormat));\r\n break;\r\n case DateTimeWorkflowStates.DateTimeMode:\r\n // Important : If the date has been set then ensure the value is set to the assigned\r\n // object. In the event it's not been set use today's date in order to\r\n // ensure the moment object is valid.\r\n if (this.hasSetDateProperty()) {\r\n this.value(moment(`${currentDateValue} ${currentTimeValue}`, this.dateTimeFormat));\r\n } else {\r\n this.value(moment(`${this.defaultDate} ${currentTimeValue}`, this.dateTimeFormat));\r\n }\r\n break;\r\n default:\r\n throw new Error(\"The provided 'componentState' is not a valid option\");\r\n }\r\n } else {\r\n this.value(null);\r\n }\r\n }\r\n });\r\n\r\n this.dateValue = ko.computed({\r\n owner: this,\r\n read: (): Moment => {\r\n return DateTimePickerServices.FormatDateTimeComputedRead(this.value, this.hasSetDateProperty, this.configuration.ComponentState);\r\n },\r\n write: (value: Moment) => {\r\n this.hasSetDateProperty(value != null);\r\n\r\n let currentTimeValue = this.defaultTime,\r\n currentDateValue = value ? value.format(DateTimeFormatterService.InternalMomentDateFormat) : this.defaultDate;\r\n\r\n if (this.value()) {\r\n currentTimeValue = this.value().format(DateTimeFormatterService.InternalMomentTimeFormat);\r\n }\r\n\r\n if (value) {\r\n switch (this.configuration.ComponentState) {\r\n case DateTimeWorkflowStates.DateMode:\r\n // Important : Don't need to set the time, just autofill it as the start of current day\r\n this.value(moment(`${currentDateValue} ${this.defaultTime}`, this.dateTimeFormat));\r\n break;\r\n case DateTimeWorkflowStates.TimeMode:\r\n // Important : Don't need to set the date, just autofill it as today's date.\r\n this.value(moment(`${this.defaultDate} ${currentTimeValue}`, this.dateTimeFormat));\r\n break;\r\n case DateTimeWorkflowStates.DateTimeMode:\r\n // Important : If the time has been set then ensure the value is set to the assigned\r\n // object. In the event it's not been set use the start time of today in\r\n // order to ensure the moment object is valid.\r\n if (this.hasSetTimeProperty()) {\r\n this.value(moment(`${currentDateValue} ${currentTimeValue}`, this.dateTimeFormat));\r\n } else {\r\n this.value(moment(`${currentDateValue} ${this.defaultTime}`, this.dateTimeFormat));\r\n }\r\n break;\r\n default:\r\n throw new Error(\"The provided 'componentState' is not a valid option\");\r\n }\r\n } else {\r\n this.value(null);\r\n }\r\n }\r\n });\r\n\r\n this.formattedDatePlaceholderLabel = ko.computed(() => {\r\n return ` (${this.DateFormatPlaceholder})`;\r\n });\r\n\r\n this.formattedTimePlaceholderLabel = ko.computed(() => {\r\n return ` (${this.TimeFormatPlaceholder})`;\r\n });\r\n };\r\n\r\n private SubscribeMethods(): void {\r\n this.subs.push(this.dateValue.subscribe((value: Moment) => {\r\n if (this.configuration.DateConfiguration.IsReadonly) {\r\n this.ReadonlyDateValue(this.ParseDateToReadOnlyValue(value));\r\n }\r\n this.ConfigureDateTimeProperties();\r\n }));\r\n\r\n this.subs.push(this.timeValue.subscribe((value: Moment) => {\r\n if (this.configuration.TimeConfiguration.IsReadonly) {\r\n this.ReadonlyTimeValue(this.ParseTimeToReadOnlyValue(value));\r\n }\r\n this.ConfigureDateTimeProperties();\r\n }));\r\n };\r\n\r\n private RetrieveCustomMessages(): void {\r\n this.CustomMessages = {\r\n ClearDateTime: Deps.LocalisationHelper.getString(\"GenericResources\", \"ButtonClearDateTime\")\r\n };\r\n };\r\n\r\n private SetupValidation(): void {\r\n const validationConfiguration = {\r\n HasSetDateProperty: this.hasSetDateProperty,\r\n HasSetTimeProperty: this.hasSetTimeProperty,\r\n ComponentState: this.configuration.ComponentState,\r\n ValidationDateTime: this.configuration.ValidationDateTime,\r\n IsDateRequired: this.configuration.DateConfiguration.IsRequired,\r\n IsTimeRequired: this.configuration.TimeConfiguration.IsRequired,\r\n AllowedMinutes: Deps.TimePickerServices.ConfigureEnabledMinutes(this.configuration.TimeConfiguration),\r\n AllowedMinutesValidationMessage: this.configuration.TimeConfiguration.MinutesStepValidationMessage\r\n };\r\n\r\n ValidationService.AddValidationRule(this.value, this.validationFields, {\r\n validation: DateTimePickerValidationServices.ConfigureValidationRules(validationConfiguration)\r\n });\r\n };\r\n\r\n private removeValidationFields() {\r\n ValidationService.RemoveValidationRule(this.value, this.validationFields);\r\n };\r\n\r\n public dispose() {\r\n this.removeValidationFields();\r\n _.each(this.subs, s => s.dispose());\r\n };\r\n}\r\n\r\nconst standardComponent = \"datetime-picker\";\r\nko.components.unregister(standardComponent);\r\nko.components.register(standardComponent, {\r\n viewModel: DateTimePicker,\r\n template: { require: `text!Content/ts/Shared/Controls/DateTime/${standardComponent}.html` }\r\n});\r\n\r\nconst datePickerNoLabelsComponent = \"date-picker-nolabels\";\r\nko.components.unregister(datePickerNoLabelsComponent);\r\nko.components.register(datePickerNoLabelsComponent, {\r\n viewModel: DateTimePicker,\r\n template: { require: `text!Content/ts/Shared/Controls/DateTime/${datePickerNoLabelsComponent}.html` }\r\n});\r\n\r\nconst noinput= \"date-picker-noinput\";\r\nko.components.unregister(noinput);\r\nko.components.register(noinput, {\r\n viewModel: DateTimePicker,\r\n template: { require: `text!Content/ts/Shared/Controls/DateTime/${noinput}.html` }\r\n});"]}