Skip to content

Commit 08d413e

Browse files
committed
Add OnlyView mode & refactor TableSelect/MultiSelect APIs
- Added OnlyView method to all select/multiselect interfaces and implementations for view-only mode. - Refactored TableSelect and TableMultiSelect: removed AutoFill/AddFormatType, changed AddColumn to use Func<T, string>, simplified filtering, and improved answer rendering. - Updated ITableMultiSelectControl<T> AddItem/AddItems to support initial checked state. - Updated documentation, samples, and internal column handling for new APIs. - Improved consistency, filtering logic, and view-only handling across controls.
1 parent 1553533 commit 08d413e

57 files changed

Lines changed: 868 additions & 1402 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api/assemblies/PromptPlus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
| interface [ISwitchWidget](./PromptPlusLibrary/ISwitchWidget.md) | Provides functionality for configuring and interacting with a Switch widget. |
7474
| interface [ITableMultiSelectControl&lt;T&gt;](./PromptPlusLibrary/ITableMultiSelectControl-1.md) | Represents the interface with all Methods of the Table MultiSelect Control |
7575
| interface [ITableSelectControl&lt;T&gt;](./PromptPlusLibrary/ITableSelectControl-1.md) | Represents the interface with all Methods of the Table Select Control |
76-
| interface [ITableWidget&lt;T&gt;](./PromptPlusLibrary/ITableWidget-1.md) | Represents the interface with all Methods of the Table Widget. |
76+
| interface [ITableWidget&lt;T&gt;](./PromptPlusLibrary/ITableWidget-1.md) | Represents the interface with all Methods of the Table Widget |
7777
| class [ItemFile](./PromptPlusLibrary/ItemFile.md) | Represents a file or folder selected |
7878
| struct [ItemHistory](./PromptPlusLibrary/ItemHistory.md) | Represents the history of an item with a timeout. |
7979
| interface [IWaitCommandControl](./PromptPlusLibrary/IWaitCommandControl.md) | Provides functionality for configuring and interacting with a WaitTimer control. |

docs/api/assemblies/PromptPlusLibrary/IMultiSelectControl-1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public interface IMultiSelectControl<T>
3434
| [HideTipGroup](IMultiSelectControl-1/HideTipGroup.md)(…) | Controls the visibility of the group name tooltip. Default is `false`. |
3535
| [Interaction](IMultiSelectControl-1/Interaction.md)(…) | |
3636
| [MaxWidth](IMultiSelectControl-1/MaxWidth.md)(…) | Sets the maximum display width for selected items text.Default value is [`MaxWidth`](./IPromptPlusConfig/MaxWidth.md). |
37+
| [OnlyView](IMultiSelectControl-1/OnlyView.md)(…) | Configures the control to be in view-only mode, where items can be viewed but not selected. Default is `false`. |
3738
| [Options](IMultiSelectControl-1/Options.md)(…) | Applies custom options to configure control behavior. |
3839
| [PageSize](IMultiSelectControl-1/PageSize.md)(…) | Sets the maximum number of items displayed per page. Default is 10. |
3940
| [PredicateSelected](IMultiSelectControl-1/PredicateSelected.md)(…) | Sets a validation predicate to determine whether an item can be selected. (2 methods) |
4041
| [Range](IMultiSelectControl-1/Range.md)(…) | Defines the valid range of items that must be selected. |
4142
| [Run](IMultiSelectControl-1/Run.md)(…) | Runs the MultiSelect control and returns the result. |
42-
| [ShowAllSelected](IMultiSelectControl-1/ShowAllSelected.md)(…) | Controls whether all selected items are displayed at completion. Default is `false`. |
4343
| [Styles](IMultiSelectControl-1/Styles.md)(…) | Configures the visual style for a specific element of the MultiSelect control. |
4444
| [TextSelector](IMultiSelectControl-1/TextSelector.md)(…) | Sets the function to convert items to display text. Default uses `Item.ToString()`. |
4545

docs/api/assemblies/PromptPlusLibrary/IMultiSelectControl-1/ShowAllSelected.md renamed to docs/api/assemblies/PromptPlusLibrary/IMultiSelectControl-1/OnlyView.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
![PromptPlus Logo](https://raw.githubusercontent.com/FRACerqueira/PromptPlus/refs/heads/main/icon.png)
22

3-
### IMultiSelectControl&lt;T&gt;.ShowAllSelected method
3+
### IMultiSelectControl&lt;T&gt;.OnlyView method
44
</br>
55

66

7-
#### Controls whether all selected items are displayed at completion. Default is `false`.
7+
#### Configures the control to be in view-only mode, where items can be viewed but not selected. Default is `false`.
88

99
```csharp
10-
public IMultiSelectControl ShowAllSelected(bool value)
10+
public IMultiSelectControl OnlyView(bool value = true)
1111
```
1212

1313
| parameter | description |
1414
| --- | --- |
15-
| value | Indicates whether to show all selected items at completion, ignoring [`MaxWidth`](./MaxWidth.md) constraints. Default is `true`. |
15+
| value | If `true`, the control is in view-only mode; otherwise, it is editable to select items. |
1616

1717
### Return Value
1818

19-
The current [`IMultiSelectControl`](../IMultiSelectControl-1.md) instance for method chaining.
19+
The current [`IMultiSelectControl`](../IMultiSelectControl-1.md) instance for chaining.
2020

2121
### See Also
2222

docs/api/assemblies/PromptPlusLibrary/ISelectControl-1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public interface ISelectControl<T>
3434
| [HideTipGroup](ISelectControl-1/HideTipGroup.md)(…) | Hides the tip with the group name. Default is `false`. |
3535
| [Interaction](ISelectControl-1/Interaction.md)(…) | |
3636
| [MaxWidth](ISelectControl-1/MaxWidth.md)(…) | Sets the maximum display width for selected item text.Default value is [`MaxWidth`](./IPromptPlusConfig/MaxWidth.md). |
37+
| [OnlyView](ISelectControl-1/OnlyView.md)(…) | Configures the control to be in view-only mode, where items can be viewed but not selected. Default is `false`. |
3738
| [Options](ISelectControl-1/Options.md)(…) | Applies custom options to the control. |
3839
| [PageSize](ISelectControl-1/PageSize.md)(…) | Sets the maximum number of items to display per page. Default value is 10. |
3940
| [PredicateSelected](ISelectControl-1/PredicateSelected.md)(…) | Sets a validation predicate to determine if a selected item is valid. (2 methods) |
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
![PromptPlus Logo](https://raw.githubusercontent.com/FRACerqueira/PromptPlus/refs/heads/main/icon.png)
2+
3+
### ISelectControl&lt;T&gt;.OnlyView method
4+
</br>
5+
6+
7+
#### Configures the control to be in view-only mode, where items can be viewed but not selected. Default is `false`.
8+
9+
```csharp
10+
public ISelectControl OnlyView(bool value = true)
11+
```
12+
13+
| parameter | description |
14+
| --- | --- |
15+
| value | If `true`, the control is in view-only mode; otherwise, it is editable to select items. |
16+
17+
### Return Value
18+
19+
The current [`ISelectControl`](../ISelectControl-1.md) instance for chaining.
20+
21+
### See Also
22+
23+
* interface [ISelectControl&lt;T&gt;](../ISelectControl-1.md)
24+
* namespace [PromptPlusLibrary](../../PromptPlus.md)
25+
26+
<!-- DO NOT EDIT: generated by xmldocmd for PromptPlus.dll -->

docs/api/assemblies/PromptPlusLibrary/ITableMultiSelectControl-1.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,20 @@ public interface ITableMultiSelectControl<T>
1919

2020
| name | description |
2121
| --- | --- |
22-
| [AddColumn](ITableMultiSelectControl-1/AddColumn.md)(…) | Adds a column to the table. Cannot be used with [`AutoFill`](./ITableMultiSelectControl-1/AutoFill.md). |
23-
| [AddFormatType&lt;T1&gt;](ITableMultiSelectControl-1/AddFormatType.md)(…) | Sets a custom format function for columns by field type when not specified by [`AddColumn`](./ITableMultiSelectControl-1/AddColumn.md). |
24-
| [AddItem](ITableMultiSelectControl-1/AddItem.md)(…) | Adds an item to the list. |
25-
| [AddItems](ITableMultiSelectControl-1/AddItems.md)(…) | Adds a collection of items to the list. |
26-
| [AutoFill](ITableMultiSelectControl-1/AutoFill.md)(…) | Automatically generates columns based on public properties. Cannot be used with [`AddColumn`](./ITableMultiSelectControl-1/AddColumn.md) or AutoFit. Header alignment will always be Center. Content alignment will always be Left with sliding lines enabled. Columns are generated from public properties of the data class recognized by TypeCode. DBNull and Object will be ignored. The column size will be automatically adjusted based on the title size (property name) and the *minwidth*/*maxwidth* parameters, or content width when min/max width is `null`. |
22+
| [AddColumn](ITableMultiSelectControl-1/AddColumn.md)(…) | Adds a column to the table with custom formatting and alignment options. |
23+
| [AddItem](ITableMultiSelectControl-1/AddItem.md)(…) | Adds a single item to the list. |
24+
| [AddItems](ITableMultiSelectControl-1/AddItems.md)(…) | Adds multiple items to the list. |
2725
| [ChangeDescription](ITableMultiSelectControl-1/ChangeDescription.md)(…) | Dynamically changes the description using a custom function. |
2826
| [Default](ITableMultiSelectControl-1/Default.md)(…) | Sets the initial selected values. |
2927
| [EnabledHistory](ITableMultiSelectControl-1/EnabledHistory.md)(…) | Enables history and applies custom options to the history feature. |
3028
| [EqualItems](ITableMultiSelectControl-1/EqualItems.md)(…) | Sets a custom item comparator for equality comparison. |
31-
| [FilterByColumns](ITableMultiSelectControl-1/FilterByColumns.md)(…) | Sets the columns used by the filter strategy. |
29+
| [Filter](ITableMultiSelectControl-1/Filter.md)(…) | Sets the filter strategy for filtering items in the collection. Default is Disabled. |
3230
| [HideCountSelected](ITableMultiSelectControl-1/HideCountSelected.md)(…) | Hides the tip count of selected items. Default is `false`. |
3331
| [HideHeaders](ITableMultiSelectControl-1/HideHeaders.md)(…) | Hides column headers. Default is `false`. |
3432
| [Interaction](ITableMultiSelectControl-1/Interaction.md)(…) | |
3533
| [Layout](ITableMultiSelectControl-1/Layout.md)(…) | Sets the table layout. Default is SingleGridFull. |
3634
| [MaxWidth](ITableMultiSelectControl-1/MaxWidth.md)(…) | Sets the maximum width for the selected items display. Default is 30 characters. |
35+
| [OnlyView](ITableMultiSelectControl-1/OnlyView.md)(…) | Configures the control to be in view-only mode, where items can be viewed but not selected. Default is `false`. |
3736
| [Options](ITableMultiSelectControl-1/Options.md)(…) | Applies custom options to the control. |
3837
| [PageSize](ITableMultiSelectControl-1/PageSize.md)(…) | Sets the maximum number of items to view per page. Default is 10. |
3938
| [PredicateSelected](ITableMultiSelectControl-1/PredicateSelected.md)(…) | Sets validation predicate for selected items. (2 methods) |

docs/api/assemblies/PromptPlusLibrary/ITableMultiSelectControl-1/AddColumn.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,28 @@
44
</br>
55

66

7-
#### Adds a column to the table. Cannot be used with [`AutoFill`](./AutoFill.md).
7+
#### Adds a column to the table with custom formatting and alignment options.
88

99
```csharp
10-
public ITableMultiSelectControl AddColumn(Expression<Func<T, object>> field, int width,
11-
Func<object, string>? format = null, TextAlignment alignment = TextAlignment.Left,
12-
string? title = null, TextAlignment titlealignment = TextAlignment.Center,
13-
bool titlereplaceswidth = true, bool textcrop = false, int? maxslidinglines = null)
10+
public ITableMultiSelectControl AddColumn(string title, int width, Func<T, string> rowvalue,
11+
TextAlignment rowAlignment = TextAlignment.Left,
12+
TextAlignment titleAlignment = TextAlignment.Center, bool titlereplaceswidth = true,
13+
int maxslidinglines = 0)
1414
```
1515

1616
| parameter | description |
1717
| --- | --- |
18-
| field | The expression that defines the field associated with the column. |
19-
| width | The column width in characters. |
20-
| format | The function to format the field value. If not specified, uses ToString. |
21-
| alignment | The content alignment. Default is Left. |
22-
| title | The column title. If not specified, uses the property name. |
23-
| titlealignment | The title alignment. Default is Center. |
24-
| titlereplaceswidth | If `true`, the title width overrides column width when greater; otherwise, the title is truncated to fit the column width. Default is `true`. |
25-
| textcrop | If `true`, the value will be truncated to the column size; otherwise, the content will be wrapped to multiple lines. Default is `false`. |
26-
| maxslidinglines | The maximum number of sliding lines when the content length exceeds the column size and *textcrop* is `false`. |
18+
| title | The optional title for the column header. If not specified, the field name is used. |
19+
| width | The width of the column in characters. |
20+
| rowvalue | A function that takes an item and returns the value to display in the column. |
21+
| rowAlignment | The content alignment within the column. The default is TextAlignment.Left. |
22+
| titleAlignment | The title alignment within the column. The default is TextAlignment.Center. |
23+
| titlereplaceswidth | When true, the title width overrides the column width if the title is longer. The default is true. |
24+
| maxslidinglines | The maximum number of sliding lines when content exceeds the column width and textcrop is false. The default is 0. |
2725

2826
### Return Value
2927

30-
The current [`ITableMultiSelectControl`](../ITableMultiSelectControl-1.md) instance for chaining.
28+
The current [`ITableMultiSelectControl`](../ITableMultiSelectControl-1.md) instance for method chaining.
3129

3230
### See Also
3331

docs/api/assemblies/PromptPlusLibrary/ITableMultiSelectControl-1/AddItem.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,27 @@
44
</br>
55

66

7-
#### Adds an item to the list.
7+
#### Adds a single item to the list.
88

99
```csharp
10-
public ITableMultiSelectControl AddItem(T value, bool disable = false)
10+
public ITableMultiSelectControl AddItem(T value, bool valuechecked = false, bool disable = false)
1111
```
1212

1313
| parameter | description |
1414
| --- | --- |
1515
| value | The item to add. |
16-
| disable | If `true`, the item is added as disabled; otherwise, it is enabled. |
16+
| valuechecked | Indicates whether the item should be initially checked. Default is `false`. |
17+
| disable | Indicates whether the item should be disabled. Default is `false`. |
1718

1819
### Return Value
1920

20-
The current [`ITableMultiSelectControl`](../ITableMultiSelectControl-1.md) instance for chaining.
21+
The current [`ITableMultiSelectControl`](../ITableMultiSelectControl-1.md) instance for method chaining.
22+
23+
### Exceptions
24+
25+
| exception | condition |
26+
| --- | --- |
27+
| ArgumentNullException | Thrown when *value* is `null`. |
2128

2229
### See Also
2330

docs/api/assemblies/PromptPlusLibrary/ITableMultiSelectControl-1/AddItems.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,28 @@
44
</br>
55

66

7-
#### Adds a collection of items to the list.
7+
#### Adds multiple items to the list.
88

99
```csharp
10-
public ITableMultiSelectControl AddItems(IEnumerable<T> values, bool disable = false)
10+
public ITableMultiSelectControl AddItems(IEnumerable<T> values, bool valuechecked = false,
11+
bool disable = false)
1112
```
1213

1314
| parameter | description |
1415
| --- | --- |
1516
| values | The collection of items to add. |
16-
| disable | If `true`, all items are added as disabled; otherwise, they are enabled. |
17+
| valuechecked | Indicates whether the items should be initially checked. Default is `false`. |
18+
| disable | Indicates whether the items should be disabled. Default is `false`. |
1719

1820
### Return Value
1921

20-
The current [`ITableMultiSelectControl`](../ITableMultiSelectControl-1.md) instance for chaining.
22+
The current [`ITableMultiSelectControl`](../ITableMultiSelectControl-1.md) instance for method chaining.
23+
24+
### Exceptions
25+
26+
| exception | condition |
27+
| --- | --- |
28+
| ArgumentNullException | Thrown when *values* is `null`. |
2129

2230
### See Also
2331

docs/api/assemblies/PromptPlusLibrary/ITableMultiSelectControl-1/AutoFill.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)