-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds documentation for commonly used providers
- Loading branch information
Showing
6 changed files
with
374 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Data source provider | ||
|
||
**Package**: `com.fliplet.data-source-provider` | ||
|
||
## Overview | ||
|
||
The **Data source provider** allows users to set the data source requirements for a component. The provider can be used to select a data source, set the default value for a newly created data source, set the data source security requirements, and more. | ||
|
||
## Usage | ||
|
||
```js | ||
var provider = Fliplet.Widget.open('com.fliplet.data-source-provider', { | ||
selector: '#data-source', | ||
data: { | ||
dataSourceTitle: 'Data source title', | ||
dataSourceId: 123, | ||
appId: Fliplet.Env.get('appId'), | ||
default: { | ||
name: `Data for ${Fliplet.Env.get('appName')}`, | ||
columns: ['Column 1', 'Column 2'], | ||
entries: [{ 'Column 1': 'Value 1', 'Column 2': 'Value 2' }] | ||
}, | ||
accessRules: [{ allow: 'all', type: ['select'] }] | ||
} | ||
}); | ||
``` | ||
|
||
## Parameters | ||
|
||
The following parameters can be passed to `Fliplet.Widget.open()` using `data` as shown above. | ||
|
||
* `dataSourceTitle` (String) Title to use above the data source dropdown. **Default**: `Select a data source` | ||
* `dataSourceId` (String) The data source to select, if provided. | ||
* `appId` (Number) If provided, the initial list of data source shown in the dropdown will be limited to those assigned to the app. | ||
* `default` (Object) The default configuration for a new data source created by the data source provider. | ||
* `name` (String) A custom name to use when creating a new data source. | ||
* `columns` (Array) An array of strings representing the column names that should be created in the new data source. | ||
* `entries` (Array) An array of objects representing the entries that should be added to the data source when it's created. | ||
* `accessRules` (Array) Array of security rules required for the data source. If any of the required access rules are not found in the data source, users will be prompted to set them up. | ||
|
||
## Return value | ||
|
||
The `provider` object resolves with an object representing the selected data source. Usually, only the data source ID needs to be saved. | ||
|
||
<p class="warning">Ensure data source information is not unnecessarily saved or exposed to prevent security breaches.</p> | ||
|
||
**Example** | ||
|
||
```js | ||
provider.then(function(result) { | ||
console.log('Selected data source ID:', result.data.id); | ||
}); | ||
``` | ||
|
||
## Provider triggers | ||
|
||
### `widget-autosize` | ||
|
||
Resize the provider size to fit the size of the content within. | ||
|
||
**Example** | ||
|
||
```js | ||
provider.emit('widget-autosize'); | ||
``` | ||
|
||
### `update-security-rules` | ||
|
||
Update the data source security rule requirements. | ||
|
||
**Example** | ||
|
||
```js | ||
provider.emit('update-security-rules', { accessRules: accessRules }); | ||
``` | ||
|
||
## Provider events | ||
|
||
* `dataSourceSelect` A data source is selected. | ||
* `selected-data-source-loaded` Selected data source is loaded. | ||
* `data-sources-loaded` List of available data source is loaded. | ||
|
||
--- | ||
|
||
[Back to Providers](../../components/Using-Providers.html) | ||
{: .buttons} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Email provider | ||
|
||
**Package**: `com.fliplet.email-provider` | ||
|
||
## Overview | ||
|
||
The **Email provider** allows users to provide information for email templates such that emails can be sent via Fliplet's `Fliplet.Communicate.sendEmail()` JS API ([reference](../../API/fliplet-communicate.html#send-an-email)). | ||
|
||
## Usage | ||
|
||
```js | ||
var provider = Fliplet.Widget.open('com.fliplet.email-provider', { | ||
data: { | ||
options: { | ||
subject: 'Greetings', | ||
html: '<p>Hi, how are you?</p>', | ||
headers: { | ||
'Reply-To': '[email protected]' | ||
}, | ||
to: [ | ||
{ | ||
email: '[email protected]', | ||
name: 'Alice', | ||
type: 'to' | ||
}, | ||
{ | ||
email: '[email protected]' | ||
type: 'cc' | ||
} | ||
] | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
## Parameters | ||
|
||
The following parameters can be passed to `Fliplet.Widget.open()` using `data` as shown above. | ||
|
||
* `subject` (String) Email subject. | ||
* `html` (String) Email body. | ||
* `headers` (Object) Object of header values to be included. | ||
* `Reply-To` (String) Set the Reply-To email address. | ||
* `to` (Array) List of email recipients. Each item supports the following parameters. | ||
* `email` (String) **Required** Email address | ||
* `name` (String) Name of recipient | ||
* `type` (String) **Required** Type of recipient. Possible values include: `to`, `cc`, `bcc` | ||
* `hideTo` (Boolean) Set to `true` to hide the To field | ||
* `hideCC` (Boolean) Set to `true` to hide the CC field | ||
* `hideBCC` (Boolean) Set to `true` to hide the BCC field | ||
* `hideReplyTo` (Boolean) Set to `true` to hide the ReplyTo field | ||
* `hideSubject` (Boolean) Set to `true` to hide the Subject field | ||
* `hideBody` (Boolean) Set to `true` to hide the Body field | ||
|
||
## Return value | ||
|
||
The `provider` object resolves with an object representing the email configuration. | ||
|
||
**Example** | ||
|
||
```js | ||
provider.then(function(result) { | ||
console.log('Email template:', result.data); | ||
}); | ||
``` | ||
|
||
--- | ||
|
||
[Back to Providers](../../components/Using-Providers.html) | ||
{: .buttons} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# File picker | ||
|
||
**Package**: `com.fliplet.file-picker` | ||
|
||
## Overview | ||
|
||
The **File picker** allows users to select one or more files that are accessible via File Manager. | ||
|
||
## Usage | ||
|
||
```js | ||
var provider = Fliplet.Widget.open('com.fliplet.file-picker', { | ||
data: { | ||
selectFiles: [{ id: 123 }], | ||
type: 'image' | ||
} | ||
}); | ||
``` | ||
|
||
## Parameters | ||
|
||
The following parameters can be passed to `Fliplet.Widget.open()` using `data` as shown above. | ||
|
||
* `selectFiles` (Array) Array of files to be marked as selected in the file picker. Each item in the array would be an object with `{ id }` | ||
* `selectMultiple` (Boolean) Set to `true` to allow users to select multiple files. | ||
* `type` (String) Type of files supported. **Default**: All files | ||
<details markdown="1"> | ||
<summary>Possible values</summary> | ||
|
||
* (Empty) All files | ||
* `image` Images | ||
* `document` Documents | ||
* `video` Video files | ||
* `folder` Folders only | ||
</details> | ||
* `fileExtension` (Array) Optionally provide a list of supported file extensions in uppercase, e.g. `['JPG', 'JPEG', 'PNG']`. Otherwise, the `type` will be sufficient for the API to only show files that match the type. | ||
|
||
## Return value | ||
|
||
The `provider` object resolves with an object representing the selected files/folders. Usually, only the file/folder ID needs to be saved. | ||
|
||
**Example** | ||
|
||
```js | ||
provider.then(function(result) { | ||
console.log('Selected files:', result.data); | ||
}); | ||
``` | ||
|
||
## Provider events | ||
|
||
* `widget-set-info` Information of selected folders and files. | ||
|
||
--- | ||
|
||
[Back to Providers](../../components/Using-Providers.html) | ||
{: .buttons} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Link action provider | ||
|
||
**Package**: `com.fliplet.link` | ||
|
||
## Overview | ||
|
||
The **Link action provider** allows users to configure actions that can be executed. The condition or trigger for executing the action depends on the provider caller. The Link action provider simply specifies the action that should be carried out. By using the Link action provider to configure this, any feature will be able to use the same UI and interactions to configure an action. | ||
|
||
## Usage | ||
|
||
```js | ||
var provider = Fliplet.Widget.open('com.fliplet.link', { | ||
selector: '#link-action', | ||
data: { | ||
actionLabel: 'Click action', | ||
action: 'screen', | ||
page: 123, | ||
omitPages: [12], | ||
options: { | ||
hideAction: true | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
## Parameters | ||
|
||
The following parameters can be passed to `Fliplet.Widget.open()` using `data` as shown above. | ||
|
||
* `actionLabel` (String) Custom label for the action dropdown. **Default**: `Link action` | ||
* `action` (String) The action to load into the link provider | ||
<details markdown="1"> | ||
<summary>Possible values</summary> | ||
|
||
* `screen` Display another screen | ||
* `url` Open a web page | ||
* `document` Open a document | ||
* `video` Play a video | ||
* `runFunction` Call a JavaScript Function | ||
</details> | ||
* `options` (Object) A map of options for the provider. | ||
* `hideAction` (Boolean) Set to `true` to hide the action dropdown. If set to `true`, `action` should also be provided to set the `action` without a dropdown. | ||
* `omitPages` (Array) List of pages to omit if the user selects the `screen` action. | ||
|
||
## Return value | ||
|
||
The `provider` object resolves with an action object that can be executed with `Fliplet.Navigate.to()` in apps and passed directly back to the provider during initialization. | ||
|
||
## Provider triggers | ||
|
||
### `widget-autosize` | ||
|
||
Resize the provider size to fit the size of the content within. | ||
|
||
**Example** | ||
|
||
```js | ||
provider.emit('widget-autosize'); | ||
``` | ||
|
||
## Provider events | ||
|
||
* `widget-changed` Event is fired when the action value is changed. | ||
|
||
--- | ||
|
||
[Back to Providers](../../components/Using-Providers.html) | ||
{: .buttons} |
Oops, something went wrong.