@leafer-ui/display 1.0.0-rc.25 → 1.0.0-rc.27
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/package.json +8 -8
- package/src/Box.ts +7 -4
- package/src/Canvas.ts +3 -6
- package/src/Text.ts +4 -1
- package/src/UI.ts +12 -4
- package/types/index.d.ts +7 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.27",
|
|
4
4
|
"description": "@leafer-ui/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.0.0-rc.
|
|
26
|
-
"@leafer-ui/data": "1.0.0-rc.
|
|
27
|
-
"@leafer-ui/display-module": "1.0.0-rc.
|
|
28
|
-
"@leafer-ui/decorator": "1.0.0-rc.
|
|
29
|
-
"@leafer-ui/external": "1.0.0-rc.
|
|
25
|
+
"@leafer/core": "1.0.0-rc.27",
|
|
26
|
+
"@leafer-ui/data": "1.0.0-rc.27",
|
|
27
|
+
"@leafer-ui/display-module": "1.0.0-rc.27",
|
|
28
|
+
"@leafer-ui/decorator": "1.0.0-rc.27",
|
|
29
|
+
"@leafer-ui/external": "1.0.0-rc.27"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.0.0-rc.
|
|
33
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
32
|
+
"@leafer/interface": "1.0.0-rc.27",
|
|
33
|
+
"@leafer-ui/interface": "1.0.0-rc.27"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Box.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILeaferCanvas, IRenderOptions, IBoundsData } from '@leafer/interface'
|
|
2
|
-
import { rewrite, rewriteAble, registerUI, BoundsHelper, dataProcessor, affectRenderBoundsType } from '@leafer/core'
|
|
1
|
+
import { ILeaferCanvas, IRenderOptions, IBoundsData, IBoolean } from '@leafer/interface'
|
|
2
|
+
import { rewrite, rewriteAble, registerUI, BoundsHelper, dataProcessor, affectRenderBoundsType, dataType } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IBox, IBoxData, IBoxInputData, IOverflow } from '@leafer-ui/interface'
|
|
5
5
|
import { BoxData } from '@leafer-ui/data'
|
|
@@ -23,6 +23,9 @@ export class Box extends Group implements IBox {
|
|
|
23
23
|
@dataProcessor(BoxData)
|
|
24
24
|
declare public __: IBoxData
|
|
25
25
|
|
|
26
|
+
@dataType(false)
|
|
27
|
+
public resizeChildren: IBoolean
|
|
28
|
+
|
|
26
29
|
@affectRenderBoundsType('show')
|
|
27
30
|
declare public overflow: IOverflow
|
|
28
31
|
|
|
@@ -56,8 +59,8 @@ export class Box extends Group implements IBox {
|
|
|
56
59
|
super.__updateBoxBounds()
|
|
57
60
|
if (!data.__autoSize) {
|
|
58
61
|
const b = this.__layout.boxBounds
|
|
59
|
-
if (!data.__autoWidth) b.
|
|
60
|
-
if (!data.__autoHeight) b.
|
|
62
|
+
if (!data.__autoWidth) b.height += b.y, b.width = data.width, b.x = b.y = 0
|
|
63
|
+
if (!data.__autoHeight) b.width += b.x, b.height = data.height, b.y = b.x = 0
|
|
61
64
|
}
|
|
62
65
|
} else {
|
|
63
66
|
this.__updateRectBoxBounds()
|
package/src/Canvas.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, ICanvasContext2DSettings, IScreenSizeData, ISizeData
|
|
2
|
-
import { Creator, Matrix, Platform, dataProcessor, registerUI
|
|
1
|
+
import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, ICanvasContext2DSettings, IScreenSizeData, ISizeData } from '@leafer/interface'
|
|
2
|
+
import { Creator, Matrix, Platform, dataProcessor, registerUI } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
|
|
5
5
|
import { CanvasData } from '@leafer-ui/data'
|
|
@@ -31,9 +31,6 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
31
31
|
@resizeType()
|
|
32
32
|
public contextSettings: ICanvasContext2DSettings
|
|
33
33
|
|
|
34
|
-
@hitType('all')
|
|
35
|
-
declare public hitFill: IHitType
|
|
36
|
-
|
|
37
34
|
public canvas: ILeaferCanvas
|
|
38
35
|
|
|
39
36
|
public context: ICanvasContext2D
|
|
@@ -42,7 +39,7 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
42
39
|
super(data)
|
|
43
40
|
this.canvas = Creator.canvas(this.__ as ILeaferCanvasConfig)
|
|
44
41
|
this.context = this.canvas.context
|
|
45
|
-
this.__.__drawAfterFill = true
|
|
42
|
+
this.__.__isCanvas = this.__.__drawAfterFill = true
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
public draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void {
|
package/src/Text.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IBoolean, INumber, IString, IBoundsData, IUnitData } from '@leafer/interface'
|
|
2
|
-
import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, hitType, MathHelper } from '@leafer/core'
|
|
2
|
+
import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, dataType, hitType, MathHelper } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IStrokeAlign, IHitType, ITextWrap } from '@leafer-ui/interface'
|
|
5
5
|
import { TextData, UnitConvert } from '@leafer-ui/data'
|
|
@@ -26,6 +26,9 @@ export class Text extends UI implements IText {
|
|
|
26
26
|
@boundsType(0)
|
|
27
27
|
declare public height: INumber
|
|
28
28
|
|
|
29
|
+
@dataType(false)
|
|
30
|
+
public resizeFontSize: IBoolean
|
|
31
|
+
|
|
29
32
|
@surfaceType('#000000')
|
|
30
33
|
declare public fill: IFill
|
|
31
34
|
|
package/src/UI.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject } from '@leafer/interface'
|
|
2
2
|
import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowType, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction } from '@leafer-ui/interface'
|
|
@@ -63,7 +63,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
63
63
|
@stateType(false)
|
|
64
64
|
public disabled: IBoolean
|
|
65
65
|
|
|
66
|
-
@
|
|
66
|
+
@surfaceType(false)
|
|
67
67
|
public locked: IBoolean
|
|
68
68
|
|
|
69
69
|
|
|
@@ -182,6 +182,9 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
182
182
|
@boundsType() // rewrite in flow
|
|
183
183
|
public autoHeight: IAutoSize
|
|
184
184
|
|
|
185
|
+
@boundsType()
|
|
186
|
+
public lockRatio: IBoolean
|
|
187
|
+
|
|
185
188
|
@boundsType()
|
|
186
189
|
public autoBox: IAutoBoxData | IConstraint
|
|
187
190
|
|
|
@@ -323,6 +326,11 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
323
326
|
public disabledStyle: IUIInputData
|
|
324
327
|
|
|
325
328
|
|
|
329
|
+
// 预留给用户使用的数据对象
|
|
330
|
+
@dataType({})
|
|
331
|
+
public data: IObject
|
|
332
|
+
|
|
333
|
+
|
|
326
334
|
public set scale(value: INumber | IPointData) {
|
|
327
335
|
if (typeof value === 'number') {
|
|
328
336
|
this.scaleX = this.scaleY = value
|
|
@@ -382,9 +390,9 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
382
390
|
|
|
383
391
|
public findTag(tag: string | string[]): IUI[] { return this.find({ tag }) }
|
|
384
392
|
|
|
385
|
-
public findOne(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI { return undefined }
|
|
393
|
+
public findOne(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI | undefined { return undefined }
|
|
386
394
|
|
|
387
|
-
public findId(id: number | string): IUI { return this.findOne({ id }) }
|
|
395
|
+
public findId(id: number | string): IUI | undefined { return this.findOne({ id }) }
|
|
388
396
|
|
|
389
397
|
|
|
390
398
|
// path
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent,
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D, IUnitData } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
3
|
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IEditorConfig, IFindUIMethod, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBox, IBoxData, IOverflow, IBoxInputData, IFrame, IFrameData, IFrameInputData, IRect, IRectData, IRectInputData, IEllipse, IEllipseData, IEllipseInputData, IPolygon, IPolygonData, IPolygonInputData, IStar, IStarData, IStarInputData, ILine, ILineData, ILineInputData, IImage, IImageData, IImageInputData, ICanvas, ICanvasData, ICanvasInputData, IText, ITextData, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
|
|
4
4
|
|
|
@@ -53,6 +53,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
53
53
|
inFlow: IBoolean;
|
|
54
54
|
autoWidth: IAutoSize;
|
|
55
55
|
autoHeight: IAutoSize;
|
|
56
|
+
lockRatio: IBoolean;
|
|
56
57
|
autoBox: IAutoBoxData | IConstraint;
|
|
57
58
|
widthRange: IRangeSize;
|
|
58
59
|
heightRange: IRangeSize;
|
|
@@ -92,6 +93,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
92
93
|
focusStyle: IUIInputData;
|
|
93
94
|
selectedStyle: IUIInputData;
|
|
94
95
|
disabledStyle: IUIInputData;
|
|
96
|
+
data: IObject;
|
|
95
97
|
set scale(value: INumber | IPointData);
|
|
96
98
|
get scale(): INumber | IPointData;
|
|
97
99
|
get pen(): IPathCreator;
|
|
@@ -105,8 +107,8 @@ declare class UI extends Leaf implements IUI {
|
|
|
105
107
|
createProxyData(): IUIInputData;
|
|
106
108
|
find(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI[];
|
|
107
109
|
findTag(tag: string | string[]): IUI[];
|
|
108
|
-
findOne(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI;
|
|
109
|
-
findId(id: number | string): IUI;
|
|
110
|
+
findOne(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI | undefined;
|
|
111
|
+
findId(id: number | string): IUI | undefined;
|
|
110
112
|
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
|
|
111
113
|
getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
|
|
112
114
|
load(): void;
|
|
@@ -240,6 +242,7 @@ declare class Box extends Group implements IBox {
|
|
|
240
242
|
get __tag(): string;
|
|
241
243
|
get isBranchLeaf(): boolean;
|
|
242
244
|
__: IBoxData;
|
|
245
|
+
resizeChildren: IBoolean;
|
|
243
246
|
overflow: IOverflow;
|
|
244
247
|
isOverflow: boolean;
|
|
245
248
|
constructor(data?: IBoxInputData);
|
|
@@ -339,7 +342,6 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
339
342
|
pixelRatio: INumber;
|
|
340
343
|
smooth: boolean;
|
|
341
344
|
contextSettings: ICanvasContext2DSettings;
|
|
342
|
-
hitFill: IHitType;
|
|
343
345
|
canvas: ILeaferCanvas;
|
|
344
346
|
context: ICanvasContext2D;
|
|
345
347
|
constructor(data?: ICanvasInputData);
|
|
@@ -355,6 +357,7 @@ declare class Text extends UI implements IText {
|
|
|
355
357
|
__: ITextData;
|
|
356
358
|
width: INumber;
|
|
357
359
|
height: INumber;
|
|
360
|
+
resizeFontSize: IBoolean;
|
|
358
361
|
fill: IFill;
|
|
359
362
|
strokeAlign: IStrokeAlign;
|
|
360
363
|
hitFill: IHitType$1;
|