@devexpress/utils
Advanced tools
Comparing version 1.0.0-alpha-008 to 1.0.0-alpha-009
@@ -20,4 +20,2 @@ export declare class MinMax<T> { | ||
export declare class ExtendedMinMax<T> extends MinMax<T> { | ||
minElement: T; | ||
maxElement: T; | ||
minValue: number; | ||
@@ -24,0 +22,0 @@ maxValue: number; |
@@ -81,2 +81,3 @@ "use strict"; | ||
} | ||
return this; | ||
}; | ||
@@ -83,0 +84,0 @@ Offsets.prototype.clone = function () { |
@@ -10,5 +10,3 @@ import { Point } from './point'; | ||
]; | ||
static fromRectangle(rect: Rectangle): Parallelogram; | ||
angleRelativeAxisX(rightSC?: boolean, byClockwise?: boolean): number; | ||
init(points: [ | ||
constructor(points: [ | ||
Point, | ||
@@ -18,3 +16,5 @@ Point, | ||
Point | ||
]): Parallelogram; | ||
]); | ||
static fromRectangle(rect: Rectangle): Parallelogram; | ||
angleRelativeAxisX(rightSC?: boolean, byClockwise?: boolean): number; | ||
rotateAroundCenter(fiInRadians: number, rightSC?: boolean, byClockwise?: boolean): Parallelogram; | ||
@@ -21,0 +21,0 @@ changeCoordinateCenterTo(p: Point): Parallelogram; |
@@ -11,6 +11,7 @@ "use strict"; | ||
var Parallelogram = (function () { | ||
function Parallelogram() { | ||
function Parallelogram(points) { | ||
this.points = points; | ||
} | ||
Parallelogram.fromRectangle = function (rect) { | ||
return new Parallelogram().init([ | ||
return new Parallelogram([ | ||
new point_1.Point(rect.x, rect.y), | ||
@@ -31,6 +32,2 @@ new point_1.Point(rect.right, rect.y), | ||
}; | ||
Parallelogram.prototype.init = function (points) { | ||
this.points = points; | ||
return this; | ||
}; | ||
Object.defineProperty(Parallelogram.prototype, "rectangle", { | ||
@@ -37,0 +34,0 @@ get: function () { |
@@ -15,3 +15,3 @@ import { ICloneable, IEquatable, ISupportConverting, ISupportCopyFrom, SimpleConverter } from '../types'; | ||
clone(): Point; | ||
equals(obj: Point): boolean; | ||
equals(obj: IPoint): boolean; | ||
offset(offsetX: number, offsetY: number): this; | ||
@@ -18,0 +18,0 @@ offsetByPoint(offset: IPoint): this; |
@@ -24,3 +24,3 @@ import { Flag } from '../class/flag'; | ||
normalizeSize(): this; | ||
equals(obj: Rectangle): boolean; | ||
equals(obj: IRectangle): boolean; | ||
clone(): Rectangle; | ||
@@ -43,2 +43,3 @@ copyFrom(obj: IRectangle): void; | ||
static center(rect: IRectangle): Point; | ||
static containsPoint(rect: IRectangle, point: IPoint): boolean; | ||
readonly right: number; | ||
@@ -45,0 +46,0 @@ readonly bottom: number; |
@@ -140,4 +140,3 @@ "use strict"; | ||
Rectangle.prototype.containsPoint = function (point) { | ||
return point.y >= this.y && this.bottom >= point.y && | ||
point.x >= this.x && this.bottom >= point.x; | ||
return Rectangle.containsPoint(this, point); | ||
}; | ||
@@ -252,2 +251,8 @@ Rectangle.prototype.containsRectangle = function (rectangle) { | ||
}; | ||
Rectangle.containsPoint = function (rect, point) { | ||
var right = rect.x + rect.width; | ||
var bottom = rect.y + rect.height; | ||
return point.y >= rect.y && bottom >= point.y && | ||
point.x >= rect.x && right >= point.x; | ||
}; | ||
return Rectangle; | ||
@@ -254,0 +259,0 @@ }()); |
@@ -0,8 +1,11 @@ | ||
import { IPoint, IRectangle } from './interfaces'; | ||
import { Point } from './point'; | ||
import { Vector } from './vector'; | ||
export declare class Segment { | ||
startPoint: Point; | ||
endPoint: Point; | ||
constructor(startPoint: Point, endPoint: Point); | ||
intersect(segment: Segment): boolean; | ||
export declare class Segment<T extends Point = Point> { | ||
startPoint: T; | ||
endPoint: T; | ||
constructor(startPoint: T, endPoint: T); | ||
intersect<AnotherT extends Point>(segment: Segment<AnotherT>): boolean; | ||
intersectPoint(point: IPoint, accuracy?: number): boolean; | ||
intersectRect(rect: IRectangle): boolean; | ||
private intersectCore; | ||
@@ -9,0 +12,0 @@ readonly length: number; |
@@ -7,2 +7,3 @@ "use strict"; | ||
var point_1 = require("./point"); | ||
var rectangle_1 = require("./rectangle"); | ||
var vector_1 = require("./vector"); | ||
@@ -50,6 +51,22 @@ var Segment = (function () { | ||
Segment.prototype.intersect = function (segment) { | ||
if (this.startPoint.equals(segment.startPoint) || this.endPoint.equals(segment.startPoint) || | ||
this.startPoint.equals(segment.endPoint) || this.endPoint.equals(segment.endPoint)) | ||
return this.startPoint.equals(segment.startPoint) || this.endPoint.equals(segment.startPoint) || | ||
this.startPoint.equals(segment.endPoint) || this.endPoint.equals(segment.endPoint) || | ||
(this.intersectCore(segment) && segment.intersectCore(this)); | ||
}; | ||
Segment.prototype.intersectPoint = function (point, accuracy) { | ||
if (accuracy === void 0) { accuracy = 0.0000001; } | ||
return this.startPoint.equals(point) || this.endPoint.equals(point) || | ||
math_1.MathUtils.numberCloseTo(this.length, point_1.Point.distance(this.startPoint, point) + point_1.Point.distance(this.endPoint, point), accuracy); | ||
}; | ||
Segment.prototype.intersectRect = function (rect) { | ||
if (rectangle_1.Rectangle.containsPoint(rect, this.startPoint) || rectangle_1.Rectangle.containsPoint(rect, this.endPoint)) | ||
return true; | ||
return this.intersectCore(segment) && segment.intersectCore(this); | ||
var left = rect.x; | ||
var right = rect.x + rect.width; | ||
var top = rect.y; | ||
var bottom = rect.y + rect.height; | ||
return this.intersect(new Segment(new point_1.Point(left, top), new point_1.Point(left, bottom))) || | ||
this.intersect(new Segment(new point_1.Point(right, top), new point_1.Point(right, bottom))) || | ||
this.intersect(new Segment(new point_1.Point(left, top), new point_1.Point(right, top))) || | ||
this.intersect(new Segment(new point_1.Point(left, bottom), new point_1.Point(right, bottom))); | ||
}; | ||
@@ -56,0 +73,0 @@ Segment.prototype.intersectCore = function (segment) { |
@@ -61,3 +61,3 @@ "use strict"; | ||
if (browser_1.Browser.Edge) | ||
(_b = helperFrame.contentWindow) === null || _b === void 0 ? void 0 : _b.document.execCommand('print', false, null); | ||
(_b = helperFrame.contentWindow) === null || _b === void 0 ? void 0 : _b.document.execCommand('print', false, undefined); | ||
else | ||
@@ -64,0 +64,0 @@ (_c = helperFrame.contentWindow) === null || _c === void 0 ? void 0 : _c.print(); |
@@ -18,3 +18,3 @@ export declare enum SesType { | ||
export declare class SequenceComparator<T> { | ||
editDistance: number; | ||
editDistance: number | null; | ||
lcs: string; | ||
@@ -40,6 +40,6 @@ ses: SesElem<T>[]; | ||
y: number; | ||
k: number; | ||
constructor(x: number, y: number, k: number); | ||
k: number | null; | ||
constructor(x: number, y: number, k: number | null); | ||
} | ||
export {}; | ||
//# sourceMappingURL=common.d.ts.map |
@@ -126,3 +126,3 @@ "use strict"; | ||
this.ses.push(new SesElem(this.a.getByIndex(px_idx), SesType.Common)); | ||
this.lcs += this.a[px_idx]; | ||
this.lcs += this.a.getByIndex(px_idx); | ||
++px_idx; | ||
@@ -129,0 +129,0 @@ ++py_idx; |
import { ISequenceComparatorItertor, SesType } from './common'; | ||
export declare class StringSequenceComparator { | ||
editDistance: number; | ||
editDistance: number | null; | ||
lcs: string; | ||
@@ -23,4 +23,4 @@ ses: StringSesElem[]; | ||
y: number; | ||
k: number; | ||
constructor(x: number, y: number, k: number); | ||
k: number | null; | ||
constructor(x: number, y: number, k: number | null); | ||
} | ||
@@ -27,0 +27,0 @@ export declare class StringSesElem { |
@@ -6,2 +6,3 @@ export declare function isDefined<T>(value: T | undefined | null): value is T; | ||
export declare function isString(obj: unknown): obj is string; | ||
export declare function isNonNullString(str: string | null | undefined): str is string; | ||
export declare function isEven(num: number): boolean; | ||
@@ -8,0 +9,0 @@ export declare function isOdd(num: number): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.numberToStringHex = exports.numberToStringBin = exports.isOdd = exports.isEven = exports.isString = exports.isNumber = exports.boolToString = exports.boolToInt = exports.isDefined = void 0; | ||
exports.numberToStringHex = exports.numberToStringBin = exports.isOdd = exports.isEven = exports.isNonNullString = exports.isString = exports.isNumber = exports.boolToString = exports.boolToInt = exports.isDefined = void 0; | ||
var string_1 = require("./string"); | ||
@@ -25,2 +25,6 @@ function isDefined(value) { | ||
exports.isString = isString; | ||
function isNonNullString(str) { | ||
return !!str; | ||
} | ||
exports.isNonNullString = isNonNullString; | ||
function isEven(num) { | ||
@@ -27,0 +31,0 @@ return (num % 2) !== 0; |
import { IPoint, IRectangle, ISize } from '../geometry/interfaces'; | ||
export declare class DomUtils { | ||
private static html2PlainTextFilter; | ||
private static verticalScrollBarWidth; | ||
@@ -11,4 +12,6 @@ static clearInnerHtml(element: HTMLElement): void; | ||
static isTextNode(node: Node): boolean; | ||
static isElementNode(node: Node): node is Element; | ||
static isHTMLTableRowElement(element: Element): element is HTMLTableRowElement; | ||
static isItParent(parentElement: Node, element: HTMLElement): boolean; | ||
static getParentByTagName(element: HTMLElement, tagName: string): HTMLElement; | ||
static getParentByTagName(element: HTMLElement, tagName: string): HTMLElement | null; | ||
static getDocumentScrollTop(): number; | ||
@@ -29,4 +32,4 @@ static getDocumentScrollLeft(): number; | ||
static getVerticalBordersWidth(element: HTMLElement, style?: CSSStyleDeclaration): number; | ||
static getNodes(parent: Element, predicate: (e: Element) => boolean): HTMLElement[]; | ||
static getChildNodes(parent: Element, predicate: (e: ChildNode) => boolean): HTMLElement[]; | ||
static getNodes(parent: Element, predicate: (e: Element) => boolean): Element[]; | ||
static getChildNodes(parent: Element, predicate: (e: ChildNode) => boolean): ChildNode[]; | ||
static getNodesByClassName(parent: Element, className: string): Element[]; | ||
@@ -36,3 +39,5 @@ static getChildNodesByClassName(parent: Element, className: string): Element[]; | ||
static getHorizontalBordersWidth(element: HTMLElement, style?: CSSStyleDeclaration): number; | ||
static getFontFamiliesFromCssString(cssString: string): string[]; | ||
static getInnerText(container: HTMLElement): string | null; | ||
} | ||
//# sourceMappingURL=dom.d.ts.map |
@@ -40,2 +40,8 @@ "use strict"; | ||
}; | ||
DomUtils.isElementNode = function (node) { | ||
return node.nodeType === Node.ELEMENT_NODE; | ||
}; | ||
DomUtils.isHTMLTableRowElement = function (element) { | ||
return element.tagName === 'TR'; | ||
}; | ||
DomUtils.isItParent = function (parentElement, element) { | ||
@@ -179,3 +185,3 @@ if (!parentElement || !element) | ||
var isFirstCycle = true; | ||
if (curEl && curEl.tagName === 'TR' && curEl.cells.length > 0) | ||
if (curEl && DomUtils.isHTMLTableRowElement(curEl) && curEl.cells.length > 0) | ||
curEl = curEl.cells[0]; | ||
@@ -363,4 +369,10 @@ var pos = getAbsoluteScrollOffset_OperaFF(curEl, false); | ||
} | ||
else | ||
return DomUtils.getChildNodes(parent, function (elem) { return elem.className && DomUtils.hasClassName(elem, className); }); | ||
else { | ||
return DomUtils.getChildNodes(parent, function (elem) { | ||
if (DomUtils.isElementNode(elem)) | ||
return common_1.isNonNullString(elem.className) && DomUtils.hasClassName(elem, elem.className); | ||
else | ||
return false; | ||
}); | ||
} | ||
}; | ||
@@ -395,2 +407,28 @@ DomUtils.getVerticalScrollBarWidth = function () { | ||
}; | ||
DomUtils.getFontFamiliesFromCssString = function (cssString) { | ||
return cssString.split(',').map(function (fam) { return string_1.StringUtils.trim(fam.replace(/'|"/gi, '')); }); | ||
}; | ||
DomUtils.getInnerText = function (container) { | ||
if (browser_1.Browser.Safari && browser_1.Browser.MajorVersion <= 5) { | ||
if (DomUtils.html2PlainTextFilter === null) { | ||
DomUtils.html2PlainTextFilter = document.createElement('DIV'); | ||
DomUtils.html2PlainTextFilter.style.width = '0'; | ||
DomUtils.html2PlainTextFilter.style.height = '0'; | ||
DomUtils.html2PlainTextFilter.style.overflow = 'visible'; | ||
DomUtils.html2PlainTextFilter.style.display = 'none'; | ||
document.body.appendChild(DomUtils.html2PlainTextFilter); | ||
} | ||
var filter = DomUtils.html2PlainTextFilter; | ||
filter.innerHTML = container.innerHTML; | ||
filter.style.display = ''; | ||
var innerText = filter.innerText; | ||
filter.style.display = 'none'; | ||
return innerText; | ||
} | ||
else if (browser_1.Browser.NetscapeFamily || browser_1.Browser.WebKitFamily || (browser_1.Browser.IE && browser_1.Browser.Version >= 9) || browser_1.Browser.Edge) | ||
return container.textContent; | ||
else | ||
return container.innerText; | ||
}; | ||
DomUtils.html2PlainTextFilter = null; | ||
DomUtils.verticalScrollBarWidth = undefined; | ||
@@ -397,0 +435,0 @@ return DomUtils; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var browser_1 = require("../browser"); | ||
var html_1 = require("./html"); | ||
var encode_1 = require("./encode"); | ||
var string_1 = require("./string"); | ||
@@ -162,3 +162,3 @@ var KeyUtils = (function () { | ||
else | ||
alert(html_1.HtmlUtils.decodeViaTextArea('Invalid shortcut')); | ||
alert(encode_1.EncodeUtils.decodeViaTextArea('Invalid shortcut')); | ||
return KeyUtils.getShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey); | ||
@@ -165,0 +165,0 @@ }; |
@@ -18,3 +18,3 @@ import { CmpFunc, ICloneable } from '../../types'; | ||
static anyOf<T, TRes>(map: Record<number, T>, callback: (currVal: T, key: number) => TRes | null): TRes | null; | ||
static unsafeAnyOf<T, TRes>(map: Record<number, T>, callback: (currVal: T, key: number) => TRes): TRes; | ||
static unsafeAnyOf<T, TRes>(map: Record<number, T>, callback: (currVal: T, key: number) => TRes | null | undefined): TRes | null; | ||
static allOf<T>(map: Record<number, T>, callback: (currVal: T, key: number) => boolean): boolean; | ||
@@ -21,0 +21,0 @@ static mapLength<T>(map: Record<number, T>): number; |
@@ -197,3 +197,3 @@ "use strict"; | ||
if (Object.prototype.hasOwnProperty.call(map, key)) { | ||
if (found !== null) { | ||
if (found !== undefined) { | ||
var elem = map[key]; | ||
@@ -213,3 +213,3 @@ if (cmp(elem, found) > 0) | ||
if (Object.prototype.hasOwnProperty.call(map, key)) { | ||
if (found !== null) { | ||
if (found !== undefined) { | ||
var elem = map[key]; | ||
@@ -216,0 +216,0 @@ if (cmp(elem, found) < 0) |
@@ -18,3 +18,3 @@ import { ExtendedMax, ExtendedMin, ExtendedMinMax, MinMax } from '../../class/min-max'; | ||
static anyOf<T, TRes>(map: Record<string, T>, callback: (currVal: T, key: string) => TRes | null): TRes | null; | ||
static unsafeAnyOf<T, TRes>(map: Record<string, T>, callback: (currVal: T, key: string) => TRes): TRes; | ||
static unsafeAnyOf<T, TRes>(map: Record<string, T>, callback: (currVal: T, key: string) => TRes | null | undefined): TRes | null; | ||
static allOf<T>(map: Record<string, T>, callback: (currVal: T, key: string) => boolean): boolean; | ||
@@ -21,0 +21,0 @@ static mapLength<T>(map: Record<string, T>): number; |
@@ -196,3 +196,3 @@ "use strict"; | ||
if (Object.prototype.hasOwnProperty.call(map, key)) { | ||
if (found !== null) { | ||
if (found !== undefined) { | ||
var elem = map[key]; | ||
@@ -212,3 +212,3 @@ if (cmp(elem, found) > 0) | ||
if (Object.prototype.hasOwnProperty.call(map, key)) { | ||
if (found !== null) { | ||
if (found !== undefined) { | ||
var elem = map[key]; | ||
@@ -215,0 +215,0 @@ if (cmp(elem, found) < 0) |
@@ -16,3 +16,3 @@ export declare class StringUtils { | ||
static repeat(str: string, count: number): string; | ||
static isNullOrEmpty(str: string): boolean; | ||
static isNullOrEmpty(str: string | null | undefined): boolean; | ||
static padLeft(str: string, totalWidth: number, paddingChar: string): string; | ||
@@ -19,0 +19,0 @@ private static trimInternal; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var browser_1 = require("../browser"); | ||
var common_1 = require("./common"); | ||
var string_1 = require("./string"); | ||
@@ -21,3 +22,3 @@ var javascriptPrefix = 'javascript:'; | ||
try { | ||
if (target !== '') | ||
if (common_1.isNonNullString(target)) | ||
Url.navigateTo(url, target); | ||
@@ -58,4 +59,6 @@ else | ||
var newWindow = window.open(); | ||
newWindow.opener = null; | ||
newWindow.location = url; | ||
if (newWindow) { | ||
newWindow.opener = null; | ||
newWindow.location.assign(url); | ||
} | ||
} | ||
@@ -62,0 +65,0 @@ }; |
{ | ||
"name": "@devexpress/utils", | ||
"version": "1.0.0-alpha-008", | ||
"version": "1.0.0-alpha-009", | ||
"description": "DevExpress utils", | ||
@@ -5,0 +5,0 @@ "author": "DevExpress Inc.", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
793990
16349