Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jul 15, 2023
1 parent 4fcb5d9 commit 5e3247e
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 59 deletions.
5 changes: 1 addition & 4 deletions docs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,7 @@ Each layout, depending on it's content, may come with several views that you can

## Admin Layout

:::{php:namespace} Atk4\Ui\Layout
:::

:::{php:class} Admin
:::{php:class} Layout\Admin
:::

Agile Toolkit comes with a ready to use admin layout for your application. The layout is built
Expand Down
4 changes: 2 additions & 2 deletions docs/autocomplete.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
:::{php:namespace} Atk4\Ui\Form\Control
:::{php:namespace} Atk4\Ui
:::

(autocomplete)=

# AutoComplete Form Control

:::{php:class} AutoComplete
:::{php:class} Form\Control\AutoComplete
:::

Agile UI uses "Form\Control\Dropdown" by default on the form, but there is also implementation
Expand Down
22 changes: 11 additions & 11 deletions docs/dataexecutor.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:::{php:namespace} Atk4\Ui\UserAction
:::{php:namespace} Atk4\Ui
:::

(dataexecutor)=
Expand All @@ -19,15 +19,15 @@ Demo: https://ui.agiletoolkit.org/demos/data-action/actions.php

All executors must implement the ExecutorInterface or JsExecutorInterface interface.

:::{php:interface} ExecutorInterface
:::{php:interface} UserAction\ExecutorInterface
:::

:::{php:interface} JsExecutorInterface
:::{php:interface} UserAction\JsExecutorInterface
:::

## Basic Executor

:::{php:class} BasicExecutor
:::{php:class} UserAction\BasicExecutor
:::

This is the base view for most of the other action executors. This executor generally
Expand All @@ -40,23 +40,23 @@ BasicExecutor will display:

## Preview Executor

:::{php:class} PreviewExecutor
:::{php:class} UserAction\PreviewExecutor
:::

This executor is specifically set in order to display the $preview property of the current model UserAction.
You can select to display the preview using regular console type container, regular text or using HTML content.

## Form Executor

:::{php:class} FormExecutor
:::{php:class} UserAction\FormExecutor
:::

This executor will display a form where user is required to fill in either all model fields or certain model fields
depending on the model UserAction $field property. Form control will depend on model field type.

## Argument Form Executor

:::{php:class} ArgumentFormExecutor
:::{php:class} UserAction\ArgumentFormExecutor
:::

This executor will display a form but instead of filling form control with model field, it will use model UserAction
Expand All @@ -65,15 +65,15 @@ The type of form control type to be used in form will depend on how $args is set

## JS Callaback Executor

:::{php:class} JsCallbackExecutor
:::{php:class} UserAction\JsCallbackExecutor
:::

This type of executor will output proper javascript that you can assign to a view event using View::on() method.
It is also possible to pass the UserAction argument via $_POST argument.

## Modal Executor

:::{php:class} ModalExecutor
:::{php:class} UserAction\ModalExecutor
:::

The ModalExecutor is base on Modal view. This is a one size fits all for model UserAction. When setting the UserAction via the
Expand All @@ -93,7 +93,7 @@ Modal::$title property.

## Confirmation Executor

:::{php:class} ConfirmationExecutor
:::{php:class} UserAction\ConfirmationExecutor
:::

Like ModalExecutor, Confirmation executor is also based on a Modal view. It allow to display UserAction::confirmation property prior to
Expand Down Expand Up @@ -129,7 +129,7 @@ other hand, if MODIFIER_UPDATE is set, then Table needs to be reloaded.

## The Executor Factory

:::{php:class} ExecutorFactory
:::{php:class} UserAction\ExecutorFactory
:::

:::{php:attr} executorSeed
Expand Down
9 changes: 3 additions & 6 deletions docs/fileupload.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ in steps:
1. User arrives at the page with a form
2. User selects file.
3. File begins uploading.
4. PHP upload callback {php:meth}`Upload::onUpload` is called, returns "file_id"
4. PHP upload callback {php:meth}`Form\Control\Upload::onUpload` is called, returns "file_id"
5. "file_id" is placed inside form.
6. User submits the form
7. {php:meth}`\Atk4\Ui\Form::onSubmit()` receives "file_id"
Expand All @@ -24,10 +24,7 @@ it can be removed. Both Upload and UploadImage controls contain an upload button
open a File Selection dialog. UploadImage also implements image preview icon.
During upload, a progress bar will appear.

:::{php:namespace} Atk4\Ui\Form\Control
:::

:::{php:class} Upload
:::{php:class} Form\Control\Upload
:::

## Attributes
Expand Down Expand Up @@ -137,7 +134,7 @@ $img->onDelete(function (string $fileId) use ($img) {

Similar to Upload, this is a control implementation for uploading images. Here are additional properties:

:::{php:class} UploadImage
:::{php:class} Form\Control\UploadImage
:::

UploadImage form control inherits all of the Upload properties plus these ones:
Expand Down
25 changes: 11 additions & 14 deletions docs/form-control.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
:::{php:namespace} Atk4\Ui\Form
:::{php:namespace} Atk4\Ui
:::

(form-control)=

# Form Controls

:::{php:class} Control
:::{php:class} Form\Control
:::

Agile UI dedicates a separate namespace for the Form Controls. Those are
Expand Down Expand Up @@ -195,9 +195,9 @@ Form Control Decorator.

The rules are rather straightforward but may change in future versions of Agile UI:

- if [enum](https://agile-data.readthedocs.io/en/develop/fields.html#Field::$enum) is defined, use {php:class}`Dropdown`
- if [enum](https://agile-data.readthedocs.io/en/develop/fields.html#Field::$enum) is defined, use {php:class}`Form\Control\Dropdown`
- consult {php:attr}`\Atk4\Ui\Form::$typeToDecorator` property for type-to-seed association
- type=password will use {php:class}`Password`
- type=password will use {php:class}`Form\Control\Password`

You always have an option to explicitly specify which field you would like to use:

Expand Down Expand Up @@ -226,12 +226,9 @@ will be linked with Model Fields.
Form decorator defines $field property which will be pointing to a field object of a model, so technically
the value of the field would be read from `$decorator->entityField->get()`.

:::{php:namespace} Atk4\Ui\Form\Control
:::

## Line Input Form control

:::{php:class} Input
:::{php:class} Form\Control\Input
Implements View for presenting Input form controls. Based around https://fomantic-ui.com/elements/input.html.
:::

Expand Down Expand Up @@ -308,7 +305,7 @@ To see various examples of form controls and their attributes see `demos/form-co

### Integration with Form

When you use {php:class}`form::addControl()` it will create 'Form Control Decorator'
When you use {php:class}`Form::addControl()` it will create 'Form Control Decorator'

### JavaScript on Input

Expand Down Expand Up @@ -348,7 +345,7 @@ $c1->onChange(\Atk4\Ui\Js\JsExpression('console.log(\'c1 changed: \' + date + \'

## Dropdown

:::{php:class} Dropdown
:::{php:class} Form\Control\Dropdown
:::

Dropdown uses Fomantic-UI Dropdown (https://fomantic-ui.com/modules/dropdown.html). A Dropdown can be used in two ways:
Expand All @@ -357,10 +354,10 @@ Dropdown uses Fomantic-UI Dropdown (https://fomantic-ui.com/modules/dropdown.htm

### Usage with a Model

A Dropdown is not used as default Form Control decorator (`$model->hasOne()` uses {php:class}`Lookup`), but in your Model, you can define that
A Dropdown is not used as default Form Control decorator (`$model->hasOne()` uses {php:class}`Form\Control\Lookup`), but in your Model, you can define that
UI should render a Field as Dropdown. For example, this makes sense when a `hasOne()` relationship only has a very limited amount (like 20)
of records to display. Dropdown renders all records when the paged is rendered, while Lookup always sends an additional request to the server.
{php:class}`Lookup` on the other hand is the better choice if there is lots of records (like more than 50).
{php:class}`Form\Control\Lookup` on the other hand is the better choice if there is lots of records (like more than 50).

To render a model field as Dropdown, use the ui property of the field:

Expand Down Expand Up @@ -519,7 +516,7 @@ $this->addField('expressions', [

## DropdownCascade

:::{php:class} DropdownCascade
:::{php:class} Form\Control\DropdownCascade
:::

DropdownCascade input are extend from Dropdown input. They rely on `cascadeFrom` and `reference` property.
Expand Down Expand Up @@ -551,7 +548,7 @@ $form->addControl('product_id', [DropdownCascade::class, 'cascadeFrom' => 'sub_c

## Lookup

:::{php:class} Lookup
:::{php:class} Form\Control\Lookup
:::

Lookup input is also based on Fomantic-UI dropdown module but with ability to dynamically request server for data it's
Expand Down
30 changes: 15 additions & 15 deletions docs/js.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:::{php:namespace} Atk4\Ui\Js
:::{php:namespace} Atk4\Ui
:::

(js)=
Expand Down Expand Up @@ -40,7 +40,7 @@ the code for hiding a view can be generated by calling:
$action = $view->js()->hide();
```

There are other ways to generate an action, such as using {php:meth}`JsExpression`:
There are other ways to generate an action, such as using {php:class}`JsExpression`:

```
$action = new JsExpression('alert([])', ['Hello world']);
Expand Down Expand Up @@ -141,7 +141,7 @@ for details.

## Building actions with JsExpressionable

:::{php:interface} JsExpressionable
:::{php:interface} Js\JsExpressionable
Allow objects of the class implementing this interface to participate in
building JavaScript expressions.
:::
Expand All @@ -166,7 +166,7 @@ $('#button-id').appendTo('#frame-id');

### JavaScript Chain Building

:::{php:class} JsChain
:::{php:class} Js\JsChain
Base class JsChain can be extended by other classes such as Jquery to provide transparent
mappers for any JavaScript framework.
:::
Expand All @@ -181,7 +181,7 @@ $chain = new Jquery('#the-box-id');
$chain->dropdown();
```

The calls to the chain are stored in the object and can be converted into JavaScript by calling {php:meth}`JsChain::jsRender()`
The calls to the chain are stored in the object and can be converted into JavaScript by calling {php:meth}`Js\JsChain::jsRender()`

:::{php:method} jsRender()
Converts actions recorded in JsChain into string of JavaScript code.
Expand All @@ -207,9 +207,9 @@ JavaScript binding and also decides which actions should be available while crea
:::{php:method} _jsEncode
JsChain will map all the other methods into JS counterparts while encoding all the arguments using `_jsEncode()`.
Although similar to the standard JSON encode function, this method quotes strings using single quotes
and recognizes {php:interface}`JsExpressionable` objects and will substitute them with the result of
{php:meth}`JsExpressionable::jsRender`. The result will not be escaped and any object implementing
{php:interface}`JsExpressionable` interface is responsible for safe JavaScript generation.
and recognizes {php:interface}`Js\JsExpressionable` objects and will substitute them with the result of
{php:meth}`Js\JsExpressionable::jsRender`. The result will not be escaped and any object implementing
{php:interface}`Js\JsExpressionable` interface is responsible for safe JavaScript generation.
:::

The following code is safe:
Expand Down Expand Up @@ -297,7 +297,7 @@ $buttons->on('click', '.button', $b3->js()->hide());

## JsExpression

:::{php:class} JsExpression
:::{php:class} Js\JsExpression
:::

:::{php:method} __construct(template, args)
Expand All @@ -313,7 +313,7 @@ $action = new JsExpression('alert([])', [
]);
```

Because {php:class}`JsChain` will typically wrap all the arguments through
Because {php:class}`Js\JsChain` will typically wrap all the arguments through
{php:meth}`JsChain::_jsonEncode()`, it prevents you from accidentally injecting JavaScript code:

```
Expand Down Expand Up @@ -429,7 +429,7 @@ There are two modal implementations in ATK:
- View - Modal: This works with a pre-existing Div, shows it and can be populated with contents;
- JsModal: This creates an entirely new modal Div and then populates it.

In contrast to {php:class}`Modal`, the HTML `<div>` element generated by {php:class}`JsModal`
In contrast to {php:class}`Modal`, the HTML `<div>` element generated by {php:class}`Js\JsModal`
is always destroyed when the modal is closed instead of only hiding it.

### Modal
Expand Down Expand Up @@ -490,7 +490,7 @@ or `contentCss` or use the method `addContentCss()`. See the Fomantic-UI modal d

### JsModal

:::{php:class} JsModal
:::{php:class} Js\JsModal
:::

This alternative implementation to {php:class}`Modal` is convenient for situations
Expand All @@ -515,7 +515,7 @@ See [Modals and reloading](#modals-and-reloading) concerning the intricacies bet

## Reloading

:::{php:class} JsReload
:::{php:class} Js\JsReload
:::

JsReload is a JavaScript action that performs reload of a certain object:
Expand Down Expand Up @@ -548,7 +548,7 @@ In this example, filling out and submitting the form will result in table conten

### Modals and reloading

Care needs to be taken when attempting to combine the above with a {php:class}`JsModal` which requires a {ref}`virtualpage` to
Care needs to be taken when attempting to combine the above with a {php:class}`Js\JsModal` which requires a {ref}`virtualpage` to
store its contents. In that case, the order in which declarations are made matters because of the way the
Render Tree is processed.

Expand Down Expand Up @@ -674,7 +674,7 @@ comes into play.

### Server Sent Event (JsSse)

:::{php:class} \Atk4\Ui\JsSse
:::{php:class} JsSse
:::

:::{php:method} send(action)
Expand Down
6 changes: 3 additions & 3 deletions docs/multiline.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:::{php:namespace} Atk4\Ui\Form\Control
:::{php:namespace} Atk4\Ui
:::

:::{php:class} Multiline
:::{php:class} Form\Control\Multiline
:::

# Multiline Form Control
Expand Down Expand Up @@ -145,7 +145,7 @@ normally call this method in your form onSubmit handler method.
If a Model contains Expressions, there resulting values will automatically get updated when one of the form control value is changed.
A loading icon on the `+` button will indicates that the expression values are being update.

Lets use the example of demos/multiline.php:
Lets use the example of `demos/multiline.php`:

```
class InventoryItem extends \Atk4\Data\Model
Expand Down
4 changes: 2 additions & 2 deletions docs/rightpanel.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
:::{php:namespace} Atk4\Ui\Panel
:::{php:namespace} Atk4\Ui
:::

(rightpanel)=

# Right Panel

:::{php:class} Right
:::{php:class} Panel\Right
:::

Right panel are view attached to the app layout. They are display on demand via javascript event
Expand Down
4 changes: 2 additions & 2 deletions docs/tree-item-selector.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:::{php:namespace} Atk4\Ui\Form\Control
:::{php:namespace} Atk4\Ui
:::

:::{php:class} TreeItemSelector
:::{php:class} Form\Control\TreeItemSelector
:::

# TreeItemSelector Form Control
Expand Down

0 comments on commit 5e3247e

Please sign in to comment.