-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable selection of terms to import into excel #584
Changes from 4 commits
bffed7f
2aa0ddf
b179a4a
b46fc28
04a2cb7
12d4d78
450cda8
c2064a5
4d11c9a
2cf7798
ace120f
849b155
869ade6
ca0a1d4
6ddefa4
5feb2b1
9cf7d21
95dcf24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
module Modals.ModalElements | ||
module Modals | ||
|
||
open Feliz | ||
open Feliz.DaisyUI | ||
open Model | ||
open Messages | ||
open Shared | ||
open Shared.DTOs.SelectedColumnsModalDto | ||
open SelectedColumns | ||
|
||
open ARCtrl | ||
open JsonImport | ||
|
@@ -14,6 +14,20 @@ open Fable.React.Helpers | |
|
||
type ModalElements = | ||
|
||
static member LogicContainer (children: ReactElement list) = | ||
Html.div [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that i think about it. Why do you need this in a modal? this should only be used for sidebar logic groups? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I grouped all elements that were used by SeletiveTemplateFromDB.fs and SelectiveImporModal.fs into the ModalElements.fs. |
||
// prop.className "border-l-4 border-transparent px-4 py-2 shadow-md" | ||
// prop.style [ | ||
// let rndVal = rnd.Next(30,70) | ||
// let colorArr = [|NFDIColors.LightBlue.Lighter10; NFDIColors.Mint.Lighter10;|] | ||
// style.custom("borderImageSlice", "1") | ||
// style.custom("borderImageSource", $"linear-gradient({colorArr.[if order then 0 else 1]} {100-rndVal}%%, {colorArr.[if order then 1 else 0]})") | ||
// order <- not order | ||
// ] | ||
prop.className "relative flex p-4 animated-border shadow-md gap-4 flex-col" //experimental | ||
prop.children children | ||
] | ||
|
||
static member Button(text: string, onClickAction, buttonInput, ?isDisabled: bool) = | ||
let isDisabled = defaultArg isDisabled false | ||
Daisy.button.a [ | ||
|
@@ -106,78 +120,3 @@ type ModalElements = | |
prop.onClick (fun _ -> setSelector targetselector) | ||
prop.text (string targetselector) | ||
] | ||
|
||
static member RadioPluginsBox(boxName, icon, importType: TableJoinOptions, radioData: (TableJoinOptions * string)[], setImportType: TableJoinOptions -> unit) = | ||
let myradio(target: TableJoinOptions, txt: string) = | ||
let isChecked = importType = target | ||
ModalElements.RadioPlugin("importType", txt, isChecked, fun (b: bool) -> if b then setImportType target) | ||
ModalElements.Box (boxName, icon, React.fragment [ | ||
Html.div [ | ||
for i in 0..radioData.Length-1 do | ||
myradio(radioData.[i]) | ||
] | ||
]) | ||
|
||
static member checkBox(columns: CompositeColumn [], index, selectionInformation: SelectedColumns, setSelectedColumns: SelectedColumns -> unit) = | ||
Html.div [ | ||
prop.style [style.display.flex; style.justifyContent.center] | ||
prop.children [ | ||
Daisy.checkbox [ | ||
prop.type'.checkbox | ||
prop.style [ | ||
style.height(length.perc 100) | ||
] | ||
prop.isChecked | ||
(if selectionInformation.Columns.Length > 0 then | ||
selectionInformation.Columns.[index] | ||
else true) | ||
prop.onChange (fun (b: bool) -> | ||
if columns.Length > 0 then | ||
let selectedData = selectionInformation.Columns | ||
selectedData.[index] <- b | ||
{selectionInformation with Columns = selectedData} |> setSelectedColumns) | ||
] | ||
] | ||
] | ||
|
||
static member TableWithImportColumnCheckboxes(table: ArcTable, ?selectionInformation: SelectedColumns, ?setSelectedColumns: SelectedColumns -> unit) = | ||
let columns = table.Columns | ||
let displayCheckBox = | ||
//Determine whether to display checkboxes or not | ||
selectionInformation.IsSome && setSelectedColumns.IsSome | ||
Daisy.table [ | ||
prop.children [ | ||
Html.thead [ | ||
Html.tr [ | ||
for i in 0..columns.Length-1 do | ||
Html.th [ | ||
Html.label [ | ||
prop.className "join flex flex-row centered gap-2" | ||
prop.children [ | ||
if displayCheckBox then | ||
ModalElements.checkBox(columns, i, selectionInformation.Value, setSelectedColumns.Value) | ||
Html.text (columns.[i].Header.ToString()) | ||
Html.div [ | ||
prop.onClick (fun e -> | ||
if columns.Length > 0 && selectionInformation.IsSome then | ||
let selectedData = selectionInformation.Value.Columns | ||
selectedData.[i] <- not selectedData.[i] | ||
{selectionInformation.Value with Columns = selectedData} |> setSelectedColumns.Value) | ||
] | ||
] | ||
] | ||
] | ||
] | ||
] | ||
|
||
Html.tbody [ | ||
for ri in 0 .. (table.RowCount-1) do | ||
let row = table.GetRow(ri, true) | ||
Html.tr [ | ||
for c in row do | ||
Html.td (c.ToString()) | ||
] | ||
] | ||
] | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed