Changed Unumber and Number names

This commit is contained in:
veeso 2021-03-06 15:10:54 +01:00
parent b90953f65e
commit c1780230e9
4 changed files with 8 additions and 8 deletions

View file

@ -254,7 +254,7 @@ impl Component for FileList {
///
/// Return component value. File list return index
fn get_value(&self) -> Payload {
Payload::Unumber(self.states.get_list_index())
Payload::Unsigned(self.states.get_list_index())
}
// -- events
@ -366,7 +366,7 @@ mod tests {
// Enter
assert_eq!(
component.on(InputEvent::Key(KeyEvent::from(KeyCode::Enter))),
Msg::OnSubmit(Payload::Unumber(0))
Msg::OnSubmit(Payload::Unsigned(0))
);
// On key
assert_eq!(

View file

@ -61,7 +61,7 @@ impl OwnStates {
/// Append, if possible according to input type, the character to the input vec
pub fn append(&mut self, ch: char, itype: InputType) {
match itype {
InputType::Number => {
InputType::Signed => {
if ch.is_digit(10) {
// Must be digit
self.input.push(ch);
@ -269,8 +269,8 @@ impl Component for Input {
/// Returns the value as string or as a number based on the input value
fn get_value(&self) -> Payload {
match self.props.input_type {
InputType::Number => {
Payload::Unumber(self.states.get_value().parse::<usize>().ok().unwrap_or(0))
InputType::Signed => {
Payload::Unsigned(self.states.get_value().parse::<usize>().ok().unwrap_or(0))
}
_ => Payload::Text(self.states.get_value()),
}

View file

@ -53,8 +53,8 @@ pub enum Msg {
#[derive(std::fmt::Debug, PartialEq)]
pub enum Payload {
Text(String),
Number(isize),
Unumber(usize),
Signed(isize),
Unsigned(usize),
None,
}

View file

@ -282,7 +282,7 @@ pub enum PropValue {
#[derive(Clone, Copy, PartialEq, std::fmt::Debug)]
pub enum InputType {
Text,
Number,
Signed,
Password,
}