UNPKG

@progress/kendo-vue-inputs

Version:
9 lines (8 loc) 1.44 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./misc.js"),n=require("@progress/kendo-drawing");class l{constructor(){this.colorRows=[]}setColorMatrix(r,o){if(this.colorRows=[],!!(e.isPresent(r)&&r.length)){o=o||r.length;for(let s=0;s<r.length;s+=o){const t=r.slice(s,o+s);this.colorRows.push(t)}}}isInColors(r,o){return r.some(s=>s===o)}getCellCoordsFor(r){if(!e.isPresent(r))return;const o=r&&n.parseColor(r,!0),s=[r];e.isPresent(o)&&s.push(o.toCss(),o.toCssRgba());for(let t=0;t<this.colorRows.length;t++)for(let i=0;i<this.colorRows[t].length;i++)if(this.isInColors(s,this.colorRows[t][i]))return{row:t,col:i}}getColorAt(r){if(e.isPresent(r)&&e.isPresent(this.colorRows[r.row]))return this.colorRows[r.row][r.col]}getNextCell(r,o,s){if(!(e.isPresent(r)&&e.isPresent(r.row)&&e.isPresent(r.col)))return{row:0,col:0};const t=this.clampIndex(r.row+s,this.colorRows.length-1),i=this.clampIndex(r.col+o,this.colorRows[t].length-1);return{row:t,col:i}}clampIndex(r,o){return r<0?0:r>o?o:r}}exports.ColorPaletteService=l;