From 553c71c958d9ac813c24df58758eb7095282598d Mon Sep 17 00:00:00 2001 From: Andy Stark <30621568+therealandeeee@users.noreply.github.com> Date: Tue, 24 Oct 2017 09:57:59 +0100 Subject: [PATCH] [ADF-1586] Added files for core services (#2529) * [ADF-1586] Added files for core services * [ADF-1586] Fixed syntax error in example --- docs/DataTableAdapter.md | 2 +- docs/README.md | 15 +++++--- docs/data-column.component.md | 2 +- docs/highlight-transform.service.md | 45 ++++++++++++++++++++++ docs/highlight.directive.md | 60 +++++++++++++++++++++++++++++ docs/seeAlsoGraph.json | 3 ++ docs/text-highlight.pipe.md | 26 +++++++++++++ 7 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 docs/highlight-transform.service.md create mode 100644 docs/highlight.directive.md create mode 100644 docs/text-highlight.pipe.md diff --git a/docs/DataTableAdapter.md b/docs/DataTableAdapter.md index 1bc1761ce5..4db22dc0db 100644 --- a/docs/DataTableAdapter.md +++ b/docs/DataTableAdapter.md @@ -162,5 +162,5 @@ let schema = ObjectDataTableAdapter.generateSchema(data); ## See also - [Datatable component](datatable.component.md) -- [Tasklist component](task-list.component.md) +- [Task list component](task-list.component.md) \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 3cb224d406..84ee8f29c7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -227,6 +227,7 @@ for more information about installing and using the source code. ### Other classes and interfaces - [FormFieldValidator interface](FormFieldValidator.md) + [(Back to Contents)](#contents) ## ADF Processlist @@ -281,7 +282,7 @@ for more information about installing and using the source code. - [Task details component](task-details.component.md) - [Task filters component](task-filters.component.md) - [Task header component](task-header.component.md) -- [Tasklist component](task-list.component.md) +- [Task list component](task-list.component.md) - [*Comment list component](../ng2-components/ng2-activiti-tasklist/src/components/comment-list.component.ts) - [*People list component](../ng2-components/ng2-activiti-tasklist/src/components/people-list.component.ts) @@ -327,6 +328,7 @@ for more information about installing and using the source code. ### Directives - [Context menu directive](context-menu.directive.md) +- [Highlight directive](highlight.directive.md) - [Logout directive](logout.directive.md) - [Node delete directive](node-delete.directive.md) - [Node favorite directive](node-favorite.directive.md) @@ -334,14 +336,13 @@ for more information about installing and using the source code. - [Node restore directive](node-restore.directive.md) - [Upload directive](upload.directive.md) - [*Card view content proxy directive](../ng2-components/ng2-alfresco-core/src/components/view/card-view-content-proxy.directive.ts) -- [*Highlight directive](../ng2-components/ng2-alfresco-core/src/directives/highlight.directive.ts) ### Pipes - [Node name tooltip pipe](node-name-tooltip.pipe.md) +- [Text highlight pipe](text-highlight.pipe.md) - [*File size pipe](../ng2-components/ng2-alfresco-core/src/pipes/file-size.pipe.ts) - [*Mime type icon pipe](../ng2-components/ng2-alfresco-core/src/pipes/mime-type-icon.pipe.ts) -- [*Text highlight pipe](../ng2-components/ng2-alfresco-core/src/pipes/text-highlight.pipe.ts) - [*Time ago pipe](../ng2-components/ng2-alfresco-core/src/pipes/time-ago.pipe.ts) - [*User initial pipe](../ng2-components/ng2-alfresco-core/src/pipes/user-initial.pipe.ts) @@ -351,6 +352,8 @@ for more information about installing and using the source code. - [App config service](app-config.service.md) - [Authentication service](authentication.service.md) - [Card view update service](card-view-update.service.md) +- [Highlight transform service](highlight-transform.service.md) +- [Log service](log.service.md) - [Notification service](notification.service.md) - [Renditions service](renditions.service.md) - [Translation service](translation.service.md) @@ -369,8 +372,6 @@ for more information about installing and using the source code. - [*Deleted nodes api service](../ng2-components/ng2-alfresco-core/src/services/deleted-nodes-api.service.ts) - [*Discovery api service](../ng2-components/ng2-alfresco-core/src/services/discovery-api.service.ts) - [*Favorites api service](../ng2-components/ng2-alfresco-core/src/services/favorites-api.service.ts) -- [*Highlight transform service](../ng2-components/ng2-alfresco-core/src/services/highlight-transform.service.ts) -- [Log service](log.service.md) - [*Nodes api service](../ng2-components/ng2-alfresco-core/src/services/nodes-api.service.ts) - [*Page title service](../ng2-components/ng2-alfresco-core/src/services/page-title.service.ts) - [*People content service](../ng2-components/ng2-alfresco-core/src/services/people-content.service.ts) @@ -589,4 +590,6 @@ for more information about installing and using the source code. ### Components - [Webscript component](webscript.component.md) - \ No newline at end of file + + +[(Back to Contents)](#contents) \ No newline at end of file diff --git a/docs/data-column.component.md b/docs/data-column.component.md index 1affd97672..65dd8a38d0 100644 --- a/docs/data-column.component.md +++ b/docs/data-column.component.md @@ -295,5 +295,5 @@ Now you can declare columns and assign `desktop-only` class where needed: - [Document list component](document-list.component.md) - [Datatable component](datatable.component.md) -- [Tasklist component](task-list.component.md) +- [Task list component](task-list.component.md) \ No newline at end of file diff --git a/docs/highlight-transform.service.md b/docs/highlight-transform.service.md new file mode 100644 index 0000000000..31ccd68aed --- /dev/null +++ b/docs/highlight-transform.service.md @@ -0,0 +1,45 @@ +# Highlight Transform service + +Adds HTML to a string to highlight chosen sections. + +## Methods + +`public highlight(text: string, search: string, wrapperClass: string = 'highlight'): HightlightTransformResult`
+Searches for `search` string(s) within `text` and highlights all occurrences. + +## Details + +A typical use case for this service is to display the results from a search engine. +An excerpt of a retrieved document can be shown with the matching search terms +highlighted to indicate where they were found. + +The service works by adding HTML <span> elements around all sections of text +that match the `search` string. You can specify multiple search strings at once by +separating them with spaces, so passing "Apple Banana Cherry" in `search` will +highlight any of those words individually. The <span> element includes a +`class` attribute which defaults to "highlight" but you can pass any class name +you like using the `wrapperClass` parameter. + +The resulting text with HTML highlighting is returned within a `HightlightTransformResult` +object: + +```ts +interface HightlightTransformResult { + text: string; + changed: boolean; +} +``` + +The `changed` flag will be false if the search string was not found (ie, no highlighting +took place) and true otherwise. + + + +## See also + +- [Text highlight pipe](text-highlight.pipe.md) +- [Highlight directive](highlight.directive.md) + + + + diff --git a/docs/highlight.directive.md b/docs/highlight.directive.md new file mode 100644 index 0000000000..4d5acef679 --- /dev/null +++ b/docs/highlight.directive.md @@ -0,0 +1,60 @@ +# Highlight directive + +Adds highlighting to selected sections of an HTML element's content. + +## Basic Usage + +```HTML +
+
You can dance if you want to
+
+``` + +## Details + +Add `adf-highlight` with a search term to an element to highlight occurrences +of that term in its content. For example: + +```HTML +
+
+ You can dance if you want to +
+
+``` + +...will result in the word "dance" being highlighted. Note that you must also +specify `adf-highlight-selector`, a CSS selector that specifies which +elements can have their contents highlighted. + +If the search string contain spaces then each section between the spaces will +be treated as a separate item to highlight. For example, you could use this to +highlight all occurrences of words in a list. + +The highlighting works by adding an HTML <span> element around the +selected text. The <span> includes a CSS class; this defaults to +"adf-highlight" but you can supply your own class using the `adf-highlight-class` +property: + +```HTML +
+
+ You can dance if you want to +
+
+``` + + + +## See also + +- [Text highlight pipe](text-highlight.pipe.md) +- [Highlight transform service](highlight-transform.service.md) + \ No newline at end of file diff --git a/docs/seeAlsoGraph.json b/docs/seeAlsoGraph.json index e6482a16ac..cf11eb8a56 100644 --- a/docs/seeAlsoGraph.json +++ b/docs/seeAlsoGraph.json @@ -49,6 +49,8 @@ ], "form.service": [], "FormFieldValidator": [], + "highlight.directive": ["text-highlight.pipe"], + "highlight-transform.service": ["text-highlight.pipe", "highlight.directive"], "info-drawer.component": ["info-drawer-layout.component"], "info-drawer-layout.component": [], "like.component": ["rating.component"], @@ -87,6 +89,7 @@ "task-filters.component": [], "task-header.component": [], "task-list.component": [], + "text-highlight.pipe": [], "theming": [], "toolbar-divider.component": [], "toolbar-title.component": [], diff --git a/docs/text-highlight.pipe.md b/docs/text-highlight.pipe.md new file mode 100644 index 0000000000..9c80cc0978 --- /dev/null +++ b/docs/text-highlight.pipe.md @@ -0,0 +1,26 @@ +# Text Highlight pipe + +Adds highlighting to words or sections of text that match a search string. + +## Basic Usage + +```HTML +
+ Some rude words have been detected in your summary: {{ summary | highlight:rudeWordList }} +
+``` + +## Details + +The pipe's parameter is a string to search for in the text. Any occurrences of the string will +be highlighted with added HTML (see the +[Highlight Transform service](highlight-transform.service.md) for more information about how +this is implemented). The parameter can contain spaces, in which case each separate "word" in the string will be highlighted individually. + + + +## See also + +- [Highlight directive](highlight.directive.md) +- [Highlight transform service](highlight-transform.service.md) + \ No newline at end of file