Skip to content

Ab#87614 classic style available for datepicker #2435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const CORE_QUESTION_ALLOWED_PROPERTIES = [
'valueName',
'inputType',
'html',
'calendarType',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ export type DateInputFormat = 'date' | 'datetime' | 'datetime-local' | 'time';
* @param inputType - The type of the input element.
* @param element - The element that the directive is attached to.
* @param domService - The element that the directive is attached to
* @param calendarType - kendo type of calendar, classic or infinite (infinite by default)
* @returns The picker instance, or null if the type is not allowed
*/
export const createPickerInstance = (
inputType: DateInputFormat,
element: any,
domService: DomService
domService: DomService,
calendarType: 'classic' | 'infinite' = 'infinite'
):
| DatePickerComponent
| DateTimePickerComponent
Expand All @@ -32,6 +34,7 @@ export const createPickerInstance = (
);
const datePickerInstance: DatePickerComponent = datePicker.instance;
datePickerInstance.format = 'dd/MM/yyyy';
datePickerInstance.calendarType = calendarType;
return datePickerInstance;
case 'datetime':
case 'datetime-local':
Expand All @@ -42,6 +45,7 @@ export const createPickerInstance = (
const dateTimePickerInstance: DateTimePickerComponent =
dateTimePicker.instance;
dateTimePickerInstance.format = 'dd/MM/yyyy HH:mm';
dateTimePickerInstance.calendarType = calendarType;
return dateTimePickerInstance;
case 'time':
const timePicker = domService.appendComponentToBody(
Expand Down
14 changes: 13 additions & 1 deletion libs/shared/src/lib/survey/widgets/text-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ export const init = (
obj.setPropertyValue('max', value);
},
});
serializer.addProperty('text', {
name: 'calendarType',
visibleIndex: 2,
category: 'layout',
type: 'string',
choices: ['infinite', 'classic'],
default: 'infinite',
dependsOn: ['inputType'],
visibleIf: (obj: QuestionText) =>
['date', 'datetime', 'datetime-local'].includes(obj.inputType || ''),
});
// register the editor for type "date" with kendo date picker
registerCustomPropertyEditor(
CustomPropertyGridComponentTypes.dateTypeDisplayer
Expand Down Expand Up @@ -117,7 +128,8 @@ export const init = (
const pickerInstance = createPickerInstance(
question.inputType as DateInputFormat,
pickerDiv,
domService
domService,
question.calendarType || 'infinite'
);

if (pickerInstance) {
Expand Down