Skip to content

Commit bc1944a

Browse files
authored
Merge pull request #41 from disberd/structbond_select
2 parents 1582b78 + 8c4628c commit bc1944a

25 files changed

Lines changed: 1577 additions & 293 deletions

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
matrix:
2626
version:
2727
- '1'
28-
- '1.9'
28+
- 'lts'
2929
os:
3030
- ubuntu-latest
3131
- windows-latest

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
This file contains the changelog for the PlutoExtras package. It follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format.
4+
5+
## [Unreleased]
6+
Changelog was introduced in this version. Only changes w.r.t. version v0.7.14 are listed
7+
8+
### Added
9+
- Added an option to the `@NTBond` macro to provide a function as third argument which is applied via `PlutoUI.Experimental.transformed_value` to the bond resulting from the `@NTBond` macro.
10+
- Added a new exported type `StructBondSelect` to the module `StructBondModule` which simplifies creating a widget whose value may have different number of fields/parameters depending on a dropdown selector.
11+
- The package now re-exports the names exported by its `StructBondModule` submodule.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Markdown = "1"
2222
PlutoUI = "0.7.51"
2323
REPL = "1"
2424
Random = "1"
25-
julia = "1.9"
25+
julia = "1.10"

docs/src/structbond.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,25 @@ The macro simply create a [`StructBond`](@ref) wrapping the desired NamedTuple t
3737
</video>
3838
```
3939

40+
## StructBondSelect
41+
Sometimes, one wants to create a more complex binding where the number of parameters to control a bond can vary depending on some other variable. The `StructBondSelect` can be of help in some of these cases, by providing a way to select out of a number of arbitrary `StructBonds` (which include `@NTBond`) by using a dropdown to select the one to be displayed and used for generating the `StructBondSelect` widget's output.
42+
43+
This structure can be constructed with a vector of `StructBond` or `transformed_value(f, ::StructBond)` elements, and will take care of generating an appropriate widget to display and process only the selected one.
44+
45+
The main signature of the constructor is the following:
46+
```julia
47+
StructBondSelect(els::Vector; description = "StructBondSelect", default_idx = 1, selector_text = "Selector")
48+
```
49+
50+
The names to select upon will be taken from the `description` of the provided `StructBonds`, while the text displayed next to the _selector_ will default to `Selector` but can be customized with the `selector_text` kwarg to the constructor.
51+
The `description` kwarg can be used to customize the text in the widget container (similar to the same kwarg in `StructBond` and to `@NTBond`). Finally, the `default_idx` should be an integer and will select which of the provided `StructBond`s will be selected as default when instantiating the widget.
52+
53+
```@raw html
54+
<video controls=true>
55+
<source src="https://private-user-images.githubusercontent.com/12846528/435671114-795c3da9-ede1-4f96-a971-038a8ce506c3.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDUyNDA0ODgsIm5iZiI6MTc0NTI0MDE4OCwicGF0aCI6Ii8xMjg0NjUyOC80MzU2NzExMTQtNzk1YzNkYTktZWRlMS00Zjk2LWE5NzEtMDM4YThjZTUwNmMzLm1wND9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA0MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNDIxVDEyNTYyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdmMWZmYjJhNTIyNGI5NDFmMDk3ODcxZWU2ZTE3Njk1MGYyZDk2MmQ5ZTI1NzEyNzJlZTZkNjUxMDhkNDI4ODYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.XXQ6NJLqc1MoBVQXY9MNageij2F0DhsEzvQpHSP9F4A" type="video/mp4">
56+
</video>
57+
```
58+
4059
## @BondsList
4160
In some cases, one does not want to have a single bond wrapping either a Structure or a NamedTuple because single independent bonds are more convenient.
4261

html_exports/test_bondstable.jl.html

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)