@omegagrid/grid-core 0.10.54 → 0.10.56
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/dist/model/cssStyle.d.ts
CHANGED
|
@@ -17,4 +17,7 @@ export declare const addPattern: (css: CSSStyle, s: Style) => CSSStyle;
|
|
|
17
17
|
export declare const addGradient: (css: CSSStyle, s: Style) => CSSStyle;
|
|
18
18
|
export declare const styleToCSStyle: (s: Style) => CSSStyle;
|
|
19
19
|
export declare const cssStyleToStyle: (s: CSSStyle | string) => Style;
|
|
20
|
+
export declare const applyStyle: (div: HTMLDivElement, style: CSSStyle) => void;
|
|
21
|
+
export declare const requiresManualAlignment: (style: Style) => boolean;
|
|
22
|
+
export declare const applyAlignment: (div: HTMLDivElement, style: Style) => void;
|
|
20
23
|
//# sourceMappingURL=cssStyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cssStyle.d.ts","sourceRoot":"","sources":["../../src/model/cssStyle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAuB,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE7F,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAIrF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAO7D;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAC,OAAO,GAAC,QAAQ,GAAC,QAAQ,GAAC,QAAQ,CAAC;AACvE,eAAO,MAAM,iBAAiB;WACtB,MAAM;WACN,cAAc;EAgBpB,CAAC;AAEH,eAAO,MAAM,iBAAiB,+CAQ1B,CAAC;AAEL,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GACP,iBAAiB,CAClE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAA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GAAG,KAAK,KAAI,QAGtD,CAAA;AAgBD,eAAO,MAAM,cAAc,GAAI,GAAG,KAAK,KAAG,QA2CzC,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,GAAG,QAAQ,GAAC,MAAM,KAAG,KA4FpD,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,KAAK,cAAc,EAAE,OAAO,QAAQ,SAI9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,OAAO,KAAK,YAEnD,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,KAAK,cAAc,EAAE,OAAO,KAAK,SAwB/D,CAAC"}
|
package/dist/model/cssStyle.js
CHANGED
|
@@ -153,42 +153,17 @@ export const addGradient = (css, s) => {
|
|
|
153
153
|
return css;
|
|
154
154
|
};
|
|
155
155
|
function createCssRotation(align, valign, rot) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
style.position = "absolute";
|
|
170
|
-
style.transformOrigin = "bottom left";
|
|
171
|
-
style.transform = "rotate(" + (-rot).toString() + "deg) translateY(50%)";
|
|
172
|
-
style.left = "50%";
|
|
173
|
-
style.bottom = "0";
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
else if (align == 'right') {
|
|
177
|
-
style.position = "absolute";
|
|
178
|
-
style.transformOrigin = "top right";
|
|
179
|
-
style.transform = "rotate(" + (rot).toString() + "deg) translateX(50%)";
|
|
180
|
-
style.top = "50%";
|
|
181
|
-
style.right = "0";
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
style.position = "absolute";
|
|
185
|
-
style.transformOrigin = "top left";
|
|
186
|
-
style.transform = "rotate(" + (rot).toString() + "deg) translateX(-50%)";
|
|
187
|
-
style.top = "50%";
|
|
188
|
-
style.left = "0";
|
|
189
|
-
}
|
|
190
|
-
style.overflow = 'visible';
|
|
191
|
-
return style;
|
|
156
|
+
return {
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
overflow: 'visible',
|
|
159
|
+
inset: 'initial',
|
|
160
|
+
padding: '0',
|
|
161
|
+
// margin: '0 auto',
|
|
162
|
+
// width: '100%',
|
|
163
|
+
// height: '100%',
|
|
164
|
+
// transformOrigin: 'center center',
|
|
165
|
+
transform: "rotate(" + (-rot).toString() + "deg)"
|
|
166
|
+
};
|
|
192
167
|
}
|
|
193
168
|
export const styleToCSStyle = (s) => {
|
|
194
169
|
const style = s.cssStyle ? { ...s.cssStyle } : {};
|
|
@@ -346,4 +321,38 @@ export const cssStyleToStyle = (s) => {
|
|
|
346
321
|
}
|
|
347
322
|
return style;
|
|
348
323
|
};
|
|
324
|
+
export const applyStyle = (div, style) => {
|
|
325
|
+
for (const k in style) {
|
|
326
|
+
div.style[k] = style[k];
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
export const requiresManualAlignment = (style) => {
|
|
330
|
+
return style.alignment && style.alignment.textRotation != null;
|
|
331
|
+
};
|
|
332
|
+
export const applyAlignment = (div, style) => {
|
|
333
|
+
if (!style.alignment || style.alignment.textRotation == null)
|
|
334
|
+
return;
|
|
335
|
+
// rect = transformed (visual) bounding box; offset*/client* = untransformed layout boxes.
|
|
336
|
+
// With transform-origin center, the visual box is centered on the untransformed box,
|
|
337
|
+
// so the gap to each edge is half the size difference on that axis.
|
|
338
|
+
const alignment = style.alignment;
|
|
339
|
+
const rect = div.getBoundingClientRect();
|
|
340
|
+
const parent = div.parentElement;
|
|
341
|
+
const dx = (rect.width - div.offsetWidth) / 2;
|
|
342
|
+
const dy = (rect.height - div.offsetHeight) / 2;
|
|
343
|
+
const pos = {};
|
|
344
|
+
if (alignment.vertical == 'top')
|
|
345
|
+
pos.t = dy;
|
|
346
|
+
else if (alignment.vertical == 'bottom')
|
|
347
|
+
pos.b = dy;
|
|
348
|
+
else
|
|
349
|
+
pos.t = (parent.clientHeight - div.offsetHeight) / 2;
|
|
350
|
+
if (alignment.horizontal == 'left')
|
|
351
|
+
pos.l = dx;
|
|
352
|
+
else if (alignment.horizontal == 'right')
|
|
353
|
+
pos.r = dx;
|
|
354
|
+
else
|
|
355
|
+
pos.l = (parent.clientWidth - div.offsetWidth) / 2;
|
|
356
|
+
dom.setPosition(div, pos);
|
|
357
|
+
};
|
|
349
358
|
//# sourceMappingURL=cssStyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cssStyle.js","sourceRoot":"","sources":["../../src/model/cssStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKrD,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAEtC,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IAClD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAClC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACd,CAAC;AAGD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAGrC;IACF,CAAC,MAAM,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAC,CAAC;IACtC,CAAC,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAC,CAAC;IACtC,CAAC,OAAO,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAC,CAAC;IACrC,CAAC,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,EAA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S,CAAC,QAAQ,GAAG,KAAK,IAAI,KAAK,IAAI,QAAQ,CAAC;gBACtD,MAAM;YACP,KAAK,OAAO;gBACX,KAAK,CAAC,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;gBACrC,MAAM;YACP,KAAK,YAAY,CAAC;YAClB,KAAK,iBAAiB,CAAC;YACvB,KAAK,kBAAkB;gBACtB,KAAK,CAAC,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;gBACvC,MAAM;YACP,KAAK,UAAU,CAAC;YAChB,KAAK,WAAW;gBACf,KAAK,CAAC,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC7B,MAAM;YACP,KAAK,YAAY,CAAC;YAClB,KAAK,aAAa;gBACjB,KAAK,CAAC,IAAI,GAAG,KAAK,IAAI,MAAM,CAAC;gBAC7B,MAAM;YACP,KAAK,WAAW,CAAC;YACjB,KAAK,YAAY;gBAChB,KAAK,CAAC,MAAM,GAAG,KAAK,IAAI,QAAQ,CAAC;gBACjC,MAAM;YACP;gBACC,KAAK,CAAC,CAAgB,CAAC,GAAG,KAAK,CAAC;gBAChC,MAAM;QACR,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC,CAAA","sourcesContent":["import { colors, dom, utils } from \"@omegagrid/core\";\nimport { Border, BorderStyle, HorizontalAlignment, Style, VerticalAlignment } from \"./style\";\n\nexport type CSSStyle = Partial<CSSStyleDeclaration> & { [propName: string]: string };\n\nconst DEFAULT_BORDER_COLOR = 'CCCCCC';\n\nexport function cssStyleFromString(strStyle: string): CSSStyle {\n\tconst style: CSSStyle = {};\n\tstrStyle.split(';').forEach(item => {\n\t\tconst [key, value] = item.split(':');\n\t\tstyle[key] = value.trim();\n\t});\n\treturn style;\n}\n\nexport type CSSBorderStyle = 'none'|'solid'|'double'|'dotted'|'dashed';\nexport const borderStyleCSSMap = new Map<BorderStyle, {\n\twidth: number, \n\tstyle: CSSBorderStyle,\n}>([\n\t['thin', {width: 1.5, style: 'solid'}],\n\t['medium', {width: 2, style: 'solid'}],\n\t['thick', {width: 3, style: 'solid'}],\n\t['double', {width: 3, style: 'double'}],\n\t['dotted', {width: 1.5, style: 'dotted'}],\n\t['hair', {width: 1, style: 'solid'}],\n\t['dashed', {width: 1.5, style: 'dashed'}],\n\t['mediumDashed', {width: 2, style: 'dashed'}],\n\t['dashDot', {width: 1.5, style: 'dashed'}],\n\t['mediumDashDot', {width: 2, style: 'dashed'}],\n\t['dashDotDot', {width: 1.5, style: 'dotted'}],\n\t['mediumDashDotDot', {width: 2, style: 'dotted'}],\n\t['slantDashDot', {width: 1.5, style: 'dashed'}],\n\t['none', {width: 1.5, style: 'solid'}],\n]);\n\nexport const borderCSSStyleMap = (() => {\n\tconst map = new Map<CSSBorderStyle, Map<number, BorderStyle>>();\n\tborderStyleCSSMap.forEach((value, key) => {\n\t\tlet widthMap: Map<number, BorderStyle> = map.get(value.style);\n\t\tif (!widthMap) widthMap = map.set(value.style, new Map()).get(value.style);\n\t\twidthMap.set(value.width, key);\n\t});\n\treturn map;\n})();\n\nexport function convertCSSVerticalAlignment(align: string) {\n\treturn (align == 'middle' ? 'center' : align) as VerticalAlignment;\n}\n\nexport function convertCSSColor(color: string) {\n\tcolor = color.charAt(0) == '#' ? color.substring(1) : color;\n\tif (/^[0-9a-fA-F]{3}$/.test(color)) {\n\t\treturn color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n\t}\n\tif (/^[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(color)) {\n\t\treturn color;\n\t}\n\t// named colors (red, green, ...), rgb()/hsl(), etc.\n\treturn colors.plainHex(colors.toHex(color));\n}\n\nexport const convertCSSBorder = (border: string): Border => {\n\tif (border == 'none') return null;\n\t\n\tconst chunks = border.split(' ');\n\tconst width = parseInt(chunks[0].charAt(0)) || 1;\n\tconst borderStyle = chunks.length > 1 ? (chunks[1] as CSSBorderStyle) : 'solid';\n\n\tconst widthMap = borderCSSStyleMap.get(borderStyle);\n\treturn {\n\t\tstyle: (widthMap ? widthMap.get(width) : null) ?? 'thin',\n\t\tcolor: chunks.length > 2 ? convertCSSColor(chunks[2]) : DEFAULT_BORDER_COLOR\n\t};\n}\n\nexport const convertToCSSBorder = (b: Border) => {\n\tconst borderStyle = borderStyleCSSMap.get(b.style || 'none');\n\tif (!borderStyle) return 'none';\n\treturn [\n\t\tdom.px(borderStyle.width),\n\t\tborderStyle.style,\n\t\tb.style == 'none' ? 'var(--og-cell-background)' : (b.color ? `#${b.color}` : 'var(--og-border-color)'),\n\t].join(' ');\n}\n\nexport const addPattern = (css: CSSStyle, s: Style) : CSSStyle => {\n\t// background-image: radial-gradient(rgb(255, 255, 255) 10%, transparent 10%), radial-gradient(rgb(255, 255, 255) 10%, transparent 10%);\n\t// background-position: 0px 0px, 4px 4px;\n\t// background-size: 8px 8px;\n\t// background-color: rgb(255, 51, 51);\n\n\t// console.log('addPattern', s.patternType, fgColor, bgColor);\n\n\tconst fg = '#' + (s.fgColor || '000000');\n\tconst bg = '#' + (s.bgColor || 'FFFFFF');\n\n\tswitch (s.patternType) {\n\t\tcase 'solid':\n\t\t\tcss.backgroundColor = fg || bg;\n\t\t\tbreak;\n\t\tcase 'darkGray':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.75);\n\t\t\tbreak;\n\t\tcase 'mediumGray':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.50);\n\t\t\tbreak;\n\t\tcase 'lightGray':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.25);\n\t\t\tbreak;\n\t\tcase 'gray125':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.125);\n\t\t\tbreak;\n\t\tcase 'gray0625':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.0625);\n\t\t\tbreak;\n\t\tcase 'darkHorizontal':\n\t\t\tcss.backgroundImage = `linear-gradient(0deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'darkVertical':\n\t\t\tcss.backgroundImage = `linear-gradient(90deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'darkDown':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'darkUp':\n\t\t\tcss.backgroundImage = `linear-gradient(-45deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'lightHorizontal':\n\t\t\tcss.backgroundImage = `linear-gradient(0deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'lightVertical':\n\t\t\tcss.backgroundImage = `linear-gradient(90deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'lightDown':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'lightUp':\n\t\t\tcss.backgroundImage = `linear-gradient(-45deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'darkGrid':\n\t\t\tcss.backgroundImage = `linear-gradient(${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '2px 2px';\n\t\t\tbreak;\n\t\tcase 'lightGrid':\n\t\t\tcss.backgroundImage = `linear-gradient(${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '1px 1px';\n\t\t\tbreak;\n\t\tcase 'darkTrellis':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '2px 2px';\n\t\t\tbreak;\n\t\tcase 'lightTrellis':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '1px 1px';\n\t\t\tbreak;\n\t}\n\n\treturn css;\n}\n\nexport const addGradient = (css: CSSStyle, s: Style) : CSSStyle => {\n\tcss.backgroundImage = `linear-gradient(${(s.angle ?? 0) + 90}deg,${s.stops.map(stop => `#${stop.rgb} ${stop.v * 100}%`).join(',')})`;\n\treturn css;\n}\n\nfunction createCssRotation(align: HorizontalAlignment, valign: VerticalAlignment, rot: number) : CSSStyle {\n\tconst style: CSSStyle = {};\n\tif (align == 'center') {\n\t\tif (valign == 'center') {\n\t\t\tstyle.transform = \"rotate(\" + (-rot).toString() + \"deg)\";\n\t\t} else if (valign == 'top') {\n\t\t\tstyle.position = \"absolute\";\n\t\t\tstyle.transformOrigin = \"top right\";\n\t\t\tstyle.transform = \"rotate(\" + (-rot).toString() + \"deg) translateY(-50%)\";\n\t\t\tstyle.right = \"50%\";\n\t\t\tstyle.top = \"0\";\n\t\t} else {\n\t\t\tstyle.position = \"absolute\";\n\t\t\tstyle.transformOrigin = \"bottom left\";\n\t\t\tstyle.transform = \"rotate(\" + (-rot).toString() + \"deg) translateY(50%)\";\n\t\t\tstyle.left = \"50%\";\n\t\t\tstyle.bottom = \"0\";\n\t\t}\n\t} else if (align == 'right') {\n\t\tstyle.position = \"absolute\";\n\t\tstyle.transformOrigin = \"top right\";\n\t\tstyle.transform = \"rotate(\" + (rot).toString() + \"deg) translateX(50%)\";\n\t\tstyle.top = \"50%\";\n\t\tstyle.right = \"0\";\n\t} else {\n\t\tstyle.position = \"absolute\";\n\t\tstyle.transformOrigin = \"top left\";\n\t\tstyle.transform = \"rotate(\" + (rot).toString() + \"deg) translateX(-50%)\";\n\t\tstyle.top = \"50%\";\n\t\tstyle.left = \"0\";\n\t}\n\tstyle.overflow = 'visible';\n\treturn style;\n}\n\nexport const styleToCSStyle = (s: Style): CSSStyle => {\n\tconst style: CSSStyle = s.cssStyle ? {...s.cssStyle} : {};\n\tif (s.bold != null) style.fontWeight = s.bold ? 'bold' : 'normal';\n\tif (s.italic) style.fontStyle = 'italic';\n\tif (s.underline) style.textDecoration = 'underline';\n\telse if (s.strike) style.textDecoration = 'line-through';\n\tif (s.sz) style.fontSize = dom.numToPixels(s.sz); // (s.sz * 0.75).toString() + 'px';\n\tif (s.color) style.color = '#' + s.color;\n\tif (s.top) style.borderTop = convertToCSSBorder(s.top);\n\tif (s.right) style.borderRight = convertToCSSBorder(s.right);\n\tif (s.bottom) style.borderBottom = convertToCSSBorder(s.bottom);\n\tif (s.left) style.borderLeft = convertToCSSBorder(s.left);\n\tif (s.top || s.right || s.bottom || s.left) style.zIndex = '1';\n\tif (s.alignment) {\n\t\tif (s.alignment.vertical) {\n\t\t\tstyle.display = 'flex';\n\t\t\tstyle.justifyContent = s.alignment.horizontal;\n\t\t\tstyle.alignItems = s.alignment.vertical == 'top' ? 'start' : (s.alignment.vertical == 'bottom' ? 'end' : 'center');\n\t\t}\n\n\t\tif (s.alignment.horizontal) {\n\t\t\tstyle.textAlign = s.alignment.horizontal;\n\t\t}\n\n\t\tif (s.alignment.wrapText) {\n\t\t\tstyle.display = 'flex';\n\t\t\tstyle.justifyContent = style.justifyContent ?? style.textAlign ?? 'left';\n\t\t\tstyle.alignItems = style.alignItems ?? 'center';\n\t\t\tstyle.whiteSpace = 'pre-wrap';\n\t\t}\n\n\t\tif (s.alignment.textRotation) {\n\t\t\tObject.assign(style, createCssRotation(s.alignment.horizontal || 'center', s.alignment.vertical || 'center', s.alignment.textRotation));\n\t\t}\n\t}\n\tif (s.patternType) addPattern(style, s);\n\telse if (s.stops && s.stops.length) addGradient(style, s);\n\telse if (s.fgColor) style.backgroundColor = '#' + s.fgColor;\n\telse if (s.bgColor) style.backgroundColor = '#' + s.bgColor;\n\t\n\t///TODO - rotation\n\t\n\treturn style;\n}\n\nexport const cssStyleToStyle = (s: CSSStyle|string): Style => {\n\tconst cssStyle: CSSStyle = utils.isObject(s) ? s as CSSStyle : cssStyleFromString(s as string);\n\tconst style: Style = {};\n\tlet border: Border;\n\tfor (const k in cssStyle) {\n\t\tconst value = cssStyle[k];\n\t\tif (value == null) continue;\n\t\tswitch(k) {\n\t\t\tcase 'borderTop':\n\t\t\tcase 'border-top':\n\t\t\t\tstyle.top = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderTopColor':\n\t\t\tcase 'border-top-color':\n\t\t\t\tif (style.top) style.top.color = convertCSSColor(value as string);\n\t\t\t\telse style.top = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\n\t\t\tcase 'borderRight':\n\t\t\tcase 'border-right':\n\t\t\t\tstyle.right = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderRightColor':\n\t\t\tcase 'border-right-color':\n\t\t\t\tif (style.right) style.right.color = convertCSSColor(value as string);\n\t\t\t\telse style.right = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\n\t\t\tcase 'borderBottom':\n\t\t\tcase 'border-bottom':\n\t\t\t\tstyle.bottom = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderBottomColor':\n\t\t\tcase 'border-bottom-color':\n\t\t\t\tif (style.bottom) style.bottom.color = convertCSSColor(value as string);\n\t\t\t\telse style.bottom = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\n\t\t\tcase 'borderLeft':\n\t\t\tcase 'border-left':\n\t\t\t\tstyle.left = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderLeftColor':\n\t\t\tcase 'border-left-color':\n\t\t\t\tif (style.left) style.left.color = convertCSSColor(value as string);\n\t\t\t\telse style.left = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\t\t\n\t\t\tcase 'border':\n\t\t\t\tborder = convertCSSBorder(value as string);\n\t\t\t\tstyle.top = style.top || border;\n\t\t\t\tstyle.right = style.right || border;\n\t\t\t\tstyle.bottom = style.bottom || border;\n\t\t\t\tstyle.left = style.left || border;\n\t\t\t\tbreak;\n\t\t\tcase 'textAlign':\n\t\t\tcase 'text-align':\n\t\t\t\tstyle.alignment = style.alignment || {};\n\t\t\t\tstyle.alignment.horizontal = value as HorizontalAlignment;\n\t\t\t\tbreak;\n\t\t\tcase 'verticalAlign':\n\t\t\tcase 'vertical-align':\n\t\t\t\tstyle.alignment = style.alignment || {};\n\t\t\t\tstyle.alignment.vertical = convertCSSVerticalAlignment(value);\n\t\t\t\tbreak;\n\t\t\tcase 'whiteSpace':\n\t\t\tcase 'white-space':\n\t\t\t\tstyle.alignment = style.alignment || {};\n\t\t\t\tstyle.alignment.wrapText = value && value != 'nowrap';\n\t\t\t\tbreak;\n\t\t\tcase 'color':\n\t\t\t\tstyle.color = convertCSSColor(value);\n\t\t\t\tbreak;\n\t\t\tcase 'background':\n\t\t\tcase 'backgroundColor':\n\t\t\tcase 'background-color':\n\t\t\t\tstyle.fgColor = convertCSSColor(value);\n\t\t\t\tbreak;\n\t\t\tcase 'fontSize':\n\t\t\tcase 'font-size':\n\t\t\t\tstyle.sz = parseFloat(value);\n\t\t\t\tbreak;\n\t\t\tcase 'fontWeight':\n\t\t\tcase 'font-weight':\n\t\t\t\tstyle.bold = value == 'bold';\n\t\t\t\tbreak;\n\t\t\tcase 'fontStyle':\n\t\t\tcase 'font-style':\n\t\t\t\tstyle.italic = value == 'italic';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tstyle[k as keyof Style] = value;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn style;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cssStyle.js","sourceRoot":"","sources":["../../src/model/cssStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,GAAG,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKlE,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAEtC,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IAClD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAClC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACd,CAAC;AAGD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAGrC;IACF,CAAC,MAAM,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAC,CAAC;IACtC,CAAC,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAC,CAAC;IACtC,CAAC,OAAO,EAAE,EAAC,KA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agrid/core\";\nimport { Border, BorderStyle, HorizontalAlignment, Style, VerticalAlignment } from \"./style\";\n\nexport type CSSStyle = Partial<CSSStyleDeclaration> & { [propName: string]: string };\n\nconst DEFAULT_BORDER_COLOR = 'CCCCCC';\n\nexport function cssStyleFromString(strStyle: string): CSSStyle {\n\tconst style: CSSStyle = {};\n\tstrStyle.split(';').forEach(item => {\n\t\tconst [key, value] = item.split(':');\n\t\tstyle[key] = value.trim();\n\t});\n\treturn style;\n}\n\nexport type CSSBorderStyle = 'none'|'solid'|'double'|'dotted'|'dashed';\nexport const borderStyleCSSMap = new Map<BorderStyle, {\n\twidth: number, \n\tstyle: CSSBorderStyle,\n}>([\n\t['thin', {width: 1.5, style: 'solid'}],\n\t['medium', {width: 2, style: 'solid'}],\n\t['thick', {width: 3, style: 'solid'}],\n\t['double', {width: 3, style: 'double'}],\n\t['dotted', {width: 1.5, style: 'dotted'}],\n\t['hair', {width: 1, style: 'solid'}],\n\t['dashed', {width: 1.5, style: 'dashed'}],\n\t['mediumDashed', {width: 2, style: 'dashed'}],\n\t['dashDot', {width: 1.5, style: 'dashed'}],\n\t['mediumDashDot', {width: 2, style: 'dashed'}],\n\t['dashDotDot', {width: 1.5, style: 'dotted'}],\n\t['mediumDashDotDot', {width: 2, style: 'dotted'}],\n\t['slantDashDot', {width: 1.5, style: 'dashed'}],\n\t['none', {width: 1.5, style: 'solid'}],\n]);\n\nexport const borderCSSStyleMap = (() => {\n\tconst map = new Map<CSSBorderStyle, Map<number, BorderStyle>>();\n\tborderStyleCSSMap.forEach((value, key) => {\n\t\tlet widthMap: Map<number, BorderStyle> = map.get(value.style);\n\t\tif (!widthMap) widthMap = map.set(value.style, new Map()).get(value.style);\n\t\twidthMap.set(value.width, key);\n\t});\n\treturn map;\n})();\n\nexport function convertCSSVerticalAlignment(align: string) {\n\treturn (align == 'middle' ? 'center' : align) as VerticalAlignment;\n}\n\nexport function convertCSSColor(color: string) {\n\tcolor = color.charAt(0) == '#' ? color.substring(1) : color;\n\tif (/^[0-9a-fA-F]{3}$/.test(color)) {\n\t\treturn color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n\t}\n\tif (/^[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(color)) {\n\t\treturn color;\n\t}\n\t// named colors (red, green, ...), rgb()/hsl(), etc.\n\treturn colors.plainHex(colors.toHex(color));\n}\n\nexport const convertCSSBorder = (border: string): Border => {\n\tif (border == 'none') return null;\n\t\n\tconst chunks = border.split(' ');\n\tconst width = parseInt(chunks[0].charAt(0)) || 1;\n\tconst borderStyle = chunks.length > 1 ? (chunks[1] as CSSBorderStyle) : 'solid';\n\n\tconst widthMap = borderCSSStyleMap.get(borderStyle);\n\treturn {\n\t\tstyle: (widthMap ? widthMap.get(width) : null) ?? 'thin',\n\t\tcolor: chunks.length > 2 ? convertCSSColor(chunks[2]) : DEFAULT_BORDER_COLOR\n\t};\n}\n\nexport const convertToCSSBorder = (b: Border) => {\n\tconst borderStyle = borderStyleCSSMap.get(b.style || 'none');\n\tif (!borderStyle) return 'none';\n\treturn [\n\t\tdom.px(borderStyle.width),\n\t\tborderStyle.style,\n\t\tb.style == 'none' ? 'var(--og-cell-background)' : (b.color ? `#${b.color}` : 'var(--og-border-color)'),\n\t].join(' ');\n}\n\nexport const addPattern = (css: CSSStyle, s: Style) : CSSStyle => {\n\t// background-image: radial-gradient(rgb(255, 255, 255) 10%, transparent 10%), radial-gradient(rgb(255, 255, 255) 10%, transparent 10%);\n\t// background-position: 0px 0px, 4px 4px;\n\t// background-size: 8px 8px;\n\t// background-color: rgb(255, 51, 51);\n\n\t// console.log('addPattern', s.patternType, fgColor, bgColor);\n\n\tconst fg = '#' + (s.fgColor || '000000');\n\tconst bg = '#' + (s.bgColor || 'FFFFFF');\n\n\tswitch (s.patternType) {\n\t\tcase 'solid':\n\t\t\tcss.backgroundColor = fg || bg;\n\t\t\tbreak;\n\t\tcase 'darkGray':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.75);\n\t\t\tbreak;\n\t\tcase 'mediumGray':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.50);\n\t\t\tbreak;\n\t\tcase 'lightGray':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.25);\n\t\t\tbreak;\n\t\tcase 'gray125':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.125);\n\t\t\tbreak;\n\t\tcase 'gray0625':\n\t\t\tcss.backgroundColor = colors.darken(bg, 0.0625);\n\t\t\tbreak;\n\t\tcase 'darkHorizontal':\n\t\t\tcss.backgroundImage = `linear-gradient(0deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'darkVertical':\n\t\t\tcss.backgroundImage = `linear-gradient(90deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'darkDown':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'darkUp':\n\t\t\tcss.backgroundImage = `linear-gradient(-45deg, ${fg} 33.33%, ${bg} 33.33%, ${bg} 50%, ${fg} 50%, ${fg} 83.33%, ${bg} 83.33%, ${bg} 100%)`;\n\t\t\tcss.backgroundSize = '6px 6px';\n\t\t\tbreak;\n\t\tcase 'lightHorizontal':\n\t\t\tcss.backgroundImage = `linear-gradient(0deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'lightVertical':\n\t\t\tcss.backgroundImage = `linear-gradient(90deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'lightDown':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'lightUp':\n\t\t\tcss.backgroundImage = `linear-gradient(-45deg, ${bg} 25%, ${fg} 25%, ${fg} 50%, ${bg} 50%, ${bg} 75%, ${fg} 75%, ${fg} 100%)`;\n\t\t\tcss.backgroundSize = '4px 4px';\n\t\t\tbreak;\n\t\tcase 'darkGrid':\n\t\t\tcss.backgroundImage = `linear-gradient(${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '2px 2px';\n\t\t\tbreak;\n\t\tcase 'lightGrid':\n\t\t\tcss.backgroundImage = `linear-gradient(${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '1px 1px';\n\t\t\tbreak;\n\t\tcase 'darkTrellis':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '2px 2px';\n\t\t\tbreak;\n\t\tcase 'lightTrellis':\n\t\t\tcss.backgroundImage = `linear-gradient(45deg, ${bg} 0.5px, transparent 0.5px), linear-gradient(90deg, ${bg} 0.5px, transparent 0.5px)`;\n\t\t\tcss.backgroundSize = '1px 1px';\n\t\t\tbreak;\n\t}\n\n\treturn css;\n}\n\nexport const addGradient = (css: CSSStyle, s: Style) : CSSStyle => {\n\tcss.backgroundImage = `linear-gradient(${(s.angle ?? 0) + 90}deg,${s.stops.map(stop => `#${stop.rgb} ${stop.v * 100}%`).join(',')})`;\n\treturn css;\n}\n\nfunction createCssRotation(align: HorizontalAlignment, valign: VerticalAlignment, rot: number) : CSSStyle {\n\treturn {\n\t\tposition: 'absolute', \n\t\toverflow: 'visible', \n\t\tinset: 'initial',\n\t\tpadding: '0',\n\t\t// margin: '0 auto',\n\t\t// width: '100%',\n\t\t// height: '100%',\n\t\t// transformOrigin: 'center center',\n\t\ttransform: \"rotate(\" + (-rot).toString() + \"deg)\"\n\t};\n}\n\nexport const styleToCSStyle = (s: Style): CSSStyle => {\n\tconst style: CSSStyle = s.cssStyle ? {...s.cssStyle} : {};\n\tif (s.bold != null) style.fontWeight = s.bold ? 'bold' : 'normal';\n\tif (s.italic) style.fontStyle = 'italic';\n\tif (s.underline) style.textDecoration = 'underline';\n\telse if (s.strike) style.textDecoration = 'line-through';\n\tif (s.sz) style.fontSize = dom.numToPixels(s.sz); // (s.sz * 0.75).toString() + 'px';\n\tif (s.color) style.color = '#' + s.color;\n\tif (s.top) style.borderTop = convertToCSSBorder(s.top);\n\tif (s.right) style.borderRight = convertToCSSBorder(s.right);\n\tif (s.bottom) style.borderBottom = convertToCSSBorder(s.bottom);\n\tif (s.left) style.borderLeft = convertToCSSBorder(s.left);\n\tif (s.top || s.right || s.bottom || s.left) style.zIndex = '1';\n\tif (s.alignment) {\n\t\tif (s.alignment.vertical) {\n\t\t\tstyle.display = 'flex';\n\t\t\tstyle.justifyContent = s.alignment.horizontal;\n\t\t\tstyle.alignItems = s.alignment.vertical == 'top' ? 'start' : (s.alignment.vertical == 'bottom' ? 'end' : 'center');\n\t\t}\n\n\t\tif (s.alignment.horizontal) {\n\t\t\tstyle.textAlign = s.alignment.horizontal;\n\t\t}\n\n\t\tif (s.alignment.wrapText) {\n\t\t\tstyle.display = 'flex';\n\t\t\tstyle.justifyContent = style.justifyContent ?? style.textAlign ?? 'left';\n\t\t\tstyle.alignItems = style.alignItems ?? 'center';\n\t\t\tstyle.whiteSpace = 'pre-wrap';\n\t\t}\n\n\t\tif (s.alignment.textRotation) {\n\t\t\tObject.assign(style, createCssRotation(s.alignment.horizontal || 'center', s.alignment.vertical || 'center', s.alignment.textRotation));\n\t\t}\n\t}\n\tif (s.patternType) addPattern(style, s);\n\telse if (s.stops && s.stops.length) addGradient(style, s);\n\telse if (s.fgColor) style.backgroundColor = '#' + s.fgColor;\n\telse if (s.bgColor) style.backgroundColor = '#' + s.bgColor;\n\t\n\t///TODO - rotation\n\t\n\treturn style;\n}\n\nexport const cssStyleToStyle = (s: CSSStyle|string): Style => {\n\tconst cssStyle: CSSStyle = utils.isObject(s) ? s as CSSStyle : cssStyleFromString(s as string);\n\tconst style: Style = {};\n\tlet border: Border;\n\tfor (const k in cssStyle) {\n\t\tconst value = cssStyle[k];\n\t\tif (value == null) continue;\n\t\tswitch(k) {\n\t\t\tcase 'borderTop':\n\t\t\tcase 'border-top':\n\t\t\t\tstyle.top = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderTopColor':\n\t\t\tcase 'border-top-color':\n\t\t\t\tif (style.top) style.top.color = convertCSSColor(value as string);\n\t\t\t\telse style.top = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\n\t\t\tcase 'borderRight':\n\t\t\tcase 'border-right':\n\t\t\t\tstyle.right = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderRightColor':\n\t\t\tcase 'border-right-color':\n\t\t\t\tif (style.right) style.right.color = convertCSSColor(value as string);\n\t\t\t\telse style.right = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\n\t\t\tcase 'borderBottom':\n\t\t\tcase 'border-bottom':\n\t\t\t\tstyle.bottom = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderBottomColor':\n\t\t\tcase 'border-bottom-color':\n\t\t\t\tif (style.bottom) style.bottom.color = convertCSSColor(value as string);\n\t\t\t\telse style.bottom = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\n\t\t\tcase 'borderLeft':\n\t\t\tcase 'border-left':\n\t\t\t\tstyle.left = convertCSSBorder(value as string);\n\t\t\t\tbreak;\n\t\t\tcase 'borderLeftColor':\n\t\t\tcase 'border-left-color':\n\t\t\t\tif (style.left) style.left.color = convertCSSColor(value as string);\n\t\t\t\telse style.left = {style: 'thin', color: convertCSSColor(value as string)};\n\t\t\t\tbreak;\t\t\n\t\t\tcase 'border':\n\t\t\t\tborder = convertCSSBorder(value as string);\n\t\t\t\tstyle.top = style.top || border;\n\t\t\t\tstyle.right = style.right || border;\n\t\t\t\tstyle.bottom = style.bottom || border;\n\t\t\t\tstyle.left = style.left || border;\n\t\t\t\tbreak;\n\t\t\tcase 'textAlign':\n\t\t\tcase 'text-align':\n\t\t\t\tstyle.alignment = style.alignment || {};\n\t\t\t\tstyle.alignment.horizontal = value as HorizontalAlignment;\n\t\t\t\tbreak;\n\t\t\tcase 'verticalAlign':\n\t\t\tcase 'vertical-align':\n\t\t\t\tstyle.alignment = style.alignment || {};\n\t\t\t\tstyle.alignment.vertical = convertCSSVerticalAlignment(value);\n\t\t\t\tbreak;\n\t\t\tcase 'whiteSpace':\n\t\t\tcase 'white-space':\n\t\t\t\tstyle.alignment = style.alignment || {};\n\t\t\t\tstyle.alignment.wrapText = value && value != 'nowrap';\n\t\t\t\tbreak;\n\t\t\tcase 'color':\n\t\t\t\tstyle.color = convertCSSColor(value);\n\t\t\t\tbreak;\n\t\t\tcase 'background':\n\t\t\tcase 'backgroundColor':\n\t\t\tcase 'background-color':\n\t\t\t\tstyle.fgColor = convertCSSColor(value);\n\t\t\t\tbreak;\n\t\t\tcase 'fontSize':\n\t\t\tcase 'font-size':\n\t\t\t\tstyle.sz = parseFloat(value);\n\t\t\t\tbreak;\n\t\t\tcase 'fontWeight':\n\t\t\tcase 'font-weight':\n\t\t\t\tstyle.bold = value == 'bold';\n\t\t\t\tbreak;\n\t\t\tcase 'fontStyle':\n\t\t\tcase 'font-style':\n\t\t\t\tstyle.italic = value == 'italic';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tstyle[k as keyof Style] = value;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn style;\n}\n\nexport const applyStyle = (div: HTMLDivElement, style: CSSStyle) => {\n\tfor (const k in style) {\n\t\t(div.style as CSSStyle)[k] = style[k];\n\t}\n};\n\nexport const requiresManualAlignment = (style: Style) => {\n\treturn style.alignment && style.alignment.textRotation != null;\n}\n\nexport const applyAlignment = (div: HTMLDivElement, style: Style) => {\n\tif (!style.alignment || style.alignment.textRotation == null) return;\n\n\t// rect = transformed (visual) bounding box; offset*/client* = untransformed layout boxes.\n\t// With transform-origin center, the visual box is centered on the untransformed box,\n\t// so the gap to each edge is half the size difference on that axis.\n\tconst alignment = style.alignment;\n\tconst rect = div.getBoundingClientRect();\n\tconst parent = div.parentElement;\n\n\tconst dx = (rect.width - div.offsetWidth) / 2;\n\tconst dy = (rect.height - div.offsetHeight) / 2;\n\n\tconst pos: CssPosition = {};\n\n\tif (alignment.vertical == 'top') pos.t = dy;\n\telse if (alignment.vertical == 'bottom') pos.b = dy;\n\telse pos.t = (parent.clientHeight - div.offsetHeight) / 2;\n\n\tif (alignment.horizontal == 'left') pos.l = dx;\n\telse if (alignment.horizontal == 'right') pos.r = dx;\n\telse pos.l = (parent.clientWidth - div.offsetWidth) / 2;\n\n\tdom.setPosition(div, pos);\n};"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/grid-core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.56",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Grid model, no ui components",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"generate-functions-docs": "node ./scripts/generate-functions-docs.cjs"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@omegagrid/core": "^0.10.
|
|
32
|
-
"@omegagrid/localize": "^0.10.
|
|
31
|
+
"@omegagrid/core": "^0.10.56",
|
|
32
|
+
"@omegagrid/localize": "^0.10.56",
|
|
33
33
|
"@stdlib/stats": "^0.0.13",
|
|
34
34
|
"color": "^4.2.3",
|
|
35
35
|
"date-fns": "^3.2.0",
|