-
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.
now selected theme will be store in browser localStorage, add more options for forms, add new component input number , fixes popover, input password, text area, update examples
- Loading branch information
Showing
178 changed files
with
1,186 additions
and
756 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-disable react/display-name */ | ||
import React from "react" | ||
import { Form } from "antd" | ||
|
||
|
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,17 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
import React from 'react' | ||
import { InputNumber } from 'antd' | ||
import useDashboardEvent from "../api/Hooks/useDashboardEvent" | ||
|
||
|
||
export default function AntdInputNumber({ id, prefix, suffix, ...props }) { | ||
const onFormat = value => `${prefix}${value}${suffix}` | ||
return ( | ||
<InputNumber | ||
{ ...props } | ||
formatter={ value => onFormat(value) } | ||
/> | ||
) | ||
} | ||
|
||
AntdInputNumber.displayName = "AntdInputNumber" |
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,10 +1,18 @@ | ||
import React from "react"; | ||
import { Input } from "antd" | ||
// import "antd/es/input/style/index.css" | ||
import useDashboardEvent from "../api/Hooks/useDashboardEvent"; | ||
|
||
export default props => { | ||
const [{attributes}] = useDashboardEvent(props.id, props); | ||
return <Input.Password {...attributes} />; | ||
}; | ||
export default function AntdInputPassword({ prefix, suffix, addonAfter, addonBefore, ...props }) { | ||
const prefix_suffix = { | ||
prefix: prefix && UniversalDashboard.renderComponent(prefix), | ||
suffix: suffix && UniversalDashboard.renderComponent(suffix) | ||
} | ||
|
||
const addons = { | ||
addonBefore: addonBefore && UniversalDashboard.renderComponent(addonBefore), | ||
addonAfter: addonAfter && UniversalDashboard.renderComponent(addonAfter) | ||
} | ||
|
||
return <Input.Password { ...props } { ...addons } { ...prefix_suffix }/>; | ||
} | ||
|
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 |
---|---|---|
@@ -1,54 +1,17 @@ | ||
import React from "react" | ||
import { Timeline, Alert } from "antd" | ||
import { queryCache } from 'react-query' | ||
import { useEndpointSubscription } from "../api/Hooks/useDashboardEvent" | ||
import useTimeline from "./useTimeline" | ||
import useAddToTimeline from "./addToTimeline" | ||
import useRemoveFromTimeline from "./removeFromTimeline" | ||
import useClearTimeline from "./clearTimeline" | ||
import { Timeline, Alert, Spin } from "antd" | ||
import useTimeline from './useTimeline' | ||
|
||
|
||
export default function AntdTimeline({ id, ...props }) { | ||
const { autoRefresh, refreshInterval, ...restOfProps } = props | ||
const [add, { status: addStatus, reset, data: addData }] = useAddToTimeline() | ||
const [remove] = useRemoveFromTimeline() | ||
const [clear] = useClearTimeline() | ||
|
||
const { data, status, error, isFetching, isStale, refetch } = useTimeline(id, autoRefresh, refreshInterval) | ||
|
||
useEndpointSubscription(id, (_, event) => { | ||
if (event.type === "addTimelineItem") { | ||
add({ timelineId: event?.data?.timelineId, item: event?.data?.item }) | ||
} | ||
if (event.type === "removeTimelineItem") { | ||
remove({ timelineId: event?.data?.timelineId, itemId: event?.data?.itemId }) | ||
} | ||
if (event.type === "clearTimeline") { | ||
clear({ timelineId: event?.data?.timelineId }) | ||
} | ||
}) | ||
|
||
if (status === "error") return <Alert message={ error.message } type="error" /> | ||
|
||
console.log("addStatus", addStatus) | ||
console.log("status", status) | ||
console.log("addData", addData) | ||
console.log("data", data) | ||
const {content, attributes} = useTimeline({id:id, ...props}) | ||
return ( | ||
<Timeline | ||
pending={ addStatus === "loading" && "Getting data..." } | ||
{ ...restOfProps } | ||
> | ||
{ data !== undefined && data.map( | ||
item => <Timeline.Item | ||
{ ...item } | ||
key={ item?.id } | ||
dot={ UniversalDashboard.renderComponent(item?.dot) } | ||
label={ UniversalDashboard.renderComponent(item?.label) } | ||
onClick={ () => reset() } | ||
> | ||
{ UniversalDashboard.renderComponent(item.content) } | ||
</Timeline.Item>) } | ||
</Timeline> | ||
<Alert.ErrorBoundary> | ||
<React.Suspense fallback={ <Spin spinning size="default" /> } > | ||
<Timeline { ...attributes } > | ||
{ content } | ||
</Timeline> | ||
</React.Suspense> | ||
</Alert.ErrorBoundary> | ||
) | ||
} |
Oops, something went wrong.