@daracl/form 0.0.17 → 0.0.18

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.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/dist/DaraForm.d.ts +51 -2
  3. package/dist/FieldInfoMap.d.ts +8 -1
  4. package/dist/FormTemplate.d.ts +2 -2
  5. package/dist/constants.d.ts +5 -1
  6. package/dist/daracl.form.css +688 -0
  7. package/dist/daracl.form.min.css +10 -0
  8. package/dist/daracl.form.min.umd.js +171 -0
  9. package/dist/daracl.form.min.umd.js.map +1 -0
  10. package/dist/daracl.form.umd.js +4477 -0
  11. package/dist/daracl.form.umd.js.map +1 -0
  12. package/dist/defaultOption.d.ts +8 -0
  13. package/dist/event/renderEvents.d.ts +1 -1
  14. package/dist/global.d.ts +6 -0
  15. package/dist/index.cjs +1806 -519
  16. package/dist/index.cjs.map +1 -7
  17. package/dist/index.d.ts +7 -2
  18. package/dist/index.html +193 -348
  19. package/dist/index.js +4090 -3101
  20. package/dist/index.js.map +1 -7
  21. package/dist/index.min.cjs +171 -0
  22. package/dist/index.min.cjs.map +1 -0
  23. package/dist/index.min.js +2910 -0
  24. package/dist/index.min.js.map +1 -0
  25. package/dist/index.umd.d.ts +7 -0
  26. package/dist/renderer/ButtonRender.d.ts +2 -2
  27. package/dist/renderer/CheckboxRender.d.ts +2 -2
  28. package/dist/renderer/CustomRender.d.ts +2 -2
  29. package/dist/renderer/DateRender.d.ts +2 -2
  30. package/dist/renderer/DropdownRender.d.ts +2 -2
  31. package/dist/renderer/FileRender.d.ts +2 -2
  32. package/dist/renderer/GridRender.d.ts +2 -2
  33. package/dist/renderer/GroupRender.d.ts +2 -2
  34. package/dist/renderer/HiddenRender.d.ts +2 -2
  35. package/dist/renderer/NumberRender.d.ts +2 -2
  36. package/dist/renderer/PasswordRender.d.ts +2 -2
  37. package/dist/renderer/RadioRender.d.ts +2 -2
  38. package/dist/renderer/RangeRender.d.ts +2 -2
  39. package/dist/renderer/Render.d.ts +2 -2
  40. package/dist/renderer/TabRender.d.ts +2 -2
  41. package/dist/renderer/TextAreaRender.d.ts +2 -2
  42. package/dist/renderer/TextRender.d.ts +2 -2
  43. package/dist/types/FormField.d.ts +18 -13
  44. package/dist/types/FormOptions.d.ts +1 -1
  45. package/dist/types/style.d.ts +3 -0
  46. package/dist/util/renderFactory.d.ts +1 -1
  47. package/dist/util/styleUtils.d.ts +10 -12
  48. package/dist/util/utils.d.ts +1 -1
  49. package/package.json +129 -140
  50. package/style/abstracts/_index.scss +2 -0
  51. package/style/abstracts/_mixins.scss +22 -0
  52. package/style/abstracts/_variables.scss +1 -0
  53. package/style/base/_base.scss +59 -0
  54. package/style/base/_index.scss +1 -0
  55. package/style/components/_button.scss +16 -0
  56. package/style/components/_field-container.scss +41 -0
  57. package/style/components/_field-group.scss +16 -0
  58. package/style/components/_file-list.scss +33 -0
  59. package/style/components/_form-field.scss +47 -0
  60. package/style/components/_form-group.scss +90 -0
  61. package/style/components/_grid-field.scss +121 -0
  62. package/style/components/_icon.scss +16 -0
  63. package/style/components/_index.scss +11 -0
  64. package/style/components/_label.scss +59 -0
  65. package/style/components/_row.scss +88 -0
  66. package/style/components/_tab.scss +70 -0
  67. package/{dist/index.css → style/daracl.form.css} +19 -66
  68. package/style/daracl.form.css.map +1 -0
  69. package/style/daracl.form.min.css +2 -0
  70. package/style/daracl.form.min.css.map +1 -0
  71. package/style/daracl.form.scss +44 -691
  72. package/style/themes/_common.scss +13 -0
  73. package/style/themes/_dark.scss +20 -0
  74. package/style/themes/_index.scss +14 -0
  75. package/style/themes/_light.scss +20 -0
  76. package/style/themes/_mixin.scss +6 -0
  77. package/dist/commonVender.d.ts +0 -1
  78. package/dist/daracl.form.js +0 -5720
  79. package/dist/daracl.form.js.map +0 -1
  80. package/dist/daracl.form.min.js +0 -7
  81. package/dist/daracl.form.min.js.LICENSE.txt +0 -5
  82. package/dist/daracl.form.min.js.map +0 -1
  83. package/dist/daracl.vender.min.css +0 -5
  84. package/dist/daracl.vender.min.js +0 -2
  85. package/dist/daracl.vender.min.js.LICENSE.txt +0 -3
  86. package/dist/index.css.map +0 -7
  87. package/dist/indexVender.d.ts +0 -6
  88. package/dist/main.css +0 -6
  89. package/dist/main.css.map +0 -1
  90. package/src/index.ts +0 -5
  91. /package/dist/util/{Lanauage.d.ts → Language.d.ts} +0 -0
package/README.md CHANGED
@@ -135,7 +135,7 @@ type: {
135
135
  | renderer | custom renderer | | |
136
136
  | conditional | 보이기 여부 조건 | show: 보이기 여부 <br/> field: field name <br> eq: 비교 값 <br> custom: custom 체크 메소드 | |
137
137
  | renderType | render type | text | number, text, file, textarea, dropdown, radio, checkbox, date(dara-datetimepicker모듈 사용), group, custom |
138
- | customOptions | date 타입등의 추가 module에서 사용하는 추가 옵션 | | |
138
+ | rendererOptions | date 타입등의 추가 module에서 사용하는 추가 옵션 | | |
139
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
140
  | rule | 유효성 규칙 | minLength: 최소 길이 <br> maxLength: 최대길이<br> minimum: 최소값 <br> exclusiveMinimum: 최소값 포함 여부 <br> maximum: 최대값 <br>exclusiveMaximum: 최대값 포함여부 | |
141
141
  | different | field 값이 다른지 비교 | field: field name <br> message: 메시지 | |
@@ -2,16 +2,25 @@ import { FormOptions } from "@t/FormOptions";
2
2
  import { FormField } from "@t/FormField";
3
3
  import { ValidResult } from "@t/ValidResult";
4
4
  import { Message } from "@t/Message";
5
- import FieldInfoMap from "src/FieldInfoMap";
5
+ import FieldInfoMap from "@/FieldInfoMap";
6
6
  import FormTemplate from "./FormTemplate";
7
7
  import { FORM_MODE } from "./constants";
8
+ export interface FormChangeEvent {
9
+ form: DaraForm;
10
+ }
11
+ export interface FormChangeListener {
12
+ (event: FormChangeEvent): void;
13
+ }
14
+ export interface Unsubscribe {
15
+ (): void;
16
+ }
8
17
  /**
9
18
  * DaraForm class
10
19
  *
11
20
  * @class DaraForm
12
21
  * @typedef {DaraForm}
13
22
  */
14
- export default class DaraForm {
23
+ export declare class DaraForm {
15
24
  static VERSION: string;
16
25
  private readonly options;
17
26
  private orginFormStyleClass;
@@ -20,9 +29,11 @@ export default class DaraForm {
20
29
  private fieldInfoMap;
21
30
  private formValue;
22
31
  formTemplate: FormTemplate;
32
+ private changeListeners;
23
33
  constructor(formElement: Element, options: FormOptions, message?: Message);
24
34
  static create(formElement: Element, options: FormOptions, message?: Message): DaraForm;
25
35
  static setMessage(message: Message): void;
36
+ static setDefaultOptions(options: FormOptions, message?: Message): void;
26
37
  private createForm;
27
38
  /**
28
39
  * change mode
@@ -81,6 +92,34 @@ export default class DaraForm {
81
92
  * @param {string} fieldName
82
93
  */
83
94
  removeField: (fieldName: string) => void;
95
+ /**
96
+ * 제거할 필드와 같은 fieldInfoMap에 등록된 하위 필드(group 하위 필드, tab 패널) 목록
97
+ * grid 컬럼, tab 패널 내부 필드는 별도 form에 등록되므로 제외됨.
98
+ *
99
+ * @param {FormField} fieldInfo
100
+ * @param {FormField[]} result
101
+ * @returns {FormField[]}
102
+ */
103
+ private getRemoveFields;
104
+ /**
105
+ * field element 제거
106
+ *
107
+ * @param {FormField} fieldInfo
108
+ */
109
+ private removeFieldElement;
110
+ /**
111
+ * 부모 children(최상위는 options.fields)에서 필드 제거
112
+ * tab 은 children 기준으로 값/유효성 체크를 하므로 제거해야 함.
113
+ *
114
+ * @param {FormField} fieldInfo
115
+ */
116
+ private removeParentChildField;
117
+ /**
118
+ * getValue() 시 formValue에 누적된 field 값 제거
119
+ *
120
+ * @param {FormField} fieldInfo
121
+ */
122
+ private removeFormValue;
84
123
  /**
85
124
  * 폼 유효성 검증 여부
86
125
  *
@@ -100,6 +139,16 @@ export default class DaraForm {
100
139
  */
101
140
  getOptions: () => FormOptions;
102
141
  conditionCheck(): void;
142
+ /**
143
+ * 폼 상태(값/보이기 여부 등) 변경을 감지하는 리스너 등록.
144
+ *
145
+ * value/setValue/resetForm/conditional 변경 체크
146
+ *
147
+ * @param listener 상태 변경시 호출되는 콜백
148
+ * @returns 등록 해제 함수
149
+ */
150
+ subscribe: (listener: FormChangeListener) => Unsubscribe;
151
+ private notifyChange;
103
152
  setFieldDisabled(fieldName: string, flag: boolean): void;
104
153
  /**
105
154
  * 설명 추가
@@ -1,6 +1,6 @@
1
1
  import { FormField } from "./types/FormField";
2
2
  import { ValidResult } from "./types/ValidResult";
3
- import DaraForm from "./DaraForm";
3
+ import { DaraForm } from "./DaraForm";
4
4
  interface NumberFieldMap {
5
5
  [key: string]: FormField;
6
6
  }
@@ -57,6 +57,13 @@ export default class FieldInfoMap {
57
57
  * @param {string} fieldName
58
58
  */
59
59
  removeFieldInfo(fieldName: string): void;
60
+ /**
61
+ * 필드 키로 필드 정보 맵에서 지우기
62
+ *
63
+ * @public
64
+ * @param {string} fieldKey
65
+ */
66
+ removeFieldInfoByKey(fieldKey: string): void;
60
67
  /**
61
68
  * 모든 필드값 구하기
62
69
  *
@@ -1,6 +1,6 @@
1
1
  import { FieldStyle, FormField } from "@t/FormField";
2
- import FieldInfoMap from "src/FieldInfoMap";
3
- import DaraForm from "./DaraForm";
2
+ import FieldInfoMap from "@/FieldInfoMap";
3
+ import { DaraForm } from "./DaraForm";
4
4
  /**
5
5
  * form template
6
6
  *
@@ -27,7 +27,11 @@ export type RENDER_TYPE = "number" | "text" | "file" | "textarea" | "dropdown" |
27
27
  export type REGEXP_TYPE = "email" | "url" | "alpha" | "alpha-num";
28
28
  export type PASSWORD_TYPE = "number" | "upper" | "upper-special" | "upper-special-number";
29
29
  export type FIELD_POSITION = "top" | "left" | "left-left" | "left-right" | "right" | "right-left" | "right-right" | "bottom";
30
- export type ORIENTATION_TYPE = "horizontal" | "vertical";
30
+ export declare const OrientationMap: {
31
+ readonly horizontal: "horizontal";
32
+ readonly vertical: "vertical";
33
+ };
34
+ export type OrientationType = (typeof OrientationMap)[keyof typeof OrientationMap];
31
35
  interface StringArrayMap {
32
36
  [key: string]: string[];
33
37
  }