@aurigma/design-atoms
Advanced tools
Comparing version 6.17.5 to 6.18.0
@@ -108,2 +108,5 @@ var __extends = (this && this.__extends) || (function () { | ||
this._resizeProduct(target); | ||
if (this._canvas != null) { | ||
this._canvas.viewer._onResize(this, false); | ||
} | ||
} | ||
@@ -110,0 +113,0 @@ else if (target instanceof PrintArea) { |
@@ -6,3 +6,3 @@ import { IFontSettings } from "@aurigma/design-atoms-model/Product/Interfaces"; | ||
import { IFontService } from "../IFontService"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-text/Model/Span"; | ||
export declare class HtmlToXmlConverter extends TreeConverter { | ||
@@ -9,0 +9,0 @@ private _colorPaletteManager; |
@@ -19,4 +19,5 @@ var __extends = (this && this.__extends) || (function () { | ||
import * as _ from "underscore"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
//import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
import { parseStyleAttribute, serializeStyleAttribute } from "../../Utils/Dom"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-text/Model/Span"; | ||
var HtmlToXmlConverter = /** @class */ (function (_super) { | ||
@@ -23,0 +24,0 @@ __extends(HtmlToXmlConverter, _super); |
@@ -9,3 +9,3 @@ import { Color } from "@aurigma/design-atoms-model/Colors"; | ||
import { IFontService } from "../IFontService"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-text/Model/Span"; | ||
export declare class XmlToHtmlConverter extends TreeConverter { | ||
@@ -12,0 +12,0 @@ protected _colorPaletteManager: IColorPaletteManager; |
@@ -20,4 +20,4 @@ var __extends = (this && this.__extends) || (function () { | ||
import * as _ from "underscore"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
import { parseStyleAttribute, serializeStyleAttribute } from "../../Utils/Dom"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-text/Model/Span"; | ||
var XmlToHtmlConverter = /** @class */ (function (_super) { | ||
@@ -24,0 +24,0 @@ __extends(XmlToHtmlConverter, _super); |
@@ -15,6 +15,6 @@ var __extends = (this && this.__extends) || (function () { | ||
import { EqualsOfFloatNumbers, Transform, PointF } from "@aurigma/design-atoms-model/Math"; | ||
import { TextManager2 } from "./TextManager"; | ||
import { CanvasElementHandler } from "../CanvasElementHandler"; | ||
import { TextRenderer } from "./TextRenderer"; | ||
import { Graphics } from "../Graphics"; | ||
import { TextWhizzWrapper } from "@aurigma/design-atoms-text/TextEditor"; | ||
var Ctx2dTextRenderer = /** @class */ (function (_super) { | ||
@@ -37,3 +37,3 @@ __extends(Ctx2dTextRenderer, _super); | ||
catch (e) { | ||
throw TextManager2.createException(e, this._textWhizz); | ||
throw TextWhizzWrapper.createException(this._textWhizz, e); | ||
} | ||
@@ -63,3 +63,3 @@ finally { | ||
catch (e) { | ||
throw TextManager2.createException(e, this._textWhizz); | ||
throw TextWhizzWrapper.createException(this._textWhizz, e); | ||
} | ||
@@ -89,3 +89,3 @@ finally { | ||
catch (e) { | ||
throw TextManager2.createException(e, this._textWhizz); | ||
throw TextWhizzWrapper.createException(this._textWhizz, e); | ||
} | ||
@@ -92,0 +92,0 @@ finally { |
@@ -9,4 +9,4 @@ import { Color } from "@aurigma/design-atoms-model/Colors"; | ||
import { IFontService } from "./IFontService"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
import { ICharStyle } from "@aurigma/design-atoms-text/TextEditor/Interfaces/ICharStyle"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-text/Model/Span"; | ||
export interface IStroke { | ||
@@ -13,0 +13,0 @@ color?: Color; |
@@ -8,3 +8,4 @@ import { EventObject, EventWithSenderArg } from "@aurigma/design-atoms-model/EventObject"; | ||
import { EditorInitData } from "../ITextEditor"; | ||
import { ICharStyle, IParagraphStyle, IInputTextValidator, ICommand, IMouseEvent, ITextEditor } from "@aurigma/design-atoms-text/dist/TextEditor/Interfaces"; | ||
import { ICharStyle, IParagraphStyle, IInputTextValidator, IMouseEvent, ITextEditor } from "@aurigma/design-atoms-text/dist/TextEditor/Interfaces"; | ||
import { CommandType } from "@aurigma/design-atoms-text/TextEditor"; | ||
export declare class MobileTextEditor implements ITextEditor { | ||
@@ -29,6 +30,7 @@ private _inputTextValidator; | ||
constructor(elementHandler: ITextEditorElementHandler, fontService: IFontService, useSimpleFontList: boolean, backendServiceUrl: string, _inputTextValidator: IInputTextValidator); | ||
isApplyingListsEnabled(): boolean; | ||
private readonly _frameChangedEvent; | ||
get frameChanged(): EventWithSenderArg<ITextEditor, RectangleF>; | ||
get invalidCharEntered(): EventObject<ITextEditor>; | ||
executeCommand(command: ICommand): void; | ||
executeCommand(commandType: CommandType, initData: any): void; | ||
getTextModel(): TextModel; | ||
@@ -38,2 +40,8 @@ _insertTextAtCaret(text: any): void; | ||
initialize(data: EditorInitData, colorPalette: IColorPaletteManager): void; | ||
/** @inheritDoc */ | ||
isBulletedList(): boolean; | ||
/** @inheritDoc */ | ||
isNumberedList(): boolean; | ||
/** @inheritDoc */ | ||
isIndentationEnabled(): boolean; | ||
private _validateInputText; | ||
@@ -40,0 +48,0 @@ enterEditMode(point?: IPoint): void; |
@@ -164,2 +164,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
MobileTextEditor.prototype.isApplyingListsEnabled = function () { | ||
return true; //TODO: add disable for curved text | ||
}; | ||
Object.defineProperty(MobileTextEditor.prototype, "frameChanged", { | ||
@@ -179,3 +182,3 @@ get: function () { | ||
}); | ||
MobileTextEditor.prototype.executeCommand = function (command) { | ||
MobileTextEditor.prototype.executeCommand = function (commandType, initData) { | ||
throw new Error("Method not implemented."); | ||
@@ -203,2 +206,14 @@ }; | ||
}; | ||
/** @inheritDoc */ | ||
MobileTextEditor.prototype.isBulletedList = function () { | ||
return false; | ||
}; | ||
/** @inheritDoc */ | ||
MobileTextEditor.prototype.isNumberedList = function () { | ||
return false; | ||
}; | ||
/** @inheritDoc */ | ||
MobileTextEditor.prototype.isIndentationEnabled = function () { | ||
return false; | ||
}; | ||
MobileTextEditor.prototype._validateInputText = function (text, insertText) { | ||
@@ -205,0 +220,0 @@ var _this = this; |
@@ -10,3 +10,3 @@ import { RgbColor } from "@aurigma/design-atoms-model/Colors"; | ||
import * as Utils from "@aurigma/design-atoms-model/Utils/Utils"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-text/Model/Span"; | ||
//TODO: delete class after merging to develop5 | ||
@@ -13,0 +13,0 @@ var TextEditor = /** @class */ (function () { |
@@ -18,2 +18,4 @@ import { RectangleF, Transform } from "@aurigma/design-atoms-model/Math"; | ||
private readonly _activeTextCanvasHandler; | ||
private readonly _listStyleSheetManagerFactory; | ||
private readonly _listStyleSheetManager; | ||
private readonly _exitedEditModeEvent; | ||
@@ -79,2 +81,3 @@ private readonly _enteredEditModeEvent; | ||
private _unbindFromEditor; | ||
private _getListSettingFromConfig; | ||
private _onSelectedItemHandlerChanged; | ||
@@ -100,2 +103,3 @@ private _onCanvasSelectionLocked; | ||
private _restorePlaceholderText; | ||
private _updateItemListStyles; | ||
private _handleTextChanged; | ||
@@ -107,2 +111,7 @@ private _extractDefaultTextStyle; | ||
private isOnlyThisItemSelected; | ||
private _serializeToItemListStyles; | ||
private _parseItemListStyles; | ||
private _convertFromModelSpanStyle; | ||
private _convertFromModelParagraphStyle; | ||
private _convertToModelParagraphAlignment; | ||
} |
@@ -41,3 +41,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { Environment } from "@aurigma/design-atoms-model/Utils/Environment"; | ||
import { BoundedTextItem, CurvedTextItem, OverflowStrategy, PlainTextItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { BoundedTextItem, CurvedTextItem, OverflowStrategy, PlainTextItem, TextAlignment } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { Keys } from "@aurigma/design-atoms-text/TextEditor"; | ||
import { DefaultStyleExtractor } from "@aurigma/design-atoms-text/Serialization/DefaultStyleExtractor"; | ||
import { ColorPalette } from "@aurigma/design-atoms-text/Serialization/Model/ColorPalette"; | ||
import { ParagraphAlignment } from "@aurigma/design-atoms-text/Model"; | ||
import { ListStyleSheetManagerFactory } from "@aurigma/design-atoms-text/TextEditor/Services"; | ||
import { TextWhizzWrapper } from "@aurigma/design-atoms-text/TextEditor/TextWhizz/TextWhizzWrapper"; | ||
@@ -48,3 +53,2 @@ import { MouseEventType } from "@aurigma/design-atoms-text/TextEditor/Enums/MouseEventType"; | ||
import { TextStateType } from "./TextStateType"; | ||
import { Keys } from "@aurigma/design-atoms-text/dist/TextEditor/Enums/Keys"; | ||
import { ItemUtils } from "../Utils/ItemUtils"; | ||
@@ -56,3 +60,2 @@ import { Cursor } from "../Utils/Common"; | ||
import { TextWhizzInitData } from "./TextWhizzInitData"; | ||
import { DefaultStyleExtractorConverter } from "./Convert/DefaultStyleExtractorConverter"; | ||
//TODO: | ||
@@ -105,3 +108,4 @@ // 1) Split controllers for mobile and TextWhizz version. | ||
_this._isTextImageValid = false; | ||
_this._onTextStateChanged(); | ||
_this._redrawText(); | ||
_this._onTextStateChanged(); //TODO: fix rollback changes | ||
}; | ||
@@ -126,2 +130,4 @@ this._onFrameChanged = function (sender, newFrame) { | ||
this._activeTextCanvasHandler = this._canvas.activeTextCanvasHandler; | ||
this._listStyleSheetManagerFactory = new ListStyleSheetManagerFactory(this._getListSettingFromConfig(this._canvas.viewer.configuration.listSettings)); | ||
this._listStyleSheetManager = this._listStyleSheetManagerFactory.create(); | ||
// text engine wrapper | ||
@@ -267,2 +273,3 @@ this._tw = this._createEngineWrapper(); | ||
this._unbindFromEditor(); | ||
this._updateItemListStyles(); | ||
if (this._itemHandler.item.isTextPlaceholder && newText === '') | ||
@@ -427,3 +434,3 @@ this._restorePlaceholderText(); | ||
var fontRegistry = this._canvas.fontRegistry; | ||
return new TextWhizzWrapper(engine, fontRegistry.textWhizzFontRegistry); | ||
return new TextWhizzWrapper(engine, fontRegistry.textWhizzFontRegistry, this._listStyleSheetManager); | ||
}; | ||
@@ -436,2 +443,3 @@ TextEditorController.prototype._getEngineWrapperInitData = function (text) { | ||
if (text === void 0) { text = null; } | ||
this._listStyleSheetManager.initialize(this._parseItemListStyles(this._itemHandler.item)); | ||
this._tw.initialize(this._getEngineWrapperInitData(text), false); | ||
@@ -477,8 +485,8 @@ }; | ||
TextEditorController.prototype._initActiveTextEditor = function () { | ||
//TODO: add call _initEngineWrapper() | ||
if (this.activeTextEditor) { | ||
var editorInitData = this._getTextWhizzEditorInitData(); | ||
if (this._textEditor instanceof NewTextEditor) { | ||
var renderer = this._textEditor.renderer; | ||
renderer.initialize(this._itemHandler); | ||
this._textEditor.initialize(this._tw, editorInitData); | ||
this._textEditor.renderer.initialize(this._itemHandler); | ||
this._textEditor.initialize(this._tw, editorInitData, this._listStyleSheetManager); | ||
} | ||
@@ -502,2 +510,23 @@ else if (this._textEditor instanceof MobileTextEditor) { | ||
}; | ||
TextEditorController.prototype._getListSettingFromConfig = function (config) { | ||
return config ? { | ||
maxNestingListLevel: config.maxLevel, | ||
defOrderedListLevelGap: config.levelIndent, | ||
defUnorderedListLevelGap: config.levelIndent, | ||
defOrderedListStyle: { | ||
firstLineIndent: config.firstLineIndent, | ||
leftIndent: config.listIndent, | ||
tabOffset: config.tabOffset, | ||
numberingFormat: config.numberingFormat | ||
}, | ||
defUnorderedListStyle: { | ||
firstLineIndent: config.firstLineIndent, | ||
leftIndent: config.listIndent, | ||
tabOffset: config.tabOffset, | ||
bulletCharCode: config.bulletChar ? config.bulletChar.charCodeAt(0) : null | ||
}, | ||
styleNameKey: "", | ||
styleNamePrefix: "" | ||
} : null; | ||
}; | ||
//#endregion - Private - Event handlers - | ||
@@ -698,2 +727,6 @@ //#region - Private - Mouse & keyboard processor - | ||
}; | ||
TextEditorController.prototype._updateItemListStyles = function () { | ||
var listStyleSheets = this._listStyleSheetManager.getAllStyleSheets().map(function (x) { return x.getListStyleSheet(); }); | ||
this._itemHandler.item.listStyles = this._serializeToItemListStyles(listStyleSheets); | ||
}; | ||
TextEditorController.prototype._handleTextChanged = function (newText) { | ||
@@ -703,4 +736,4 @@ this._isTextImageValid = false; | ||
this._itemHandler.item.text = extractResult.text; | ||
this._itemHandler.applyInlineStyle(extractResult.spanStyle); | ||
this._itemHandler.applyParagraphStyle(extractResult.paragraphStyle); | ||
this._itemHandler.applyInlineStyle(this._convertFromModelSpanStyle(extractResult.spanStyle)); | ||
this._itemHandler.applyParagraphStyle(this._convertFromModelParagraphStyle(extractResult.paragraphStyle)); | ||
if (!this.isMobile && | ||
@@ -710,15 +743,8 @@ this._itemHandler.item) //TODO: to del after support RTL text in TextWhizz | ||
}; | ||
//TODO: to del after adding text model in mobile editor | ||
TextEditorController.prototype._extractDefaultTextStyle = function (formattedText) { | ||
var result = { | ||
spanStyle: null, | ||
paragraphStyle: null, | ||
text: formattedText | ||
}; | ||
var colorPalette = this._tw.colorPalette; | ||
var converter = new DefaultStyleExtractorConverter(colorPalette); | ||
result.text = converter.convert(formattedText); | ||
result.spanStyle = converter.defaultSpanStyle; | ||
result.paragraphStyle = converter.defaultParagraphStyle; | ||
return result; | ||
var colors = this._tw.colorPalette.getPaletteColors(); | ||
var colorPalette = new ColorPalette(colors); | ||
var converter = new DefaultStyleExtractor(); | ||
var defaultFontSize = this._tw.styleHandler.getDefaultCharStyle().font.size; | ||
return converter.extract(formattedText, colorPalette, defaultFontSize, this._listStyleSheetManager); | ||
}; | ||
@@ -749,2 +775,72 @@ //#endregion - Private - Text - | ||
}; | ||
TextEditorController.prototype._serializeToItemListStyles = function (listStyleSheets) { | ||
return (listStyleSheets === null || listStyleSheets === void 0 ? void 0 : listStyleSheets.length) > 0 ? JSON.stringify(listStyleSheets) : ''; | ||
}; | ||
TextEditorController.prototype._parseItemListStyles = function (item) { | ||
return item.listStyles ? JSON.parse(item.listStyles) : []; | ||
}; | ||
//#endregion - Private - Helpers - | ||
//#region - Private - Converters from model - | ||
TextEditorController.prototype._convertFromModelSpanStyle = function (source) { | ||
var _a, _b, _c; | ||
var font = null; | ||
if (source.fontName || source.fontSize) { | ||
font = { | ||
postScriptName: source.fontName, | ||
size: (_a = source.fontSize) === null || _a === void 0 ? void 0 : _a.value, | ||
fauxBold: source.bold, | ||
fauxItalic: source.italic, | ||
allCaps: source.allCaps | ||
}; | ||
} | ||
var stroke = null; | ||
if (source.penColor || source.penWidth) { | ||
stroke = { | ||
color: source.penColor, | ||
size: (_b = source.penWidth) === null || _b === void 0 ? void 0 : _b.value | ||
}; | ||
} | ||
return { | ||
font: font, | ||
color: source.color, | ||
underline: source.underline, | ||
leading: (_c = source.leading) === null || _c === void 0 ? void 0 : _c.value, | ||
tracking: source.tracking, | ||
stroke: stroke, | ||
openType: source.openTypeFeatures, | ||
subscript: source.sub, | ||
superscript: source.sup, | ||
verticalScale: source.verticalScale, | ||
horizontalScale: source.horizontalScale | ||
}; | ||
}; | ||
TextEditorController.prototype._convertFromModelParagraphStyle = function (value) { | ||
var _a, _b, _c, _d, _e; | ||
return { | ||
alignment: this._convertToModelParagraphAlignment(value.alignment), | ||
firstLineIndent: (_a = value.firstLineIndent) === null || _a === void 0 ? void 0 : _a.value, | ||
spaceBefore: (_b = value.spaceBefore) === null || _b === void 0 ? void 0 : _b.value, | ||
spaceAfter: (_c = value.spaceAfter) === null || _c === void 0 ? void 0 : _c.value, | ||
leftIndent: (_d = value.leftIndent) === null || _d === void 0 ? void 0 : _d.value, | ||
rightIndent: (_e = value.rightIndent) === null || _e === void 0 ? void 0 : _e.value | ||
}; | ||
}; | ||
TextEditorController.prototype._convertToModelParagraphAlignment = function (source) { | ||
switch (source) { | ||
case ParagraphAlignment.left: | ||
return TextAlignment.Left; | ||
case ParagraphAlignment.center: | ||
return TextAlignment.Center; | ||
case ParagraphAlignment.right: | ||
return TextAlignment.Right; | ||
case ParagraphAlignment.justification: | ||
return TextAlignment.Justify; | ||
case ParagraphAlignment.lastLeft: | ||
return TextAlignment.LastLeft; | ||
case ParagraphAlignment.lastCenter: | ||
return TextAlignment.LastCenter; | ||
case ParagraphAlignment.lastRight: | ||
return TextAlignment.LastRight; | ||
} | ||
}; | ||
return TextEditorController; | ||
@@ -751,0 +847,0 @@ }()); |
@@ -23,3 +23,3 @@ var TextEditorRenderer = /** @class */ (function () { | ||
TextEditorRenderer.prototype.drawSelection = function (textHandler, selection) { | ||
if (selection === null || selection === void 0 ? void 0 : selection.isValid()) { | ||
if (selection.isValid()) { | ||
var transform = this._itemHandler.item.transform; | ||
@@ -26,0 +26,0 @@ var previewScale = this._itemHandler.item.previewScale; |
@@ -42,2 +42,3 @@ import { Color } from "@aurigma/design-atoms-model/Colors"; | ||
constructor(itemHandler: NewBaseTextItemHandler); | ||
getPaletteColors(): Color[]; | ||
private _textInputIssueUserConfirmationDelegate; | ||
@@ -44,0 +45,0 @@ get textInputIssueUserConfirmationDelegate(): Func<Promise<boolean>, string>; |
@@ -49,3 +49,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { TextEditor } from "./TextEditor"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-model/Product/Items/OpenTypeFeature"; | ||
import { TextProcessor } from "../Utils/TextProcessor"; | ||
@@ -55,2 +54,3 @@ import { DefaultStyleExtractorConverter } from "./Convert/DefaultStyleExtractorConverter"; | ||
import { StringUtils } from "../Utils/StringUtils"; | ||
import { OpenTypeFeature } from "@aurigma/design-atoms-text/Model/Span"; | ||
//TODO: delete class after merging to develop5 | ||
@@ -109,2 +109,5 @@ var TextManager2 = /** @class */ (function () { | ||
} | ||
TextManager2.prototype.getPaletteColors = function () { | ||
return null; | ||
}; | ||
Object.defineProperty(TextManager2.prototype, "textInputIssueUserConfirmationDelegate", { | ||
@@ -111,0 +114,0 @@ get: function () { |
@@ -15,3 +15,2 @@ var __extends = (this && this.__extends) || (function () { | ||
import { EqualsOfFloatNumbers, Transform, PointF, ConvertDegreeToRadian } from "@aurigma/design-atoms-model/Math"; | ||
import { TextManager2 } from "./TextManager"; | ||
import { CanvasElementHandler } from "../CanvasElementHandler"; | ||
@@ -21,2 +20,3 @@ import { TextRenderer } from "./TextRenderer"; | ||
import { toTextWhizzPath } from "@aurigma/design-atoms-text/Utils/PathUtils"; | ||
import { TextWhizzWrapper } from "@aurigma/design-atoms-text/TextEditor"; | ||
var WebGLTextRenderer = /** @class */ (function (_super) { | ||
@@ -77,3 +77,3 @@ __extends(WebGLTextRenderer, _super); | ||
catch (e) { | ||
throw TextManager2.createException(e, this._textWhizz); | ||
throw TextWhizzWrapper.createException(this._textWhizz, e); | ||
} | ||
@@ -113,6 +113,6 @@ }; | ||
var selectionTextColor = this._colorToTextWhizz(this._selectionTextColor); | ||
this._textWhizz.addColorTextRangeToContext(handler, selection, selectionTextColor); | ||
this._textWhizz.addColorTextRangeToContext(handler, selection, selectionTextColor, true); | ||
} | ||
catch (e) { | ||
throw TextManager2.createException(e, this._textWhizz); | ||
throw TextWhizzWrapper.createException(this._textWhizz, e); | ||
} | ||
@@ -139,3 +139,3 @@ }; | ||
catch (e) { | ||
throw TextManager2.createException(e, this._textWhizz); | ||
throw TextWhizzWrapper.createException(this._textWhizz, e); | ||
} | ||
@@ -142,0 +142,0 @@ try { |
@@ -277,4 +277,2 @@ import { BaseTextItem, RectangleItem, ImageItem, PlaceholderItem, BarcodeItem, BoundedTextItem, CurvedTextItem, PathBoundedTextItem, ShapeItem, LineItem, PolylineItem, PlainTextItem, DashedLineItem, AutoScaledTextItem, GridItem, EllipseItem, GroupItem, ClipartItem, ArchedTextItem, LayoutItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
reasons.push("max line length is not 0"); | ||
if (item.text.includes("<ol") || item.text.includes("<ul") || item.text.includes("<li")) | ||
reasons.push("numbered or bulleted list"); | ||
if (item instanceof BoundedTextItem) { | ||
@@ -281,0 +279,0 @@ if (item.scheduledFitMode != null) |
@@ -140,6 +140,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
order = this._item.getItemsOrder(); | ||
/* ??? | ||
if (this._itemHandler.canvas == null) | ||
return [2 /*return*/]; | ||
return; */ | ||
return [4 /*yield*/, this._itemHandler.waitUpdate()]; | ||
case 1: | ||
/* ??? | ||
if (this._itemHandler.canvas == null) | ||
return; */ | ||
_a.sent(); | ||
@@ -241,2 +245,3 @@ if (!order) | ||
if (fromCenter === void 0) { fromCenter = false; } | ||
var _a, _b, _c; | ||
if (this._disposed) | ||
@@ -250,8 +255,8 @@ return; | ||
try { | ||
var historyActive = !this._history.isPaused(); | ||
var historyActive = !((_a = this._history) === null || _a === void 0 ? void 0 : _a.isPaused()); | ||
if (historyActive) | ||
this._history.pause(); | ||
this._itemHandler.canvas.pauseRedraw(); | ||
(_b = this._itemHandler.canvas) === null || _b === void 0 ? void 0 : _b.pauseRedraw(); | ||
var changed = this._applyLayoutImpl(fromCenter); | ||
this._itemHandler.canvas.continueRedraw(true); | ||
(_c = this._itemHandler.canvas) === null || _c === void 0 ? void 0 : _c.continueRedraw(true); | ||
if (historyActive) { | ||
@@ -258,0 +263,0 @@ if (changed) |
@@ -150,6 +150,12 @@ var __extends = (this && this.__extends) || (function () { | ||
return [2 /*return*/]; | ||
/* ??? | ||
if (!this.canvas) | ||
return [2 /*return*/]; | ||
return; | ||
*/ | ||
return [4 /*yield*/, this._resetSourceRectangle()]; | ||
case 1: | ||
/* ??? | ||
if (!this.canvas) | ||
return; | ||
*/ | ||
_a.sent(); | ||
@@ -204,2 +210,3 @@ return [2 /*return*/]; | ||
LayoutItemHandler.prototype._endTransform = function (changed, resized, suppressOnChanged) { | ||
var _a, _b, _c, _d; | ||
_super.prototype._endTransform.call(this, changed, resized, suppressOnChanged); | ||
@@ -212,3 +219,3 @@ if (this._transformedRectangle == null) { | ||
} | ||
this.canvas.pauseRedraw(); | ||
(_a = this.canvas) === null || _a === void 0 ? void 0 : _a.pauseRedraw(); | ||
var t = this._transformedRectangle; | ||
@@ -218,3 +225,3 @@ this._transformedRectangle = null; | ||
//await this.waitUpdate(); | ||
this._history.pause(); | ||
(_b = this._history) === null || _b === void 0 ? void 0 : _b.pause(); | ||
this.setSourceRectangle(t); | ||
@@ -224,4 +231,4 @@ if (this._layoutHandler) | ||
this.applyLayout(null); | ||
this._history.resume(true, false, true); | ||
this.canvas.continueRedraw(); | ||
(_c = this._history) === null || _c === void 0 ? void 0 : _c.resume(true, false, true); | ||
(_d = this.canvas) === null || _d === void 0 ? void 0 : _d.continueRedraw(); | ||
}; | ||
@@ -399,6 +406,7 @@ LayoutItemHandler.prototype.drawChildHighlights = function (itemHandlerCtx) { | ||
this._unsubscribeChildItemHandlers(); | ||
if (this._layoutHandler != null) { | ||
/* ??? | ||
if (this._layoutHandler != null){ | ||
this._layoutHandler.dispose(); | ||
this._layoutHandler = null; | ||
} | ||
}*/ | ||
_super.prototype._onRemovedFromCanvas.call(this, canvas); | ||
@@ -405,0 +413,0 @@ return [2 /*return*/]; |
@@ -667,4 +667,9 @@ var __extends = (this && this.__extends) || (function () { | ||
case 0: | ||
if (this._isDisposed || this.canvas == null) | ||
if (this._isDisposed || this.canvas == null) { | ||
if (this._handlerUpdated != null) { | ||
this._handlerUpdated.resolve(); | ||
this._handlerUpdated = null; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
innerUpdate = function () { | ||
@@ -671,0 +676,0 @@ if (typeof beforeUpdate == "function") |
{ | ||
"version": "6.17.5", | ||
"version": "6.18.0", | ||
"name": "@aurigma/design-atoms", | ||
@@ -22,5 +22,5 @@ "license": "SEE LICENSE IN License.md", | ||
"dependencies": { | ||
"@aurigma/design-atoms-model": "6.5.25", | ||
"@aurigma/design-atoms-text": "6.17.5", | ||
"@aurigma/text-whizz": "1.5.24", | ||
"@aurigma/design-atoms-model": "6.5.26", | ||
"@aurigma/design-atoms-text": "6.18.0", | ||
"@aurigma/text-whizz": "1.5.44", | ||
"clone": "2.1.1", | ||
@@ -27,0 +27,0 @@ "json-cycle": "1.3.0", |
@@ -15,2 +15,4 @@ import { Item, PlaceholderItem, ImageItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
removeItemChanged(listener: (item: Item) => void): any; | ||
addItemChanging(listener: (sender: Item) => void): any; | ||
removeItemChanging(listener: (sender: Item) => void): any; | ||
addSurfaceChanged(listener: (surface: Surface) => void): any; | ||
@@ -28,4 +30,12 @@ removeSurfaceChanged(listener: (surface: Surface) => void): any; | ||
removeSnapshotLoadedEvent(listener: (snapshot: Product | Surface) => void): any; | ||
addBeforeSnapshotLoad(listener: (snapshot: Product | Surface) => void): any; | ||
removeBeforeSnapshotLoad(listener: (snapshot: Product | Surface) => void): any; | ||
addSurfaceCollectionChanged(listener: () => void): any; | ||
removeSurfaceCollectionChanged(listener: () => void): any; | ||
addLayerCollectionChanged(listener: () => void): any; | ||
removeLayerCollectionChanged(listener: () => void): any; | ||
addIItemHandelrCollectionChanged(listener: () => void): any; | ||
removeItemHandlerCollectionChanged(listener: () => void): any; | ||
addPrintAreaCollectionChanged(listener: () => void): any; | ||
removePrintAreaCollectionChanged(listener: () => void): any; | ||
addContainerCollectionChanged(listener: () => void): any; | ||
@@ -32,0 +42,0 @@ removeContainerCollectionChanged(listener: () => void): any; |
@@ -1,5 +0,5 @@ | ||
import { Viewer } from "../Viewer"; | ||
import { Surface, SurfaceContainer, PrintArea, Product } from "@aurigma/design-atoms-model/Product"; | ||
import { ItemHandler } from "../ItemHandlers"; | ||
import { Item } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { Surface, SurfaceContainer, PrintArea } from "@aurigma/design-atoms-model/Product"; | ||
import { Viewer } from "../Viewer"; | ||
import { ISize } from "../Utils/Math"; | ||
@@ -19,3 +19,3 @@ export declare class ProductHandler { | ||
waitUpdate(): Promise<void[]>; | ||
get product(): import("@aurigma/design-atoms-model/Product").Product; | ||
get product(): Product; | ||
checkSelectionByHitTest(x: number, y: number): boolean; | ||
@@ -33,2 +33,3 @@ get selectedItems(): Item[]; | ||
isItemSelected(item: Item): boolean; | ||
applyLayout(product: Product, surfaceFilterFunc?: (index: number, surface: Surface) => boolean): void; | ||
} |
@@ -39,2 +39,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { ISize } from "../Utils/Math"; | ||
import { SurfaceHandler } from "./SurfaceHandler"; | ||
var ProductHandler = /** @class */ (function () { | ||
@@ -183,2 +184,16 @@ function ProductHandler(_viewer) { | ||
}; | ||
ProductHandler.prototype.applyLayout = function (product, surfaceFilterFunc) { | ||
if (!product) | ||
product = this.product; | ||
var handlerFactory = this._viewer.canvas.handlerFactory; | ||
for (var i = 0; i < product.surfaces.length; i++) { | ||
var surface = product.surfaces.get(i); | ||
var skipSurface = false; | ||
if (surfaceFilterFunc) | ||
skipSurface = surfaceFilterFunc(i, surface); | ||
if (skipSurface) | ||
continue; | ||
SurfaceHandler.applyLayout(handlerFactory, this._viewer.canvas, surface); | ||
} | ||
}; | ||
return ProductHandler; | ||
@@ -185,0 +200,0 @@ }()); |
@@ -1,4 +0,6 @@ | ||
import { Surface } from "@aurigma/design-atoms-model/Product"; | ||
import { Surface, PrintAreaBoundsType } from "@aurigma/design-atoms-model/Product"; | ||
import { Item } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { RectangleF } from "@aurigma/design-atoms-model/Math"; | ||
import { PrintAreaBoundsType } from "@aurigma/design-atoms-model/Product/PrintAreaBoundsType"; | ||
import { HandlerFactoryByItem } from "../ItemHandlers/HandlerFactoryByItem"; | ||
import { Canvas } from "../Canvas"; | ||
export declare class SurfaceHandler { | ||
@@ -9,2 +11,5 @@ private _surface; | ||
getPrintAreasBounds(type: PrintAreaBoundsType): RectangleF; | ||
static getItemSurface(item: Item): any; | ||
static applyLayout(handlerFactory: HandlerFactoryByItem, canvas: Canvas, surface: Surface): Promise<void>; | ||
private static _updateTextItemHandlers; | ||
} |
@@ -0,2 +1,52 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
import { Surface, PrintArea, SurfaceMockup } from "@aurigma/design-atoms-model/Product"; | ||
import { BaseTextItem, LayoutItem } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { RectangleF } from "@aurigma/design-atoms-model/Math"; | ||
import { NewBaseTextItemHandler } from "../ItemHandlers/NewBaseTextItemHandler"; | ||
var SurfaceHandler = /** @class */ (function () { | ||
@@ -13,2 +63,93 @@ function SurfaceHandler(_surface) { | ||
}; | ||
SurfaceHandler.getItemSurface = function (item) { | ||
if (item.parentGroupItem) | ||
return SurfaceHandler.getItemSurface(item.parentGroupItem); | ||
var container = item.parentContainer; | ||
if (!container || !container.parentComponent) | ||
return null; | ||
if (container.parentComponent instanceof Surface) | ||
return container.parentComponent; | ||
else if (container.parentComponent instanceof PrintArea) | ||
return container.parentComponent.parentSurface; | ||
else if (container.parentComponent instanceof SurfaceMockup) | ||
return container.parentComponent.parentSurface; | ||
return null; | ||
}; | ||
SurfaceHandler.applyLayout = function (handlerFactory, canvas, surface) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var layoutItemsHandlers, textItemHandlers, layoutItemsHandlers_1, layoutItemsHandlers_1_1, handler; | ||
var e_1, _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
layoutItemsHandlers = surface.getAllItems({ flatGroupItems: true, ignoreMockups: true }) | ||
.where(function (x) { return x.type == LayoutItem.type; }) | ||
.select(function (x) { return handlerFactory.get(x); }); | ||
if (!layoutItemsHandlers) return [3 /*break*/, 2]; | ||
textItemHandlers = surface.getAllItems({ flatGroupItems: true, ignoreMockups: true }) | ||
.ofType(BaseTextItem) | ||
.select(function (x) { return handlerFactory.get(x); }) | ||
.where(function (x) { return x instanceof NewBaseTextItemHandler; }).toArray(); | ||
return [4 /*yield*/, SurfaceHandler._updateTextItemHandlers(textItemHandlers, canvas)]; | ||
case 1: | ||
_b.sent(); | ||
_b.label = 2; | ||
case 2: | ||
try { | ||
for (layoutItemsHandlers_1 = __values(layoutItemsHandlers), layoutItemsHandlers_1_1 = layoutItemsHandlers_1.next(); !layoutItemsHandlers_1_1.done; layoutItemsHandlers_1_1 = layoutItemsHandlers_1.next()) { | ||
handler = layoutItemsHandlers_1_1.value; | ||
handler.applyLayout(); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (layoutItemsHandlers_1_1 && !layoutItemsHandlers_1_1.done && (_a = layoutItemsHandlers_1.return)) _a.call(layoutItemsHandlers_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
// this method update TextItemHandlers (new) that are not on the current canvas to allow applyLayout work correctly | ||
// TODO: need to make solution to update text items handlers that are not on the canvas | ||
SurfaceHandler._updateTextItemHandlers = function (textItemHandlers, canvas) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var promises; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
promises = textItemHandlers.map(function (x) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (x.canvas) | ||
return [2 /*return*/]; | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, , 3, 4]); | ||
x.canvas = canvas; | ||
x.update(); | ||
return [4 /*yield*/, x.waitUpdate()]; | ||
case 2: | ||
_a.sent(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
x.canvas = null; | ||
return [7 /*endfinally*/]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
return [4 /*yield*/, Promise.all(promises)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return SurfaceHandler; | ||
@@ -15,0 +156,0 @@ }()); |
export function applyIfDefined(value, setter) { | ||
if (value !== undefined) | ||
if (value !== undefined && value != null) | ||
setter(value); | ||
} | ||
//# sourceMappingURL=Functions.js.map |
import { PrintArea } from "@aurigma/design-atoms-model/Product"; | ||
import { IProductThemeConfig } from "@aurigma/design-atoms-model/Product/Interfaces"; | ||
import { IFloatingItemToolbarConfig } from "../Services/FloatingToolbar/FloatingToolbarManager"; | ||
import { NumberingFormatType } from "@aurigma/design-atoms-text/TextEditor"; | ||
export interface IViewerConfiguration { | ||
@@ -20,2 +21,3 @@ stubImages?: IStubImagesConfig; | ||
textEditor: TextEditorMode; | ||
listSettings: IListConfiguration; | ||
handlers: IHandlersConfiguration; | ||
@@ -98,2 +100,11 @@ violationService: IViolationServiceConfiguration; | ||
} | ||
export interface IListConfiguration { | ||
maxLevel: number; | ||
firstLineIndent: number; | ||
listIndent: number; | ||
levelIndent: number; | ||
tabOffset: number; | ||
bulletChar: string; | ||
numberingFormat: NumberingFormatType; | ||
} | ||
export interface IHandlersConfiguration { | ||
@@ -100,0 +111,0 @@ placeholderEditingViewMode: PlaceholderEditingViewMode; |
import { PrintArea } from "@aurigma/design-atoms-model/Product"; | ||
import { ISnapLinesConfiguration } from "./SnapLinesHandler"; | ||
import { IProductThemeConfig } from "@aurigma/design-atoms-model/Product/Interfaces"; | ||
import { IViewerConfiguration, GridConfig, IRangeParams, IRulersConfig, ITextParams, IViewerMessagesConfig, IStubImagesConfig, IStubImagesBarcodeConfig, IPrintZoneConfiguration, TextEditorMode, IHandlersConfiguration, IViolationServiceConfiguration } from "./IViewerConfiguration"; | ||
import { IViewerConfiguration, GridConfig, IRangeParams, IRulersConfig, ITextParams, IViewerMessagesConfig, IStubImagesConfig, IStubImagesBarcodeConfig, IPrintZoneConfiguration, TextEditorMode, IHandlersConfiguration, IViolationServiceConfiguration, IListConfiguration } from "./IViewerConfiguration"; | ||
import { IFloatingItemToolbarConfig } from "../Services/FloatingToolbar/FloatingToolbarManager"; | ||
@@ -26,2 +26,3 @@ export declare class ViewerConfiguration implements IViewerConfiguration { | ||
textEditor: TextEditorMode; | ||
listSettings: IListConfiguration; | ||
handlers: IHandlersConfiguration; | ||
@@ -28,0 +29,0 @@ violationService: IViolationServiceConfiguration; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
4053204
53747
+ Added@aurigma/design-atoms-text@6.18.0(transitive)
+ Added@aurigma/text-whizz@1.5.44(transitive)
- Removed@aurigma/design-atoms-text@6.17.5(transitive)
- Removed@aurigma/text-whizz@1.5.24(transitive)
Updated@aurigma/text-whizz@1.5.44