Browse Source

Add Container Class override ability on extensible-form-prop.component

pull/13839/head
Mahmut Gundogdu 4 years ago
parent
commit
4e2150ea1c
  1. 2
      npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-form/extensible-form-prop.component.html
  2. 7
      npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-form/extensible-form-prop.component.ts
  3. 2
      npm/ng-packs/packages/theme-shared/extensions/src/lib/models/form-props.ts

2
npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-form/extensible-form-prop.component.html

@ -1,5 +1,5 @@
<div
class="mb-3 form-group"
[ngClass]="containerClassName"
*abpPermission="prop.permission; runChangeDetection: false"
[ngSwitch]="getComponent(prop)"
>

7
npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-form/extensible-form-prop.component.ts

@ -55,6 +55,8 @@ export class ExtensibleFormPropComponent implements OnChanges, AfterViewInit {
@ViewChild('field') private fieldRef!: ElementRef<HTMLElement>;
asterisk = '';
containerClassName = 'mb-3 form-group'
options$: Observable<ABP.Option<any>[]> = of([]);
@ -175,7 +177,7 @@ export class ExtensibleFormPropComponent implements OnChanges, AfterViewInit {
ngOnChanges({ prop }: SimpleChanges) {
const currentProp = prop?.currentValue;
const { options, readonly, disabled, validators } = currentProp || {};
const { options, readonly, disabled, validators , className } = currentProp || {};
if (options) this.options$ = options(this.data);
if (readonly) this.readonly = readonly(this.data);
@ -187,6 +189,9 @@ export class ExtensibleFormPropComponent implements OnChanges, AfterViewInit {
this.validators = validators(this.data);
this.setAsterisk();
}
if(className !== undefined){
this.containerClassName = className;
}
const [keyControl, valueControl] = this.getTypeaheadControls();
if (keyControl && valueControl)

2
npm/ng-packs/packages/theme-shared/extensions/src/lib/models/form-props.ts

@ -67,6 +67,7 @@ export class FormProp<R = any> extends Prop<R> {
readonly options: PropCallback<R, Observable<ABP.Option<any>[]>> | undefined;
readonly id: string | undefined;
readonly group?: FormPropGroup | undefined;
readonly className?: string;
constructor(options: FormPropOptions<R>) {
super(
@ -78,6 +79,7 @@ export class FormProp<R = any> extends Prop<R> {
options.isExtra,
);
this.group = options.group;
this.className = options.className;
this.asyncValidators = options.asyncValidators || (_ => []);
this.validators = options.validators || (_ => []);

Loading…
Cancel
Save