1
0
mirror of synced 2025-12-08 01:57:56 +08:00

Compare commits

...

4 Commits

Author SHA1 Message Date
roymondchen
3b647794d0 v1.0.0-rc.1 2022-05-18 17:47:06 +08:00
roymondchen
c35f51a7dc build(utils): 构建产物不将依赖打入 2022-05-18 17:36:00 +08:00
roymondchen
7b3130d81f feat(editor): 属性表单大小配置;记住编辑器分栏宽度 2022-05-18 17:29:36 +08:00
roymondchen
805ac6c90e refactor(form): select 暴露getOptions方法 2022-05-18 16:57:59 +08:00
31 changed files with 105 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"npmClient": "npm",
"packages": [
"packages/*",

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/core",
"sideEffects": [
"dist/*"
@@ -33,7 +33,7 @@
"vue"
],
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"events": "^3.3.0"
},
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@tmagic/editor",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/editor",
"sideEffects": [
"dist/*",
@@ -44,11 +44,11 @@
],
"dependencies": {
"@element-plus/icons": "0.0.11",
"@tmagic/core": "^1.0.0-beta.16",
"@tmagic/form": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/stage": "^1.0.0-beta.16",
"@tmagic/utils": "^1.0.0-beta.16",
"@tmagic/core": "^1.0.0-rc.1",
"@tmagic/form": "^1.0.0-rc.1",
"@tmagic/schema": "^1.0.0-rc.1",
"@tmagic/stage": "^1.0.0-rc.1",
"@tmagic/utils": "^1.0.0-rc.1",
"buffer": "^6.0.3",
"color": "^3.1.3",
"element-plus": "^2.2.0",

View File

@@ -1,9 +1,9 @@
<template>
<m-form
class="m-editor-props-panel"
:class="`m-editor-props-panel ${propsPanelSize}`"
popper-class="m-editor-props-panel-popper"
ref="configForm"
size="small"
:size="propsPanelSize"
:init-values="values"
:config="curFormConfig"
@change="submit"
@@ -55,6 +55,7 @@ export default defineComponent({
values,
configForm,
curFormConfig,
propsPanelSize: computed(() => services?.uiService.get('propsPanelSize') || 'small'),
async submit() {
try {

View File

@@ -28,6 +28,14 @@ import BaseService from './BaseService';
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
const COLUMN_WIDTH_STORAGE_KEY = '$MagicEditorColumnWidthData';
const defaultColumnWidth = {
left: DEFAULT_LEFT_COLUMN_WIDTH,
center: globalThis.document.body.clientWidth - DEFAULT_LEFT_COLUMN_WIDTH - DEFAULT_RIGHT_COLUMN_WIDTH,
right: DEFAULT_RIGHT_COLUMN_WIDTH,
};
const state = reactive<UiState>({
uiSelectMode: false,
showSrc: false,
@@ -40,13 +48,10 @@ const state = reactive<UiState>({
width: 375,
height: 817,
},
columnWidth: {
left: DEFAULT_LEFT_COLUMN_WIDTH,
center: globalThis.document.body.clientWidth - DEFAULT_LEFT_COLUMN_WIDTH - DEFAULT_RIGHT_COLUMN_WIDTH,
right: DEFAULT_RIGHT_COLUMN_WIDTH,
},
columnWidth: defaultColumnWidth,
showGuides: true,
showRule: true,
propsPanelSize: 'small',
});
class Ui extends BaseService {
@@ -57,6 +62,16 @@ class Ui extends BaseService {
center: 'auto',
});
});
const columnWidthCacheData = globalThis.localStorage.getItem(COLUMN_WIDTH_STORAGE_KEY);
if (columnWidthCacheData) {
try {
const columnWidthCache = JSON.parse(columnWidthCacheData);
this.setColumnWidth(columnWidthCache);
} catch (e) {
console.error(e);
}
}
}
public set<T = any>(name: keyof UiState, value: T) {
@@ -112,10 +127,17 @@ class Ui extends BaseService {
if (!center || center === 'auto') {
const bodyWidth = globalThis.document.body.clientWidth;
columnWidth.center = bodyWidth - (columnWidth?.left || 0) - (columnWidth?.right || 0);
if (columnWidth.center <= 0) {
columnWidth.left = defaultColumnWidth.left;
columnWidth.center = defaultColumnWidth.center;
columnWidth.right = defaultColumnWidth.right;
}
} else {
columnWidth.center = center;
}
globalThis.localStorage.setItem(COLUMN_WIDTH_STORAGE_KEY, JSON.stringify(columnWidth));
state.columnWidth = columnWidth;
}

View File

@@ -1,18 +1,20 @@
.m-editor-props-panel {
padding: 0 10px;
.el-form-item__label {
font-size: 12px;
}
.m-fieldset {
legend {
&.small {
.el-form-item__label {
font-size: 12px;
}
}
.el-tabs__item {
font-size: 12px;
.m-fieldset {
legend {
font-size: 12px;
}
}
.el-tabs__item {
font-size: 12px;
}
}
.el-input__wrapper {

View File

@@ -99,6 +99,8 @@ export interface UiState {
showGuides: boolean;
/** 是否显示标尺true: 显示false: 不显示默认为true */
showRule: boolean;
/** 用于控制该属性配置表单内组件的尺寸 */
propsPanelSize: 'large' | 'default' | 'small';
}
export interface EditorNodeInfo {

View File

@@ -1,6 +1,6 @@
{
"name": "@tmagic/form",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/form",
"sideEffects": [
"dist/*",
@@ -35,7 +35,7 @@
},
"dependencies": {
"@element-plus/icons": "0.0.11",
"@tmagic/utils": "^1.0.0-beta.16",
"@tmagic/utils": "^1.0.0-rc.1",
"element-plus": "^2.2.0",
"lodash-es": "^4.17.21",
"moment": "^2.29.2",

View File

@@ -345,6 +345,8 @@ export default defineComponent({
moreLoadingVisible,
popperClass: mForm?.popperClass,
getOptions,
getRequestFuc() {
return getConfig('request');
},
@@ -366,11 +368,6 @@ export default defineComponent({
}
},
async editAfterAction() {
pgIndex.value = 0;
options.value = await getOptions();
},
async remoteMethod(q: string) {
if (!localOptions.value.length) {
query.value = q;

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/schema",
"sideEffects": false,
"main": "dist/tmagic-schema.umd.js",

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/stage",
"sideEffects": [
"dist/*"
@@ -27,8 +27,8 @@
},
"dependencies": {
"@scena/guides": "^0.17.0",
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/utils": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"@tmagic/utils": "^1.0.0-rc.1",
"events": "^3.3.0",
"lodash-es": "^4.17.21",
"moveable": "^0.29.4",

View File

@@ -1,6 +1,6 @@
{
"name": "@tmagic/table",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/table",
"sideEffects": [
"dist/*"
@@ -30,7 +30,7 @@
"url": "https://github.com/Tencent/tmagic-editor.git"
},
"dependencies": {
"@tmagic/form": "^1.0.0-beta.16",
"@tmagic/form": "^1.0.0-rc.1",
"element-plus": "^2.2.0",
"lodash-es": "^4.17.21",
"vue": "^3.2.0"

View File

@@ -1,6 +1,6 @@
{
"name": "@tmagic/ui-react",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@tmagic/ui-react",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"main": "src/index.ts",
"engines": {
"node": ">=14"
@@ -13,7 +13,7 @@
"react:build": "tsc && vite build"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},

View File

@@ -1,6 +1,6 @@
{
"name": "@tmagic/ui-vue2",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/ui-vue2",
"main": "src/index.ts",
"scripts": {

View File

@@ -1,6 +1,6 @@
{
"name": "@tmagic/ui",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/ui",
"main": "src/index.ts",
"engines": {
@@ -11,7 +11,7 @@
"url": "https://github.com/Tencent/tmagic-editor.git"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"delegate": "^3.2.0",
"tiny-emitter": "^2.1.0",
"vue": "^3.2.0"

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"name": "@tmagic/utils",
"main": "dist/tmagic-utils.umd.js",
"module": "dist/tmagic-utils.es.js",
@@ -24,7 +24,7 @@
"url": "https://github.com/Tencent/tmagic-editor.git"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"moment": "^2.29.2"
},
"devDependencies": {

View File

@@ -19,6 +19,10 @@
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import pkg from './package.json';
const deps = Object.keys(pkg.dependencies);
export default defineConfig({
plugins: [
dts({
@@ -41,5 +45,12 @@ export default defineConfig({
name: 'TMagicUtils',
fileName: 'tmagic-utils',
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external(id: string) {
return deps.some((k) => new RegExp(`^${k}`).test(id));
},
},
},
});

View File

@@ -1,6 +1,6 @@
{
"name": "tmagic-playground",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "tmagic-playground",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"private": true,
"scripts": {
"dev": "vite",
@@ -9,11 +9,11 @@
},
"dependencies": {
"@element-plus/icons": "0.0.11",
"@tmagic/editor": "^1.0.0-beta.16",
"@tmagic/form": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/stage": "^1.0.0-beta.16",
"@tmagic/utils": "^1.0.0-beta.16",
"@tmagic/editor": "^1.0.0-rc.1",
"@tmagic/form": "^1.0.0-rc.1",
"@tmagic/schema": "^1.0.0-rc.1",
"@tmagic/stage": "^1.0.0-rc.1",
"@tmagic/utils": "^1.0.0-rc.1",
"element-plus": "^2.2.0",
"serialize-javascript": "^6.0.0",
"vue": "^3.2.0",

View File

@@ -1,6 +1,6 @@
{
"name": "runtime-react",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "runtime-react",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"private": true,
"scripts": {
"dev": "npm run build && npm run serve",
@@ -9,8 +9,8 @@
"serve": "vite preview --port 8076"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/stage": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"@tmagic/stage": "^1.0.0-rc.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},

View File

@@ -1,6 +1,6 @@
{
"name": "runtime-vue2",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "runtime-vue2",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"private": true,
"scripts": {
"dev": "npm run build && npm run serve",
@@ -9,8 +9,8 @@
"serve": "vite preview --port 8077"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/stage": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"@tmagic/stage": "^1.0.0-rc.1",
"@vue/composition-api": "1.0.5",
"vue": "^2.6.14"
},

View File

@@ -1,6 +1,6 @@
{
"name": "runtime-vue3",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "runtime-vue3",
"version": "1.0.0-beta.16",
"version": "1.0.0-rc.1",
"private": true,
"scripts": {
"dev": "npm run build && npm run serve",
@@ -9,8 +9,8 @@
"serve": "vite preview --port 8078"
},
"dependencies": {
"@tmagic/schema": "^1.0.0-beta.16",
"@tmagic/stage": "^1.0.0-beta.16",
"@tmagic/schema": "^1.0.0-rc.1",
"@tmagic/stage": "^1.0.0-rc.1",
"axios": "^0.25.0",
"vue": "^3.2.0"
},