@mosip/json-form-builder 0.1.0 → 0.1.1-beta.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/README.md CHANGED
@@ -28,33 +28,113 @@ import { JsonFormBuilder } from "@mosip/json-form-builder";
28
28
  const config = {
29
29
  schema: [
30
30
  {
31
- id: "name",
32
- controlType: "textbox",
31
+ id: "sampleInputId",
32
+ required: true,
33
+ type: "string",
33
34
  labelName: {
34
- eng: "Name",
35
- fra: "Nom",
35
+ eng: "Sample Field",
36
+ ara: "حقل تجريبي",
37
+ fra: "Champ d'exemple",
36
38
  },
37
39
  placeholder: {
38
- eng: "Enter your name",
39
- fra: "Entrez votre nom"
40
+ eng: "Enter value",
41
+ ara: "أدخل القيمة",
42
+ fra: "Entrez la valeur",
43
+ },
44
+ info: {
45
+ eng: "You have to input some text in this field",
46
+ ara: "عليك إدخال بعض النصوص في هذا الحقل",
47
+ fra: "Vous devez saisir du texte dans ce champ",
40
48
  },
41
49
  capsLockCheck: true,
42
- validator: [
50
+ cssClasses: "sample-input-field",
51
+ controlType: "textbox",
52
+ validators: [
43
53
  {
44
- regex: "^[a-zA-Z]{4,35}$",
54
+ regex: "^[a-zA-Z0-9]+$",
55
+ langCode: null,
45
56
  error: {
46
- eng: "Name should contain letters and must be of length between 4 to 35",
47
- fra: "Le nom doit contenir des lettres et doit avoir une longueur comprise entre 4 et 35"
48
- }
49
- }
57
+ eng: "Special characters are not allowed",
58
+ ara: "لا يُسمح باستخدام الأحرف الخاصة",
59
+ fra: "Les caractères spéciaux ne sont pas autorisés",
60
+ },
61
+ },
50
62
  ],
63
+ alignmentGroup: "group1",
64
+ },
65
+ {
66
+ id: "gender",
67
+ controlType: "dropdown",
68
+ labelName: {
69
+ eng: "Gender",
70
+ fra: "Genre",
71
+ ara: "جنس",
72
+ },
73
+ required: false,
74
+ alignmentGroup: "group2",
75
+ },
76
+ {
77
+ id: "samplePhone",
78
+ controlType: "phone",
79
+ disabled: true,
80
+ required: false,
81
+ prefix: ["+91"],
82
+ labelName: {
83
+ eng: "Phone Number",
84
+ ara: "رقم الهاتف",
85
+ fra: "Numéro de téléphone",
86
+ },
87
+ placeholder: {
88
+ eng: "Enter your phone number",
89
+ ara: "أدخل رقم هاتفك",
90
+ fra: "Entrez votre numéro de téléphone",
91
+ },
92
+ },
93
+ {
94
+ id: "password",
95
+ controlType: "password",
96
+ labelName: {
97
+ eng: "Password",
98
+ ara: "كلمة المرور",
99
+ fra: "Mot de passe",
100
+ },
101
+ placeholder: {
102
+ eng: "Enter your password",
103
+ ara: "أدخل كلمة المرور الخاصة بك",
104
+ fra: "Entrez votre mot de passe",
105
+ },
51
106
  info: {
52
- eng: "Your name should contain letters only and should be of length between 4 to 35",
53
- fra: "Votre nom doit contenir uniquement des lettres et doit avoir une longueur comprise entre 4 et 35"
54
- }
107
+ eng: "Use 8 or more characters with a mix of letters and at least one number.",
108
+ ara: "استخدم 8 أحرف أو أكثر بمزيج من الحروف ورقم واحد على الأقل.",
109
+ fra: "Utilisez 8 caractères ou plus avec un mélange de lettres et au moins un chiffre.",
110
+ },
111
+ required: true,
112
+ alignmentGroup: "group3",
113
+ },
114
+ {
115
+ id: "dob",
116
+ controlType: "date",
117
+ labelName: {
118
+ eng: "Date of Birth",
119
+ ara: "تاريخ الميلاد",
120
+ fra: "Date de naissance",
121
+ },
122
+ minAge: 2,
123
+ maxAge: 3,
124
+ alignmentGroup: "group4",
125
+ required: true,
126
+ },
127
+ {
128
+ id: "consent",
129
+ controlType: "checkbox",
130
+ labelName: {
131
+ eng: "I agree to the <b><a href='#'>Terms & Conditions</a></b> and <b><a href='#'>Privacy Policy</a></b>.",
132
+ ara: "أوافق على <b><a href='#'>الشروط والأحكام</a></b> و<b><a href='#'>سياسة الخصوصية</a></b>.",
133
+ fra: "J'accepte les <b><a href='#'>conditions générales</a></b> et la <b><a href='#'>politique de confidentialité</a></b>.",
134
+ },
55
135
  required: true,
136
+ alignmentGroup: "group5",
56
137
  },
57
- // ... more fields
58
138
  ],
59
139
  i18nValues: {
60
140
  errors: {
@@ -70,10 +150,11 @@ const config = {
70
150
  },
71
151
  language: {
72
152
  mandatory: ["eng"],
73
- optional: ["fra"],
153
+ optional: ["fra", "ara"],
74
154
  langCodeMap: {
75
155
  eng: "en",
76
156
  fra: "fr",
157
+ ara: "ar",
77
158
  },
78
159
  },
79
160
  };
@@ -298,7 +379,6 @@ The form builder comes with default styles but can be customized using CSS. The
298
379
  - `.caps-lock-icon`: Caps lock icon
299
380
  - `.caps-lock-text`: Caps lock text
300
381
 
301
-
302
382
  ## Browser Support
303
383
 
304
384
  - Chrome (latest)
@@ -337,20 +417,21 @@ This will generate:
337
417
  - TypeScript declaration files
338
418
 
339
419
  ### Development with an actual Application
420
+
340
421
  #### This should be used only in local for development purpose only
341
422
 
342
423
  1. First link the current `json-form-builder` library, with below command
343
- ```bash
344
- npm link
345
- ```
424
+ ```bash
425
+ npm link
426
+ ```
346
427
  2. Now go to the application, where you want to use `json-form-builder` library, and run the below command
347
428
  ```bash
348
429
  npm link @mosip/json-form-builder
349
430
  ```
350
431
  3. This will create a link between the library and application, after that if any changes has been done in the library, just run the below command and it will reflect in the application as well
351
- ```bash
352
- npm run build
353
- ```
432
+ ```bash
433
+ npm run build
434
+ ```
354
435
 
355
436
  ### Development Mode
356
437