-
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
12 changed files
with
412 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry=https://registry.npmjs.org/ |
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,35 +1,27 @@ | ||
import * as Module from './index.tsx' | ||
import * as TestModule from './index-test.tsx' | ||
import { RenderToReactWithWrap } from '../../shared/render' | ||
import { useState } from 'react' | ||
export const Component = RenderToReactWithWrap(Module) | ||
export function InputBox () { | ||
export const Component = RenderToReactWithWrap(TestModule) | ||
export function TestCase () { | ||
const [val, setVal] = useState('v0') | ||
return ( | ||
<div style={{ margin: '10px', color: '#999' }}> | ||
|
||
<div style={{ margin: '10px' }}> | ||
<Component /> | ||
</div> | ||
) | ||
} | ||
|
||
|
||
export function InputBox2 () { | ||
export function TestCase2 () { | ||
const [val, setVal] = useState('v0') | ||
return ( | ||
<div style={{ margin: '10px', color: '#999' }}> | ||
<div style={{ margin: '10px' }}> | ||
</div> | ||
) | ||
} | ||
|
||
# Input 输入 | ||
# Form 表单 | ||
|
||
<InputBox /> | ||
普通 Form Input 表单 | ||
|
||
接收用户输入 | ||
|
||
<InputBox2 /> | ||
|
||
数字框 type=number | ||
|
||
<Component disabled value="disabled" /> | ||
|
||
不可以的输入框 | ||
<TestCase /> |
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,75 @@ | ||
import { h, SignalProps, PropTypes, useLogic, ConvertToLayoutTreeDraft, createComposeComponent, createFunctionComponent } from '@polymita/renderer'; | ||
import { after, Signal, signal } from '@polymita/signal' | ||
import * as Form from '../form' | ||
import * as FormItem from '../form-item' | ||
import * as Input from '../input' | ||
|
||
export const name = 'FormTest' as const | ||
export let meta: { | ||
props: FormTestProps, | ||
layoutStruct: FormTestLayout | ||
patchCommands: [] | ||
} | ||
|
||
export interface FormTestProps { | ||
} | ||
|
||
export const propTypes = { | ||
} | ||
|
||
export const logic = (props: SignalProps<FormTestProps>) => { | ||
const name = signal(''); | ||
const password = signal(''); | ||
|
||
return { | ||
name, | ||
password, | ||
} | ||
} | ||
type LogicReturn = ReturnType<typeof logic> | ||
|
||
export type FormTestLayout = { | ||
type: 'formTestContainer', | ||
children: [ | ||
] | ||
} | ||
|
||
const FormCpt = createFunctionComponent(Form) | ||
const FormItemCpt = createComposeComponent(FormItem) | ||
const InputCpt = createFunctionComponent(Input) | ||
export const layout = (props: FormTestProps) => { | ||
const logic = useLogic<LogicReturn>() | ||
return ( | ||
<formTestContainer> | ||
<formResult> | ||
name: {logic.name()} <br/> | ||
password: {logic.password()} | ||
</formResult> | ||
<br/> | ||
<br/> | ||
<FormCpt | ||
layout={{ labelWidth: '6em' }} | ||
form={ | ||
<div> | ||
<FormItemCpt label="name" > | ||
<InputCpt value={logic.name} /> | ||
</FormItemCpt> | ||
<FormItemCpt label="password" > | ||
<InputCpt value={logic.password} /> | ||
</FormItemCpt> | ||
</div> | ||
} | ||
/> | ||
</formTestContainer> | ||
) | ||
} | ||
|
||
export const styleRules = (props: FormTestProps, layout: ConvertToLayoutTreeDraft<FormTestLayout>) => { | ||
return [ | ||
] | ||
} | ||
|
||
export const designPattern = (props: FormTestProps, layout: ConvertToLayoutTreeDraft<FormTestLayout>) => { | ||
const logic = useLogic<LogicReturn>() | ||
return {} | ||
} |
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
Oops, something went wrong.