MCPcopy Create free account
hub / github.com/ElemeFE/element-react / handleAction

Method handleAction

src/message-box/MessageBox.jsx:85–116  ·  view source on GitHub ↗
(action: string)

Source from the content-addressed store, hash-verified

83 }
84
85 handleAction(action: string): void {
86 const { modal, promise, showInput } = this.props;
87
88 if (modal) {
89 switch (action) {
90 case 'cancel':
91 promise.reject();
92 break;
93 case 'confirm':
94 if (modal === 'prompt') {
95 if (this.validate(this.state.inputValue || '')) {
96 if (showInput) {
97 promise.resolve({ value: this.state.inputValue, action });
98 } else {
99 promise.resolve(action);
100 }
101 } else {
102 return;
103 }
104 } else {
105 promise.resolve();
106 }
107 break;
108 default:
109 break;
110 }
111 } else {
112 promise.resolve(action);
113 }
114
115 this.close();
116 }
117
118 close(): void {
119 this.setState({

Callers

nothing calls this directly

Calls 3

validateMethod · 0.95
closeMethod · 0.95
resolveMethod · 0.80

Tested by

no test coverage detected