update 0.13.1

This commit is contained in:
yehuozhili
2022-04-04 21:09:36 +08:00
parent 3f9e8f09f0
commit cddf4fc0c3
12 changed files with 53 additions and 13 deletions

View File

@@ -155,5 +155,5 @@ MIT
## Todo
重构动画
重构数据源
完善文档

View File

@@ -1,5 +1,5 @@
{
"version": "0.13.0",
"version": "0.13.1",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/dooringx-lib.esm.js",

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-02-25 21:16:58
* @LastEditors: yehuozhili
* @LastEditTime: 2022-01-12 17:26:07
* @LastEditTime: 2022-04-04 20:17:55
* @FilePath: \dooringx\packages\dooringx-lib\src\config\index.tsx
*/
import React from 'react';
@@ -451,9 +451,16 @@ export class UserConfig {
return JSON.parse(json);
}
/**
*
* 重设store并根据store重设
* @param {IStoreData[]} data
* @memberof UserConfig
*/
resetData(data: IStoreData[]) {
this.store.resetToInitData(data, true);
this.toRegist();
this.animateFactory.syncStoreToConfig(this);
}
getWrapperMove() {
@@ -478,6 +485,9 @@ export class UserConfig {
getStoreChanger() {
return this.storeChanger;
}
getAnimateFactory() {
return this.animateFactory;
}
getConfig() {
return this.initConfig;
}

View File

@@ -163,6 +163,26 @@ export class AnimateFactory {
}
}
/**
*
* 将store中的配置写入config
* 注意只在导入新store后使用
* @memberof AnimateFactory
*/
syncStoreToConfig(config: UserConfig) {
const store = config.getStore();
let data: IStoreData;
const isEdit = config.getStoreChanger().isEdit();
if (isEdit) {
const origin = config.getStoreChanger().getOrigin()!;
data = origin.data[origin.current];
} else {
data = store.getData();
}
const dataAnimate = data.globalState?.customAnimate;
this.customAnimateName = [...dataAnimate];
}
/**
*
* 将用户输入转换为新的动画

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-03-14 05:35:15
* @LastEditors: yehuozhili
* @LastEditTime: 2021-07-20 16:18:29
* @LastEditTime: 2022-04-04 20:13:58
* @FilePath: \dooringx\packages\dooringx-lib\src\hooks\index.ts
*/
import { useEffect, useMemo, useState } from 'react';