Skip to content

Commit

Permalink
feat:标注支持组件映射关系
Browse files Browse the repository at this point in the history
  • Loading branch information
huangwencun committed Jul 22, 2021
1 parent 6749f5c commit c0a0f39
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ export interface BaseComponent {
value?: string // 内容
panel?: Panel // 标注面板
symbolName?: string //组件名称
symbolComponentObject?: { // 组件映射对象
url: string,
code_name: string,
code_lib_name: string,
}
}
2 changes: 1 addition & 1 deletion picasso-package/packages/picasso-parse/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wubafe/picasso-parse",
"version": "0.0.29",
"version": "0.0.30",
"description": "Picasso解析库",
"main": "dist/picasso-parse/src/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SKLayer } from '../types'
*/
const filterGroupLayer = (layers:SKLayer[],afterLayer:SKLayer[]=[]):SKLayer[] => {
layers.forEach((layer:SKLayer) => {
if (layer._class!=='group') {
if (layer._class!=='group' || layer.symbolComponentObject) {
afterLayer.push({...layer,layers:[]})
}
if (Array.isArray(layer.layers)) {
Expand Down
4 changes: 4 additions & 0 deletions picasso-package/packages/picasso-parse/src/parseDSL/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const _parseDSL = (sketchData: SKLayer[]):DSL => {
symbolName: layer.symbolName || ''
}

if (layer.symbolComponentObject) {
dslLayer.symbolComponentObject = layer.symbolComponentObject;
}

// 面板解析
dslLayer.panel = layer.panel;
// 结构解析
Expand Down
1 change: 1 addition & 0 deletions picasso-package/packages/picasso-parse/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"src", "../picasso-trans/src/parseCode.ts" // 会编译src目录下的所有文件,包括子目录
],
"compilerOptions": {
"lib": ["dom", "es2017"],
"target": "es6", // 指定ECMAScript目标版本
"module": "commonjs", // 指定模块化类型
"declaration": true, // 生成 `.d.ts` 文件
Expand Down
5 changes: 5 additions & 0 deletions picasso-package/packages/sketch-dsl/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export type SKLayer = {
hasConvertedToNewRoundCorners?: boolean
panel?: Panel
symbolName?: string
symbolComponentObject?: {
url: string,
code_name: string,
code_lib_name: string,
},
sharedLayerStyleName?: string
sharedTextStyleName?: string
}
Expand Down
1 change: 1 addition & 0 deletions picasso-package/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"lib": ["dom", "es2017"],
"module": "commonjs",
"target": "es6",
"experimentalDecorators": true,
Expand Down

0 comments on commit c0a0f39

Please sign in to comment.