@next-bricks/form 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +15 -4
- package/dist/chunks/{1970.0122d8c6.js → 1970.1bf0f5c1.js} +3 -3
- package/dist/chunks/{1970.0122d8c6.js.map → 1970.1bf0f5c1.js.map} +1 -1
- package/dist/chunks/2179.5d5ada16.js +2 -0
- package/dist/chunks/{6205.af7a9022.js.map → 2179.5d5ada16.js.map} +1 -1
- package/dist/chunks/2618.4d1b4f8f.js +2 -0
- package/dist/chunks/2618.4d1b4f8f.js.map +1 -0
- package/dist/chunks/{3494.4a17db19.js → 3494.81238413.js} +2 -2
- package/dist/chunks/{3494.4a17db19.js.map → 3494.81238413.js.map} +1 -1
- package/dist/chunks/4131.cd33579d.js +2 -0
- package/dist/chunks/4131.cd33579d.js.map +1 -0
- package/dist/chunks/4356.e66da273.js +2 -0
- package/dist/chunks/4356.e66da273.js.map +1 -0
- package/dist/chunks/4791.288c8084.js +2 -0
- package/dist/chunks/4791.288c8084.js.map +1 -0
- package/dist/chunks/5636.676bad66.js +2 -0
- package/dist/chunks/5636.676bad66.js.map +1 -0
- package/dist/chunks/6205.e5f8de3e.js +2 -0
- package/dist/chunks/{7164.dcaf6d0e.js.map → 6205.e5f8de3e.js.map} +1 -1
- package/dist/chunks/7164.c5911296.js +2 -0
- package/dist/chunks/7164.c5911296.js.map +1 -0
- package/dist/chunks/{7822.53604e29.js → 7822.8c36398f.js} +2 -2
- package/dist/chunks/{7822.53604e29.js.map → 7822.8c36398f.js.map} +1 -1
- package/dist/chunks/{8826.4444fb49.js → 9223.c35f1d9a.js} +2 -2
- package/dist/chunks/9223.c35f1d9a.js.map +1 -0
- package/dist/chunks/{9431.4eea30bd.js → 9431.cabf049c.js} +2 -2
- package/dist/chunks/{9431.4eea30bd.js.map → 9431.cabf049c.js.map} +1 -1
- package/dist/chunks/{code-editor.c7e4ccfa.js → code-editor.85b3ad33.js} +2 -2
- package/dist/chunks/code-editor.85b3ad33.js.map +1 -0
- package/dist/chunks/dynamic-form-item.f3f40a4e.js +2 -0
- package/dist/chunks/dynamic-form-item.f3f40a4e.js.map +1 -0
- package/dist/chunks/general-checkbox.81d8d8d1.js +3 -0
- package/dist/chunks/general-checkbox.81d8d8d1.js.map +1 -0
- package/dist/chunks/general-form-item.9a3d11f7.js +3 -0
- package/dist/chunks/general-form-item.9a3d11f7.js.map +1 -0
- package/dist/chunks/general-form.03de30e1.js +2 -0
- package/dist/chunks/general-form.03de30e1.js.map +1 -0
- package/dist/chunks/general-input.1e2be165.js +3 -0
- package/dist/chunks/general-input.1e2be165.js.map +1 -0
- package/dist/chunks/general-radio.f5b2b849.js +3 -0
- package/dist/chunks/general-radio.f5b2b849.js.map +1 -0
- package/dist/chunks/general-search.a76cac8b.js +3 -0
- package/dist/chunks/general-search.a76cac8b.js.map +1 -0
- package/dist/chunks/general-select.b806fc3d.js +3 -0
- package/dist/chunks/general-select.b806fc3d.js.map +1 -0
- package/dist/chunks/general-textarea.ce42122f.js +3 -0
- package/dist/chunks/general-textarea.ce42122f.js.map +1 -0
- package/dist/chunks/icon-select.c1e34968.js +3 -0
- package/dist/chunks/icon-select.c1e34968.js.LICENSE.txt +5 -0
- package/dist/chunks/icon-select.c1e34968.js.map +1 -0
- package/dist/chunks/main.ba6d4ded.js +2 -0
- package/dist/chunks/main.ba6d4ded.js.map +1 -0
- package/dist/chunks/submit-buttons.0a2d1413.js +2 -0
- package/dist/chunks/submit-buttons.0a2d1413.js.map +1 -0
- package/dist/index.a93d21e4.js +2 -0
- package/dist/index.a93d21e4.js.map +1 -0
- package/dist/manifest.json +294 -212
- package/dist-types/bootstrap.d.ts +1 -0
- package/dist-types/checkbox/index.d.ts +37 -40
- package/dist-types/code-editor/index.d.ts +3 -3
- package/dist-types/dynamic-form-item/index.d.ts +14 -9
- package/dist-types/form/index.d.ts +19 -16
- package/dist-types/form-item/index.d.ts +4 -5
- package/dist-types/icon-select/i18n.d.ts +15 -0
- package/dist-types/icon-select/index.d.ts +53 -0
- package/dist-types/icon-select/index.spec.d.ts +1 -0
- package/dist-types/icon-select/utils.d.ts +25 -0
- package/dist-types/input/index.d.ts +82 -11
- package/dist-types/input/index.spec.d.ts +1 -0
- package/dist-types/radio/index.d.ts +44 -82
- package/dist-types/search/index.d.ts +5 -5
- package/dist-types/select/index.d.ts +19 -79
- package/dist-types/submit-buttons/index.d.ts +11 -49
- package/dist-types/textarea/calculateAutoSizeStyle.d.ts +1 -0
- package/dist-types/textarea/index.d.ts +25 -58
- package/docs/dynamic-form-item.md +89 -0
- package/docs/general-checkbox.md +221 -0
- package/docs/general-form.md +245 -0
- package/docs/general-input.md +163 -0
- package/docs/general-radio.md +286 -0
- package/docs/general-select.md +205 -0
- package/docs/general-textarea.md +109 -0
- package/docs/icon-select.md +14 -0
- package/docs/submit-buttons.md +67 -0
- package/package.json +2 -2
- package/dist/chunks/2255.91dc8128.js +0 -2
- package/dist/chunks/2255.91dc8128.js.map +0 -1
- package/dist/chunks/2993.5d245055.js +0 -2
- package/dist/chunks/2993.5d245055.js.map +0 -1
- package/dist/chunks/6205.af7a9022.js +0 -2
- package/dist/chunks/7164.dcaf6d0e.js +0 -2
- package/dist/chunks/8826.4444fb49.js.map +0 -1
- package/dist/chunks/9396.f9127ea6.js +0 -2
- package/dist/chunks/9396.f9127ea6.js.map +0 -1
- package/dist/chunks/code-editor.c7e4ccfa.js.map +0 -1
- package/dist/chunks/dynamic-form-item.97b25da2.js +0 -2
- package/dist/chunks/dynamic-form-item.97b25da2.js.map +0 -1
- package/dist/chunks/general-checkbox.0ec43d11.js +0 -3
- package/dist/chunks/general-checkbox.0ec43d11.js.map +0 -1
- package/dist/chunks/general-form-item.865dc60f.js +0 -3
- package/dist/chunks/general-form-item.865dc60f.js.map +0 -1
- package/dist/chunks/general-form.c9523ae0.js +0 -2
- package/dist/chunks/general-form.c9523ae0.js.map +0 -1
- package/dist/chunks/general-input.243352ff.js +0 -3
- package/dist/chunks/general-input.243352ff.js.map +0 -1
- package/dist/chunks/general-radio.21553834.js +0 -3
- package/dist/chunks/general-radio.21553834.js.map +0 -1
- package/dist/chunks/general-search.0ba9a7cb.js +0 -3
- package/dist/chunks/general-search.0ba9a7cb.js.map +0 -1
- package/dist/chunks/general-select.d6404264.js +0 -3
- package/dist/chunks/general-select.d6404264.js.map +0 -1
- package/dist/chunks/general-textarea.11a84e7c.js +0 -3
- package/dist/chunks/general-textarea.11a84e7c.js.map +0 -1
- package/dist/chunks/main.c796802d.js +0 -2
- package/dist/chunks/main.c796802d.js.map +0 -1
- package/dist/chunks/submit-buttons.6fe24040.js +0 -2
- package/dist/chunks/submit-buttons.6fe24040.js.map +0 -1
- package/dist/index.7af0aa96.js +0 -2
- package/dist/index.7af0aa96.js.map +0 -1
- package/dist-types/form/formStore.d.ts +0 -53
- package/dist-types/form-item/FormItemElement.d.ts +0 -22
- package/dist-types/utils/PubSub.d.ts +0 -6
- /package/dist/chunks/{1970.0122d8c6.js.LICENSE.txt → 1970.1bf0f5c1.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{general-checkbox.0ec43d11.js.LICENSE.txt → general-checkbox.81d8d8d1.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{general-form-item.865dc60f.js.LICENSE.txt → general-form-item.9a3d11f7.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{general-input.243352ff.js.LICENSE.txt → general-input.1e2be165.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{general-radio.21553834.js.LICENSE.txt → general-radio.f5b2b849.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{general-search.0ba9a7cb.js.LICENSE.txt → general-search.a76cac8b.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{general-select.d6404264.js.LICENSE.txt → general-select.b806fc3d.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{general-textarea.11a84e7c.js.LICENSE.txt → general-textarea.ce42122f.js.LICENSE.txt} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "@next-core/theme";
|
|
3
|
-
import {
|
|
3
|
+
import type { FormItemProps } from "../form-item/index.js";
|
|
4
|
+
import { FormItemElementBase } from "@next-shared/form";
|
|
4
5
|
export type CheckboxType = "default" | "icon";
|
|
5
6
|
export declare type CheckboxValueType = string | number | boolean;
|
|
6
7
|
export interface CheckboxOptionType {
|
|
@@ -19,66 +20,62 @@ export interface OptionGroup {
|
|
|
19
20
|
key: string;
|
|
20
21
|
options: CheckboxOptionType[];
|
|
21
22
|
}
|
|
22
|
-
export interface CheckboxProps {
|
|
23
|
+
export interface CheckboxProps extends FormItemProps {
|
|
23
24
|
options?: CheckboxOptionType[];
|
|
24
25
|
label?: string;
|
|
25
26
|
value?: CheckboxValueType[];
|
|
26
|
-
|
|
27
|
-
text?: string;
|
|
27
|
+
disabled?: boolean;
|
|
28
28
|
type?: CheckboxType;
|
|
29
29
|
isCustom?: boolean;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
onChange?: (value: CheckboxOptionType[]) => void;
|
|
31
|
+
optionsChange?: (options: CheckboxOptionType[], name: string) => void;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* 表单复选框构件
|
|
35
|
+
* @author derrickma
|
|
36
|
+
*/
|
|
37
|
+
declare class Checkbox extends FormItemElementBase {
|
|
34
38
|
#private;
|
|
35
39
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @required true
|
|
38
|
-
* @default -
|
|
39
|
-
* @description 多选框当前选中初始值
|
|
40
|
-
* @group basic
|
|
40
|
+
* 字段名称
|
|
41
41
|
*/
|
|
42
|
-
accessor
|
|
42
|
+
accessor name: string | undefined;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
* @default -
|
|
46
|
-
* @description 多选框选项表
|
|
47
|
-
* @group basic
|
|
44
|
+
* 字段说明
|
|
48
45
|
*/
|
|
49
|
-
accessor
|
|
46
|
+
accessor label: string | undefined;
|
|
50
47
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @required true
|
|
53
|
-
* @default -
|
|
54
|
-
* @description 多选框字段名
|
|
55
|
-
* @group basicFormItem
|
|
48
|
+
* 值
|
|
56
49
|
*/
|
|
57
|
-
accessor
|
|
50
|
+
accessor value: CheckboxValueType[] | undefined;
|
|
58
51
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @required
|
|
61
|
-
* @default -
|
|
62
|
-
* @description 多选框字段说明
|
|
63
|
-
* @group basic
|
|
52
|
+
* 多选框选项表
|
|
53
|
+
* @required
|
|
64
54
|
*/
|
|
65
|
-
accessor
|
|
55
|
+
accessor options: CheckboxOptionType[];
|
|
66
56
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
69
|
-
* @default -
|
|
70
|
-
* @description 多选框类型
|
|
71
|
-
* @group basic
|
|
57
|
+
* 类型
|
|
58
|
+
* @default "default"
|
|
72
59
|
*/
|
|
73
60
|
accessor type: CheckboxType;
|
|
74
61
|
/**
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
62
|
+
* 是否禁用
|
|
63
|
+
*/
|
|
64
|
+
accessor disabled: boolean | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* 是否为自定义
|
|
67
|
+
* @default false
|
|
80
68
|
*/
|
|
81
69
|
accessor isCustom: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 是否必填
|
|
72
|
+
*/
|
|
73
|
+
accessor required: boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* 校验文本
|
|
76
|
+
*/
|
|
77
|
+
accessor message: Record<string, string> | undefined;
|
|
78
|
+
handleCheckboxChange: (detail: CheckboxOptionType[]) => void;
|
|
82
79
|
render(): JSX.Element;
|
|
83
80
|
}
|
|
84
81
|
export { Checkbox };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react"
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { CodeEditorProps, HighlightTokenSettings, Annotation } from "./interfaces.js";
|
|
3
|
-
import {
|
|
3
|
+
import { FormItemElementBase } from "@next-shared/form";
|
|
4
4
|
export interface Error {
|
|
5
5
|
err: Annotation[];
|
|
6
6
|
hasError: boolean;
|
|
@@ -13,7 +13,7 @@ export interface Error {
|
|
|
13
13
|
* @author sailor
|
|
14
14
|
* @noInheritDoc
|
|
15
15
|
*/
|
|
16
|
-
declare class CodeEditor extends
|
|
16
|
+
declare class CodeEditor extends FormItemElementBase {
|
|
17
17
|
#private;
|
|
18
18
|
/**
|
|
19
19
|
* @description
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/// <reference types="react"
|
|
2
|
-
import { FormItemElement } from "../form-item/FormItemElement.js";
|
|
1
|
+
/// <reference types="react" />
|
|
3
2
|
import { UseBrickConf } from "@next-core/types";
|
|
4
3
|
import "@next-core/theme";
|
|
4
|
+
import { FormItemElementBase } from "@next-shared/form";
|
|
5
5
|
type DynamicFormValuesItem = Record<string, any>;
|
|
6
6
|
/**
|
|
7
7
|
* @id form.dynamic-form-item
|
|
@@ -11,21 +11,26 @@ type DynamicFormValuesItem = Record<string, any>;
|
|
|
11
11
|
* @author sailor
|
|
12
12
|
* @noInheritDoc
|
|
13
13
|
*/
|
|
14
|
-
declare class DynamicFormItem extends
|
|
14
|
+
declare class DynamicFormItem extends FormItemElementBase {
|
|
15
15
|
#private;
|
|
16
|
+
/**
|
|
17
|
+
* 字段名称
|
|
18
|
+
*/
|
|
16
19
|
accessor name: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* 字段说明
|
|
22
|
+
*/
|
|
17
23
|
accessor label: string | undefined;
|
|
18
24
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @required
|
|
21
|
-
* @description
|
|
25
|
+
* 是否必填
|
|
22
26
|
*/
|
|
23
27
|
accessor required: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* 值
|
|
30
|
+
*/
|
|
24
31
|
accessor value: DynamicFormValuesItem[] | undefined;
|
|
25
32
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @required
|
|
28
|
-
* @description
|
|
33
|
+
* 动态表单子项构件列表
|
|
29
34
|
*/
|
|
30
35
|
accessor useBrick: UseBrickConf | undefined;
|
|
31
36
|
handleDynamicFormChange: (values: DynamicFormValuesItem[]) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react"
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ReactNextElement } from "@next-core/react-element";
|
|
3
|
-
import { FormStore } from "
|
|
3
|
+
import { AbstractForm, FormStore } from "@next-shared/form";
|
|
4
4
|
import { ComponentSize, Layout } from "../interface.js";
|
|
5
5
|
interface FormProps {
|
|
6
6
|
values?: Record<string, any>;
|
|
@@ -18,46 +18,49 @@ export interface FormMapEvents {
|
|
|
18
18
|
onValidateError: "validate.error";
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @name form.general-form
|
|
23
|
-
* @docKind brick
|
|
24
|
-
* @description 通用输入框构件
|
|
21
|
+
* 表单构件
|
|
25
22
|
* @author sailor
|
|
26
|
-
* @
|
|
23
|
+
* @slot - 表单内容
|
|
27
24
|
*/
|
|
28
|
-
declare class Form extends ReactNextElement implements FormProps {
|
|
25
|
+
declare class Form extends ReactNextElement implements FormProps, AbstractForm {
|
|
29
26
|
#private;
|
|
30
|
-
readonly isFormElement = true;
|
|
31
27
|
formStore: FormStore;
|
|
32
28
|
defaultEmitValuesChange: boolean;
|
|
33
29
|
constructor();
|
|
30
|
+
get isFormElement(): true;
|
|
34
31
|
set values(value: Record<string, unknown>);
|
|
35
32
|
get values(): Record<string, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* 布局方式
|
|
35
|
+
*/
|
|
36
36
|
accessor layout: Layout | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* 表单组件尺寸
|
|
39
|
+
*/
|
|
37
40
|
accessor size: ComponentSize | undefined;
|
|
38
41
|
handleValuesChange: (values: Record<string, unknown>) => void;
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
43
|
+
* 表单校验方法
|
|
41
44
|
*/
|
|
42
45
|
validate(): boolean | Record<string, unknown>;
|
|
43
46
|
/**
|
|
44
|
-
*
|
|
47
|
+
* 表单设置值方法
|
|
45
48
|
*/
|
|
46
49
|
setInitValue(values: Record<string, unknown>): void;
|
|
47
50
|
/**
|
|
48
|
-
*
|
|
51
|
+
* 表单重置值方法
|
|
49
52
|
*/
|
|
50
53
|
resetFields(name?: string): void;
|
|
51
54
|
/**
|
|
52
|
-
*
|
|
55
|
+
* 获取表单值方法
|
|
53
56
|
*/
|
|
54
|
-
getFieldsValue(name
|
|
57
|
+
getFieldsValue(name?: string): unknown;
|
|
55
58
|
/**
|
|
56
|
-
*
|
|
59
|
+
* 校验表单字段方法
|
|
57
60
|
*/
|
|
58
61
|
validateField(name: string): void;
|
|
59
62
|
/**
|
|
60
|
-
*
|
|
63
|
+
* 重置表单校验状态方法
|
|
61
64
|
*/
|
|
62
65
|
resetValidateState(): void;
|
|
63
66
|
render(): JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="react"
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AbstractForm, FormItemElementBase, MessageBody } from "@next-shared/form";
|
|
3
3
|
import type { Form } from "../form/index.jsx";
|
|
4
4
|
import type { ComponentSize, Layout } from "../interface.js";
|
|
5
|
-
import type { MessageBody } from "../form/formStore.js";
|
|
6
5
|
import "@next-core/theme";
|
|
7
6
|
type CurrentElement = HTMLElement & {
|
|
8
7
|
size?: ComponentSize;
|
|
@@ -10,7 +9,7 @@ type CurrentElement = HTMLElement & {
|
|
|
10
9
|
[key: string]: any;
|
|
11
10
|
};
|
|
12
11
|
export interface FormItemProps {
|
|
13
|
-
formElement?:
|
|
12
|
+
formElement?: AbstractForm | null;
|
|
14
13
|
curElement: CurrentElement;
|
|
15
14
|
name?: string;
|
|
16
15
|
label?: string;
|
|
@@ -37,7 +36,7 @@ export interface FormItemProps {
|
|
|
37
36
|
* @author sailor
|
|
38
37
|
* @noInheritDoc
|
|
39
38
|
*/
|
|
40
|
-
declare class FormItem extends
|
|
39
|
+
declare class FormItem extends FormItemElementBase implements FormItemProps {
|
|
41
40
|
/**
|
|
42
41
|
* @default
|
|
43
42
|
* @required
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum K {
|
|
2
|
+
ICON = "ICON",
|
|
3
|
+
COLOR = "COLOR",
|
|
4
|
+
SELECT_ICON = "SELECT_ICON",
|
|
5
|
+
SEARCH_PLACEHOLDER = "SEARCH_PLACEHOLDER"
|
|
6
|
+
}
|
|
7
|
+
export declare const NS = "bricks/form/icon-select";
|
|
8
|
+
export declare const locales: {
|
|
9
|
+
en: Locale;
|
|
10
|
+
zh: Locale;
|
|
11
|
+
};
|
|
12
|
+
type Locale = {
|
|
13
|
+
[key in K]: string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormItemElementBase } from "@next-shared/form";
|
|
3
|
+
import "@next-core/theme";
|
|
4
|
+
import type { FormItemProps } from "../form-item/index.js";
|
|
5
|
+
import type { GeneralIconProps } from "@next-bricks/icons/general-icon";
|
|
6
|
+
type Icon = GeneralIconProps & {
|
|
7
|
+
color?: string;
|
|
8
|
+
};
|
|
9
|
+
export interface IconSelectProps {
|
|
10
|
+
name?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
value?: Icon;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
message?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 图标选择构件
|
|
19
|
+
*/
|
|
20
|
+
export declare class IconSelect extends FormItemElementBase implements IconSelectProps {
|
|
21
|
+
#private;
|
|
22
|
+
/**
|
|
23
|
+
* 字段名称
|
|
24
|
+
*/
|
|
25
|
+
accessor name: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* 字段说明
|
|
28
|
+
*/
|
|
29
|
+
accessor label: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* 值
|
|
32
|
+
*/
|
|
33
|
+
accessor value: Icon | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* 是否禁用
|
|
36
|
+
*/
|
|
37
|
+
accessor disabled: boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* 是否必填
|
|
40
|
+
*/
|
|
41
|
+
accessor required: boolean | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* 是否必填
|
|
44
|
+
*/
|
|
45
|
+
accessor message: Record<string, string> | undefined;
|
|
46
|
+
handleChange: (value?: Icon) => void;
|
|
47
|
+
render(): JSX.Element;
|
|
48
|
+
}
|
|
49
|
+
interface IconSelectComponentProps extends FormItemProps, IconSelectProps {
|
|
50
|
+
onChange?: (value?: Icon) => void;
|
|
51
|
+
}
|
|
52
|
+
export declare function IconSelectComponent(props: IconSelectComponentProps): JSX.Element;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum Colors {
|
|
2
|
+
green = "green",
|
|
3
|
+
red = "red",
|
|
4
|
+
blue = "blue",
|
|
5
|
+
orange = "orange",
|
|
6
|
+
cyan = "cyan",
|
|
7
|
+
purple = "purple",
|
|
8
|
+
geekblue = "geekblue",
|
|
9
|
+
gray = "gray"
|
|
10
|
+
}
|
|
11
|
+
export declare const COLORS_MAP: Record<Colors, {
|
|
12
|
+
color: string;
|
|
13
|
+
background: string;
|
|
14
|
+
borderColor: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* 如果提供的颜色值是平台提供的规范颜色,则转换为使用平台规范的颜色定义,包括color、background、borderColor,不是的话则原样输出。
|
|
18
|
+
* @param color {string} 颜色值
|
|
19
|
+
* @return {color:string;background:string;borderColor:string;} 返回处理后的对应颜色值
|
|
20
|
+
*/
|
|
21
|
+
export declare function getColor(color?: string): {
|
|
22
|
+
color: string;
|
|
23
|
+
background: string;
|
|
24
|
+
borderColor: string;
|
|
25
|
+
};
|
|
@@ -1,27 +1,98 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ComponentSize, InputType } from "../interface.js";
|
|
3
|
+
import { FormItemElementBase } from "@next-shared/form";
|
|
3
4
|
import "@next-core/theme";
|
|
4
|
-
import {
|
|
5
|
-
interface InputProps {
|
|
6
|
-
formElement?: Form;
|
|
7
|
-
curElement: HTMLElement;
|
|
8
|
-
name?: string;
|
|
9
|
-
label?: string;
|
|
5
|
+
import type { FormItemProps } from "../form-item/index.jsx";
|
|
6
|
+
interface InputProps extends FormItemProps {
|
|
10
7
|
value?: string;
|
|
11
8
|
placeholder?: string;
|
|
12
9
|
disabled?: boolean;
|
|
10
|
+
clearable?: boolean;
|
|
13
11
|
type?: InputType;
|
|
14
12
|
size?: ComponentSize;
|
|
15
13
|
inputStyle?: React.CSSProperties;
|
|
16
14
|
minLength?: number;
|
|
17
15
|
maxLength?: number;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
pattern?: string;
|
|
20
|
-
min?: number;
|
|
21
|
-
max?: number;
|
|
22
16
|
validateState?: string;
|
|
23
17
|
trigger?: string;
|
|
24
18
|
onInputChange: (value: string) => void;
|
|
25
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* 通用输入框构件
|
|
22
|
+
* @author sailor
|
|
23
|
+
* @slot prefix - 输入框前置插槽
|
|
24
|
+
* @slot suffix - 输入框后置插槽
|
|
25
|
+
*/
|
|
26
|
+
declare class Input extends FormItemElementBase {
|
|
27
|
+
#private;
|
|
28
|
+
/**
|
|
29
|
+
* 字段名称
|
|
30
|
+
*/
|
|
31
|
+
accessor name: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* 标签文字
|
|
34
|
+
*/
|
|
35
|
+
accessor label: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* 输入框值
|
|
38
|
+
*/
|
|
39
|
+
accessor value: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* 占位说明
|
|
42
|
+
*/
|
|
43
|
+
accessor placeholder: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* 是否禁用
|
|
46
|
+
*/
|
|
47
|
+
accessor disabled: boolean | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* 是否显示清除按钮
|
|
50
|
+
*/
|
|
51
|
+
accessor clearable: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* 类型
|
|
54
|
+
* @default "text"
|
|
55
|
+
*/
|
|
56
|
+
accessor type: InputType | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* 大小
|
|
59
|
+
* @default "medium"
|
|
60
|
+
*/
|
|
61
|
+
accessor size: ComponentSize | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* 最小长度
|
|
64
|
+
*/
|
|
65
|
+
accessor minLength: number | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* 最大长度
|
|
68
|
+
*/
|
|
69
|
+
accessor maxLength: number | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* 是否必填
|
|
72
|
+
*/
|
|
73
|
+
accessor required: boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* 正则校验规则
|
|
76
|
+
*/
|
|
77
|
+
accessor pattern: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* 表单校验最大长度
|
|
80
|
+
*/
|
|
81
|
+
accessor max: number | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* 表单校验最小长度
|
|
84
|
+
*/
|
|
85
|
+
accessor min: number | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* 错误时显示消息
|
|
88
|
+
*/
|
|
89
|
+
accessor message: Record<string, string> | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* 输入框样式
|
|
92
|
+
*/
|
|
93
|
+
accessor inputStyle: React.CSSProperties | undefined;
|
|
94
|
+
handleInputChange: (value: string) => void;
|
|
95
|
+
render(): JSX.Element;
|
|
96
|
+
}
|
|
26
97
|
export declare function InputComponent(props: InputProps): JSX.Element;
|
|
27
|
-
export {};
|
|
98
|
+
export { Input };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { FormItemElementBase } from "@next-shared/form";
|
|
3
|
+
import type { RadioType, GeneralOption, GeneralComplexOption, UIType, RadioGroupButtonStyle, ComponentSize } from "../interface.js";
|
|
3
4
|
import "@next-core/theme";
|
|
5
|
+
import type { FormItemProps } from "../form-item/index.jsx";
|
|
4
6
|
import { UseSingleBrickConf } from "@next-core/types";
|
|
5
|
-
import { FormItemElement } from "../form-item/FormItemElement.js";
|
|
6
|
-
import type { Form } from "../form/index.jsx";
|
|
7
7
|
interface CustomOptions {
|
|
8
8
|
url: string;
|
|
9
9
|
description?: string;
|
|
@@ -14,132 +14,94 @@ interface CustomOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export interface RadioProps {
|
|
16
16
|
type?: RadioType;
|
|
17
|
-
curElement: HTMLElement;
|
|
18
|
-
formElement: Form;
|
|
19
17
|
options: GeneralOption[] | CustomOptions[] | undefined;
|
|
20
18
|
value?: any;
|
|
21
|
-
name?: string;
|
|
22
19
|
disabled?: boolean;
|
|
23
20
|
buttonStyle?: RadioGroupButtonStyle;
|
|
24
|
-
size?:
|
|
21
|
+
size?: ComponentSize;
|
|
25
22
|
ui?: UIType;
|
|
26
23
|
useBrick?: UseSingleBrickConf;
|
|
27
24
|
customStyle?: React.CSSProperties;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
optionsChange
|
|
25
|
+
}
|
|
26
|
+
export interface RadioEvents {
|
|
27
|
+
change: CustomEvent<GeneralComplexOption["value"]>;
|
|
28
|
+
optionsChange: CustomEvent<{
|
|
29
|
+
options: GeneralComplexOption[];
|
|
30
|
+
name: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export interface RadioEventsMapping {
|
|
34
|
+
onValueChange: "change";
|
|
35
|
+
onOptionsChange: "optionsChange";
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @name form.general-radio
|
|
36
|
-
* @docKind brick
|
|
37
|
-
* @description 通用单选构件
|
|
38
|
+
* 通用单选构件
|
|
38
39
|
* @author sailor
|
|
39
|
-
* @noInheritDoc
|
|
40
40
|
*/
|
|
41
|
-
declare class Radio extends
|
|
41
|
+
declare class Radio extends FormItemElementBase {
|
|
42
42
|
#private;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
* @required true
|
|
46
|
-
* @default -
|
|
47
|
-
* @description 下拉框字段名
|
|
48
|
-
* @group basicFormItem
|
|
44
|
+
* 下拉框字段名
|
|
49
45
|
*/
|
|
50
46
|
accessor name: string | undefined;
|
|
51
47
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @required false
|
|
54
|
-
* @default -
|
|
55
|
-
* @description 单选框字段说明
|
|
56
|
-
* @group basic
|
|
48
|
+
* 单选框字段说明
|
|
57
49
|
*/
|
|
58
50
|
accessor label: string | undefined;
|
|
59
51
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
* @description 单选框选项表,RadioType为default时,如果设置了tooltip值,可以设置tooltipIcon图标(MenuIcon 类型),tooltipIcon颜色默认为--color-secondary-text。
|
|
63
|
-
* @group basic
|
|
52
|
+
* 单选框选项表
|
|
53
|
+
* @required
|
|
64
54
|
*/
|
|
65
55
|
accessor options: GeneralOption[] | undefined;
|
|
66
56
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @required true
|
|
69
|
-
* @default -
|
|
70
|
-
* @description 单选框当前选中始值
|
|
71
|
-
* @group basic
|
|
57
|
+
* 单选框当前选中始值
|
|
72
58
|
*/
|
|
73
59
|
accessor value: any | undefined;
|
|
74
60
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @required false
|
|
77
|
-
* @default -
|
|
78
|
-
* @description 是否必填项
|
|
79
|
-
* @group basicFormItem
|
|
61
|
+
* 是否必填
|
|
80
62
|
*/
|
|
81
63
|
accessor required: boolean | undefined;
|
|
82
64
|
/**
|
|
83
|
-
*
|
|
84
|
-
* @required false
|
|
85
|
-
* @default -
|
|
86
|
-
* @description 校验文本信息
|
|
87
|
-
* @group basicFormItem
|
|
65
|
+
* 校验文本信息
|
|
88
66
|
*/
|
|
89
67
|
accessor message: Record<string, string> | undefined;
|
|
90
68
|
/**
|
|
91
|
-
*
|
|
92
|
-
* @required false
|
|
93
|
-
* @default false
|
|
94
|
-
* @description 是否禁用
|
|
95
|
-
* @group basic
|
|
69
|
+
* 是否禁用
|
|
96
70
|
*/
|
|
97
71
|
accessor disabled: boolean | undefined;
|
|
98
72
|
/**
|
|
99
|
-
*
|
|
100
|
-
* @
|
|
101
|
-
* @default default
|
|
102
|
-
* @description 单选框样式类型
|
|
103
|
-
* @enums "button"|"default"|"icon"|"icon-circle"|"icon-square"|"custom"
|
|
104
|
-
* @group basic
|
|
73
|
+
* 单选框样式类型
|
|
74
|
+
* @default "default"
|
|
105
75
|
*/
|
|
106
76
|
accessor type: RadioType | undefined;
|
|
107
77
|
/**
|
|
108
|
-
*
|
|
109
|
-
* @
|
|
110
|
-
* @default default
|
|
111
|
-
* @description Ui样式,可选择 `dashboard` 样式,默认`default`
|
|
112
|
-
* @group ui
|
|
78
|
+
* UI样式
|
|
79
|
+
* @default "default"
|
|
113
80
|
*/
|
|
114
81
|
accessor ui: UIType | undefined;
|
|
115
82
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @
|
|
118
|
-
* @default -
|
|
119
|
-
* @description 大小,只对按钮样式生效
|
|
120
|
-
* @enums "large"|"medium"|"small"
|
|
121
|
-
* @group ui
|
|
83
|
+
* 大小,只对按钮样式生效
|
|
84
|
+
* @default "medium"
|
|
122
85
|
*/
|
|
123
|
-
accessor size:
|
|
86
|
+
accessor size: ComponentSize | undefined;
|
|
124
87
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @required false
|
|
127
|
-
* @default -
|
|
128
|
-
* @description 自定义radio的外层样式
|
|
129
|
-
* @group ui
|
|
88
|
+
* 自定义radio的外层样式
|
|
130
89
|
*/
|
|
131
90
|
accessor customStyle: React.CSSProperties | undefined;
|
|
132
91
|
/**
|
|
133
|
-
*
|
|
134
|
-
* @required false
|
|
135
|
-
* @default
|
|
136
|
-
* @description 自定义radio的内容
|
|
137
|
-
* @group advancedFormItem
|
|
92
|
+
* 自定义radio的内容
|
|
138
93
|
*/
|
|
139
94
|
accessor useBrick: UseSingleBrickConf | undefined;
|
|
140
|
-
|
|
141
|
-
|
|
95
|
+
handleChange: (item: {
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
label: string;
|
|
98
|
+
value: any;
|
|
99
|
+
}) => void;
|
|
142
100
|
render(): JSX.Element;
|
|
143
101
|
}
|
|
144
|
-
|
|
102
|
+
interface RadioComponentProps extends RadioProps, FormItemProps {
|
|
103
|
+
onChange?: (value: any) => void;
|
|
104
|
+
optionsChange?: (options: any, name: string) => void;
|
|
105
|
+
}
|
|
106
|
+
export declare function RadioComponent(props: RadioComponentProps): JSX.Element;
|
|
145
107
|
export { Radio };
|