blob: 1f2735f671ddc5035e8e3475d2497f8156aa5e27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
odoo.define('point_of_sale.TextAreaPopup', function(require) {
'use strict';
const { useState, useRef } = owl.hooks;
const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup');
const Registries = require('point_of_sale.Registries');
// formerly TextAreaPopupWidget
// IMPROVEMENT: This code is very similar to TextInputPopup.
// Combining them would reduce the code.
class TextAreaPopup extends AbstractAwaitablePopup {
/**
* @param {Object} props
* @param {string} props.startingValue
*/
constructor() {
super(...arguments);
this.state = useState({ inputValue: this.props.startingValue });
this.inputRef = useRef('input');
}
mounted() {
this.inputRef.el.focus();
}
getPayload() {
return this.state.inputValue;
}
}
TextAreaPopup.template = 'TextAreaPopup';
TextAreaPopup.defaultProps = {
confirmText: 'Ok',
cancelText: 'Cancel',
title: '',
body: '',
};
Registries.Component.add(TextAreaPopup);
return TextAreaPopup;
});
|