form_blocks
Description
一个包含 lightbox 控件的对象
form_blocks: { checkbox?: LightboxControl; constraint?: LightboxControl; duration?: LightboxControl; duration_optional?: LightboxControl; parent?: LightboxControl; radio?: LightboxControl; resources?: LightboxControl; select?: LightboxControl; template?: LightboxControl; textarea?: LightboxControl; time?: LightboxControl; time_optional?: LightboxControl; typeselect?: LightboxControl; [ControlName: string]: LightboxControl | undefined }
Example
gantt.form_blocks["date_local_editor"] = {
render: function (sns) {
return "<input className='custom_section' type='datetime-local' name='1'/>"
},
set_value: function (node, value, task) {
if (task.start_date) {
const dateValue = gantt.date.date_to_str("%Y-%m-%d")(value);
const timeValue = gantt.date.date_to_str("%H:%i")(value);
const dateLocalValue = dateValue + "T" + timeValue;
node.value = dateLocalValue;
}
},
get_value: function (node, task) {
task.start_date = new Date(node.value)
task.end_date = gantt.calculateEndDate(task)
return task.start_date;
},
focus: function (node) {
const a = node;
a.select();
a.focus();
}
};