-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create select component and fix it so it will work inside a form ! textArea is still buggy not working ionside form, and component input group and rate component
- Loading branch information
Showing
145 changed files
with
991 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from "react" | ||
import { Input } from "antd" | ||
|
||
export default function AntdInputGroup({ content, ...props }) { | ||
return ( | ||
<Input.Group { ...props }> | ||
{ UniversalDashboard.renderComponent(content) } | ||
</Input.Group> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import React from "react" | ||
import { Input } from "antd" | ||
import useDashboardEvent from "../api/Hooks/useDashboardEvent" | ||
|
||
export default function AntdTextArea ({ id, ...props }) { | ||
const [{ attributes }] = useDashboardEvent(id, props) | ||
return <Input.TextArea rows={4} autoSize={true} spellCheck={true} /> | ||
export default function AntdTextArea(props) { | ||
const [value, setValue] = React.useState("demo text") | ||
return <Input.TextArea id={ props.id } value={ value } onChange={ ({target}) => setValue(target.value) } autoSize={false} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react' | ||
import { Rate } from 'antd' | ||
import StarFilled from '@ant-design/icons/StarFilled' | ||
export default function AntdRating(props) { | ||
const { character, ...restOfProps } = props | ||
return <Rate | ||
{ ...restOfProps } | ||
character={ character && UniversalDashboard.renderComponent(character) || <StarFilled /> } | ||
/> | ||
} | ||
|
||
AntdRating.displayName = "AntdRating" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react' | ||
import { Select } from 'antd' | ||
|
||
const { Option } = Select | ||
|
||
export default function AntdSelectOption({ value }) { | ||
return <Option key={ value } label={ value } value={ value }>{ value }</Option> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
import { Select, Alert, Input } from 'antd' | ||
import { getMeta } from '../framework/meta' | ||
import useDashboardEvent from '../api/Hooks/useDashboardEvent' | ||
import useSelect from './useSelect' | ||
|
||
const { Option } = Select | ||
|
||
export default function AntdSelect(props) { | ||
const { content, ...restOfProps } = props | ||
return ( | ||
<Select { ...restOfProps }> | ||
{content.map( item => <Option value={ item.value }>{ item.value }</Option>)} | ||
</Select> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import { useQuery } from 'react-query' | ||
// import { endpoint } from '../api/consts' | ||
import { getMeta } from '../framework/meta' | ||
import { Alert, Select } from 'antd' | ||
|
||
const dashboardid = getMeta("ud-dashboard") | ||
const { Option } = Select | ||
export default function useSelect(url) { | ||
const { data, status, error, isFetching } = useQuery(["select", { url }], async () => { | ||
const res = await fetch(url, { | ||
headers: { | ||
dashboardid, | ||
UDConnectionId: UniversalDashboard.connectionId, | ||
}, | ||
}) | ||
const res_1 = await res.json() | ||
return res_1 | ||
},{refetchOnMount: true}) | ||
|
||
if (status === "error") return <Alert message={error.message} type="error"/> | ||
const options = data && data.map(i => <Option key={ i } value={ i }>{ i }</Option>) | ||
return { options, isFetching } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,17 @@ New-UDPage -Title 'Forms' -Name 'Form' -Content { | |
username = "AlonGvili" | ||
password = "Aa123456" | ||
email = "[email protected]" | ||
textbox = "GviliAlon" | ||
} | ||
$WrapperCol = @{ span = 20; pull = 2; push = 2 } | ||
|
||
$Repos = Get-Content -Path "$Root\data\data.json" -Raw | ConvertFrom-Json | ||
[System.Collections.ArrayList]$filters = @() | ||
$null = $filters.AddRange($Repos[0].psobject.Properties.name) | ||
$null = $filters.Add('owner.id') | ||
|
||
$v = Get-Content -Path "$Root\data\data.json" -Raw | ConvertFrom-Json | ||
$NamesAsJson = $v.Name | ConvertTo-Json | ||
New-UDAntdForm -Id 'demoForm' -Variant small -WrapperCol $WrapperCol -InitialValues $InitialValues -Content { | ||
New-UDAntdFormItem -Name 'username' -Content ( | ||
New-UDAntdInput -PlaceHolder 'Enter your user name' -Prefix ( New-UDAntdIcon -Icon UserOutlined ) | ||
|
@@ -21,11 +29,9 @@ New-UDPage -Title 'Forms' -Name 'Form' -Content { | |
message = "you must enter a valide password." | ||
}) | ||
New-UDAntdFormItem -Name "group" -Content ( | ||
New-UDAntdInput -PlaceHolder 'Enter your group name' -Prefix ( New-UDAntdIcon -Icon TeamOutlined ) -AddonAfter ( | ||
New-UDAntdPopover -Trigger ( | ||
New-UDAntdIcon -Icon InfoCircleOutlined | ||
) -Content "valide groups names are: dev, ops, qa" -Title "test" | ||
) | ||
New-UDAntdPopover -Trigger ( | ||
New-UDAntdInput -PlaceHolder 'Enter your group name' -Prefix ( New-UDAntdIcon -Icon TeamOutlined ) | ||
) -Content "valide groups names are: dev, ops, qa" | ||
) | ||
New-UDAntdFormItem -Name 'email' -Content ( | ||
New-UDAntdInput -PlaceHolder 'Enter your email address' -Prefix ( New-UDAntdIcon -Icon MailOutlined ) | ||
|
@@ -35,7 +41,28 @@ New-UDPage -Title 'Forms' -Name 'Form' -Content { | |
type = 'email' | ||
}) | ||
New-UDAntdFormItem -Name 'textbox' -Content ( | ||
New-UDAntdInputTextArea -PlaceHolder '??' | ||
New-UDAntdInputTextArea | ||
) | ||
New-UDAntdFormItem -Name 'input_group' -Content ( | ||
New-UDAntdInputGroup -Content { | ||
New-UDAntdSelect -DataSource { | ||
(Get-Content -Path "$Root\data\data.json" -Raw | ConvertFrom-Json).Foreach( { | ||
New-UDAntdSelectOption -Value $_.Name | ||
}) | ||
} -Bordered -DropdownMatchSelectWidth -Placeholder "Select github repo name." | ||
New-UDAntdInputNumber | ||
} | ||
) | ||
|
||
New-UDAntdFormItem -Name 'cnum' -Content ( | ||
New-UDAntdInputNumber -DefaultValue 2 | ||
) | ||
New-UDAntdFormItem -HasFeedback -Name "gvili_select" -Content ( | ||
New-UDAntdSelect -DataSource { | ||
(Get-Content -Path "$Root\data\data.json" -Raw | ConvertFrom-Json).Foreach( { | ||
New-UDAntdSelectOption -Value $_.Name | ||
}) | ||
} -Bordered -DropdownMatchSelectWidth -Placeholder "Select github repo name." | ||
) | ||
New-UDAntdFormItem -Name 'radioGroup' -Content ( | ||
New-UDAntdRadioGroup -Content { | ||
|
@@ -51,6 +78,20 @@ New-UDPage -Title 'Forms' -Name 'Form' -Content { | |
New-UDAntdRadioButton -Value "VS" -Content { "Visual Studio" } | ||
} | ||
) | ||
New-UDAntdFormItem -Name 'my_rate' -Content ( | ||
New-UDAntdRate | ||
) -Rules @(@{ | ||
required = $true | ||
message = "you must select a rate." | ||
}) | ||
New-UDAntdFormItem -Name 'my_rate_custom' -Content ( | ||
New-UDAntdRate -Character "??" | ||
) | ||
New-UDAntdFormItem -Name 'my_rate_custom_icon' -Content ( | ||
New-UDAntdRate -Character ( | ||
New-UDAntdIcon -Icon ForkOutlined -Size 2x | ||
) | ||
) | ||
} -Layout vertical -SubmitButton ( | ||
New-UDAntdButton -Label Demo -HtmlType submit -ButtonType primary | ||
) -ResetButton ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function New-UDAntdInputGroup { | ||
[CmdletBinding()] | ||
[OutputType('Ant.Design.Input.Group')] | ||
param( | ||
[Parameter()] | ||
[string]$Id = (New-Guid).ToString(), | ||
[Parameter()] | ||
[hashtable]$Style, | ||
[Parameter(Mandatory)] | ||
[scriptblock]$Content, | ||
[Parameter()] | ||
[switch]$Compact, | ||
[Parameter()] | ||
[ValidateSet("default", "small", "large")] | ||
[string]$size = "default" | ||
) | ||
|
||
End { | ||
$AntdInputGroup = @{ | ||
assetId = $AssetId | ||
isPlugin = $true | ||
type = "ud-antd-input-group" | ||
id = $Id | ||
content = $Content.Invoke() | ||
size = $Size | ||
style = $Style | ||
compact = $Compact.IsPresent | ||
} | ||
$AntdInputGroup.PSTypeNames.Insert(0, 'Ant.Design.Input.Group') | ||
$AntdInputGroup | ||
} | ||
} |
Oops, something went wrong.