addoptions to flasher libraries builders

This commit is contained in:
KHOUBZA Younes
2021-01-09 08:17:47 +01:00
parent 845aa308c7
commit f0a77abaec
19 changed files with 1879 additions and 64 deletions
+79 -2
View File
@@ -7,6 +7,8 @@ use Flasher\Prime\Notification\NotificationBuilder;
final class NotyBuilder extends NotificationBuilder
{
/**
* This string can contain HTML too. But be careful and don't pass user inputs to this parameter.
*
* @param string $text
*
* @return NotyBuilder
@@ -28,6 +30,9 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* top, topLeft, topCenter, topRight, center, centerLeft, centerRight, bottom, bottomLeft, bottomCenter,
* bottomRight - ClassName generator uses this value → noty_layout__${layout}
*
* @param string $layout
*
* @return $this
@@ -40,6 +45,8 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* relax, mint, metroui - ClassName generator uses this value → noty_theme__${theme}
*
* @param string $theme
*
* @return $this
@@ -52,6 +59,8 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* false, 1000, 3000, 3500, etc. Delay for closing event in milliseconds (ms). Set 'false' for sticky notifications.
*
* @param int|bool $timeout
*
* @return $this
@@ -64,6 +73,8 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* true, false - Displays a progress bar if timeout is not false.
*
* @param bool $progressBar
*
* @return $this
@@ -76,18 +87,23 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* @param array $closeWith
* click, button
*
* @param string|array $closeWith
*
* @return $this
*/
public function closeWith($closeWith)
{
$this->option('closeWith', $closeWith);
$this->option('closeWith', (array) $closeWith);
return $this;
}
/**
* If string, assumed to be CSS class name. If null, no animation at all. If function, runs the function. (v3.0.1+)
* You can use animate.css class names or your custom css animations as well.
*
* @param string $animation
* @param string $effect
*
@@ -113,6 +129,19 @@ final class NotyBuilder extends NotificationBuilder
return $this;
}
/**
* @param string $option
* @param mixed $docTitle
*
* @return $this
*/
public function docTitle($option, $docTitle)
{
$this->option('docTitle'.$option, $docTitle);
return $this;
}
/**
* @param bool $modal
*
@@ -126,6 +155,22 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* You can use this id with querySelectors. Generated automatically if false.
*
* @param bool|string $id
*
* @return $this
*/
public function id($id)
{
$this->option('id', $id);
return $this;
}
/**
* DOM insert method depends on this parameter. If false uses append, if true uses prepend.
*
* @param bool $force
*
* @return $this
@@ -138,6 +183,20 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* @param string $queue
*
* @return $this
*/
public function queue($queue)
{
$this->option('queue', $queue);
return $this;
}
/**
* If true closes all visible notifications and shows itself. If string(queueName) closes all visible notification on this queue and shows itself.
*
* @param string|bool $killer
*
* @return $this
@@ -150,6 +209,8 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* Custom container selector string. Like '.my-custom-container'. Layout parameter will be ignored.
*
* @param string|bool $container
*
* @return $this
@@ -162,6 +223,8 @@ final class NotyBuilder extends NotificationBuilder
}
/**
* An array of Noty.button, for creating confirmation dialogs.
*
* @param array $buttons
*
* @return $this
@@ -172,4 +235,18 @@ final class NotyBuilder extends NotificationBuilder
return $this;
}
/**
* If true Noty uses PageVisibility API to handle timeout. To ensure that users do not miss their notifications.
*
* @param bool $visibilityControl
*
* @return $this
*/
public function visibilityControl($visibilityControl)
{
$this->option('visibilityControl', $visibilityControl);
return $this;
}
}