Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit 1a2d373

Browse files
authored
Merge pull request #1691 from NativeScript/tgpetrov/calendar-events
docs about custom tokens in autocomplete
2 parents e3af221 + 8557430 commit 1a2d373

File tree

19 files changed

+213
-130
lines changed

19 files changed

+213
-130
lines changed

docs/ui/professional-ui-components/AutoCompleteTextView/autocomplete-display-modes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Display mode can be changed with the {% typedoc_link classes:RadAutoCompleteText
2323
In plain mode **RadAutoCompleteTextView** displays chosen item as plain text. With this mode only one item can be chosen.
2424

2525
## Tokens Mode
26-
Tokens mode allows multiple choice of items. Chosen items are displayed as tokens which can be modified or completely changed with custom ones.
26+
Tokens mode allows multiple choice of items, which are displayed as tokens.
2727

2828
When **RadAutoCompleteTextView**'s `displayMode` is `Tokens`, you can apply two different behaviors for token arrangement.
2929

@@ -35,10 +35,10 @@ The default value of this property is {% typedoc_link enums:AutoCompleteLayoutMo
3535

3636
<snippet id='autocomplete-layout-mode'/>
3737

38-
## Wrap Layout
39-
In wrap mode tokens are arranged on multiple lines. Every time a new line is started the **RadAutoCompleteTextView** is expanding in order to show all tokens.
38+
### Wrap Layout
39+
In wrap mode tokens are arranged on multiple lines. Every time a new line is started the **RadAutoCompleteTextView** is expanding in order to show all tokens.
4040

41-
## Horizontal Layout
41+
### Horizontal Layout
4242
In horizontal mode tokens are displayed on single line which can be scrolled horizontally in order to display all tokens.
4343

4444
## References

docs/ui/professional-ui-components/AutoCompleteTextView/autocomplete-getting-started.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ publish: true
1010

1111
# RadAutoCompleteTextView Getting Started
1212

13-
In this article, you will learn how to initialize **RadAutoCompleteTextView** and use it with it's basic configuration.
13+
In this article, you will learn how to initialize **RadAutoCompleteTextView** and use it with its basic configuration.
1414

1515
## Installation
16-
Run the following command to add the plugin to your application:
16+
**RadAutoCompleteTextView** is distributed through the `nativescript-ui-autocomplete` package, so before using it, you need to run the following command to add the plugin to your application:
1717

1818
```
1919
tns plugin add nativescript-ui-autocomplete
@@ -26,23 +26,32 @@ Then, in order to add a {% typedoc_link classes:RadAutoCompleteTextView %} insta
2626

2727
To create a **RadAutoCompleteTextView** you should use the RadAutoCompleteTextView tag in your .xml file.
2828
Once you have added the tag you should specify value for the `items` property of the control.
29-
The `items` property defines the collection of `TokenModel` objects which will be used to provide suggestions to the user input.
30-
The `hint` property allows you to provide a text that will be displayed when there is no input.
31-
The `text` property allows you to change the autocomplete text or get the current user input.
32-
The `TokenModel` object is a data model used by the autocomplete to populate the suggestion view and the chosen items.
3329

3430
<snippet id='autocomplete-getting-started'/>
3531

36-
Additionally you need to create, in your model, the collection of `TokenModel` objects which will be used to populate the **RadAutoCompleteTextView**.
32+
In order to provide suggestions that will be used by **RadAutoCompleteTextView** you need to provide a collection of items of type `TokenModel`:
3733

3834
<snippet id='autocomplete-generate-data'/>
3935

40-
In order to setup the suggestion view, which will be used as a holder to show possible suggestion, you need to add a `SuggestionView` tag and then provide a template for the layout of each suggestion.
36+
If necessarily, you can also use **RadAutoCompleteTextView**'s `hint` property to provide a text that will be displayed when there is no input; the `text` property that allows you to change the text or get the current user input or the `noResultsText` property to change the text displayed when no suggestions are found.
37+
38+
## Customize the Suggestions
39+
When you start typing the input field, you will see the default suggestion view displayed below the input field. If you want, you can add a custom suggestion view and change its template (through the `suggestionItemTemplate` property) and/or fix its height (through the `suggestionViewHeight` property). Here's an example:
4140

4241
<snippet id='autocomplete-suggestion-view-xml'/>
4342

44-
The `suggestionViewHeight` property allows you to have control over the height of the suggestion view.
45-
The `suggestionItemTemplate` is the holder which is used to produce layout for each item of the suggestion view.
43+
## Customize the TokenModel
44+
If you need, you can extend the `TokenModel` with an id to track more easily the selected items or any other information that you need that is missing from the default model. Here's an example:
45+
46+
<snippet id='autocomplete-custom-token-model-ts'/>
47+
48+
Then you can use the new type to populate the list of items that will be bound to **RadAutoCompleteTextView**'s `items` property:
49+
50+
<snippet id='autocomplete-custom-tokens-items-ts'/>
51+
52+
You can also display the properties added to your custom model in the template of the suggestions:
53+
54+
<snippet id='autocomplete-custom-tokens-template-xml'/>
4655

4756
## References
4857
Want to see more examples using **RadAutoCompleteTextView**?

docs/ui/professional-ui-components/AutoCompleteTextView/overview.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,41 @@ publish: true
1010

1111
# RadAutoCompleteTextView Overview
1212

13-
**RadAutoCompleteTextView** can automatically complete user input string by comparing the text being entered to all strings in the associated data source. The control provides means for easy customization and data management.
13+
**RadAutoCompleteTextView** can automatically complete user input string by comparing the text being entered to all strings in the associated data source. The control provides means for easy customization and data management. It is distributed through the `nativescript-ui-autocomplete` package on [npmjs](https://www.npmjs.com/package/nativescript-ui-autocomplete).
1414

1515
## Features
1616
### Suggest Modes
17-
**RadAutoCompleteTextView** supports three different suggest modes:
17+
**RadAutoCompleteTextView** can display drop-down list below the input field to show the suggestions for a text that is typed, directly append one of the suggestions in the input field itself or in a combination of both. This is controlled through the different acceptable values for the `suggestMode` property:
1818

1919
- **Suggest** - Suggestions are shown in a drop-down list below the input field.
2020
- **Append** - Only one suggestion is shown as an appended text to the input.
2121
- **SuggestAppend** - Both **Suggest** and **Append** modes are applied.
2222

23+
[This article]({% slug autocomplete-suggest-modes %} "Describe the suggest modes in RadAutoCompleteTextView in NS") describes their usage.
24+
2325
### Display Modes
24-
**RadAutoCompleteTextView** supports two display modes.
26+
When a suggestion is selected, **RadAutoCompleteTextView** can display its selection in one of two ways - as a simple text or as a token. This is controlled through the different acceptable values for the `displayModes` property:
2527

2628
- **Plain** - When **Plain** mode is active, only one item can be selected. The selected item is shown as a plain text in the input field.
2729
- **Tokens** - In **Tokens** mode the **RadAutoCompleteTextView** allows multiple selection of suggestions. The selected items are displayed as tokens.
2830

29-
### Tokens Layout Modes
30-
**RadAutoCompleteTextView** provides two different layouts of tokens when **Tokens** display mode is used.
31+
[This article]({% slug autocomplete-display-modes %} "Describe the display modes in RadAutoCompleteTextView in NS") describes their usage.
32+
33+
### Layout Modes
34+
When **RadAutoCompleteTextView**'s `displayMode` is **Tokens** and all selected tokens don't fit in one row, you can choose whether to layout them keep adding new token in the same (now scrollable) row, or add as many new rows as necessary to accommodate all tokens. This is controlled by the `layoutMode` property. Its acceptable values are:
3135

32-
- **Wrap** - Tokens are aligned in a grid manner.
33-
- **Horizontal** - Tokens are aligned horizontally.
36+
- **Wrap** - When a row is filled, another row is added to accommodate new tokens.
37+
- **Horizontal** - Tokens are added in a long scrollable row.
38+
39+
The layout modes are also listed in the [article about tokens]({% slug autocomplete-display-modes %} "Describe the layout modes in RadAutoCompleteTextView in NS").
3440

3541
### Completion Modes
36-
**RadAutoCompleteTextView** has two possible modes on which the filtering function is based.
42+
There are two ways that **RadAutoCompleteTextView** can search for a matching suggestion for the input text - for items that start with the provided text or for items that contain the provided text but not necessarily in the beginning. This can be controlled with the `completionMode` property.
3743

3844
- **StartsWith** - Shows only suggestions which start with the typed text.
39-
- **Contains** - Shows suggestions which contain the typed text.
45+
- **Contains** - Shows suggestions which contain the typed text but not necessarily in the beginning.
46+
47+
More information about the completion modes is available in [this article]({% slug autocomplete-completion-modes %} "Describe the completion modes in RadAutoCompleteTextView in NS") describes their usage.
4048

4149
#### Figure 1. RadAutoCompleteTextView (iOS/Android)
4250
![RadAutoCompleteTextView: Overview](../../img/ns_ui/autocomplete-overview-ios.png "RadAutoCompleteTextView in iOS") ![RadAutoCompleteTextView: Overview](../../img/ns_ui/autocomplete-overview-android.png "RadAutoCompleteTextView in Android")

docs/ui/professional-ui-components/Calendar/event-handling.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ publish: true
1818
- {% typedoc_link classes:RadCalendar,member:navigatingToDateStartedEvent %} - fired when navigation to a given date is about to happen
1919
- {% typedoc_link classes:RadCalendar,member:viewModeChangedEvent %} - fired when the view-mode changes to one of the modes described in [view modes]({% slug calendar-view-modes %})
2020
- {% typedoc_link classes:RadCalendar,member:dayViewEventSelectedEvent %} - fired when an event, part the list of events in the day view area of the calendar, has been selected
21+
- {% typedoc_link classes:RadCalendar,member:cellTapEvent %} - fired when a cell is tapped
2122

2223

2324
## Providing Handlers
@@ -48,6 +49,10 @@ All events exposed by {% typedoc_link classes:RadCalendar %} provide additional
4849
- `eventName` - the name of the event
4950
- `object` - the sender of the event
5051
- `eventData` - an instance of the {% typedoc_link classes:CalendarEvent %} class representing the selected event
52+
- {% typedoc_link classes:RadCalendar,member:cellTapEvent %} delivers its data by providing an instance of the {% typedoc_link classes:CalendarCellTapEventData %}. This class defines the following properties:
53+
- `eventName` - the name of the event
54+
- `object` - the sender of the event
55+
- `date` - the date of the cell that is tapped
5156

5257
## References
5358
Want to see this scenario in action?

docs/ui/professional-ui-components/Calendar/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ publish: true
99
---
1010

1111
# RadCalendar Overview
12-
{% typedoc_link classes:RadCalendar %} for NativeScript is based on the corresponding native calendar components from the Progress UI for iOS and Progress UI for Android suites. It exposes a unified API covering all major features coming from the native components like:
12+
{% typedoc_link classes:RadCalendar %} for NativeScript is a highly customizable native calendar abstraction that exposes a unified API, covering:
1313
- inline events
1414
- different view modes
1515
- cells customization
@@ -19,7 +19,7 @@ publish: true
1919

2020
## Features
2121
### View modes
22-
{% typedoc_link classes:RadCalendar %} supports four different view modes that are suitable for different application scenarios:
22+
{% typedoc_link classes:RadCalendar %} supports different view modes that are suitable for different application scenarios:
2323

2424
- {% typedoc_link enums:CalendarViewMode,member:Week %} - displays the dates within one week
2525
- {% typedoc_link enums:CalendarViewMode,member:Month %} - displays the dates within one month

docs/ui/professional-ui-components/Calendar/populating-with-data.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ publish: true
1111
# Populating RadCalendar with Data
1212
RadCalendar allows you to define a list of events for a particular date. This is done by using the `eventSource` property. This article describes the steps you need to take in order to feed {% typedoc_link classes:RadCalendar %} with your custom events using a events source.
1313

14-
### The CalendarEvent Class
14+
## The CalendarEvent Class
1515
Feeding events into {% typedoc_link classes:RadCalendar %} is done via instances of the {% typedoc_link classes:CalendarEvent %} class. The {% typedoc_link classes:CalendarEvent %} class is model describing a single event. It exposes properties allowing you to specify things like:
1616

1717
- start time of the event
@@ -38,8 +38,17 @@ Running the application, the following is shown on iOS and Android:
3838

3939
![TelerikUI-RadCalendar-Populating-With-Data](../../img/ns_ui/calendar-populating-with-data_android.png "iOS") ![TelerikUI-RadCalendar-Populating-With-Data](../../img/ns_ui/calendar-populating-with-data_ios.png "Android")
4040

41+
## Extending the CalendarEvent
42+
If you need, you can extend the `CalendarEvent` with an id to track more easily the selected items or any other information that you need that is missing from the default event. Here's an example:
43+
44+
<snippet id='calendar-custom-event-model-ts'/>
45+
46+
Then you can use the new type to populate the list of items that will be bound to **RadCalendar**'s `eventSource` property:
47+
48+
<snippet id='calendar-custom-event-items-ts'/>
49+
4150
## Event View Modes
42-
By default, events for each date cell are shown as dots (iOS) or squares with a summary (Android). You can customize this behavior by choosing one of the following event view modes:
51+
The events for each date cell are shown as dots (iOS) or squares with a summary (Android). **RadCalendar** allows you to show more information about the events by changing the **eventsViewMode** property. The default value is **None** meaning that there will be no additional event reperesentation coming out-of-the-box and the detailed information about events could be added through an additional **ListView** added below the **RadCalendar** and populated with information about events in a selected date. There are other event modes - **Inline** and **Popover** that present similar information within the calendar. Here are the available event view modes:
4352

4453
- {% typedoc_link enums:CalendarEventsViewMode,member:None %} - the default option
4554
- {% typedoc_link enums:CalendarEventsViewMode,member:Inline %} - event details are displayed in a list that appears in the calendar

docs/ui/professional-ui-components/Calendar/selection-modes.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Selection modes
33
page_title: RadCalendar selection modes | Progress NativeScript UI Documentation
4-
description: This article explains how to set the RadCalendar's selection mode with Angular
4+
description: This article explains how to set the RadCalendar's selection mode
55
slug: calendar-selection-modes
66
tags: calendar, angular, selection, modes, nativescript, professional, ui
77
position: 4
@@ -22,4 +22,15 @@ To change the selection mode of {% typedoc_link classes:RadCalendar %} you shoul
2222

2323
For more information on how to handle selection events, you can take a look at the [Event Handling]({% slug calendar-event-handling %}) article.
2424

25+
Depending on the currect selection mode, you can use the following properties to get/set the selected dates:
26+
27+
- Single selection - {% typedoc_link classes:RadCalendar,member:selectedDate%}, which accepts values of type `Date`.
28+
- Multiple selection - {% typedoc_link classes:RadCalendar,member:selectedDates%}, which accepts values of type `Date` array.
29+
- Range selection - {% typedoc_link classes:RadCalendar,member:selectedDateRange%}, which accepts values of type {% typedoc_link classes:DateRange %}.
30+
31+
To programmatically clear the selection, you can either set `null` to the relevant property, or call {% typedoc_link classes:RadCalendar,member:clearSelection %}.
32+
Here's an example:
33+
34+
<snippet id='calendar-programmatic-selection-ts' />
35+
2536
> The Selection mode functionality could be used in the cases while we use `Month` or `Week` `viewMode`

docs/ui/professional-ui-components/ng-AutoCompleteTextView/display-modes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The next code snippet shows how to change that default value to {% typedoc_link
2626
In plain mode the {% typedoc_link classes:RadAutoCompleteTextView %} displays chosen item as plain text. With this mode only one item can be chosen.
2727

2828
## Tokens mode
29-
Tokens mode allows multiple choice of items. Chosen items are displayed as tokens which can be modified or completely changed with custom ones.
29+
Tokens mode allows multiple choice of items, which are displayed as tokens.
3030

3131
When **RadAutoCompleteTextView**'s `displayMode` is `Tokens`, you can apply two different behaviors for token arrangement.
3232

@@ -38,10 +38,10 @@ The layout mode of the tokens can be changed with the {% typedoc_link enums:RadA
3838
<snippet id='angular-autocomplete-layouts-wrap-html'/>
3939
<snippet id='angular-autocomplete-layouts-wrap'/>
4040

41-
## Wrap layout
42-
In wrap mode tokens are arranged on multiple lines. Every time a new line is started the {% typedoc_link classes:RadAutoCompleteTextView %} is expanding in order to show all tokens.
41+
### Wrap Layout
42+
In wrap mode tokens are arranged on multiple lines. Every time a new line is started the **RadAutoCompleteTextView** is expanding in order to show all tokens.
4343

44-
## Horizontal layout
44+
### Horizontal Layout
4545
In horizontal mode tokens are displayed on single line which can be scrolled horizontally in order to display all tokens.
4646

4747
## References

0 commit comments

Comments
 (0)