add nanoid
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
"packages": ["packages/*"],
|
"packages": ["packages/*"],
|
||||||
"version": "0.0.0"
|
"version": "0.0.0",
|
||||||
|
"npmClient": "yarn",
|
||||||
|
"useWorkspaces": true
|
||||||
}
|
}
|
||||||
|
49
packages/dooringx-doc/src/changelog/1.1.md
Normal file
49
packages/dooringx-doc/src/changelog/1.1.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
title: CHANGELOG
|
||||||
|
order: 1
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## 0.3.1
|
||||||
|
|
||||||
|
1、由uuid更换为nanoid。
|
||||||
|
|
||||||
|
2、control组件增加标尺控制。
|
||||||
|
|
||||||
|
## 0.3.0
|
||||||
|
|
||||||
|
1、增加标尺,ContainerWrapper需要传递config才可使用。
|
||||||
|
|
||||||
|
2、修改容器最小拖动667。修复画布缩放下拖拽时与鼠标距离不一致。
|
||||||
|
|
||||||
|
3、innerContainerDragUp需要传递config。
|
||||||
|
|
||||||
|
## 0.2.0
|
||||||
|
|
||||||
|
commander的传递进行修改,可以获得config了,commander不再从index中导出 ,需要使用时从config中获取。增加左侧类名,方便自定义。
|
||||||
|
|
||||||
|
## 0.1.10
|
||||||
|
|
||||||
|
修改eslint依赖推荐
|
||||||
|
|
||||||
|
|
||||||
|
## 0.1.9
|
||||||
|
|
||||||
|
增加全局body设置
|
||||||
|
|
||||||
|
## 0.1.8
|
||||||
|
|
||||||
|
增加弹窗设置,移除modalContainer
|
||||||
|
|
||||||
|
## 0.1.7
|
||||||
|
|
||||||
|
修改预览特殊条件显示,删除console
|
||||||
|
## 0.1.6
|
||||||
|
|
||||||
|
调整初始缩放,画布初始比例,增加回正画布功能。
|
||||||
|
## 0.1.5
|
||||||
|
|
||||||
|
删除未作按钮,增加fixed配置
|
||||||
|
## 0.1.4
|
||||||
|
|
||||||
|
基础功能
|
@@ -14,6 +14,7 @@
|
|||||||
const home = base + '/';
|
const home = base + '/';
|
||||||
const docs = base + '/docs';
|
const docs = base + '/docs';
|
||||||
const api = base + '/api';
|
const api = base + '/api';
|
||||||
|
const changelog = base +'/changelog'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
@@ -32,6 +33,9 @@
|
|||||||
<div class:active={$page.path === '/api'}>
|
<div class:active={$page.path === '/api'}>
|
||||||
<Button href={api} color={$page.path === '/api' ? '#4569d4' : '#4d5164'}>API</Button>
|
<Button href={api} color={$page.path === '/api' ? '#4569d4' : '#4d5164'}>API</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class:active={$page.path === '/changelog'}>
|
||||||
|
<Button href={changelog} color={$page.path === '/changelog' ? '#4569d4' : '#4d5164'}>更新</Button>
|
||||||
|
</div>
|
||||||
<div class:active={$page.path === '/about'}>
|
<div class:active={$page.path === '/about'}>
|
||||||
<Button>Github</Button>
|
<Button>Github</Button>
|
||||||
</div>
|
</div>
|
||||||
|
18
packages/dooringx-doc/src/routes/changelog/index.json.ts
Normal file
18
packages/dooringx-doc/src/routes/changelog/index.json.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* @Author: yehuozhili
|
||||||
|
* @Date: 2021-07-13 11:11:17
|
||||||
|
* @LastEditors: yehuozhili
|
||||||
|
* @LastEditTime: 2021-07-13 11:11:42
|
||||||
|
* @FilePath: \dooringx\packages\dooringx-doc\src\routes\changelog\index.json.ts
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 必须建立json否则不生成json文件
|
||||||
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
|
import { api } from '../docs/_api';
|
||||||
|
|
||||||
|
export const get: RequestHandler = async (request) => {
|
||||||
|
const param = request.query;
|
||||||
|
const name = param.get('name');
|
||||||
|
const response = await api(name);
|
||||||
|
return response;
|
||||||
|
};
|
64
packages/dooringx-doc/src/routes/changelog/index.svelte
Normal file
64
packages/dooringx-doc/src/routes/changelog/index.svelte
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<script context="module" lang="ts">
|
||||||
|
import type { Load } from '@sveltejs/kit';
|
||||||
|
import type { MarkDownItemProps } from '../docs/_api';
|
||||||
|
import { base } from '$app/paths';
|
||||||
|
export const load: Load = async ({ fetch }) => {
|
||||||
|
const path = `${base}/api.json?name=changelog`;
|
||||||
|
const res = await fetch(path);
|
||||||
|
if (res.ok) {
|
||||||
|
const files: MarkDownItemProps[] = await res.json();
|
||||||
|
return {
|
||||||
|
props: { files: files }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const { message } = await res.json();
|
||||||
|
|
||||||
|
return {
|
||||||
|
error: new Error(message)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import DocRender from '$lib/DocRender/index.svelte';
|
||||||
|
import { getContext } from 'svelte';
|
||||||
|
import type { Writable } from 'svelte/store';
|
||||||
|
export let files: MarkDownItemProps[];
|
||||||
|
const lang = getContext<Writable<string>>('lang');
|
||||||
|
let sections = new Map<string, MarkDownItemProps[]>();
|
||||||
|
lang.subscribe((la) => {
|
||||||
|
sections = new Map<string, MarkDownItemProps[]>();
|
||||||
|
let tmp = files.filter((v) => {
|
||||||
|
const name = v.file;
|
||||||
|
const sp = name.split('.');
|
||||||
|
if (Array.isArray(sp) && sp.length > 1 && sp[sp.length - 2] === 'EN') {
|
||||||
|
return la === 'en';
|
||||||
|
} else {
|
||||||
|
return la === 'cn';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tmp.forEach((v) => {
|
||||||
|
const stitle = v.sTitle || 'default';
|
||||||
|
const value = sections.get(stitle);
|
||||||
|
if (value) {
|
||||||
|
value.push(v);
|
||||||
|
} else {
|
||||||
|
sections.set(stitle, [v]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let active = '';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>API Docs • Svelte</title>
|
||||||
|
<meta name="twitter:title" content="Svelte API docs" />
|
||||||
|
<meta name="twitter:description" content="Cybernetically enhanced web apps" />
|
||||||
|
<meta name="Description" content="Cybernetically enhanced web apps" />
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<DocRender {active} {sections} />
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
</style>
|
@@ -2,7 +2,7 @@
|
|||||||
* @Author: yehuozhili
|
* @Author: yehuozhili
|
||||||
* @Date: 2021-07-07 14:46:01
|
* @Date: 2021-07-07 14:46:01
|
||||||
* @LastEditors: yehuozhili
|
* @LastEditors: yehuozhili
|
||||||
* @LastEditTime: 2021-07-10 18:33:35
|
* @LastEditTime: 2021-07-13 10:17:28
|
||||||
* @FilePath: \dooringx\packages\dooringx-example\src\plugin\formComponents\actionButton.tsx
|
* @FilePath: \dooringx\packages\dooringx-example\src\plugin\formComponents\actionButton.tsx
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -381,6 +381,7 @@ function ActionButton(props: ActionButtonProps) {
|
|||||||
<Col span={6}>选择函数:</Col>
|
<Col span={6}>选择函数:</Col>
|
||||||
<Col span={14}>
|
<Col span={14}>
|
||||||
<Select
|
<Select
|
||||||
|
showSearch
|
||||||
value={current?.value || ''}
|
value={current?.value || ''}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
optionFilterProp="children"
|
optionFilterProp="children"
|
||||||
|
@@ -2,13 +2,17 @@
|
|||||||
* @Author: yehuozhili
|
* @Author: yehuozhili
|
||||||
* @Date: 2021-01-31 20:44:16
|
* @Date: 2021-01-31 20:44:16
|
||||||
* @LastEditors: yehuozhili
|
* @LastEditors: yehuozhili
|
||||||
* @LastEditTime: 2021-07-12 21:00:48
|
* @LastEditTime: 2021-07-13 11:10:00
|
||||||
* @FilePath: \dooringx\packages\dooringx-lib\README.md
|
* @FilePath: \dooringx\packages\dooringx-lib\README.md
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## Dooringx-lib
|
## Dooringx-lib
|
||||||
## changelog
|
## changelog
|
||||||
|
|
||||||
|
- 0.3.1
|
||||||
|
1、由uuid更换为nanoid。
|
||||||
|
2、control组件增加标尺控制。
|
||||||
|
|
||||||
- 0.3.0
|
- 0.3.0
|
||||||
1、增加标尺,ContainerWrapper需要传递config才可使用。
|
1、增加标尺,ContainerWrapper需要传递config才可使用。
|
||||||
2、修改容器最小拖动667。修复画布缩放下拖拽时与鼠标距离不一致。
|
2、修改容器最小拖动667。修复画布缩放下拖拽时与鼠标距离不一致。
|
||||||
@@ -26,5 +30,4 @@
|
|||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
|
||||||
1、制作标尺
|
1、重构拖拽,优化性能与config传递。
|
||||||
2、重构拖拽,优化性能与config传递。
|
|
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
@@ -17,32 +17,33 @@
|
|||||||
"prepare": "tsdx build"
|
"prepare": "tsdx build"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">=16.8",
|
"animate.css": ">=4",
|
||||||
"antd": ">=4",
|
"antd": ">=4",
|
||||||
"animate.css": ">=4"
|
"react": ">=16.8"
|
||||||
},
|
},
|
||||||
"name": "dooringx-lib",
|
"name": "dooringx-lib",
|
||||||
"author": "yehuozhili",
|
"author": "yehuozhili",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ant-design/icons": "^4.6.2",
|
"@ant-design/icons": "^4.6.2",
|
||||||
|
"@types/react": "^17.0.0",
|
||||||
|
"@types/react-color": "^3.0.4",
|
||||||
|
"@types/react-dom": "^17.0.0",
|
||||||
|
"@types/uuid": "^8.3.0",
|
||||||
"antd": "^4.15.2",
|
"antd": "^4.15.2",
|
||||||
"postcss-modules": "^4.0.0",
|
|
||||||
"babel-plugin-import": "^1.13.3",
|
"babel-plugin-import": "^1.13.3",
|
||||||
"babel-plugin-import-v2": "^1.0.0",
|
"babel-plugin-import-v2": "^1.0.0",
|
||||||
"@types/react-color": "^3.0.4",
|
"less": "^4.1.1",
|
||||||
"@types/react": "^17.0.0",
|
"postcss": "^8.2.8",
|
||||||
"@types/react-dom": "^17.0.0",
|
"postcss-modules": "^4.0.0",
|
||||||
"size-limit": "^4.10.1",
|
|
||||||
"tsdx": "^0.14.1",
|
|
||||||
"react": "17.x",
|
"react": "17.x",
|
||||||
"react-dom": "17.x",
|
"react-dom": "17.x",
|
||||||
"postcss": "^8.2.8",
|
|
||||||
"less": "^4.1.1",
|
|
||||||
"rollup-plugin-postcss": "^4.0.0",
|
"rollup-plugin-postcss": "^4.0.0",
|
||||||
"@types/uuid": "^8.3.0"
|
"size-limit": "^4.10.1",
|
||||||
|
"tsdx": "^0.14.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"deepcopy": "^2.1.0",
|
"deepcopy": "^2.1.0",
|
||||||
|
"nanoid": "^3.1.23",
|
||||||
"react-color": "^2.19.3",
|
"react-color": "^2.19.3",
|
||||||
"react-sortable-hoc": "^2.0.0",
|
"react-sortable-hoc": "^2.0.0",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
|
@@ -4,6 +4,7 @@ import {
|
|||||||
FullscreenExitOutlined,
|
FullscreenExitOutlined,
|
||||||
FullscreenOutlined,
|
FullscreenOutlined,
|
||||||
GatewayOutlined,
|
GatewayOutlined,
|
||||||
|
LayoutOutlined,
|
||||||
MenuOutlined,
|
MenuOutlined,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
UnorderedListOutlined,
|
UnorderedListOutlined,
|
||||||
@@ -13,7 +14,6 @@ import React, { CSSProperties, PropsWithChildren, useState } from 'react';
|
|||||||
import { UserConfig } from '..';
|
import { UserConfig } from '..';
|
||||||
import { IBlockType, IStoreData } from '../core/store/storetype';
|
import { IBlockType, IStoreData } from '../core/store/storetype';
|
||||||
import { deepCopy, arrayMove, changeItem, changeLayer, focusEle } from '../core/utils';
|
import { deepCopy, arrayMove, changeItem, changeLayer, focusEle } from '../core/utils';
|
||||||
|
|
||||||
import { SortEnd, SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
import { SortEnd, SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
||||||
import { wrapperMoveState } from './wrapperMove/event';
|
import { wrapperMoveState } from './wrapperMove/event';
|
||||||
export interface ControlProps {
|
export interface ControlProps {
|
||||||
@@ -151,8 +151,13 @@ export function Control(props: PropsWithChildren<ControlProps>) {
|
|||||||
<Popover style={{ minWidth: '208px' }} content={content} trigger="click">
|
<Popover style={{ minWidth: '208px' }} content={content} trigger="click">
|
||||||
<Button icon={<UnorderedListOutlined />}></Button>
|
<Button icon={<UnorderedListOutlined />}></Button>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
<Button
|
||||||
{/* <Button icon={<FolderOpenOutlined />}></Button> */}
|
icon={<LayoutOutlined />}
|
||||||
|
onClick={() => {
|
||||||
|
props.config.ticker = !props.config.ticker;
|
||||||
|
props.config.getStore().forceUpdate();
|
||||||
|
}}
|
||||||
|
></Button>
|
||||||
<Popover
|
<Popover
|
||||||
placement="left"
|
placement="left"
|
||||||
content={
|
content={
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* @Author: yehuozhili
|
* @Author: yehuozhili
|
||||||
* @Date: 2021-03-14 04:29:09
|
* @Date: 2021-03-14 04:29:09
|
||||||
* @LastEditors: yehuozhili
|
* @LastEditors: yehuozhili
|
||||||
* @LastEditTime: 2021-07-12 19:47:39
|
* @LastEditTime: 2021-07-13 10:49:33
|
||||||
* @FilePath: \dooringx\packages\dooringx-lib\src\components\wrapperMove\index.tsx
|
* @FilePath: \dooringx\packages\dooringx-lib\src\components\wrapperMove\index.tsx
|
||||||
*/
|
*/
|
||||||
import { AllHTMLAttributes, CSSProperties, PropsWithChildren, useRef } from 'react';
|
import { AllHTMLAttributes, CSSProperties, PropsWithChildren, useRef } from 'react';
|
||||||
@@ -21,6 +21,7 @@ export interface ContainerWrapperProps extends AllHTMLAttributes<HTMLDivElement>
|
|||||||
function ContainerWrapper(props: PropsWithChildren<ContainerWrapperProps>) {
|
function ContainerWrapper(props: PropsWithChildren<ContainerWrapperProps>) {
|
||||||
const { children, style, classNames, ...rest } = props;
|
const { children, style, classNames, ...rest } = props;
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
const ticker = props.config.ticker;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`ant-menu ${classNames ? classNames : ''}`}
|
className={`ant-menu ${classNames ? classNames : ''}`}
|
||||||
@@ -41,7 +42,7 @@ function ContainerWrapper(props: PropsWithChildren<ContainerWrapperProps>) {
|
|||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<Ticker config={props.config}></Ticker>
|
{ticker && <Ticker config={props.config}></Ticker>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* @Author: yehuozhili
|
* @Author: yehuozhili
|
||||||
* @Date: 2021-02-25 21:16:58
|
* @Date: 2021-02-25 21:16:58
|
||||||
* @LastEditors: yehuozhili
|
* @LastEditors: yehuozhili
|
||||||
* @LastEditTime: 2021-07-12 16:49:46
|
* @LastEditTime: 2021-07-13 10:48:14
|
||||||
* @FilePath: \dooringx\packages\dooringx-lib\src\config\index.tsx
|
* @FilePath: \dooringx\packages\dooringx-lib\src\config\index.tsx
|
||||||
*/
|
*/
|
||||||
import { IBlockType, IStoreData } from '../core/store/storetype';
|
import { IBlockType, IStoreData } from '../core/store/storetype';
|
||||||
@@ -322,6 +322,7 @@ export class UserConfig {
|
|||||||
public dataCenter: DataCenter;
|
public dataCenter: DataCenter;
|
||||||
public scaleState = scaleState;
|
public scaleState = scaleState;
|
||||||
public collapsed = false;
|
public collapsed = false;
|
||||||
|
public ticker = true;
|
||||||
constructor(initConfig?: Partial<InitConfig>) {
|
constructor(initConfig?: Partial<InitConfig>) {
|
||||||
const mergeConfig = userConfigMerge(defaultConfig, initConfig);
|
const mergeConfig = userConfigMerge(defaultConfig, initConfig);
|
||||||
this.initConfig = mergeConfig;
|
this.initConfig = mergeConfig;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
import { RGBColor } from 'react-color';
|
import { RGBColor } from 'react-color';
|
||||||
import * as uuid from 'uuid';
|
import { nanoid } from 'nanoid';
|
||||||
import Store from '../store';
|
import Store from '../store';
|
||||||
import { IBlockType, IStoreData } from '../store/storetype';
|
import { IBlockType, IStoreData } from '../store/storetype';
|
||||||
import { specialCoList } from './special';
|
import { specialCoList } from './special';
|
||||||
@@ -31,9 +31,9 @@ export function rgba2Obj(rgba = '') {
|
|||||||
|
|
||||||
export function createUid(name?: string) {
|
export function createUid(name?: string) {
|
||||||
if (name) {
|
if (name) {
|
||||||
return name + '-' + uuid.v4();
|
return name + '-' + nanoid();
|
||||||
} else {
|
} else {
|
||||||
return uuid.v4();
|
return nanoid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user