Docs review 3.4.0

This commit is contained in:
Eugenio Romano
2019-08-05 16:59:34 +01:00
parent 78e60a4da4
commit 3767c5d8de
17 changed files with 168 additions and 72 deletions

View File

@@ -0,0 +1,83 @@
---
Title: Icon Component
Added: v3.0.0
Status: Active
Last reviewed: 2019-02-08
---
# [Icon Component](../../../lib/core/icon/icon.component.ts "Defined in icon.component.ts")
Provides a universal way of rendering registered and named icons.
## Basic usage
```html
<!-- Font ligature -->
<adf-icon value="alert"></adf-icon>
<!-- ADF Thumbnail Service -->
<adf-icon value="image/png"></adf-icon>
<!-- Custom icon from MatIconRegistry -->
<adf-icon value="my-company:my-icon"></adf-icon>
```
## Class members
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| color | `ThemePalette` | | Theme color palette for the component. |
| value | `string` | | Icon value, which can be either a ligature name or a custom icon in the format `[namespace]:[name]`. |
## Details
You can register custom SVG files as named icons in the format `[namespace]:[name]`.
The example below shows how to register a new icon named `adf:move_file`
that points to an external file within the `assets` folder:
```ts
import { Component, OnInit } from '@angular/core';
import { MatIconRegistry } from '@angular/material';
import { DomSanitizer } from '@angular/platform-browser';
@Component({...})
export class AppComponent implements OnInit {
constructor(
private matIconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer
) {}
ngOnInit() {
this.matIconRegistry.addSvgIconInNamespace(
'adf',
'move_file',
this.sanitizer.bypassSecurityTrustResourceUrl(
'./assets/images/adf-move-file-24px.svg'
)
);
}
}
```
In the HTML, you can now use the icon as shown below:
```html
<adf-icon value="adf:move_file"></adf-icon>
```
### Thumbnail Service
You can also reference the icons registered with the [Thumbnail Service](../services/thumbnail.service.md)
using the `adf:` namespace.
```html
<adf-icon value="adf:image/gif"></adf-icon>
```
## See also
- [Thumbnail service](../services/thumbnail.service.md)

View File

@@ -1,4 +1,11 @@
# [Decimal Number Pipe](../../../lib/core/pipes/decimal-number.pipe.ts "Defined in multi-value.pipe.ts")
---
Title: Decimal Number Pipe
Added: v3.4.0
Status: Active
Last reviewed: 2019-08-05
---
# [Decimal Number Pipe](../../../lib/core/pipes/decimal-number.pipe.ts "Defined in decimal-number.pipe.ts")
Transforms a number to have a certain amount of digits in its integer part and also in its decimal part.
@@ -6,10 +13,10 @@ Transforms a number to have a certain amount of digits in its integer part and a
### Properties
| Name | Type | Default value | Description |
| ---------- | ---------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------- |
| digitsInfo | [DecimalNumberModel](../../../lib/core/models/decimal-number.model.ts) | | A format to apply to the date value. [Date Pipe Formats.](https://angular.io/api/common/DatePipe#custom-format-options) |
| locale | string | 'en-US' | A locale id for the locale format rules to use. |
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| digitsInfo | [`DecimalNumberModel`](../../../lib/core/models/decimal-number.model.ts) | | A format to apply to the date value. [Date Pipe Formats.](https://angular.io/api/common/DatePipe#custom-format-options) |
| locale | string | 'en-US' | A locale id for the locale format rules to use. |
## Details
@@ -23,7 +30,7 @@ This pipe transforms a given number so it follows the set configuration for the
}
```
You can also overwrite this config by passing a [DecimalNumberModel](../../../lib/core/models/decimal-number.model.ts) as an argument for this pipe.
You can also overwrite this config by passing a [`DecimalNumberModel`](../../../lib/core/models/decimal-number.model.ts) as an argument for this pipe.
The number can be also localized so it applies commas and dots in the right place depending on the locale id in use.

View File

@@ -33,7 +33,7 @@ The pipe takes a date and formats it and localizes it so the date is displayed i
To localize the dates in your application, you will need to add the specific locale file for your region in order to use it. Read more about internationalization [here](https://angular.io/guide/i18n#i18n-pipes).
For example, if you want add the japanese date localization in your ADF app you can add in your ```app.module.ts```:
For example, if you want add the japanese date localization in your ADF app you can add in your `app.module.ts`:
```typescript
import { AppConfigService, TRANSLATION_PROVIDER, DebugAppConfigService, CoreModule, CoreAutomationService } from '@alfresco/adf-core';
@@ -45,13 +45,11 @@ import { registerLocaleData } from '@angular/common';
import localeJa from '@angular/common/locales/ja';
registerLocaleData(localeJa);
```
### Default values
You can overwrite the default values of this pipe by adding these properties to your ```app.config.json```:
You can overwrite the default values of this pipe by adding these properties to your `app.config.json`:
```json
"dateValues": {
@@ -67,4 +65,4 @@ You can overwrite the default values of this pipe by adding these properties to
| defaultDateTimeFormat | string | The format to apply to date-time values |
| defaultLocale | string | The locale id to apply |
This configuration overwrites the values in the localized date pipe as well as other components to have more consistency across your app. However, you can still overwrite these values any time by using the pipe in your code.
This configuration overwrites the values in the [localized date pipe](../../core/pipes/localized-date.pipe.md) as well as other components to have more consistency across your app. However, you can still overwrite these values any time by using the pipe in your code.

View File

@@ -18,26 +18,26 @@ Accesses app-generated data objects via URLs and file downloads.
- _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Data to wrap into object URL
- **Returns** `string` - URL string
- **downloadBlob**(blob: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob), fileName: `string`)<br/>
Invokes content download for a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) with a file name.
(**Deprecated:** in 3.2.0, use [DownloadService](../../../lib/core/services/download.service.ts) instead. Invokes content download for a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) with a file name.)
- _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Content to download.
- _fileName:_ `string` - Name of the resulting file.
- **downloadData**(data: `any`, fileName: `string`)<br/>
Invokes content download for a data array with a file name.
(**Deprecated:** in 3.2.0, use [DownloadService](../../../lib/core/services/download.service.ts) instead. Invokes content download for a data array with a file name.)
- _data:_ `any` - Data to download.
- _fileName:_ `string` - Name of the resulting file.
- **downloadJSON**(json: `any`, fileName: `string`)<br/>
Invokes content download for a JSON object with a file name.
(**Deprecated:** in 3.2.0, use [DownloadService](../../../lib/core/services/download.service.ts) instead. Invokes content download for a JSON object with a file name.)
- _json:_ `any` - JSON object to download.
- _fileName:_ `string` - Name of the resulting file.
- **getContentUrl**(node: `any`, attachment?: `boolean`, ticket?: `string`): `string`<br/>
- **getContentUrl**(node: [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`|string`, attachment?: `boolean`, ticket?: `string`): `string`<br/>
Gets a content URL for the given node.
- _node:_ `any` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
- _node:_ [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`|string` - Node or Node ID to get URL for.
- _attachment:_ `boolean` - (Optional) Toggles whether to retrieve content as an attachment for download
- _ticket:_ `string` - (Optional) Custom ticket to use for authentication
- **Returns** `string` - URL string
- **getDocumentThumbnailUrl**(node: `any`, attachment?: `boolean`, ticket?: `string`): `string`<br/>
Gets a thumbnail URL for the given document node.
- _node:_ `any` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
- **Returns** `string` - URL string or `null`
- **getDocumentThumbnailUrl**(node: [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`|string`, attachment?: `boolean`, ticket?: `string`): `string`<br/>
(**Deprecated:** in 3.2.0, use ThumbnailService instead. Gets a thumbnail URL for the given document node.)
- _node:_ [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`|string` - Node or Node ID to get URL for.
- _attachment:_ `boolean` - (Optional) Toggles whether to retrieve content as an attachment for download
- _ticket:_ `string` - (Optional) Custom ticket to use for authentication
- **Returns** `string` - URL string

View File

@@ -17,6 +17,9 @@ Decodes a JSON Web Token (JWT) to a JavaScript object.
Decodes a JSON web token into a JS object.
- _token:_ `any` - Token in encoded form
- **Returns** `Object` - Decoded token data object
- **getAccessToken**(): `string`<br/>
Gets access token
- **Returns** `string` - access token
- **getValueFromLocalAccessToken**(key: `string`)<br/>
Gets a named value from the user access token.
- _key:_ `string` - Key name of the field to retrieve

View File

@@ -15,8 +15,6 @@ Stores items in the form of key-value pairs.
- **clear**()<br/>
Removes all currently stored items.
- **getAppPrefix**()<br/>
Sets the prefix that is used for the local storage of the app It assigns the string that is defined i the app config, empty prefix otherwise.
- **getItem**(key: `string`): `string|null`<br/>
Gets an item.
- _key:_ `string` - Key to identify the item

View File

@@ -16,9 +16,11 @@ Retrieves an SVG thumbnail image to represent a document type.
- **getDefaultMimeTypeIcon**(): `string`<br/>
Gets a "miscellaneous" thumbnail URL for types with no other icon defined.
- **Returns** `string` - URL string
- **getDocumentThumbnailUrl**(node: `any`): `string`<br/>
- **getDocumentThumbnailUrl**(node: [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`|string`, attachment?: `boolean`, ticket?: `string`): `string`<br/>
Gets a thumbnail URL for the given document node.
- _node:_ `any` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
- _node:_ [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`|string` - Node or Node ID to get URL for.
- _attachment:_ `boolean` - (Optional)
- _ticket:_ `string` - (Optional)
- **Returns** `string` - URL string
- **getMimeTypeIcon**(mimeType: `string`): `string`<br/>
Gets a thumbnail URL for a MIME type.