Richard Knight преди 6 години
родител
ревизия
9cc0b646ce
променени са 4 файла, в които са добавени 43 реда и са изтрити 5 реда
  1. 37 0
      src/app/_mock/testfields.v14.ts
  2. 2 2
      src/app/app.component.html
  3. 3 2
      src/app/app.component.ts
  4. 1 1
      src/app/dynaform/dynaform.component.ts

+ 37 - 0
src/app/_mock/testfields.v14.ts

@@ -0,0 +1,37 @@
+// TESTS: Repeating Groups Of Fields in Single Mode ( 1 -> N arrays of containers for multiple fields )
+
+const model = {
+	repeating: [
+		{
+			a: 1,
+			b: 2,
+		},
+		{
+			a: 3,
+			b: 4,
+		}
+	],
+	standard: 'YABBA DABBA DOOOOOO'
+};
+
+const meta = {
+	repeating: {
+		label: 'Repeating Group',
+		seed: { class: 'short-field' },
+		minRepeat: 1,
+		maxRepeat: 5,
+		initialRepeat: 3,
+		showAddControl: true,
+		showDeleteControl: true,
+		display: 'ALL', // ALL or SINGLE,
+		primaryField: 'a',
+		meta: [
+			{
+				a: { label: 'Field A' },
+				b: { label: 'Field B', type: 'select', options: [1, 2, 3, 4, 5] }
+			}
+		]
+	}
+};
+
+export { model, meta };

+ 2 - 2
src/app/app.component.html

@@ -4,7 +4,7 @@
 			<h1>NgDynaform</h1>
 			<p>
 			Dynamic Form Layout Module<br>
-			Load different tests by appending a query param to the URL <b>?test=N</b> (where N is a number between 1 and 13).<br>
+			Load different tests by appending a query param to the URL <b>?test=N</b> (where N is a number between 1 and 14).<br>
 			NOTE: Model set to update on change, but this can be set to blur or submit for less re-rendering.
 			</p>
 		</div>
@@ -39,7 +39,7 @@
 			<ng-container dynafield [control]="control" [meta]="meta" (call)="handleCallback($event)"></ng-container>
 		</div>
 	</div>
-	
+
 	<ng-template #recursiveDynaform>
 		<div class="row pt-3">
 			<h3 class="col-sm-12" [ngClass]="'h-dyna-' + (path.length + 2)">{{ meta.label }}</h3>

+ 3 - 2
src/app/app.component.ts

@@ -15,10 +15,11 @@ import * as test10 from './_mock/testfields.v10';
 import * as test11 from './_mock/testfields.v11';
 import * as test12 from './_mock/testfields.v12';
 import * as test13 from './_mock/testfields.v13';
+import * as test14 from './_mock/testfields.v14';
 
-const testdata = [ test1, test2, test3, test4, test5, test6, test7, test8, test9, test10, test11, test12, test13 ];
+const testdata = [ test1, test2, test3, test4, test5, test6, test7, test8, test9, test10, test11, test12, test13, test14 ];
 
-const defatltTest = 13;
+const defatltTest = 14;
 
 @Component({
 	selector: 'app-root',

+ 1 - 1
src/app/dynaform/dynaform.component.ts

@@ -248,7 +248,7 @@ export class DynaformComponent implements OnInit {
 	private getContolKeysCSVFromMetadata(metadata): string {
 		// Return CSV of control keys in current nesting-level's metadata,
 		// excluding metadata points that don't create FormControls, FromGroups or FormArrays
-		// (identified by their 'noFormControsl' flag)
+		// (identified by their 'noFormControl' flag)
 		// e.g. ButtonGroups, HTMLChunks, etc.
 		return Object.entries(metadata)
 				.filter(([key, val]) => !(val as StringMap<any>).noFormControls)