@ng-matero/extensions 10.16.1 → 10.16.5
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/alert/_alert-theme.scss +20 -20
- package/alert/alert.component.d.ts +4 -3
- package/alert/mtxAlert.metadata.json +1 -1
- package/bundles/mtxAlert.umd.js +3 -3
- package/bundles/mtxAlert.umd.js.map +1 -1
- package/bundles/mtxAlert.umd.min.js.map +1 -1
- package/bundles/{ng-matero-extensions-button.umd.js → mtxButton.umd.js} +2 -2
- package/bundles/mtxButton.umd.js.map +1 -0
- package/bundles/{ng-matero-extensions-button.umd.min.js → mtxButton.umd.min.js} +1 -1
- package/bundles/{ng-matero-extensions-button.umd.min.js.map → mtxButton.umd.min.js.map} +0 -0
- package/bundles/mtxCheckboxGroup.umd.js +87 -22
- package/bundles/mtxCheckboxGroup.umd.js.map +1 -1
- package/bundles/mtxCheckboxGroup.umd.min.js +1 -1
- package/bundles/mtxCheckboxGroup.umd.min.js.map +1 -1
- package/bundles/mtxColorPicker.umd.js +32 -5
- package/bundles/mtxColorPicker.umd.js.map +1 -1
- package/bundles/mtxColorPicker.umd.min.js +1 -1
- package/bundles/mtxColorPicker.umd.min.js.map +1 -1
- package/bundles/mtxDialog.umd.js +0 -2
- package/bundles/mtxDialog.umd.js.map +1 -1
- package/bundles/mtxDialog.umd.min.js +1 -1
- package/bundles/mtxDialog.umd.min.js.map +1 -1
- package/bundles/mtxFormGroup.umd.js +2 -0
- package/bundles/mtxFormGroup.umd.js.map +1 -1
- package/bundles/mtxFormGroup.umd.min.js +1 -1
- package/bundles/mtxFormGroup.umd.min.js.map +1 -1
- package/bundles/mtxGrid.umd.js +31 -101
- package/bundles/mtxGrid.umd.js.map +1 -1
- package/bundles/mtxGrid.umd.min.js +2 -2
- package/bundles/mtxGrid.umd.min.js.map +1 -1
- package/bundles/mtxLoader.umd.js +1 -1
- package/bundles/mtxLoader.umd.js.map +1 -1
- package/bundles/mtxLoader.umd.min.js +1 -1
- package/bundles/mtxLoader.umd.min.js.map +1 -1
- package/bundles/mtxProgress.umd.js +2 -2
- package/bundles/mtxProgress.umd.js.map +1 -1
- package/bundles/mtxProgress.umd.min.js.map +1 -1
- package/bundles/mtxSelect.umd.js +5 -1
- package/bundles/mtxSelect.umd.js.map +1 -1
- package/bundles/mtxSelect.umd.min.js +1 -1
- package/bundles/mtxSelect.umd.min.js.map +1 -1
- package/bundles/mtxTooltip.umd.js +1 -1
- package/bundles/mtxTooltip.umd.js.map +1 -1
- package/bundles/mtxTooltip.umd.min.js +1 -1
- package/bundles/mtxTooltip.umd.min.js.map +1 -1
- package/bundles/mtxUtils.umd.js.map +1 -1
- package/bundles/mtxUtils.umd.min.js.map +1 -1
- package/button/{ng-matero-extensions-button.d.ts → mtxButton.d.ts} +0 -0
- package/button/{ng-matero-extensions-button.metadata.json → mtxButton.metadata.json} +0 -0
- package/button/package.json +7 -7
- package/checkbox-group/checkbox-group.component.d.ts +15 -11
- package/checkbox-group/mtxCheckboxGroup.metadata.json +1 -1
- package/color-picker/color-picker.component.d.ts +10 -9
- package/color-picker/mtxColorPicker.metadata.json +1 -1
- package/data-grid/_grid-theme.scss +14 -32
- package/data-grid/cell.component.d.ts +2 -1
- package/data-grid/column-menu.component.d.ts +4 -3
- package/data-grid/grid.component.d.ts +7 -20
- package/data-grid/grid.component.scss +51 -5
- package/data-grid/grid.interface.d.ts +18 -36
- package/data-grid/mtxGrid.metadata.json +1 -1
- package/dialog/dialog.config.d.ts +3 -2
- package/dialog/mtxDialog.metadata.json +1 -1
- package/esm2015/alert/alert.component.js +4 -4
- package/esm2015/button/mtxButton.js +10 -0
- package/esm2015/checkbox-group/checkbox-group.component.js +77 -20
- package/esm2015/color-picker/color-picker.component.js +29 -6
- package/esm2015/data-grid/cell.component.js +2 -2
- package/esm2015/data-grid/column-menu.component.js +1 -2
- package/esm2015/data-grid/grid.component.js +32 -100
- package/esm2015/data-grid/grid.interface.js +12 -11
- package/esm2015/dialog/dialog.config.js +1 -1
- package/esm2015/dialog/dialog.js +1 -3
- package/esm2015/form-group/form-group.component.js +4 -2
- package/esm2015/loader/loader.component.js +2 -2
- package/esm2015/progress/progress.component.js +3 -3
- package/esm2015/select/select.component.js +6 -2
- package/esm2015/tooltip/tooltip.js +2 -2
- package/esm2015/utils/to-observable.pipe.js +1 -1
- package/fesm2015/mtxAlert.js +3 -3
- package/fesm2015/mtxAlert.js.map +1 -1
- package/fesm2015/{ng-matero-extensions-button.js → mtxButton.js} +2 -2
- package/fesm2015/mtxButton.js.map +1 -0
- package/fesm2015/mtxCheckboxGroup.js +76 -19
- package/fesm2015/mtxCheckboxGroup.js.map +1 -1
- package/fesm2015/mtxColorPicker.js +28 -5
- package/fesm2015/mtxColorPicker.js.map +1 -1
- package/fesm2015/mtxDialog.js +0 -2
- package/fesm2015/mtxDialog.js.map +1 -1
- package/fesm2015/mtxFormGroup.js +3 -1
- package/fesm2015/mtxFormGroup.js.map +1 -1
- package/fesm2015/mtxGrid.js +43 -111
- package/fesm2015/mtxGrid.js.map +1 -1
- package/fesm2015/mtxLoader.js +1 -1
- package/fesm2015/mtxLoader.js.map +1 -1
- package/fesm2015/mtxProgress.js +2 -2
- package/fesm2015/mtxProgress.js.map +1 -1
- package/fesm2015/mtxSelect.js +5 -1
- package/fesm2015/mtxSelect.js.map +1 -1
- package/fesm2015/mtxTooltip.js +1 -1
- package/fesm2015/mtxTooltip.js.map +1 -1
- package/fesm2015/mtxUtils.js.map +1 -1
- package/form-group/mtxFormGroup.metadata.json +1 -1
- package/loader/loader.component.d.ts +2 -1
- package/loader/mtxLoader.metadata.json +1 -1
- package/package.json +1 -1
- package/progress/mtxProgress.metadata.json +1 -1
- package/progress/progress.component.d.ts +3 -2
- package/select/_select-theme.scss +18 -18
- package/select/mtxSelect.metadata.json +1 -1
- package/select/select.component.d.ts +4 -1
- package/tooltip/mtxTooltip.metadata.json +1 -1
- package/utils/to-observable.pipe.d.ts +1 -1
- package/bundles/ng-matero-extensions-button.umd.js.map +0 -1
- package/esm2015/button/ng-matero-extensions-button.js +0 -10
- package/fesm2015/ng-matero-extensions-button.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/extensions/checkbox-group/checkbox-group.component.ts","../../../projects/extensions/checkbox-group/checkbox-group.module.ts"],"names":["label","value","this","MtxCheckboxGroupComponent","_changeDetectorRef","_items","_originalItems","bindLabel","bindValue","showSelectAll","selectAllLabel","_disabled","change","EventEmitter","selectAll","selectAllIndeterminate","color","selectedItems","_onChange","_onTouched","Object","defineProperty","prototype","JSON","parse","stringify","map","option","MtxCheckboxBase","_compareWith","fn","Error","coerceBooleanProperty","ngAfterViewInit","_selectValue","_this","correspondingOption","items","find","compareValue","error","console","warn","checked","writeValue","Array","isArray","forEach","currentValue","_checkMasterCheckboxState","markForCheck","registerOnChange","registerOnTouched","setDisabledState","isDisabled","filter","disabled","every","_getSelectedItems","index","selectedOption","emit","model","_updateNormalCheckboxState","e","_updateMasterCheckboxState","Component","args","selector","exportAs","host","class","template","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","providers","provide","NG_VALUE_ACCESSOR","useExisting","forwardRef","multi","ChangeDetectorRef","ContentChildren","MatCheckbox","descendants","Input","Output","NgModule","imports","CommonModule","FormsModule","MatCheckboxModule","MtxUtilsModule","exports","declarations"],"mappings":"k1BAoBE,SAAmBA,EAAoBC,GAApBC,KAAAF,MAAAA,EAAoBE,KAAAD,MAAAA,oBA+EvC,SAAAE,EAAoBC,GAAAF,KAAAE,mBAAAA,EA3CZF,KAAAG,OAAmC,GACnCH,KAAAI,eAA2C,GAE1CJ,KAAAK,UAAY,QACZL,KAAAM,UAAY,QACZN,KAAAO,eAAgB,EAChBP,KAAAQ,eAAiB,aAuBlBR,KAAAS,WAAY,EAEVT,KAAAU,OAAS,IAAIC,EAAAA,aAEvBX,KAAAY,WAAY,EACZZ,KAAAa,wBAAyB,EAEzBb,KAAAc,MAAsB,SA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,KAAKa,wBAAyB,EAE1Bb,KAAKY,UACPZ,KAAKmC,MACFkB,QAAM,SAAC5B,GAAU,OAAAA,EAAOgB,UAAYhB,EAAO6B,YAC3CT,SAAO,SAACpB,GAAU,OAACA,EAAOgB,SAAU,KAEvCzC,KAAKmC,MACFkB,QAAM,SAAC5B,GAAU,OAAAA,EAAOgB,UAAYhB,EAAO6B,YAC3CT,SAAO,SAACpB,GAAU,OAACA,EAAOgB,UAAYhB,EAAO6B,YAGlDtD,KAAKwD,kBAAkBC,6BA3M1BO,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,qBACVC,SAAU,mBACVC,KAAM,CACJC,MAAO,sBAETC,SAAA,0/BAEAC,cAAeC,EAAAA,kBAAkBC,KACjCC,gBAAiBC,EAAAA,wBAAwBC,OACzCC,UAAW,CACT,CACEC,QAASC,EAAAA,kBACTC,YAAaC,EAAAA,YAAU,WAAO,OAAAhF,KAC9BiF,OAAO,kOA9BXC,EAAAA,0DAmCCC,EAAAA,gBAAenB,KAAA,CAACgB,EAAAA,YAAU,WAAO,OAAAI,EAAAA,eAAc,CAAEC,aAAa,mBAG9DC,EAAAA,yBAcAA,EAAAA,yBACAA,EAAAA,6BACAA,EAAAA,8BACAA,EAAAA,2BACAA,EAAAA,wBAeAA,EAAAA,sBASAC,EAAAA,gBC1EH,iCALCC,EAAAA,SAAQxB,KAAA,CAAC,CACRyB,QAAS,CAACC,EAAAA,aAAcC,EAAAA,YAAaC,EAAAA,kBAAmBC,EAAAA,gBACxDC,QAAS,CAAC9F,GACV+F,aAAc,CAAC/F","sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n ViewEncapsulation,\n Input,\n Output,\n EventEmitter,\n ChangeDetectorRef,\n forwardRef,\n AfterViewInit,\n ContentChildren,\n QueryList,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { ThemePalette } from '@angular/material/core';\nimport { MatCheckbox } from '@angular/material/checkbox';\nimport { MtxCheckboxGroupOption } from './checkbox-group.interface';\n\nexport class MtxCheckboxBase {\n constructor(public label?: any, public value?: any) {}\n}\n\n@Component({\n selector: 'mtx-checkbox-group',\n exportAs: 'mtxCheckboxGroup',\n host: {\n class: 'mtx-checkbox-group',\n },\n templateUrl: './checkbox-group.component.html',\n styleUrls: ['./checkbox-group.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MtxCheckboxGroupComponent),\n multi: true,\n },\n ],\n})\nexport class MtxCheckboxGroupComponent implements AfterViewInit, ControlValueAccessor {\n @ContentChildren(forwardRef(() => MatCheckbox), { descendants: true })\n _checkboxes: QueryList<MatCheckbox>;\n\n @Input()\n get items(): MtxCheckboxGroupOption[] {\n return this._items;\n }\n set items(value) {\n // TODO: Deep clone\n this._originalItems = JSON.parse(JSON.stringify(value));\n this._items = value.map(option => {\n return option instanceof Object ? option : new MtxCheckboxBase(option, option);\n });\n }\n private _items: MtxCheckboxGroupOption[] = [];\n private _originalItems: MtxCheckboxGroupOption[] = [];\n\n @Input() bindLabel = 'label';\n @Input() bindValue = 'value';\n @Input() showSelectAll = false;\n @Input() selectAllLabel = 'Select All';\n @Input()\n get compareWith() {\n return this._compareWith;\n }\n set compareWith(fn: (o1: any, o2: any) => boolean) {\n if (typeof fn !== 'function') {\n throw Error('`compareWith` must be a function.');\n }\n\n if (fn) {\n this._compareWith = fn;\n }\n }\n private _compareWith: (o1: any, o2: any) => boolean;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n }\n private _disabled = false;\n\n @Output() change = new EventEmitter<{ model: MtxCheckboxGroupOption[]; index: number }>();\n\n selectAll = false;\n selectAllIndeterminate = false;\n\n color: ThemePalette = 'accent';\n\n selectedItems: MtxCheckboxGroupOption[] = [];\n\n _onChange: (value: MtxCheckboxGroupOption[]) => void = () => null;\n _onTouched: () => void = () => null;\n\n constructor(private _changeDetectorRef: ChangeDetectorRef) {}\n\n ngAfterViewInit() {}\n\n /**\n * Finds and selects and option based on its value.\n * @returns Option that has the corresponding value.\n */\n private _selectValue(value: MtxCheckboxGroupOption) {\n const correspondingOption = this.items.find((option: MtxCheckboxGroupOption) => {\n try {\n const compareValue = option[this.bindValue] === value;\n return this._compareWith ? this._compareWith(option, value) : compareValue;\n } catch (error) {\n console.warn(error);\n return false;\n }\n });\n\n if (correspondingOption) {\n correspondingOption.checked = true;\n }\n\n return correspondingOption;\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: any[]): void {\n if (value) {\n if (!Array.isArray(value)) {\n throw Error('Value must be an array.');\n }\n\n value.forEach((currentValue: any) => this._selectValue(currentValue));\n this.selectedItems = value;\n }\n\n this._checkMasterCheckboxState();\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: (value: MtxCheckboxGroupOption[]) => {}): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: () => {}): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this._disabled = isDisabled;\n }\n\n private _checkMasterCheckboxState() {\n if (\n this.items\n .filter(option => option.checked || !option.disabled)\n .every(option => !option.checked)\n ) {\n this.selectAll = false;\n this.selectAllIndeterminate = false;\n } else if (\n this.items\n .filter(option => option.checked || !option.disabled)\n .every(option => option.checked)\n ) {\n this.selectAll = true;\n this.selectAllIndeterminate = false;\n } else {\n this.selectAllIndeterminate = true;\n }\n }\n\n private _getSelectedItems(index: number) {\n this.selectedItems = this.items.filter(option => option.checked);\n\n if (this._compareWith) {\n this.selectedItems = this._originalItems.filter(option =>\n this.selectedItems.find(selectedOption => this._compareWith(option, selectedOption))\n );\n } else {\n this.selectedItems = this.selectedItems.map(option => option[this.bindValue]);\n }\n\n this._onChange(this.selectedItems);\n\n this.change.emit({ model: this.selectedItems, index });\n }\n\n /** Handle normal checkbox toggle */\n _updateNormalCheckboxState(e: boolean, index: number): void {\n this._checkMasterCheckboxState();\n this._getSelectedItems(index);\n }\n\n /** Handle master checkbox toggle */\n _updateMasterCheckboxState(e: boolean, index: number): void {\n this.selectAll = !this.selectAll;\n this.selectAllIndeterminate = false;\n\n if (this.selectAll) {\n this.items\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = true));\n } else {\n this.items\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = !!option.disabled));\n }\n\n this._getSelectedItems(index);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\n\nimport { MtxUtilsModule } from '@ng-matero/extensions/utils';\nimport { MtxCheckboxGroupComponent } from './checkbox-group.component';\n\n@NgModule({\n imports: [CommonModule, FormsModule, MatCheckboxModule, MtxUtilsModule],\n exports: [MtxCheckboxGroupComponent],\n declarations: [MtxCheckboxGroupComponent],\n})\nexport class MtxCheckboxGroupModule {}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../projects/extensions/checkbox-group/checkbox-group.component.ts","../../../projects/extensions/checkbox-group/checkbox-group.module.ts"],"names":["label","value","this","MtxCheckboxGroupComponent","_changeDetectorRef","_focusMonitor","_elementRef","_items","_originalItems","bindLabel","bindValue","_showSelectAll","selectAllLabel","_disabled","change","EventEmitter","selectAll","selectAllIndeterminate","selectedItems","_onChange","_onTouched","Object","defineProperty","prototype","JSON","parse","stringify","map","option","MtxCheckboxBase","coerceBooleanProperty","_compareWith","fn","Error","ngAfterViewInit","_this","monitor","subscribe","focusOrigin","Promise","resolve","then","markForCheck","ngOnDestroy","stopMonitoring","_selectValue","correspondingOption","find","compareValue","error","console","warn","checked","writeValue","Array","isArray","forEach","currentValue","_checkMasterCheckboxState","registerOnChange","registerOnTouched","setDisabledState","isDisabled","filter","disabled","every","_getSelectedItems","index","selectedOption","emit","model","_updateNormalCheckboxState","e","_updateMasterCheckboxState","Component","args","selector","exportAs","host","class","template","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","providers","provide","NG_VALUE_ACCESSOR","useExisting","forwardRef","multi","ChangeDetectorRef","FocusMonitor","ElementRef","ContentChildren","MatCheckbox","descendants","Input","Output","NgModule","imports","CommonModule","FormsModule","MatCheckboxModule","MtxUtilsModule","exports","declarations"],"mappings":"m5BAsBE,SAAmBA,EAAoBC,GAApBC,KAAAF,MAAAA,EAAoBE,KAAAD,MAAAA,oBAwFvC,SAAAE,EACUC,EACAC,EACAC,GAFAJ,KAAAE,mBAAAA,EACAF,KAAAG,cAAAA,EACAH,KAAAI,YAAAA,EAvDFJ,KAAAK,OAAgB,GAChBL,KAAAM,eAAwB,GAEvBN,KAAAO,UAAY,QAEZP,KAAAQ,UAAY,QASbR,KAAAS,gBAAiB,EAEhBT,KAAAU,eAAiB,aAwBlBV,KAAAW,WAAY,EAEVX,KAAAY,OAAS,IAAIC,EAAAA,aAEvBb,KAAAc,WAAY,EACZd,KAAAe,wBAAyB,EAEzBf,KAAAgB,cAA0C,GAE1ChB,KAAAiB,UAAS,WAAoD,OAAA,MAC7DjB,KAAAkB,WAAU,WAAqB,OAAA,aA7D/BC,OAAAC,eACInB,EAAAoB,UAAA,QAAK,KADT,WAEE,OAAOrB,KAAKK,YAEd,SAAUN,GAERC,KAAKM,eAAiBgB,KAAKC,MAAMD,KAAKE,UAAUzB,IAChDC,KAAKK,OAASN,EAAM0B,KAAG,SAACC,GACtB,OAAOA,aAAkBP,OAAS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BAAA,SAA2BD,EAAsBL,GAC/CjE,KAAKc,WAAad,KAAKc,UACvBd,KAAKe,wBAAyB,EAE1Bf,KAAKc,UACNd,KAAU,MACR6D,QAAM,SAACnC,GAAU,OAAAA,EAAOwB,UAAYxB,EAAOoC,YAC3CR,SAAO,SAAC5B,GAAU,OAACA,EAAOwB,SAAU,KAEtClD,KAAU,MACR6D,QAAM,SAACnC,GAAU,OAAAA,EAAOwB,UAAYxB,EAAOoC,YAC3CR,SAAO,SAAC5B,GAAU,OAACA,EAAOwB,UAAYxB,EAAOoC,YAGlD9D,KAAKgE,kBAAkBC,6BA1O1BO,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,qBACVC,SAAU,mBACVC,KAAM,CACJC,MAAO,sBAETC,SAAA,i/BAEAC,cAAeC,EAAAA,kBAAkBC,KACjCC,gBAAiBC,EAAAA,wBAAwBC,OACzCC,UAAW,CACT,CACEC,QAASC,EAAAA,kBACTC,YAAaC,EAAAA,YAAU,WAAO,OAAAxF,KAC9ByF,OAAO,kOAhCXC,EAAAA,yBASOC,EAAAA,oBAJPC,EAAAA,mDAgCCC,EAAAA,gBAAerB,KAAA,CAACgB,EAAAA,YAAU,WAAO,OAAAM,EAAAA,eAAc,CAAEC,aAAa,mBAG9DC,EAAAA,yBAcAA,EAAAA,yBAEAA,EAAAA,6BAEAA,EAAAA,8BASAA,EAAAA,2BAEAA,EAAAA,wBAeAA,EAAAA,sBASAC,EAAAA,gBCvFH,iCALCC,EAAAA,SAAQ1B,KAAA,CAAC,CACR2B,QAAS,CAACC,EAAAA,aAAcC,EAAAA,YAAaC,EAAAA,kBAAmBC,EAAAA,gBACxDC,QAAS,CAACxG,GACVyG,aAAc,CAACzG","sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n ViewEncapsulation,\n Input,\n Output,\n EventEmitter,\n ChangeDetectorRef,\n forwardRef,\n AfterViewInit,\n ContentChildren,\n QueryList,\n ElementRef,\n OnDestroy,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';\nimport { MtxCheckboxGroupOption } from './checkbox-group.interface';\n\nexport class MtxCheckboxBase {\n constructor(public label?: any, public value?: any) {}\n}\n\n@Component({\n selector: 'mtx-checkbox-group',\n exportAs: 'mtxCheckboxGroup',\n host: {\n class: 'mtx-checkbox-group',\n },\n templateUrl: './checkbox-group.component.html',\n styleUrls: ['./checkbox-group.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MtxCheckboxGroupComponent),\n multi: true,\n },\n ],\n})\nexport class MtxCheckboxGroupComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {\n @ContentChildren(forwardRef(() => MatCheckbox), { descendants: true })\n _checkboxes: QueryList<MatCheckbox>;\n\n @Input()\n get items() {\n return this._items;\n }\n set items(value: any[]) {\n // TODO: Deep clone\n this._originalItems = JSON.parse(JSON.stringify(value));\n this._items = value.map(option => {\n return option instanceof Object ? option : new MtxCheckboxBase(option, option);\n });\n }\n private _items: any[] = [];\n private _originalItems: any[] = [];\n\n @Input() bindLabel = 'label';\n\n @Input() bindValue = 'value';\n\n @Input()\n get showSelectAll(): boolean {\n return this._showSelectAll;\n }\n set showSelectAll(value: boolean) {\n this._showSelectAll = coerceBooleanProperty(value);\n }\n private _showSelectAll = false;\n\n @Input() selectAllLabel = 'Select All';\n\n @Input()\n get compareWith() {\n return this._compareWith;\n }\n set compareWith(fn: (o1: any, o2: any) => boolean) {\n if (typeof fn !== 'function') {\n throw Error('`compareWith` must be a function.');\n }\n\n if (fn) {\n this._compareWith = fn;\n }\n }\n private _compareWith: (o1: any, o2: any) => boolean;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n }\n private _disabled = false;\n\n @Output() change = new EventEmitter<{ model: MtxCheckboxGroupOption[]; index: number }>();\n\n selectAll = false;\n selectAllIndeterminate = false;\n\n selectedItems: MtxCheckboxGroupOption[] = [];\n\n _onChange: (value: MtxCheckboxGroupOption[]) => void = () => null;\n _onTouched: () => void = () => null;\n\n constructor(\n private _changeDetectorRef: ChangeDetectorRef,\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>\n ) {}\n\n ngAfterViewInit() {\n this._focusMonitor.monitor(this._elementRef, true).subscribe(focusOrigin => {\n if (!focusOrigin) {\n // When a focused element becomes disabled, the browser *immediately* fires a blur event.\n // Angular does not expect events to be raised during change detection, so any state change\n // (such as a form control's 'ng-touched') will cause a changed-after-checked error.\n // See https://github.com/angular/angular/issues/17793. To work around this, we defer\n // telling the form control it has been touched until the next tick.\n Promise.resolve().then(() => {\n this._onTouched();\n this._changeDetectorRef.markForCheck();\n });\n }\n });\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /**\n * Finds and selects and option based on its value.\n * @returns Option that has the corresponding value.\n */\n private _selectValue(value: MtxCheckboxGroupOption) {\n const correspondingOption = (this.items as MtxCheckboxGroupOption[]).find(option => {\n try {\n const compareValue = option[this.bindValue] === value;\n return this._compareWith ? this._compareWith(option, value) : compareValue;\n } catch (error) {\n console.warn(error);\n return false;\n }\n });\n\n if (correspondingOption) {\n correspondingOption.checked = true;\n }\n\n return correspondingOption;\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: any[]): void {\n if (value) {\n if (!Array.isArray(value)) {\n throw Error('Value must be an array.');\n }\n\n value.forEach((currentValue: any) => this._selectValue(currentValue));\n this.selectedItems = value;\n }\n\n this._checkMasterCheckboxState();\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: (value: MtxCheckboxGroupOption[]) => {}): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: () => {}): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this._disabled = isDisabled;\n }\n\n private _checkMasterCheckboxState() {\n if (\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .every(option => !option.checked)\n ) {\n this.selectAll = false;\n this.selectAllIndeterminate = false;\n } else if (\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .every(option => option.checked)\n ) {\n this.selectAll = true;\n this.selectAllIndeterminate = false;\n } else {\n this.selectAllIndeterminate = true;\n }\n }\n\n private _getSelectedItems(index: number) {\n this.selectedItems = (this.items as MtxCheckboxGroupOption[]).filter(option => option.checked);\n\n if (this._compareWith) {\n this.selectedItems = (this._originalItems as MtxCheckboxGroupOption[]).filter(option =>\n this.selectedItems.find(selectedOption => this._compareWith(option, selectedOption))\n );\n } else {\n this.selectedItems = this.selectedItems.map(option => option[this.bindValue]);\n }\n\n this._onChange(this.selectedItems);\n\n this.change.emit({ model: this.selectedItems, index });\n }\n\n /** Handle normal checkbox toggle */\n _updateNormalCheckboxState(e: MatCheckboxChange, index: number): void {\n this._checkMasterCheckboxState();\n this._getSelectedItems(index);\n }\n\n /** Handle master checkbox toggle */\n _updateMasterCheckboxState(e: MatCheckboxChange, index: number): void {\n this.selectAll = !this.selectAll;\n this.selectAllIndeterminate = false;\n\n if (this.selectAll) {\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = true));\n } else {\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = !!option.disabled));\n }\n\n this._getSelectedItems(index);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\n\nimport { MtxUtilsModule } from '@ng-matero/extensions/utils';\nimport { MtxCheckboxGroupComponent } from './checkbox-group.component';\n\n@NgModule({\n imports: [CommonModule, FormsModule, MatCheckboxModule, MtxUtilsModule],\n exports: [MtxCheckboxGroupComponent],\n declarations: [MtxCheckboxGroupComponent],\n})\nexport class MtxCheckboxGroupModule {}\n"]}
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
this._focused = false;
|
|
43
43
|
this._required = false;
|
|
44
44
|
this._disabled = false;
|
|
45
|
+
this._readonly = false;
|
|
45
46
|
this.errorState = false;
|
|
46
47
|
/**
|
|
47
48
|
* A name for this control that can be used by `mat-form-field`.
|
|
@@ -228,6 +229,24 @@
|
|
|
228
229
|
enumerable: false,
|
|
229
230
|
configurable: true
|
|
230
231
|
});
|
|
232
|
+
Object.defineProperty(MtxColorPickerComponent.prototype, "readonly", {
|
|
233
|
+
/**
|
|
234
|
+
* Whether the element is readonly.
|
|
235
|
+
* @return {?}
|
|
236
|
+
*/
|
|
237
|
+
get: function () {
|
|
238
|
+
return this._readonly;
|
|
239
|
+
},
|
|
240
|
+
/**
|
|
241
|
+
* @param {?} value
|
|
242
|
+
* @return {?}
|
|
243
|
+
*/
|
|
244
|
+
set: function (value) {
|
|
245
|
+
this._readonly = coercion.coerceBooleanProperty(value);
|
|
246
|
+
},
|
|
247
|
+
enumerable: false,
|
|
248
|
+
configurable: true
|
|
249
|
+
});
|
|
231
250
|
/**
|
|
232
251
|
* @return {?}
|
|
233
252
|
*/
|
|
@@ -363,7 +382,7 @@
|
|
|
363
382
|
*/
|
|
364
383
|
MtxColorPickerComponent.prototype._onColorChanged = function (model) {
|
|
365
384
|
this.value = model.color.hex;
|
|
366
|
-
this.colorChange.emit(
|
|
385
|
+
this.colorChange.emit(model);
|
|
367
386
|
};
|
|
368
387
|
/**
|
|
369
388
|
* Stream of clicks outside of the color picker panel.
|
|
@@ -382,9 +401,7 @@
|
|
|
382
401
|
// If we're in the Shadow DOM, the event target will be the shadow root, so we have to
|
|
383
402
|
// fall back to check the first element in the path of the click event.
|
|
384
403
|
/** @type {?} */
|
|
385
|
-
var clickTarget = ( /** @type {?} */((_this._isInsideShadowRoot && event.composedPath
|
|
386
|
-
? event.composedPath()[0]
|
|
387
|
-
: event.target)));
|
|
404
|
+
var clickTarget = ( /** @type {?} */((_this._isInsideShadowRoot && event.composedPath ? event.composedPath()[0] : event.target)));
|
|
388
405
|
/** @type {?} */
|
|
389
406
|
var formField = _this._formField ? _this._formField._elementRef.nativeElement : null;
|
|
390
407
|
return (clickTarget !== _this._elementRef.nativeElement &&
|
|
@@ -397,7 +414,7 @@
|
|
|
397
414
|
{ type: core.Component, args: [{
|
|
398
415
|
selector: 'mtx-color-picker',
|
|
399
416
|
exportAs: 'mtxColorPicker',
|
|
400
|
-
template: "<input matInput\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n (focus)=\"_handleFocus()\"\n autocomplete=\"off\">\n\n<div #colorPickerTrigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"colorPickerPopover\"\n (menuOpened)=\"_openPanel()\"\n (menuClosed)=\"_closePanel()\">\n</div>\n\n<mat-menu #colorPickerPopover=\"matMenu\" class=\"mtx-color-picker-panel\" [hasBackdrop]=\"false\">\n <div class=\"mtx-color-picker\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\">\n <color-chrome [color]=\"value\" (onChangeComplete)=\"_onColorChanged($event)\"></color-chrome>\n </div>\n</mat-menu>\n",
|
|
417
|
+
template: "<input matInput\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n (focus)=\"_handleFocus()\"\n autocomplete=\"off\">\n\n<div #colorPickerTrigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"colorPickerPopover\"\n (menuOpened)=\"_openPanel()\"\n (menuClosed)=\"_closePanel()\">\n</div>\n\n<mat-menu #colorPickerPopover=\"matMenu\" class=\"mtx-color-picker-panel\" [hasBackdrop]=\"false\">\n <div class=\"mtx-color-picker\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\">\n <color-chrome [color]=\"value\" (onChangeComplete)=\"_onColorChanged($event)\"></color-chrome>\n </div>\n</mat-menu>\n",
|
|
401
418
|
encapsulation: core.ViewEncapsulation.None,
|
|
402
419
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
403
420
|
providers: [{ provide: formField.MatFormFieldControl, useExisting: MtxColorPickerComponent }],
|
|
@@ -420,10 +437,15 @@
|
|
|
420
437
|
placeholder: [{ type: core.Input }],
|
|
421
438
|
required: [{ type: core.Input }],
|
|
422
439
|
disabled: [{ type: core.Input }],
|
|
440
|
+
readonly: [{ type: core.Input }],
|
|
423
441
|
colorChange: [{ type: core.Output }],
|
|
424
442
|
trigger: [{ type: core.ViewChild, args: [menu.MatMenuTrigger, { static: true },] }]
|
|
425
443
|
};
|
|
426
444
|
if (false) {
|
|
445
|
+
/** @type {?} */
|
|
446
|
+
MtxColorPickerComponent.ngAcceptInputType_required;
|
|
447
|
+
/** @type {?} */
|
|
448
|
+
MtxColorPickerComponent.ngAcceptInputType_disabled;
|
|
427
449
|
/**
|
|
428
450
|
* @type {?}
|
|
429
451
|
* @private
|
|
@@ -465,6 +487,11 @@
|
|
|
465
487
|
* @private
|
|
466
488
|
*/
|
|
467
489
|
MtxColorPickerComponent.prototype._disabled;
|
|
490
|
+
/**
|
|
491
|
+
* @type {?}
|
|
492
|
+
* @private
|
|
493
|
+
*/
|
|
494
|
+
MtxColorPickerComponent.prototype._readonly;
|
|
468
495
|
/** @type {?} */
|
|
469
496
|
MtxColorPickerComponent.prototype.errorState;
|
|
470
497
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtxColorPicker.umd.js","sources":["../../../projects/extensions/color-picker/color-picker.component.ts","../../../projects/extensions/color-picker/color-picker.module.ts"],"sourcesContent":["import {\n Component,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Optional,\n Self,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Inject,\n DoCheck,\n ViewChild,\n Host,\n AfterViewInit,\n NgZone,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { _supportsShadowDom } from '@angular/cdk/platform';\nimport { MatFormFieldControl, MatFormField } from '@angular/material/form-field';\nimport { MatMenuTrigger } from '@angular/material/menu';\nimport { Subject, Observable, merge, fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { Color } from 'ngx-color';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'mtx-color-picker',\n exportAs: 'mtxColorPicker',\n templateUrl: './color-picker.component.html',\n styleUrls: ['./color-picker.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: MatFormFieldControl, useExisting: MtxColorPickerComponent }],\n})\nexport class MtxColorPickerComponent\n implements OnDestroy, DoCheck, AfterViewInit, ControlValueAccessor, MatFormFieldControl<any> {\n /** Value of the color picker control. */\n @Input()\n get value(): string | null {\n return this._value;\n }\n set value(newValue: string | null) {\n this._value = newValue;\n this._onChange(newValue);\n this.stateChanges.next();\n }\n private _value: string | null = '';\n\n /** Implemented as part of MatFormFieldControl. */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /** Unique id for this input. */\n private _uid = `mtx-color-picker-${nextUniqueId++}`;\n\n /** Unique id of the element. */\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n this.stateChanges.next();\n }\n private _id: string;\n\n /** Placeholder to be shown if value is empty. */\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n private _placeholder: string;\n\n /** Whether the input is focused. */\n get focused(): boolean {\n return this._focused || this._panelOpen;\n }\n private _focused = false;\n\n get empty(): boolean {\n return !this.value;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _required = false;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _disabled = false;\n\n errorState = false;\n\n /** A name for this control that can be used by `mat-form-field`. */\n controlType = 'mtx-color-picker';\n\n /** The aria-describedby attribute on the color picker for improved a11y. */\n _ariaDescribedby: string;\n\n /** `View -> model callback called when value changes` */\n _onChange: (value: any) => void = () => {};\n\n /** `View -> model callback called when color picker has been touched` */\n _onTouched = () => {};\n\n /** Event emitted when the color changed */\n @Output() readonly colorChange = new EventEmitter<{ color: Color; $event: MouseEvent }>();\n\n @ViewChild(MatMenuTrigger, { static: true }) trigger: MatMenuTrigger;\n\n /** Whether or not the overlay panel is open. */\n _panelOpen = false;\n\n /** The subscription for closing actions (some are bound to document). */\n private _closingActionsSubscription: Subscription;\n\n /** Whether the element is inside of a ShadowRoot component. */\n private _isInsideShadowRoot: boolean;\n\n /**\n * Whether the color picker can open the next time it is focused. Used to prevent a focused,\n * closed color picker from being reopened if the user switches to another browser tab and then\n * comes back.\n */\n private _canOpenOnNextFocus = true;\n\n /**\n * Event handler for when the window is blurred. Needs to be an\n * arrow function in order to preserve the context.\n */\n private _windowBlurHandler = () => {\n // If the user blurred the window while the color picker is focused, it means that it'll be\n // refocused when they come back. In this case we want to skip the first focus event, if the\n // pane was closed, in order to avoid reopening it unintentionally.\n this._canOpenOnNextFocus =\n this._document.activeElement !== this._elementRef.nativeElement || this._panelOpen;\n };\n\n constructor(\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>,\n private _changeDetectorRef: ChangeDetectorRef,\n private _zone: NgZone,\n @Optional() @Self() public ngControl: NgControl,\n @Optional() @Host() private _formField: MatFormField,\n @Optional() @Inject(DOCUMENT) private _document: any\n ) {\n _focusMonitor.monitor(_elementRef, true).subscribe(origin => {\n if (this._focused && !origin) {\n this._onTouched();\n }\n this._focused = !!origin;\n this.stateChanges.next();\n });\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngDoCheck(): void {\n if (this.ngControl) {\n this.errorState = (this.ngControl.invalid && this.ngControl.touched) as boolean;\n this.stateChanges.next();\n }\n }\n\n ngAfterViewInit() {\n if (typeof window !== 'undefined') {\n this._zone.runOutsideAngular(() => {\n window.addEventListener('blur', this._windowBlurHandler);\n });\n\n if (_supportsShadowDom()) {\n const element = this._elementRef.nativeElement;\n const rootNode = element.getRootNode ? element.getRootNode() : null;\n\n // We need to take the `ShadowRoot` off of `window`, because the built-in types are\n // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.\n this._isInsideShadowRoot = rootNode instanceof (window as any).ShadowRoot;\n }\n }\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Implemented as part of MatFormFieldControl. */\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n /** Implemented as part of MatFormFieldControl. */\n onContainerClick() {\n this._handleFocus();\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: string | null): void {\n this.value = value || '';\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n /** Open panel with input focus event. */\n _handleFocus() {\n this.trigger.openMenu();\n\n this._closingActionsSubscription = merge(this._getOutsideClickStream())\n .pipe()\n .subscribe(event => {\n this.trigger.closeMenu();\n this._closingActionsSubscription.unsubscribe();\n });\n }\n\n /** Opens the overlay panel. */\n _openPanel() {\n if (this._focused) {\n this._panelOpen = true;\n }\n }\n\n /** Closes the overlay panel and focuses the host element. */\n _closePanel() {\n if (this._panelOpen) {\n this._panelOpen = false;\n this._changeDetectorRef.markForCheck();\n this._onTouched();\n }\n }\n\n /** The callback of color changed. */\n _onColorChanged(model: { color: Color; $event: MouseEvent }) {\n this.value = model.color.hex;\n this.colorChange.emit({ color: model.color, $event: model.$event });\n }\n\n /** Stream of clicks outside of the color picker panel. */\n private _getOutsideClickStream(): Observable<any> {\n return merge(\n fromEvent(this._document, 'click') as Observable<MouseEvent>,\n fromEvent(this._document, 'touchend') as Observable<TouchEvent>\n ).pipe(\n filter(event => {\n // If we're in the Shadow DOM, the event target will be the shadow root, so we have to\n // fall back to check the first element in the path of the click event.\n const clickTarget = (this._isInsideShadowRoot && event.composedPath\n ? event.composedPath()[0]\n : event.target) as HTMLElement;\n const formField = this._formField ? this._formField._elementRef.nativeElement : null;\n\n return (\n clickTarget !== this._elementRef.nativeElement &&\n (!formField || !formField.contains(clickTarget))\n );\n })\n );\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { ColorChromeModule } from 'ngx-color/chrome';\n\nimport { MtxColorPickerComponent } from './color-picker.component';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n MatMenuModule,\n MatFormFieldModule,\n MatInputModule,\n ColorChromeModule,\n ],\n exports: [MtxColorPickerComponent],\n declarations: [MtxColorPickerComponent],\n})\nexport class MtxColorPickerModule {}\n"],"names":["Subject","EventEmitter","coerceBooleanProperty","_supportsShadowDom","merge","fromEvent","filter","Component","ViewEncapsulation","ChangeDetectionStrategy","MatFormFieldControl","FocusMonitor","ElementRef","ChangeDetectorRef","NgZone","NgControl","Optional","Self","MatFormField","Host","Inject","DOCUMENT","Input","Output","ViewChild","MatMenuTrigger","NgModule","CommonModule","FormsModule","MatMenuModule","MatFormFieldModule","MatInputModule","ColorChromeModule"],"mappings":";;;;;;;;;;;;QA+BI,YAAY,GAAG,CAAC;;;;;;;;;;;QAsIlB,iCACU,aAA2B,EAC3B,WAAoC,EACpC,kBAAqC,EACrC,KAAa,EACM,SAAoB,EACnB,UAAwB,EACd,SAAc;YAPtD,iBAoBC;YAnBS,kBAAa,GAAb,aAAa,CAAc;YAC3B,gBAAW,GAAX,WAAW,CAAyB;YACpC,uBAAkB,GAAlB,kBAAkB,CAAmB;YACrC,UAAK,GAAL,KAAK,CAAQ;YACM,cAAS,GAAT,SAAS,CAAW;YACnB,eAAU,GAAV,UAAU,CAAc;YACd,cAAS,GAAT,SAAS,CAAK;YAtH9C,WAAM,GAAkB,EAAE,CAAC;;;;YAG1B,iBAAY,GAAkB,IAAIA,YAAO,EAAQ,CAAC;;;;YAGnD,SAAI,GAAG,sBAAoB,YAAY,EAAI,CAAC;YA4B5C,aAAQ,GAAG,KAAK,CAAC;YAkBjB,cAAS,GAAG,KAAK,CAAC;YAUlB,cAAS,GAAG,KAAK,CAAC;YAE1B,eAAU,GAAG,KAAK,CAAC;;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6CAAmB;;;;;QAGnB,8CAAiC;;;;;QAGjC,mDAAyB;;;;;QAGzB,4CAA2C;;;;;QAG3C,6CAAsB;;;;;QAGtB,8CAA0F;;QAE1F,0CAAqE;;;;;QAGrE,6CAAmB;;;;;;QAGnB,8DAAkD;;;;;;QAGlD,sDAAqC;;;;;;;;QAOrC,sDAAmC;;;;;;;QAMnC,qDAME;;;;;QAGA,gDAAmC;;;;;QACnC,8CAA4C;;;;;QAC5C,qDAA6C;;;;;QAC7C,wCAAqB;;QACrB,4CAA+C;;;;;QAC/C,6CAAoD;;;;;QACpD,4CAAoD;;;;;;;;;QCrJxD;;;;;gBAZCC,aAAQ,SAAC;oBACR,OAAO,EAAE;wBACPC,mBAAY;wBACZC,iBAAW;wBACXC,kBAAa;wBACbC,4BAAkB;wBAClBC,oBAAc;wBACdC,wBAAiB;qBAClB;oBACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;oBAClC,YAAY,EAAE,CAAC,uBAAuB,CAAC;iBACxC;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mtxColorPicker.umd.js","sources":["../../../projects/extensions/color-picker/color-picker.component.ts","../../../projects/extensions/color-picker/color-picker.module.ts"],"sourcesContent":["import {\n Component,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Optional,\n Self,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Inject,\n DoCheck,\n ViewChild,\n Host,\n AfterViewInit,\n NgZone,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { _supportsShadowDom } from '@angular/cdk/platform';\nimport { MatFormFieldControl, MatFormField } from '@angular/material/form-field';\nimport { MatMenuTrigger } from '@angular/material/menu';\nimport { Subject, Observable, merge, fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ColorEvent } from 'ngx-color';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'mtx-color-picker',\n exportAs: 'mtxColorPicker',\n templateUrl: './color-picker.component.html',\n styleUrls: ['./color-picker.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: MatFormFieldControl, useExisting: MtxColorPickerComponent }],\n})\nexport class MtxColorPickerComponent\n implements OnDestroy, DoCheck, AfterViewInit, ControlValueAccessor, MatFormFieldControl<any>\n{\n /** Value of the color picker control. */\n @Input()\n get value(): string | null {\n return this._value;\n }\n set value(newValue: string | null) {\n this._value = newValue;\n this._onChange(newValue);\n this.stateChanges.next();\n }\n private _value: string | null = '';\n\n /** Implemented as part of MatFormFieldControl. */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /** Unique id for this input. */\n private _uid = `mtx-color-picker-${nextUniqueId++}`;\n\n /** Unique id of the element. */\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n this.stateChanges.next();\n }\n private _id: string;\n\n /** Placeholder to be shown if value is empty. */\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n private _placeholder: string;\n\n /** Whether the input is focused. */\n get focused(): boolean {\n return this._focused || this._panelOpen;\n }\n private _focused = false;\n\n get empty(): boolean {\n return !this.value;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _required = false;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _disabled = false;\n\n /** Whether the element is readonly. */\n @Input()\n get readonly(): boolean {\n return this._readonly;\n }\n set readonly(value: boolean) {\n this._readonly = coerceBooleanProperty(value);\n }\n private _readonly = false;\n\n errorState = false;\n\n /** A name for this control that can be used by `mat-form-field`. */\n controlType = 'mtx-color-picker';\n\n /** The aria-describedby attribute on the color picker for improved a11y. */\n _ariaDescribedby: string;\n\n /** `View -> model callback called when value changes` */\n _onChange: (value: any) => void = () => {};\n\n /** `View -> model callback called when color picker has been touched` */\n _onTouched = () => {};\n\n /** Event emitted when the color changed */\n @Output() readonly colorChange = new EventEmitter<ColorEvent>();\n\n @ViewChild(MatMenuTrigger, { static: true }) trigger: MatMenuTrigger;\n\n /** Whether or not the overlay panel is open. */\n _panelOpen = false;\n\n /** The subscription for closing actions (some are bound to document). */\n private _closingActionsSubscription: Subscription;\n\n /** Whether the element is inside of a ShadowRoot component. */\n private _isInsideShadowRoot: boolean;\n\n /**\n * Whether the color picker can open the next time it is focused. Used to prevent a focused,\n * closed color picker from being reopened if the user switches to another browser tab and then\n * comes back.\n */\n private _canOpenOnNextFocus = true;\n\n /**\n * Event handler for when the window is blurred. Needs to be an\n * arrow function in order to preserve the context.\n */\n private _windowBlurHandler = () => {\n // If the user blurred the window while the color picker is focused, it means that it'll be\n // refocused when they come back. In this case we want to skip the first focus event, if the\n // pane was closed, in order to avoid reopening it unintentionally.\n this._canOpenOnNextFocus =\n this._document.activeElement !== this._elementRef.nativeElement || this._panelOpen;\n };\n\n constructor(\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>,\n private _changeDetectorRef: ChangeDetectorRef,\n private _zone: NgZone,\n @Optional() @Self() public ngControl: NgControl,\n @Optional() @Host() private _formField: MatFormField,\n @Optional() @Inject(DOCUMENT) private _document: any\n ) {\n _focusMonitor.monitor(_elementRef, true).subscribe(origin => {\n if (this._focused && !origin) {\n this._onTouched();\n }\n this._focused = !!origin;\n this.stateChanges.next();\n });\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngDoCheck(): void {\n if (this.ngControl) {\n this.errorState = (this.ngControl.invalid && this.ngControl.touched) as boolean;\n this.stateChanges.next();\n }\n }\n\n ngAfterViewInit() {\n if (typeof window !== 'undefined') {\n this._zone.runOutsideAngular(() => {\n window.addEventListener('blur', this._windowBlurHandler);\n });\n\n if (_supportsShadowDom()) {\n const element = this._elementRef.nativeElement;\n const rootNode = element.getRootNode ? element.getRootNode() : null;\n\n // We need to take the `ShadowRoot` off of `window`, because the built-in types are\n // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.\n this._isInsideShadowRoot = rootNode instanceof (window as any).ShadowRoot;\n }\n }\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Implemented as part of MatFormFieldControl. */\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n /** Implemented as part of MatFormFieldControl. */\n onContainerClick() {\n this._handleFocus();\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: string | null): void {\n this.value = value || '';\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n /** Open panel with input focus event. */\n _handleFocus() {\n this.trigger.openMenu();\n\n this._closingActionsSubscription = merge(this._getOutsideClickStream())\n .pipe()\n .subscribe(event => {\n this.trigger.closeMenu();\n this._closingActionsSubscription.unsubscribe();\n });\n }\n\n /** Opens the overlay panel. */\n _openPanel() {\n if (this._focused) {\n this._panelOpen = true;\n }\n }\n\n /** Closes the overlay panel and focuses the host element. */\n _closePanel() {\n if (this._panelOpen) {\n this._panelOpen = false;\n this._changeDetectorRef.markForCheck();\n this._onTouched();\n }\n }\n\n /** The callback of color changed. */\n _onColorChanged(model: ColorEvent) {\n this.value = model.color.hex;\n this.colorChange.emit(model);\n }\n\n /** Stream of clicks outside of the color picker panel. */\n private _getOutsideClickStream(): Observable<any> {\n return merge(\n fromEvent(this._document, 'click') as Observable<MouseEvent>,\n fromEvent(this._document, 'touchend') as Observable<TouchEvent>\n ).pipe(\n filter(event => {\n // If we're in the Shadow DOM, the event target will be the shadow root, so we have to\n // fall back to check the first element in the path of the click event.\n const clickTarget = (\n this._isInsideShadowRoot && event.composedPath ? event.composedPath()[0] : event.target\n ) as HTMLElement;\n const formField = this._formField ? this._formField._elementRef.nativeElement : null;\n\n return (\n clickTarget !== this._elementRef.nativeElement &&\n (!formField || !formField.contains(clickTarget))\n );\n })\n );\n }\n\n static ngAcceptInputType_required: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { ColorChromeModule } from 'ngx-color/chrome';\n\nimport { MtxColorPickerComponent } from './color-picker.component';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n MatMenuModule,\n MatFormFieldModule,\n MatInputModule,\n ColorChromeModule,\n ],\n exports: [MtxColorPickerComponent],\n declarations: [MtxColorPickerComponent],\n})\nexport class MtxColorPickerModule {}\n"],"names":["Subject","EventEmitter","coerceBooleanProperty","_supportsShadowDom","merge","fromEvent","filter","Component","ViewEncapsulation","ChangeDetectionStrategy","MatFormFieldControl","FocusMonitor","ElementRef","ChangeDetectorRef","NgZone","NgControl","Optional","Self","MatFormField","Host","Inject","DOCUMENT","Input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DAA6C;;;;;QAC7C,wCAAqB;;QACrB,4CAA+C;;;;;QAC/C,6CAAoD;;;;;QACpD,4CAAoD;;;;;;;;;QChKxD;;;;;gBAZCC,aAAQ,SAAC;oBACR,OAAO,EAAE;wBACPC,mBAAY;wBACZC,iBAAW;wBACXC,kBAAa;wBACbC,4BAAkB;wBAClBC,oBAAc;wBACdC,wBAAiB;qBAClB;oBACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;oBAClC,YAAY,EAAE,CAAC,uBAAuB,CAAC;iBACxC;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("@angular/material/menu"),require("@angular/material/form-field"),require("@angular/material/input"),require("ngx-color/chrome"),require("@angular/cdk/a11y"),require("@angular/cdk/coercion"),require("@angular/cdk/platform"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ng-matero/extensions/color-picker",["exports","@angular/core","@angular/common","@angular/forms","@angular/material/menu","@angular/material/form-field","@angular/material/input","ngx-color/chrome","@angular/cdk/a11y","@angular/cdk/coercion","@angular/cdk/platform","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-matero"]=e["ng-matero"]||{},e["ng-matero"].extensions=e["ng-matero"].extensions||{},e["ng-matero"].extensions["color-picker"]={}),e.ng.core,e.ng.common,e.ng.forms,e.ng.material.menu,e.ng.material.formField,e.ng.material.input,e["ngx-color-chrome"],e.ng.cdk.a11y,e.ng.cdk.coercion,e.ng.cdk.platform,e.rxjs,e.rxjs.operators)}(this,(function(e,t,o,n,r,i,a,c,s,l,u,p,d){"use strict";var h=0,g=function(){function e(e,o,n,r,i,a,c){var s=this;this._focusMonitor=e,this._elementRef=o,this._changeDetectorRef=n,this._zone=r,this.ngControl=i,this._formField=a,this._document=c,this._value="",this.stateChanges=new p.Subject,this._uid="mtx-color-picker-"+h++,this._focused=!1,this._required=!1,this._disabled=!1,this.errorState=!1,this.controlType="mtx-color-picker",this._onChange=function(){},this._onTouched=function(){},this.colorChange=new t.EventEmitter,this._panelOpen=!1,this._canOpenOnNextFocus=!0,this._windowBlurHandler=function(){s._canOpenOnNextFocus=s._document.activeElement!==s._elementRef.nativeElement||s._panelOpen},e.monitor(o,!0).subscribe((function(e){s._focused&&!e&&s._onTouched(),s._focused=!!e,s.stateChanges.next()})),null!=this.ngControl&&(this.ngControl.valueAccessor=this)}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e,this._onChange(e),this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e||this._uid,this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){this._placeholder=e,this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focused",{get:function(){return this._focused||this._panelOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"empty",{get:function(){return!this.value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shouldLabelFloat",{get:function(){return this.focused||!this.empty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return this._required},set:function(e){this._required=l.coerceBooleanProperty(e),this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=l.coerceBooleanProperty(e),this.stateChanges.next()},enumerable:!1,configurable:!0}),e.prototype.ngDoCheck=function(){this.ngControl&&(this.errorState=this.ngControl.invalid&&this.ngControl.touched,this.stateChanges.next())},e.prototype.ngAfterViewInit=function(){var e=this;if("undefined"!=typeof window&&(this._zone.runOutsideAngular((function(){window.addEventListener("blur",e._windowBlurHandler)})),u._supportsShadowDom())){var t=this._elementRef.nativeElement,o=t.getRootNode?t.getRootNode():null;this._isInsideShadowRoot=o instanceof window.ShadowRoot}},e.prototype.ngOnDestroy=function(){this.stateChanges.complete(),this._focusMonitor.stopMonitoring(this._elementRef)},e.prototype.setDescribedByIds=function(e){this._ariaDescribedby=e.join(" ")},e.prototype.onContainerClick=function(){this._handleFocus()},e.prototype.writeValue=function(e){this.value=e||"",this._changeDetectorRef.markForCheck()},e.prototype.registerOnChange=function(e){this._onChange=e},e.prototype.registerOnTouched=function(e){this._onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e},e.prototype._handleFocus=function(){var e=this;this.trigger.openMenu(),this._closingActionsSubscription=p.merge(this._getOutsideClickStream()).pipe().subscribe((function(t){e.trigger.closeMenu(),e._closingActionsSubscription.unsubscribe()}))},e.prototype._openPanel=function(){this._focused&&(this._panelOpen=!0)},e.prototype._closePanel=function(){this._panelOpen&&(this._panelOpen=!1,this._changeDetectorRef.markForCheck(),this._onTouched())},e.prototype._onColorChanged=function(e){this.value=e.color.hex,this.colorChange.emit(
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("@angular/material/menu"),require("@angular/material/form-field"),require("@angular/material/input"),require("ngx-color/chrome"),require("@angular/cdk/a11y"),require("@angular/cdk/coercion"),require("@angular/cdk/platform"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ng-matero/extensions/color-picker",["exports","@angular/core","@angular/common","@angular/forms","@angular/material/menu","@angular/material/form-field","@angular/material/input","ngx-color/chrome","@angular/cdk/a11y","@angular/cdk/coercion","@angular/cdk/platform","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-matero"]=e["ng-matero"]||{},e["ng-matero"].extensions=e["ng-matero"].extensions||{},e["ng-matero"].extensions["color-picker"]={}),e.ng.core,e.ng.common,e.ng.forms,e.ng.material.menu,e.ng.material.formField,e.ng.material.input,e["ngx-color-chrome"],e.ng.cdk.a11y,e.ng.cdk.coercion,e.ng.cdk.platform,e.rxjs,e.rxjs.operators)}(this,(function(e,t,o,n,r,i,a,c,s,l,u,p,d){"use strict";var h=0,g=function(){function e(e,o,n,r,i,a,c){var s=this;this._focusMonitor=e,this._elementRef=o,this._changeDetectorRef=n,this._zone=r,this.ngControl=i,this._formField=a,this._document=c,this._value="",this.stateChanges=new p.Subject,this._uid="mtx-color-picker-"+h++,this._focused=!1,this._required=!1,this._disabled=!1,this._readonly=!1,this.errorState=!1,this.controlType="mtx-color-picker",this._onChange=function(){},this._onTouched=function(){},this.colorChange=new t.EventEmitter,this._panelOpen=!1,this._canOpenOnNextFocus=!0,this._windowBlurHandler=function(){s._canOpenOnNextFocus=s._document.activeElement!==s._elementRef.nativeElement||s._panelOpen},e.monitor(o,!0).subscribe((function(e){s._focused&&!e&&s._onTouched(),s._focused=!!e,s.stateChanges.next()})),null!=this.ngControl&&(this.ngControl.valueAccessor=this)}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e,this._onChange(e),this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e||this._uid,this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){this._placeholder=e,this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focused",{get:function(){return this._focused||this._panelOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"empty",{get:function(){return!this.value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shouldLabelFloat",{get:function(){return this.focused||!this.empty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"required",{get:function(){return this._required},set:function(e){this._required=l.coerceBooleanProperty(e),this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=l.coerceBooleanProperty(e),this.stateChanges.next()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"readonly",{get:function(){return this._readonly},set:function(e){this._readonly=l.coerceBooleanProperty(e)},enumerable:!1,configurable:!0}),e.prototype.ngDoCheck=function(){this.ngControl&&(this.errorState=this.ngControl.invalid&&this.ngControl.touched,this.stateChanges.next())},e.prototype.ngAfterViewInit=function(){var e=this;if("undefined"!=typeof window&&(this._zone.runOutsideAngular((function(){window.addEventListener("blur",e._windowBlurHandler)})),u._supportsShadowDom())){var t=this._elementRef.nativeElement,o=t.getRootNode?t.getRootNode():null;this._isInsideShadowRoot=o instanceof window.ShadowRoot}},e.prototype.ngOnDestroy=function(){this.stateChanges.complete(),this._focusMonitor.stopMonitoring(this._elementRef)},e.prototype.setDescribedByIds=function(e){this._ariaDescribedby=e.join(" ")},e.prototype.onContainerClick=function(){this._handleFocus()},e.prototype.writeValue=function(e){this.value=e||"",this._changeDetectorRef.markForCheck()},e.prototype.registerOnChange=function(e){this._onChange=e},e.prototype.registerOnTouched=function(e){this._onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e},e.prototype._handleFocus=function(){var e=this;this.trigger.openMenu(),this._closingActionsSubscription=p.merge(this._getOutsideClickStream()).pipe().subscribe((function(t){e.trigger.closeMenu(),e._closingActionsSubscription.unsubscribe()}))},e.prototype._openPanel=function(){this._focused&&(this._panelOpen=!0)},e.prototype._closePanel=function(){this._panelOpen&&(this._panelOpen=!1,this._changeDetectorRef.markForCheck(),this._onTouched())},e.prototype._onColorChanged=function(e){this.value=e.color.hex,this.colorChange.emit(e)},e.prototype._getOutsideClickStream=function(){var e=this;return p.merge(p.fromEvent(this._document,"click"),p.fromEvent(this._document,"touchend")).pipe(d.filter((function(t){var o=e._isInsideShadowRoot&&t.composedPath?t.composedPath()[0]:t.target,n=e._formField?e._formField._elementRef.nativeElement:null;return!(o===e._elementRef.nativeElement||n&&n.contains(o))})))},e}();g.decorators=[{type:t.Component,args:[{selector:"mtx-color-picker",exportAs:"mtxColorPicker",template:'<input matInput\n [(ngModel)]="value"\n [placeholder]="placeholder"\n [disabled]="disabled"\n [readonly]="readonly"\n (focus)="_handleFocus()"\n autocomplete="off">\n\n<div #colorPickerTrigger="matMenuTrigger"\n [matMenuTriggerFor]="colorPickerPopover"\n (menuOpened)="_openPanel()"\n (menuClosed)="_closePanel()">\n</div>\n\n<mat-menu #colorPickerPopover="matMenu" class="mtx-color-picker-panel" [hasBackdrop]="false">\n <div class="mtx-color-picker"\n (click)="$event.stopPropagation()"\n (keydown)="$event.stopPropagation()">\n <color-chrome [color]="value" (onChangeComplete)="_onColorChanged($event)"></color-chrome>\n </div>\n</mat-menu>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[{provide:i.MatFormFieldControl,useExisting:g}],styles:[".mtx-color-picker-panel .mat-menu-content:not(:empty){padding:0}.mtx-color-picker-panel .mtx-color-picker{padding:8px}.mtx-color-picker-panel .mtx-color-picker .chrome-picker{border-radius:0;box-shadow:none}.mtx-color-picker-panel .mtx-color-picker .chrome-picker .saturation{border-radius:0}"]}]}],g.ctorParameters=function(){return[{type:s.FocusMonitor},{type:t.ElementRef},{type:t.ChangeDetectorRef},{type:t.NgZone},{type:n.NgControl,decorators:[{type:t.Optional},{type:t.Self}]},{type:i.MatFormField,decorators:[{type:t.Optional},{type:t.Host}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[o.DOCUMENT]}]}]},g.propDecorators={value:[{type:t.Input}],id:[{type:t.Input}],placeholder:[{type:t.Input}],required:[{type:t.Input}],disabled:[{type:t.Input}],readonly:[{type:t.Input}],colorChange:[{type:t.Output}],trigger:[{type:t.ViewChild,args:[r.MatMenuTrigger,{static:!0}]}]};var m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[o.CommonModule,n.FormsModule,r.MatMenuModule,i.MatFormFieldModule,a.MatInputModule,c.ColorChromeModule],exports:[g],declarations:[g]}]}],e.MtxColorPickerComponent=g,e.MtxColorPickerModule=m,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mtxColorPicker.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/extensions/color-picker/color-picker.component.ts","../../../projects/extensions/color-picker/color-picker.module.ts"],"names":["nextUniqueId","MtxColorPickerComponent","_focusMonitor","_elementRef","_changeDetectorRef","_zone","ngControl","_formField","_document","_this","this","_value","stateChanges","Subject","_uid","_focused","_required","_disabled","errorState","controlType","_onChange","_onTouched","colorChange","EventEmitter","_panelOpen","_canOpenOnNextFocus","_windowBlurHandler","activeElement","nativeElement","monitor","subscribe","origin","next","valueAccessor","Object","defineProperty","prototype","newValue","_id","value","_placeholder","focused","empty","coerceBooleanProperty","ngDoCheck","invalid","touched","ngAfterViewInit","window","runOutsideAngular","addEventListener","_supportsShadowDom","element","rootNode","getRootNode","_isInsideShadowRoot","ShadowRoot","ngOnDestroy","complete","stopMonitoring","setDescribedByIds","ids","_ariaDescribedby","join","onContainerClick","_handleFocus","writeValue","markForCheck","registerOnChange","fn","registerOnTouched","setDisabledState","isDisabled","disabled","trigger","openMenu","_closingActionsSubscription","merge","_getOutsideClickStream","pipe","event","closeMenu","unsubscribe","_openPanel","_closePanel","_onColorChanged","model","color","hex","emit","$event","fromEvent","filter","clickTarget","composedPath","target","formField","contains","Component","args","selector","exportAs","template","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","providers","provide","MatFormFieldControl","useExisting","FocusMonitor","ElementRef","ChangeDetectorRef","NgZone","NgControl","decorators","type","Optional","Self","MatFormField","Host","Inject","DOCUMENT","Input","Output","ViewChild","MatMenuTrigger","static","NgModule","imports","CommonModule","FormsModule","MatMenuModule","MatFormFieldModule","MatInputModule","ColorChromeModule","exports","declarations"],"mappings":"gsCA+BIA,EAAe,eAsIjB,SAAAC,EACUC,EACAC,EACAC,EACAC,EACmBC,EACCC,EACUC,GAPxC,IAAAC,EAAAC,KACUA,KAAAR,cAAAA,EACAQ,K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AC,cAAeC,EAAAA,kBAAkBC,KACjCC,gBAAiBC,EAAAA,wBAAwBC,OACzCC,UAAW,CAAC,CAAEC,QAASC,EAAAA,oBAAqBC,YAAa/G,iWAnBlDgH,EAAAA,oBAbPC,EAAAA,kBAJAC,EAAAA,yBAaAC,EAAAA,cAG6BC,EAAAA,UAASC,WAAA,CAAA,CAAAC,KAsJnCC,EAAAA,UAAQ,CAAAD,KAAIE,EAAAA,cAlJaC,EAAAA,aAAYJ,WAAA,CAAA,CAAAC,KAmJrCC,EAAAA,UAAQ,CAAAD,KAAII,EAAAA,uCACZH,EAAAA,UAAQ,CAAAD,KAAIK,EAAAA,OAAMzB,KAAA,CAAC0B,EAAAA,8CA/HrBC,EAAAA,kBAkBAA,EAAAA,2BAWAA,EAAAA,wBAwBAA,EAAAA,wBAUAA,EAAAA,2BAyBAC,EAAAA,wBAEAC,EAAAA,UAAS7B,KAAA,CAAC8B,EAAAA,eAAgB,CAAEC,QAAQ,aChHvC,iCAZCC,EAAAA,SAAQhC,KAAA,CAAC,CACRiC,QAAS,CACPC,EAAAA,aACAC,EAAAA,YACAC,EAAAA,cACAC,EAAAA,mBACAC,EAAAA,eACAC,EAAAA,mBAEFC,QAAS,CAAC1I,GACV2I,aAAc,CAAC3I","sourcesContent":["import {\n Component,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Optional,\n Self,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Inject,\n DoCheck,\n ViewChild,\n Host,\n AfterViewInit,\n NgZone,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { _supportsShadowDom } from '@angular/cdk/platform';\nimport { MatFormFieldControl, MatFormField } from '@angular/material/form-field';\nimport { MatMenuTrigger } from '@angular/material/menu';\nimport { Subject, Observable, merge, fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { Color } from 'ngx-color';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'mtx-color-picker',\n exportAs: 'mtxColorPicker',\n templateUrl: './color-picker.component.html',\n styleUrls: ['./color-picker.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: MatFormFieldControl, useExisting: MtxColorPickerComponent }],\n})\nexport class MtxColorPickerComponent\n implements OnDestroy, DoCheck, AfterViewInit, ControlValueAccessor, MatFormFieldControl<any> {\n /** Value of the color picker control. */\n @Input()\n get value(): string | null {\n return this._value;\n }\n set value(newValue: string | null) {\n this._value = newValue;\n this._onChange(newValue);\n this.stateChanges.next();\n }\n private _value: string | null = '';\n\n /** Implemented as part of MatFormFieldControl. */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /** Unique id for this input. */\n private _uid = `mtx-color-picker-${nextUniqueId++}`;\n\n /** Unique id of the element. */\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n this.stateChanges.next();\n }\n private _id: string;\n\n /** Placeholder to be shown if value is empty. */\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n private _placeholder: string;\n\n /** Whether the input is focused. */\n get focused(): boolean {\n return this._focused || this._panelOpen;\n }\n private _focused = false;\n\n get empty(): boolean {\n return !this.value;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _required = false;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _disabled = false;\n\n errorState = false;\n\n /** A name for this control that can be used by `mat-form-field`. */\n controlType = 'mtx-color-picker';\n\n /** The aria-describedby attribute on the color picker for improved a11y. */\n _ariaDescribedby: string;\n\n /** `View -> model callback called when value changes` */\n _onChange: (value: any) => void = () => {};\n\n /** `View -> model callback called when color picker has been touched` */\n _onTouched = () => {};\n\n /** Event emitted when the color changed */\n @Output() readonly colorChange = new EventEmitter<{ color: Color; $event: MouseEvent }>();\n\n @ViewChild(MatMenuTrigger, { static: true }) trigger: MatMenuTrigger;\n\n /** Whether or not the overlay panel is open. */\n _panelOpen = false;\n\n /** The subscription for closing actions (some are bound to document). */\n private _closingActionsSubscription: Subscription;\n\n /** Whether the element is inside of a ShadowRoot component. */\n private _isInsideShadowRoot: boolean;\n\n /**\n * Whether the color picker can open the next time it is focused. Used to prevent a focused,\n * closed color picker from being reopened if the user switches to another browser tab and then\n * comes back.\n */\n private _canOpenOnNextFocus = true;\n\n /**\n * Event handler for when the window is blurred. Needs to be an\n * arrow function in order to preserve the context.\n */\n private _windowBlurHandler = () => {\n // If the user blurred the window while the color picker is focused, it means that it'll be\n // refocused when they come back. In this case we want to skip the first focus event, if the\n // pane was closed, in order to avoid reopening it unintentionally.\n this._canOpenOnNextFocus =\n this._document.activeElement !== this._elementRef.nativeElement || this._panelOpen;\n };\n\n constructor(\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>,\n private _changeDetectorRef: ChangeDetectorRef,\n private _zone: NgZone,\n @Optional() @Self() public ngControl: NgControl,\n @Optional() @Host() private _formField: MatFormField,\n @Optional() @Inject(DOCUMENT) private _document: any\n ) {\n _focusMonitor.monitor(_elementRef, true).subscribe(origin => {\n if (this._focused && !origin) {\n this._onTouched();\n }\n this._focused = !!origin;\n this.stateChanges.next();\n });\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngDoCheck(): void {\n if (this.ngControl) {\n this.errorState = (this.ngControl.invalid && this.ngControl.touched) as boolean;\n this.stateChanges.next();\n }\n }\n\n ngAfterViewInit() {\n if (typeof window !== 'undefined') {\n this._zone.runOutsideAngular(() => {\n window.addEventListener('blur', this._windowBlurHandler);\n });\n\n if (_supportsShadowDom()) {\n const element = this._elementRef.nativeElement;\n const rootNode = element.getRootNode ? element.getRootNode() : null;\n\n // We need to take the `ShadowRoot` off of `window`, because the built-in types are\n // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.\n this._isInsideShadowRoot = rootNode instanceof (window as any).ShadowRoot;\n }\n }\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Implemented as part of MatFormFieldControl. */\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n /** Implemented as part of MatFormFieldControl. */\n onContainerClick() {\n this._handleFocus();\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: string | null): void {\n this.value = value || '';\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n /** Open panel with input focus event. */\n _handleFocus() {\n this.trigger.openMenu();\n\n this._closingActionsSubscription = merge(this._getOutsideClickStream())\n .pipe()\n .subscribe(event => {\n this.trigger.closeMenu();\n this._closingActionsSubscription.unsubscribe();\n });\n }\n\n /** Opens the overlay panel. */\n _openPanel() {\n if (this._focused) {\n this._panelOpen = true;\n }\n }\n\n /** Closes the overlay panel and focuses the host element. */\n _closePanel() {\n if (this._panelOpen) {\n this._panelOpen = false;\n this._changeDetectorRef.markForCheck();\n this._onTouched();\n }\n }\n\n /** The callback of color changed. */\n _onColorChanged(model: { color: Color; $event: MouseEvent }) {\n this.value = model.color.hex;\n this.colorChange.emit({ color: model.color, $event: model.$event });\n }\n\n /** Stream of clicks outside of the color picker panel. */\n private _getOutsideClickStream(): Observable<any> {\n return merge(\n fromEvent(this._document, 'click') as Observable<MouseEvent>,\n fromEvent(this._document, 'touchend') as Observable<TouchEvent>\n ).pipe(\n filter(event => {\n // If we're in the Shadow DOM, the event target will be the shadow root, so we have to\n // fall back to check the first element in the path of the click event.\n const clickTarget = (this._isInsideShadowRoot && event.composedPath\n ? event.composedPath()[0]\n : event.target) as HTMLElement;\n const formField = this._formField ? this._formField._elementRef.nativeElement : null;\n\n return (\n clickTarget !== this._elementRef.nativeElement &&\n (!formField || !formField.contains(clickTarget))\n );\n })\n );\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { ColorChromeModule } from 'ngx-color/chrome';\n\nimport { MtxColorPickerComponent } from './color-picker.component';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n MatMenuModule,\n MatFormFieldModule,\n MatInputModule,\n ColorChromeModule,\n ],\n exports: [MtxColorPickerComponent],\n declarations: [MtxColorPickerComponent],\n})\nexport class MtxColorPickerModule {}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../projects/extensions/color-picker/color-picker.component.ts","../../../projects/extensions/color-picker/color-picker.module.ts"],"names":["nextUniqueId","MtxColorPickerComponent","_focusMonitor","_elementRef","_changeDetectorRef","_zone","ngControl","_formField","_document","_this","this","_value","stateChanges","Subject","_uid","_focused","_required","_disabled","_readonly","errorState","controlType","_onChange","_onTouched","colorChange","EventEmitter","_panelOpen","_canOpenOnNextFocus","_windowBlurHandler","activeElement","nativeElement","monitor","subscribe","origin","next","valueAccessor","Object","defineProperty","prototype","newValue","_id","value","_placeholder","focused","empty","coerceBooleanProperty","ngDoCheck","invalid","touched","ngAfterViewInit","window","runOutsideAngular","addEventListener","_supportsShadowDom","element","rootNode","getRootNode","_isInsideShadowRoot","ShadowRoot","ngOnDestroy","complete","stopMonitoring","setDescribedByIds","ids","_ariaDescribedby","join","onContainerClick","_handleFocus","writeValue","markForCheck","registerOnChange","fn","registerOnTouched","setDisabledState","isDisabled","disabled","trigger","openMenu","_closingActionsSubscription","merge","_getOutsideClickStream","pipe","event","closeMenu","unsubscribe","_openPanel","_closePanel","_onColorChanged","model","color","hex","emit","fromEvent","filter","clickTarget","composedPath","target","formField","contains","Component","args","selector","exportAs","template","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","providers","provide","MatFormFieldControl","useExisting","FocusMonitor","ElementRef","ChangeDetectorRef","NgZone","NgControl","decorators","type","Optional","Self","MatFormField","Host","Inject","DOCUMENT","Input","Output","ViewChild","MatMenuTrigger","static","NgModule","imports","CommonModule","FormsModule","MatMenuModule","MatFormFieldModule","MatInputModule","ColorChromeModule","exports","declarations"],"mappings":"gsCA+BIA,EAAe,eAiJjB,SAAAC,EACUC,EACAC,EACAC,EACAC,EACmBC,EACCC,EACUC,GAPxC,IAAAC,EAAAC,KACUA,KAAAR,cAAAA,EACAQ,KAAAP,YAAAA,EACAO,KAAAN,mBAAAA,EACAM,KAAAL,MAAAA,EACmBK,KAAAJ,UAAAA,EACCI,KAAAH,WAAAA,EACUG,KAAAF,UAAAA,EAhIhCE,KAAAC,OAAwB,GAGvBD,KAAAE,aAA8B,IAAIC,EAAAA,QAGnCH,KAAAI,KAAO,oBAAoBd,IA4B3BU,KAAAK,UAAW,EAkBXL,KAAAM,WAAY,EAUZN,KAAAO,WAAY,EAUZP,KAAAQ,WAAY,EAEpBR,KAAAS,YAAa,EAGbT,KAAAU,YAAc,mBAMdV,KAAAW,UAAS,aAGTX,KAAAY,WAAU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EAAAA,aAAYJ,WAAA,CAAA,CAAAC,KA8JrCC,EAAAA,UAAQ,CAAAD,KAAII,EAAAA,uCACZH,EAAAA,UAAQ,CAAAD,KAAIK,EAAAA,OAAMzB,KAAA,CAAC0B,EAAAA,8CAzIrBC,EAAAA,kBAkBAA,EAAAA,2BAWAA,EAAAA,wBAwBAA,EAAAA,wBAUAA,EAAAA,wBAWAA,EAAAA,2BAwBAC,EAAAA,wBAEAC,EAAAA,UAAS7B,KAAA,CAAC8B,EAAAA,eAAgB,CAAEC,QAAQ,aC3HvC,iCAZCC,EAAAA,SAAQhC,KAAA,CAAC,CACRiC,QAAS,CACPC,EAAAA,aACAC,EAAAA,YACAC,EAAAA,cACAC,EAAAA,mBACAC,EAAAA,eACAC,EAAAA,mBAEFC,QAAS,CAAC1I,GACV2I,aAAc,CAAC3I","sourcesContent":["import {\n Component,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Optional,\n Self,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Inject,\n DoCheck,\n ViewChild,\n Host,\n AfterViewInit,\n NgZone,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { _supportsShadowDom } from '@angular/cdk/platform';\nimport { MatFormFieldControl, MatFormField } from '@angular/material/form-field';\nimport { MatMenuTrigger } from '@angular/material/menu';\nimport { Subject, Observable, merge, fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ColorEvent } from 'ngx-color';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'mtx-color-picker',\n exportAs: 'mtxColorPicker',\n templateUrl: './color-picker.component.html',\n styleUrls: ['./color-picker.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: MatFormFieldControl, useExisting: MtxColorPickerComponent }],\n})\nexport class MtxColorPickerComponent\n implements OnDestroy, DoCheck, AfterViewInit, ControlValueAccessor, MatFormFieldControl<any>\n{\n /** Value of the color picker control. */\n @Input()\n get value(): string | null {\n return this._value;\n }\n set value(newValue: string | null) {\n this._value = newValue;\n this._onChange(newValue);\n this.stateChanges.next();\n }\n private _value: string | null = '';\n\n /** Implemented as part of MatFormFieldControl. */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /** Unique id for this input. */\n private _uid = `mtx-color-picker-${nextUniqueId++}`;\n\n /** Unique id of the element. */\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n this.stateChanges.next();\n }\n private _id: string;\n\n /** Placeholder to be shown if value is empty. */\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n private _placeholder: string;\n\n /** Whether the input is focused. */\n get focused(): boolean {\n return this._focused || this._panelOpen;\n }\n private _focused = false;\n\n get empty(): boolean {\n return !this.value;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _required = false;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _disabled = false;\n\n /** Whether the element is readonly. */\n @Input()\n get readonly(): boolean {\n return this._readonly;\n }\n set readonly(value: boolean) {\n this._readonly = coerceBooleanProperty(value);\n }\n private _readonly = false;\n\n errorState = false;\n\n /** A name for this control that can be used by `mat-form-field`. */\n controlType = 'mtx-color-picker';\n\n /** The aria-describedby attribute on the color picker for improved a11y. */\n _ariaDescribedby: string;\n\n /** `View -> model callback called when value changes` */\n _onChange: (value: any) => void = () => {};\n\n /** `View -> model callback called when color picker has been touched` */\n _onTouched = () => {};\n\n /** Event emitted when the color changed */\n @Output() readonly colorChange = new EventEmitter<ColorEvent>();\n\n @ViewChild(MatMenuTrigger, { static: true }) trigger: MatMenuTrigger;\n\n /** Whether or not the overlay panel is open. */\n _panelOpen = false;\n\n /** The subscription for closing actions (some are bound to document). */\n private _closingActionsSubscription: Subscription;\n\n /** Whether the element is inside of a ShadowRoot component. */\n private _isInsideShadowRoot: boolean;\n\n /**\n * Whether the color picker can open the next time it is focused. Used to prevent a focused,\n * closed color picker from being reopened if the user switches to another browser tab and then\n * comes back.\n */\n private _canOpenOnNextFocus = true;\n\n /**\n * Event handler for when the window is blurred. Needs to be an\n * arrow function in order to preserve the context.\n */\n private _windowBlurHandler = () => {\n // If the user blurred the window while the color picker is focused, it means that it'll be\n // refocused when they come back. In this case we want to skip the first focus event, if the\n // pane was closed, in order to avoid reopening it unintentionally.\n this._canOpenOnNextFocus =\n this._document.activeElement !== this._elementRef.nativeElement || this._panelOpen;\n };\n\n constructor(\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>,\n private _changeDetectorRef: ChangeDetectorRef,\n private _zone: NgZone,\n @Optional() @Self() public ngControl: NgControl,\n @Optional() @Host() private _formField: MatFormField,\n @Optional() @Inject(DOCUMENT) private _document: any\n ) {\n _focusMonitor.monitor(_elementRef, true).subscribe(origin => {\n if (this._focused && !origin) {\n this._onTouched();\n }\n this._focused = !!origin;\n this.stateChanges.next();\n });\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngDoCheck(): void {\n if (this.ngControl) {\n this.errorState = (this.ngControl.invalid && this.ngControl.touched) as boolean;\n this.stateChanges.next();\n }\n }\n\n ngAfterViewInit() {\n if (typeof window !== 'undefined') {\n this._zone.runOutsideAngular(() => {\n window.addEventListener('blur', this._windowBlurHandler);\n });\n\n if (_supportsShadowDom()) {\n const element = this._elementRef.nativeElement;\n const rootNode = element.getRootNode ? element.getRootNode() : null;\n\n // We need to take the `ShadowRoot` off of `window`, because the built-in types are\n // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.\n this._isInsideShadowRoot = rootNode instanceof (window as any).ShadowRoot;\n }\n }\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Implemented as part of MatFormFieldControl. */\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n /** Implemented as part of MatFormFieldControl. */\n onContainerClick() {\n this._handleFocus();\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: string | null): void {\n this.value = value || '';\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n /** Open panel with input focus event. */\n _handleFocus() {\n this.trigger.openMenu();\n\n this._closingActionsSubscription = merge(this._getOutsideClickStream())\n .pipe()\n .subscribe(event => {\n this.trigger.closeMenu();\n this._closingActionsSubscription.unsubscribe();\n });\n }\n\n /** Opens the overlay panel. */\n _openPanel() {\n if (this._focused) {\n this._panelOpen = true;\n }\n }\n\n /** Closes the overlay panel and focuses the host element. */\n _closePanel() {\n if (this._panelOpen) {\n this._panelOpen = false;\n this._changeDetectorRef.markForCheck();\n this._onTouched();\n }\n }\n\n /** The callback of color changed. */\n _onColorChanged(model: ColorEvent) {\n this.value = model.color.hex;\n this.colorChange.emit(model);\n }\n\n /** Stream of clicks outside of the color picker panel. */\n private _getOutsideClickStream(): Observable<any> {\n return merge(\n fromEvent(this._document, 'click') as Observable<MouseEvent>,\n fromEvent(this._document, 'touchend') as Observable<TouchEvent>\n ).pipe(\n filter(event => {\n // If we're in the Shadow DOM, the event target will be the shadow root, so we have to\n // fall back to check the first element in the path of the click event.\n const clickTarget = (\n this._isInsideShadowRoot && event.composedPath ? event.composedPath()[0] : event.target\n ) as HTMLElement;\n const formField = this._formField ? this._formField._elementRef.nativeElement : null;\n\n return (\n clickTarget !== this._elementRef.nativeElement &&\n (!formField || !formField.contains(clickTarget))\n );\n })\n );\n }\n\n static ngAcceptInputType_required: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { ColorChromeModule } from 'ngx-color/chrome';\n\nimport { MtxColorPickerComponent } from './color-picker.component';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n MatMenuModule,\n MatFormFieldModule,\n MatInputModule,\n ColorChromeModule,\n ],\n exports: [MtxColorPickerComponent],\n declarations: [MtxColorPickerComponent],\n})\nexport class MtxColorPickerModule {}\n"]}
|
package/bundles/mtxDialog.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtxDialog.umd.js","sources":["../../../projects/extensions/dialog/dialog.component.ts","../../../projects/extensions/dialog/dialog.ts","../../../projects/extensions/dialog/dialog.module.ts"],"sourcesContent":["import { Component, Inject, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\n\nimport { MtxDialogData } from './dialog.config';\n\n@Component({\n selector: 'mtx-dialog',\n exportAs: 'mtxDialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MtxDialogComponent {\n constructor(\n public dialogRef: MatDialogRef<MtxDialogComponent>,\n @Inject(MAT_DIALOG_DATA) public data: MtxDialogData\n ) {}\n\n _onClick(fn: () => void) {\n if (fn) {\n fn.call(this);\n }\n this._onClose();\n }\n\n _onClose() {\n this.dialogRef.close();\n }\n}\n","import { Injectable, TemplateRef } from '@angular/core';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { MatDialog } from '@angular/material/dialog';\n\nimport { MtxDialogComponent } from './dialog.component';\nimport { MtxDialogData } from './dialog.config';\nimport { Observable } from 'rxjs';\n\nconst defaults: MtxDialogData = {\n title: '',\n description: '',\n buttons: [\n {\n color: 'warn',\n text: 'OK',\n focusInitial: true,\n onClick: () => {},\n },\n {\n
|
|
1
|
+
{"version":3,"file":"mtxDialog.umd.js","sources":["../../../projects/extensions/dialog/dialog.component.ts","../../../projects/extensions/dialog/dialog.ts","../../../projects/extensions/dialog/dialog.module.ts"],"sourcesContent":["import { Component, Inject, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\n\nimport { MtxDialogData } from './dialog.config';\n\n@Component({\n selector: 'mtx-dialog',\n exportAs: 'mtxDialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MtxDialogComponent {\n constructor(\n public dialogRef: MatDialogRef<MtxDialogComponent>,\n @Inject(MAT_DIALOG_DATA) public data: MtxDialogData\n ) {}\n\n _onClick(fn: () => void) {\n if (fn) {\n fn.call(this);\n }\n this._onClose();\n }\n\n _onClose() {\n this.dialogRef.close();\n }\n}\n","import { Injectable, TemplateRef } from '@angular/core';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { MatDialog } from '@angular/material/dialog';\n\nimport { MtxDialogComponent } from './dialog.component';\nimport { MtxDialogData } from './dialog.config';\nimport { Observable } from 'rxjs';\n\nconst defaults: MtxDialogData = {\n title: '',\n description: '',\n buttons: [\n {\n color: 'warn',\n text: 'OK',\n focusInitial: true,\n onClick: () => {},\n },\n {\n text: 'CLOSE',\n onClick: () => {},\n },\n ],\n showCloseIcon: false,\n disableClose: true,\n width: '300px',\n};\n\n@Injectable()\nexport class MtxDialog {\n constructor(public dialog: MatDialog) {}\n\n originalOpen(\n componentOrTemplateRef: ComponentType<any> | TemplateRef<any> = MtxDialogComponent,\n config: any\n ) {\n return this.dialog.open(componentOrTemplateRef, config);\n }\n\n open(\n config: MtxDialogData,\n componentOrTemplateRef: ComponentType<any> | TemplateRef<any> = MtxDialogComponent\n ) {\n const data = Object.assign({}, defaults, config);\n return this.dialog.open(componentOrTemplateRef, {\n ...data,\n data,\n });\n }\n\n alert(\n title: string | Observable<string>,\n description: string | Observable<string> = '',\n onOk = () => {}\n ) {\n this.open({\n title,\n description,\n buttons: [\n {\n color: 'warn',\n text: 'OK',\n onClick: () => onOk(),\n },\n ],\n });\n }\n\n confirm(\n title: string | Observable<string>,\n description: string | Observable<string> = '',\n onOk = () => {},\n onClose = () => {}\n ) {\n this.open({\n title,\n description,\n buttons: [\n {\n color: 'warn',\n text: 'OK',\n onClick: () => onOk(),\n },\n {\n text: 'CLOSE',\n onClick: () => onClose(),\n },\n ],\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { MtxUtilsModule } from '@ng-matero/extensions/utils';\nimport { MtxDialogComponent } from './dialog.component';\nimport { MtxDialog } from './dialog';\n\n@NgModule({\n imports: [CommonModule, MatDialogModule, MatButtonModule, MatIconModule, MtxUtilsModule],\n exports: [MtxDialogComponent],\n declarations: [MtxDialogComponent],\n providers: [MtxDialog],\n entryComponents: [MtxDialogComponent],\n})\nexport class MtxDialogModule {}\n"],"names":["Component","ViewEncapsulation","ChangeDetectionStrategy","MatDialogRef","Inject","MAT_DIALOG_DATA","Injectable","MatDialog","NgModule","CommonModule","MatDialogModule","MatButtonModule","MatIconModule","MtxUtilsModule"],"mappings":";;;;;;;;;;;;;;;;QAcE,4BACS,SAA2C,EAClB,IAAmB;YAD5C,cAAS,GAAT,SAAS,CAAkC;YAClB,SAAI,GAAJ,IAAI,CAAe;SACjD;;;;;QAEJ,qCAAQ,GAAR,UAAS,EAAc;YACrB,IAAI,EAAE,EAAE;gBACN,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACf;YACD,IAAI,CAAC,QAAQ,EAAE,CAAC;SACjB;;;;QAED,qCAAQ,GAAR;YACE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;SACxB;;;;gBAvBFA,cAAS,SAAC;oBACT,QAAQ,EAAE,YAAY;oBACtB,QAAQ,EAAE,WAAW;oBACrB,snFAAsC;oBAEtC,aAAa,EAAEC,sBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAEC,4BAAuB,CAAC,MAAM;;iBAChD;;;;gBAXQC,mBAAY;gDAehBC,WAAM,SAACC,sBAAe;;;;QADvB,uCAAkD;;QAClD,kCAAmD;;;;;;;;;;QCAxC,eAAQ;;QAIR,eAAQ;;QAZjB,QAAQ,GAAkB;QAC9B,KAAK,EAAE,EAAE;QACT,WAAW,EAAE,EAAE;QACf,OAAO,EAAE;YACP;gBACE,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,IAAI;gBACV,YAAY,EAAE,IAAI;gBAClB,OAAO,MAAU;aAClB;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,OAAO,MAAU;aAClB;SACF;QACD,aAAa,EAAE,KAAK;QACpB,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,OAAO;KACf;;;;;QAIC,mBAAmB,MAAiB;YAAjB,WAAM,GAAN,MAAM,CAAW;SAAI;;;;;;QAExC,gCAAY,GAAZ,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GAAA,CAAA;qBACzB;iBACF;aACF,CAAC,CAAC;SACJ;;;;gBA7DFC,eAAU;;;;gBA1BFC,gBAAS;;;;QA4BJ,2BAAwB;;;;;;;;;QCbtC;;;;;gBAPCC,aAAQ,SAAC;oBACR,OAAO,EAAE,CAACC,mBAAY,EAAEC,sBAAe,EAAEC,sBAAe,EAAEC,kBAAa,EAAEC,oBAAc,CAAC;oBACxF,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,SAAS,EAAE,CAAC,SAAS,CAAC;oBACtB,eAAe,EAAE,CAAC,kBAAkB,CAAC;iBACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/material/dialog"),require("@angular/material/button"),require("@angular/material/icon"),require("@ng-matero/extensions/utils")):"function"==typeof define&&define.amd?define("@ng-matero/extensions/dialog",["exports","@angular/core","@angular/common","@angular/material/dialog","@angular/material/button","@angular/material/icon","@ng-matero/extensions/utils"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self)["ng-matero"]=n["ng-matero"]||{},n["ng-matero"].extensions=n["ng-matero"].extensions||{},n["ng-matero"].extensions.dialog={}),n.ng.core,n.ng.common,n.ng.material.dialog,n.ng.material.button,n.ng.material.icon,n["ng-matero"].extensions.utils)}(this,(function(n,t,o,e,i,a,l){"use strict";var c=function(){function n(n,t){this.dialogRef=n,this.data=t}return n.prototype._onClick=function(n){n&&n.call(this),this._onClose()},n.prototype._onClose=function(){this.dialogRef.close()},n}();c.decorators=[{type:t.Component,args:[{selector:"mtx-dialog",exportAs:"mtxDialog",template:'<h1 class="mtx-dialog-title" *ngIf="data.title">{{data.title | toObservable | async}}\n <button mat-icon-button *ngIf="data.showCloseIcon" (click)="_onClose()">\n <mat-icon>close</mat-icon>\n </button>\n</h1>\n<div class="mtx-dialog-content" *ngIf="data.description">\n <p>{{data.description | toObservable | async}}</p>\n</div>\n<div class="mtx-dialog-actions">\n <ng-container *ngFor="let btn of data.buttons">\n <ng-container [ngSwitch]="btn.type">\n <ng-container *ngSwitchCase="\'raised\'">\n <button mat-raised-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-raised-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n <ng-container *ngSwitchCase="\'stroked\'">\n <button mat-stroked-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-stroked-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n <ng-container *ngSwitchCase="\'flat\'">\n <button mat-flat-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-flat-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button mat-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[".mtx-dialog-title{align-items:center;display:flex;font:500 20px/32px Roboto,Helvetica Neue,sans-serif;justify-content:space-between;letter-spacing:normal;margin:0 0 20px}.mtx-dialog-content{-webkit-overflow-scrolling:touch;display:block;margin:0 -24px;max-height:65vh;overflow:auto;padding:0 24px}.mtx-dialog-actions{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-end;margin-bottom:-24px;min-height:52px;padding:8px 0}"]}]}],c.ctorParameters=function(){return[{type:e.MatDialogRef},{type:void 0,decorators:[{type:t.Inject,args:[e.MAT_DIALOG_DATA]}]}]};var s={title:"",description:"",buttons:[{color:"warn",text:"OK",focusInitial:!0,onClick:function(){}},{
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/material/dialog"),require("@angular/material/button"),require("@angular/material/icon"),require("@ng-matero/extensions/utils")):"function"==typeof define&&define.amd?define("@ng-matero/extensions/dialog",["exports","@angular/core","@angular/common","@angular/material/dialog","@angular/material/button","@angular/material/icon","@ng-matero/extensions/utils"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self)["ng-matero"]=n["ng-matero"]||{},n["ng-matero"].extensions=n["ng-matero"].extensions||{},n["ng-matero"].extensions.dialog={}),n.ng.core,n.ng.common,n.ng.material.dialog,n.ng.material.button,n.ng.material.icon,n["ng-matero"].extensions.utils)}(this,(function(n,t,o,e,i,a,l){"use strict";var c=function(){function n(n,t){this.dialogRef=n,this.data=t}return n.prototype._onClick=function(n){n&&n.call(this),this._onClose()},n.prototype._onClose=function(){this.dialogRef.close()},n}();c.decorators=[{type:t.Component,args:[{selector:"mtx-dialog",exportAs:"mtxDialog",template:'<h1 class="mtx-dialog-title" *ngIf="data.title">{{data.title | toObservable | async}}\n <button mat-icon-button *ngIf="data.showCloseIcon" (click)="_onClose()">\n <mat-icon>close</mat-icon>\n </button>\n</h1>\n<div class="mtx-dialog-content" *ngIf="data.description">\n <p>{{data.description | toObservable | async}}</p>\n</div>\n<div class="mtx-dialog-actions">\n <ng-container *ngFor="let btn of data.buttons">\n <ng-container [ngSwitch]="btn.type">\n <ng-container *ngSwitchCase="\'raised\'">\n <button mat-raised-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-raised-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n <ng-container *ngSwitchCase="\'stroked\'">\n <button mat-stroked-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-stroked-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n <ng-container *ngSwitchCase="\'flat\'">\n <button mat-flat-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-flat-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button mat-button *ngIf="btn.focusInitial" cdkFocusInitial\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n <button mat-button *ngIf="!btn.focusInitial"\n [color]="btn.color" [ngClass]="btn.class" (click)="_onClick(btn.onClick)">\n {{btn.text | toObservable | async}}\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[".mtx-dialog-title{align-items:center;display:flex;font:500 20px/32px Roboto,Helvetica Neue,sans-serif;justify-content:space-between;letter-spacing:normal;margin:0 0 20px}.mtx-dialog-content{-webkit-overflow-scrolling:touch;display:block;margin:0 -24px;max-height:65vh;overflow:auto;padding:0 24px}.mtx-dialog-actions{align-items:center;display:flex;flex-wrap:wrap;justify-content:flex-end;margin-bottom:-24px;min-height:52px;padding:8px 0}"]}]}],c.ctorParameters=function(){return[{type:e.MatDialogRef},{type:void 0,decorators:[{type:t.Inject,args:[e.MAT_DIALOG_DATA]}]}]};var s={title:"",description:"",buttons:[{color:"warn",text:"OK",focusInitial:!0,onClick:function(){}},{text:"CLOSE",onClick:function(){}}],showCloseIcon:!1,disableClose:!0,width:"300px"},r=function(){function n(n){this.dialog=n}return n.prototype.originalOpen=function(n,t){return void 0===n&&(n=c),this.dialog.open(n,t)},n.prototype.open=function(n,t){void 0===t&&(t=c);var o=Object.assign({},s,n);return this.dialog.open(t,Object.assign(Object.assign({},o),{data:o}))},n.prototype.alert=function(n,t,o){void 0===t&&(t=""),void 0===o&&(o=function(){}),this.open({title:n,description:t,buttons:[{color:"warn",text:"OK",onClick:function(){return o()}}]})},n.prototype.confirm=function(n,t,o,e){void 0===t&&(t=""),void 0===o&&(o=function(){}),void 0===e&&(e=function(){}),this.open({title:n,description:t,buttons:[{color:"warn",text:"OK",onClick:function(){return o()}},{text:"CLOSE",onClick:function(){return e()}}]})},n}();r.decorators=[{type:t.Injectable}],r.ctorParameters=function(){return[{type:e.MatDialog}]};var u=function(){};u.decorators=[{type:t.NgModule,args:[{imports:[o.CommonModule,e.MatDialogModule,i.MatButtonModule,a.MatIconModule,l.MtxUtilsModule],exports:[c],declarations:[c],providers:[r],entryComponents:[c]}]}],n.MtxDialog=r,n.MtxDialogComponent=c,n.MtxDialogModule=u,Object.defineProperty(n,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mtxDialog.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/extensions/dialog/dialog.component.ts","../../../projects/extensions/dialog/dialog.ts","../../../projects/extensions/dialog/dialog.module.ts"],"names":["MtxDialogComponent","dialogRef","data","this","prototype","_onClick","fn","call","_onClose","close","Component","args","selector","exportAs","template","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","MatDialogRef","Inject","MAT_DIALOG_DATA","defaults","title","description","buttons","color","text","focusInitial","onClick","showCloseIcon","disableClose","width","MtxDialog","dialog","originalOpen","componentOrTemplateRef","config","open","Object","assign","alert","onOk","confirm","onClose","Injectable","MatDialog","NgModule","imports","CommonModule","MatDialogModule","MatButtonModule","MatIconModule","MtxUtilsModule","exports","declarations","providers","entryComponents"],"mappings":"q2BAcE,SAAAA,EACSC,EACyBC,GADzBC,KAAAF,UAAAA,EACyBE,KAAAD,KAAAA,SAGlCF,EAAAI,UAAAC,SAAA,SAASC,GACHA,GACFA,EAAGC,KAAKJ,MAEVA,KAAKK,YAGPR,EAAAI,UAAAI,SAAA,WACEL,KAAKF,UAAUQ,kCAtBlBC,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,aACVC,SAAU,YACVC,SAAA,2hFAEAC,cAAeC,EAAAA,kBAAkBC,KACjCC,gBAAiBC,EAAAA,wBAAwBC,ufAVlCC,EAAAA,6CAeJC,EAAAA,OAAMX,KAAA,CAACY,EAAAA,0BCRNC,EAA0B,CAC9BC,MAAO,GACPC,YAAa,GACbC,QAAS,CACP,CACEC,MAAO,OACPC,KAAM,KACNC,cAAc,EACdC,QAAS,cAEX,
|
|
1
|
+
{"version":3,"sources":["../../../projects/extensions/dialog/dialog.component.ts","../../../projects/extensions/dialog/dialog.ts","../../../projects/extensions/dialog/dialog.module.ts"],"names":["MtxDialogComponent","dialogRef","data","this","prototype","_onClick","fn","call","_onClose","close","Component","args","selector","exportAs","template","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","MatDialogRef","Inject","MAT_DIALOG_DATA","defaults","title","description","buttons","color","text","focusInitial","onClick","showCloseIcon","disableClose","width","MtxDialog","dialog","originalOpen","componentOrTemplateRef","config","open","Object","assign","alert","onOk","confirm","onClose","Injectable","MatDialog","NgModule","imports","CommonModule","MatDialogModule","MatButtonModule","MatIconModule","MtxUtilsModule","exports","declarations","providers","entryComponents"],"mappings":"q2BAcE,SAAAA,EACSC,EACyBC,GADzBC,KAAAF,UAAAA,EACyBE,KAAAD,KAAAA,SAGlCF,EAAAI,UAAAC,SAAA,SAASC,GACHA,GACFA,EAAGC,KAAKJ,MAEVA,KAAKK,YAGPR,EAAAI,UAAAI,SAAA,WACEL,KAAKF,UAAUQ,kCAtBlBC,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,aACVC,SAAU,YACVC,SAAA,2hFAEAC,cAAeC,EAAAA,kBAAkBC,KACjCC,gBAAiBC,EAAAA,wBAAwBC,ufAVlCC,EAAAA,6CAeJC,EAAAA,OAAMX,KAAA,CAACY,EAAAA,0BCRNC,EAA0B,CAC9BC,MAAO,GACPC,YAAa,GACbC,QAAS,CACP,CACEC,MAAO,OACPC,KAAM,KACNC,cAAc,EACdC,QAAS,cAEX,CACEF,KAAM,QACNE,QAAS,eAGbC,eAAe,EACfC,cAAc,EACdC,MAAO,sBAKP,SAAAC,EAAmBC,GAAAjC,KAAAiC,OAAAA,SAEnBD,EAAA/B,UAAAiC,aAAA,SACEC,EACAC,GAEA,YAHA,IAAAD,IAAAA,EAAAtC,GAGOG,KAAKiC,OAAOI,KAAKF,EAAwBC,IAGlDJ,EAAA/B,UAAAoC,KAAA,SACED,EACAD,QAAA,IAAAA,IAAAA,EAAAtC,OAEME,EAAOuC,OAAOC,OAAO,GAAIlB,EAAUe,GACzC,OAAOpC,KAAKiC,OAAOI,KAAKF,EAAsBG,OAAAC,OAAAD,OAAAC,OAAA,GACzCxC,GAAI,CACPA,KAAIA,MAIRiC,EAAA/B,UAAAuC,MAAA,SACElB,EACAC,EACAkB,QADA,IAAAlB,IAAAA,EAAA,SACA,IAAAkB,IAAAA,EAAA,cAEAzC,KAAKqC,KAAK,CACRf,MAAKA,EACLC,YAAWA,EACXC,QAAS,CACP,CACEC,MAAO,OACPC,KAAM,KACNE,QAAO,WAAQ,OAAAa,UAMvBT,EAAA/B,UAAAyC,QAAA,SACEpB,EACAC,EACAkB,EACAE,QAFA,IAAApB,IAAAA,EAAA,SACA,IAAAkB,IAAAA,EAAA,mBACA,IAAAE,IAAAA,EAAA,cAEA3C,KAAKqC,KAAK,CACRf,MAAKA,EACLC,YAAWA,EACXC,QAAS,CACP,CACEC,MAAO,OACPC,KAAM,KACNE,QAAO,WAAQ,OAAAa,MAEjB,CACEf,KAAM,QACNE,QAAO,WAAQ,OAAAe,mCAzDxBC,EAAAA,sDA1BQC,EAAAA,mBCeT,iCAPCC,EAAAA,SAAQtC,KAAA,CAAC,CACRuC,QAAS,CAACC,EAAAA,aAAcC,EAAAA,gBAAiBC,EAAAA,gBAAiBC,EAAAA,cAAeC,EAAAA,gBACzEC,QAAS,CAACxD,GACVyD,aAAc,CAACzD,GACf0D,UAAW,CAACvB,GACZwB,gBAAiB,CAAC3D","sourcesContent":["import { Component, Inject, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\n\nimport { MtxDialogData } from './dialog.config';\n\n@Component({\n selector: 'mtx-dialog',\n exportAs: 'mtxDialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MtxDialogComponent {\n constructor(\n public dialogRef: MatDialogRef<MtxDialogComponent>,\n @Inject(MAT_DIALOG_DATA) public data: MtxDialogData\n ) {}\n\n _onClick(fn: () => void) {\n if (fn) {\n fn.call(this);\n }\n this._onClose();\n }\n\n _onClose() {\n this.dialogRef.close();\n }\n}\n","import { Injectable, TemplateRef } from '@angular/core';\nimport { ComponentType } from '@angular/cdk/portal';\nimport { MatDialog } from '@angular/material/dialog';\n\nimport { MtxDialogComponent } from './dialog.component';\nimport { MtxDialogData } from './dialog.config';\nimport { Observable } from 'rxjs';\n\nconst defaults: MtxDialogData = {\n title: '',\n description: '',\n buttons: [\n {\n color: 'warn',\n text: 'OK',\n focusInitial: true,\n onClick: () => {},\n },\n {\n text: 'CLOSE',\n onClick: () => {},\n },\n ],\n showCloseIcon: false,\n disableClose: true,\n width: '300px',\n};\n\n@Injectable()\nexport class MtxDialog {\n constructor(public dialog: MatDialog) {}\n\n originalOpen(\n componentOrTemplateRef: ComponentType<any> | TemplateRef<any> = MtxDialogComponent,\n config: any\n ) {\n return this.dialog.open(componentOrTemplateRef, config);\n }\n\n open(\n config: MtxDialogData,\n componentOrTemplateRef: ComponentType<any> | TemplateRef<any> = MtxDialogComponent\n ) {\n const data = Object.assign({}, defaults, config);\n return this.dialog.open(componentOrTemplateRef, {\n ...data,\n data,\n });\n }\n\n alert(\n title: string | Observable<string>,\n description: string | Observable<string> = '',\n onOk = () => {}\n ) {\n this.open({\n title,\n description,\n buttons: [\n {\n color: 'warn',\n text: 'OK',\n onClick: () => onOk(),\n },\n ],\n });\n }\n\n confirm(\n title: string | Observable<string>,\n description: string | Observable<string> = '',\n onOk = () => {},\n onClose = () => {}\n ) {\n this.open({\n title,\n description,\n buttons: [\n {\n color: 'warn',\n text: 'OK',\n onClick: () => onOk(),\n },\n {\n text: 'CLOSE',\n onClick: () => onClose(),\n },\n ],\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { MtxUtilsModule } from '@ng-matero/extensions/utils';\nimport { MtxDialogComponent } from './dialog.component';\nimport { MtxDialog } from './dialog';\n\n@NgModule({\n imports: [CommonModule, MatDialogModule, MatButtonModule, MatIconModule, MtxUtilsModule],\n exports: [MtxDialogComponent],\n declarations: [MtxDialogComponent],\n providers: [MtxDialog],\n entryComponents: [MtxDialogComponent],\n})\nexport class MtxDialogModule {}\n"]}
|
|
@@ -53,11 +53,13 @@
|
|
|
53
53
|
MtxFormGroupComponent.decorators = [
|
|
54
54
|
{ type: core.Component, args: [{
|
|
55
55
|
selector: 'mtx-form-group',
|
|
56
|
+
exportAs: 'mtxFormGroup',
|
|
56
57
|
host: {
|
|
57
58
|
class: 'mtx-form-group',
|
|
58
59
|
},
|
|
59
60
|
template: "<div class=\"mtx-form-field-layout mtx-form-field-appearance-fluent\">\r\n <label *ngIf=\"label\"\r\n class=\"mtx-form-label\"\r\n [class.mtx-form-label-marker]=\"showRequiredMarker\">{{label}}</label>\r\n <ng-content></ng-content>\r\n</div>\r\n",
|
|
60
61
|
encapsulation: core.ViewEncapsulation.None,
|
|
62
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
61
63
|
styles: [".mtx-form-group{display:inline-block}.mtx-form-group .mtx-form-field-layout{align-items:flex-start;display:inline-flex;width:100%}.mtx-form-group .mtx-form-label{display:inline-block;line-height:1.125;padding-bottom:calc(.375em + 1px);padding-right:1em;padding-top:calc(.375em + 1px);position:relative}[dir=rtl] .mtx-form-group .mtx-form-label{padding-left:1em;padding-right:unset}.mtx-form-group .mtx-form-label.mtx-form-label-marker:after{content:\"*\";margin-left:4px}[dir=rtl] .mtx-form-group .mtx-form-label.mtx-form-label-marker:after{margin-left:auto;margin-right:4px}.mtx-form-field-appearance-fluent .mat-form-field{margin-bottom:.25em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button{height:1.5em;width:1.5em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button .mat-datepicker-toggle-default-icon{width:1em}.mtx-form-field-appearance-fluent .mat-form-field-has-label .mat-form-field-flex{margin-top:.84375em}.mtx-form-field-appearance-fluent .mat-form-field-appearance-standard .mat-form-field-flex{padding-top:0}.mtx-form-field-appearance-fluent .mat-form-field-flex{align-items:center;border-radius:2px;padding:0 .5em}.mtx-form-field-appearance-fluent .mat-form-field-infix{border-top:0;padding:.375em 0}.mtx-form-field-appearance-fluent .mat-form-field-prefix,.mtx-form-field-appearance-fluent .mat-form-field-suffix{display:inline-flex}.mtx-form-field-appearance-fluent .mat-form-field-prefix .mat-icon,.mtx-form-field-appearance-fluent .mat-form-field-suffix .mat-icon{line-height:normal}.mtx-form-field-appearance-fluent .mat-form-field-underline{display:none}.mtx-form-field-appearance-fluent .mtx-select{display:block;margin:0 -8px}.mtx-form-field-appearance-fluent .ng-select{margin-top:-.4375em;padding-left:8px;padding-right:8px;padding-top:.4375em}"]
|
|
62
64
|
}] }
|
|
63
65
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtxFormGroup.umd.js","sources":["../../../projects/extensions/form-group/form-group.component.ts","../../../projects/extensions/form-group/form-group.module.ts"],"sourcesContent":["import {\r\n AfterContentInit,\r\n Component,\r\n ContentChildren,\r\n Input,\r\n OnInit,\r\n QueryList,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\r\nimport { MatFormField } from '@angular/material/form-field';\r\n\r\n@Component({\r\n selector: 'mtx-form-group',\r\n host: {\r\n class: 'mtx-form-group',\r\n },\r\n templateUrl: './form-group.component.html',\r\n styleUrls: ['./form-group.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class MtxFormGroupComponent implements OnInit, AfterContentInit {\r\n @ContentChildren(MatFormField) formFields!: QueryList<MatFormField>;\r\n\r\n @Input() label: string;\r\n @Input()\r\n get showRequiredMarker() {\r\n return this._showRequiredMarker;\r\n }\r\n set showRequiredMarker(value: boolean) {\r\n this._showRequiredMarker = coerceBooleanProperty(value);\r\n }\r\n private _showRequiredMarker = false;\r\n\r\n constructor() {}\r\n\r\n ngOnInit(): void {}\r\n\r\n ngAfterContentInit() {\r\n this.formFields.forEach(item => {\r\n item.appearance = 'standard';\r\n });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MtxFormGroupComponent } from './form-group.component';\n\n@NgModule({\n imports: [CommonModule],\n exports: [MtxFormGroupComponent],\n declarations: [MtxFormGroupComponent],\n})\nexport class MtxFormGroupModule {}\n"],"names":["coerceBooleanProperty","Component","ViewEncapsulation","ContentChildren","MatFormField","Input","NgModule","CommonModule"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"mtxFormGroup.umd.js","sources":["../../../projects/extensions/form-group/form-group.component.ts","../../../projects/extensions/form-group/form-group.module.ts"],"sourcesContent":["import {\r\n AfterContentInit,\r\n ChangeDetectionStrategy,\r\n Component,\r\n ContentChildren,\r\n Input,\r\n OnInit,\r\n QueryList,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\r\nimport { MatFormField } from '@angular/material/form-field';\r\n\r\n@Component({\r\n selector: 'mtx-form-group',\r\n exportAs: 'mtxFormGroup',\r\n host: {\r\n class: 'mtx-form-group',\r\n },\r\n templateUrl: './form-group.component.html',\r\n styleUrls: ['./form-group.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class MtxFormGroupComponent implements OnInit, AfterContentInit {\r\n @ContentChildren(MatFormField) formFields!: QueryList<MatFormField>;\r\n\r\n @Input() label: string;\r\n @Input()\r\n get showRequiredMarker() {\r\n return this._showRequiredMarker;\r\n }\r\n set showRequiredMarker(value: boolean) {\r\n this._showRequiredMarker = coerceBooleanProperty(value);\r\n }\r\n private _showRequiredMarker = false;\r\n\r\n constructor() {}\r\n\r\n ngOnInit(): void {}\r\n\r\n ngAfterContentInit() {\r\n this.formFields.forEach(item => {\r\n item.appearance = 'standard';\r\n });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MtxFormGroupComponent } from './form-group.component';\n\n@NgModule({\n imports: [CommonModule],\n exports: [MtxFormGroupComponent],\n declarations: [MtxFormGroupComponent],\n})\nexport class MtxFormGroupModule {}\n"],"names":["coerceBooleanProperty","Component","ViewEncapsulation","ChangeDetectionStrategy","ContentChildren","MatFormField","Input","NgModule","CommonModule"],"mappings":";;;;;;;;;;;;QAqCE;YAFQ,wBAAmB,GAAG,KAAK,CAAC;SAEpB;QAThB,sBACI,qDAAkB;;;;iBADtB;gBAEE,OAAO,IAAI,CAAC,mBAAmB,CAAC;aACjC;;;;;iBACD,UAAuB,KAAc;gBACnC,IAAI,CAAC,mBAAmB,GAAGA,8BAAqB,CAAC,KAAK,CAAC,CAAC;aACzD;;;WAHA;;;;QAQD,wCAAQ,GAAR,eAAmB;;;;QAEnB,kDAAkB,GAAlB;YACE,IAAI,CAAC,UAAU,CAAC,OAAO;;;eAAC;;;gBAAA,IAAI;gBAC1B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;aAC9B,EAAC,CAAC;SACJ;;;;gBAhCFC,cAAS,SAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,cAAc;oBACxB,IAAI,EAAE;wBACJ,KAAK,EAAE,gBAAgB;qBACxB;oBACD,mRAA0C;oBAE1C,aAAa,EAAEC,sBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAEC,4BAAuB,CAAC,MAAM;;iBAChD;;;;;6BAEEC,oBAAe,SAACC,sBAAY;wBAE5BC,UAAK;qCACLA,UAAK;;;;QAHN,2CAAoE;;QAEpE,sCAAuB;;;;;QAQvB,oDAAoC;;;;;;;;;QCzBtC;;;;;gBALCC,aAAQ,SAAC;oBACR,OAAO,EAAE,CAACC,mBAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,qBAAqB,CAAC;oBAChC,YAAY,EAAE,CAAC,qBAAqB,CAAC;iBACtC;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@angular/common"),require("@angular/cdk/coercion"),require("@angular/material/form-field")):"function"==typeof define&&define.amd?define("@ng-matero/extensions/form-group",["exports","@angular/core","@angular/common","@angular/cdk/coercion","@angular/material/form-field"],r):r(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-matero"]=e["ng-matero"]||{},e["ng-matero"].extensions=e["ng-matero"].extensions||{},e["ng-matero"].extensions["form-group"]={}),e.ng.core,e.ng.common,e.ng.cdk.coercion,e.ng.material.formField)}(this,(function(e,r,t,o,a){"use strict";var n=function(){function e(){this._showRequiredMarker=!1}return Object.defineProperty(e.prototype,"showRequiredMarker",{get:function(){return this._showRequiredMarker},set:function(e){this._showRequiredMarker=o.coerceBooleanProperty(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.ngAfterContentInit=function(){this.formFields.forEach((function(e){e.appearance="standard"}))},e}();n.decorators=[{type:r.Component,args:[{selector:"mtx-form-group",host:{class:"mtx-form-group"},template:'<div class="mtx-form-field-layout mtx-form-field-appearance-fluent">\r\n <label *ngIf="label"\r\n class="mtx-form-label"\r\n [class.mtx-form-label-marker]="showRequiredMarker">{{label}}</label>\r\n <ng-content></ng-content>\r\n</div>\r\n',encapsulation:r.ViewEncapsulation.None,styles:['.mtx-form-group{display:inline-block}.mtx-form-group .mtx-form-field-layout{align-items:flex-start;display:inline-flex;width:100%}.mtx-form-group .mtx-form-label{display:inline-block;line-height:1.125;padding-bottom:calc(.375em + 1px);padding-right:1em;padding-top:calc(.375em + 1px);position:relative}[dir=rtl] .mtx-form-group .mtx-form-label{padding-left:1em;padding-right:unset}.mtx-form-group .mtx-form-label.mtx-form-label-marker:after{content:"*";margin-left:4px}[dir=rtl] .mtx-form-group .mtx-form-label.mtx-form-label-marker:after{margin-left:auto;margin-right:4px}.mtx-form-field-appearance-fluent .mat-form-field{margin-bottom:.25em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button{height:1.5em;width:1.5em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button .mat-datepicker-toggle-default-icon{width:1em}.mtx-form-field-appearance-fluent .mat-form-field-has-label .mat-form-field-flex{margin-top:.84375em}.mtx-form-field-appearance-fluent .mat-form-field-appearance-standard .mat-form-field-flex{padding-top:0}.mtx-form-field-appearance-fluent .mat-form-field-flex{align-items:center;border-radius:2px;padding:0 .5em}.mtx-form-field-appearance-fluent .mat-form-field-infix{border-top:0;padding:.375em 0}.mtx-form-field-appearance-fluent .mat-form-field-prefix,.mtx-form-field-appearance-fluent .mat-form-field-suffix{display:inline-flex}.mtx-form-field-appearance-fluent .mat-form-field-prefix .mat-icon,.mtx-form-field-appearance-fluent .mat-form-field-suffix .mat-icon{line-height:normal}.mtx-form-field-appearance-fluent .mat-form-field-underline{display:none}.mtx-form-field-appearance-fluent .mtx-select{display:block;margin:0 -8px}.mtx-form-field-appearance-fluent .ng-select{margin-top:-.4375em;padding-left:8px;padding-right:8px;padding-top:.4375em}']}]}],n.ctorParameters=function(){return[]},n.propDecorators={formFields:[{type:r.ContentChildren,args:[a.MatFormField]}],label:[{type:r.Input}],showRequiredMarker:[{type:r.Input}]};var m=function(){};m.decorators=[{type:r.NgModule,args:[{imports:[t.CommonModule],exports:[n],declarations:[n]}]}],e.MtxFormGroupComponent=n,e.MtxFormGroupModule=m,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@angular/common"),require("@angular/cdk/coercion"),require("@angular/material/form-field")):"function"==typeof define&&define.amd?define("@ng-matero/extensions/form-group",["exports","@angular/core","@angular/common","@angular/cdk/coercion","@angular/material/form-field"],r):r(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-matero"]=e["ng-matero"]||{},e["ng-matero"].extensions=e["ng-matero"].extensions||{},e["ng-matero"].extensions["form-group"]={}),e.ng.core,e.ng.common,e.ng.cdk.coercion,e.ng.material.formField)}(this,(function(e,r,t,o,a){"use strict";var n=function(){function e(){this._showRequiredMarker=!1}return Object.defineProperty(e.prototype,"showRequiredMarker",{get:function(){return this._showRequiredMarker},set:function(e){this._showRequiredMarker=o.coerceBooleanProperty(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.ngAfterContentInit=function(){this.formFields.forEach((function(e){e.appearance="standard"}))},e}();n.decorators=[{type:r.Component,args:[{selector:"mtx-form-group",exportAs:"mtxFormGroup",host:{class:"mtx-form-group"},template:'<div class="mtx-form-field-layout mtx-form-field-appearance-fluent">\r\n <label *ngIf="label"\r\n class="mtx-form-label"\r\n [class.mtx-form-label-marker]="showRequiredMarker">{{label}}</label>\r\n <ng-content></ng-content>\r\n</div>\r\n',encapsulation:r.ViewEncapsulation.None,changeDetection:r.ChangeDetectionStrategy.OnPush,styles:['.mtx-form-group{display:inline-block}.mtx-form-group .mtx-form-field-layout{align-items:flex-start;display:inline-flex;width:100%}.mtx-form-group .mtx-form-label{display:inline-block;line-height:1.125;padding-bottom:calc(.375em + 1px);padding-right:1em;padding-top:calc(.375em + 1px);position:relative}[dir=rtl] .mtx-form-group .mtx-form-label{padding-left:1em;padding-right:unset}.mtx-form-group .mtx-form-label.mtx-form-label-marker:after{content:"*";margin-left:4px}[dir=rtl] .mtx-form-group .mtx-form-label.mtx-form-label-marker:after{margin-left:auto;margin-right:4px}.mtx-form-field-appearance-fluent .mat-form-field{margin-bottom:.25em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button{height:1.5em;width:1.5em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button .mat-datepicker-toggle-default-icon{width:1em}.mtx-form-field-appearance-fluent .mat-form-field-has-label .mat-form-field-flex{margin-top:.84375em}.mtx-form-field-appearance-fluent .mat-form-field-appearance-standard .mat-form-field-flex{padding-top:0}.mtx-form-field-appearance-fluent .mat-form-field-flex{align-items:center;border-radius:2px;padding:0 .5em}.mtx-form-field-appearance-fluent .mat-form-field-infix{border-top:0;padding:.375em 0}.mtx-form-field-appearance-fluent .mat-form-field-prefix,.mtx-form-field-appearance-fluent .mat-form-field-suffix{display:inline-flex}.mtx-form-field-appearance-fluent .mat-form-field-prefix .mat-icon,.mtx-form-field-appearance-fluent .mat-form-field-suffix .mat-icon{line-height:normal}.mtx-form-field-appearance-fluent .mat-form-field-underline{display:none}.mtx-form-field-appearance-fluent .mtx-select{display:block;margin:0 -8px}.mtx-form-field-appearance-fluent .ng-select{margin-top:-.4375em;padding-left:8px;padding-right:8px;padding-top:.4375em}']}]}],n.ctorParameters=function(){return[]},n.propDecorators={formFields:[{type:r.ContentChildren,args:[a.MatFormField]}],label:[{type:r.Input}],showRequiredMarker:[{type:r.Input}]};var m=function(){};m.decorators=[{type:r.NgModule,args:[{imports:[t.CommonModule],exports:[n],declarations:[n]}]}],e.MtxFormGroupComponent=n,e.MtxFormGroupModule=m,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mtxFormGroup.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/extensions/form-group/form-group.component.ts","../../../projects/extensions/form-group/form-group.module.ts"],"names":["MtxFormGroupComponent","this","_showRequiredMarker","Object","defineProperty","prototype","value","coerceBooleanProperty","ngOnInit","ngAfterContentInit","formFields","forEach","item","appearance","Component","args","selector","host","class","template","encapsulation","ViewEncapsulation","None","ContentChildren","MatFormField","Input","NgModule","imports","CommonModule","exports","declarations"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../projects/extensions/form-group/form-group.component.ts","../../../projects/extensions/form-group/form-group.module.ts"],"names":["MtxFormGroupComponent","this","_showRequiredMarker","Object","defineProperty","prototype","value","coerceBooleanProperty","ngOnInit","ngAfterContentInit","formFields","forEach","item","appearance","Component","args","selector","exportAs","host","class","template","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","ContentChildren","MatFormField","Input","NgModule","imports","CommonModule","exports","declarations"],"mappings":"2rBAqCE,SAAAA,IAFQC,KAAAC,qBAAsB,SAP9BC,OAAAC,eACIJ,EAAAK,UAAA,qBAAkB,KADtB,WAEE,OAAOJ,KAAKC,yBAEd,SAAuBI,GACrBL,KAAKC,oBAAsBK,EAAAA,sBAAsBD,oCAMnDN,EAAAK,UAAAG,SAAA,aAEAR,EAAAK,UAAAI,mBAAA,WACER,KAAKS,WAAWC,SAAO,SAACC,GACtBA,EAAKC,WAAa,wCA9BvBC,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,iBACVC,SAAU,eACVC,KAAM,CACJC,MAAO,kBAETC,SAAA,kQAEAC,cAAeC,EAAAA,kBAAkBC,KACjCC,gBAAiBC,EAAAA,wBAAwBC,w5DAGxCC,EAAAA,gBAAeZ,KAAA,CAACa,EAAAA,6BAEhBC,EAAAA,kCACAA,EAAAA,eClBH,iCALCC,EAAAA,SAAQf,KAAA,CAAC,CACRgB,QAAS,CAACC,EAAAA,cACVC,QAAS,CAACjC,GACVkC,aAAc,CAAClC","sourcesContent":["import {\r\n AfterContentInit,\r\n ChangeDetectionStrategy,\r\n Component,\r\n ContentChildren,\r\n Input,\r\n OnInit,\r\n QueryList,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\r\nimport { MatFormField } from '@angular/material/form-field';\r\n\r\n@Component({\r\n selector: 'mtx-form-group',\r\n exportAs: 'mtxFormGroup',\r\n host: {\r\n class: 'mtx-form-group',\r\n },\r\n templateUrl: './form-group.component.html',\r\n styleUrls: ['./form-group.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class MtxFormGroupComponent implements OnInit, AfterContentInit {\r\n @ContentChildren(MatFormField) formFields!: QueryList<MatFormField>;\r\n\r\n @Input() label: string;\r\n @Input()\r\n get showRequiredMarker() {\r\n return this._showRequiredMarker;\r\n }\r\n set showRequiredMarker(value: boolean) {\r\n this._showRequiredMarker = coerceBooleanProperty(value);\r\n }\r\n private _showRequiredMarker = false;\r\n\r\n constructor() {}\r\n\r\n ngOnInit(): void {}\r\n\r\n ngAfterContentInit() {\r\n this.formFields.forEach(item => {\r\n item.appearance = 'standard';\r\n });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MtxFormGroupComponent } from './form-group.component';\n\n@NgModule({\n imports: [CommonModule],\n exports: [MtxFormGroupComponent],\n declarations: [MtxFormGroupComponent],\n})\nexport class MtxFormGroupModule {}\n"]}
|