|
@@ -15,21 +15,10 @@ const common_input_tpl = `
|
|
|
<div class="valid-feedback">{{valid_feedback}}</div> <!-- input 添加 is-valid 类 -->
|
|
|
<small id="{{id_name}}_help" class="form-text text-muted">{{help_text}}</small>
|
|
|
</div>`;
|
|
|
-const select_input_tpl = `
|
|
|
-<div class="form-group">
|
|
|
- {{#label}}<label for="{{id_name}}">{{label}}</label>{{/label}}
|
|
|
- <select id="{{id_name}}" aria-describedby="{{id_name}}_help" class="form-control" {{#multiple}}multiple{{/multiple}}>
|
|
|
- {{#options}}
|
|
|
- <option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}}>{{label}}</option>
|
|
|
- {{/options}}
|
|
|
- </select>
|
|
|
- <div class="invalid-feedback">{{invalid_feedback}}</div>
|
|
|
- <div class="valid-feedback">{{valid_feedback}}</div>
|
|
|
- <small id="{{id_name}}_help" class="form-text text-muted">{{help_text}}</small>
|
|
|
-</div>`;
|
|
|
+
|
|
|
|
|
|
export class Input extends InputItem {
|
|
|
- static accept_input_types: string[] = ["text", "password", "number", "color", "date", "range", "time", "select"];
|
|
|
+ static accept_input_types: string[] = ["text", "password", "number", "color", "date", "range", "time"];
|
|
|
|
|
|
constructor(session: Session, task_id: string, spec: any) {
|
|
|
super(session, task_id, spec);
|
|
@@ -42,11 +31,7 @@ export class Input extends InputItem {
|
|
|
if (spec.datalist)
|
|
|
spec['list'] = id_name + '-list';
|
|
|
|
|
|
- let html;
|
|
|
- if (spec.type === 'select')
|
|
|
- html = Mustache.render(select_input_tpl, spec);
|
|
|
- else
|
|
|
- html = Mustache.render(common_input_tpl, spec);
|
|
|
+ let html = Mustache.render(common_input_tpl, spec);
|
|
|
|
|
|
this.element = $(html);
|
|
|
let input_elem = this.element.find('#' + id_name);
|
|
@@ -82,7 +67,7 @@ export class Input extends InputItem {
|
|
|
}
|
|
|
|
|
|
get_value(): any {
|
|
|
- return this.element.find('input,select').val();
|
|
|
+ return this.element.find('input').val();
|
|
|
}
|
|
|
}
|
|
|
|