forked from codebdy/rxdrag
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
334 additions
and
52 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
export const icon = <svg height="1em" width="1em" fill="currentColor" viewBox="0 0 1024 1024"> | ||
<path d="M840.834 64.951c66.098 0 119.471 50.204 119.44 112.112V848.84c0 62.02-53.462 112.112-119.44 112.112H183.715c-66.096 0-119.44-50.205-119.44-112.14V177.063c0-62.02 53.463-112.112 119.44-112.112h657.12z m55.44 749.797v-603.62c0-45.367-39.67-82.177-88.851-82.177H217.126c-49.093 0-88.851 37.056-88.851 82.177v603.62c0 45.394 39.67 82.203 88.851 82.203h590.297c49.064 0 88.852-37.056 88.852-82.203zM366.275 474h164a8 8 0 0 0 8-8V348.951c0-17.673 14.327-32 32-32 17.674 0 32 14.327 32 32v328c0 17.673-14.326 32-32 32-17.673 0-32-14.327-32-32V546a8 8 0 0 0-8-8h-164a8 8 0 0 0-8 8v130.951c0 17.673-14.326 32-32 32-17.673 0-32-14.327-32-32v-328c0-17.673 14.327-32 32-32 17.674 0 32 14.327 32 32V466a8 8 0 0 0 8 8z m332-45.049c17.674 0 32 14.327 32 32v216c0 17.673-14.326 32-32 32-17.673 0-32-14.327-32-32v-216c0-17.673 14.327-32 32-32z m0-112c17.674 0 32 14.327 32 32v24c0 17.673-14.326 32-32 32-17.673 0-32-14.327-32-32v-24c0-17.673 14.327-32 32-32z"></path> | ||
</svg> |
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,28 @@ | ||
import { IComponentMaterial } from "core-react"; | ||
import { icon } from "./icon"; | ||
import { boxLocales, boxResourceLocales } from "./locales"; | ||
import { boxSchema } from "./schema"; | ||
import { Hero } from "expamples/ant5/components/layouts/Hero"; | ||
|
||
const name = "Hero" | ||
export const HeroMaterial: IComponentMaterial = { | ||
componentName: name, | ||
component: Hero, | ||
designer: Hero, | ||
designerLocales: boxLocales, | ||
designerSchema: boxSchema, | ||
resource: { | ||
name: name, | ||
icon: icon, | ||
color: "#dfa324", | ||
resourceLocales: boxResourceLocales, | ||
elements: [ | ||
{ | ||
componentName: name, | ||
} | ||
] | ||
}, | ||
behaviorRule: { | ||
droppable: true, | ||
} | ||
} |
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,23 @@ | ||
export const boxLocales = { | ||
"zh-CN": { | ||
title: "大块屏", | ||
settings: { | ||
} | ||
|
||
}, | ||
'en-US': { | ||
title: "Hero", | ||
settings: { | ||
} | ||
} | ||
} | ||
|
||
|
||
export const boxResourceLocales = { | ||
"zh-CN": { | ||
"Hero": "大块屏", | ||
}, | ||
'en-US': { | ||
"Hero": "Hero", | ||
} | ||
} |
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,4 @@ | ||
import { INodeSchema } from "core"; | ||
import { createSchema } from "react-shells/ant5/shared/createSchema"; | ||
|
||
export const boxSchema: INodeSchema = createSchema() |
1 change: 0 additions & 1 deletion
1
...react-shells/ant5/SettingsForm/components/BackgroundImageInput/css-background-parser.d.ts
This file was deleted.
Oops, something went wrong.
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
88 changes: 88 additions & 0 deletions
88
src/react-shells/ant5/SettingsForm/components/ImageSelect/index.tsx
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,88 @@ | ||
import { Col, Modal, Row } from "antd" | ||
import { useToken } from "antd/es/theme/internal" | ||
import { useToolsTranslate } from "core-react/hooks/useToolsTranslate" | ||
import React, { useCallback, useEffect } from "react" | ||
import { memo, useState } from "react" | ||
import { ImageView } from "react-shells/ant5/components/ImageView" | ||
import styled from "styled-components" | ||
|
||
const ImageContainer = styled.div.attrs((props: { actived?: boolean, borderColor?: string }) => ({ | ||
...props, | ||
}))` | ||
width: 100%; | ||
border-radius: 8px; | ||
overflow: hidden; | ||
padding:2px; | ||
outline: ${props => props.actived ? props.borderColor + " solid 1px" : undefined}; | ||
` | ||
|
||
const images = [ | ||
"/imgs/hero.png", | ||
"/imgs/ad.jpg", | ||
] | ||
|
||
export const ImageSelect = memo(( | ||
props: { | ||
children: React.ReactElement, | ||
value?: string, | ||
onChange?: (value?: string) => void, | ||
} | ||
) => { | ||
const { children, value, onChange } = props | ||
const [open, setOpen] = useState(false) | ||
const [selected, setSelected] = useState<string>() | ||
const t = useToolsTranslate() | ||
const [, token] = useToken() | ||
|
||
useEffect(()=>{ | ||
setSelected(value) | ||
}, [value]) | ||
|
||
const handleClick = useCallback(() => { | ||
setOpen(true) | ||
}, []) | ||
|
||
const handleOk = useCallback(() => { | ||
setOpen(false); | ||
onChange?.(selected) | ||
}, [onChange, selected]); | ||
|
||
const handleCancel = useCallback(() => { | ||
setOpen(false); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
{React.cloneElement(children, { onClick: handleClick })} | ||
<Modal | ||
title={t('selectImage')} | ||
open={open} | ||
okText={t("confirm")} | ||
cancelText={t("cancel")} | ||
onOk={handleOk} | ||
onCancel={handleCancel} | ||
okButtonProps={{ | ||
disabled: !selected | ||
}} | ||
> | ||
<Row gutter={16}> | ||
{ | ||
images.map((img, index) => { | ||
return ( | ||
<Col span={6} key={index}> | ||
<ImageContainer | ||
borderColor={token.colorPrimary} | ||
actived={selected === img} | ||
onClick={() => setSelected(img)} | ||
> | ||
<ImageView height="100%" value={img} style={{ borderRadius: 8 }} /> | ||
</ImageContainer> | ||
</Col> | ||
) | ||
}) | ||
} | ||
</Row> | ||
</Modal> | ||
</> | ||
) | ||
}) |
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
Oops, something went wrong.