mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 08:35:43 -06:00
* build(webpack): replace babel-loader with esbuild-loader * build(webpack): add esbuild minifier to production builds * Wip * Removed ngInject and replaced with manual inject params * chore: bump esbuild to 0.15.13 * Fixed angular issues * build(frontend): update esbuild to 0.16.16 * chore(webpack): support browserslist for esbuild * build(esbuild): unify versions of esbuild to 0.16.17 and esbuild-loader to 2.21.0 Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
25 lines
785 B
TypeScript
25 lines
785 B
TypeScript
/**
|
|
* Wrapper for the new ngReact <color-picker> directive for backward compatibility.
|
|
* Allows remaining <spectrum-picker> untouched in outdated plugins.
|
|
* Technically, it's just a wrapper for react component with two-way data binding support.
|
|
*/
|
|
import coreModule from '../core_module';
|
|
|
|
coreModule.directive('spectrumPicker', spectrumPicker);
|
|
|
|
export function spectrumPicker() {
|
|
return {
|
|
restrict: 'E',
|
|
require: 'ngModel',
|
|
scope: true,
|
|
replace: true,
|
|
template: '<color-picker color="ngModel.$viewValue" on-change="onColorChange"></color-picker>',
|
|
link: (scope: any, element: any, attrs: any, ngModel: any) => {
|
|
scope.ngModel = ngModel;
|
|
scope.onColorChange = (color: string) => {
|
|
ngModel.$setViewValue(color);
|
|
};
|
|
},
|
|
};
|
|
}
|