refactor: 删除 editor-setters

This commit is contained in:
力皓 2020-12-04 20:58:47 +08:00
parent ea6bc7aeb8
commit f14b871b0d
22 changed files with 0 additions and 4130 deletions

View File

@ -1,856 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="0.13.1-29"></a>
## [0.13.1-29](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-28...v0.13.1-29) (2020-12-03)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-28"></a>
## [0.13.1-28](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-27...v0.13.1-28) (2020-12-03)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-27"></a>
## [0.13.1-27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-26...v0.13.1-27) (2020-12-02)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-26"></a>
## [0.13.1-26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-25...v0.13.1-26) (2020-12-02)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-25"></a>
## [0.13.1-25](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-24...v0.13.1-25) (2020-12-01)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-24"></a>
## [0.13.1-24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-23...v0.13.1-24) (2020-11-26)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-23"></a>
## [0.13.1-23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-22...v0.13.1-23) (2020-11-25)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-22"></a>
## [0.13.1-22](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-19...v0.13.1-22) (2020-11-25)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-19"></a>
## [0.13.1-19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-18...v0.13.1-19) (2020-11-24)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-18"></a>
## [0.13.1-18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-15...v0.13.1-18) (2020-11-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-15"></a>
## [0.13.1-15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-11...v0.13.1-15) (2020-11-18)
<a name="0.12.1-19"></a>
## [0.12.1-19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-18...v0.12.1-19) (2020-10-17)
<a name="0.12.1-18"></a>
## [0.12.1-18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-17...v0.12.1-18) (2020-10-17)
<a name="0.12.1-17"></a>
## [0.12.1-17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-16...v0.12.1-17) (2020-10-14)
<a name="0.12.1-16"></a>
## [0.12.1-16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-15...v0.12.1-16) (2020-10-12)
<a name="0.12.1-15"></a>
## [0.12.1-15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-1...v0.12.1-15) (2020-10-12)
### Features
* 使用 release/1.0.0 的 editor-setters ([80d74d6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/80d74d6))
<a name="0.12.1-14"></a>
## [0.12.1-14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-13...v0.12.1-14) (2020-10-10)
<a name="0.12.1-13"></a>
## [0.12.1-13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-12...v0.12.1-13) (2020-09-28)
<a name="0.12.1-12"></a>
## [0.12.1-12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-11...v0.12.1-12) (2020-09-28)
<a name="0.12.1-11"></a>
## [0.12.1-11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-10...v0.12.1-11) (2020-09-27)
<a name="0.12.1-10"></a>
## [0.12.1-10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-9...v0.12.1-10) (2020-09-27)
<a name="0.12.1-9"></a>
## [0.12.1-9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-8...v0.12.1-9) (2020-09-27)
<a name="0.12.1-8"></a>
## [0.12.1-8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-7...v0.12.1-8) (2020-09-27)
<a name="0.12.1-7"></a>
## [0.12.1-7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-2...v0.12.1-7) (2020-09-27)
<a name="0.13.1-12"></a>
## [0.13.1-12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-11...v0.13.1-12) (2020-11-18)
<a name="0.12.1-19"></a>
## [0.12.1-19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-18...v0.12.1-19) (2020-10-17)
<a name="0.12.1-18"></a>
## [0.12.1-18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-17...v0.12.1-18) (2020-10-17)
<a name="0.12.1-17"></a>
## [0.12.1-17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-16...v0.12.1-17) (2020-10-14)
<a name="0.12.1-16"></a>
## [0.12.1-16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-15...v0.12.1-16) (2020-10-12)
<a name="0.12.1-15"></a>
## [0.12.1-15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-1...v0.12.1-15) (2020-10-12)
### Features
* 使用 release/1.0.0 的 editor-setters ([80d74d6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/80d74d6))
<a name="0.12.1-14"></a>
## [0.12.1-14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-13...v0.12.1-14) (2020-10-10)
<a name="0.12.1-13"></a>
## [0.12.1-13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-12...v0.12.1-13) (2020-09-28)
<a name="0.12.1-12"></a>
## [0.12.1-12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-11...v0.12.1-12) (2020-09-28)
<a name="0.12.1-11"></a>
## [0.12.1-11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-10...v0.12.1-11) (2020-09-27)
<a name="0.12.1-10"></a>
## [0.12.1-10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-9...v0.12.1-10) (2020-09-27)
<a name="0.12.1-9"></a>
## [0.12.1-9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-8...v0.12.1-9) (2020-09-27)
<a name="0.12.1-8"></a>
## [0.12.1-8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-7...v0.12.1-8) (2020-09-27)
<a name="0.12.1-7"></a>
## [0.12.1-7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-2...v0.12.1-7) (2020-09-27)
<a name="0.13.1-11"></a>
## [0.13.1-11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-10...v0.13.1-11) (2020-11-02)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-10"></a>
## [0.13.1-10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-9...v0.13.1-10) (2020-10-26)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-9"></a>
## [0.13.1-9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-7...v0.13.1-9) (2020-10-26)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-8"></a>
## [0.13.1-8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-7...v0.13.1-8) (2020-10-26)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-7"></a>
## [0.13.1-7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-6...v0.13.1-7) (2020-10-23)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-6"></a>
## [0.13.1-6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-5...v0.13.1-6) (2020-10-22)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-5"></a>
## [0.13.1-5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-4...v0.13.1-5) (2020-10-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-4"></a>
## [0.13.1-4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-3...v0.13.1-4) (2020-10-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-3"></a>
## [0.13.1-3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-2...v0.13.1-3) (2020-10-19)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-2"></a>
## [0.13.1-2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.13.1-1...v0.13.1-2) (2020-10-19)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.1-1"></a>
## [0.13.1-1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-3...v0.13.1-1) (2020-10-12)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.12.1-3"></a>
## [0.12.1-3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-2...v0.12.1-3) (2020-10-12)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.12.1-2"></a>
## [0.12.1-2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v0.12.1-1...v0.12.1-2) (2020-09-23)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.12.1-1"></a>
## [0.12.1-1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.9-9...v0.12.1-1) (2020-09-22)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.9-9"></a>
## [1.0.9-9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.9-8...v1.0.9-9) (2020-09-22)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.9-8"></a>
## [1.0.9-8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.9-7...v1.0.9-8) (2020-09-22)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.9-7"></a>
## [1.0.9-7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.9-5...v1.0.9-7) (2020-09-18)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.9-5"></a>
## [1.0.9-5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.9-2...v1.0.9-5) (2020-09-17)
### Bug Fixes
* source-editor bug & exp-setter bug ([5cd88d4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/5cd88d4))
<a name="1.0.9-2"></a>
## [1.0.9-2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.9-1...v1.0.9-2) (2020-09-14)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.9-1"></a>
## [1.0.9-1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/v1.0.9-0...v1.0.9-1) (2020-09-14)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.9-0"></a>
## 1.0.9-0 (2020-09-14)
### Bug Fixes
* fix function-setter bug ([dced647](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/dced647))
* fix function-setter bug ([8fd77df](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8fd77df))
* fix NextTable callback function ([ce77375](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ce77375))
* rename MixinSetter to MixedSetter ([0e9a740](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0e9a740))
* 合并master分支 ([bd2c6ad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd2c6ad))
* 清理代码依赖及版本 ([0b15d30](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0b15d30))
* 适配Nav组件 ([7e9829f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7e9829f))
### Features
* add function setter ([114b6b0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/114b6b0))
* add style-setters ([99b1d84](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/99b1d84))
* setting-pane 新增removeProp 函数 ([b97c807](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b97c807))
* tree 组件修改 ([7efa52f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7efa52f))
* 新增functionSetter ([9359ac6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9359ac6))
* 新增事件入参功能 ([0614fa7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0614fa7))
<a name="1.0.8-0"></a>
## [1.0.8-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.21...@ali/lowcode-editor-setters@1.0.8-0) (2020-09-09)
### Bug Fixes
* 合并master分支 ([bd2c6ad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd2c6ad))
* 清理代码依赖及版本 ([0b15d30](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0b15d30))
* 适配Nav组件 ([7e9829f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7e9829f))
* fix function-setter bug ([dced647](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/dced647))
* fix function-setter bug ([8fd77df](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8fd77df))
* fix NextTable callback function ([ce77375](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ce77375))
### Features
* 新增事件入参功能 ([0614fa7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0614fa7))
* 新增functionSetter ([9359ac6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9359ac6))
* add function setter ([114b6b0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/114b6b0))
* add style-setters ([99b1d84](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/99b1d84))
* setting-pane 新增removeProp 函数 ([b97c807](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b97c807))
* tree 组件修改 ([7efa52f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7efa52f))
<a name="1.0.7-0"></a>
## [1.0.7-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@1.0.6-0...@ali/lowcode-editor-setters@1.0.7-0) (2020-09-02)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.6-0"></a>
## [1.0.6-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.19...@ali/lowcode-editor-setters@1.0.6-0) (2020-09-02)
<a name="0.9.21"></a>
## [0.9.21](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.20...@ali/lowcode-editor-setters@0.9.21) (2020-09-03)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.20"></a>
## [0.9.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.19...@ali/lowcode-editor-setters@0.9.20) (2020-09-03)
### Bug Fixes
* 合并master分支 ([bd2c6ad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/bd2c6ad))
* 清理代码依赖及版本 ([0b15d30](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0b15d30))
* 适配Nav组件 ([7e9829f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7e9829f))
* fix function-setter bug ([dced647](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/dced647))
* fix function-setter bug ([8fd77df](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8fd77df))
* fix NextTable callback function ([ce77375](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ce77375))
### Features
* 新增事件入参功能 ([0614fa7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0614fa7))
* 新增functionSetter ([9359ac6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9359ac6))
* add function setter ([114b6b0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/114b6b0))
* add style-setters ([99b1d84](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/99b1d84))
* setting-pane 新增removeProp 函数 ([b97c807](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b97c807))
* tree 组件修改 ([7efa52f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7efa52f))
<a name="1.0.5-0"></a>
## [1.0.5-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@1.0.4-0...@ali/lowcode-editor-setters@1.0.5-0) (2020-08-20)
<a name="0.9.19"></a>
## [0.9.19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.18...@ali/lowcode-editor-setters@0.9.19) (2020-08-27)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.18"></a>
## [0.9.18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.17...@ali/lowcode-editor-setters@0.9.18) (2020-08-24)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.17"></a>
## [0.9.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.16...@ali/lowcode-editor-setters@0.9.17) (2020-08-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.4-0"></a>
## [1.0.4-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@1.0.3-0...@ali/lowcode-editor-setters@1.0.4-0) (2020-08-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.3-0"></a>
## [1.0.3-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@1.0.2-0...@ali/lowcode-editor-setters@1.0.3-0) (2020-08-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.2-0"></a>
## [1.0.2-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@1.0.1-0...@ali/lowcode-editor-setters@1.0.2-0) (2020-08-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="1.0.1-0"></a>
## [1.0.1-0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.16...@ali/lowcode-editor-setters@1.0.1-0) (2020-08-20)
### Bug Fixes
* fix function-setter bug ([8fd77df](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/8fd77df))
### Features
* add function setter ([114b6b0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/114b6b0))
* add style-setters ([99b1d84](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/99b1d84))
* setting-pane 新增removeProp 函数 ([b97c807](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b97c807))
* 新增functionSetter ([9359ac6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/9359ac6))
<a name="1.0.0"></a>
# [1.0.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.14.0...@ali/lowcode-editor-setters@1.0.0) (2020-08-17)
<a name="0.9.16"></a>
## [0.9.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.15...@ali/lowcode-editor-setters@0.9.16) (2020-08-19)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.14.0"></a>
# [0.14.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.13.0...@ali/lowcode-editor-setters@0.14.0) (2020-08-17)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.13.0"></a>
# [0.13.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.11.0...@ali/lowcode-editor-setters@0.13.0) (2020-08-17)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.12.0"></a>
# [0.12.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.11.0...@ali/lowcode-editor-setters@0.12.0) (2020-08-17)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.11.0"></a>
# [0.11.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.10.0...@ali/lowcode-editor-setters@0.11.0) (2020-08-16)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.10.0"></a>
# [0.10.0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.14...@ali/lowcode-editor-setters@0.10.0) (2020-08-14)
### Features
* add style-setters ([99b1d84](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/99b1d84))
<a name="0.9.14"></a>
## [0.9.14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.13...@ali/lowcode-editor-setters@0.9.14) (2020-08-04)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.13"></a>
## [0.9.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.11...@ali/lowcode-editor-setters@0.9.13) (2020-08-04)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.12"></a>
## [0.9.12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.11...@ali/lowcode-editor-setters@0.9.12) (2020-08-04)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.11"></a>
## [0.9.11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.10...@ali/lowcode-editor-setters@0.9.11) (2020-07-28)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.10"></a>
## [0.9.10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.9...@ali/lowcode-editor-setters@0.9.10) (2020-07-22)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.9"></a>
## [0.9.9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.8...@ali/lowcode-editor-setters@0.9.9) (2020-07-21)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.8"></a>
## [0.9.8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.7...@ali/lowcode-editor-setters@0.9.8) (2020-07-21)
### Bug Fixes
* rename MixinSetter to MixedSetter ([0e9a740](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/0e9a740))
<a name="0.9.7"></a>
## [0.9.7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.6...@ali/lowcode-editor-setters@0.9.7) (2020-07-13)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.6"></a>
## [0.9.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.5...@ali/lowcode-editor-setters@0.9.6) (2020-07-12)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.5"></a>
## [0.9.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.4...@ali/lowcode-editor-setters@0.9.5) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.4"></a>
## [0.9.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.3...@ali/lowcode-editor-setters@0.9.4) (2020-06-23)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.3"></a>
## [0.9.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.2...@ali/lowcode-editor-setters@0.9.3) (2020-06-15)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.2"></a>
## [0.9.2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-setters@0.9.1...@ali/lowcode-editor-setters@0.9.2) (2020-05-20)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.9.1"></a>
## 0.9.1 (2020-05-18)
**Note:** Version bump only for package @ali/lowcode-editor-setters
<a name="0.8.15"></a>
## [0.8.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.14...@ali/lowcode-setters@0.8.15) (2020-05-15)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.14"></a>
## [0.8.14](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.13...@ali/lowcode-setters@0.8.14) (2020-05-13)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.13"></a>
## [0.8.13](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.12...@ali/lowcode-setters@0.8.13) (2020-05-08)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.12"></a>
## [0.8.12](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.11...@ali/lowcode-setters@0.8.12) (2020-05-07)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.11"></a>
## [0.8.11](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.10...@ali/lowcode-setters@0.8.11) (2020-04-27)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.10"></a>
## [0.8.10](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.9...@ali/lowcode-setters@0.8.10) (2020-04-27)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.9"></a>
## [0.8.9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.8...@ali/lowcode-setters@0.8.9) (2020-04-27)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.8"></a>
## [0.8.8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.7...@ali/lowcode-setters@0.8.8) (2020-04-16)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.7"></a>
## [0.8.7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.6...@ali/lowcode-setters@0.8.7) (2020-04-15)
### Features
* mixin-setter get all setter ([eaa84d2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/eaa84d2))
* mixin-setter get all setter ([a5eb62d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a5eb62d))
<a name="0.8.6"></a>
## [0.8.6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.5...@ali/lowcode-setters@0.8.6) (2020-03-31)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.5"></a>
## [0.8.5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.4...@ali/lowcode-setters@0.8.5) (2020-03-30)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.4"></a>
## [0.8.4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.3...@ali/lowcode-setters@0.8.4) (2020-03-30)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.3"></a>
## [0.8.3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-setters@0.8.2...@ali/lowcode-setters@0.8.3) (2020-03-30)
**Note:** Version bump only for package @ali/lowcode-setters
<a name="0.8.2"></a>
## 0.8.2 (2020-03-30)
### Bug Fixes
* ts type ([1732e7d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1732e7d))
<a name="0.8.1"></a>
## 0.8.1 (2020-03-30)
### Bug Fixes
* ts type ([1732e7d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1732e7d))

View File

@ -1,58 +0,0 @@
{
"name": "@ali/lowcode-editor-setters",
"version": "0.13.1-29",
"description": "Builtin setters for Ali lowCode engine",
"files": [
"es",
"lib"
],
"main": "lib/index.js",
"module": "es/index.js",
"scripts": {
"build": "build-scripts build --skip-demo",
"test": "ava",
"test:snapshot": "ava --update-snapshots"
},
"dependencies": {
"@ali/iceluna-comp-expression": "^1.0.6",
"@ali/iceluna-comp-form": "^1.0.20",
"@ali/iceluna-comp-list": "^1.0.26",
"@ali/iceluna-comp-object-button": "^1.0.23",
"@ali/iceluna-comp-react-node": "^1.0.5",
"@ali/iceluna-sdk": "^1.0.5-beta.24",
"@ali/lc-style-setter": "^0.0.1",
"@ali/lowcode-editor-core": "^0.13.1-29",
"@alifd/next": "^1.19.16",
"acorn": "^6.4.1",
"classnames": "^2.2.6",
"intl-messageformat": "^9.3.1",
"js-beautify": "^1.13.0",
"qs": "^6.9.1",
"react": "^16",
"react-dom": "^16.7.0",
"react-monaco-editor": "0.40.0"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"@types/classnames": "^2.2.7",
"@types/node": "^13.7.1",
"@types/react": "^16",
"@types/react-dom": "^16",
"build-plugin-component": "^0.2.10",
"build-plugin-fusion": "^0.1.0",
"build-plugin-moment-locales": "^0.1.0"
},
"ava": {
"compileEnhancements": false,
"snapshotDir": "test/fixtures/__snapshots__",
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
},
"publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com"
}
}

View File

@ -1,97 +0,0 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { SketchPicker } from 'react-color';
import { Input, Balloon } from '@alife/next';
import './index.scss';
interface Color {
rgb: any;
onChange: () => void;
}
export interface PluginProps {
value: string;
onChange: any;
}
export default class ColorPickerView extends PureComponent<PluginProps> {
static display = 'ColorPicker';
static propTypes = {
onChange: PropTypes.func,
value: PropTypes.string,
};
static defaultProps = {
onChange: () => {},
value: '',
};
constructor(props: Readonly<{ value: string; defaultValue: string }>) {
super(props);
this.state = {
value: props.value || props.defaultValue,
};
}
static getDerivedStateFromProps(props: { value: string }, state: { preValue: string }) {
if (props.value != state.preValue) {
return {
preValue: props.value,
value: props.value,
};
}
return null;
}
onChangeComplete = (color: Color): void => {
let value;
if (color.rgb.a < 1) {
const { rgb } = color;
const rgba = [rgb.r, rgb.g, rgb.b, rgb.a];
value = `rgba(${rgba.join(',')})`;
} else {
value = color.hex;
}
this.setState({
value,
});
this.props.onChange && this.props.onChange(value);
};
onInputChange = (value: string): void => {
if (/^[0-9a-zA-Z]{6}$/.test(value)) value = `#${ value}`;
this.setState({
value,
});
this.props.onChange && this.props.onChange(value);
};
render(): React.ReactNode {
const { value, onChange, ...restProps } = this.props;
const boxStyle = {
backgroundColor: this.state.value,
};
const triggerNode = (
<div className="lowcode-color-box">
<div style={boxStyle} />
</div>
);
const InnerBeforeNode = (
<Balloon
className={'lowcode-color-content'}
trigger={triggerNode}
needAdjust
triggerType="click"
closable={false}
alignEdge="edge"
offset={[-3, -6]}
>
<SketchPicker onChangeComplete={this.onChangeComplete} color={this.state.value} arrowPointAtCenter />
</Balloon>
);
return (
<Input {...restProps} innerBefore={InnerBeforeNode} onChange={this.onInputChange} value={this.state.value} />
);
}
}

View File

@ -1,464 +0,0 @@
import { Component } from 'react';
import { Radio, Menu, Table, Icon } from '@alifd/next';
import nativeEvents from './native-events';
import './index.scss';
const { Item, Group } = Menu;
const RadioGroup = Radio.Group;
const EVENT_CONTENTS = {
COMPONENT_EVENT: 'componentEvent',
NATIVE_EVENT: 'nativeEvent',
LIFE_CYCLE_EVENT: 'lifeCycleEvent',
};
const DEFINITION_EVENT_TYPE = {
EVENTS: 'events',
NATIVE_EVENTS: 'nativeEvents',
LIFE_CYCLE_EVENT: 'lifeCycleEvent',
};
const SETTER_NAME = 'event-setter';
export default class EventsSetter extends Component<{
value: any[];
onChange: (eventList: any[]) => void;
}> {
state = {
eventBtns: [],
eventList: [],
selectType: null,
nativeEventList: [],
lifeCycleEventList: [],
eventDataList: (this.props?.value?.eventDataList ? this.props.value.eventDataList : this.props?.value) || [],
};
// constructor (){
// super();
// debugger;
// // if (!this.props || !this.props.value){
// // this.setState({
// // eventDataList:[]
// // })
// // }
// }
// static getDerivedStateFromProps(nextProps, prevState) {
// debugger;
// // const { value } = nextProps;
// // debugger;
// // if (value !== prevState.eventDataList) {
// // return {
// // value,
// // };
// // }
// return null;
// }
private bindEventName: string;
componentDidMount() {
console.log(this.state.eventDataList);
const { editor } = this.props.field;
this.initEventBtns();
this.initEventList();
editor.on(`${SETTER_NAME}.bindEvent`, (relatedEventName, paramStr) => {
this.bindEvent(relatedEventName, paramStr);
});
}
/**
*
*/
initEventBtns() {
const { definition } = this.props;
let isRoot = false;
let isCustom = false;
let eventBtns = [];
definition.map(item => {
if (item.type === DEFINITION_EVENT_TYPE.LIFE_CYCLE_EVENT) {
isRoot = true;
}
if (item.type === DEFINITION_EVENT_TYPE.EVENTS) {
isCustom = true;
}
return item;
});
if (isRoot) {
eventBtns = [
{
value: EVENT_CONTENTS.LIFE_CYCLE_EVENT,
label: '生命周期',
},
];
} else if (isCustom) {
eventBtns = [
{
value: EVENT_CONTENTS.COMPONENT_EVENT,
label: '组件自带事件',
},
];
} else {
eventBtns = [
{
value: EVENT_CONTENTS.NATIVE_EVENT,
label: '原生事件',
},
];
}
this.setState({
eventBtns,
});
}
initEventList() {
const { definition } = this.props;
let nativeEventList = [];
definition.map(item => {
if (item.type === DEFINITION_EVENT_TYPE.EVENTS) {
this.checkEventListStatus(item.list, DEFINITION_EVENT_TYPE.EVENTS);
this.setState({
eventList: item.list,
});
}
if (item.type === DEFINITION_EVENT_TYPE.NATIVE_EVENTS) {
this.checkEventListStatus(
item.list,
DEFINITION_EVENT_TYPE.NATIVE_EVENTS,
);
nativeEventList = item.list;
}
if (item.type === DEFINITION_EVENT_TYPE.LIFE_CYCLE_EVENT) {
this.checkEventListStatus(
item.list,
DEFINITION_EVENT_TYPE.LIFE_CYCLE_EVENT,
);
this.setState({
lifeCycleEventList: item.list,
});
}
return item;
});
if (nativeEventList.length == 0) {
nativeEventList = nativeEvents;
this.setState({
nativeEventList,
});
}
}
checkEventListStatus = (eventList: any[], eventType: string) => {
const { eventDataList } = this.state;
if (
eventType === DEFINITION_EVENT_TYPE.EVENTS ||
eventType === DEFINITION_EVENT_TYPE.LIFE_CYCLE_EVENT
) {
eventList.map(item => {
item.disabled = false;
eventDataList.map(eventDataItem => {
if (item.name === eventDataItem.name) {
item.disabled = true;
}
return eventDataItem;
});
return item;
});
} else if (eventType === DEFINITION_EVENT_TYPE.NATIVE_EVENTS) {
eventDataList.map(eventDataItem => {
eventList.map(item => {
item.eventList.map(eventItem => {
if (eventItem.name === eventDataItem.name) {
item.disabled = true;
} else {
item.disabled = false;
}
return eventItem;
});
return item;
});
return eventDataItem;
});
}
};
/**
*
*/
renderEventInfoCell = (value, index, record) => {
let eventTagText = '';
if (record.type === EVENT_CONTENTS.NATIVE_EVENT) {
eventTagText = '原';
} else if (record.type === EVENT_CONTENTS.COMPONENT_EVENT) {
eventTagText = '组';
} else if (record.type === EVENT_CONTENTS.LIFE_CYCLE_EVENT) {
eventTagText = '生';
}
return (
<div>
<div className="event-cell">
<div className="event-type-tag">{eventTagText}</div>
{record.name}
</div>
<div className="event-cell" style={{ marginTop: '8px' }}>
<Icon type="attachment" size="small" className="related-icon" />
<span className="related-event-name" onClick={() => this.onRelatedEventNameClick(record.relatedEventName)}>
{record.relatedEventName || ''}
</span>
</div>
</div>
);
};
/**
*
*/
renderEventOperateCell = (eventName: string) => {
return (
<div>
<Icon
type="set"
className="event-operate-icon"
style={{ marginLeft: '3px', marginRight: '4px' }}
onClick={() => this.openDialog(eventName)}
/>
<Icon
type="ashbin"
className="event-operate-icon"
onClick={() => this.openDeleteEventDialog(eventName)}
/>
</div>
);
};
updateEventListStatus = (eventName: string, unDisabled: boolean) => {
const { eventList, nativeEventList, lifeCycleEventList } = this.state;
eventList.map(item => {
if (item.name === eventName) {
item.disabled = !unDisabled;
}
return item;
});
lifeCycleEventList.map(item => {
if (item.name === eventName) {
item.disabled = !unDisabled;
}
return item;
});
nativeEventList.map(item => {
item.eventList.map(itemData => {
if (itemData.name === eventName) {
itemData.disabled = !unDisabled;
}
return itemData;
});
return item;
});
};
onRadioChange = value => {
this.setState({
selectType: value,
});
};
onEventMenuClick = (eventName: string) => {
const { selectType, eventDataList } = this.state;
eventDataList.push({
type: selectType,
name: eventName,
});
this.setState({
eventDataList,
});
this.updateEventListStatus(eventName);
this.closeEventMenu();
this.openDialog(eventName);
};
onRelatedEventNameClick = (eventName: string) => {
const { editor } = this.props.field;
editor.get('skeleton').getPanel('sourceEditor').show();
setTimeout(() => {
editor.emit('sourceEditor.focusByFunction', {
functionName: eventName,
});
}, 300);
// editor.emit('sourceEditor.focusByFunction',{
// functionName:eventName
// })
};
closeEventMenu = () => {
if (this.state.selectType !== null) {
this.setState({
selectType: null,
});
}
};
openDeleteEventDialog = (eventName: string) => {
this.deleteEvent(eventName);
// Dialog.confirm({
// title: '删除事件',
// content: '确定删除当前事件吗',
// onOk: () => this.deleteEvent(eventName),
// });
};
deleteEvent = (eventName: string) => {
const { eventDataList, eventList } = this.state;
eventDataList.map((item, index) => {
if (item.name === eventName) {
eventDataList.splice(index, 1);
}
return item;
});
this.setState({
eventDataList,
});
this.props.onChange({ eventDataList, eventList });
this.updateEventListStatus(eventName, true);
};
openDialog = (bindEventName: string) => {
const { editor } = this.props.field;
const { eventDataList } = this.state;
let paramStr;
eventDataList.map((item) => {
if (item.name == bindEventName) {
paramStr = item.paramStr;
}
return item;
});
this.bindEventName = bindEventName;
editor.emit('eventBindDialog.openDialog', bindEventName, SETTER_NAME, paramStr);
};
bindEvent = (relatedEventName: string, paramStr: string) => {
const { eventDataList, eventList } = this.state;
eventDataList.map(item => {
if (item.name === this.bindEventName) {
item.relatedEventName = relatedEventName;
if (paramStr) {
item.paramStr = paramStr;
}
}
return item;
});
this.setState({
eventDataList,
});
this.props.onChange({ eventDataList, eventList });
// this.closeDialog();
};
render() {
const {
eventBtns,
eventList,
nativeEventList,
lifeCycleEventList,
selectType,
eventDataList,
} = this.state;
const showEventList =
lifeCycleEventList.length > 0 ? lifeCycleEventList : eventList;
return (
<div className="lc-block-setter event-body" onClick={this.closeEventMenu}>
<div className="event-title">
{
eventBtns.length > 1 ? <span></span> : <span></span>
}
</div>
<RadioGroup
dataSource={eventBtns}
shape="button"
size="medium"
value={selectType}
onChange={this.onRadioChange}
style={{ width: '100%' }}
/>
{selectType && selectType != EVENT_CONTENTS.NATIVE_EVENT && (
<Menu
defaultOpenKeys="sub-menu"
className="event-menu"
onItemClick={this.onEventMenuClick}
>
{showEventList.map((item) => (
<Item
key={item.name}
helper={item.description}
disabled={item.disabled}
>
{item.name}
</Item>
))}
</Menu>
)}
{selectType && selectType === EVENT_CONTENTS.NATIVE_EVENT && (
<Menu
defaultOpenKeys="sub-menu"
className="event-menu"
onItemClick={this.onEventMenuClick}
>
{nativeEventList.map((item, index) => (
<Group label={item.name} key={index}>
{item.eventList.map(groupItem => (
<Item key={groupItem.name} disabled={groupItem.disabled}>
{groupItem.name}
</Item>
))}
</Group>
))}
</Menu>
)}
<div className="event-table">
<Table dataSource={eventDataList} size="small">
<Table.Column title="已有事件" cell={this.renderEventInfoCell} />
<Table.Column
title="操作"
dataIndex="name"
cell={this.renderEventOperateCell}
width={70}
/>
</Table>
</div>
</div>
);
}
}

View File

@ -1,349 +0,0 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Select, Balloon } from '@alife/next';
import * as acorn from 'acorn';
import { isJSExpression, generateI18n } from './locale/utils';
import zhCN from './locale/zh-CN';
import './index.scss';
const { Option, AutoComplete } = Select;
const { Tooltip } = Balloon;
const helpMap = {
this: '容器上下文对象',
state: '容器的state',
props: '容器的props',
context: '容器的context',
schema: '页面上下文对象',
component: '组件上下文对象',
constants: '应用常量对象',
utils: '应用工具对象',
dataSourceMap: '容器数据源Map',
field: '表单Field对象',
};
export default class ExpressionView extends PureComponent {
static displayName = 'Expression';
static propTypes = {
context: PropTypes.object,
dataSource: PropTypes.array,
locale: PropTypes.string,
messages: PropTypes.object,
onChange: PropTypes.func,
placeholder: PropTypes.string,
value: PropTypes.string,
};
static defaultProps = {
context: {},
dataSource: [],
locale: 'zh-CN',
messages: zhCN,
onChange: () => {},
placeholder: '',
value: '',
};
expression: React.RefObject<unknown>;
i18n: any;
t: void;
$input: any;
listenerFun: ((event: any) => void) | undefined;
static getInitValue(val: { value: any; match: (arg0: RegExp) => any; }) {
if (isJSExpression(val)) {
if (typeof val === 'object') {
return val.value;
} else if (typeof val === 'string') {
const arr = val.match(/^\{\{(.*?)\}\}$/);
if (arr) return arr[1];
}
}
return val;
}
constructor(props: any) {
super(props);
this.expression = React.createRef();
this.i18n = generateI18n(props.locale, props.messages);
this.state = {
value: ExpressionView.getInitValue(props.value),
dataSource: props.dataSource || [],
};
}
static getDerivedStateFromProps(props: { value: any; }, state: { preValue: any; }) {
const curValue = ExpressionView.getInitValue(props.value);
if (curValue !== state.preValue) {
return {
preValue: curValue,
value: curValue,
};
}
return null;
}
onChange(value: string, actionType: string) {
let realInputValue = value;
const realDataSource = null;
let nextCursorIndex: number;
// 更新值
if (actionType === 'itemClick' || actionType === 'enter') {
const curValue = this.state.value;
if (curValue) {
realInputValue = curValue + realInputValue;
}
}
// 更新数据源
const newState = {
value: realInputValue,
};
if (realDataSource !== null) newState.dataSource = realDataSource;
this.setState(newState, () => {
nextCursorIndex && this.setInputCursorPosition(nextCursorIndex);
});
// 默认加上变量表达式
this.t && clearTimeout(this.t);
this.t = setTimeout(() => {
const { onChange } = this.props;
// realInputValue = realInputValue ? `{{${realInputValue}}}` : undefined;
onChange && onChange({
type: 'JSExpression',
value: realInputValue,
});
}, 300);
}
/**
* AutoComplete数据源
* @param {String}
* @return {Array}
*/
getDataSource(): any[] {
const { editor } = this.props.field;
const schema = editor.get('designer').project.getSchema();
const stateMap = schema.componentsTree[0].state;
const dataSource = [];
for (const key in stateMap) {
dataSource.push(`this.state.${key}`);
}
return dataSource;
}
/**
*
* @param {String} str
* @return {String}
*/
getCurrentFiled(str: string | any[]) {
str += 'x'; // .后面加一个x字符便于acorn解析
try {
const astTree = acorn.parse(str);
const right = astTree.body[0].expression.right || astTree.body[0].expression;
if (right.type === 'MemberExpression') {
const { start, end } = right;
str = str.slice(start, end);
return { str, start, end };
}
} catch (e) {
return null;
}
}
/**
*
* @param {Array}
* @return {Array}
*/
getContextKeys(keys: []) {
const { editor } = this.props.field;
console.log(editor);
const limitKeys = ['schema', 'utils', 'constants'];
if (keys.length === 0) return limitKeys;
if (!limitKeys.includes(keys[0])) return [];
let result = [];
let keyValue = editor;
let assert = false;
keys.forEach(item => {
if (!keyValue[item] || typeof keyValue[item] !== 'object') {
assert = true;
}
if (keyValue[item]) {
keyValue = keyValue[item];
}
});
if (assert) return [];
result = Object.keys(keyValue);
return result;
// return utilsKeys.concat(constantsKeys).concat(schemaKeys);
}
/* 过滤key */
filterKey(obj: any, name: string) {
const filterKeys = [
'reloadDataSource',
'REACT_HOT_LOADER_RENDERED_GENERATION',
'refs',
'updater',
'appHelper',
'isReactComponent',
'forceUpdate',
'setState',
'isPureReactComponent',
];
const result = [];
for (const key in obj) {
if (key.indexOf('_') !== 0 && filterKeys.indexOf(key) === -1) {
result.push(`${name}.${key}`);
}
}
return result;
}
/**
*
* @param {String}
* @param {String}
* @return {Boolen}
*/
filterOption(inputValue: string, item: { value: string | any[]; }) {
const cursorIndex = this.getInputCursorPosition();
const preStr = inputValue.substr(0, cursorIndex);
const lastKey: string[] = preStr.split('.').slice(-1);
if (!lastKey) return true;
if (item.value.indexOf(lastKey) > -1) return true;
return false;
}
// handleClick = () => {
// this.props.field.editor.emit('variableBindDialog.open');
// }
render() {
const { value, dataSource } = this.state;
const { placeholder } = this.props;
const isValObject = !!(value == '[object Object]');
const title = isValObject
? this.i18n('valueIllegal')
: (value || placeholder || this.i18n('jsExpression')).toString();
const cursorIndex = this.getInputCursorPosition();
const childNode = cursorIndex ? (
<div className="cursor-blink">
{title.substr(0, cursorIndex)}
<b>|</b>
{title.substr(cursorIndex)}
</div>
) : (
title
);
return (
<div ref={this.expression} style={{ width: '100%', display: 'inline-block' }}>
<Tooltip
triggerType={isValObject ? ['click'] : ['focus']}
align="tl"
popupClassName="code-input-overlay"
trigger={
isValObject ? (
value
) : (
<div>
<AutoComplete
{...this.props}
style={{ width: '100%' }}
dataSource={dataSource}
placeholder={placeholder || this.i18n('jsExpression')}
value={value}
disabled={isValObject}
innerBefore={<span style={{ color: '#999', marginLeft: 4 }}>{'{{'}</span>}
innerAfter={<span style={{ color: '#999', marginRight: 4 }}>{'}}'}</span>}
popupClassName="expression-setter-item-inner"
// eslint-disable-next-line no-shadow
itemRender={({ value }) => {
return (
<Option key={value} text={value} value={value}>
<div className="code-input-value">{value}</div>
<div className="code-input-help">{helpMap[value]}</div>
</Option>
);
}}
onChange={this.onChange.bind(this)}
filter={this.filterOption.bind(this)}
/>
</div>
)
}
>
{childNode}
</Tooltip>
</div>
);
}
componentDidMount() {
this.$input = this.findInputElement();
if (this.$input) {
this.listenerFun = event => {
const isMoveKey = !!(event.type == 'keyup' && ~[37, 38, 39, 91].indexOf(event.keyCode));
const isMouseup = event.type == 'mouseup';
if (isMoveKey || isMouseup) {
// eslint-disable-next-line react/no-access-state-in-setstate
const dataSource = this.getDataSource(this.state.value) || [];
this.setState({
dataSource,
});
}
};
this.$input.addEventListener('keyup', this.listenerFun, false);
this.$input.addEventListener('mouseup', this.listenerFun, false);
}
}
componentWillUnmount() {
if (this.listenerFun && this.$input) {
this.$input.removeEventListener('keyup', this.listenerFun, false);
this.$input.removeEventListener('mouseup', this.listenerFun, false);
}
}
/**
* Input输入框DOM节点
*/
findInputElement() {
return this.expression.current.children[0].getElementsByTagName('input')[0];
}
/**
*
*
*/
getInputCursorPosition() {
if (!this.$input) return;
return this.$input.selectionStart;
}
/*
* keys
*/
getObjectKeys(str: string) {
let keys: string | any[] = [];
if (str) keys = str.split('.');
return keys.slice(0, keys.length - 1);
}
/*
* input组件光标位置在闭合}
*/
setInputCursorPosition(idx: number) {
this.$input.setSelectionRange(idx, idx);
this.forceUpdate();
}
}

View File

@ -1,242 +0,0 @@
export default [
{
label: 'constants',
kind: 'Class',
insertText: 'constants',
detail: '应用全局常量',
documentation: '应用范围定义的通用常量',
},
{
label: 'utils',
kind: 'Class',
insertText: 'utils',
detail: '应用全局公共函数',
documentation: '应用范围扩展的公共函数',
},
{
label: 'state',
kind: 'Enum',
insertText: 'state',
detail: '当前所在容器组件内部状态',
documentation: 'React Class内部状态state',
},
{
label: 'setState',
kind: 'Function',
insertText: 'setState({\n\t$0\n})',
insertTextRules: 'InsertAsSnippet',
detail: '设置当前所在容器组件的state数据',
documentation: '原生React方法会自动更新组件视图',
},
{
label: 'reloadDataSource',
kind: 'Function',
insertText: 'reloadDataSource(${1:${2:namespace}, ${3:false}, ${4:callback}})',
insertTextRules: 'InsertAsSnippet',
detail: '刷新当前所在的容器组件',
documentation: '触发当前所在的容器组件,重新发送异步请求,并用最新数据更新视图',
},
{
label: 'location',
kind: 'Class',
insertText: 'location',
detail: '路由解析对象',
},
{
label: 'location.query',
kind: 'Value',
insertText: 'location.query.${1:xxxx}',
insertTextRules: 'InsertAsSnippet',
detail: '从路由解析对象中获取参数信息',
},
{
label: 'history',
kind: 'Class',
insertText: 'history',
detail: '路由历史对象',
},
{
label: 'React',
kind: 'Keyword',
insertText: 'React',
detail: 'React对象',
},
{
label: 'ReactDOM',
kind: 'Keyword',
insertText: 'ReactDOM',
detail: 'ReactDom对象',
},
{
label: 'ReactDOM.findDOMNode',
kind: 'Function',
insertText: 'ReactDOM.findDOMNode(${1:this.refs.xxxx})',
insertTextRules: 'InsertAsSnippet',
detail: 'ReactDom查找真实dom node',
},
{
label: 'Dialog.alert',
kind: 'Method',
insertText: [
'Dialog.alert({',
"\tcontent: '${1:Alert content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: 'alert弹框 By Fusion',
},
{
label: 'Dialog.confirm',
kind: 'Method',
insertText: [
'Dialog.confirm({',
"\tcontent: '${1:Confirm content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '确认弹出框 By Fusion',
},
{
label: 'Message.success',
kind: 'Method',
insertText: 'Message.success(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '成功反馈提示 By Fusion',
},
{
label: 'Message.error',
kind: 'Method',
insertText: 'Message.error(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '错误反馈提示 By Fusion',
},
{
label: 'Message.help',
kind: 'Method',
insertText: 'Message.help(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '帮助反馈提示 By Fusion',
},
{
label: 'Message.loading',
kind: 'Method',
insertText: 'Message.loading(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: 'loading反馈提示 By Fusion',
},
{
label: 'Message.notice',
kind: 'Method',
insertText: 'Message.notice(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '注意反馈提示 By Fusion',
},
{
label: 'Message.waining',
kind: 'Method',
insertText: 'Message.waining(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '警告反馈提示 By Fusion',
},
{
label: 'Modal.confirm',
kind: 'Method',
insertText: [
'Modal.confirm({',
"\tcontent: '${1:Confirm content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '确认弹出框 By Antd',
},
{
label: 'Modal.info',
kind: 'Method',
insertText: [
'Modal.info({',
"\tcontent: '${1:Info content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '信息弹出框 By Antd',
},
{
label: 'Modal.success',
kind: 'Method',
insertText: [
'Modal.success({',
"\tcontent: '${1:Success content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '成功弹出框 By Antd',
},
{
label: 'Modal.error',
kind: 'Method',
insertText: [
'Modal.error({',
"\tcontent: '${1:Error content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '错误弹出框 By Antd',
},
{
label: 'Modal.warning',
kind: 'Method',
insertText: [
'Modal.warning({',
"\tcontent: '${1:Warning content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '警告弹出框 By Antd',
},
];

View File

@ -1,21 +0,0 @@
import IntlMessageFormat from 'intl-messageformat';
export const isJSExpression = (obj = '') => {
if (obj && typeof obj === 'object' && obj.type === 'JSExpression') {
return true;
}
return false;
};
/**
*
* @param {*} locale zh-CNen-US
* @param {*} messages
*/
export const generateI18n = (locale = 'zh-CN', messages = {}) => {
return function (key, values = {}) {
if (!messages || !messages[key]) return '';
const formater = new IntlMessageFormat(messages[key], locale);
return formater.format(values);
};
};

View File

@ -1,36 +0,0 @@
export default {
// function
setting: '点击设置',
edit: '编辑',
submitConfirm: '确认提交 cmd+s',
close: '关闭 esc',
fullScreen: '全屏',
cancelFullScreen: '取消全屏',
jsonIllegal: '非json格式',
functionIllegal: '非function格式',
objectIllegal: '非object格式',
circularRef: '对象中出现循环引用的对象',
formatError: '格式错误',
saved: '已保存',
// expression
valueIllegal: '值类型为对象类型,与当前组件属性设置的控件类型不匹配,请在属性“代码编辑模式”下进行编辑',
jsExpression: '请输入JS表达式',
// Mixin
input: '字符串Input',
textarea: '多行字符串Textarea',
expression: '变量控件Expression',
monacoEditor: '编辑器MonacoEditor',
numberPicker: '数字NumberPicker',
bool: '布尔Switch',
datePicker: '日期选择DatePicker',
select: '下拉选择Select',
radio: '单项选择RadioGroup',
date: '日期选择DatePicker',
dateYear: '年选择DatePicker',
dateMonth: '月选择DatePicker',
dateRange: '日期区间选择DatePicker',
list: '数组List',
object: '对象ObjectButton',
reactNode: '节点类型ReactNode',
typeError: 'Minix组件属性Types配置错误存在不支持类型[{type}],请检查组件属性配置',
};

View File

@ -1,230 +0,0 @@
import React, { PureComponent } from 'react';
// import PropTypes from 'prop-types';
import { Button, Icon, Dialog } from '@alifd/next';
import MonacoEditor from 'react-monaco-editor';
import { js_beautify } from 'js-beautify';
import './index.scss';
const SETTER_NAME = 'function-setter';
const defaultEditorOption = {
width: '100%',
height: '100%',
options: {
readOnly: false,
automaticLayout: true,
folding: true, // 默认开启折叠代码功能
lineNumbers: 'on',
wordWrap: 'off',
formatOnPaste: true,
fontSize: 12,
tabSize: 2,
scrollBeyondLastLine: false,
fixedOverflowWidgets: false,
snippetSuggestions: 'top',
minimap: {
enabled: false,
},
scrollbar: {
vertical: 'auto',
horizontal: 'auto',
},
},
};
interface FunctionSetterProps {
value: string;
type: string;
defaultValue: string;
placeholder: string;
hasClear: boolean;
onChange: (icon: string) => undefined;
icons: string[];
}
export default class FunctionSetter extends PureComponent<FunctionSetterProps> {
static defaultProps = {
value: undefined,
type: 'string',
defaultValue: '',
hasClear: true,
placeholder: '请点击选择 Icon',
onChange: () => undefined,
};
private emitEventName = '';
state = {
isShowDialog: false,
};
componentDidMount() {
const { editor } = this.props.field;
this.emitEventName = `${SETTER_NAME}-${this.props.field.id}`;
editor.on(`${this.emitEventName}.bindEvent`, this.bindEvent);
}
bindEvent = (eventName) => {
this.bindEventCallback(eventName);
};
componentWillUnmount() {
const { editor } = this.props.field;
editor.off(`${this.emitEventName}.bindEvent`, this.bindEvent);
}
bindFunction = () => {
const { field } = this.props;
field.editor.emit('eventBindDialog.openDialog', field.name, this.emitEventName);
};
openDialog = () => {
const { value = {} } = this.props;
this.setState({
isShowDialog: true,
});
this.functionCode = value.value;
};
closeDialog = () => {
this.setState({
isShowDialog: false,
});
};
removeFunctionBind = () => {
const { removeProp } = this.props;
removeProp();
};
parseFunctionName = (functionString: string) => {
// 因为函数格式是固定的,所以可以按照字符换去匹配获取函数名
const funNameStr = functionString.split('this.')[1];
if (funNameStr) {
const endIndex = funNameStr.indexOf('(');
return funNameStr.substr(0, endIndex);
} else {
return '';
}
};
/**
* ()
*/
renderButton = () => {
return <Button type="normal" onClick={() => this.bindFunction()}></Button>;
};
updateCode = (newCode) => {
this.functionCode = newCode;
};
onDialogOk = () => {
const { onChange } = this.props;
onChange({
type: 'JSFunction',
value: this.functionCode,
});
this.closeDialog();
};
focusFunctionName = (functionName) => {
const { editor } = this.props.field;
editor.get('skeleton').getPanel('sourceEditor').show();
setTimeout(() => {
editor.emit('sourceEditor.focusByFunction', {
functionName,
});
}, 300);
};
/**
*
*/
renderBindFunction = () => {
const { value } = this.props;
// 解析函数名
const functionName = this.parseFunctionName(value.value);
return (
<div className="function-container">
<img className="funtion-icon" src="https://gw.alicdn.com/tfs/TB1NXNhk639YK4jSZPcXXXrUFXa-200-200.png" />
<span className="function-name" onClick={() => this.focusFunctionName(functionName)}>{functionName}</span>
<Icon type="set" size="medium" className="funtion-operate-icon" onClick={this.bindFunction} />
<Icon type="ashbin" size="medium" className="funtion-operate-icon" onClick={this.removeFunctionBind} />
</div>
);
};
/**
* ()
*/
renderEditFunctionButton = () => {
return (
<div>
<Button type="primary" onClick={this.openDialog}><Icon type="edit" /></Button>
</div>
);
};
bindEventCallback = (eventName: string) => {
const { onChange } = this.props;
onChange({
type: 'JSFunction',
value: `function(){ this.${eventName}() }`,
});
};
render() {
const { value } = this.props;
const { isShowDialog } = this.state;
let functionName = '';
if (value && value.value) {
functionName = this.parseFunctionName(value.value);
}
let renderFunction;
if (value) {
if (functionName) {
renderFunction = this.renderBindFunction;
} else {
renderFunction = this.renderEditFunctionButton;
}
} else {
renderFunction = this.renderButton;
}
return (
<div className="lc-function-setter">
{
renderFunction()
}
{
value && value.value &&
<Dialog visible={isShowDialog} closeable={'close'} title="函数编辑" onCancel={this.closeDialog} onOk={this.onDialogOk} onClose={() => { this.closeDialog(); }}>
<div style={{ width: '500px', height: '400px' }}>
<MonacoEditor
value={js_beautify(value.value)}
{...defaultEditorOption}
{...{ language: 'javascript' }}
onChange={(newCode) => this.updateCode(newCode)}
/>
</div>
</Dialog>
}
</div>
);
}
}

View File

@ -1,171 +0,0 @@
import React, { PureComponent } from 'react';
// import PropTypes from 'prop-types';
import { Input, Icon, Balloon } from '@alifd/next';
import './index.scss';
const icons = [
'smile',
'cry',
'success',
'warning',
'prompt',
'error',
'help',
'clock',
'success-filling',
'delete-filling',
'favorites-filling',
'add',
'minus',
'arrow-up',
'arrow-down',
'arrow-left',
'arrow-right',
'arrow-double-left',
'arrow-double-right',
'switch',
'sorting',
'descending',
'ascending',
'select',
'semi-select',
'loading',
'search',
'close',
'ellipsis',
'picture',
'calendar',
'ashbin',
'upload',
'download',
'set',
'edit',
'refresh',
'filter',
'attachment',
'account',
'email',
'atm',
'copy',
'exit',
'eye',
'eye-close',
'toggle-left',
'toggle-right',
'lock',
'unlock',
'chart-pie',
'chart-bar',
'form',
'detail',
'list',
'dashboard',
];
interface IconSetterProps {
value: string;
type: string;
defaultValue: string;
placeholder: string;
hasClear: boolean;
onChange: (icon: string) => undefined;
icons: string[];
}
export default class IconSetter extends PureComponent<IconSetterProps> {
static defaultProps = {
value: undefined,
type: 'string',
defaultValue: '',
hasClear: true,
icons,
placeholder: '请点击选择 Icon',
onChange: () => undefined,
};
state = {
firstLoad: true,
};
_onChange = (icon: string) => {
const { onChange, type } = this.props;
if (type === 'string') {
onChange(icon);
} else if (type === 'node') {
onChange({
componentName: 'Icon',
props: {
type: icon,
},
});
}
};
onInputChange = (icon: string) => {
this._onChange(icon);
};
onSelectIcon = (icon: string) => {
this._onChange(icon);
};
render() {
const { value, defaultValue, onChange, placeholder, hasClear } = this.props;
const { firstLoad } = this.state;
const _value = typeof value === 'object' ? value?.props?.type : value;
if (firstLoad && defaultValue && typeof value === 'undefined') {
onChange(defaultValue);
this.setState({
firstLoad: false,
});
}
const currentIcon = <Icon size="xs" type={_value} />;
const clearIcon = hasClear && (
<Icon
size="xs"
id="icon-clear"
type="delete-filling"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
this.onSelectIcon('');
}}
/>
);
const triggerNode = (
<div>
<Input
placeholder={placeholder}
addonTextBefore={currentIcon}
onChange={this.onInputChange}
value={_value}
defaultValue={defaultValue}
readOnly
addonTextAfter={clearIcon}
/>
</div>
);
const InnerBeforeNode = (
<Balloon
className={'lowcode-icon-content'}
trigger={triggerNode}
needAdjust
triggerType="click"
closable={false}
alignEdge
align="l"
popupClassName="lowcode-icon-setter-popup"
>
<ul className="lowcode-icon-list">
{icons.map((icon) => (
<li key={icon} onClick={() => this.onSelectIcon(icon)}>
<Icon type={icon} size="medium" />
</li>
))}
</ul>
</Balloon>
);
return <div className="lc-icon-setter">{InnerBeforeNode}</div>;
}
}

View File

@ -1,131 +0,0 @@
import React, { Component } from 'react';
import { registerSetter } from '@ali/lowcode-editor-core';
import { isJSExpression, isJSFunction } from '@ali/lowcode-types';
import { DatePicker, TimePicker, Input, Radio, Select, Switch, NumberPicker } from '@alifd/next';
import ExpressionSetter from './expression-setter';
import ColorSetter from './color-setter';
import JsonSetter from './json-setter';
import EventsSetter from './events-setter';
import StyleSetter from './style-setter';
import IconSetter from './icon-setter';
import FunctionSetter from './function-setter';
// import ClassNameSetter from './classname-setter';
// import MixedSetter from './mixed-setter';
export const StringSetter = {
component: Input,
defaultProps: { placeholder: '请输入', style: { maxWidth: 180 } },
title: 'StringSetter',
recommend: true,
condition: (field: any) => {
const v = field.getValue();
return typeof v === 'string';
},
};
export const NumberSetter = NumberPicker;
export class BoolSetter extends Component {
render() {
const { onChange, value, defaultValue } = this.props;
return <Switch checked={value} defaultChecked={defaultValue} onChange={onChange} />;
}
}
export const SelectSetter = Select;
// suggest: 做成 SelectSetter 一种变体
export const RadioGroupSetter = {
component: Radio.Group,
defaultProps: {
shape: 'button',
},
};
// suggest: 做成 StringSetter 的一个参数,
export const TextAreaSetter = {
component: Input.TextArea,
defaultProps: { placeholder: '请输入', style: { maxWidth: 180 } },
title: 'TextAreaSetter',
recommend: true,
condition: (field: any) => {
const v = field.getValue();
return typeof v === 'string';
},
};
export const DateSetter = DatePicker;
export const DateYearSetter = DatePicker.YearPicker;
export const DateMonthSetter = DatePicker.MonthPicker;
export const DateRangeSetter = DatePicker.RangePicker;
export { ExpressionSetter, EventsSetter, JsonSetter, IconSetter };
// eslint-disable-next-line react/no-multi-comp
class StringDateSetter extends Component {
render() {
const { onChange } = this.props;
return (
<DatePicker
onChange={(val) => {
onChange(val.format());
}}
/>
);
}
}
// eslint-disable-next-line react/no-multi-comp
class StringTimePicker extends Component {
render() {
const { onChange } = this.props;
return (
<TimePicker
onChange={(val) => {
onChange(val.format('HH:mm:ss'));
}}
/>
);
}
}
const VariableSetter = {
component: ExpressionSetter,
condition: (field: any) => {
const v = field.getValue();
return isJSExpression(v);
},
defaultProps: { placeholder: '请输入表达式' },
title: '表达式输入',
recommend: true,
};
const FunctionBindSetter = {
component: FunctionSetter,
title: '函数绑定',
condition: (field: any) => {
const v = field.getValue();
return v == isJSFunction(v);
},
};
const builtinSetters: any = {
StringSetter,
NumberSetter,
BoolSetter,
SelectSetter,
VariableSetter,
ExpressionSetter: VariableSetter,
RadioGroupSetter,
TextAreaSetter,
DateSetter: StringDateSetter,
TimePicker: StringTimePicker,
DateYearSetter,
DateMonthSetter,
DateRangeSetter,
EventsSetter,
ColorSetter,
JsonSetter,
StyleSetter,
IconSetter,
ClassNameSetter,
FunctionSetter: FunctionBindSetter,
};
registerSetter(builtinSetters);

View File

@ -1,622 +0,0 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { js_beautify, css_beautify } from 'js-beautify';
import MonacoEditor from 'react-monaco-editor';
import classNames from 'classnames';
import { Icon, Message } from '@alife/next';
import ObjectButton from '@ali/iceluna-comp-object-button';
import FormItem from '@ali/iceluna-comp-form/lib/item';
import { serialize, jsonuri, generateI18n } from '@ali/iceluna-sdk/lib/utils';
import localeConfig from '@ali/iceluna-sdk/lib/hoc/localeConfig';
import Snippets from './locale/snippets';
import zhCN from './locale/zh-CN';
import './index.scss';
let registerApiAndSnippetStatus = false; // 判断注册api机制
window.bt = js_beautify;
class MonacoEditorView extends PureComponent {
static displayName = 'MonacoEditor';
render() {
const { type, ...restProps } = this.props;
const Node = type == 'button' ? MonacoEditorButtonView : MonacoEditorDefaultView;
return <Node {...restProps} registerApi={(apis) => Object.assign(this, apis)} />;
}
}
localeConfig('MonacoEditor', MonacoEditorView);
// monaco编辑器存在3种主题vs、vs-dark、hc-black
// eslint-disable-next-line react/no-multi-comp
class MonacoEditorDefaultView extends PureComponent {
static displayName = 'MonacoEditorDefault';
static propTypes = {
locale: PropTypes.string,
messages: PropTypes.object,
language: PropTypes.string,
};
static defaultProps = {
locale: 'zh-CN',
messages: zhCN,
width: '100%',
height: '300px',
language: 'json',
autoFocus: false, // 自动获得焦点
autoSubmit: true, // 自动提交
placeholder: '', // 默认占位内容
btnText: '提交',
btnSize: 'small',
rules: [], // 校验规则
options: {
readOnly: false,
automaticLayout: true,
folding: true, // 默认开启折叠代码功能
lineNumbers: 'on',
wordWrap: 'off',
formatOnPaste: true,
fontSize: 12,
tabSize: 2,
scrollBeyondLastLine: false,
fixedOverflowWidgets: false,
snippetSuggestions: 'top',
minimap: {
enabled: true,
},
scrollbar: {
vertical: 'hidden',
horizontal: 'hidden',
verticalScrollbarSize: 0,
},
},
};
strValue: string;
i18n: any;
editorRef: React.RefObject<unknown>;
options: any;
fullScreenOptions: any;
position: any;
editor: any;
editorNode: unknown;
editorParentNode: any;
constructor(props: Readonly) {
super(props);
this.strValue = '';
this.i18n = generateI18n(props.locale, props.messages);
this.editorRef = React.createRef();
this.options = Object.assign({}, MonacoEditorDefaultView.defaultProps.options, props.options);
this.fullScreenOptions = {
...this.options,
lineNumbers: 'on',
folding: true,
scrollBeyondLastLine: true,
minimap: {
enabled: true,
},
};
this.state = {
isFullScreen: false,
};
this.onChange = this.onChange.bind(this);
this.onSubmit = this.onSubmit.bind(this);
this.fullScreen = this.fullScreen.bind(this);
this.format = this.format.bind(this);
}
componentDidUpdate() {
// 如果是全屏操作,获得焦点,光标保留在原来位置;
if (this.position) {
this.editor.focus();
this.editor.setPosition(this.position);
delete this.position;
}
}
componentDidMount() {
this.editorNode = this.editorRef.current; // 记录当前dom节点
this.editorParentNode = this.editorNode.parentNode; // 记录父节点;
// 自动获得焦点, 格式化需要时间
if (this.props.autoFocus) {
setTimeout(() => {
this.editor.setPosition({
column: 4,
lineNumber: 2,
});
this.editor.focus();
}, 100);
}
// 快捷键编码
const CtrlCmd = 2048;
const KEY_S = 49;
const Shift = 1024;
const KEY_F = 36;
const KEY_B = 32;
const Escape = 9;
this.editor.addCommand(CtrlCmd | KEY_S, () => {
this.onSubmit(); // 保存快捷键
});
this.editor.addCommand(CtrlCmd | Shift | KEY_F, () => {
this.fullScreen(); // 全屏快捷键
});
this.editor.addCommand(CtrlCmd | KEY_B, () => {
this.format(); // 美化快捷键
});
this.editor.addCommand(Escape, () => {
this.props.onEscape && this.props.onEscape();
});
// 注册api
this.editor.submit = this.onSubmit;
this.editor.format = this.format;
this.editor.fullScreen = this.fullScreen;
this.editor.toJson = this.toJson;
this.editor.toObject = this.toObject;
this.editor.toFunction = this.toFunction;
// 针对object情况改写setValue和getValue api
if (this.props.language === 'object') {
const { getValue } = this.editor;
const { setValue } = this.editor;
this.editor.getValue = () => {
return getValue.call(this.editor).substring(this.valuePrefix.length);
};
this.editor.setValue = (value) => {
return setValue.call(this.editor, [this.valuePrefix + value]);
};
}
}
render() {
const {
value,
placeholder,
style,
className,
width,
height,
language,
theme,
editorWillMount,
editorDidMount,
registerApi,
} = this.props;
const { isFullScreen } = this.state;
this.valuePrefix = ''; // 值前缀
if (language === 'object') this.valuePrefix = 'export default ';
if (!this.isFullScreenAction) {
// 将值转换成目标值
const nowValue = this.valueHandler(value || placeholder, language);
const curValue = this.valueHandler(this.strValue, language);
if (nowValue !== curValue) this.strValue = nowValue;
if (language === 'object') this.strValue = this.strValue || placeholder || '{\n\t\n}'; // 设置初始化值
if (language === 'json' && this.strValue === '{}') this.strValue = '{\n\t\n}';
}
this.isFullScreenAction = false;
// 真实高亮语言
let tarLanguage = language;
if (language === 'object' || language === 'function') {
tarLanguage = 'javascript';
}
const classes = classNames('monaco-editor-wrap', {
'monaco-fullscreen': !!isFullScreen,
'monaco-nofullscreen': !isFullScreen,
});
const tarStyle = Object.assign({ minHeight: 60, width, height }, style);
let tempValue = this.valuePrefix + this.strValue;
if (tarLanguage === 'json') {
try {
tempValue = JSON.stringify(JSON.parse(tempValue || '{}'), null, 2);
} catch (err) {
console.log(err);
}
}
return (
<div className={className} style={tarStyle}>
<div ref={this.editorRef} style={{ height: '100%' }} className={classes}>
<MonacoEditor
value={tempValue}
width="100%"
height="300"
language={tarLanguage}
theme={theme || window.__monacoTheme}
options={isFullScreen ? this.fullScreenOptions : this.options}
onChange={this.onChange}
editorWillMount={editorWillMount}
editorDidMount={(editor, monaco) => {
this.editor = editor;
registerApi({ editor });
this.registerApiAndSnippet(monaco);
editorDidMount && editorDidMount.call(this, arguments);
}}
/>
<a
onClick={this.fullScreen}
className="monaco_fullscreen_icon"
title={
isFullScreen ? `${this.i18n('cancelFullScreen')} cmd+shift+f` : `${this.i18n('fullScreen')} cmd+shift+f`
}
>
<Icon type={isFullScreen ? 'quxiaoquanping' : 'quanping'} />
</a>
</div>
</div>
);
}
// 值变化
onChange(curValue) {
if (curValue === this.valuePrefix + this.strValue) return;
const { onAfterChange, language, autoSubmit, onChange } = this.props;
this.strValue = curValue; // 记录当前格式
if (this.ct) clearTimeout(this.ct);
this.ct = setTimeout(() => {
this.position = this.editor.getPosition();
const ret = this.resultHandler(curValue, language);
if (autoSubmit) onChange && onChange(ret.value);
onAfterChange && onAfterChange(ret.value, ret.error, this.editor);
}, 300);
}
// 提交动作
onSubmit() {
const { onSubmit, onChange, language } = this.props;
const curValue = this.editor.getValue();
const ret = this.resultHandler(curValue, language);
if (!ret.error) onChange && onChange(ret.value);
onSubmit && onSubmit(ret.value, ret.error, this.editor);
}
// 值类型转换处理
valueHandler(value, language) {
let tarValue = value || '';
if (language === 'json') {
if (value && typeof value === 'object') {
tarValue = JSON.stringify(value, null, 2);
} else if (value && typeof value === 'string') {
try {
const ret = this.toJson(value);
if (!ret.error) {
tarValue = JSON.stringify(ret.value, null, 2);
}
} catch (err) {
// empty
}
}
} else if (language === 'function') {
if (typeof value === 'function') {
tarValue = value.toString();
}
if (tarValue && typeof tarValue === 'string') {
tarValue = js_beautify(tarValue, { indent_size: 2, indent_empty_lines: true });
}
} else if (language === 'object') {
// 先转成对象,在进行序列化和格式化;
value = value || {};
if (value && typeof value === 'object') {
try {
tarValue = serialize(value, { unsafe: true });
tarValue = js_beautify(tarValue, { indent_size: 2, indent_empty_lines: true });
} catch (err) {
// empty
}
} else if (typeof value === 'string') {
try {
const ret = this.resultHandler(value, 'object');
tarValue = ret.error ? ret.value : serialize(ret.value, { unsafe: true });
tarValue = js_beautify(tarValue, { indent_size: 2, indent_empty_lines: true });
} catch (err) {
// empty
}
}
}
return tarValue;
}
// 结果处理
resultHandler(value, language) {
let ret = { value };
if (language === 'json') {
ret = this.toJson(value);
} else if (language === 'object') {
ret = this.toObject(value);
} else if (language === 'function') {
ret = this.toFunction(value);
}
return ret;
}
// 设置全屏时的动作
fullScreen() {
if (!this.editorRef) return;
// 还原到原来位置;
this.position = this.editor.getPosition();
if (this.state.isFullScreen) {
if (this.editorParentNode) {
if (this.editorParentNode.firstChild) {
this.editorParentNode.insertBefore(this.editorNode, this.editorParentNode.firstChild);
} else {
this.editorParentNode.appendChild(this.editorNode);
}
}
} else {
document.body.appendChild(this.editorNode);
}
// eslint-disable-next-line react/no-access-state-in-setstate
const nextFs = !this.state.isFullScreen;
this.isFullScreenAction = true; // 记录是全屏幕操作
this.setState(
{
isFullScreen: nextFs,
},
() => {
this.editor.updateOptions(nextFs ? this.fullScreenOptions : this.options);
},
);
}
// 美化代码
format() {
if (!this.editor) return;
if (/^\$_obj?\{.*?\}$/m.test(this.editor.getValue())) return;
if (this.props.language === 'json' || this.props.language === 'object' || this.props.language === 'function') {
const tarValue = js_beautify(this.editor.getValue(), { indent_size: 2 });
this.editor.setValue(tarValue);
} else if (this.props.language === 'less' || this.props.language === 'css' || this.props.language === 'scss') {
const tarValue = css_beautify(this.editor.getValue(), { indent_size: 2 });
this.editor.setValue(tarValue);
} else {
this.editor.getAction('editor.action.formatDocument').run();
}
}
// 校验是否是json
toJson(value) {
try {
// eslint-disable-next-line no-new-func
const obj = new Function(`'use strict'; return ${value.replace(/[\r\n\t]/g, '')}`)();
if (typeof obj === 'object' && obj) {
// eslint-disable-next-line no-new-func
const tarValue = new Function(`'use strict'; return ${value}`)();
return { value: JSON.parse(JSON.stringify(tarValue)) };
}
return { error: this.i18n('jsonIllegal'), value };
} catch (err) {
return { error: err, value };
}
}
// 校验是否为object对象
toObject(value) {
try {
// eslint-disable-next-line no-new-func
const obj = new Function(`'use strict';return ${value}`)();
if (obj && typeof obj === 'object') {
if (jsonuri.isCircular(obj)) return { error: this.i18n('circularRef'), value };
return { value: obj };
} else {
return { error: this.i18n('objectIllegal'), value };
}
} catch (err) {
return { error: err, value };
}
}
// 校验是否为function
toFunction(value) {
try {
// eslint-disable-next-line no-new-func
const fun = new Function(`'use strict';return ${value}`)();
if (fun && typeof fun === 'function') {
return { value: fun };
} else {
return { error: this.i18n('functionIllegal'), value };
}
} catch (err) {
return { error: err, value };
}
}
// 注册api和代码片段
registerApiAndSnippet(monaco) {
if (registerApiAndSnippetStatus) return;
registerApiAndSnippetStatus = true;
// 注册this.提示的方法;
const thisSuggestions = [];
Snippets.map((item) => {
if (!item.label || !item.kind || !item.insertText) return;
const tarItem = Object.assign(item, {
label: item.label,
kind: monaco.languages.CompletionItemKind[item.kind],
insertText: item.insertText,
});
if (item.insertTextRules) tarItem.insertTextRules = monaco.languages.CompletionItemInsertTextRule[item.insertTextRules];
thisSuggestions.push(tarItem);
return item;
});
monaco.languages.registerCompletionItemProvider('javascript', {
provideCompletionItems: (model, position) => {
const textUntilPosition = model.getValueInRange({
startLineNumber: position.lineNumber,
startColumn: 1,
endLineNumber: position.lineNumber,
endColumn: position.column,
});
const match = textUntilPosition.match(/(^this\.)|(\sthis\.)/);
const suggestions = match ? thisSuggestions : [];
return { suggestions };
},
triggerCharacters: ['.'],
});
}
}
// const prefix = 'data:text/javascript;charset=utf-8,';
// const baseUrl = 'https://g.alicdn.com/iceluna/iceluna-vendor/0.0.1/';
// window.MonacoEnvironment = {
// getWorkerUrl(label: string) {
// if (label === 'json') {
// return `${prefix}${encodeURIComponent(`
// importScripts('${baseUrl}json.worker.js');`)}`;
// }
// if (['css', 'less', 'scss'].includes(label)) {
// return `${prefix}${encodeURIComponent(`
// importScripts('${baseUrl}css.worker.js');`)}`;
// }
// if (label === 'html') {
// return `${prefix}${encodeURIComponent(`
// importScripts('${baseUrl}html.worker.js');`)}`;
// }
// if (['typescript', 'javascript'].includes(label)) {
// return `${prefix}${encodeURIComponent(`
// importScripts('${baseUrl}typescript.worker.js');`)}`;
// }
// return `${prefix}${encodeURIComponent(`
// importScripts('${baseUrl}editor.worker.js');`)}`;
// },
// };
// eslint-disable-next-line react/no-multi-comp
export default class MonacoEditorButtonView extends PureComponent {
static displayName = 'JsonSetter';
static propTypes = {
locale: PropTypes.string,
messages: PropTypes.object,
};
static defaultProps = {
locale: 'zh-CN',
messages: zhCN,
};
i18n: any;
objectButtonRef: React.RefObject<unknown>;
constructor(props: Readonly) {
super(props);
this.i18n = generateI18n(props.locale, props.messages);
this.objectButtonRef = React.createRef();
// 兼容代码,待去除
window.__ctx.appHelper.constants = window.__ctx.appHelper.constants || {};
}
afterHandler(value: { nrs_temp_field: any }) {
if (!value) return;
return value.nrs_temp_field;
}
beforeHandler(value: any) {
if (!value) return;
return { nrs_temp_field: value };
}
message(type: string, title: any, dom: Element | null) {
Message.show({
type,
title,
duration: 1000,
align: 'cc cc',
overlayProps: {
target: dom,
},
});
}
componentDidMount() {
const { registerApi } = this.props;
const objectButtonThis = this.objectButtonRef;
registerApi &&
registerApi({
show: objectButtonThis.showModal,
hide: objectButtonThis.hideModal,
submit: objectButtonThis.submitHandler,
setValues: objectButtonThis.setValues,
});
}
render() {
const self = this;
const { locale, messages, value, onChange, field, languages, ...restProps } = this.props;
const { id } = field;
const tarRestProps = { ...restProps };
tarRestProps.autoSubmit = true;
tarRestProps.autoFocus = true;
const tarOnSubmit = tarRestProps.onSubmit;
// 确保monaco快捷键保存能出发最外层的保存
tarRestProps.onSubmit = (editorValue, error) => {
const msgDom = document.querySelector('.object-button-overlay .next-dialog-body');
if (error) return this.message('error', this.i18n('formatError'), msgDom);
this.objectButtonRef &&
this.objectButtonRef.current &&
this.objectButtonRef.current.submitHandler(() => {
this.message('success', this.i18n('saved'), msgDom);
});
};
const tarObjProps = {};
tarObjProps.className = 'luna-monaco-button';
if (tarRestProps['data-meta']) {
delete tarRestProps['data-meta'];
tarObjProps['data-meta'] = 'Field';
}
tarObjProps.id = id;
tarObjProps.value = value || '';
tarObjProps.onChange = onChange;
const tarRule = [];
// 判断如果是jsonfunction, object等类型自动追加校验规则
if (tarRestProps.language && ['json', 'function', 'object'].includes(tarRestProps.language)) {
if (['json', 'object'].includes(tarRestProps.language)) {
tarRule.push({
validator(validatorValue: any, callback: (arg0: undefined) => void) {
if (typeof validatorValue !== 'object') {
callback(self.i18n('formatError'));
} else {
callback();
}
},
});
} else {
tarRule.push({
validator(validatorValue: any, callback: (arg0: undefined) => void) {
if (typeof validatorValue !== 'function') {
callback(self.i18n('formatError'));
} else {
callback();
}
},
});
}
}
return (
<div>
<ObjectButton
locale={locale}
messages={messages}
{...tarObjProps}
ref={this.objectButtonRef}
beforeHandler={this.beforeHandler.bind(this)}
afterHandler={this.afterHandler.bind(this)}
onSubmit={tarOnSubmit}
>
<FormItem name="nrs_temp_field" rules={tarRule}>
<MonacoEditorDefaultView {...tarRestProps} registerApi={(apis: any) => Object.assign(this, apis)} />
</FormItem>
</ObjectButton>
</div>
);
}
}

View File

@ -1,242 +0,0 @@
export default [
{
label: 'constants',
kind: 'Class',
insertText: 'constants',
detail: '应用全局常量',
documentation: '应用范围定义的通用常量',
},
{
label: 'utils',
kind: 'Class',
insertText: 'utils',
detail: '应用全局公共函数',
documentation: '应用范围扩展的公共函数',
},
{
label: 'state',
kind: 'Enum',
insertText: 'state',
detail: '当前所在容器组件内部状态',
documentation: 'React Class内部状态state',
},
{
label: 'setState',
kind: 'Function',
insertText: 'setState({\n\t$0\n})',
insertTextRules: 'InsertAsSnippet',
detail: '设置当前所在容器组件的state数据',
documentation: '原生React方法会自动更新组件视图',
},
{
label: 'reloadDataSource',
kind: 'Function',
insertText: 'reloadDataSource(${1:${2:namespace}, ${3:false}, ${4:callback}})',
insertTextRules: 'InsertAsSnippet',
detail: '刷新当前所在的容器组件',
documentation: '触发当前所在的容器组件,重新发送异步请求,并用最新数据更新视图',
},
{
label: 'location',
kind: 'Class',
insertText: 'location',
detail: '路由解析对象',
},
{
label: 'location.query',
kind: 'Value',
insertText: 'location.query.${1:xxxx}',
insertTextRules: 'InsertAsSnippet',
detail: '从路由解析对象中获取参数信息',
},
{
label: 'history',
kind: 'Class',
insertText: 'history',
detail: '路由历史对象',
},
{
label: 'React',
kind: 'Keyword',
insertText: 'React',
detail: 'React对象',
},
{
label: 'ReactDOM',
kind: 'Keyword',
insertText: 'ReactDOM',
detail: 'ReactDom对象',
},
{
label: 'ReactDOM.findDOMNode',
kind: 'Function',
insertText: 'ReactDOM.findDOMNode(${1:this.refs.xxxx})',
insertTextRules: 'InsertAsSnippet',
detail: 'ReactDom查找真实dom node',
},
{
label: 'Dialog.alert',
kind: 'Method',
insertText: [
'Dialog.alert({',
"\tcontent: '${1:Alert content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: 'alert弹框 By Fusion',
},
{
label: 'Dialog.confirm',
kind: 'Method',
insertText: [
'Dialog.confirm({',
"\tcontent: '${1:Confirm content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '确认弹出框 By Fusion',
},
{
label: 'Message.success',
kind: 'Method',
insertText: 'Message.success(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '成功反馈提示 By Fusion',
},
{
label: 'Message.error',
kind: 'Method',
insertText: 'Message.error(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '错误反馈提示 By Fusion',
},
{
label: 'Message.help',
kind: 'Method',
insertText: 'Message.help(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '帮助反馈提示 By Fusion',
},
{
label: 'Message.loading',
kind: 'Method',
insertText: 'Message.loading(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: 'loading反馈提示 By Fusion',
},
{
label: 'Message.notice',
kind: 'Method',
insertText: 'Message.notice(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '注意反馈提示 By Fusion',
},
{
label: 'Message.waining',
kind: 'Method',
insertText: 'Message.waining(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '警告反馈提示 By Fusion',
},
{
label: 'Modal.confirm',
kind: 'Method',
insertText: [
'Modal.confirm({',
"\tcontent: '${1:Confirm content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '确认弹出框 By Antd',
},
{
label: 'Modal.info',
kind: 'Method',
insertText: [
'Modal.info({',
"\tcontent: '${1:Info content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '信息弹出框 By Antd',
},
{
label: 'Modal.success',
kind: 'Method',
insertText: [
'Modal.success({',
"\tcontent: '${1:Success content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '成功弹出框 By Antd',
},
{
label: 'Modal.error',
kind: 'Method',
insertText: [
'Modal.error({',
"\tcontent: '${1:Error content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '错误弹出框 By Antd',
},
{
label: 'Modal.warning',
kind: 'Method',
insertText: [
'Modal.warning({',
"\tcontent: '${1:Warning content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '警告弹出框 By Antd',
},
];

View File

@ -1,21 +0,0 @@
import IntlMessageFormat from 'intl-messageformat';
export const isJSExpression = (obj = '') => {
if (obj && typeof obj === 'object' && obj.type === 'JSExpression') {
return true;
}
return false;
};
/**
*
* @param {*} locale zh-CNen-US
* @param {*} messages
*/
export const generateI18n = (locale = 'zh-CN', messages = {}) => {
return function (key, values = {}) {
if (!messages || !messages[key]) return '';
const formater = new IntlMessageFormat(messages[key], locale);
return formater.format(values);
};
};

View File

@ -1,36 +0,0 @@
export default {
// function
setting: '点击设置',
edit: '编辑',
submitConfirm: '确认提交 cmd+s',
close: '关闭 esc',
fullScreen: '全屏',
cancelFullScreen: '取消全屏',
jsonIllegal: '非json格式',
functionIllegal: '非function格式',
objectIllegal: '非object格式',
circularRef: '对象中出现循环引用的对象',
formatError: '格式错误',
saved: '已保存',
// expression
valueIllegal: '值类型为对象类型,与当前组件属性设置的控件类型不匹配,请在属性“代码编辑模式”下进行编辑',
jsExpression: '请输入JS表达式',
// Mixin
input: '字符串Input',
textarea: '多行字符串Textarea',
expression: '变量控件Expression',
monacoEditor: '编辑器MonacoEditor',
numberPicker: '数字NumberPicker',
bool: '布尔Switch',
datePicker: '日期选择DatePicker',
select: '下拉选择Select',
radio: '单项选择RadioGroup',
date: '日期选择DatePicker',
dateYear: '年选择DatePicker',
dateMonth: '月选择DatePicker',
dateRange: '日期区间选择DatePicker',
list: '数组List',
object: '对象ObjectButton',
reactNode: '节点类型ReactNode',
typeError: 'Minix组件属性Types配置错误存在不支持类型[{type}],请检查组件属性配置',
};

View File

@ -1,242 +0,0 @@
export default [
{
label: 'constants',
kind: 'Class',
insertText: 'constants',
detail: '应用全局常量',
documentation: '应用范围定义的通用常量',
},
{
label: 'utils',
kind: 'Class',
insertText: 'utils',
detail: '应用全局公共函数',
documentation: '应用范围扩展的公共函数',
},
{
label: 'state',
kind: 'Enum',
insertText: 'state',
detail: '当前所在容器组件内部状态',
documentation: 'React Class内部状态state',
},
{
label: 'setState',
kind: 'Function',
insertText: 'setState({\n\t$0\n})',
insertTextRules: 'InsertAsSnippet',
detail: '设置当前所在容器组件的state数据',
documentation: '原生React方法会自动更新组件视图',
},
{
label: 'reloadDataSource',
kind: 'Function',
insertText: 'reloadDataSource(${1:${2:namespace}, ${3:false}, ${4:callback}})',
insertTextRules: 'InsertAsSnippet',
detail: '刷新当前所在的容器组件',
documentation: '触发当前所在的容器组件,重新发送异步请求,并用最新数据更新视图',
},
{
label: 'location',
kind: 'Class',
insertText: 'location',
detail: '路由解析对象',
},
{
label: 'location.query',
kind: 'Value',
insertText: 'location.query.${1:xxxx}',
insertTextRules: 'InsertAsSnippet',
detail: '从路由解析对象中获取参数信息',
},
{
label: 'history',
kind: 'Class',
insertText: 'history',
detail: '路由历史对象',
},
{
label: 'React',
kind: 'Keyword',
insertText: 'React',
detail: 'React对象',
},
{
label: 'ReactDOM',
kind: 'Keyword',
insertText: 'ReactDOM',
detail: 'ReactDom对象',
},
{
label: 'ReactDOM.findDOMNode',
kind: 'Function',
insertText: 'ReactDOM.findDOMNode(${1:this.refs.xxxx})',
insertTextRules: 'InsertAsSnippet',
detail: 'ReactDom查找真实dom node',
},
{
label: 'Dialog.alert',
kind: 'Method',
insertText: [
'Dialog.alert({',
"\tcontent: '${1:Alert content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: 'alert弹框 By Fusion',
},
{
label: 'Dialog.confirm',
kind: 'Method',
insertText: [
'Dialog.confirm({',
"\tcontent: '${1:Confirm content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '确认弹出框 By Fusion',
},
{
label: 'Message.success',
kind: 'Method',
insertText: 'Message.success(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '成功反馈提示 By Fusion',
},
{
label: 'Message.error',
kind: 'Method',
insertText: 'Message.error(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '错误反馈提示 By Fusion',
},
{
label: 'Message.help',
kind: 'Method',
insertText: 'Message.help(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '帮助反馈提示 By Fusion',
},
{
label: 'Message.loading',
kind: 'Method',
insertText: 'Message.loading(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: 'loading反馈提示 By Fusion',
},
{
label: 'Message.notice',
kind: 'Method',
insertText: 'Message.notice(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '注意反馈提示 By Fusion',
},
{
label: 'Message.waining',
kind: 'Method',
insertText: 'Message.waining(${1:content})',
insertTextRules: 'InsertAsSnippet',
detail: '警告反馈提示 By Fusion',
},
{
label: 'Modal.confirm',
kind: 'Method',
insertText: [
'Modal.confirm({',
"\tcontent: '${1:Confirm content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '确认弹出框 By Antd',
},
{
label: 'Modal.info',
kind: 'Method',
insertText: [
'Modal.info({',
"\tcontent: '${1:Info content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '信息弹出框 By Antd',
},
{
label: 'Modal.success',
kind: 'Method',
insertText: [
'Modal.success({',
"\tcontent: '${1:Success content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '成功弹出框 By Antd',
},
{
label: 'Modal.error',
kind: 'Method',
insertText: [
'Modal.error({',
"\tcontent: '${1:Error content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '错误弹出框 By Antd',
},
{
label: 'Modal.warning',
kind: 'Method',
insertText: [
'Modal.warning({',
"\tcontent: '${1:Warning content}',",
"\ttitle: '${2:Title}',",
'\tonOk: () => {',
'\t\t$3',
'\t},',
'\tonCancel: () => {',
'\t\t$4',
'\t}',
'})',
].join('\n'),
insertTextRules: 'InsertAsSnippet',
detail: '警告弹出框 By Antd',
},
];

View File

@ -1,21 +0,0 @@
import IntlMessageFormat from 'intl-messageformat';
export const isJSExpression = (obj = '') => {
if (obj && typeof obj === 'object' && obj.type === 'JSExpression') {
return true;
}
return false;
};
/**
*
* @param {*} locale zh-CNen-US
* @param {*} messages
*/
export const generateI18n = (locale = 'zh-CN', messages = {}) => {
return function (key, values = {}) {
if (!messages || !messages[key]) return '';
const formater = new IntlMessageFormat(messages[key], locale);
return formater.format(values);
};
};

View File

@ -1,36 +0,0 @@
export default {
// function
setting: '点击设置',
edit: '编辑',
submitConfirm: '确认提交 cmd+s',
close: '关闭 esc',
fullScreen: '全屏',
cancelFullScreen: '取消全屏',
jsonIllegal: '非json格式',
functionIllegal: '非function格式',
objectIllegal: '非object格式',
circularRef: '对象中出现循环引用的对象',
formatError: '格式错误',
saved: '已保存',
// expression
valueIllegal: '值类型为对象类型,与当前组件属性设置的控件类型不匹配,请在属性“代码编辑模式”下进行编辑',
jsExpression: '请输入JS表达式',
// Mixin
input: '字符串Input',
textarea: '多行字符串Textarea',
expression: '变量控件Expression',
monacoEditor: '编辑器MonacoEditor',
numberPicker: '数字NumberPicker',
bool: '布尔Switch',
datePicker: '日期选择DatePicker',
select: '下拉选择Select',
radio: '单项选择RadioGroup',
date: '日期选择DatePicker',
dateYear: '年选择DatePicker',
dateMonth: '月选择DatePicker',
dateRange: '日期区间选择DatePicker',
list: '数组List',
object: '对象ObjectButton',
reactNode: '节点类型ReactNode',
typeError: 'Minix组件属性Types配置错误存在不支持类型[{type}],请检查组件属性配置',
};

View File

@ -1,161 +0,0 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Dropdown, Button, Menu, Icon } from '@alifd/next';
import { getSetter } from '@ali/lowcode-editor-core';
import { generateI18n } from './locale/utils';
import zhCN from './locale/zh-CN';
import './index.scss';
export default class Mixed extends PureComponent {
static displayName = 'Mixed';
static propTypes = {
locale: PropTypes.string,
messages: PropTypes.object,
defaultType: PropTypes.string,
types: PropTypes.arrayOf(PropTypes.string),
inputProps: PropTypes.object,
expressionProps: PropTypes.object,
monacoEditorProps: PropTypes.object,
switchProps: PropTypes.object,
selectProps: PropTypes.object,
radioGroupProps: PropTypes.object,
};
static defaultProps = {
locale: 'zh-CN',
messages: zhCN,
types: [
{
name: 'StringSetter',
props: {},
},
],
};
typeMap: any;
i18n: (key: any, values) => string | void | Array<string | void>;
constructor(props: Readonly) {
super(props);
const type = props.defaultType; // judgeTypeHandler(props, {});
this.i18n = generateI18n(props.locale, props.messages);
this.state = {
type,
};
}
changeType(type: string) {
if (typeof type === 'object' || type === this.state.type) return;
const { onChange } = this.props;
let newValue;
const setterProps = this.typeMap[type].props;
if (setterProps) {
if (setterProps.value !== undefined) {
newValue = setterProps.value;
} else if (setterProps.defaultValue !== undefined) {
newValue = setterProps.defaultValue;
}
}
if (type === 'BoolSetter' && newValue === undefined) {
newValue = false; // 给切换到switch默认值为false
}
this.setState({ type });
onChange && onChange(newValue);
}
render() {
const { style = {}, className, locale, messages, types = [], defaultType, ...restProps } = this.props;
this.typeMap = {};
const realTypes: any[] = [];
types.forEach((el: { name: any; props: any }) => {
const { name, props } = el;
const Setter = getSetter(name);
if (Setter) {
this.typeMap[name] = {
label: name,
component: Setter.component,
props,
};
}
realTypes.push(name);
});
let moreBtnNode = null;
// 如果只有2种且有变量表达式则直接展示变量按钮
if (realTypes.length > 1) {
const isTwoType = !!(realTypes.length === 2 && ~realTypes.indexOf('ExpressionSetter'));
const btnProps = {
size: 'small',
text: true,
style: {
position: 'absolute',
left: '100%',
top: 0,
bottom: 0,
margin: 'auto 0 auto 8px',
padding: 0,
width: 16,
height: 16,
lineHeight: '16px',
textAlign: 'center',
},
};
if (isTwoType) {
btnProps.onClick = this.changeType.bind(this, realTypes.indexOf(this.state.type) ? realTypes[0] : realTypes[1]);
}
const triggerNode = (
<Button {...btnProps} size={isTwoType ? 'large' : 'small'}>
<Icon type={isTwoType ? 'edit' : 'ellipsis'} />
</Button>
);
if (isTwoType) {
moreBtnNode = triggerNode;
} else {
// eslint-disable-next-line @typescript-eslint/ban-types
const MenuItems: {} | null | undefined = [];
realTypes.map((type) => {
if (this.typeMap[type]) {
MenuItems.push(<Menu.Item key={type}>{this.typeMap[type].label}</Menu.Item>);
} else {
console.error(
this.i18n('typeError', {
type,
}),
);
}
return type;
});
const MenuNode = (
<Menu
selectMode="single"
hasSelectedIcon={false}
selectedKeys={this.state.type}
onItemClick={this.changeType.bind(this)}
>
{MenuItems}
</Menu>
);
moreBtnNode = (
<Dropdown trigger={triggerNode} triggerType="click">
{MenuNode}
</Dropdown>
);
}
}
const TargetNode = this.typeMap[this.state.type]?.component || 'div';
const targetProps = this.typeMap[this.state.type]?.props || {};
const tarStyle = { position: 'relative', ...style };
const classes = classNames(className, 'lowcode-setter-mixin');
return (
<div style={tarStyle} className={classes}>
<TargetNode {...restProps} {...targetProps} />
{moreBtnNode}
</div>
);
}
}

View File

@ -1,21 +0,0 @@
import IntlMessageFormat from 'intl-messageformat';
export const isJSExpression = (obj = '') => {
if (obj && typeof obj === 'object' && obj.type === 'JSExpression') {
return true;
}
return false;
};
/**
*
* @param {*} locale zh-CNen-US
* @param {*} messages
*/
export const generateI18n = (locale = 'zh-CN', messages = {}) => {
return function (key, values = {}) {
if (!messages || !messages[key]) return '';
const formater = new IntlMessageFormat(messages[key], locale);
return formater.format(values);
};
};

View File

@ -1,36 +0,0 @@
export default {
// function
setting: '点击设置',
edit: '编辑',
submitConfirm: '确认提交 cmd+s',
close: '关闭 esc',
fullScreen: '全屏',
cancelFullScreen: '取消全屏',
jsonIllegal: '非json格式',
functionIllegal: '非function格式',
objectIllegal: '非object格式',
circularRef: '对象中出现循环引用的对象',
formatError: '格式错误',
saved: '已保存',
// expression
valueIllegal: '值类型为对象类型,与当前组件属性设置的控件类型不匹配,请在属性“代码编辑模式”下进行编辑',
jsExpression: '请输入JS表达式',
// Mixin
input: '字符串Input',
textarea: '多行字符串Textarea',
expression: '变量控件Expression',
monacoEditor: '编辑器MonacoEditor',
numberPicker: '数字NumberPicker',
bool: '布尔Switch',
datePicker: '日期选择DatePicker',
select: '下拉选择Select',
radio: '单项选择RadioGroup',
date: '日期选择DatePicker',
dateYear: '年选择DatePicker',
dateMonth: '月选择DatePicker',
dateRange: '日期区间选择DatePicker',
list: '数组List',
object: '对象ObjectButton',
reactNode: '节点类型ReactNode',
typeError: 'Minix组件属性Types配置错误存在不支持类型[{type}],请检查组件属性配置',
};

View File

@ -1,37 +0,0 @@
import './style.less';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import LowStyleSetter from '@ali/lc-style-setter';
import { globalLocale } from '@ali/lowcode-editor-core';
export default class StyleSetter extends Component {
static displayName = 'StyleSetter';
static propTypes = {
value: PropTypes.object,
onChange: PropTypes.func,
placeholder: PropTypes.string,
locale: PropTypes.string,
};
static defaultProps = {
value: {},
onChange: () => { },
placeholder: '',
locale: globalLocale.getLocale() || 'en-US',
};
onChange = (val: any) => {
const { onChange } = this.props;
onChange(val.native);
};
render() {
const { value } = this.props;
return (
<div className="lc-block-setter">
<LowStyleSetter {...this.props} value={value} onChange={this.onChange} />
</div>
);
}
}