Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: page material developer #455

Merged
merged 23 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion extensions/iceworks-app/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@
"extension.iceworksApp.showDepsQuickPick.quickPickItem.detail": "Install <%= label %>",
"extension.iceworksApp.openEntryFile.ErrorMessage": "Cannot find entry",
"extension.iceworksApp.extension.title": "Iceworks Settings",
"extension.iceworksApp.extension.emptyWorkplace": "Current workspace is empty, please open or create an application."
"extension.iceworksApp.extension.emptyWorkplace": "Current workspace is empty, please open or create an application.",
"extension.iceworksApp.views.pageViews.createPage": "Create Page",
"extension.iceworksApp.views.pageViews.createPageDetail": "Create page through page templates",
"extension.iceworksApp.views.pageViews.generatePage": "Generate Page",
"extension.iceworksApp.views.pageViews.generatePageDetail": "Generate page through assmebling component materials"
}
5 changes: 4 additions & 1 deletion extensions/iceworks-app/src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
"extension.iceworksApp.showDepsQuickPick.quickPickItem.detail": "安装 <%= label %>",
"extension.iceworksApp.openEntryFile.ErrorMessage": "没有找到入口",
"extension.iceworksApp.extension.title": "设置 - Iceworks",
"extension.iceworksApp.extension.emptyWorkplace": "当前工作区为空,请打开应用或新建应用。"
"extension.iceworksApp.views.pageViews.createPage": "创建页面",
"extension.iceworksApp.views.pageViews.createPageDetail": "通过配置模板的方式创建页面",
"extension.iceworksApp.views.pageViews.generatePage": "生成页面",
"extension.iceworksApp.views.pageViews.generatePageDetail": "通过区块组装的方式生成页面"
}
26 changes: 25 additions & 1 deletion extensions/iceworks-app/src/views/pagesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as path from 'path';
import { checkPathExists, registerCommand } from '@iceworks/common-service';
import { pagesPath, projectPath } from '@iceworks/project-service';
import openEntryFile from '../openEntryFile';
import i18n from '../i18n';

export class PagesProvider implements vscode.TreeDataProvider<PageTreeItem> {
private workspaceRoot: string;
Expand Down Expand Up @@ -85,13 +86,36 @@ class PageTreeItem extends vscode.TreeItem {
contextValue = 'page';
}

const addPageQuickPickItems: any[] = [
{
label: i18n.format('extension.iceworksApp.views.pageViews.createPage'),
detail: i18n.format('extension.iceworksApp.views.pageViews.createPageDetail'),
command: 'iceworks-ui-builder.create-page',
},
{
label: i18n.format('extension.iceworksApp.views.pageViews.generatePage'),
detail: i18n.format('extension.iceworksApp.views.pageViews.generatePageDetail'),
command: 'iceworks-ui-builder.generate-page',
},
];
function showAddPageQuickPicks() {
const quickPick = vscode.window.createQuickPick();
quickPick.items = addPageQuickPickItems;
quickPick.onDidChangeSelection((change) => {
// @ts-ignore
vscode.commands.executeCommand(change[0].command);
});
quickPick.onDidHide(() => quickPick.dispose());
quickPick.show();
}

export function createPagesTreeView(context: vscode.ExtensionContext) {
const pagesProvider = new PagesProvider(context, projectPath);
const treeView = vscode.window.createTreeView('pages', { treeDataProvider: pagesProvider });

registerCommand('iceworksApp.pages.add', () => {
console.log('iceworksApp: activate iceworks-ui-builder.generate-page');
vscode.commands.executeCommand('iceworks-ui-builder.generate-page');
showAddPageQuickPicks();
});
registerCommand('iceworksApp.pages.refresh', () => pagesProvider.refresh());
registerCommand('iceworksApp.pages.openFile', (pagePath) => openEntryFile(pagePath));
Expand Down
12 changes: 10 additions & 2 deletions extensions/iceworks-ui-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"activationEvents": [
"onCommand:iceworks-ui-builder.generate-page",
"onCommand:iceworks-ui-builder.create-component",
"onCommand:iceworks-ui-builder.generate-component"
"onCommand:iceworks-ui-builder.generate-component",
"onCommand:iceworks-ui-builder.create-page"
],
"repository": {
"type": "git",
Expand All @@ -42,6 +43,10 @@
{
"command": "iceworks-ui-builder.generate-page",
"title": "%iceworksUIBuilder.commands.generatePage.title%"
},
{
"command": "iceworks-ui-builder.create-page",
"title": "%iceworksUIBuilder.commands.createPage.title%"
}
],
"configuration": {
Expand Down Expand Up @@ -107,6 +112,7 @@
"compile": "tsc -p ./tsconfig.json"
},
"devDependencies": {
"@types/lodash": "^4.14.160",
"@types/node": "^13.11.0",
"@types/vscode": "^1.41.0",
"ts-loader": "^7.0.5",
Expand All @@ -120,9 +126,11 @@
"@iceworks/i18n": "^0.1.0",
"@iceworks/material-service": "^0.1.3",
"@iceworks/page-service": "^0.1.5",
"@iceworls/template-service": "^0.1.0",
"@iceworks/project-service": "^0.1.4",
"@iceworks/recorder": "^0.1.0",
"@iceworks/vscode-webview": "^0.1.1"
"@iceworks/vscode-webview": "^0.1.1",
"loadash": "^1.0.0"
alvinhui marked this conversation as resolved.
Show resolved Hide resolved
},
"homepage": "https://github.com/ice-lab/iceworks/blob/master/extensions/iceworks-ui-builder/README.md",
"bugs": {
Expand Down
3 changes: 2 additions & 1 deletion extensions/iceworks-ui-builder/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"iceworksUIBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks material sources, decide which materials to use.",
"iceworksUIBuilder.commands.generateComponent.title": "Iceworks: Generate Component",
"iceworksUIBuilder.commands.createComponent.title": "Iceworks: Create Component",
"iceworksUIBuilder.commands.generatePage.title": "Iceworks: Generate Page"
"iceworksUIBuilder.commands.generatePage.title": "Iceworks: Generate Page",
"iceworksUIBuilder.commands.createPage.title": "Iceworks: Create Page"
}
3 changes: 2 additions & 1 deletion extensions/iceworks-ui-builder/package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"iceworksUIBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks 物料源,决定使用哪些物料。",
"iceworksUIBuilder.commands.generateComponent.title": "Iceworks: 生成组件",
"iceworksUIBuilder.commands.createComponent.title": "Iceworks: 创建组件",
"iceworksUIBuilder.commands.generatePage.title": "Iceworks: 生成页面"
"iceworksUIBuilder.commands.generatePage.title": "Iceworks: 生成页面",
"iceworksUIBuilder.commands.createPage.title": "Iceworks: 创建页面"
}
18 changes: 18 additions & 0 deletions extensions/iceworks-ui-builder/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@ export function activate(context: vscode.ExtensionContext) {
activePageGeneraterWebview();
})
);
function activePageCreatorWebview() {
const webviewPanel: vscode.WebviewPanel = window.createWebviewPanel(
'iceworks',
i18n.format('extension.iceworksPageCreator.extensnion.webViewTitle'),
ViewColumn.One,
{
enableScripts: true,
retainContextWhenHidden: true,
}
);
webviewPanel.webview.html = getHtmlForWebview(extensionPath, 'pagecreator', true);
connectService(webviewPanel, context, { services, recorder });
}
subscriptions.push(
registerCommand('iceworks-ui-builder.create-page', function () {
activePageCreatorWebview();
})
);
}

export function deactivate() {}
3 changes: 2 additions & 1 deletion extensions/iceworks-ui-builder/src/locales/en-US.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extension.iceworksComponentGenerator.extension.webviewTitle": "Generate Component - Iceworks",
"extension.iceworksComponentBuilder.extension.webviewTitle": "Create Component - Iceworks",
"extension.iceworksPageBuilder.extensnion.webViewTitle": "Generate Page - Iceworks"
"extension.iceworksPageBuilder.extensnion.webViewTitle": "Generate Page - Iceworks",
"extension.iceworksPageCreator.extensnion.webViewTitle": "Create Page - Iceworks"
}
3 changes: 2 additions & 1 deletion extensions/iceworks-ui-builder/src/locales/zh-CN.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extension.iceworksComponentGenerator.extension.webviewTitle": "生成组件 - Iceworks",
"extension.iceworksComponentBuilder.extension.webviewTitle": "创建组件 - Iceworks",
"extension.iceworksPageBuilder.extensnion.webViewTitle": "生成页面 - Iceworks"
"extension.iceworksPageBuilder.extensnion.webViewTitle": "生成页面 - Iceworks",
"extension.iceworksPageCreator.extensnion.webViewTitle": "创建页面 - Iceworks"
}
3 changes: 2 additions & 1 deletion extensions/iceworks-ui-builder/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as material from '@iceworks/material-service';
import * as common from '@iceworks/common-service';
import * as page from '@iceworks/page-service';
import * as component from '@iceworks/component-service';
import * as template from '@iceworks/template-service';
import * as block from './block';

export default { material, block, common, page, component };
export default { material, block, common, page, component, template };
122 changes: 122 additions & 0 deletions extensions/iceworks-ui-builder/web/mocks/material/getData.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,127 @@
"publishTime": "2019-11-07T09:05:00.572Z",
"updateTime": "2020-04-08T05:28:38.818Z"
}
],
"pages": [
{
"name": "BasicPage",
"title": "BasicPage",
"category": "Basic",
"views": [
{
"title": "",
"props": {},
"screenshot": "build/views/block_view1.png",
"html": "build/views/block_view1.html"
}
],
"screenshot": "https://unpkg.com/@alifd/fusion-advanced-detail/screenshot.png",
"description": "intro block",
"homepage": "https://unpkg.com/@alifd/fusion-advanced-detail@0.1.9/build/index.html",
"categories": ["Information"],
"repository": "https://github.com/alibaba-fusion/materials/tree/master/blocks/AdvancedDetail",
"source": {
"type": "npm",
"npm": "@alifd/fusion-advanced-detail",
"version": "0.1.9",
"registry": "https://registry.npmjs.org"
},
"dependencies": {
"prop-types": "^15.5.8"
},
"screenshots": ["https://unpkg.com/@alifd/fusion-advanced-detail/screenshot.png"],
"publishTime": "2019-11-28T11:30:32.213Z",
"updateTime": "2020-03-31T12:36:39.300Z"
},
{
"name": "AdvancePage",
"title": "AdvancePage",
"category": "Other",
"views": [
{
"title": "",
"props": {},
"screenshot": "build/views/block_view1.png",
"html": "build/views/block_view1.html"
}
],
"screenshot": "https://unpkg.com/@alifd/fusion-basic-detail/screenshot.png",
"description": "intro block",
"homepage": "https://unpkg.com/@alifd/fusion-basic-detail@0.1.7/build/index.html",
"categories": ["Information"],
"repository": "https://github.com/alibaba-fusion/materials/tree/master/blocks/BasicDetail",
"source": {
"type": "npm",
"npm": "@alifd/fusion-basic-detail",
"version": "0.1.7",
"registry": "https://registry.npmjs.org"
},
"dependencies": {
"prop-types": "^15.5.8"
},
"screenshots": ["https://unpkg.com/@alifd/fusion-basic-detail/screenshot.png"],
"publishTime": "2019-11-28T11:38:31.720Z",
"updateTime": "2020-03-31T12:52:50.478Z"
},
{
"name": "BasicDetail",
"title": "BasicDetail",
"category": "Information",
"views": [
{
"title": "",
"props": {},
"screenshot": "build/views/block_view1.png",
"html": "build/views/block_view1.html"
}
],
"screenshot": "https://unpkg.com/@alifd/fusion-basic-detail/screenshot.png",
"description": "intro block",
"homepage": "https://unpkg.com/@alifd/fusion-basic-detail@0.1.7/build/index.html",
"categories": ["Information"],
"repository": "https://github.com/alibaba-fusion/materials/tree/master/blocks/BasicDetail",
"source": {
"type": "npm",
"npm": "@alifd/fusion-basic-detail",
"version": "0.1.7",
"registry": "https://registry.npmjs.org"
},
"dependencies": {
"prop-types": "^15.5.8"
},
"screenshots": ["https://unpkg.com/@alifd/fusion-basic-detail/screenshot.png"],
"publishTime": "2019-11-28T11:38:31.720Z",
"updateTime": "2020-03-31T12:52:50.478Z"
},
{
"name": "BasicDetail",
"title": "BasicDetail",
"category": "Information",
"views": [
{
"title": "",
"props": {},
"screenshot": "build/views/block_view1.png",
"html": "build/views/block_view1.html"
}
],
"screenshot": "https://unpkg.com/@alifd/fusion-basic-detail/screenshot.png",
"description": "intro block",
"homepage": "https://unpkg.com/@alifd/fusion-basic-detail@0.1.7/build/index.html",
"categories": ["Information"],
"repository": "https://github.com/alibaba-fusion/materials/tree/master/blocks/BasicDetail",
"source": {
"type": "npm",
"npm": "@alifd/fusion-basic-detail",
"version": "0.1.7",
"registry": "https://registry.npmjs.org"
},
"dependencies": {
"prop-types": "^15.5.8"
},
"screenshots": ["https://unpkg.com/@alifd/fusion-basic-detail/screenshot.png"],
"publishTime": "2019-11-28T11:38:31.720Z",
"updateTime": "2020-03-31T12:52:50.478Z"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"schema": {
"title": "用户任务列表",
"description": "显示用户信息和用户持有的任务",
"type": "object",
"required": ["isShowUser"],
"properties": {
"isShowUser": {
"type": "boolean",
"title": "是否显示用户信息"
},
"title": {
"type": "string",
"title": "标题"
},
"userTitle": {
"type": "number",
"title": "用户页面标题"
}
}
}
}
9 changes: 7 additions & 2 deletions extensions/iceworks-ui-builder/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
"@types/classnames": "^2.2.10",
"@types/react": "^16.8.0",
"@types/react-dom": "^16.8.0",
"@types/lodash": "^4.14.160",
"build-plugin-css-assets-local": "^0.1.0",
"build-plugin-fusion": "^0.1.3",
"build-plugin-moment-locales": "^0.1.0",
"ice.js": "^1.0.0",
"typescript": "^3.8.3"
},
"dependencies": {
"@alifd/next": "~1.19.2",
"@alifd/next": "^1.20.28",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么升级到了 1.20?

Copy link
Collaborator Author

@sspku-yqLiu sspku-yqLiu Aug 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有刻意升级 应该是 npm run setup 的时候自动变的。
需要回溯到 1.19 吗

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要引入不必要的改动

"@alifd/theme-iceworks-dark": "^1.1.0",
"@formily/next": "^1.3.1",
"@formily/next-components": "^1.3.1",
"@iceworks/material-ui": "^0.1.5",
"@iceworks/vscode-webview": "^0.1.1",
"loadash": "^1.0.0",
"moment": "^2.24.0",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-intl": "^5.3.2",
"react-sortable-hoc": "^1.11.0"
"react-sortable-hoc": "^1.11.0",
"styled-components": "^5.1.1"
},
"scripts": {
"start": "icejs start --disable-reload",
Expand Down
13 changes: 13 additions & 0 deletions extensions/iceworks-ui-builder/web/public/pagecreator.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>Page Creator</title>
</head>

<body>
<div id="ice-container"></div>
</body>
</html>
Loading