mis-crystal-design-system 4.0.39 → 4.0.41
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/async-search-dropdown/mis-crystal-design-system-async-search-dropdown.metadata.json +1 -1
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.js +1 -1
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-async-search-dropdown.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-dropdown.umd.js +27 -3
- package/bundles/mis-crystal-design-system-dropdown.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-dropdown.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-dropdown.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-timepicker.umd.js +1 -1
- package/bundles/mis-crystal-design-system-timepicker.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-timepicker.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-timepicker.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-timerangepicker.umd.js +47 -30
- package/bundles/mis-crystal-design-system-timerangepicker.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-tooltip.umd.js +12 -1
- package/bundles/mis-crystal-design-system-tooltip.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-tooltip.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-tooltip.umd.min.js.map +1 -1
- package/dropdown/calculate-height.pipe.d.ts +4 -0
- package/dropdown/dropdown.component.d.ts +1 -0
- package/dropdown/mis-crystal-design-system-dropdown.d.ts +1 -0
- package/dropdown/mis-crystal-design-system-dropdown.metadata.json +1 -1
- package/esm2015/async-search-dropdown/async-dropdown.component.js +1 -1
- package/esm2015/dropdown/calculate-height.pipe.js +19 -0
- package/esm2015/dropdown/dropdown.component.js +5 -3
- package/esm2015/dropdown/dropdown.module.js +3 -2
- package/esm2015/dropdown/mis-crystal-design-system-dropdown.js +2 -1
- package/esm2015/timepicker/timepicker.component.js +2 -2
- package/esm2015/timerangepicker/timerangepicker.component.js +48 -31
- package/esm2015/tooltip/tooltip-container/tooltip.component.js +3 -2
- package/esm2015/tooltip/tooltip.directive.js +7 -1
- package/fesm2015/mis-crystal-design-system-async-search-dropdown.js +1 -1
- package/fesm2015/mis-crystal-design-system-dropdown.js +25 -5
- package/fesm2015/mis-crystal-design-system-dropdown.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-timepicker.js +1 -1
- package/fesm2015/mis-crystal-design-system-timepicker.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-timerangepicker.js +47 -30
- package/fesm2015/mis-crystal-design-system-timerangepicker.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-tooltip.js +8 -1
- package/fesm2015/mis-crystal-design-system-tooltip.js.map +1 -1
- package/package.json +1 -1
- package/tooltip/mis-crystal-design-system-tooltip.metadata.json +1 -1
- package/tooltip/tooltip-container/tooltip.component.d.ts +1 -0
- package/tooltip/tooltip.directive.d.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-timerangepicker.umd.js","sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts","../../../projects/mis-components/timerangepicker/mis-crystal-design-system-timerangepicker.ts"],"sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // first interval for the start picker will be the one closest to the current time\n // if the start date is equal to the curr date\n if (this.startDate === this.endDate) {\n const currentTime = moment().valueOf();\n\n // if current time >= 11:45 the start picker will show\n // current time instead of next closest interval\n if ( currentTime >= moment().endOf(\"d\").subtract(15, \"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n } else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n }\n this.startTime = {\n valid: true,\n time: moment().add(offset, \"m\").format(this.timeFormat),\n epoch: moment().add(offset, \"m\").valueOf()\n };\n } else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.startTime = {\n valid: true,\n time: this.givenStartTime ? moment(this.givenStartTime).format(this.timeFormat) : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").format(this.timeFormat),\n epoch: this.givenStartTime ? this.givenStartTime : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").valueOf()\n };\n }\n\n // for the end picker if the startDate and the endDate is same\n // the first interval is set one interval ahead of the first interval for start picker\n // else if the dates are different we set it to the start of the day\n if (this.startDate === this.endDate) {\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n } else {\n this.firstIntervalForEndPicker = moment().startOf(\"d\").valueOf();\n }\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: this.firstIntervalForEndPicker\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["moment","EventEmitter","moment.tz","Component","ChangeDetectorRef","Input","Output","NgModule","CommonModule","FormsModule","TimePickerModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCE,kCAAoB,GAAsB;YAAtB,QAAG,GAAH,GAAG,CAAmB;YA3BjC,eAAU,GAAW,OAAO,CAAC;YAE7B,WAAM,GAAW,MAAM,CAAC;YACxB,aAAQ,GAAW,cAAc,CAAC;YAClC,mBAAc,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAC9D,iBAAY,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAG5D,gBAAW,GAAW,EAAE,CAAC;YACzB,aAAQ,GAAW,EAAE,CAAC;YACtB,gBAAW,GAAY,IAAI,CAAC;YAC5B,cAAS,GAAe,KAAK,CAAC;YAC9B,QAAG,GAAW,MAAM,CAAC;YAEpB,qBAAgB,GAAG,IAAIC,iBAAY,EAAc,CAAC;YAM5D,gCAA2B,GAAWD,iBAAM,EAAE,CAAC,OAAO,EAAE,CAAC;YACzD,8BAAyB,GAAWA,iBAAM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AAK;iCACLA,UAAK;+BACLA,UAAK;iCACLA,UAAK;+BACLA,UAAK;8BACLA,UAAK;2BACLA,UAAK;8BACLA,UAAK;4BACLA,UAAK;sBACLA,UAAK;mCAELC,WAAM;;;;QCbT;;QACS,6BAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SAC3D;;;;gBARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,wBAAwB,CAAC;oBACxC,OAAO,EAAE,CAACC,mBAAY,EAAEC,iBAAW,EAAEC,2BAAgB,CAAC;oBACtD,OAAO,EAAE,CAAC,wBAAwB,CAAC;iBACpC;;;ICVD;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-timerangepicker.umd.js","sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts","../../../projects/mis-components/timerangepicker/mis-crystal-design-system-timerangepicker.ts"],"sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // start date, 22 MAY === current date, 22 MAY\n if( this.startDate === this.currDate ){\n const currentTime = moment(this.startDateEpoch).valueOf();\n\n // start date, 22 MAY === current date, 22 MAY === end date, 22 MAY\n if(this.startDate === this.endDate){\n\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n }\n } \n // start date, 22 MAY === current date, 22 MAY !== end date, 30 MAY\n else {\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).valueOf();\n }\n }\n }\n // start date, 30 MAY !== current date, 22 MAY\n else {\n // start date === end Date\n if( this.startDate === this.endDate){\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).add(this.interval, \"m\").valueOf();\n } \n // start date !== end date\n else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n }\n\n }\n\n if(this.givenStartTime)\n this.firstIntervalForStartPicker = this.givenStartTime;\n \n if(this.givenEndTime)\n this.firstIntervalForEndPicker = this.givenEndTime;\n \n this.startTime = {\n valid: true,\n time: moment(this.firstIntervalForStartPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForStartPicker).valueOf()\n };\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForEndPicker).valueOf()\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["moment","EventEmitter","moment.tz","Component","ChangeDetectorRef","Input","Output","NgModule","CommonModule","FormsModule","TimePickerModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCE,kCAAoB,GAAsB;YAAtB,QAAG,GAAH,GAAG,CAAmB;YA3BjC,eAAU,GAAW,OAAO,CAAC;YAE7B,WAAM,GAAW,MAAM,CAAC;YACxB,aAAQ,GAAW,cAAc,CAAC;YAClC,mBAAc,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAC9D,iBAAY,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;YAG5D,gBAAW,GAAW,EAAE,CAAC;YACzB,aAAQ,GAAW,EAAE,CAAC;YACtB,gBAAW,GAAY,IAAI,CAAC;YAC5B,cAAS,GAAe,KAA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ARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,wBAAwB,CAAC;oBACxC,OAAO,EAAE,CAACC,mBAAY,EAAEC,iBAAW,EAAEC,2BAAgB,CAAC;oBACtD,OAAO,EAAE,CAAC,wBAAwB,CAAC;iBACpC;;;ICVD;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("moment-timezone"),require("@angular/common"),require("@angular/forms"),require("mis-crystal-design-system/timepicker")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/timerangepicker",["exports","@angular/core","moment-timezone","@angular/common","@angular/forms","mis-crystal-design-system/timepicker"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].timerangepicker={}),t.ng.core,t.moment,t.ng.common,t.ng.forms,t["mis-crystal-design-system"].timepicker)}(this,(function(t,e,i,r,a,n){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("moment-timezone"),require("@angular/common"),require("@angular/forms"),require("mis-crystal-design-system/timepicker")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/timerangepicker",["exports","@angular/core","moment-timezone","@angular/common","@angular/forms","mis-crystal-design-system/timepicker"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].timerangepicker={}),t.ng.core,t.moment,t.ng.common,t.ng.forms,t["mis-crystal-design-system"].timepicker)}(this,(function(t,e,i,r,a,n){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var o=s(i),h=function(){function t(t){this.cdr=t,this.inputWidth="100px",this.height="46px",this.timezone="Asia/Kolkata",this.startDateEpoch=o().tz(this.timezone).valueOf(),this.endDateEpoch=o().tz(this.timezone).valueOf(),this.clockFormat=12,this.interval=15,this.showTooltip=!0,this.direction="row",this.gap="1rem",this.timeRangeEmitter=new e.EventEmitter,this.firstIntervalForStartPicker=o().valueOf(),this.firstIntervalForEndPicker=o().valueOf(),this.rangeValidity=!0,this.triggerChange=!0}return t.prototype.ngOnInit=function(){},t.prototype.ngOnChanges=function(){this.timeFormat=12===this.clockFormat?"hh:mm a":"HH:mm",i.tz.setDefault(this.timezone),this.startDate=o(this.startDateEpoch).format("DD-MM-YYYY"),this.endDate=o(this.endDateEpoch).format("DD-MM-YYYY"),this.currDate=o().format("DD-MM-YYYY"),this.setFirstIntervals()},t.prototype.setFirstIntervals=function(){var t=o().minutes(),e=this.interval-t%this.interval;if(this.startDate===this.currDate){var i=o(this.startDateEpoch).valueOf();this.startDate===this.endDate?i>=o(this.startDateEpoch).endOf("d").subtract(this.interval,"m").valueOf()?(this.firstIntervalForStartPicker=i,this.firstIntervalForEndPicker=o(this.endDateEpoch).endOf("d").valueOf()):(this.firstIntervalForStartPicker=o().add(e,"m").valueOf(),this.firstIntervalForEndPicker=o().add(e,"m").add(this.interval,"m").valueOf()):i>=o(this.startDateEpoch).endOf("d").subtract(this.interval,"m").valueOf()?(this.firstIntervalForStartPicker=i,this.firstIntervalForEndPicker=o(this.endDateEpoch).endOf("d").valueOf()):(this.firstIntervalForStartPicker=o().add(e,"m").valueOf(),this.firstIntervalForEndPicker=o(this.endDateEpoch).valueOf())}else this.startDate===this.endDate?(this.firstIntervalForStartPicker=o(this.startDateEpoch).startOf("d").valueOf(),this.firstIntervalForEndPicker=o(this.endDateEpoch).add(this.interval,"m").valueOf()):(this.firstIntervalForStartPicker=o(this.startDateEpoch).startOf("d").valueOf(),this.firstIntervalForEndPicker=o(this.startDateEpoch).startOf("d").valueOf());this.givenStartTime&&(this.firstIntervalForStartPicker=this.givenStartTime),this.givenEndTime&&(this.firstIntervalForEndPicker=this.givenEndTime),this.startTime={valid:!0,time:o(this.firstIntervalForStartPicker).format(this.timeFormat),epoch:o(this.firstIntervalForStartPicker).valueOf()},this.endTime={valid:!0,time:o(this.firstIntervalForEndPicker).format(this.timeFormat),epoch:o(this.firstIntervalForEndPicker).valueOf()}},t.prototype.emitTimeRange=function(t){this.timeRangeEmitter.emit(t)},t.prototype.startPickerHandler=function(t){if(this.startTime=t,this.rangeValidity=!0,this.startDate===this.endDate){var e=o(this.startTime.time,this.timeFormat).minutes(),i=this.interval-e%this.interval;this.firstIntervalForEndPicker=o(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).add(i,"m").valueOf(),o(this.firstIntervalForEndPicker).format(this.timeFormat)===o(o(""+this.startDate,"DD-MM-YYYY "+this.timeFormat).endOf("d").add(1,"m")).format(this.timeFormat)&&(this.firstIntervalForEndPicker=o(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).endOf("d").valueOf())}else{var r=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(r),this.emitTimeRange({valid:r&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:o(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:o(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})}this.triggerChange=!this.triggerChange},t.prototype.endPickerHandler=function(t){this.endTime=t;var e=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(e),this.emitTimeRange({valid:e&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:o(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:o(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})},t.prototype.checkTimeValidity=function(t,e){var i=12===this.clockFormat?/^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i:/^([01][0-9]|2[0-3]):[0-5][0-9]$/,r=o(o(e).format("DD-MM-YYYY")+" "+t,"'DD-MM-YYYY' "+this.timeFormat);return this.givenStartTime&&this.givenEndTime||this.startDate!==this.endDate&&this.startDate!==this.currDate?!!t.match(i):!!(t.match(i)&&r.diff(o(),"m")>=0)},t.prototype.rangeValidation=function(t){if(t&&this.startDate===this.endDate){var e=o(this.startTime.time,this.timeFormat),i=o(this.endTime.time,this.timeFormat);this.rangeValidity=i.diff(e,"m")>=1,this.cdr.detectChanges()}},t}();h.decorators=[{type:e.Component,args:[{selector:"mis-timerangepicker",template:'<div class="rangepicker-container" [ngStyle]="{\'flexDirection\': direction, \'gap\': gap}">\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="startDateEpoch"\n [firstInterval]="firstIntervalForStartPicker"\n (timeEmitter)="startPickerHandler($event)"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenStartTime"\n ></mis-timepicker>\n <p *ngIf="direction === \'row\'">-</p>\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="endDateEpoch"\n [firstInterval]="firstIntervalForEndPicker"\n (timeEmitter)="endPickerHandler($event)"\n [rangeValidity]="rangeValidity"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenEndTime"\n [triggerChange]="triggerChange"\n ></mis-timepicker>\n</div>\n',styles:[".rangepicker-container{display:flex;gap:1rem;align-items:center}p{margin:0;display:inline-flex;align-items:center}"]}]}],h.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},h.propDecorators={inputWidth:[{type:e.Input}],dropdownWidth:[{type:e.Input}],height:[{type:e.Input}],timezone:[{type:e.Input}],startDateEpoch:[{type:e.Input}],endDateEpoch:[{type:e.Input}],givenStartTime:[{type:e.Input}],givenEndTime:[{type:e.Input}],clockFormat:[{type:e.Input}],interval:[{type:e.Input}],showTooltip:[{type:e.Input}],direction:[{type:e.Input}],gap:[{type:e.Input}],timeRangeEmitter:[{type:e.Output}]};var m=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t}();m.decorators=[{type:e.NgModule,args:[{declarations:[h],imports:[r.CommonModule,a.FormsModule,n.TimePickerModule],exports:[h]}]}],t.TimeRangePickerComponent=h,t.TimeRangePickerModule=m,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-timerangepicker.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts"],"names":["TimeRangePickerComponent","cdr","this","inputWidth","height","timezone","startDateEpoch","moment","tz","valueOf","endDateEpoch","clockFormat","interval","showTooltip","direction","gap","timeRangeEmitter","EventEmitter","firstIntervalForStartPicker","firstIntervalForEndPicker","rangeValidity","triggerChange","prototype","ngOnInit","ngOnChanges","timeFormat","moment.tz","setDefault","startDate","format","endDate","currDate","setFirstIntervals","minutes","offset","currentTime","endOf","subtract","add","startTime","valid","time","epoch","startOf","givenStartTime","endTime","emitTimeRange","data","emit","startPickerHandler","validity","checkTimeValidity","trim","rangeValidation","startEpoch","endEpoch","endPickerHandler","date","RE","timeMoment","givenEndTime","match","diff","startMoment","endMoment","detectChanges","Component","args","selector","template","ChangeDetectorRef","Input","Output","TimeRangePickerModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","FormsModule","TimePickerModule","exports"],"mappings":"8hCAqCE,SAAAA,EAAoBC,GAAAC,KAAAD,IAAAA,EA3BXC,KAAAC,WAAqB,QAErBD,KAAAE,OAAiB,OACjBF,KAAAG,SAAmB,eACnBH,KAAAI,eAAyBC,IAASC,GAAGN,KAAKG,UAAUI,UACpDP,KAAAQ,aAAuBH,IAASC,GAAGN,KAAKG,UAAUI,UAGlDP,KAAAS,YAAsB,GACtBT,KAAAU,SAAmB,GACnBV,KAAAW,aAAuB,EACvBX,KAAAY,UAAwB,MACxBZ,KAAAa,IAAc,OAEbb,KAAAc,iBAAmB,IAAIC,EAAAA,aAMjCf,KAAAgB,4BAAsCX,IAASE,UAC/CP,KAAAiB,0BAAoCZ,IAASE,UAG7CP,KAAAkB,eAAyB,EACzBlB,KAAAmB,eAAyB,SAIzBrB,EAAAsB,UAAAC,SAAA,aAEAvB,EAAAsB,UAAAE,YAAA,WACEtB,KAAKuB,WAAkC,KAArBvB,KAAKS,YAAqB,UAAY,QACxDe,EAAAA,GAAUC,WAAWzB,KAAKG,UAC1BH,KAAK0B,UAAYrB,EAAOL,KAAKI,gBAAgBuB,OAAO,cACpD3B,KAAK4B,QAAUvB,EAAOL,KAAKQ,cAAcmB,OAAO,cAChD3B,KAAK6B,SAAWxB,IAASsB,OAAO,cAChC3B,KAAK8B,qBAIPhC,EAAAsB,UAAAU,kBAAA,WACE,IAAMC,EAAU1B,IAAS0B,UACnBC,EAAShC,KAAKU,SAAYqB,EAAU/B,KAAKU,SAI/C,GAAIV,KAAK0B,YAAc1B,KAAK4B,QAAS,CACnC,IAAMK,EAAc5B,IAASE,UAIxB0B,GAAe5B,IAAS6B,MAAM,KAAKC,SAAS,GAAI,KAAK5B,UACxDP,KAAKgB,4BAA8BiB,EAEnCjC,KAAKgB,4BAA8BX,IAAS+B,IAAIJ,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AAAA,SAAQV,KAAA,CAAC,CACRW,aAAc,CAAC9E,GACf+E,QAAS,CAACC,EAAAA,aAAcC,EAAAA,YAAaC,EAAAA,kBACrCC,QAAS,CAACnF","sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // first interval for the start picker will be the one closest to the current time\n // if the start date is equal to the curr date\n if (this.startDate === this.endDate) {\n const currentTime = moment().valueOf();\n\n // if current time >= 11:45 the start picker will show\n // current time instead of next closest interval\n if ( currentTime >= moment().endOf(\"d\").subtract(15, \"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n } else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n }\n this.startTime = {\n valid: true,\n time: moment().add(offset, \"m\").format(this.timeFormat),\n epoch: moment().add(offset, \"m\").valueOf()\n };\n } else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.startTime = {\n valid: true,\n time: this.givenStartTime ? moment(this.givenStartTime).format(this.timeFormat) : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").format(this.timeFormat),\n epoch: this.givenStartTime ? this.givenStartTime : moment(this.startDateEpoch).startOf('d').add(offset, \"m\").valueOf()\n };\n }\n\n // for the end picker if the startDate and the endDate is same\n // the first interval is set one interval ahead of the first interval for start picker\n // else if the dates are different we set it to the start of the day\n if (this.startDate === this.endDate) {\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n } else {\n this.firstIntervalForEndPicker = moment().startOf(\"d\").valueOf();\n }\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: this.firstIntervalForEndPicker\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts"],"names":["TimeRangePickerComponent","cdr","this","inputWidth","height","timezone","startDateEpoch","moment","tz","valueOf","endDateEpoch","clockFormat","interval","showTooltip","direction","gap","timeRangeEmitter","EventEmitter","firstIntervalForStartPicker","firstIntervalForEndPicker","rangeValidity","triggerChange","prototype","ngOnInit","ngOnChanges","timeFormat","moment.tz","setDefault","startDate","format","endDate","currDate","setFirstIntervals","minutes","offset","currentTime","endOf","subtract","add","startOf","givenStartTime","givenEndTime","startTime","valid","time","epoch","endTime","emitTimeRange","data","emit","startPickerHandler","validity","checkTimeValidity","trim","rangeValidation","startEpoch","endEpoch","endPickerHandler","date","RE","timeMoment","match","diff","startMoment","endMoment","detectChanges","Component","args","selector","template","ChangeDetectorRef","Input","Output","TimeRangePickerModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","FormsModule","TimePickerModule","exports"],"mappings":"8hCAqCE,SAAAA,EAAoBC,GAAAC,KAAAD,IAAAA,EA3BXC,KAAAC,WAAqB,QAErBD,KAAAE,OAAiB,OACjBF,KAAAG,SAAmB,eACnBH,KAAAI,eAAyBC,IAASC,GAAGN,KAAKG,UAAUI,UACpDP,KAAAQ,aAAuBH,IAASC,GAAGN,KAAKG,UAAUI,UAGlDP,KAAAS,YAAsB,GACtBT,KAAAU,SAAmB,GACnBV,KAAAW,aAAuB,EACvBX,KAAAY,UAAwB,MACxBZ,KAAAa,IAAc,OAEbb,KAAAc,iBAAmB,IAAIC,EAAAA,aAMjCf,KAAAgB,4BAAsCX,IAASE,UAC/CP,KAAAiB,0BAAoCZ,IAASE,UAG7CP,KAAAkB,eAAyB,EACzBlB,KAAAmB,eAAyB,SAIzBrB,EAAAsB,UAAAC,SAAA,aAEAvB,EAAAsB,UAAAE,YAAA,WACEtB,KAAKuB,WAAkC,KAArBvB,KAAKS,YAAqB,UAAY,QACxDe,EAAAA,GAAUC,WAAWzB,KAAKG,UAC1BH,KAAK0B,UAAYrB,EAAOL,KAAKI,gBAAgBuB,OAAO,cACpD3B,KAAK4B,QAAUvB,EAAOL,KAAKQ,cAAcmB,OAAO,cAChD3B,KAAK6B,SAAWxB,IAASsB,OAAO,cAChC3B,KAAK8B,qBAIPhC,EAAAsB,UAAAU,kBAAA,WACE,IAAMC,EAAU1B,IAAS0B,UACnBC,EAAShC,KAAKU,SAAYqB,EAAU/B,KAAKU,SAG/C,GAAIV,KAAK0B,YAAc1B,KAAK6B,SAAU,CACpC,IAAMI,EAAc5B,EAAOL,K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AKuB,YAC/CuC,EAAYzD,EAAOL,KAAK4C,QAAQF,KAAM1C,KAAKuB,YACjDvB,KAAKkB,cAAgB4C,EAAUF,KAAKC,EAAa,MAAQ,EACzD7D,KAAKD,IAAIgE,2CAzMdC,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,sBACVC,SAAA,0sCANyBC,EAAAA,yDAUxBC,EAAAA,6BACAA,EAAAA,sBACAA,EAAAA,wBACAA,EAAAA,8BACAA,EAAAA,4BACAA,EAAAA,8BACAA,EAAAA,4BACAA,EAAAA,2BACAA,EAAAA,wBACAA,EAAAA,2BACAA,EAAAA,yBACAA,EAAAA,mBACAA,EAAAA,gCAEAC,EAAAA,2BCbH,SAAAC,YACSA,EAAAC,QAAP,WACE,MAAO,CAAEC,SAAUF,EAAuBG,UAAW,8BAPxDC,EAAAA,SAAQV,KAAA,CAAC,CACRW,aAAc,CAAC9E,GACf+E,QAAS,CAACC,EAAAA,aAAcC,EAAAA,YAAaC,EAAAA,kBACrCC,QAAS,CAACnF","sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // start date, 22 MAY === current date, 22 MAY\n if( this.startDate === this.currDate ){\n const currentTime = moment(this.startDateEpoch).valueOf();\n\n // start date, 22 MAY === current date, 22 MAY === end date, 22 MAY\n if(this.startDate === this.endDate){\n\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n }\n } \n // start date, 22 MAY === current date, 22 MAY !== end date, 30 MAY\n else {\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).valueOf();\n }\n }\n }\n // start date, 30 MAY !== current date, 22 MAY\n else {\n // start date === end Date\n if( this.startDate === this.endDate){\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).add(this.interval, \"m\").valueOf();\n } \n // start date !== end date\n else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n }\n\n }\n\n if(this.givenStartTime)\n this.firstIntervalForStartPicker = this.givenStartTime;\n \n if(this.givenEndTime)\n this.firstIntervalForEndPicker = this.givenEndTime;\n \n this.startTime = {\n valid: true,\n time: moment(this.firstIntervalForStartPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForStartPicker).valueOf()\n };\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForEndPicker).valueOf()\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}"]}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
function ToolTipComponent() {
|
|
9
9
|
this.toolTipText = "";
|
|
10
10
|
this.toolTipPosition = "bottom";
|
|
11
|
+
this.toolTipTextAlignment = "";
|
|
11
12
|
}
|
|
12
13
|
ToolTipComponent.prototype.ngOnInit = function () { };
|
|
13
14
|
ToolTipComponent.prototype.ngAfterViewInit = function () {
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
ToolTipComponent.decorators = [
|
|
30
31
|
{ type: core.Component, args: [{
|
|
31
32
|
selector: "mis-tooltip",
|
|
32
|
-
template: "<div id=\"tooltip-container\" *ngIf=\"toolTipText.length > 0\" #container>\n <div id=\"tooltip\">\n <div id=\"tooltip-text\"
|
|
33
|
+
template: "<div id=\"tooltip-container\" *ngIf=\"toolTipText.length > 0\" #container>\n <div id=\"tooltip\">\n <div id=\"tooltip-text\" [innerHTML]=\"toolTipText\" \n [ngStyle]=\"{'text-align' : toolTipTextAlignment ? toolTipTextAlignment : '' }\"></div>\n <span\n id=\"arrow\"\n [ngClass]=\"{\n 'arrow-left': toolTipPosition === 'left',\n 'arrow-right': toolTipPosition === 'right',\n 'arrow-top': toolTipPosition === 'top',\n 'arrow-bottom': toolTipPosition === 'bottom'\n }\"\n ></span>\n </div>\n</div>\n",
|
|
33
34
|
styles: ["#tooltip-container{position:absolute;z-index:1}#tooltip{position:relative;display:block;padding:8px 12px;border-radius:8px;color:#fff;background:#181f33;font-family:Lato,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:20px;text-align:center;letter-spacing:.2px}#tooltip-text{width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#arrow{position:absolute;height:12px;width:12px;background:#181f33;z-index:1}.arrow-top{bottom:-6px}.arrow-bottom,.arrow-top{left:50%;transform:translateX(-50%) rotate(-45deg);-webkit-transform:translateX(-50%) rotate(-45deg)}.arrow-bottom{top:-6px}.arrow-left{right:-6px}.arrow-left,.arrow-right{top:50%;transform:translateY(-50%) rotate(-45deg);-webkit-transform:translateY(-50%) rotate(-45deg)}.arrow-right{left:-6px}"]
|
|
34
35
|
},] }
|
|
35
36
|
];
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
this.viewContainerRef = viewContainerRef;
|
|
46
47
|
this.isToolTipDisplayed = false;
|
|
47
48
|
this.toolTipText = "";
|
|
49
|
+
this.toolTipTextAlignment = "";
|
|
48
50
|
this.toolTipPosition = "bottom";
|
|
49
51
|
this.showOnHover = true;
|
|
50
52
|
}
|
|
@@ -73,6 +75,13 @@
|
|
|
73
75
|
enumerable: false,
|
|
74
76
|
configurable: true
|
|
75
77
|
});
|
|
78
|
+
Object.defineProperty(ToolTipDirective.prototype, "alignText", {
|
|
79
|
+
set: function (value) {
|
|
80
|
+
this.toolTipTextAlignment = value;
|
|
81
|
+
},
|
|
82
|
+
enumerable: false,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
76
85
|
ToolTipDirective.prototype.onMouseEnter = function () {
|
|
77
86
|
if (this.showOnHover)
|
|
78
87
|
this.displayToolTip();
|
|
@@ -110,6 +119,7 @@
|
|
|
110
119
|
var tooltipRef = this.overlayRef.attach(tempRef);
|
|
111
120
|
tooltipRef.instance.toolTipText = this.toolTipText;
|
|
112
121
|
tooltipRef.instance.toolTipPosition = this.toolTipPosition;
|
|
122
|
+
tooltipRef.instance.toolTipTextAlignment = this.toolTipTextAlignment;
|
|
113
123
|
this.overlayRef
|
|
114
124
|
.backdropClick()
|
|
115
125
|
.pipe(operators.take(1))
|
|
@@ -159,6 +169,7 @@
|
|
|
159
169
|
showToolTip: [{ type: core.Input }],
|
|
160
170
|
text: [{ type: core.Input }],
|
|
161
171
|
position: [{ type: core.Input }],
|
|
172
|
+
alignText: [{ type: core.Input }],
|
|
162
173
|
onMouseEnter: [{ type: core.HostListener, args: ["mouseenter",] }],
|
|
163
174
|
onMouseLeave: [{ type: core.HostListener, args: ["mouseleave",] }]
|
|
164
175
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-tooltip.umd.js","sources":["../../../projects/mis-components/tooltip/tooltip-container/tooltip.component.ts","../../../projects/mis-components/tooltip/tooltip.directive.ts","../../../projects/mis-components/tooltip/tooltip.module.ts","../../../projects/mis-components/tooltip/mis-crystal-design-system-tooltip.ts"],"sourcesContent":["import { AfterViewInit, Component, ElementRef, Inject, OnInit, ViewChild } from \"@angular/core\";\nimport { ITooltipPositions } from \"../models/tooltip.model\";\n\n@Component({\n selector: \"mis-tooltip\",\n templateUrl: \"./tooltip.component.html\",\n styleUrls: [\"./tooltip.component.scss\"]\n})\nexport class ToolTipComponent implements OnInit, AfterViewInit {\n public toolTipText: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n\n @ViewChild(\"container\") container: ElementRef;\n\n constructor() {}\n ngOnInit() {}\n ngAfterViewInit() {\n if (!this.container?.nativeElement) return;\n if (this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = eleWidth.width / -2 + \"px\";\n return;\n }\n if (this.toolTipPosition === \"left\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = -eleWidth.width + \"px\";\n }\n }\n}\n","import { AfterViewInit, Directive, ElementRef, HostListener, Input, OnInit, ViewContainerRef } from \"@angular/core\";\nimport { Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { take } from \"rxjs/operators\";\nimport { ComponentPortal } from \"@angular/cdk/portal\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\nimport { genPositionPairs } from \"mis-crystal-design-system/utils\";\nimport { ITooltipPositions } from \"./models/tooltip.model\";\n\n@Directive({\n selector: \"[misToolTip]\"\n})\nexport class ToolTipDirective implements OnInit, AfterViewInit {\n public isToolTipDisplayed: boolean = false;\n public toolTipText: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n private overlayRef: OverlayRef;\n\n @Input() showOnHover: boolean = true;\n @Input() set showToolTip(value: boolean) {\n this.isToolTipDisplayed = value;\n if (value) this.displayToolTip();\n else this.hideToolTip();\n }\n @Input() set text(value: string) {\n this.toolTipText = value;\n }\n @Input() set position(value: ITooltipPositions) {\n this.toolTipPosition = value;\n }\n\n @HostListener(\"mouseenter\") onMouseEnter() {\n if (this.showOnHover) this.displayToolTip();\n }\n @HostListener(\"mouseleave\") onMouseLeave() {\n if (this.showOnHover) this.hideToolTip();\n }\n\n constructor(private element: ElementRef, private overlay: Overlay, private viewContainerRef: ViewContainerRef) {}\n\n ngOnInit() {}\n ngAfterViewInit() {\n if (this.isToolTipDisplayed) this.displayToolTip();\n else this.hideToolTip();\n }\n\n displayToolTip() {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.element)\n .withPositions(\n genPositionPairs(\n {\n positionX: \"center\",\n positionY: this.toolTipPosition === \"top\" ? \"top\" : \"center\",\n offsetX: this.positionTooltip(\"OFFSET_X\"),\n offsetY: this.positionTooltip(\"OFFSET_Y\")\n },\n false\n )\n )\n .withPush(true);\n const config = new OverlayConfig({\n hasBackdrop: false,\n positionStrategy,\n scrollStrategy: this.overlay.scrollStrategies.reposition()\n });\n this.overlayRef = this.overlay.create(config);\n const tempRef = new ComponentPortal(ToolTipComponent, this.viewContainerRef);\n const tooltipRef = this.overlayRef.attach(tempRef);\n tooltipRef.instance.toolTipText = this.toolTipText;\n tooltipRef.instance.toolTipPosition = this.toolTipPosition;\n this.overlayRef\n .backdropClick()\n .pipe(take(1))\n .subscribe(() => {\n this.hideToolTip();\n });\n }\n\n positionTooltip(type: \"OFFSET_X\" | \"OFFSET_Y\") {\n if (type === \"OFFSET_X\") {\n return this.toolTipPosition === \"right\"\n ? this.element.nativeElement.offsetWidth / 2 + 8\n : this.toolTipPosition === \"left\"\n ? (this.element.nativeElement.offsetWidth / 2 + 8) * -1\n : this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\"\n ? 0\n : 8;\n }\n if (type !== \"OFFSET_Y\") return;\n return this.toolTipPosition === \"right\" || this.toolTipPosition === \"left\"\n ? -18\n : this.toolTipPosition === \"top\"\n ? -44\n : this.toolTipPosition === \"bottom\"\n ? this.element.nativeElement.offsetHeight / 2 + 8\n : 8;\n }\n\n hideToolTip() {\n this.overlayRef?.detach();\n this.overlayRef?.dispose();\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ToolTipDirective } from \"./tooltip.directive\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\n\n@NgModule({\n declarations: [ToolTipDirective, ToolTipComponent],\n imports: [CommonModule, OverlayModule],\n exports: [ToolTipDirective, ToolTipComponent],\n entryComponents: [ToolTipComponent]\n})\nexport class ToolTipModule {\n static forRoot(): ModuleWithProviders<ToolTipModule> {\n return { ngModule: ToolTipModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["Component","ViewChild","genPositionPairs","OverlayConfig","ComponentPortal","take","Directive","ElementRef","Overlay","ViewContainerRef","Input","HostListener","NgModule","CommonModule","OverlayModule"],"mappings":";;;;;;;QAcE;YALO,gBAAW,GAAW,EAAE,CAAC;YACzB,oBAAe,GAAsB,QAAQ,CAAC;SAIrC;QAChB,mCAAQ,GAAR,eAAa;QACb,0CAAe,GAAf;;YACE,IAAI,QAAC,IAAI,CAAC,SAAS,0CAAE,aAAa,CAAA;gBAAE,OAAO;YAC3C,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE;gBACvE,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;gBACtE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;gBACrE,OAAO;aACR;YACD,IAAI,IAAI,CAAC,eAAe,KAAK,MAAM,EAAE;gBACnC,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;gBACtE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC;aAClE;SACF;;;;gBAxBFA,cAAS,SAAC;oBACT,QAAQ,EAAE,aAAa;oBACvB,odAAuC;;iBAExC;;;;4BAKEC,cAAS,SAAC,WAAW;;;;QCyBtB,0BAAoB,OAAmB,EAAU,OAAgB,EAAU,gBAAkC;YAAzF,YAAO,GAAP,OAAO,CAAY;YAAU,YAAO,GAAP,OAAO,CAAS;YAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;YAzBtG,uBAAkB,GAAY,KAAK,CAAC;YACpC,gBAAW,GAAW,EAAE,CAAC;YACzB,oBAAe,GA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AK,UAAU;gBAAE,OAAO;YAChC,OAAO,IAAI,CAAC,eAAe,KAAK,OAAO,IAAI,IAAI,CAAC,eAAe,KAAK,MAAM;kBACtE,CAAC,EAAE;kBACH,IAAI,CAAC,eAAe,KAAK,KAAK;sBAC9B,CAAC,EAAE;sBACH,IAAI,CAAC,eAAe,KAAK,QAAQ;0BACjC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC;0BAC/C,CAAC,CAAC;SACP;QAED,sCAAW,GAAX;;YACE,MAAA,IAAI,CAAC,UAAU,0CAAE,MAAM,GAAG;YAC1B,MAAA,IAAI,CAAC,UAAU,0CAAE,OAAO,GAAG;SAC5B;;;;gBA9FFC,cAAS,SAAC;oBACT,QAAQ,EAAE,cAAc;iBACzB;;;gBAVkCC,eAAU;gBACpCC,eAAO;gBAD4DC,qBAAgB;;;8BAiBzFC,UAAK;8BACLA,UAAK;uBAKLA,UAAK;2BAGLA,UAAK;+BAILC,iBAAY,SAAC,YAAY;+BAGzBA,iBAAY,SAAC,YAAY;;;;QCrB5B;;QACS,qBAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SACnD;;;;gBATFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;oBAClD,OAAO,EAAE,CAACC,mBAAY,EAAEC,qBAAa,CAAC;oBACtC,OAAO,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;oBAC7C,eAAe,EAAE,CAAC,gBAAgB,CAAC;iBACpC;;;ICXD;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-tooltip.umd.js","sources":["../../../projects/mis-components/tooltip/tooltip-container/tooltip.component.ts","../../../projects/mis-components/tooltip/tooltip.directive.ts","../../../projects/mis-components/tooltip/tooltip.module.ts","../../../projects/mis-components/tooltip/mis-crystal-design-system-tooltip.ts"],"sourcesContent":["import { AfterViewInit, Component, ElementRef, Inject, OnInit, ViewChild } from \"@angular/core\";\nimport { ITooltipPositions } from \"../models/tooltip.model\";\n\n@Component({\n selector: \"mis-tooltip\",\n templateUrl: \"./tooltip.component.html\",\n styleUrls: [\"./tooltip.component.scss\"]\n})\nexport class ToolTipComponent implements OnInit, AfterViewInit {\n public toolTipText: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n public toolTipTextAlignment: string = \"\";\n\n @ViewChild(\"container\") container: ElementRef;\n\n constructor() {}\n ngOnInit() {}\n ngAfterViewInit() {\n if (!this.container?.nativeElement) return;\n if (this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = eleWidth.width / -2 + \"px\";\n return;\n }\n if (this.toolTipPosition === \"left\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = -eleWidth.width + \"px\";\n }\n }\n}\n","import { AfterViewInit, Directive, ElementRef, HostListener, Input, OnInit, ViewContainerRef } from \"@angular/core\";\nimport { Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { take } from \"rxjs/operators\";\nimport { ComponentPortal } from \"@angular/cdk/portal\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\nimport { genPositionPairs } from \"mis-crystal-design-system/utils\";\nimport { ITooltipPositions } from \"./models/tooltip.model\";\n\n@Directive({\n selector: \"[misToolTip]\"\n})\nexport class ToolTipDirective implements OnInit, AfterViewInit {\n public isToolTipDisplayed: boolean = false;\n public toolTipText: string = \"\";\n public toolTipTextAlignment: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n private overlayRef: OverlayRef;\n\n @Input() showOnHover: boolean = true;\n @Input() set showToolTip(value: boolean) {\n this.isToolTipDisplayed = value;\n if (value) this.displayToolTip();\n else this.hideToolTip();\n }\n @Input() set text(value: string) {\n this.toolTipText = value;\n }\n @Input() set position(value: ITooltipPositions) {\n this.toolTipPosition = value;\n }\n @Input() set alignText(value: string) {\n this.toolTipTextAlignment = value;\n }\n\n @HostListener(\"mouseenter\") onMouseEnter() {\n if (this.showOnHover) this.displayToolTip();\n }\n @HostListener(\"mouseleave\") onMouseLeave() {\n if (this.showOnHover) this.hideToolTip();\n }\n\n constructor(private element: ElementRef, private overlay: Overlay, private viewContainerRef: ViewContainerRef) {}\n\n ngOnInit() {}\n ngAfterViewInit() {\n if (this.isToolTipDisplayed) this.displayToolTip();\n else this.hideToolTip();\n }\n\n displayToolTip() {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.element)\n .withPositions(\n genPositionPairs(\n {\n positionX: \"center\",\n positionY: this.toolTipPosition === \"top\" ? \"top\" : \"center\",\n offsetX: this.positionTooltip(\"OFFSET_X\"),\n offsetY: this.positionTooltip(\"OFFSET_Y\")\n },\n false\n )\n )\n .withPush(true);\n const config = new OverlayConfig({\n hasBackdrop: false,\n positionStrategy,\n scrollStrategy: this.overlay.scrollStrategies.reposition()\n });\n this.overlayRef = this.overlay.create(config);\n const tempRef = new ComponentPortal(ToolTipComponent, this.viewContainerRef);\n const tooltipRef = this.overlayRef.attach(tempRef);\n tooltipRef.instance.toolTipText = this.toolTipText;\n tooltipRef.instance.toolTipPosition = this.toolTipPosition;\n tooltipRef.instance.toolTipTextAlignment = this.toolTipTextAlignment;\n this.overlayRef\n .backdropClick()\n .pipe(take(1))\n .subscribe(() => {\n this.hideToolTip();\n });\n }\n\n positionTooltip(type: \"OFFSET_X\" | \"OFFSET_Y\") {\n if (type === \"OFFSET_X\") {\n return this.toolTipPosition === \"right\"\n ? this.element.nativeElement.offsetWidth / 2 + 8\n : this.toolTipPosition === \"left\"\n ? (this.element.nativeElement.offsetWidth / 2 + 8) * -1\n : this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\"\n ? 0\n : 8;\n }\n if (type !== \"OFFSET_Y\") return;\n return this.toolTipPosition === \"right\" || this.toolTipPosition === \"left\"\n ? -18\n : this.toolTipPosition === \"top\"\n ? -44\n : this.toolTipPosition === \"bottom\"\n ? this.element.nativeElement.offsetHeight / 2 + 8\n : 8;\n }\n\n hideToolTip() {\n this.overlayRef?.detach();\n this.overlayRef?.dispose();\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ToolTipDirective } from \"./tooltip.directive\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\n\n@NgModule({\n declarations: [ToolTipDirective, ToolTipComponent],\n imports: [CommonModule, OverlayModule],\n exports: [ToolTipDirective, ToolTipComponent],\n entryComponents: [ToolTipComponent]\n})\nexport class ToolTipModule {\n static forRoot(): ModuleWithProviders<ToolTipModule> {\n return { ngModule: ToolTipModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["Component","ViewChild","genPositionPairs","OverlayConfig","ComponentPortal","take","Directive","ElementRef","Overlay","ViewContainerRef","Input","HostListener","NgModule","CommonModule","OverlayModule"],"mappings":";;;;;;;QAeE;YANO,gBAAW,GAAW,EAAE,CAAC;YACzB,oBAAe,GAAsB,QAAQ,CAAC;YAC9C,yBAAoB,GAAW,EAAE,CAAC;SAIzB;QAChB,mCAAQ,GAAR,eAAa;QACb,0CAAe,GAAf;;YACE,IAAI,QAAC,IAAI,CAAC,SAAS,0CAAE,aAAa,CAAA;gBAAE,OAAO;YAC3C,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE;gBACvE,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;gBACtE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;gBAC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OAAO,GAAG;SAC5B;;;;gBAnGFC,cAAS,SAAC;oBACT,QAAQ,EAAE,cAAc;iBACzB;;;gBAVkCC,eAAU;gBACpCC,eAAO;gBAD4DC,qBAAgB;;;8BAkBzFC,UAAK;8BACLA,UAAK;uBAKLA,UAAK;2BAGLA,UAAK;4BAGLA,UAAK;+BAILC,iBAAY,SAAC,YAAY;+BAGzBA,iBAAY,SAAC,YAAY;;;;QCzB5B;;QACS,qBAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SACnD;;;;gBATFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;oBAClD,OAAO,EAAE,CAACC,mBAAY,EAAEC,qBAAa,CAAC;oBACtC,OAAO,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;oBAC7C,eAAe,EAAE,CAAC,gBAAgB,CAAC;iBACpC;;;ICXD;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core"),require("@angular/cdk/overlay"),require("rxjs/operators"),require("@angular/cdk/portal"),require("mis-crystal-design-system/utils"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/tooltip",["exports","@angular/core","@angular/cdk/overlay","rxjs/operators","@angular/cdk/portal","mis-crystal-design-system/utils","@angular/common"],o):o(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].tooltip={}),t.ng.core,t.ng.cdk.overlay,t.rxjs.operators,t.ng.cdk.portal,t["mis-crystal-design-system"].utils,t.ng.common)}(this,(function(t,o,i,
|
|
1
|
+
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core"),require("@angular/cdk/overlay"),require("rxjs/operators"),require("@angular/cdk/portal"),require("mis-crystal-design-system/utils"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/tooltip",["exports","@angular/core","@angular/cdk/overlay","rxjs/operators","@angular/cdk/portal","mis-crystal-design-system/utils","@angular/common"],o):o(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].tooltip={}),t.ng.core,t.ng.cdk.overlay,t.rxjs.operators,t.ng.cdk.portal,t["mis-crystal-design-system"].utils,t.ng.common)}(this,(function(t,o,e,i,n,r,s){"use strict";var l=function(){function t(){this.toolTipText="",this.toolTipPosition="bottom",this.toolTipTextAlignment=""}return t.prototype.ngOnInit=function(){},t.prototype.ngAfterViewInit=function(){var t;if(null===(t=this.container)||void 0===t?void 0:t.nativeElement)if("top"!==this.toolTipPosition&&"bottom"!==this.toolTipPosition){if("left"===this.toolTipPosition){o=this.container.nativeElement.getBoundingClientRect();this.container.nativeElement.style.left=-o.width+"px"}}else{var o=this.container.nativeElement.getBoundingClientRect();this.container.nativeElement.style.left=o.width/-2+"px"}},t}();l.decorators=[{type:o.Component,args:[{selector:"mis-tooltip",template:"<div id=\"tooltip-container\" *ngIf=\"toolTipText.length > 0\" #container>\n <div id=\"tooltip\">\n <div id=\"tooltip-text\" [innerHTML]=\"toolTipText\" \n [ngStyle]=\"{'text-align' : toolTipTextAlignment ? toolTipTextAlignment : '' }\"></div>\n <span\n id=\"arrow\"\n [ngClass]=\"{\n 'arrow-left': toolTipPosition === 'left',\n 'arrow-right': toolTipPosition === 'right',\n 'arrow-top': toolTipPosition === 'top',\n 'arrow-bottom': toolTipPosition === 'bottom'\n }\"\n ></span>\n </div>\n</div>\n",styles:["#tooltip-container{position:absolute;z-index:1}#tooltip{position:relative;display:block;padding:8px 12px;border-radius:8px;color:#fff;background:#181f33;font-family:Lato,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:20px;text-align:center;letter-spacing:.2px}#tooltip-text{width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#arrow{position:absolute;height:12px;width:12px;background:#181f33;z-index:1}.arrow-top{bottom:-6px}.arrow-bottom,.arrow-top{left:50%;transform:translateX(-50%) rotate(-45deg);-webkit-transform:translateX(-50%) rotate(-45deg)}.arrow-bottom{top:-6px}.arrow-left{right:-6px}.arrow-left,.arrow-right{top:50%;transform:translateY(-50%) rotate(-45deg);-webkit-transform:translateY(-50%) rotate(-45deg)}.arrow-right{left:-6px}"]}]}],l.ctorParameters=function(){return[]},l.propDecorators={container:[{type:o.ViewChild,args:["container"]}]};var p=function(){function t(t,o,e){this.element=t,this.overlay=o,this.viewContainerRef=e,this.isToolTipDisplayed=!1,this.toolTipText="",this.toolTipTextAlignment="",this.toolTipPosition="bottom",this.showOnHover=!0}return Object.defineProperty(t.prototype,"showToolTip",{set:function(t){this.isToolTipDisplayed=t,t?this.displayToolTip():this.hideToolTip()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{set:function(t){this.toolTipText=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{set:function(t){this.toolTipPosition=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alignText",{set:function(t){this.toolTipTextAlignment=t},enumerable:!1,configurable:!0}),t.prototype.onMouseEnter=function(){this.showOnHover&&this.displayToolTip()},t.prototype.onMouseLeave=function(){this.showOnHover&&this.hideToolTip()},t.prototype.ngOnInit=function(){},t.prototype.ngAfterViewInit=function(){this.isToolTipDisplayed?this.displayToolTip():this.hideToolTip()},t.prototype.displayToolTip=function(){var t=this,o=this.overlay.position().flexibleConnectedTo(this.element).withPositions(r.genPositionPairs({positionX:"center",positionY:"top"===this.toolTipPosition?"top":"center",offsetX:this.positionTooltip("OFFSET_X"),offsetY:this.positionTooltip("OFFSET_Y")},!1)).withPush(!0),s=new e.OverlayConfig({hasBackdrop:!1,positionStrategy:o,scrollStrategy:this.overlay.scrollStrategies.reposition()});this.overlayRef=this.overlay.create(s);var p=new n.ComponentPortal(l,this.viewContainerRef),a=this.overlayRef.attach(p);a.instance.toolTipText=this.toolTipText,a.instance.toolTipPosition=this.toolTipPosition,a.instance.toolTipTextAlignment=this.toolTipTextAlignment,this.overlayRef.backdropClick().pipe(i.take(1)).subscribe((function(){t.hideToolTip()}))},t.prototype.positionTooltip=function(t){return"OFFSET_X"===t?"right"===this.toolTipPosition?this.element.nativeElement.offsetWidth/2+8:"left"===this.toolTipPosition?-1*(this.element.nativeElement.offsetWidth/2+8):"top"===this.toolTipPosition||"bottom"===this.toolTipPosition?0:8:"OFFSET_Y"===t?"right"===this.toolTipPosition||"left"===this.toolTipPosition?-18:"top"===this.toolTipPosition?-44:"bottom"===this.toolTipPosition?this.element.nativeElement.offsetHeight/2+8:8:void 0},t.prototype.hideToolTip=function(){var t,o;null===(t=this.overlayRef)||void 0===t||t.detach(),null===(o=this.overlayRef)||void 0===o||o.dispose()},t}();p.decorators=[{type:o.Directive,args:[{selector:"[misToolTip]"}]}],p.ctorParameters=function(){return[{type:o.ElementRef},{type:e.Overlay},{type:o.ViewContainerRef}]},p.propDecorators={showOnHover:[{type:o.Input}],showToolTip:[{type:o.Input}],text:[{type:o.Input}],position:[{type:o.Input}],alignText:[{type:o.Input}],onMouseEnter:[{type:o.HostListener,args:["mouseenter"]}],onMouseLeave:[{type:o.HostListener,args:["mouseleave"]}]};var a=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t}();a.decorators=[{type:o.NgModule,args:[{declarations:[p,l],imports:[s.CommonModule,e.OverlayModule],exports:[p,l],entryComponents:[l]}]}],t.ToolTipComponent=l,t.ToolTipDirective=p,t.ToolTipModule=a,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-tooltip.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/mis-components/tooltip/tooltip-container/tooltip.component.ts","../../../projects/mis-components/tooltip/tooltip.directive.ts","../../../projects/mis-components/tooltip/tooltip.module.ts"],"names":["ToolTipComponent","this","toolTipText","toolTipPosition","prototype","ngOnInit","ngAfterViewInit","_a","container","nativeElement","eleWidth","getBoundingClientRect","style","left","width","Component","args","selector","template","ViewChild","ToolTipDirective","element","overlay","viewContainerRef","isToolTipDisplayed","showOnHover","Object","defineProperty","value","displayToolTip","hideToolTip","onMouseEnter","onMouseLeave","_this","positionStrategy","position","flexibleConnectedTo","withPositions","genPositionPairs","positionX","positionY","offsetX","positionTooltip","offsetY","withPush","config","OverlayConfig","hasBackdrop","scrollStrategy","scrollStrategies","reposition","overlayRef","create","tempRef","ComponentPortal","tooltipRef","attach","instance","backdropClick","pipe","take","subscribe","type","offsetWidth","offsetHeight","detach","_b","dispose","Directive","ElementRef","Overlay","ViewContainerRef","Input","HostListener","ToolTipModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","OverlayModule","exports","entryComponents"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../projects/mis-components/tooltip/tooltip-container/tooltip.component.ts","../../../projects/mis-components/tooltip/tooltip.directive.ts","../../../projects/mis-components/tooltip/tooltip.module.ts"],"names":["ToolTipComponent","this","toolTipText","toolTipPosition","toolTipTextAlignment","prototype","ngOnInit","ngAfterViewInit","_a","container","nativeElement","eleWidth","getBoundingClientRect","style","left","width","Component","args","selector","template","ViewChild","ToolTipDirective","element","overlay","viewContainerRef","isToolTipDisplayed","showOnHover","Object","defineProperty","value","displayToolTip","hideToolTip","onMouseEnter","onMouseLeave","_this","positionStrategy","position","flexibleConnectedTo","withPositions","genPositionPairs","positionX","positionY","offsetX","positionTooltip","offsetY","withPush","config","OverlayConfig","hasBackdrop","scrollStrategy","scrollStrategies","reposition","overlayRef","create","tempRef","ComponentPortal","tooltipRef","attach","instance","backdropClick","pipe","take","subscribe","type","offsetWidth","offsetHeight","detach","_b","dispose","Directive","ElementRef","Overlay","ViewContainerRef","Input","HostListener","ToolTipModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","OverlayModule","exports","entry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D,WAAzBF,KAAKE,gBACvC,EACA,EAEO,aAAT4D,EAC4B,UAAzB9D,KAAKE,iBAAwD,SAAzBF,KAAKE,iBAC3C,GACwB,QAAzBF,KAAKE,iBACJ,GACwB,WAAzBF,KAAKE,gBACLF,KAAKqB,QAAQZ,cAAcuD,aAAe,EAAI,EAC9C,OAPJ,GAUF5C,EAAAhB,UAAA0B,YAAA,mBACiB,QAAfvB,EAAAP,KAAKmD,kBAAU,IAAA5C,GAAAA,EAAE0D,SACF,QAAfC,EAAAlE,KAAKmD,kBAAU,IAAAe,GAAAA,EAAEC,oCAlGpBC,EAAAA,UAASpD,KAAA,CAAC,CACTC,SAAU,4DATuBoD,EAAAA,kBAC1BC,EAAAA,eADmEC,EAAAA,yDAkBzEC,EAAAA,2BACAA,EAAAA,oBAKAA,EAAAA,wBAGAA,EAAAA,yBAGAA,EAAAA,4BAIAC,EAAAA,aAAYzD,KAAA,CAAC,oCAGbyD,EAAAA,aAAYzD,KAAA,CAAC,kCCzBhB,SAAA0D,YACSA,EAAAC,QAAP,WACE,MAAO,CAAEC,SAAUF,EAAeG,UAAW,8BARhDC,EAAAA,SAAQ9D,KAAA,CAAC,CACR+D,aAAc,CAAC3D,EAAkBrB,GACjCiF,QAAS,CAACC,EAAAA,aAAcC,EAAAA,eACxBC,QAAS,CAAC/D,EAAkBrB,GAC5BqF,gBAAiB,CAACrF","sourcesContent":["import { AfterViewInit, Component, ElementRef, Inject, OnInit, ViewChild } from \"@angular/core\";\nimport { ITooltipPositions } from \"../models/tooltip.model\";\n\n@Component({\n selector: \"mis-tooltip\",\n templateUrl: \"./tooltip.component.html\",\n styleUrls: [\"./tooltip.component.scss\"]\n})\nexport class ToolTipComponent implements OnInit, AfterViewInit {\n public toolTipText: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n public toolTipTextAlignment: string = \"\";\n\n @ViewChild(\"container\") container: ElementRef;\n\n constructor() {}\n ngOnInit() {}\n ngAfterViewInit() {\n if (!this.container?.nativeElement) return;\n if (this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = eleWidth.width / -2 + \"px\";\n return;\n }\n if (this.toolTipPosition === \"left\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = -eleWidth.width + \"px\";\n }\n }\n}\n","import { AfterViewInit, Directive, ElementRef, HostListener, Input, OnInit, ViewContainerRef } from \"@angular/core\";\nimport { Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { take } from \"rxjs/operators\";\nimport { ComponentPortal } from \"@angular/cdk/portal\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\nimport { genPositionPairs } from \"mis-crystal-design-system/utils\";\nimport { ITooltipPositions } from \"./models/tooltip.model\";\n\n@Directive({\n selector: \"[misToolTip]\"\n})\nexport class ToolTipDirective implements OnInit, AfterViewInit {\n public isToolTipDisplayed: boolean = false;\n public toolTipText: string = \"\";\n public toolTipTextAlignment: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n private overlayRef: OverlayRef;\n\n @Input() showOnHover: boolean = true;\n @Input() set showToolTip(value: boolean) {\n this.isToolTipDisplayed = value;\n if (value) this.displayToolTip();\n else this.hideToolTip();\n }\n @Input() set text(value: string) {\n this.toolTipText = value;\n }\n @Input() set position(value: ITooltipPositions) {\n this.toolTipPosition = value;\n }\n @Input() set alignText(value: string) {\n this.toolTipTextAlignment = value;\n }\n\n @HostListener(\"mouseenter\") onMouseEnter() {\n if (this.showOnHover) this.displayToolTip();\n }\n @HostListener(\"mouseleave\") onMouseLeave() {\n if (this.showOnHover) this.hideToolTip();\n }\n\n constructor(private element: ElementRef, private overlay: Overlay, private viewContainerRef: ViewContainerRef) {}\n\n ngOnInit() {}\n ngAfterViewInit() {\n if (this.isToolTipDisplayed) this.displayToolTip();\n else this.hideToolTip();\n }\n\n displayToolTip() {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.element)\n .withPositions(\n genPositionPairs(\n {\n positionX: \"center\",\n positionY: this.toolTipPosition === \"top\" ? \"top\" : \"center\",\n offsetX: this.positionTooltip(\"OFFSET_X\"),\n offsetY: this.positionTooltip(\"OFFSET_Y\")\n },\n false\n )\n )\n .withPush(true);\n const config = new OverlayConfig({\n hasBackdrop: false,\n positionStrategy,\n scrollStrategy: this.overlay.scrollStrategies.reposition()\n });\n this.overlayRef = this.overlay.create(config);\n const tempRef = new ComponentPortal(ToolTipComponent, this.viewContainerRef);\n const tooltipRef = this.overlayRef.attach(tempRef);\n tooltipRef.instance.toolTipText = this.toolTipText;\n tooltipRef.instance.toolTipPosition = this.toolTipPosition;\n tooltipRef.instance.toolTipTextAlignment = this.toolTipTextAlignment;\n this.overlayRef\n .backdropClick()\n .pipe(take(1))\n .subscribe(() => {\n this.hideToolTip();\n });\n }\n\n positionTooltip(type: \"OFFSET_X\" | \"OFFSET_Y\") {\n if (type === \"OFFSET_X\") {\n return this.toolTipPosition === \"right\"\n ? this.element.nativeElement.offsetWidth / 2 + 8\n : this.toolTipPosition === \"left\"\n ? (this.element.nativeElement.offsetWidth / 2 + 8) * -1\n : this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\"\n ? 0\n : 8;\n }\n if (type !== \"OFFSET_Y\") return;\n return this.toolTipPosition === \"right\" || this.toolTipPosition === \"left\"\n ? -18\n : this.toolTipPosition === \"top\"\n ? -44\n : this.toolTipPosition === \"bottom\"\n ? this.element.nativeElement.offsetHeight / 2 + 8\n : 8;\n }\n\n hideToolTip() {\n this.overlayRef?.detach();\n this.overlayRef?.dispose();\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ToolTipDirective } from \"./tooltip.directive\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\n\n@NgModule({\n declarations: [ToolTipDirective, ToolTipComponent],\n imports: [CommonModule, OverlayModule],\n exports: [ToolTipDirective, ToolTipComponent],\n entryComponents: [ToolTipComponent]\n})\nexport class ToolTipModule {\n static forRoot(): ModuleWithProviders<ToolTipModule> {\n return { ngModule: ToolTipModule, providers: [] };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"DropdownComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"mis-dropdown","template":"<div (click)=\"setUpAsyncDataSearch()\"\n class=\"main-container\"\n [ngStyle]=\"{\n height: height.length > 0 ? height : '',\n width: width.length > 0 ? width : ''\n }\"\n>\n <div\n class=\"dropdown\"\n #select\n tabindex=\"0\"\n (keyup.enter)=\"toggleDropdown()\"\n (click)=\"toggleDropdown()\"\n [ngStyle]=\"customStyles\"\n [ngClass]=\"isOpen ? 'dropdown-port': ''\"\n >\n <img class=\"img-container\" [src]=\"selectedItem.customIcon\" *ngIf=\"selectedItem.customIcon\">\n <div class=\"label\">\n <p class=\"text\" *ngIf=\"!showOnlyIcon; else showIcon\">\n {{ multiLine ? selectedItem.label?.primaryText : selectedItem.label || label }}\n </p>\n <ng-template #showIcon>\n <p class=\"text\" *ngIf=\"!selectedItem.icon\">\n {{ label }}\n </p>\n <img class=\"icon\" *ngIf=\"!!selectedItem.icon\" [src]=\"selectedItem.icon\" alt=\"no img\" />\n </ng-template>\n </div>\n <svg\n class=\"handle\"\n [ngStyle]=\"{ transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)' }\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M13.825 7.15845L10 10.9751L6.175 7.15845L5 8.33345L10 13.3334L15 8.33345L13.825 7.15845Z\"\n fill=\"#181F33\"\n />\n </svg>\n </div>\n</div>\n<ng-template #popupContainer>\n <div\n class=\"popup-container\"\n [ngStyle]=\"{\n height: dropdownListHeight,\n width: dropdownListWidth\n }\"\n >\n <div *ngIf=\"searchEnabled\" class=\"search-container\">\n <svg\n *ngIf=\"!isSearchInputFocused\"\n class=\"search-icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M4.21508 11.1456C4.21508 7.3179 7.33722 4.21165 11.1926 4.21165C15.048 4.21165 18.1702 7.3179 18.1702 11.1456C18.1702 12.6931 17.6599 14.1226 16.7972 15.2767L15.3685 16.7013C14.2044 17.5668 12.759 18.0796 11.1926 18.0796C7.33722 18.0796 4.21508 14.9734 4.21508 11.1456ZM15.9421 17.7835C14.6021 18.7329 12.9627 19.2913 11.1926 19.2913C6.66977 19.2913 3 15.6461 3 11.1456C3 6.64512 6.66977 3 11.1926 3C15.7155 3 19.3852 6.64512 19.3852 11.1456C19.3852 12.9371 18.8037 14.5931 17.8184 15.9375L19.8361 17.4048C20.6705 17.912 21.7554 18.6543 20.2454 20.215C18.7353 21.7756 18.0099 20.6663 17.4991 19.8364L15.9421 17.7835Z\"\n fill=\"#6A737D\"\n />\n </svg>\n <input\n [ngModel]=\"searchInput\"\n [ngStyle]=\"{\n paddingLeft: isSearchInputFocused ? '12px' : '45px',\n border: isSearchInputFocused ? '1px solid #0937B2' : '1px solid #e0e0e0',\n paddingRight: isSearchInputFocused ? '45px' : '10px'\n }\"\n (ngModelChange)=\"searchInputOnChange($event)\"\n [placeholder]=\"isSearchInputFocused ? '' : searchLabel\"\n (focus)=\"searchInputFocused(true)\"\n class=\"search-input\"\n />\n <svg\n *ngIf=\"isSearchInputFocused\"\n class=\"cancel-icon\"\n (click)=\"searchInputCanceled($event)\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M8.87446 7.32144C8.44588 6.89285 7.751 6.89285 7.32242 7.32144C6.89383 7.75002 6.89383 8.4449 7.32242 8.87349L10.4488 11.9999L7.32357 15.1252C6.89498 15.5538 6.89498 16.2486 7.32357 16.6772C7.75215 17.1058 8.44703 17.1058 8.87561 16.6772L12.0009 13.552L15.1261 16.6772C15.5547 17.1058 16.2496 17.1058 16.6781 16.6772C17.1067 16.2486 17.1067 15.5537 16.6781 15.1251L13.5529 11.9999L16.6793 8.87354C17.1079 8.44496 17.1079 7.75008 16.6793 7.3215C16.2507 6.89291 15.5558 6.89291 15.1273 7.3215L12.0009 10.4479L8.87446 7.32144Z\"\n fill=\"#6A737D\"\n />\n </svg>\n </div>\n <div class=\"status-container\" *ngIf=\"loading\">\n <mis-loader [mobileView]=\"true\"></mis-loader>\n </div>\n <div class=\"items\" *ngIf=\"!loading\"> \n <cdk-virtual-scroll-viewport [itemSize]=\"itemSizeForCdk\" class=\"dropdown-viewport\" >\n <div\n class=\"item\"\n tabindex=\"0\"\n [ngClass]=\"{ 'item-disabled': item.disabled, 'item-selected': (higlightSelectedValue && item.value === selectedItem.value), 'icon-only' : showOnlyIcon }\"\n (click)=\"item.disabled ? null : selectItem(item)\"\n (keyup.enter)=\"item.disabled ? null : selectItem(item)\"\n *cdkVirtualFor=\"let item of searchInput ? searchData : data;\"\n >\n <div class=\"label\" *ngIf=\"!showOnlyIcon\" [ngStyle]=\"{ width: item.icon ? '90%' : '100%', 'display': multiLine ? 'flex': 'inherit', 'flex-direction': multiLine ? 'column': 'inherit' }\">\n <span class=\"primaryText\" [ngStyle]=\"getIconStyles(item.icon, activeItem)\">{{ multiLine ? item.label?.primaryText : item.label }}</span>\n <span class=\"secondaryText\" *ngIf=\"multiLine\" [ngStyle]=\"getIconStyles(item.icon, activeItem)\"> {{ item.label?.secondaryText ? item.label?.secondaryText : additionalInfoMessage }} </span>\n </div>\n <div class=\"icon-container\" *ngIf=\"item.icon\">\n <img class=\"icon\" [src]=\"item.icon\" alt=\"no img\" />\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n <div class=\"noData\" *ngIf=\"(searchInput ? searchData : data).length === 0\">\n {{ searchInput === \"\" ? noDataMessage : \"No results\" }}\n </div>\n </div>\n </div>\n</ng-template>\n","styles":[".main-container{position:relative;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;height:32px;width:256px;font-family:Lato,sans-serif!important}.main-container .dropdown{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;height:inherit;border:1px solid #e0e0e0;border-radius:6px;background-color:#fff;cursor:pointer;display:flex;justify-content:space-between;align-items:center;width:100%;box-sizing:border-box;padding:0 12px}.main-container .dropdown:focus-visible,.main-container .dropdown:hover{background-color:#f5f7fc;outline:none}.main-container .dropdown .label{box-sizing:border-box;display:flex;justify-content:flex-start;align-items:center;width:calc(100% - 32px)}.main-container .dropdown .label,.main-container .dropdown .label .text{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.main-container .dropdown .label .text{margin:0!important;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.main-container .dropdown .label .count{background-color:#e0e0e0;border-radius:50%;padding:2px 7px;margin:0}.main-container .dropdown .handle{width:24px;height:24px;transition:.3s;position:absolute;right:12px;border-radius:50%;overflow:hidden}.main-container .dropdown .img-container{width:20px;height:20px}.main-container .dropdown-port{background:#e6ebf7}.popup-container{width:100%;max-height:340px;padding-bottom:0;border:1px solid #e0e0e0;border-radius:8px;background-color:#fff;box-shadow:0 12px 24px 0 rgba(0,0,0,.12);display:flex;flex-direction:column;overflow:hidden;justify-content:space-between}.popup-container::-webkit-scrollbar{width:0;height:0}.popup-container .search-container{position:relative;box-sizing:border-box;padding:8px}.popup-container .search-container .search-icon{position:absolute;width:24px;height:24px;top:50%;transform:translateY(-50%);left:18px;z-index:1}.popup-container .search-container .search-input{height:40px;width:100%;padding:12px;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:8px;outline:none;caret-color:#0937b2;font-style:normal;font-weight:400;font-size:12px;line-height:18px;display:flex;align-items:center;letter-spacing:.2px;color:#181f33}.popup-container .search-container .cancel-icon{position:absolute;cursor:pointer;width:24px;height:24px;top:50%;transform:translateY(-50%);right:18px;z-index:1}.popup-container .items{padding:8px 0 8px 8px;overflow-y:scroll}.popup-container .items::-webkit-scrollbar{width:5px;height:0}.popup-container .items::-webkit-scrollbar-thumb{background:#9aa7b4;border-radius:10px}.popup-container .items .noData{display:flex;justify-content:center;align-items:center;font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.popup-container .items .dropdown-viewport{height:200px}.popup-container .items .dropdown-viewport .item{cursor:pointer;display:flex;justify-content:flex-start;align-items:center;gap:10px;padding:8px 12px;border-radius:6px;height:auto;letter-spacing:.2px;color:#181f33}.popup-container .items .dropdown-viewport .item:focus-visible,.popup-container .items .dropdown-viewport .item:hover{background-color:#f5f7fc;outline:none}.popup-container .items .dropdown-viewport .item .label{width:100%;line-height:20px;font-size:14px;font-style:normal;font-weight:400;text-overflow:ellipsis;overflow:hidden}.popup-container .items .dropdown-viewport .item .label .primaryText{color:#181f33;font-family:Lato;font-size:14px;line-height:20px;letter-spacing:.2px}.popup-container .items .dropdown-viewport .item .label .secondaryText{color:#6a737d;font-family:Lato;font-size:14px;line-height:20px;letter-spacing:.2px}.popup-container .items .dropdown-viewport .item .icon-container{width:10%;display:flex;justify-content:flex-end}.popup-container .items .dropdown-viewport .item .icon-container .icon{width:20px;height:20px}.popup-container .items .item-disabled{cursor:not-allowed!important}.popup-container .items .item-disabled:focus-visible,.popup-container .items .item-disabled:hover{background-color:transparent!important;outline:none!important}.popup-container .items .item-disabled .label>span{color:#929dab!important;-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.popup-container .items .item-selected{background-color:#e0e6f6;outline:none}.popup-container .items .icon-only{justify-content:center!important}::-webkit-scrollbar{height:8px;width:8px;background:#fff;border-radius:13px}::-webkit-scrollbar-thumb{background:#c8cdd3;border-radius:13px;cursor:pointer}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}"]}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"character":3}}]}],"width":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":3}}]}],"itemSizeForCdk":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"showOnlyIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"higlightSelectedValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":23,"character":3}}]}],"dropdownListHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":3}}]}],"dropdownListWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"dropdownListPosition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"searchEnabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"selectedItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":3}}]}],"noDataMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"multiLine":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":3}}]}],"additionalInfoMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"scrollIntoView":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"searchLabel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"customStyles":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"activeItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"onChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":37,"character":3}}]}],"selectElement":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":38,"character":3},"arguments":["select",{"static":false}]}]}],"popupContainer":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":39,"character":3},"arguments":["popupContainer",{"static":false}]}]}],"viewPort":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":40,"character":3},"arguments":[{"__symbolic":"reference","module":"@angular/cdk/scrolling","name":"CdkVirtualScrollViewport","line":40,"character":13}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":42,"character":28},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"Overlay","line":42,"character":57},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":42,"character":92}]}],"ngOnInit":[{"__symbolic":"method"}],"getIconStyles":[{"__symbolic":"method"}],"setUpAsyncDataSearch":[{"__symbolic":"method"}],"filterByValue":[{"__symbolic":"method"}],"filterByPrimaryText":[{"__symbolic":"method"}],"searchInputOnChange":[{"__symbolic":"method"}],"searchInputFocused":[{"__symbolic":"method"}],"searchInputCanceled":[{"__symbolic":"method"}],"toggleDropdown":[{"__symbolic":"method"}],"openDropdown":[{"__symbolic":"method"}],"selectItem":[{"__symbolic":"method"}],"onCancel":[{"__symbolic":"method"}]}},"DropdownItem":{"__symbolic":"interface"},"DropdownModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":8,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"DropdownComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":10,"character":12},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":10,"character":26},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"OverlayModule","line":10,"character":39},{"__symbolic":"reference","module":"@angular/cdk-experimental/scrolling","name":"ScrollingModule","line":10,"character":54},{"__symbolic":"reference","module":"mis-crystal-design-system/loader","name":"LoaderModule","line":10,"character":70}],"exports":[{"__symbolic":"reference","name":"DropdownComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"DropdownModule"},"providers":[]}}}}},"origins":{"DropdownComponent":"./dropdown.component","DropdownItem":"./dropdown.component","DropdownModule":"./dropdown.module"},"importAs":"mis-crystal-design-system/dropdown"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"DropdownComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"mis-dropdown","template":"<div (click)=\"setUpAsyncDataSearch()\"\n class=\"main-container\"\n [ngStyle]=\"{\n height: height.length > 0 ? height : '',\n width: width.length > 0 ? width : ''\n }\"\n>\n <div\n class=\"dropdown\"\n #select\n tabindex=\"0\"\n (keyup.enter)=\"toggleDropdown()\"\n (click)=\"toggleDropdown()\"\n [ngStyle]=\"customStyles\"\n [ngClass]=\"isOpen ? 'dropdown-port': ''\"\n >\n <img class=\"img-container\" [src]=\"selectedItem.customIcon\" *ngIf=\"selectedItem.customIcon\">\n <div class=\"label\">\n <p class=\"text\" *ngIf=\"!showOnlyIcon; else showIcon\">\n {{ multiLine ? selectedItem.label?.primaryText : selectedItem.label || label }}\n </p>\n <ng-template #showIcon>\n <p class=\"text\" *ngIf=\"!selectedItem.icon\">\n {{ label }}\n </p>\n <img class=\"icon\" *ngIf=\"!!selectedItem.icon\" [src]=\"selectedItem.icon\" alt=\"no img\" />\n </ng-template>\n </div>\n <svg\n class=\"handle\"\n [ngStyle]=\"{ transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)' }\"\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M13.825 7.15845L10 10.9751L6.175 7.15845L5 8.33345L10 13.3334L15 8.33345L13.825 7.15845Z\"\n fill=\"#181F33\"\n />\n </svg>\n </div>\n</div>\n<ng-template #popupContainer>\n <div\n class=\"popup-container\"\n [ngStyle]=\"{\n height: dropdownListHeight,\n width: dropdownListWidth\n }\"\n >\n <div *ngIf=\"searchEnabled\" class=\"search-container\">\n <svg\n *ngIf=\"!isSearchInputFocused\"\n class=\"search-icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M4.21508 11.1456C4.21508 7.3179 7.33722 4.21165 11.1926 4.21165C15.048 4.21165 18.1702 7.3179 18.1702 11.1456C18.1702 12.6931 17.6599 14.1226 16.7972 15.2767L15.3685 16.7013C14.2044 17.5668 12.759 18.0796 11.1926 18.0796C7.33722 18.0796 4.21508 14.9734 4.21508 11.1456ZM15.9421 17.7835C14.6021 18.7329 12.9627 19.2913 11.1926 19.2913C6.66977 19.2913 3 15.6461 3 11.1456C3 6.64512 6.66977 3 11.1926 3C15.7155 3 19.3852 6.64512 19.3852 11.1456C19.3852 12.9371 18.8037 14.5931 17.8184 15.9375L19.8361 17.4048C20.6705 17.912 21.7554 18.6543 20.2454 20.215C18.7353 21.7756 18.0099 20.6663 17.4991 19.8364L15.9421 17.7835Z\"\n fill=\"#6A737D\"\n />\n </svg>\n <input\n [ngModel]=\"searchInput\"\n [ngStyle]=\"{\n paddingLeft: isSearchInputFocused ? '12px' : '45px',\n border: isSearchInputFocused ? '1px solid #0937B2' : '1px solid #e0e0e0',\n paddingRight: isSearchInputFocused ? '45px' : '10px'\n }\"\n (ngModelChange)=\"searchInputOnChange($event)\"\n [placeholder]=\"isSearchInputFocused ? '' : searchLabel\"\n (focus)=\"searchInputFocused(true)\"\n class=\"search-input\"\n />\n <svg\n *ngIf=\"isSearchInputFocused\"\n class=\"cancel-icon\"\n (click)=\"searchInputCanceled($event)\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M8.87446 7.32144C8.44588 6.89285 7.751 6.89285 7.32242 7.32144C6.89383 7.75002 6.89383 8.4449 7.32242 8.87349L10.4488 11.9999L7.32357 15.1252C6.89498 15.5538 6.89498 16.2486 7.32357 16.6772C7.75215 17.1058 8.44703 17.1058 8.87561 16.6772L12.0009 13.552L15.1261 16.6772C15.5547 17.1058 16.2496 17.1058 16.6781 16.6772C17.1067 16.2486 17.1067 15.5537 16.6781 15.1251L13.5529 11.9999L16.6793 8.87354C17.1079 8.44496 17.1079 7.75008 16.6793 7.3215C16.2507 6.89291 15.5558 6.89291 15.1273 7.3215L12.0009 10.4479L8.87446 7.32144Z\"\n fill=\"#6A737D\"\n />\n </svg>\n </div>\n <div class=\"status-container\" *ngIf=\"loading\">\n <mis-loader [mobileView]=\"true\"></mis-loader>\n </div>\n <div class=\"items\" *ngIf=\"!loading\"> \n <cdk-virtual-scroll-viewport [itemSize]=\"itemSizeForCdk\" class=\"dropdown-viewport\" [style.height]=\"data | calculateContainerHeight:itemSizeForCdk:visibleItems\">\n <div\n class=\"item\"\n tabindex=\"0\"\n [ngClass]=\"{ 'item-disabled': item.disabled, 'item-selected': (higlightSelectedValue && item.value === selectedItem.value), 'icon-only' : showOnlyIcon }\"\n (click)=\"item.disabled ? null : selectItem(item)\"\n (keyup.enter)=\"item.disabled ? null : selectItem(item)\"\n *cdkVirtualFor=\"let item of searchInput ? searchData : data;\"\n >\n <div class=\"label\" *ngIf=\"!showOnlyIcon\" [ngStyle]=\"{ width: item.icon ? '90%' : '100%', 'display': multiLine ? 'flex': 'inherit', 'flex-direction': multiLine ? 'column': 'inherit' }\">\n <span class=\"primaryText\" [ngStyle]=\"getIconStyles(item.icon, activeItem)\">{{ multiLine ? item.label?.primaryText : item.label }}</span>\n <span class=\"secondaryText\" *ngIf=\"multiLine\" [ngStyle]=\"getIconStyles(item.icon, activeItem)\"> {{ item.label?.secondaryText ? item.label?.secondaryText : additionalInfoMessage }} </span>\n </div>\n <div class=\"icon-container\" *ngIf=\"item.icon\">\n <img class=\"icon\" [src]=\"item.icon\" alt=\"no img\" />\n </div>\n </div>\n </cdk-virtual-scroll-viewport>\n <div class=\"noData\" *ngIf=\"(searchInput ? searchData : data).length === 0\">\n {{ searchInput === \"\" ? noDataMessage : \"No results\" }}\n </div>\n </div>\n </div>\n</ng-template>\n","styles":[".main-container{position:relative;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;height:32px;width:256px;font-family:Lato,sans-serif!important}.main-container .dropdown{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;height:inherit;border:1px solid #e0e0e0;border-radius:6px;background-color:#fff;cursor:pointer;display:flex;justify-content:space-between;align-items:center;width:100%;box-sizing:border-box;padding:0 12px}.main-container .dropdown:focus-visible,.main-container .dropdown:hover{background-color:#f5f7fc;outline:none}.main-container .dropdown .label{box-sizing:border-box;display:flex;justify-content:flex-start;align-items:center;width:calc(100% - 32px)}.main-container .dropdown .label,.main-container .dropdown .label .text{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.main-container .dropdown .label .text{margin:0!important;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.main-container .dropdown .label .count{background-color:#e0e0e0;border-radius:50%;padding:2px 7px;margin:0}.main-container .dropdown .handle{width:24px;height:24px;transition:.3s;position:absolute;right:12px;border-radius:50%;overflow:hidden}.main-container .dropdown .img-container{width:20px;height:20px}.main-container .dropdown-port{background:#e6ebf7}.popup-container{width:100%;max-height:340px;padding-bottom:0;border:1px solid #e0e0e0;border-radius:8px;background-color:#fff;box-shadow:0 12px 24px 0 rgba(0,0,0,.12);display:flex;flex-direction:column;overflow:hidden;justify-content:space-between}.popup-container::-webkit-scrollbar{width:0;height:0}.popup-container .search-container{position:relative;box-sizing:border-box;padding:8px}.popup-container .search-container .search-icon{position:absolute;width:24px;height:24px;top:50%;transform:translateY(-50%);left:18px;z-index:1}.popup-container .search-container .search-input{height:40px;width:100%;padding:12px;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:8px;outline:none;caret-color:#0937b2;font-style:normal;font-weight:400;font-size:12px;line-height:18px;display:flex;align-items:center;letter-spacing:.2px;color:#181f33}.popup-container .search-container .cancel-icon{position:absolute;cursor:pointer;width:24px;height:24px;top:50%;transform:translateY(-50%);right:18px;z-index:1}.popup-container .items{padding:8px 0 8px 8px;overflow-y:scroll}.popup-container .items::-webkit-scrollbar{width:5px;height:0}.popup-container .items::-webkit-scrollbar-thumb{background:#9aa7b4;border-radius:10px}.popup-container .items .noData{display:flex;justify-content:center;align-items:center;font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.popup-container .items .dropdown-viewport .item{cursor:pointer;display:flex;justify-content:flex-start;align-items:center;gap:10px;padding:8px 12px;border-radius:6px;height:auto;letter-spacing:.2px;color:#181f33}.popup-container .items .dropdown-viewport .item:focus-visible,.popup-container .items .dropdown-viewport .item:hover{background-color:#f5f7fc;outline:none}.popup-container .items .dropdown-viewport .item .label{width:100%;line-height:20px;font-size:14px;font-style:normal;font-weight:400;text-overflow:ellipsis;overflow:hidden}.popup-container .items .dropdown-viewport .item .label .primaryText{color:#181f33;font-family:Lato;font-size:14px;line-height:20px;letter-spacing:.2px}.popup-container .items .dropdown-viewport .item .label .secondaryText{color:#6a737d;font-family:Lato;font-size:14px;line-height:20px;letter-spacing:.2px}.popup-container .items .dropdown-viewport .item .icon-container{width:10%;display:flex;justify-content:flex-end}.popup-container .items .dropdown-viewport .item .icon-container .icon{width:20px;height:20px}.popup-container .items .item-disabled{cursor:not-allowed!important}.popup-container .items .item-disabled:focus-visible,.popup-container .items .item-disabled:hover{background-color:transparent!important;outline:none!important}.popup-container .items .item-disabled .label>span{color:#929dab!important;-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.popup-container .items .item-selected{background-color:#e0e6f6;outline:none}.popup-container .items .icon-only{justify-content:center!important}::-webkit-scrollbar{height:8px;width:8px;background:#fff;border-radius:13px}::-webkit-scrollbar-thumb{background:#c8cdd3;border-radius:13px;cursor:pointer}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}"]}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":18,"character":3}}]}],"height":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":3}}]}],"width":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"itemSizeForCdk":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"showOnlyIcon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":23,"character":3}}]}],"higlightSelectedValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":3}}]}],"dropdownListHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"dropdownListWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"dropdownListPosition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":27,"character":3}}]}],"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"searchEnabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":3}}]}],"selectedItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"noDataMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":31,"character":3}}]}],"multiLine":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"additionalInfoMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"scrollIntoView":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"searchLabel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"customStyles":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"activeItem":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"onChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":38,"character":3}}]}],"selectElement":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":39,"character":3},"arguments":["select",{"static":false}]}]}],"popupContainer":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":40,"character":3},"arguments":["popupContainer",{"static":false}]}]}],"viewPort":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":41,"character":3},"arguments":[{"__symbolic":"reference","module":"@angular/cdk/scrolling","name":"CdkVirtualScrollViewport","line":41,"character":13}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":43,"character":28},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"Overlay","line":43,"character":57},{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":43,"character":92}]}],"ngOnInit":[{"__symbolic":"method"}],"getIconStyles":[{"__symbolic":"method"}],"setUpAsyncDataSearch":[{"__symbolic":"method"}],"filterByValue":[{"__symbolic":"method"}],"filterByPrimaryText":[{"__symbolic":"method"}],"searchInputOnChange":[{"__symbolic":"method"}],"searchInputFocused":[{"__symbolic":"method"}],"searchInputCanceled":[{"__symbolic":"method"}],"toggleDropdown":[{"__symbolic":"method"}],"openDropdown":[{"__symbolic":"method"}],"selectItem":[{"__symbolic":"method"}],"onCancel":[{"__symbolic":"method"}]}},"DropdownItem":{"__symbolic":"interface"},"DropdownModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":9,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"DropdownComponent"},{"__symbolic":"reference","name":"ɵa"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":11,"character":12},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":11,"character":26},{"__symbolic":"reference","module":"@angular/cdk/overlay","name":"OverlayModule","line":11,"character":39},{"__symbolic":"reference","module":"@angular/cdk-experimental/scrolling","name":"ScrollingModule","line":11,"character":54},{"__symbolic":"reference","module":"mis-crystal-design-system/loader","name":"LoaderModule","line":11,"character":70}],"exports":[{"__symbolic":"reference","name":"DropdownComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"DropdownModule"},"providers":[]}}}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":2,"character":1},"arguments":[{"name":"calculateContainerHeight"}]}],"members":{"transform":[{"__symbolic":"method"}]}}},"origins":{"DropdownComponent":"./dropdown.component","DropdownItem":"./dropdown.component","DropdownModule":"./dropdown.module","ɵa":"./calculate-height.pipe"},"importAs":"mis-crystal-design-system/dropdown"}
|
|
@@ -204,7 +204,7 @@ AsyncDropdownComponent.decorators = [
|
|
|
204
204
|
{ type: Component, args: [{
|
|
205
205
|
selector: "mis-async-search-dropdown",
|
|
206
206
|
template: "<div class=\"dd-wrapper\" [ngClass]=\"{ opened: opened, disabled: disabled, readonly: readonly }\" #ddBtn>\n <div class=\"selected-list\" *ngIf=\"multi && selections.size > 0\">\n <div class=\"chip\" [ngClass]=\"{'chip-md': size === 'md', 'chip-sm': size === 'sm'}\" *ngFor=\"let item of selectedItems\">\n <span [ngClass]=\"{'h6': size === 'md', 'h8-b': size === 'sm'}\" style=\"margin-right: 4px;\">{{item[displayKey]}}</span>\n <span style=\"cursor: pointer;\" (click)=\"removeItem(item)\" [ngStyle]=\"{'font-size': size === 'sm' ? '12px': '14px'}\" class=\"ic-navigation-cancel-24\"></span>\n </div>\n </div>\n <div class=\"search-input\">\n <span class=\"ic-action-search-24\"></span>\n <input *ngIf=\"disableCopyPaste; else enableCopyPaste\" [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" oncopy=\"return false;\" onpaste=\"return false\" oncut=\"return false\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" (focus)=\"defaultCall()\"/>\n <ng-template #enableCopyPaste>\n <input [ngClass]=\"{'ip-md': size === 'md', 'ip-sm': size === 'sm'}\" tabindex=\"0\" type=\"text\" class=\"black-text h6\" #input [placeholder]=\"placeholder\" [formControl]=\"searchInput\" (focus)=\"defaultCall()\" />\n </ng-template>\n <div class=\"ic-navigation-cancel-24 croos-icon\" *ngIf=\"searchInput?.value?.length\" (click)=\"removeInputValue()\"></div>\n </div>\n</div>\n\n<ng-template #dd>\n <div class=\"dd-list\" [ngStyle]=\"{'max-height':height}\" [ngClass]=\"{'dd-list-pd':data.length === 0}\" >\n <ng-container *ngIf=\"loading\">\n <ng-container\n *ngIf=\"customLoader; else defaultLoader\"\n [ngTemplateOutlet]=\"customLoader\"\n ></ng-container>\n <ng-template #defaultLoader>\n <div class=\"status-container\" *ngIf=\"loading && !customLoader\">\n <mis-loader [mobileView]=\"true\"></mis-loader>\n </div>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"error\">\n <div class=\"status-container\">\n <p>Unknown error has occurred, <br> Please try again later.</p>\n </div>\n </ng-container>\n <div *ngIf=\"!loading && !error && data.length > 0\">\n <ng-container *ngFor=\"let item of data\">\n <div (click)=\"selectData(item, false)\">\n <ng-container\n *ngIf=\"customItem; else standardItem\"\n [ngTemplateOutlet]=\"customItem\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n ></ng-container>\n <ng-template #standardItem>\n <div class=\"item\">\n <div class=\"value\">\n <div class=\"primary\">\n {{ item[displayKey] }}\n </div>\n <div class=\"secondary\">\n {{ item[secondaryDisplayKey] }}\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n </ng-container>\n </div>\n <div *ngIf=\"!loading && !error && data.length === 0 && searchInput.value\">\n <div class=\"data-not-found\">No Data Available</div>\n </div>\n </div>\n</ng-template>\n",
|
|
207
|
-
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0
|
|
207
|
+
styles: [".dd-wrapper{background:#fff;border:1px solid #e0e0e0;box-sizing:border-box;border-radius:4px;display:block;cursor:pointer;outline:none}.dd-wrapper.opened,.dd-wrapper:hover{background:#f5f5f5}.dd-wrapper .selected-list{display:flex;justify-content:flex-start;flex-wrap:wrap;gap:4px;padding:8px 16px}.dd-wrapper:focus-within{border-color:#0937b2;background:#f5f5f5}.dd-wrapper.disabled,.dd-wrapper.readonly{pointer-events:none}.search-input{position:relative;border-radius:8px}.search-input input{box-sizing:border-box;outline:none;padding-left:40px;padding-right:24px;background-color:transparent;color:#181f33;border-radius:inherit;border:1px solid transparent;width:100%}.search-input span{font-size:24px;line-height:24px;height:24px;left:8px;padding-top:2px}.search-input .croos-icon,.search-input span{position:absolute;top:50%;transform:translateY(-50%)}.search-input .croos-icon{font-size:16px;width:24px;line-height:16px;height:16px;right:0}.dd-list{padding:8px 0;max-height:200px;background:#fff;box-shadow:0 12px 24px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.12);border-radius:8px;min-width:100%;overflow-y:auto}.dd-list::-webkit-scrollbar{width:8px;border-radius:4px}.dd-list::-webkit-scrollbar-track{background:#fff;border-radius:4px}.dd-list::-webkit-scrollbar-thumb{background:#929dab;border-radius:4px}.dd-list::-webkit-scrollbar-thumb:hover{background:#929dab}.dd-list .item{padding:8px 16px;cursor:pointer}.dd-list .item .disabled{color:#6a737d!important;pointer-events:none}.dd-list .item .value{display:flex;justify-content:space-between;align-items:center}.dd-list .item .value .primary,.dd-list .item .value .secondary{font-style:normal;font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#181f33}.dd-list .item .reason{font-weight:400;font-size:14px;line-height:20px;letter-spacing:.2px;color:#6a737d}.dd-list .item:hover:not(.disabled){background:#f5f7fc}.dd-list .data-not-found{display:flex;justify-content:center;align-items:center;font-size:16px;padding:8px}.dd-list-pd{padding:unset}.chip{display:inline-flex;align-items:center;background:#e0e0e0;cursor:default}.chip span{color:#181f33}.chip-md{border-radius:16px;padding:4px 12px}.chip-sm{border-radius:6px;padding:4px 8px;text-transform:uppercase}.ip-md{padding-top:8px;padding-bottom:8px}.ip-sm{padding-top:3px;padding-bottom:3px}.status-container{display:flex;justify-content:center;align-items:center;height:128px}.status-container p{text-align:center}::ng-deep #spinner{position:relative!important}"]
|
|
208
208
|
},] }
|
|
209
209
|
];
|
|
210
210
|
AsyncDropdownComponent.ctorParameters = () => [
|