Skip to content

Commit df63bd3

Browse files
committed
fix #1
1 parent 61b9b5a commit df63bd3

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codingapi/ui-framework",
3-
"version": "0.0.24",
3+
"version": "0.0.25",
44
"description": "A UI Framework built with React and Typescript",
55
"keywords": [
66
"ui",

src/Form/fatory.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from "react";
2+
import {FormItemProps} from "./types";
3+
4+
export class FormFactory {
5+
private readonly items = new Map<string, React.Component<FormItemProps>>;
6+
7+
private constructor() {
8+
9+
}
10+
11+
private static instance = new FormFactory();
12+
13+
public static getInstance() {
14+
return this.instance;
15+
}
16+
17+
public addItem(type: string, item: React.Component<FormItemProps>): void {
18+
this.items.set(type, item);
19+
}
20+
21+
public getItem(type: string): React.Component<FormItemProps> | undefined {
22+
return this.items.get(type);
23+
}
24+
25+
}

src/Form/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export * from './antd';
33
export * from './instance';
44
export * from './listener';
55
export * from './utils';
6-
export * from './validate';
6+
export * from './validate';
7+
export * from './fatory';

0 commit comments

Comments
 (0)