@daracl/form 0.0.1
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/LICENSE +21 -0
- package/README.md +146 -0
- package/dist/DaraForm.d.ts +129 -0
- package/dist/FieldInfoMap.d.ts +97 -0
- package/dist/FormTemplate.d.ts +60 -0
- package/dist/constants.d.ts +35 -0
- package/dist/daracl.form.js +7629 -0
- package/dist/daracl.form.js.map +1 -0
- package/dist/daracl.form.min.css +6 -0
- package/dist/daracl.form.min.css.map +1 -0
- package/dist/daracl.form.min.js +7 -0
- package/dist/daracl.form.min.js.LICENSE.txt +5 -0
- package/dist/daracl.form.min.js.map +1 -0
- package/dist/event/renderEvents.d.ts +6 -0
- package/dist/index.cjs +4540 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.css +1074 -0
- package/dist/index.css.map +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.html +591 -0
- package/dist/index.js +4852 -0
- package/dist/index.js.map +7 -0
- package/dist/renderer/ButtonRender.d.ts +14 -0
- package/dist/renderer/CheckboxRender.d.ts +18 -0
- package/dist/renderer/CustomRender.d.ts +19 -0
- package/dist/renderer/DateRender.d.ts +15 -0
- package/dist/renderer/DropdownRender.d.ts +17 -0
- package/dist/renderer/FileRender.d.ts +38 -0
- package/dist/renderer/GridRender.d.ts +35 -0
- package/dist/renderer/GroupRender.d.ts +16 -0
- package/dist/renderer/HiddenRender.d.ts +13 -0
- package/dist/renderer/NumberRender.d.ts +14 -0
- package/dist/renderer/PasswordRender.d.ts +14 -0
- package/dist/renderer/RadioRender.d.ts +18 -0
- package/dist/renderer/RangeRender.d.ts +15 -0
- package/dist/renderer/Render.d.ts +43 -0
- package/dist/renderer/TabRender.d.ts +34 -0
- package/dist/renderer/TextAreaRender.d.ts +14 -0
- package/dist/renderer/TextRender.d.ts +14 -0
- package/dist/rule/fileValidator.d.ts +11 -0
- package/dist/rule/numberValidator.d.ts +10 -0
- package/dist/rule/regexpValidator.d.ts +11 -0
- package/dist/rule/stringValidator.d.ts +10 -0
- package/dist/rule/validator.d.ts +11 -0
- package/dist/types/DataMap.d.ts +17 -0
- package/dist/types/FormField.d.ts +129 -0
- package/dist/types/FormOptions.d.ts +91 -0
- package/dist/types/Message.d.ts +40 -0
- package/dist/types/ValidResult.d.ts +9 -0
- package/dist/util/Lanauage.d.ts +38 -0
- package/dist/util/renderFactory.d.ts +3 -0
- package/dist/util/styleUtils.d.ts +14 -0
- package/dist/util/utils.d.ts +62 -0
- package/dist/util/validUtils.d.ts +9 -0
- package/package.json +137 -0
- package/src/index.ts +7 -0
- package/style/daracl.form.scss +690 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-current The Darainfo Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# DaraForm
|
|
2
|
+
JavaScript form creation library
|
|
3
|
+
|
|
4
|
+
[](https://github.com/darainfo/daracl.form/blob/main/LICENSE)
|
|
5
|
+
[](https://badge.fury.io/js/@daracl%2Fform)
|
|
6
|
+
[](https://github.com/darainfo/daracl.form/releases)
|
|
7
|
+
[](https://bundlephobia.com/package/@daracl%2Fform)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Browser Support
|
|
12
|
+
|
|
13
|
+
 |  |  |  | 
|
|
14
|
+
--- | --- | --- | --- | --- |
|
|
15
|
+
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<p>
|
|
19
|
+
<img src="https://github.com/darainfo/daracl.form/blob/main/demo.gif?raw=true"/>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
1. Install
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
yarn install
|
|
27
|
+
# OR
|
|
28
|
+
npm install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
2. Run
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm start
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
3. Open `http://localhost:8889` in your browser
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# 사용방법
|
|
41
|
+
```
|
|
42
|
+
const form = new DaraForm("#loginForm", {
|
|
43
|
+
message: "This value is not valid",
|
|
44
|
+
style: {
|
|
45
|
+
position: 'top-left',
|
|
46
|
+
labelWidth: '3'
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
// form load 이후 호출.
|
|
50
|
+
onMounted: function () {
|
|
51
|
+
console.log(this)
|
|
52
|
+
},
|
|
53
|
+
message: {
|
|
54
|
+
empty: "{name} 필수 입력사항입니다.",
|
|
55
|
+
string: {
|
|
56
|
+
minLength: "{size} 글자 이상 입력해야합니다.",
|
|
57
|
+
maxLength: "{size} 글자 이상 입력할 수 없습니다.",
|
|
58
|
+
},
|
|
59
|
+
number: {
|
|
60
|
+
minimum: "{size} 보다 커야 합니다",
|
|
61
|
+
miximum: "{size} 보다 커야 합니다",
|
|
62
|
+
},
|
|
63
|
+
regexp: {
|
|
64
|
+
email: "이메일이 유효하지 않습니다.",
|
|
65
|
+
url: "URL이 유효하지 않습니다.",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
fields: [
|
|
69
|
+
{
|
|
70
|
+
name: "uid",
|
|
71
|
+
label: "아이디",
|
|
72
|
+
tooltip: "아이디를 넣어주세요.",
|
|
73
|
+
placeholder: "아이디를 넣어주세요.",
|
|
74
|
+
renderType: "text",
|
|
75
|
+
}
|
|
76
|
+
, {
|
|
77
|
+
name: "password",
|
|
78
|
+
label: "패스워드",
|
|
79
|
+
description: "비밀번호는 대문자 소문자 포함입니다.",
|
|
80
|
+
placeholder: "패스워드를 입력하세요",
|
|
81
|
+
renderType: "password",
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# Form 옵션
|
|
89
|
+
| key | 설명 | 기본값 | 옵션값 |
|
|
90
|
+
|-----|------|-----|-----|
|
|
91
|
+
| style | width: form 넓이<br> labelWidth : label 넓이 <br> valueWidth : value width<br> position : '"[label위치]"-[글자 정렬위치]' <br> -- ex) 'top-left','left-right' | width: "100%" <br> labelWidth: 3<br> valueWidth: 9<br> position: "left-right" | position : top,left,right - left,center,right |
|
|
92
|
+
| autoFocus | 포커스 여부 | true | true , false |
|
|
93
|
+
| notValidMessage | 폼 유효하지 않을때 메시지 | 'This value is not valid' | |
|
|
94
|
+
| onMounted | 폼 로드후 이벤트 | | |
|
|
95
|
+
| fields | 폼필드 [설명](#field-option) | | |
|
|
96
|
+
| message | 폼 유효성 체크 메시지 [설명](#form-message) | |
|
|
97
|
+
| useTypeValue | form에 값을 renderer type별로 값을 구 할지 여부. renderType tab 값을 구할때 영향이 있음 | |
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# Form message
|
|
101
|
+
```javascript
|
|
102
|
+
required: '{name} 필수 입력사항입니다.'
|
|
103
|
+
string: {
|
|
104
|
+
minLength: '{size} 글자 이상 입력해야합니다.'
|
|
105
|
+
maxLength: '{size} 글자 이상 입력할 수 없습니다.'
|
|
106
|
+
};
|
|
107
|
+
number: {
|
|
108
|
+
min: '{size} 보다 커야 합니다'
|
|
109
|
+
max: '{size} 보다 커야 합니다'
|
|
110
|
+
};
|
|
111
|
+
type: {
|
|
112
|
+
message: '{type} 유효하지 않습니다.'
|
|
113
|
+
};
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
# Field Option
|
|
117
|
+
| key | 설명 | 기본값 | 옵션값 |
|
|
118
|
+
|-----|------|-----|-----|
|
|
119
|
+
| name | field name | | |
|
|
120
|
+
| label | label | | |
|
|
121
|
+
| tooltip | 툴팁문구 | | |
|
|
122
|
+
| disabled | 비활성화 여부 | | |
|
|
123
|
+
| placeholder | placeholder | | |
|
|
124
|
+
| orientation | 차식 field 가 있을경우 방향 | vertical | horizontal, vertical |
|
|
125
|
+
| required | 필수 여부 | | |
|
|
126
|
+
| regexpType | 정규식 타입 | | email, url, alpha, alpha-num |
|
|
127
|
+
| template | custom value 템플릿 | | |
|
|
128
|
+
| listItem | dropdown, radio, checkbox 옵션값 | | |
|
|
129
|
+
| description | 설명 | labelField: label key <br> valueField: value key<br> list: 옵션 리스트<br>
|
|
130
|
+
orientation: 방향 | |
|
|
131
|
+
| children | 자식 field 리스트 | | |
|
|
132
|
+
| onChange | 입력값 변경시 호출되는 메소드 | | |
|
|
133
|
+
| onClick | button 타입 클릭 이벤트 | | |
|
|
134
|
+
| fileDownload | file 타입일경우 다운로드 메소드 | | |
|
|
135
|
+
| renderer | custom renderer | | |
|
|
136
|
+
| conditional | 보이기 여부 조건 | show: 보이기 여부 <br/> field: field name <br> eq: 비교 값 <br> custom: custom 체크 메소드 | |
|
|
137
|
+
| renderType | render type | text | number, text, file, textarea, dropdown, radio, checkbox, date(dara-datetimepicker모듈 사용), group, custom |
|
|
138
|
+
| customOptions | date 타입등의 추가 module에서 사용하는 추가 옵션 | | |
|
|
139
|
+
| style | width: field 넓이<br> labelHide : label 숨김여부 <br> labelWidth : label 넓이<br> customClass : custom class <br> valueWidth : value width <br> tabAlign : render type이 tab일 경우 정렬 <br> position : '"[label위치]"-[글자 정렬위치]' <br> -- ex) 'top-left','left-right' | width: "100%" <br> labelWidth: 3<br> valueWidth: 9<br> position: "left-right" | position : top,left,right - left,center,right <br> tabAlign:left, center, right|
|
|
140
|
+
| rule | 유효성 규칙 | minLength: 최소 길이 <br> maxLength: 최대길이<br> minimum: 최소값 <br> exclusiveMinimum: 최소값 포함 여부 <br> maximum: 최대값 <br>exclusiveMaximum: 최대값 포함여부 | |
|
|
141
|
+
| different | field 값이 다른지 비교 | field: field name <br> message: 메시지 | |
|
|
142
|
+
| identical | field 값이 같은지 비교 | field: field name <br> message: 메시지 | |
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
Darainfo is under [MIT License](./LICENSE).
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { FormOptions } from "@t/FormOptions";
|
|
2
|
+
import { FormField } from "@t/FormField";
|
|
3
|
+
import { ValidResult } from "@t/ValidResult";
|
|
4
|
+
import { Message } from "@t/Message";
|
|
5
|
+
import FieldInfoMap from "src/FieldInfoMap";
|
|
6
|
+
import FormTemplate from "./FormTemplate";
|
|
7
|
+
import { FORM_MODE } from "./constants";
|
|
8
|
+
/**
|
|
9
|
+
* DaraForm class
|
|
10
|
+
*
|
|
11
|
+
* @class DaraForm
|
|
12
|
+
* @typedef {DaraForm}
|
|
13
|
+
*/
|
|
14
|
+
export default class DaraForm {
|
|
15
|
+
static VERSION: string;
|
|
16
|
+
private readonly options;
|
|
17
|
+
private orginFormStyleClass;
|
|
18
|
+
private selector;
|
|
19
|
+
private formElement;
|
|
20
|
+
private fieldInfoMap;
|
|
21
|
+
private formValue;
|
|
22
|
+
formTemplate: FormTemplate;
|
|
23
|
+
constructor(formElement: Element, options: FormOptions, message?: Message);
|
|
24
|
+
static create(formElement: Element, options: FormOptions, message?: Message): DaraForm;
|
|
25
|
+
static setMessage(message: Message): void;
|
|
26
|
+
private createForm;
|
|
27
|
+
/**
|
|
28
|
+
* change mode
|
|
29
|
+
*
|
|
30
|
+
* @param mode form_mode default new
|
|
31
|
+
*/
|
|
32
|
+
changeMode: (mode: FORM_MODE) => void;
|
|
33
|
+
/**
|
|
34
|
+
* 폼 데이터 reset
|
|
35
|
+
*/
|
|
36
|
+
resetForm: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* field 값 reset
|
|
39
|
+
* @param fieldName 필드명
|
|
40
|
+
*/
|
|
41
|
+
resetField: (fieldName: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* 필드 element 얻기
|
|
44
|
+
*
|
|
45
|
+
* @param {string} fieldName
|
|
46
|
+
* @returns {*}
|
|
47
|
+
*/
|
|
48
|
+
getFieldElement(fieldName: string): any;
|
|
49
|
+
getField(fieldName: string): FormField;
|
|
50
|
+
/**
|
|
51
|
+
* field 값 얻기
|
|
52
|
+
*
|
|
53
|
+
* @param fieldName 필드명
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
getFieldValue: (fieldName: string) => any;
|
|
57
|
+
/**
|
|
58
|
+
* 폼 필드 값 얻기
|
|
59
|
+
* @param isValid 폼 유효성 검사 여부 default:false|undefined true일경우 검사.
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
getValue: (isValid: boolean) => any;
|
|
63
|
+
getFormDataValue: (isValid: boolean) => any;
|
|
64
|
+
/**
|
|
65
|
+
* 폼 필드 value 셋팅
|
|
66
|
+
* @param values
|
|
67
|
+
*/
|
|
68
|
+
setValue: (values: any, dataClear?: boolean | undefined) => void;
|
|
69
|
+
setFieldValue: (fieldName: string, value: any) => void;
|
|
70
|
+
private _setFieldValue;
|
|
71
|
+
setFieldItems: (fieldName: string, values: any) => void;
|
|
72
|
+
/**
|
|
73
|
+
* field 추가
|
|
74
|
+
*
|
|
75
|
+
* @param {FormField} field
|
|
76
|
+
*/
|
|
77
|
+
addField: (field: FormField) => void;
|
|
78
|
+
/**
|
|
79
|
+
* field 제거
|
|
80
|
+
*
|
|
81
|
+
* @param {string} fieldName
|
|
82
|
+
*/
|
|
83
|
+
removeField: (fieldName: string) => void;
|
|
84
|
+
/**
|
|
85
|
+
* 폼 유효성 검증 여부
|
|
86
|
+
*
|
|
87
|
+
* @returns {boolean}
|
|
88
|
+
*/
|
|
89
|
+
isValidForm: () => boolean;
|
|
90
|
+
/**
|
|
91
|
+
* 유효성 검증 폼 검증여부 리턴
|
|
92
|
+
*
|
|
93
|
+
* @returns {any[]}
|
|
94
|
+
*/
|
|
95
|
+
validForm: () => any[];
|
|
96
|
+
private validTabCheck;
|
|
97
|
+
isValidField: (fieldName: string) => boolean;
|
|
98
|
+
/**
|
|
99
|
+
* 설정 옵션 얻기
|
|
100
|
+
*/
|
|
101
|
+
getOptions: () => FormOptions;
|
|
102
|
+
conditionCheck(): void;
|
|
103
|
+
setFieldDisabled(fieldName: string, flag: boolean): void;
|
|
104
|
+
/**
|
|
105
|
+
* 설명 추가
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @param {string} fieldName
|
|
109
|
+
* @param {string} desc
|
|
110
|
+
*/
|
|
111
|
+
setFieldDescription(fieldName: string, desc: string): void;
|
|
112
|
+
destroy: () => void;
|
|
113
|
+
static validator: {
|
|
114
|
+
string: (value: string, field: FormField) => boolean | ValidResult;
|
|
115
|
+
number: (value: string, field: FormField) => boolean | ValidResult;
|
|
116
|
+
regexp: (value: string, field: FormField) => ValidResult;
|
|
117
|
+
};
|
|
118
|
+
static instance(ele: Element | String): DaraForm | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* 모든 field 얻기
|
|
121
|
+
*/
|
|
122
|
+
getFields: () => any[];
|
|
123
|
+
/**
|
|
124
|
+
* field setting
|
|
125
|
+
* @param fields
|
|
126
|
+
*/
|
|
127
|
+
setFields: (fields: any[]) => void;
|
|
128
|
+
getFieldInfoMap(): FieldInfoMap;
|
|
129
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { FormField } from "./types/FormField";
|
|
2
|
+
import { ValidResult } from "./types/ValidResult";
|
|
3
|
+
import DaraForm from "./DaraForm";
|
|
4
|
+
interface NumberFieldMap {
|
|
5
|
+
[key: string]: FormField;
|
|
6
|
+
}
|
|
7
|
+
export default class FieldInfoMap {
|
|
8
|
+
private fieldIdx;
|
|
9
|
+
private allFieldInfo;
|
|
10
|
+
private keyNameMap;
|
|
11
|
+
private conditionFields;
|
|
12
|
+
private fieldPrefix;
|
|
13
|
+
private form;
|
|
14
|
+
constructor(selector: string, form: DaraForm);
|
|
15
|
+
/**
|
|
16
|
+
* add Field 정보
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @param {FormField} field 폼필드 정보
|
|
20
|
+
*/
|
|
21
|
+
addField(field: FormField): void;
|
|
22
|
+
/**
|
|
23
|
+
* 필드명으로 필드 정부 구하기
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
* @param {string} fieldName 필드명
|
|
27
|
+
* @returns {FormField}
|
|
28
|
+
*/
|
|
29
|
+
getFieldName(fieldName: string): FormField;
|
|
30
|
+
/**
|
|
31
|
+
* 필드 키로 정보 구하기
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
* @param {string} fieldKey
|
|
35
|
+
* @returns {FormField}
|
|
36
|
+
*/
|
|
37
|
+
get(fieldKey: string): FormField;
|
|
38
|
+
/**
|
|
39
|
+
* 필드명 있는지 여부 체크.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @param {string} fieldName 필드명
|
|
43
|
+
* @returns {boolean}
|
|
44
|
+
*/
|
|
45
|
+
hasFieldName(fieldName: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 모든 필드 정보
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
* @returns {NumberFieldMap}
|
|
51
|
+
*/
|
|
52
|
+
getAllFieldInfo(): NumberFieldMap;
|
|
53
|
+
/**
|
|
54
|
+
* 필드 정보 맵에서 지우기
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @param {string} fieldName
|
|
58
|
+
*/
|
|
59
|
+
removeFieldInfo(fieldName: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* 모든 필드값 구하기
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
* @param {boolean} validationCheck
|
|
65
|
+
* @returns {*}
|
|
66
|
+
*/
|
|
67
|
+
getAllFieldValue(formValue: any, validationCheck: boolean): any;
|
|
68
|
+
getFormDataValue(formValue: any, validationCheck: boolean): Promise<unknown> | FormData;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
*
|
|
72
|
+
* @param field
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
isConditionFieldCheck(field: FormField): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* field 활성 비활성화 여부.
|
|
78
|
+
*
|
|
79
|
+
* @param field form field
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
isConditionField(field: FormField): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* 컬럼 로우 보이고 안보이기 체크.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
conditionCheck(): void;
|
|
89
|
+
/**
|
|
90
|
+
* field validation check
|
|
91
|
+
*
|
|
92
|
+
* @param fieldInfo FormField
|
|
93
|
+
* @returns boolean true or ValidResult
|
|
94
|
+
*/
|
|
95
|
+
getFieldValidation(fieldInfo: FormField, focusFlag: boolean | undefined): true | ValidResult;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { FieldStyle, FormField } from "@t/FormField";
|
|
2
|
+
import FieldInfoMap from "src/FieldInfoMap";
|
|
3
|
+
import DaraForm from "./DaraForm";
|
|
4
|
+
/**
|
|
5
|
+
* form template
|
|
6
|
+
*
|
|
7
|
+
* @class FormTemplate
|
|
8
|
+
* @typedef {FormTemplate}
|
|
9
|
+
*/
|
|
10
|
+
export default class FormTemplate {
|
|
11
|
+
private readonly options;
|
|
12
|
+
private readonly formElement;
|
|
13
|
+
private fieldInfoMap;
|
|
14
|
+
private daraform;
|
|
15
|
+
private addRowFields;
|
|
16
|
+
constructor(daraform: DaraForm, formElement: Element, fieldInfoMap: FieldInfoMap);
|
|
17
|
+
/**
|
|
18
|
+
* field row 추가.
|
|
19
|
+
*
|
|
20
|
+
* @param field
|
|
21
|
+
*/
|
|
22
|
+
addRow(field: FormField): void;
|
|
23
|
+
/**
|
|
24
|
+
* 그룹 템플릿
|
|
25
|
+
*
|
|
26
|
+
* @param {FormField} field
|
|
27
|
+
* @returns {string} row template
|
|
28
|
+
*/
|
|
29
|
+
addRowTemplate(field: FormField): void;
|
|
30
|
+
createField(field: FormField, element: Element): void;
|
|
31
|
+
/**
|
|
32
|
+
* child template
|
|
33
|
+
*
|
|
34
|
+
* @param {FormField} field
|
|
35
|
+
* @param {FieldStyle} parentFieldStyle
|
|
36
|
+
* @returns {*}
|
|
37
|
+
*/
|
|
38
|
+
childTemplate(field: FormField, parentFieldStyle: FieldStyle): void;
|
|
39
|
+
/**
|
|
40
|
+
* label template
|
|
41
|
+
*
|
|
42
|
+
* @param {FormField} field form field
|
|
43
|
+
* @returns {string} template string
|
|
44
|
+
*/
|
|
45
|
+
getLabelTemplate(field: FormField): string;
|
|
46
|
+
/**
|
|
47
|
+
* label 숨김 여부
|
|
48
|
+
*
|
|
49
|
+
* @param field formfield
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
isLabelHide(field: FormField): boolean;
|
|
53
|
+
checkHiddenField(field: FormField): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* add row file map
|
|
56
|
+
*
|
|
57
|
+
* @param {FormField} field
|
|
58
|
+
*/
|
|
59
|
+
addRowFieldInfo(field: FormField): void;
|
|
60
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type FORM_MODE = "new" | "modify" | "view";
|
|
2
|
+
export declare const RULES: {
|
|
3
|
+
readonly NAN: "nan";
|
|
4
|
+
readonly MIN: "minimum";
|
|
5
|
+
readonly EXCLUSIVE_MIN: "exclusiveMinimum";
|
|
6
|
+
readonly MAX: "maximum";
|
|
7
|
+
readonly EXCLUSIVE_MAX: "exclusiveMaximum";
|
|
8
|
+
readonly MIN_LENGTH: "minLength";
|
|
9
|
+
readonly MAX_LENGTH: "maxLength";
|
|
10
|
+
readonly BETWEEN: "between";
|
|
11
|
+
readonly BETWEEN_EXCLUSIVE_MIN: "betweenExclusiveMin";
|
|
12
|
+
readonly BETWEEN_EXCLUSIVE_MAX: "betweenExclusiveMax";
|
|
13
|
+
readonly BETWEEN_EXCLUSIVE_MINMAX: "betweenExclusiveMinMax";
|
|
14
|
+
readonly REGEXP: "regexp";
|
|
15
|
+
readonly REQUIRED: "required";
|
|
16
|
+
readonly VALIDATOR: "validator";
|
|
17
|
+
};
|
|
18
|
+
export declare const FIELD_PREFIX = "dff";
|
|
19
|
+
export declare const RENDER_TEMPLATE: any;
|
|
20
|
+
export declare const ALIGN: {
|
|
21
|
+
readonly left: "left";
|
|
22
|
+
readonly center: "center";
|
|
23
|
+
readonly right: "right";
|
|
24
|
+
};
|
|
25
|
+
export type TEXT_ALIGN_TYPE = (typeof ALIGN)[keyof typeof ALIGN];
|
|
26
|
+
export type RENDER_TYPE = "number" | "text" | "file" | "textarea" | "dropdown" | "radio" | "checkbox" | "date" | "datetime" | "dateyear" | "datemonth" | "datehour" | "group" | "custom";
|
|
27
|
+
export type REGEXP_TYPE = "email" | "url" | "alpha" | "alpha-num";
|
|
28
|
+
export type PASSWORD_TYPE = "number" | "upper" | "upper-special" | "upper-special-number";
|
|
29
|
+
export type FIELD_POSITION = "top" | "left" | "left-left" | "left-right" | "right" | "right-left" | "right-right" | "bottom";
|
|
30
|
+
export type ORIENTATION_TYPE = "horizontal" | "vertical";
|
|
31
|
+
interface StringArrayMap {
|
|
32
|
+
[key: string]: string[];
|
|
33
|
+
}
|
|
34
|
+
export declare const FIELD_POSITION_STYLE: StringArrayMap;
|
|
35
|
+
export {};
|