forked from sparrow-js/sparrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
310f2cf
commit c34c2ca
Showing
66 changed files
with
1,622 additions
and
343 deletions.
There are no files selected for viewing
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...gins/sparrow-test-component/dist/index.js → ...lugin-demo/sparrow-test-box/dist/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "sparrow-test-box", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
"description": "", | ||
"dependencies": { | ||
"@lukeed/uuid": "^1.0.1", | ||
"@sparrow-vue/sparrow-utils": "^1.0.6", | ||
"cheerio": "^1.0.0-rc.3" | ||
}, | ||
"main": "./dist/index.js", | ||
"scripts": { | ||
"build-ts": "tsc", | ||
"watch-ts": "tsc -w" | ||
}, | ||
"devDependencies": { | ||
"@babel/template": "^7.8.3", | ||
"@types/cheerio": "^0.22.15", | ||
"@types/execa": "^2.0.0", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^10.5.5", | ||
"@types/prettier": "^1.19.0", | ||
"@vue/cli-plugin-babel": "^4.1.1", | ||
"@vue/cli-plugin-eslint": "^4.1.1", | ||
"@vue/cli-service": "^4.1.1", | ||
"@vue/eslint-config-standard": "^5.0.1", | ||
"cross-env": "^5.2.0", | ||
"midway-bin": "1", | ||
"midway-mock": "1", | ||
"npm-run-all": "^4.1.5", | ||
"ts-node": "^8.0.2", | ||
"tslib": "^1.8.1", | ||
"typescript": "^3.2.0", | ||
"vue-template-compiler": "^2.6.11" | ||
}, | ||
"sparrow": { | ||
"name": "sparrow-test-component", | ||
"description": "Test sparrow" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "sparrow-test-box", | ||
"description": "Test sparrow box", | ||
"thumb": "https://unpkg.com/@sparrow-vue/[email protected]/assets/box.png" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
56 changes: 56 additions & 0 deletions
56
packages/plugin-demo/sparrow-test-component/dist/config.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
...ugins/sparrow-test-component/package.json → ...-demo/sparrow-test-component/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export default { | ||
model: { | ||
attr: { | ||
direction: "", | ||
'content-position': '', | ||
}, | ||
custom: { | ||
label: '输入文本', | ||
}, | ||
}, | ||
schema: { | ||
fields: [ | ||
{ | ||
type: 'object', | ||
label: '', | ||
model: 'attr', | ||
schema: { | ||
fields: [ | ||
{ | ||
type: "select", | ||
label: "direction", | ||
model: "direction", | ||
multi: true, | ||
values: ["horizontal", "vertical", ""] | ||
}, | ||
{ | ||
type: "select", | ||
label: "content-position", | ||
model: "content-position", | ||
multi: true, | ||
values: ["left", "right", "center", ""] | ||
}, | ||
] | ||
} | ||
}, | ||
{ | ||
type: 'object', | ||
label: '', | ||
model: 'custom', | ||
schema: { | ||
fields: [ | ||
{ | ||
type: "input", | ||
inputType: "text", | ||
label: "label", | ||
model: "label" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
import {Component, VueParse} from '@sparrow-vue/sparrow-utils'; | ||
import * as _ from 'lodash'; | ||
import * as fsExtra from 'fs-extra'; | ||
import * as path from 'path'; | ||
const cwd = process.cwd(); | ||
export default class TestComponent extends Component{ | ||
name: string = 'TestComponent'; | ||
config: any = {}; | ||
$fragment: any; | ||
vueParse: any; | ||
|
||
constructor (params: any, storge: any) { | ||
super(storge); | ||
this.initVueParse(); | ||
const {initType} = params; | ||
if (initType === 'auto' ) { | ||
this.config = params; | ||
} else { | ||
this.config = _.cloneDeep(require('./config').default); | ||
} | ||
this.setAttrsToStr(); | ||
} | ||
|
||
private initVueParse () { | ||
const fileStr:string = fsExtra.readFileSync(path.join(__dirname, '..', 'src/index.vue'), 'utf8'); | ||
this.vueParse = new VueParse(this.uuid, fileStr); | ||
} | ||
|
||
public insertEditText (params) { | ||
this.config.model.custom.label = params.value; | ||
} | ||
|
||
|
||
public fragment () { | ||
|
||
const type = this.storage.get('preview_view_status') || 0; | ||
let divider = ''; | ||
if (type === 0) { | ||
divider = ` | ||
<div> | ||
<el-button :plain="true" @click="open">打开消息提示</el-button> | ||
<el-button :plain="true" @click="openVn">VNode</el-button> | ||
<div>` | ||
} else { | ||
divider = ` | ||
<div> | ||
<el-button :plain="true" @click="open">打开消息提示</el-button> | ||
<el-button :plain="true" @click="openVn">VNode</el-button> | ||
<div> | ||
`; | ||
} | ||
return divider; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<div> | ||
<el-button :plain="true" @click="open">打开消息提示</el-button> | ||
<el-button :plain="true" @click="openVn">VNode</el-button> | ||
<div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
methods: { | ||
open() { | ||
this.$message('这是一条消息提示'); | ||
}, | ||
openVn() { | ||
const h = this.$createElement; | ||
this.$message({ | ||
message: h('p', null, [ | ||
h('span', null, '内容可以是 '), | ||
h('i', { style: 'color: teal' }, 'VNode') | ||
]) | ||
}); | ||
} | ||
} | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compileOnSave": true, | ||
"compilerOptions": { | ||
"target": "ES2017", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"resolveJsonModule": true, | ||
"inlineSourceMap":true, | ||
"noImplicitThis": true, | ||
"stripInternal": true, | ||
"pretty": true, | ||
"outDir": "dist", | ||
"lib": ["es2017", "dom"] | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
Oops, something went wrong.