Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into v5.13
  • Loading branch information
sagarthecook committed Jun 7, 2019
2 parents b35d809 + 61c969a commit 2c95acf
Show file tree
Hide file tree
Showing 17 changed files with 372 additions and 128 deletions.
17 changes: 17 additions & 0 deletions src/module/creative/homepage/homepage.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class AmexioHomePageComponent implements OnInit, AfterContentInit {
ngAfterContentInit() {
setTimeout(() => {
this.sideNavComponents = this.sideNavList.toArray();
this.setTimeoutMethodSeoerate();
this.sideNavComponents[0].handleMobileDevice = false;
if (this.type === '3') {
this.sideNavComponents[0].isShowOnlyIcon = true;
Expand Down Expand Up @@ -68,6 +69,22 @@ export class AmexioHomePageComponent implements OnInit, AfterContentInit {
}
}, 0);
}
setTimeoutMethodSeoerate() {
this.sideNavComponents.forEach((sidenav: any) => {
sidenav.nodeClick.subscribe((node: any) => {
if (sidenav.smalldevice && (!node.children || node.children === null || node.children === '')) {
this.sideNavComponents[0].collapseSidenav();
if (this.sideNavComponents[0].sidenavexpandedinsmalldevice) {
this.amexioHomePageWestPanelComponent.setPadding(this.northPanelHeight);
} else {
this.amexioHomePageWestPanelComponent.setPadding(0);
}
} else {
this.sideNavComponents[0].isSideNavEnable = true;
}
});
});
}

// tslint:disable-next-line:no-identical-functions
resize(event: any) {
Expand Down
2 changes: 1 addition & 1 deletion src/module/creative/window/amexio.window.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div *ngIf="show" class="amexio-root-window-ce" [style.justify-content]="horizontalposition">
<div class="amexio-root-window-content-ce" (mousedown)='onWindowPress($event)' (mousemove)='onWindowDrag($event)' [@animation]="{value: 'visible', params: {transitionParams: transitionOptions}}"
[style.width]="width" [style.height]="height" [style.top.px]='y' [style.left.px]='x' [style.justify-content]="verticalposition" [ngStyle]="maximumWindowStyle" [ngClass]="{'content-max-height': (maximize && isFullWindow)}">
<div [ngStyle]="{'background': bgimage ? 'url(' + bgimage + ') center/cover no-repeat' : null}" [ngClass]="cclass">
<div [ngStyle]="{'background': bgimage ? 'url(' + bgimage + ') center/cover no-repeat' : null,'resize': resizable ? 'both':'','overflow':resizable ?'auto':''}" [ngClass]="cclass">
<div [ngStyle]="{'justify-content': (align === 'start' || align === 'end') ? 'flex-'+align:align , 'color':color, 'background': background, 'cursor': draggable ? 'all-scroll':''}">
<ng-content></ng-content>
</div>
Expand Down
56 changes: 20 additions & 36 deletions src/module/creative/window/amexio.window.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export class AmexioWindowCEComponent extends LifeCycleBaseComponent implements O

@Input() draggable: boolean;

@Input() resizable: boolean;

@Input('remember-window-position') windowposition: boolean;
maximumWindowStyle: any;

dummyWidth: string;
Expand All @@ -112,48 +115,31 @@ export class AmexioWindowCEComponent extends LifeCycleBaseComponent implements O

minArea: number;

draggingCorner: boolean;

draggingWindow: boolean;

globalListenFunc: () => void;
globalClickListenFunc: () => void;
globalDragListenFunc: () => void;

constructor(private renderer: Renderer2) {
super();
this.x = 0;
this.y = 0;
this.px = 0;
this.py = 0;
this.draggingCorner = false;
this.draggingWindow = false;
this.minArea = 20000;
}
@HostListener('document:mousemove', ['$event'])
onCornerMove(event: MouseEvent) {
const lastX = this.x;
const lastY = this.y;
const pWidth = this.width;
const pHeight = this.height;

if (this.area() < this.minArea) {
this.x = lastX;
this.y = lastY;
this.width = pWidth;
this.height = pHeight;
}
this.px = event.clientX;
this.py = event.clientY;
}
onCloseClick() {
if (this.closable) {
this.showWindow = false;
this.show = false;
this.showChange.emit(false);
this.close.emit(this.showWindow);
this.x = 0;
this.y = 0;

if (this.windowposition) {
this.x = 0;
this.y = 0;
}
}
}
ngOnInit() {
Expand All @@ -173,12 +159,12 @@ export class AmexioWindowCEComponent extends LifeCycleBaseComponent implements O
if (this.showWindow) {
this.show = this.showWindow;
}
this.globalDragListenFunc = this.renderer.listen('document', 'mouseup', (e: any) => {
this.draggingWindow = false;
});
super.ngOnInit();

}
area() {
return this.width * this.height;
}
onWindowPress(event: MouseEvent) {
if (this.draggable) {
this.draggingWindow = true;
Expand Down Expand Up @@ -283,12 +269,12 @@ export class AmexioWindowCEComponent extends LifeCycleBaseComponent implements O
}

ngOnChanges(changes: SimpleChanges) {
if (changes['show']) {
this.setShowFlag(changes.show.currentValue);
}
if (changes['showWindow']) {
this.setShowFlag(changes.showWindow.currentValue);
}
if (changes['show']) {
this.setShowFlag(changes.show.currentValue);
}
if (changes['showWindow']) {
this.setShowFlag(changes.showWindow.currentValue);
}
}
setShowFlag(changedValue: any) {
this.show = changedValue;
Expand Down Expand Up @@ -342,10 +328,8 @@ export class AmexioWindowCEComponent extends LifeCycleBaseComponent implements O
}
ngOnDestroy() {
super.ngOnDestroy();
}
@HostListener('document:mouseup', ['$event'])
onCornerRelease(event: MouseEvent) {
this.draggingWindow = false;
this.draggingCorner = false;
if (this.globalDragListenFunc) {
this.globalDragListenFunc();
}
}
}
112 changes: 112 additions & 0 deletions src/module/directive/input-mask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* Copyright [2019] [Metamagic]
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Created by Ketan Gote on 05 June, 2019.
* Reference to : https://codepen.io/estelle/pen/LVQLRq?editors=1111
*
*/

import { Directive, HostListener, Input, Optional } from '@angular/core';
import { NgControl, NgModel } from '@angular/forms';

@Directive({
selector: '[amexio-mask-pattern]',
})
export class AmexioInputPatternDirective {

@Input('amexio-mask-pattern') inputPattern: string;

isInt: any;
isLetter: any;
matchesNumber: any;
matchesLetter: any;
newValue1: any;

constructor( @Optional() public model: NgModel, public ngControl: NgControl) {

}

@HostListener('keyup', ['$event'])
onModelChange(event: any) {
const isCharsetPresent = this.ngControl.valueAccessor['data-charset'];
const placeholder = isCharsetPresent || this.inputPattern;
const e = event.target.value;
const strippedValue = isCharsetPresent ? e.replace(/\W/g, '') : e.replace(/\D/g, '');
const newVal = this.handleCurrentValue(strippedValue, placeholder, isCharsetPresent, e);
this.model.update.emit(newVal);
}

handleCurrentValue(strippedValue: any, placeholder: any, isCharsetPresent: any, e: any) {
this.getOperatingValues(isCharsetPresent, strippedValue, placeholder);
if (this.ngControl.valueAccessor['data-valid-example']) {
return this.validateProgress(e, this.newValue1);
}
return this.newValue1;
}

getOperatingValues(isCharsetPresent: any, strippedValue: any, placeholder: any) {
let newValue = '';
this.newValue1 = '';
for (let i = 0, j = 0; i < placeholder.length; i++) {
this.valueInitialize(strippedValue[j], placeholder[i]);
if ((this.matchesNumber && this.isInt) || (isCharsetPresent && this.matchesLetter && this.isLetter)) {
newValue += strippedValue[j++];
} else if ((!isCharsetPresent && !this.isInt && this.matchesNumber) ||
(isCharsetPresent && ((this.matchesLetter && !this.isLetter) || (this.matchesNumber && !this.isInt)))) {
return newValue;
} else {
newValue += placeholder[i];
}
if (strippedValue[j] === undefined) {
break;
}
}
this.newValue1 = newValue;
}

valueInitialize(strippedValue: any, placeholder: any) {
this.isInt = !isNaN(parseInt(strippedValue, 10));
this.isLetter = strippedValue ? strippedValue.match(/[A-Z]/i) : false;
this.matchesNumber = 'XdDmMyY9'.indexOf(placeholder) >= 0;
this.matchesLetter = '_'.indexOf(placeholder) >= 0;
}

validateProgress(e: any, value: any) {
const validExample = this.ngControl.valueAccessor['data-valid-example'];
const pattern = new RegExp(this.ngControl.valueAccessor['data-pattern']);
const placeholder = this.inputPattern;

const l = value.length;
const testValue = '';

// convert to months
if (l === 1 && placeholder.toUpperCase().substr(0, 2) === 'MM') {
if (value > 1 && value < 10) {
value = '0' + value;
}
return value;
}
// test the value, removing the last character, until what you have is a submatch
for (let i = l; i >= 0; i--) {
const testValue1 = value + validExample.substr(value.length);
if (pattern.test(testValue1)) {
return value;
} else {
value = value.substr(0, value.length - 1);
}
}
return value;
}
}
4 changes: 4 additions & 0 deletions src/module/forms/amexio.forms.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ import { FacebookAuthComponent } from './socialmedia/facebookauth/facebook.auth.
import { GoogleAuthComponent } from './socialmedia/googleauth/google.auth.component';
import { LinkedInAuthComponent } from './socialmedia/linkedinauth/linkedin.auth.component';
import { AmexioSocialComponent } from './socialmedia/social.component';

import { AmexioInputPatternDirective } from '../directive/input-mask';

export * from '../services/data/common.data.service';
export * from '../services/icon/icon.service';
export * from './recaptcha/load.recaptcha.service';
Expand Down Expand Up @@ -119,6 +122,7 @@ const FORM_COMPONENTS = [
DarkmodeComponent,
AmexioRangeSliderComponent,
AmexioMultipleDatePickerComponent,
AmexioInputPatternDirective,
];

@NgModule({
Expand Down
8 changes: 6 additions & 2 deletions src/module/navigation/navbar/banner/banner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ export class AmexioBannerComponent implements AfterContentInit, OnInit {
private el: ElementRef,
public matchMediaService: DeviceQueryService,
) {
this.callWindowScroll();
}

@HostListener('window:scroll', [])
onWindowScroll() {

if (this.closeOnScroll) {
const offset =
this.document.documentElement.scrollTop || this.document.body.scrollTop || 0;
Expand All @@ -81,6 +80,11 @@ export class AmexioBannerComponent implements AfterContentInit, OnInit {
}
}

callWindowScroll() {
this.renderer
.listen('window', 'scroll', (event: any) => this.onWindowScroll());
}

ngOnInit() {
if (this.interval !== 0) {
setTimeout(() => {
Expand Down
7 changes: 6 additions & 1 deletion src/module/navigation/navbar/navmenu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@
<span *ngIf="(position == 'right' && node.submenus) || ( mobilemode && node.submenus)"
[style.padding-right.px]="mobilemode ? 18:10" [style.padding-top.px]="mobilemode ? 0:5"
style="float:right;" (click)="onIconClick($event,node)">

<ng-container *ngIf="!mobilemode">
<i class="fa fa-angle-right" aria-hidden="true"></i>
</ng-container>
<ng-container *ngIf="mobilemode">
<i *ngIf="!node.isExpanded" class="fa fa-angle-down" aria-hidden="true"></i>
<i *ngIf="node.isExpanded" class="fa fa-angle-up" aria-hidden="true"></i>
</ng-container>


</span>
</span>
Expand Down
Loading

0 comments on commit 2c95acf

Please sign in to comment.