@leafer-ui/display 1.6.1 → 1.6.2
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/Image.ts +5 -3
- package/src/Text.ts +4 -1
- package/src/UI.ts +10 -3
- package/types/index.d.ts +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
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.6.
|
|
26
|
-
"@leafer-ui/data": "1.6.
|
|
27
|
-
"@leafer-ui/display-module": "1.6.
|
|
28
|
-
"@leafer-ui/decorator": "1.6.
|
|
29
|
-
"@leafer-ui/external": "1.6.
|
|
25
|
+
"@leafer/core": "1.6.2",
|
|
26
|
+
"@leafer-ui/data": "1.6.2",
|
|
27
|
+
"@leafer-ui/display-module": "1.6.2",
|
|
28
|
+
"@leafer-ui/decorator": "1.6.2",
|
|
29
|
+
"@leafer-ui/external": "1.6.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.6.
|
|
33
|
-
"@leafer-ui/interface": "1.6.
|
|
32
|
+
"@leafer/interface": "1.6.2",
|
|
33
|
+
"@leafer-ui/interface": "1.6.2"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Image.ts
CHANGED
|
@@ -24,9 +24,11 @@ export class Image extends Rect implements IImage {
|
|
|
24
24
|
|
|
25
25
|
constructor(data?: IImageInputData) {
|
|
26
26
|
super(data)
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
this.on_(ImageEvent.LOADED, this.__onLoaded, this)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public __onLoaded(e: ImageEvent): void {
|
|
31
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url) this.image = e.image
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
public destroy(): void {
|
package/src/Text.ts
CHANGED
|
@@ -44,6 +44,9 @@ export class Text extends UI implements IText {
|
|
|
44
44
|
@boundsType('')
|
|
45
45
|
public text?: IString | INumber
|
|
46
46
|
|
|
47
|
+
@boundsType('')
|
|
48
|
+
public placeholder?: IString
|
|
49
|
+
|
|
47
50
|
@boundsType('caption')
|
|
48
51
|
public fontFamily?: IString
|
|
49
52
|
|
|
@@ -115,7 +118,7 @@ export class Text extends UI implements IText {
|
|
|
115
118
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`
|
|
116
119
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize
|
|
117
120
|
|
|
118
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__)
|
|
121
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__)
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
override __updateBoxBounds(): void {
|
package/src/UI.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter } 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, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter, ILeaferImage } 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, MathHelper, Plugin, DataHelper } from '@leafer/core'
|
|
3
3
|
|
|
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, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle } from '@leafer-ui/interface'
|
|
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, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString } from '@leafer-ui/interface'
|
|
5
5
|
import { effectType, zoomLayerType } from '@leafer-ui/decorator'
|
|
6
6
|
|
|
7
7
|
import { UIData } from '@leafer-ui/data'
|
|
8
8
|
import { UIBounds, UIRender } from '@leafer-ui/display-module'
|
|
9
9
|
|
|
10
|
-
import { Export, PathArrow } from '@leafer-ui/external'
|
|
10
|
+
import { Export, Paint, PathArrow } from '@leafer-ui/external'
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@useModule(UIBounds)
|
|
@@ -348,6 +348,9 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
348
348
|
|
|
349
349
|
public placeholderStyle?: IStateStyle
|
|
350
350
|
|
|
351
|
+
@surfaceType()
|
|
352
|
+
public placeholderColor?: IColorString
|
|
353
|
+
|
|
351
354
|
|
|
352
355
|
public button?: IBoolean
|
|
353
356
|
|
|
@@ -476,6 +479,10 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
476
479
|
} else drawer.rect(x, y, width, height)
|
|
477
480
|
}
|
|
478
481
|
|
|
482
|
+
public drawImagePlaceholder(canvas: ILeaferCanvas, _image?: ILeaferImage): void {
|
|
483
|
+
Paint.fill(this.__.placeholderColor, this, canvas) // 图片占位符
|
|
484
|
+
}
|
|
485
|
+
|
|
479
486
|
// @leafer-in/animate rewrite
|
|
480
487
|
|
|
481
488
|
public animate(_keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate {
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions,
|
|
2
|
-
import { Leaf, LeafList } from '@leafer/core';
|
|
3
|
-
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IAnimate, IEditorConfig, IFindUIMethod, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, IUIJSONData, IFindCondition as IFindCondition$1, 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, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData, IPointData as IPointData$1 } from '@leafer-ui/interface';
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
2
|
+
import { Leaf, LeafList, ImageEvent } from '@leafer/core';
|
|
3
|
+
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IAnimate, IEditorConfig, IFindUIMethod, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, IUIJSONData, IFindCondition as IFindCondition$1, 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, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData, IPointData as IPointData$1 } from '@leafer-ui/interface';
|
|
4
4
|
|
|
5
5
|
declare class UI extends Leaf implements IUI {
|
|
6
6
|
__: IUIData;
|
|
@@ -107,6 +107,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
107
107
|
selectedStyle?: IStateStyle;
|
|
108
108
|
disabledStyle?: IStateStyle;
|
|
109
109
|
placeholderStyle?: IStateStyle;
|
|
110
|
+
placeholderColor?: IColorString;
|
|
110
111
|
button?: IBoolean;
|
|
111
112
|
data: IObject;
|
|
112
113
|
set scale(value: INumber | IPointData);
|
|
@@ -135,6 +136,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
135
136
|
__drawPath(canvas: ILeaferCanvas): void;
|
|
136
137
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
137
138
|
__drawPathByBox(drawer: IPathDrawer): void;
|
|
139
|
+
drawImagePlaceholder(canvas: ILeaferCanvas, _image?: ILeaferImage): void;
|
|
138
140
|
animate(_keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
|
|
139
141
|
killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void;
|
|
140
142
|
export(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
@@ -362,6 +364,7 @@ declare class Image extends Rect implements IImage {
|
|
|
362
364
|
get ready(): boolean;
|
|
363
365
|
image?: ILeaferImage;
|
|
364
366
|
constructor(data?: IImageInputData);
|
|
367
|
+
__onLoaded(e: ImageEvent): void;
|
|
365
368
|
destroy(): void;
|
|
366
369
|
}
|
|
367
370
|
declare const MyImage: typeof Image;
|
|
@@ -399,6 +402,7 @@ declare class Text extends UI implements IText {
|
|
|
399
402
|
strokeAlign?: IStrokeAlign;
|
|
400
403
|
hitFill?: IHitType$1;
|
|
401
404
|
text?: IString | INumber;
|
|
405
|
+
placeholder?: IString;
|
|
402
406
|
fontFamily?: IString;
|
|
403
407
|
fontSize?: INumber;
|
|
404
408
|
fontWeight?: IFontWeight;
|