MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / _activate_form

Method _activate_form

webiojs/src/handlers/input.ts:47–64  ·  view source on GitHub ↗
(task_id: string, old_ctrl: InputItem)

Source from the content-addressed store, hash-verified

45 // hide old_ctrls显示的表单,激活 task_id 对应的表单
46 // 需要保证 task_id 对应有表单
47 private _activate_form(task_id: string, old_ctrl: InputItem) {
48 let ctrls = this.form_ctrls.get_value(task_id);
49 let ctrl = ctrls[ctrls.length - 1];
50 if (ctrl === old_ctrl || old_ctrl === undefined) {
51 return ctrl.element.show(state.ShowDuration, () => {
52 this._after_show_form()
53 });
54 }
55 this.form_ctrls.move_to_top(task_id);
56 old_ctrl.element.hide(100, () => {
57 // ctrl.element.show(100);
58 // 需要在回调中重新获取当前前置表单元素,因为100ms内可能有变化
59 let t = this.form_ctrls.get_top();
60 if (t) t[t.length - 1].element.show(state.ShowDuration, () => {
61 this._after_show_form()
62 });
63 });
64 };
65
66
67 /*

Callers 1

handle_messageMethod · 0.95

Calls 4

_after_show_formMethod · 0.95
move_to_topMethod · 0.80
get_topMethod · 0.80
get_valueMethod · 0.45

Tested by

no test coverage detected