├── Makefile ├── .github └── .gitkeep ├── docker └── .gitkeep ├── scripts └── .gitkeep ├── li-app ├── resource │ ├── template │ │ └── .gitkeep │ └── public │ │ └── locales │ │ ├── zh-CN.json │ │ └── en-US.json ├── internal │ ├── app │ │ └── admin │ │ │ ├── service │ │ │ └── .gitkeep │ │ │ ├── consts │ │ │ └── view.go │ │ │ ├── dto │ │ │ └── user.go │ │ │ ├── view │ │ │ ├── blog.tag.go │ │ │ ├── blog.post.go │ │ │ ├── system.user.go │ │ │ ├── blog.comment.go │ │ │ ├── app.sign.go │ │ │ ├── dashboard.workplace.go │ │ │ └── app.nav.go │ │ │ ├── controller │ │ │ └── user.go │ │ │ └── admin.go │ ├── data │ │ ├── data.go │ │ ├── ent │ │ │ ├── generate.go │ │ │ ├── schema │ │ │ │ ├── role.go │ │ │ │ └── tag.go │ │ │ └── entc.go │ │ ├── user.go │ │ └── hook │ │ │ └── user.go │ ├── pkg │ │ └── wf │ │ │ ├── executor │ │ │ └── approval_task.go │ │ │ └── wf.go │ ├── shared │ │ ├── shared.go │ │ └── context.go │ ├── middleware │ │ ├── cors.go │ │ ├── err.go │ │ ├── auth.go │ │ └── ctx.go │ └── cmd │ │ ├── cmd_migrate.go │ │ ├── cmd_user.go │ │ ├── cmd_run.go │ │ └── cmd.go ├── docker │ └── docker-compose.yaml ├── li.go ├── Makefile ├── script │ └── entclean.sh ├── go.mod └── config │ └── config.dev.yaml ├── li-engine ├── view │ ├── mixin │ │ └── .gitkeep │ ├── node │ │ ├── node_calendar.go │ │ ├── node_cascader.go │ │ ├── node_code.go │ │ ├── node_image.go │ │ ├── node_markdown.go │ │ ├── node_richtext.go │ │ ├── node_table.go │ │ ├── node_treeselect.go │ │ ├── node_phone.go │ │ ├── node_chart.go │ │ ├── node_email.go │ │ ├── node_form.go │ │ ├── node_actionformmodalcancel.go │ │ ├── node_actionformdrawercancel.go │ │ ├── node_dropdownmenuitem.go │ │ ├── node_arrayitemsindex.go │ │ ├── node_arraytableindex.go │ │ ├── node_arrayitemsremove.go │ │ ├── node_arrayitemsmoveup.go │ │ ├── node_arraytablemoveup.go │ │ ├── node_arraytableremove.go │ │ ├── node_dropdownmenusubmenu.go │ │ ├── node_arrayitemsmovedown.go │ │ ├── node_arraytablemovedown.go │ │ ├── node_arrayitemssorthandle.go │ │ ├── node_arraytablesorthandle.go │ │ ├── node_tabstabpane.go │ │ ├── node_listaction.go │ │ ├── node_dropdownmenuurl.go │ │ ├── node_listcard.go │ │ ├── node_checkbox.go │ │ ├── node_colorselect.go │ │ ├── node_divider.go │ │ ├── node_gridcol.go │ │ ├── node_listactionsearch.go │ │ ├── node_percent.go │ │ ├── node_gridrow.go │ │ ├── node_actionformmodalsubmit.go │ │ ├── node_avatar.go │ │ ├── node_actionformdrawersubmit.go │ │ ├── node_arrayitems.go │ │ ├── node_rate.go │ │ ├── node_money.go │ │ ├── node_password.go │ │ ├── node_uploadavatar.go │ │ ├── node_dropdownmenu.go │ │ ├── node_space.go │ │ └── node_checkboxgroup.go │ └── com │ │ ├── com_langswitch.go │ │ └── com_themeswitch.go ├── contrib │ ├── lient │ │ ├── internal │ │ │ ├── main.go │ │ │ └── ent │ │ │ │ ├── generate.go │ │ │ │ ├── entc.go │ │ │ │ └── schema │ │ │ │ └── tag.go │ │ ├── extension.go │ │ ├── util.go │ │ ├── template │ │ │ ├── import.tmpl │ │ │ └── db.tmpl │ │ ├── sqlx │ │ │ ├── utils.go │ │ │ └── sqlx.go │ │ ├── template.go │ │ ├── mixin │ │ │ ├── id_mixin.go │ │ │ └── time_mixin.go │ │ └── driver │ │ │ └── helper.go │ ├── liflow │ │ ├── ent │ │ │ ├── generate.go │ │ │ ├── runtime │ │ │ │ └── runtime.go │ │ │ ├── entc.go │ │ │ ├── predicate │ │ │ │ └── predicate.go │ │ │ ├── context.go │ │ │ ├── db.go │ │ │ ├── schema │ │ │ │ ├── flow_instance_data.go │ │ │ │ ├── flow_node_instance_log.go │ │ │ │ ├── flow_instance.go │ │ │ │ ├── flow_deployment.go │ │ │ │ ├── flow_definition.go │ │ │ │ ├── flow_node_instance.go │ │ │ │ └── flow_instance_comment.go │ │ │ └── config.go │ │ ├── executor │ │ │ ├── sequence_flow.go │ │ │ ├── exclusive_gateway.go │ │ │ ├── start_event.go │ │ │ └── end_event.go │ │ ├── liflow_test.go │ │ ├── liflow.go │ │ ├── processor │ │ │ ├── processor.go │ │ │ └── terminate_process.go │ │ └── enthook.go │ └── lifile │ │ └── lifile.go ├── go.mod ├── controller │ ├── internal │ │ └── reflection │ │ │ └── reflection.go │ ├── file_preview.go │ └── file_upload.go └── service │ └── file.go ├── li-web ├── README.md ├── packages │ ├── pro-components │ │ ├── src │ │ │ ├── li-flow │ │ │ │ ├── index.less │ │ │ │ ├── nodes │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── SequenceFlow.ts │ │ │ │ │ └── ExclusiveGateway.ts │ │ │ │ └── components │ │ │ │ │ └── NodePanel │ │ │ │ │ └── index.tsx │ │ │ ├── index.ts │ │ │ ├── li-editor │ │ │ │ └── index.tsx │ │ │ ├── docs │ │ │ │ ├── li-editor.md │ │ │ │ └── li-flow.md │ │ │ └── locale │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ ├── zh-CN.ts │ │ │ │ └── en-US.ts │ │ ├── .eslintrc.js │ │ ├── tsconfig.json │ │ ├── .umirc.ts │ │ └── package.json │ ├── pro-utils │ │ ├── src │ │ │ ├── nanoid │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── .eslintrc.js │ │ ├── tsconfig.json │ │ └── package.json │ ├── schema-components │ │ ├── src │ │ │ ├── components │ │ │ │ ├── list │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── List.Card.tsx │ │ │ │ │ └── context.ts │ │ │ │ ├── action │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── Action.Modal.tsx │ │ │ │ │ ├── Action.tsx │ │ │ │ │ └── types.ts │ │ │ │ ├── chart │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── context.ts │ │ │ │ │ ├── utils.ts │ │ │ │ │ ├── Chart.tsx │ │ │ │ │ └── index.less │ │ │ │ ├── input-number │ │ │ │ │ ├── utils │ │ │ │ │ │ └── supportUtil.ts │ │ │ │ │ └── index.tsx │ │ │ │ ├── __builtins__ │ │ │ │ │ ├── hooks │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── getPrefixCls.ts │ │ │ │ │ │ ├── getLocale.ts │ │ │ │ │ │ ├── usePrefixCls.ts │ │ │ │ │ │ └── useCollapseGrid.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── utils.ts │ │ │ │ │ ├── pickDataProps.ts │ │ │ │ │ ├── loading.ts │ │ │ │ │ └── icon.tsx │ │ │ │ ├── form-grid │ │ │ │ │ └── index.less │ │ │ │ ├── text-editor │ │ │ │ │ └── index.tsx │ │ │ │ ├── input │ │ │ │ │ └── index.less │ │ │ │ ├── switch │ │ │ │ │ └── index.tsx │ │ │ │ ├── card-item │ │ │ │ │ └── index.tsx │ │ │ │ ├── divider │ │ │ │ │ └── index.tsx │ │ │ │ ├── form-button-group │ │ │ │ │ └── index.less │ │ │ │ ├── grid │ │ │ │ │ └── index.tsx │ │ │ │ ├── upload │ │ │ │ │ └── types.ts │ │ │ │ ├── avatar │ │ │ │ │ └── index.tsx │ │ │ │ ├── select │ │ │ │ │ └── shared.ts │ │ │ │ ├── array-base │ │ │ │ │ └── index.less │ │ │ │ ├── space │ │ │ │ │ └── index.tsx │ │ │ │ ├── time-picker │ │ │ │ │ └── index.tsx │ │ │ │ ├── index.ts │ │ │ │ ├── radio │ │ │ │ │ └── index.tsx │ │ │ │ ├── array-table │ │ │ │ │ └── index.less │ │ │ │ ├── reset │ │ │ │ │ └── index.tsx │ │ │ │ ├── tabs │ │ │ │ │ └── index.tsx │ │ │ │ ├── date-picker │ │ │ │ │ └── index.tsx │ │ │ │ └── array-items │ │ │ │ │ └── index.less │ │ │ ├── locale │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ ├── zh-CN.tsx │ │ │ │ └── en-US.tsx │ │ │ ├── index.ts │ │ │ ├── hooks │ │ │ │ ├── index.ts │ │ │ │ ├── useSchemaComponentContext.ts │ │ │ │ ├── useComponent.ts │ │ │ │ ├── useCompile.ts │ │ │ │ ├── useAttach.ts │ │ │ │ └── useFieldProps.ts │ │ │ ├── context.ts │ │ │ ├── core │ │ │ │ ├── index.ts │ │ │ │ ├── RecordProvider.tsx │ │ │ │ ├── SchemaComponentOptions.tsx │ │ │ │ ├── SchemaFormField.tsx │ │ │ │ └── SchemaComponent.tsx │ │ │ └── types.ts │ │ ├── .eslintrc.js │ │ ├── tsconfig.json │ │ ├── .umirc.ts │ │ └── package.json │ ├── tsconfig │ │ ├── package.json │ │ ├── react-library.json │ │ └── base.json │ └── config │ │ ├── eslint-preset.js │ │ └── package.json ├── .npmrc ├── apps │ └── admin │ │ ├── src │ │ ├── vite-env.d.ts │ │ ├── modules │ │ │ ├── components │ │ │ │ ├── index.ts │ │ │ │ └── Loading.tsx │ │ │ ├── schema-components │ │ │ │ ├── index.ts │ │ │ │ ├── theme-switch │ │ │ │ │ └── index.tsx │ │ │ │ └── lang-switch │ │ │ │ │ └── index.tsx │ │ │ ├── route-switch │ │ │ │ ├── index.ts │ │ │ │ ├── context.ts │ │ │ │ ├── RouteSwitchProvider.tsx │ │ │ │ ├── types.ts │ │ │ │ ├── hooks.ts │ │ │ │ └── RouteSwitch.tsx │ │ │ ├── index.ts │ │ │ ├── application │ │ │ │ └── index.tsx │ │ │ ├── record-provider │ │ │ │ └── index.tsx │ │ │ ├── async-data-provider │ │ │ │ └── index.tsx │ │ │ ├── i18n │ │ │ │ └── index.ts │ │ │ ├── document-title │ │ │ │ └── index.tsx │ │ │ └── sign-page │ │ │ │ └── index.tsx │ │ ├── context.ts │ │ ├── assets │ │ │ ├── dark.svg │ │ │ └── logo.svg │ │ └── style │ │ │ └── global.less │ │ ├── .eslintrc.js │ │ ├── tsconfig.json │ │ ├── mock │ │ ├── getCurrentUser.ts │ │ ├── getUv.ts │ │ └── listUser.ts │ │ ├── index.html │ │ ├── config │ │ └── proxy.ts │ │ └── vite.config.ts ├── pnpm-workspace.yaml ├── Makefile ├── turbo.json ├── .editorconfig ├── .prettierignore ├── .gitignore └── package.json ├── go.mod ├── docs └── assets │ ├── li1.png │ └── li2.png ├── .gitignore └── README.md /Makefile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /li-app/resource/template/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /li-engine/view/mixin/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /li-web/README.md: -------------------------------------------------------------------------------- 1 | # li-web 2 | -------------------------------------------------------------------------------- /li-app/internal/app/admin/service/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /li-app/internal/data/data.go: -------------------------------------------------------------------------------- 1 | package data 2 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/BeanWei/li 2 | 3 | go 1.16 -------------------------------------------------------------------------------- /li-app/docker/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_calendar.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_cascader.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_code.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_image.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_markdown.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_richtext.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_table.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/li-flow/index.less: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /li-engine/contrib/lient/internal/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | -------------------------------------------------------------------------------- /li-engine/view/node/node_treeselect.go: -------------------------------------------------------------------------------- 1 | package node 2 | -------------------------------------------------------------------------------- /li-web/.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmmirror.com 2 | -------------------------------------------------------------------------------- /li-web/packages/pro-utils/src/nanoid/index.ts: -------------------------------------------------------------------------------- 1 | export * from "nanoid"; 2 | -------------------------------------------------------------------------------- /li-app/resource/public/locales/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "Li Admin": "❤️璃❤️" 3 | } -------------------------------------------------------------------------------- /li-web/apps/admin/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /li-web/pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "apps/*" 3 | - "packages/*" 4 | -------------------------------------------------------------------------------- /li-web/apps/admin/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require("eslint-preset-acme"); 2 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/components/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Loading"; 2 | -------------------------------------------------------------------------------- /docs/assets/li1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeanWei/li/HEAD/docs/assets/li1.png -------------------------------------------------------------------------------- /docs/assets/li2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BeanWei/li/HEAD/docs/assets/li2.png -------------------------------------------------------------------------------- /li-web/packages/pro-utils/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require("eslint-preset-acme"); 2 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/list/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./List"; 2 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require("eslint-preset-acme"); 2 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require("eslint-preset-acme"); 2 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/action/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Action"; 2 | -------------------------------------------------------------------------------- /li-app/internal/data/ent/generate.go: -------------------------------------------------------------------------------- 1 | package ent 2 | 3 | //go:generate go run -mod=mod entc.go 4 | -------------------------------------------------------------------------------- /li-engine/contrib/liflow/ent/generate.go: -------------------------------------------------------------------------------- 1 | package ent 2 | 3 | //go:generate go run -mod=mod entc.go 4 | -------------------------------------------------------------------------------- /li-web/packages/pro-utils/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./request"; 2 | export * from "./nanoid"; 3 | -------------------------------------------------------------------------------- /li-app/internal/app/admin/consts/view.go: -------------------------------------------------------------------------------- 1 | package consts 2 | 3 | const ( 4 | AppEntry = "/admin" 5 | ) 6 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./li-editor"; 2 | export * from "./li-flow"; 3 | -------------------------------------------------------------------------------- /li-engine/contrib/lient/internal/ent/generate.go: -------------------------------------------------------------------------------- 1 | package ent 2 | 3 | //go:generate go run -mod=mod entc.go 4 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/locale/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./zh-CN"; 2 | export * from "./en-US"; 3 | -------------------------------------------------------------------------------- /li-app/resource/public/locales/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "登录": "Login", 3 | "邮箱": "Email", 4 | "密码": "Password" 5 | } 6 | -------------------------------------------------------------------------------- /li-app/internal/data/ent/schema/role.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | const ( 4 | RoleSystemManager = "SystemManager" 5 | ) 6 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/schema-components/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./lang-switch"; 2 | export * from "./theme-switch"; 3 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/chart/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./ChartItem"; 2 | export * from "./Chart"; 3 | -------------------------------------------------------------------------------- /li-engine/contrib/liflow/executor/sequence_flow.go: -------------------------------------------------------------------------------- 1 | package executor 2 | 3 | type SequenceFlowExecutor struct { 4 | ElementExecutor 5 | } 6 | -------------------------------------------------------------------------------- /li-engine/contrib/liflow/liflow_test.go: -------------------------------------------------------------------------------- 1 | package liflow 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func Test_LiFlow(t *testing.T) { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /li-web/apps/admin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tsconfig/react-library.json", 3 | "exclude": ["dist", "build", "node_modules"], 4 | "include": ["src"] 5 | } 6 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/input-number/utils/supportUtil.ts: -------------------------------------------------------------------------------- 1 | export function supportBigInt() { 2 | return typeof BigInt === "function"; 3 | } 4 | -------------------------------------------------------------------------------- /li-web/packages/pro-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tsconfig/react-library.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tsconfig/react-library.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tsconfig/react-library.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./components"; 2 | export * from "./context"; 3 | export * from "./core"; 4 | export * from "./types"; 5 | export * from "./locale"; 6 | -------------------------------------------------------------------------------- /li-app/li.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-app/internal/cmd" 5 | "github.com/gogf/gf/v2/os/gctx" 6 | ) 7 | 8 | func main() { 9 | cmd.Li.Run(gctx.New()) 10 | } 11 | -------------------------------------------------------------------------------- /li-app/Makefile: -------------------------------------------------------------------------------- 1 | generate: 2 | go generate ./... 3 | 4 | migrate: 5 | go run li.go migrate 6 | 7 | entclean: 8 | bash ./script/entclean.sh 9 | 10 | run: 11 | go run li.go run --gf.gmode=develop 12 | -------------------------------------------------------------------------------- /li-web/apps/admin/mock/getCurrentUser.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | nickname: "阿璃", 3 | avatar: 4 | "https://lf1-xgcdn-tos.pstatp.com/obj/vcloud/vadmin/start.8e0e4855ee346a46ccff8ff3e24db27b.png", 5 | }; 6 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/li-editor/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export const LiEditor: React.FC = () => { 4 | return
LiEditor
; 5 | }; 6 | 7 | export default LiEditor; 8 | -------------------------------------------------------------------------------- /li-app/internal/pkg/wf/executor/approval_task.go: -------------------------------------------------------------------------------- 1 | package executor 2 | 3 | import "github.com/BeanWei/li/li-engine/contrib/liflow/executor" 4 | 5 | type ApprovalTask struct { 6 | executor.UserTaskExecutor 7 | } 8 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/route-switch/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./context"; 2 | export * from "./hooks"; 3 | export * from "./RouteSwitch"; 4 | export * from "./RouteSwitchProvider"; 5 | export * from "./types"; 6 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/action/Action.Modal.tsx: -------------------------------------------------------------------------------- 1 | import { Fragment } from "react"; 2 | 3 | export const ActionModal = () => { 4 | return ; 5 | }; 6 | 7 | export default ActionModal; 8 | -------------------------------------------------------------------------------- /li-web/Makefile: -------------------------------------------------------------------------------- 1 | clean: 2 | rm -rf node_modules 3 | rm -rf apps/admin/node_modules 4 | rm -rf packages/pro-components/node_modules 5 | rm -rf packages/pro-utils/node_modules 6 | rm -rf packages/schema-components/node_modules 7 | -------------------------------------------------------------------------------- /li-web/packages/tsconfig/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsconfig", 3 | "version": "0.0.0", 4 | "private": true, 5 | "main": "index.js", 6 | "files": [ 7 | "base.json", 8 | "react-library.json" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/hooks/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./useAttach"; 2 | export * from "./useCompile"; 3 | export * from "./useComponent"; 4 | export * from "./useFieldProps"; 5 | export * from "./useSchemaComponentContext"; 6 | -------------------------------------------------------------------------------- /li-app/internal/shared/shared.go: -------------------------------------------------------------------------------- 1 | package shared 2 | 3 | import "github.com/gogf/gf/v2/container/garray" 4 | 5 | // CtxUser 上下文用户信息 6 | type CtxUser struct { 7 | ID string 8 | IsAdmin bool 9 | Roles *garray.StrArray 10 | } 11 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/docs/li-editor.md: -------------------------------------------------------------------------------- 1 | # LiEditor 2 | 3 | ```tsx 4 | import React from "react"; 5 | import { LiEditor } from "pro-components"; 6 | 7 | export default () => { 8 | return ; 9 | }; 10 | ``` 11 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from "react"; 2 | import { ISchemaComponentContext } from "./types"; 3 | 4 | export const SchemaComponentContext = createContext( 5 | {} 6 | ); 7 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/hooks/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./getLocale"; 2 | export * from "./getPrefixCls"; 3 | export * from "./useClickAway"; 4 | export * from "./useCollapseGrid"; 5 | export * from "./usePrefixCls"; 6 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./hooks"; 2 | export * from "./icon"; 3 | export * from "./portal"; 4 | export * from "./loading"; 5 | export * from "./pickDataProps"; 6 | export * from "./utils"; 7 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/form-grid/index.less: -------------------------------------------------------------------------------- 1 | @import '~@arco-design/web-react/lib/style/theme/default.less'; 2 | 3 | @form-grid-prefix-cls: ~'@{prefix}-formily-grid'; 4 | 5 | .@{form-grid-prefix-cls}-layout { 6 | display: grid; 7 | } 8 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/.umirc.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | chainWebpack: (memo, { env, webpack, createCSSRule }) => { 3 | memo.module 4 | .rule("ts-in-node_modules") 5 | .include.add(require("path").join(__dirname, "../../packages/")); 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/.umirc.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | chainWebpack: (memo, { env, webpack, createCSSRule }) => { 3 | memo.module 4 | .rule("ts-in-node_modules") 5 | .include.add(require("path").join(__dirname, "../../packages/")); 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/text-editor/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { LiEditor } from "pro-components"; 3 | 4 | export const TextEditor: React.FC<{}> = (props) => { 5 | return ; 6 | }; 7 | 8 | export default TextEditor; 9 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/hooks/useSchemaComponentContext.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { SchemaComponentContext } from "../context"; 3 | 4 | export function useSchemaComponentContext() { 5 | return useContext(SchemaComponentContext); 6 | } 7 | -------------------------------------------------------------------------------- /li-app/internal/app/admin/dto/user.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type UserSignInReq struct { 4 | Email string `v:"required|email"` 5 | Password string `v:"required"` 6 | } 7 | 8 | type UserSignInRes struct { 9 | ID string `json:"id"` 10 | Sid string `json:"sid"` 11 | } 12 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/input/index.less: -------------------------------------------------------------------------------- 1 | @import '~@arco-design/web-react/lib/style/theme/default.less'; 2 | 3 | @description-cls: ~'@{prefix}-description'; 4 | 5 | .@{description-cls}-textarea 6 | .@{description-cls}-input{ 7 | line-height: 1.612; 8 | } 9 | -------------------------------------------------------------------------------- /li-web/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "pipeline": { 3 | "build": { 4 | "dependsOn": ["^build"], 5 | "outputs": ["dist/**", ".next/**"] 6 | }, 7 | "lint": { 8 | "outputs": [] 9 | }, 10 | "dev": { 11 | "cache": false 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /li-app/script/entclean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git ls-files --others --ignored --exclude-standard | awk '{print}' | 4 | while read -r line 5 | do 6 | if [[ $line == *"/ent/"* ]]; then 7 | echo "Delete: $line" 8 | rm $line 9 | fi 10 | done 11 | 12 | 13 | -------------------------------------------------------------------------------- /li-web/packages/config/eslint-preset.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: ["prettier"], 4 | settings: { 5 | next: { 6 | rootDir: ["apps/*/", "packages/*/"], 7 | }, 8 | }, 9 | rules: { 10 | "react/jsx-key": "off", 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/docs/li-flow.md: -------------------------------------------------------------------------------- 1 | # LiFlow 2 | 3 | ```tsx 4 | import React from "react"; 5 | import { LiFlow } from "pro-components"; 6 | import "@arco-design/web-react/dist/css/arco.css"; 7 | 8 | export default () => { 9 | return ; 10 | }; 11 | ``` 12 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/route-switch/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from "react"; 2 | import { RouteProps } from "./types"; 3 | 4 | export const RouteSwitchContext = createContext({ 5 | components: {}, 6 | }); 7 | 8 | export const RouteContext = createContext({ path: "/" }); 9 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/list/List.Card.tsx: -------------------------------------------------------------------------------- 1 | import { Card } from "@arco-design/web-react"; 2 | import React from "react"; 3 | 4 | const ListCard: React.FC> = (props) => { 5 | return {props.children}; 6 | }; 7 | 8 | export default ListCard; 9 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./RecordProvider"; 2 | export * from "./SchemaComponent"; 3 | export * from "./SchemaComponentOptions"; 4 | export * from "./SchemaComponentProvider"; 5 | export * from "./SchemaFormField"; 6 | export * from "./UiSchemaComponentProvider"; 7 | -------------------------------------------------------------------------------- /li-web/apps/admin/mock/getUv.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | { ds: "2020-12-31", uv: 20 }, 3 | { ds: "2021-01-01", uv: 21 }, 4 | { ds: "2021-01-02", uv: 15 }, 5 | { ds: "2021-01-03", uv: 40 }, 6 | { ds: "2021-01-04", uv: 31 }, 7 | { ds: "2021-01-05", uv: 32 }, 8 | { ds: "2021-01-06", uv: 30 }, 9 | ]; 10 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/hooks/getPrefixCls.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { ConfigProvider } from "@arco-design/web-react"; 3 | 4 | export const getPrefixCls = () => { 5 | const { prefixCls } = useContext(ConfigProvider.ConfigContext); 6 | return prefixCls; 7 | }; 8 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/utils.ts: -------------------------------------------------------------------------------- 1 | export const isUrl = (path: string): boolean => { 2 | if (!path.startsWith("http")) { 3 | return false; 4 | } 5 | try { 6 | const url = new URL(path); 7 | return !!url; 8 | } catch (error) { 9 | return false; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /li-web/packages/tsconfig/react-library.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "React Library", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "lib": ["ESNext", "DOM"], 7 | "module": "ESNext", 8 | "target": "ES6", 9 | "jsx": "react-jsx" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /li-web/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/switch/index.tsx: -------------------------------------------------------------------------------- 1 | import { Switch as ArcoSwitch } from "@arco-design/web-react"; 2 | import { connect, mapProps } from "@formily/react"; 3 | 4 | export const Switch = connect( 5 | ArcoSwitch, 6 | mapProps({ 7 | value: "checked", 8 | }) 9 | ); 10 | 11 | export default Switch; 12 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/pickDataProps.ts: -------------------------------------------------------------------------------- 1 | export const pickDataProps = (props: any = {}) => { 2 | const results: Record = {}; 3 | 4 | for (let key in props) { 5 | if (key.indexOf("data-") > -1) { 6 | results[key] = props[key]; 7 | } 8 | } 9 | 10 | return results; 11 | }; 12 | -------------------------------------------------------------------------------- /li-engine/contrib/lient/extension.go: -------------------------------------------------------------------------------- 1 | package lient 2 | 3 | import ( 4 | "entgo.io/ent/entc" 5 | "entgo.io/ent/entc/gen" 6 | ) 7 | 8 | type Extension struct { 9 | entc.DefaultExtension 10 | } 11 | 12 | func (Extension) Templates() []*gen.Template { 13 | return []*gen.Template{Templates} 14 | } 15 | 16 | var _ entc.Extension = (*Extension)(nil) 17 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./application"; 2 | export * from "./async-data-provider"; 3 | export * from "./document-title"; 4 | export * from "./i18n"; 5 | export * from "./layout"; 6 | export * from "./record-provider"; 7 | export * from "./route-switch"; 8 | export * from "./schema-components"; 9 | export * from "./sign-page"; 10 | -------------------------------------------------------------------------------- /li-engine/contrib/lient/util.go: -------------------------------------------------------------------------------- 1 | package lient 2 | 3 | import ( 4 | "github.com/rs/xid" 5 | "github.com/yitter/idgenerator-go/idgen" 6 | ) 7 | 8 | func init() { 9 | idgen.SetIdGenerator(idgen.NewIdGeneratorOptions(1)) 10 | } 11 | 12 | func NewID() int64 { 13 | return idgen.NextId() 14 | } 15 | 16 | func NewXid() string { 17 | return xid.New().String() 18 | } 19 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/hooks/getLocale.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { ConfigProvider } from "@arco-design/web-react"; 3 | import { Locale } from "../../../locale/types"; 4 | 5 | export const getLocale = (): Locale => { 6 | const { locale } = useContext(ConfigProvider.ConfigContext); 7 | return locale as Locale; 8 | }; 9 | -------------------------------------------------------------------------------- /li-engine/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/BeanWei/li/li-engine 2 | 3 | go 1.16 4 | 5 | require ( 6 | entgo.io/ent v0.10.2-0.20220510065209-fc03c8d283d3 7 | github.com/antonmedv/expr v1.9.0 8 | github.com/aws/aws-sdk-go v1.44.10 9 | github.com/gogf/gf/v2 v2.0.6 10 | github.com/hexops/valast v1.4.1 11 | github.com/rs/xid v1.4.0 12 | github.com/yitter/idgenerator-go v1.2.2 13 | ) 14 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/card-item/index.tsx: -------------------------------------------------------------------------------- 1 | import { Card } from "@arco-design/web-react"; 2 | 3 | export const CardItem: React.FC> = (props) => { 4 | return ( 5 | 6 | {props.children} 7 | 8 | ); 9 | }; 10 | 11 | export default CardItem; 12 | -------------------------------------------------------------------------------- /li-app/internal/pkg/wf/wf.go: -------------------------------------------------------------------------------- 1 | package wf 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-app/internal/pkg/wf/executor" 5 | "github.com/BeanWei/li/li-engine/contrib/liflow" 6 | ) 7 | 8 | func init() { 9 | liflow.RegisterExecutor( 10 | &liflow.RegisterExecutorInput{ 11 | ElementType: "ApprovalTask", 12 | ElementExecutor: new(executor.ApprovalTask), 13 | }, 14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/chart/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from "react"; 2 | 3 | export type ChartItemContextProps = { 4 | data: Record[]; 5 | loading: boolean; 6 | chartRef?: React.MutableRefObject; 7 | }; 8 | 9 | export const ChartItemContext = createContext({ 10 | data: [], 11 | loading: false, 12 | }); 13 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from "react"; 2 | 3 | export const GlobalContext = createContext<{ 4 | app?: Record; 5 | lang?: string; 6 | setLang?: (value: string) => void; 7 | theme?: string; 8 | setTheme?: (value: string) => void; 9 | currentUser?: Record; 10 | setCurrentUser?: (value: Record) => void; 11 | }>({}); 12 | -------------------------------------------------------------------------------- /li-web/packages/config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "config", 3 | "version": "0.0.0", 4 | "main": "index.js", 5 | "files": [ 6 | "eslint-preset.js" 7 | ], 8 | "dependencies": { 9 | "eslint-config-next": "^12.0.8", 10 | "eslint-config-prettier": "^8.3.0", 11 | "eslint-plugin-react": "7.28.0" 12 | }, 13 | "devDependencies": { 14 | "typescript": "^4.5.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /li-app/internal/middleware/cors.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "github.com/gogf/gf/v2/frame/g" 5 | "github.com/gogf/gf/v2/net/ghttp" 6 | ) 7 | 8 | // CORS 允许跨域请求中间件 9 | func CORS(r *ghttp.Request) { 10 | corsOpts := r.Response.DefaultCORSOptions() 11 | corsOpts.AllowDomain = g.Cfg().MustGet(r.Context(), "server.corsAllowDomain").Strings() 12 | r.Response.CORS(corsOpts) 13 | r.Middleware.Next() 14 | } 15 | -------------------------------------------------------------------------------- /li-web/.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.svg 2 | **/dist 3 | **/lib 4 | **/es 5 | package.json 6 | .umi 7 | .umi-production 8 | dist 9 | .dockerignore 10 | .DS_Store 11 | .eslintignore 12 | *.png 13 | *.toml 14 | docker 15 | .editorconfig 16 | Dockerfile* 17 | .gitignore 18 | .gitkeep 19 | .prettierignore 20 | LICENSE 21 | .eslintcache 22 | *.lock 23 | yarn-error.log 24 | .history 25 | CNAME 26 | build 27 | public 28 | *.ejs 29 | assets 30 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/divider/index.tsx: -------------------------------------------------------------------------------- 1 | import { Divider as ArcoDivider } from "@arco-design/web-react"; 2 | import React from "react"; 3 | 4 | export const Divider: React.FC> = (props) => { 5 | return ( 6 | 7 | {props.children} 8 | 9 | ); 10 | }; 11 | 12 | export default Divider; 13 | -------------------------------------------------------------------------------- /li-engine/contrib/liflow/ent/runtime/runtime.go: -------------------------------------------------------------------------------- 1 | // Code generated by entc, DO NOT EDIT. 2 | 3 | package runtime 4 | 5 | // The schema-stitching logic is generated in github.com/BeanWei/li/li-engine/contrib/liflow/ent/runtime.go 6 | 7 | const ( 8 | Version = "v0.10.2-0.20220408082730-6e4e4da89674" // Version of ent codegen. 9 | Sum = "h1:YMUBe+itzJQhVTkrV3sRzoX7EwUVwQc5ZQ+oXxIsQIg=" // Sum of ent codegen. 10 | ) 11 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/hooks/usePrefixCls.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { ConfigProvider } from "@arco-design/web-react"; 3 | 4 | export const usePrefixCls = ( 5 | tag: string, 6 | props?: { 7 | prefixCls?: string; 8 | } 9 | ) => { 10 | const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); 11 | return getPrefixCls?.(tag, props?.prefixCls); 12 | }; 13 | -------------------------------------------------------------------------------- /li-app/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/BeanWei/li/li-app 2 | 3 | go 1.16 4 | 5 | require ( 6 | entgo.io/ent v0.10.2-0.20220510065209-fc03c8d283d3 7 | github.com/BeanWei/li/li-engine v0.0.0 8 | github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.0.0-20220427091526-ae5891068e0e 9 | github.com/gogf/gf/v2 v2.0.6 10 | golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 11 | ) 12 | 13 | replace github.com/BeanWei/li/li-engine v0.0.0 => ../li-engine 14 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/route-switch/RouteSwitchProvider.tsx: -------------------------------------------------------------------------------- 1 | import { RouteSwitchContext } from "./context"; 2 | import { RouteSwitchProviderProps } from "./types"; 3 | 4 | export function RouteSwitchProvider(props: RouteSwitchProviderProps) { 5 | const { children, components } = props; 6 | return ( 7 | 8 | {children} 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/route-switch/types.ts: -------------------------------------------------------------------------------- 1 | export interface RouteProps { 2 | path: string; 3 | index?: boolean; 4 | redirect?: string; 5 | component?: any; 6 | // routes?: RouteProps[]; 7 | [key: string]: any; 8 | } 9 | 10 | export interface RouteSwitchProviderProps { 11 | components?: any; 12 | children?: any; 13 | } 14 | 15 | export interface RouteSwitchProps { 16 | routes?: RouteProps[]; 17 | components?: any; 18 | } 19 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/form-button-group/index.less: -------------------------------------------------------------------------------- 1 | @import '~@arco-design/web-react/lib/style/theme/default.less'; 2 | 3 | @btn-group-prefix-cls: ~'@{prefix}-formily-button-group';; 4 | 5 | .@{btn-group-prefix-cls}-sticky { 6 | padding: 10px 0; 7 | border-top: 1px solid #eee; 8 | z-index: 999; 9 | 10 | &-inner { 11 | display: flex; 12 | .@{prefix}formily-item { 13 | flex: 2; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/action/Action.tsx: -------------------------------------------------------------------------------- 1 | import { Fragment } from "react"; 2 | import ActionFormDrawer from "./Action.FormDrawer"; 3 | import ActionFormModal from "./Action.FormModal"; 4 | import { ComposedAction } from "./types"; 5 | 6 | export const Action: ComposedAction = (props) => { 7 | return ; 8 | }; 9 | 10 | Action.FormDrawer = ActionFormDrawer; 11 | Action.FormModal = ActionFormModal; 12 | 13 | export default Action; 14 | -------------------------------------------------------------------------------- /li-engine/view/node/node_phone.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import "github.com/BeanWei/li/li-engine/view/ui" 4 | 5 | func Phone(name string) *phoneBuilder { 6 | return &phoneBuilder{&NodeBuilder{ 7 | schema: &ui.Schema{ 8 | Name: name, 9 | Type: ui.SchemaTypeString, 10 | XComponent: ui.ComponentInput, 11 | XDecorator: ui.DecoratorFormItem, 12 | XValidator: "phone", 13 | }, 14 | }} 15 | } 16 | 17 | type phoneBuilder struct { 18 | *NodeBuilder 19 | } 20 | -------------------------------------------------------------------------------- /li-engine/view/com/com_langswitch.go: -------------------------------------------------------------------------------- 1 | package com 2 | 3 | import "github.com/BeanWei/li/li-engine/view/ui" 4 | 5 | func LangSwitch(name string) *langswitchBuilder { 6 | return &langswitchBuilder{schema: &ui.Schema{ 7 | Name: name, 8 | Type: ui.SchemaTypeVoid, 9 | XComponent: "LangSwitch", 10 | }} 11 | } 12 | 13 | type langswitchBuilder struct { 14 | schema *ui.Schema 15 | } 16 | 17 | func (b *langswitchBuilder) Schema() *ui.Schema { 18 | return b.schema 19 | } 20 | -------------------------------------------------------------------------------- /li-app/internal/data/ent/entc.go: -------------------------------------------------------------------------------- 1 | //go:build ignore 2 | // +build ignore 3 | 4 | package main 5 | 6 | // package ent 7 | 8 | import ( 9 | "log" 10 | 11 | "entgo.io/ent/entc" 12 | "entgo.io/ent/entc/gen" 13 | "github.com/BeanWei/li/li-engine/contrib/lient" 14 | ) 15 | 16 | func main() { 17 | err := entc.Generate("./schema", 18 | &gen.Config{}, 19 | entc.Extensions(&lient.Extension{}), 20 | ) 21 | if err != nil { 22 | log.Fatal("running ent codegen:", err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/locale/index.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { ConfigProvider } from "@arco-design/web-react"; 3 | import { Locale } from "./types"; 4 | import enUS from "./en-US"; 5 | import zhCN from "./zh-CN"; 6 | 7 | function useLocale(): Locale { 8 | const lang = useContext(ConfigProvider.ConfigContext).locale?.locale; 9 | if (lang === "en-US") { 10 | return enUS; 11 | } 12 | return zhCN; 13 | } 14 | 15 | export default useLocale; 16 | -------------------------------------------------------------------------------- /li-engine/view/com/com_themeswitch.go: -------------------------------------------------------------------------------- 1 | package com 2 | 3 | import "github.com/BeanWei/li/li-engine/view/ui" 4 | 5 | func ThemeSwitch(name string) *themeswitchBuilder { 6 | return &themeswitchBuilder{schema: &ui.Schema{ 7 | Name: name, 8 | Type: ui.SchemaTypeVoid, 9 | XComponent: "ThemeSwitch", 10 | }} 11 | } 12 | 13 | type themeswitchBuilder struct { 14 | schema *ui.Schema 15 | } 16 | 17 | func (b *themeswitchBuilder) Schema() *ui.Schema { 18 | return b.schema 19 | } 20 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/locale/types.ts: -------------------------------------------------------------------------------- 1 | export type Locale = { 2 | LiFlow: { 3 | tooltipUndo: string; 4 | tooltipRedo: string; 5 | tooltipZoomIn: string; 6 | tooltipZoomOut: string; 7 | tooltipAutoFit: string; 8 | nodeSequenceFlow: string; 9 | nodeStartEvent: string; 10 | nodeEndEvent: string; 11 | nodeExclusiveGateway: string; 12 | nodeApproverTask: string; 13 | nodeWebhookTask: string; 14 | [key: string]: string; 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /li-engine/contrib/lient/internal/ent/entc.go: -------------------------------------------------------------------------------- 1 | //go:build ignore 2 | // +build ignore 3 | 4 | package main 5 | 6 | // package ent 7 | 8 | import ( 9 | "log" 10 | 11 | "entgo.io/ent/entc" 12 | "entgo.io/ent/entc/gen" 13 | "github.com/BeanWei/li/li-engine/contrib/lient" 14 | ) 15 | 16 | func main() { 17 | err := entc.Generate("./schema", 18 | &gen.Config{}, 19 | entc.Extensions(&lient.Extension{}), 20 | ) 21 | if err != nil { 22 | log.Fatal("running ent codegen:", err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/route-switch/hooks.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import get from "lodash/get"; 3 | import { RouteContext, RouteSwitchContext } from "./context"; 4 | 5 | export function useRouteComponent(name?: string) { 6 | if (!name) { 7 | return () => null; 8 | } 9 | const { components } = useContext(RouteSwitchContext); 10 | return get(components, name) || (() => null); 11 | } 12 | 13 | export function useRoute() { 14 | return useContext(RouteContext); 15 | } 16 | -------------------------------------------------------------------------------- /li-engine/view/node/node_chart.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import "github.com/BeanWei/li/li-engine/view/ui" 4 | 5 | func Chart(name string) *chartBuilder { 6 | return &chartBuilder{&formgridBuilder{&NodeBuilder{ 7 | schema: &ui.Schema{ 8 | Name: name, 9 | Type: ui.SchemaTypeVoid, 10 | XComponent: ui.ComponentChart, 11 | XComponentProps: make(map[string]interface{}), 12 | }, 13 | }, 14 | }} 15 | } 16 | 17 | type chartBuilder struct { 18 | *formgridBuilder 19 | } 20 | -------------------------------------------------------------------------------- /li-app/internal/cmd/cmd_migrate.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/BeanWei/li/li-app/internal/data/ent" 7 | entmigrate "github.com/BeanWei/li/li-app/internal/data/ent/migrate" 8 | "github.com/gogf/gf/v2/os/gcmd" 9 | ) 10 | 11 | func migrate(ctx context.Context, parser *gcmd.Parser) (err error) { 12 | return ent.LiClient().Schema.Create(ctx, 13 | entmigrate.WithForeignKeys(false), 14 | entmigrate.WithDropIndex(true), 15 | entmigrate.WithDropColumn(true), 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/hooks/useComponent.ts: -------------------------------------------------------------------------------- 1 | import { SchemaOptionsContext } from "@formily/react"; 2 | import { get } from "lodash"; 3 | import { useContext } from "react"; 4 | 5 | export const useComponent = (component: any, defaults?: any) => { 6 | if (!component) { 7 | return defaults; 8 | } 9 | if (typeof component !== "string") { 10 | return component; 11 | } 12 | const { components } = useContext(SchemaOptionsContext); 13 | return get(components, component) || defaults; 14 | }; 15 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/locale/zh-CN.ts: -------------------------------------------------------------------------------- 1 | import { Locale } from "./types"; 2 | 3 | const zhCN: Locale = { 4 | LiFlow: { 5 | tooltipUndo: "上一步", 6 | tooltipRedo: "下一步", 7 | tooltipZoomIn: "放大", 8 | tooltipZoomOut: "缩小", 9 | tooltipAutoFit: "适应屏幕", 10 | nodeSequenceFlow: "连接线", 11 | nodeStartEvent: "开始节点", 12 | nodeEndEvent: "结束节点", 13 | nodeExclusiveGateway: "排他网关", 14 | nodeApproverTask: "审批节点", 15 | nodeWebhookTask: "钩子节点", 16 | }, 17 | }; 18 | 19 | export default zhCN; 20 | -------------------------------------------------------------------------------- /li-engine/contrib/liflow/ent/entc.go: -------------------------------------------------------------------------------- 1 | //go:build ignore 2 | // +build ignore 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | "entgo.io/ent/entc" 10 | "entgo.io/ent/entc/gen" 11 | "github.com/BeanWei/li/li-engine/contrib/lient" 12 | ) 13 | 14 | func main() { 15 | err := entc.Generate("./schema", 16 | &gen.Config{ 17 | Features: []gen.Feature{ 18 | gen.FeatureUpsert, 19 | }, 20 | }, 21 | entc.Extensions(&lient.Extension{}), 22 | ) 23 | if err != nil { 24 | log.Fatal("running ent codegen:", err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/loading.ts: -------------------------------------------------------------------------------- 1 | import { Message } from "@arco-design/web-react"; 2 | 3 | export const loading = async ( 4 | title: React.ReactNode = "Loading...", 5 | processor: () => Promise 6 | ) => { 7 | let hide: any = null; 8 | let loading = setTimeout(() => { 9 | hide = Message.loading({ 10 | content: title, 11 | }); 12 | }, 100); 13 | try { 14 | return await processor(); 15 | } finally { 16 | hide?.(); 17 | clearTimeout(loading); 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /li-app/internal/cmd/cmd_user.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/BeanWei/li/li-app/internal/data/ent" 7 | "github.com/gogf/gf/v2/os/gcmd" 8 | ) 9 | 10 | func userCreate(ctx context.Context, parser *gcmd.Parser) (err error) { 11 | err = ent.LiClient().User.Create(). 12 | SetEmail(parser.GetOpt("email").String()). 13 | SetPassword(parser.GetOpt("password").String()). 14 | SetNickname(parser.GetOpt("nickname").String()). 15 | SetIsAdmin(parser.GetOpt("isAdmin").Bool()). 16 | Exec(ctx) 17 | return 18 | } 19 | -------------------------------------------------------------------------------- /li-app/internal/app/admin/view/blog.tag.go: -------------------------------------------------------------------------------- 1 | package view 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-app/internal/data/ent" 5 | "github.com/BeanWei/li/li-engine/view" 6 | "github.com/BeanWei/li/li-engine/view/node" 7 | ) 8 | 9 | type BlogTag struct { 10 | view.Schema 11 | } 12 | 13 | func (BlogTag) Nodes() []view.Node { 14 | return []view.Node{ 15 | node.GridRow("row1"). 16 | Gutter(16). 17 | Children( 18 | node.GridCol("col1"). 19 | Span(24). 20 | Children( 21 | ent.ListTagView(), 22 | ), 23 | ), 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /li-app/internal/app/admin/view/blog.post.go: -------------------------------------------------------------------------------- 1 | package view 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-app/internal/data/ent" 5 | "github.com/BeanWei/li/li-engine/view" 6 | "github.com/BeanWei/li/li-engine/view/node" 7 | ) 8 | 9 | type BlogPost struct { 10 | view.Schema 11 | } 12 | 13 | func (BlogPost) Nodes() []view.Node { 14 | return []view.Node{ 15 | node.GridRow("row1"). 16 | Gutter(16). 17 | Children( 18 | node.GridCol("col1"). 19 | Span(24). 20 | Children( 21 | ent.ListPostView(), 22 | ), 23 | ), 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /li-app/internal/app/admin/view/system.user.go: -------------------------------------------------------------------------------- 1 | package view 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-app/internal/data/ent" 5 | "github.com/BeanWei/li/li-engine/view" 6 | "github.com/BeanWei/li/li-engine/view/node" 7 | ) 8 | 9 | type SystemUser struct { 10 | view.Schema 11 | } 12 | 13 | func (SystemUser) Nodes() []view.Node { 14 | return []view.Node{ 15 | node.GridRow("row1"). 16 | Gutter(16). 17 | Children( 18 | node.GridCol("col1"). 19 | Span(24). 20 | Children( 21 | ent.ListUserView(), 22 | ), 23 | ), 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/grid/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Grid as ArcoGrid, ColProps, RowProps } from "@arco-design/web-react"; 3 | 4 | type ComposedGrid = React.FC<{}> & { 5 | Row?: React.FC; 6 | Col?: React.FC; 7 | }; 8 | 9 | export const Grid: ComposedGrid = () => { 10 | return <>; 11 | }; 12 | 13 | Grid.Row = (props) => { 14 | return ; 15 | }; 16 | 17 | Grid.Col = (props) => { 18 | return ; 19 | }; 20 | 21 | export default Grid; 22 | -------------------------------------------------------------------------------- /li-app/internal/app/admin/view/blog.comment.go: -------------------------------------------------------------------------------- 1 | package view 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-app/internal/data/ent" 5 | "github.com/BeanWei/li/li-engine/view" 6 | "github.com/BeanWei/li/li-engine/view/node" 7 | ) 8 | 9 | type BlogComment struct { 10 | view.Schema 11 | } 12 | 13 | func (BlogComment) Nodes() []view.Node { 14 | return []view.Node{ 15 | node.GridRow("row1"). 16 | Gutter(16). 17 | Children( 18 | node.GridCol("col1"). 19 | Span(24). 20 | Children( 21 | ent.ListCommentView(), 22 | ), 23 | ), 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /li-engine/view/node/node_email.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import "github.com/BeanWei/li/li-engine/view/ui" 4 | 5 | func Email(name string) *emailBuilder { 6 | return &emailBuilder{&textBuilder{&NodeBuilder{ 7 | schema: &ui.Schema{ 8 | Name: name, 9 | Type: ui.SchemaTypeString, 10 | XComponent: ui.ComponentInput, 11 | XComponentProps: make(map[string]interface{}), 12 | XDecorator: ui.DecoratorFormItem, 13 | XValidator: "email", 14 | }, 15 | }}} 16 | } 17 | 18 | type emailBuilder struct { 19 | *textBuilder 20 | } 21 | -------------------------------------------------------------------------------- /li-engine/contrib/lient/template/import.tmpl: -------------------------------------------------------------------------------- 1 | {{/* gotype: entgo.io/ent/entc/gen.Type */}} 2 | 3 | {{ define "import/additional/lient" }} 4 | "context" 5 | "reflect" 6 | "entgo.io/ent/dialect/sql/sqljson" 7 | "github.com/BeanWei/li/li-engine/ac" 8 | "github.com/BeanWei/li/li-engine/contrib/lient/sqlx" 9 | "github.com/BeanWei/li/li-engine/view" 10 | "github.com/BeanWei/li/li-engine/view/node" 11 | "github.com/BeanWei/li/li-engine/view/ui" 12 | "github.com/gogf/gf/v2/errors/gcode" 13 | "github.com/gogf/gf/v2/errors/gerror" 14 | "github.com/gogf/gf/v2/util/gconv" 15 | {{ end }} -------------------------------------------------------------------------------- /li-web/apps/admin/src/assets/dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/hooks/useCompile.ts: -------------------------------------------------------------------------------- 1 | import { compile } from "@formily/json-schema/lib/compiler"; 2 | import { 3 | SchemaExpressionScopeContext, 4 | SchemaOptionsContext, 5 | } from "@formily/react"; 6 | import { useContext } from "react"; 7 | 8 | export const useCompile = () => { 9 | const options = useContext(SchemaOptionsContext); 10 | const scope = useContext(SchemaExpressionScopeContext); 11 | return (source: any) => { 12 | if (!source) { 13 | return source; 14 | } 15 | return compile(source, { ...options.scope, ...scope }); 16 | }; 17 | }; 18 | -------------------------------------------------------------------------------- /li-web/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | .pnp 6 | .pnp.js 7 | 8 | # testing 9 | coverage 10 | 11 | # next.js 12 | .next/ 13 | out/ 14 | build 15 | 16 | # misc 17 | .DS_Store 18 | *.pem 19 | 20 | # debug 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | .pnpm-debug.log* 25 | 26 | # local env files 27 | .env.local 28 | .env.development.local 29 | .env.test.local 30 | .env.production.local 31 | 32 | # turbo 33 | .turbo 34 | 35 | # umi 36 | .umi 37 | 38 | # dev 39 | .example 40 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/__builtins__/icon.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import * as ICONS from "@arco-design/web-react/icon"; 3 | import { IconProps } from "@arco-design/web-react/icon"; 4 | 5 | const allicons = ICONS as Record; 6 | 7 | export const Icon: React.FC = (props) => { 8 | const { type, ...rest } = props; 9 | if (!type) { 10 | return null; 11 | } 12 | const Icon = allicons[type]; 13 | if (!Icon) { 14 | return null; 15 | } 16 | return ; 17 | }; 18 | 19 | export default Icon; 20 | -------------------------------------------------------------------------------- /li-web/apps/admin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | Li Admin 13 | 14 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/components/Loading.tsx: -------------------------------------------------------------------------------- 1 | import { Spin } from "@arco-design/web-react"; 2 | 3 | export const Loading: React.FC = () => { 4 | return ( 5 |
12 | 22 |
23 | ); 24 | }; 25 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/upload/types.ts: -------------------------------------------------------------------------------- 1 | import { UploadProps } from "@arco-design/web-react"; 2 | import React from "react"; 3 | 4 | export type UploadAttachmentProps = Omit & { 5 | value?: string[]; 6 | onChange?: (value?: (string | undefined)[]) => void; 7 | }; 8 | 9 | export type UploadAvatarProps = Omit & { 10 | value?: string; 11 | onChange?: (value?: string) => void; 12 | }; 13 | 14 | export type ComposedUpload = React.FC & { 15 | Attachment?: React.FC; 16 | Avatar?: React.FC; 17 | }; 18 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/locale/en-US.ts: -------------------------------------------------------------------------------- 1 | import { Locale } from "./types"; 2 | 3 | const enUS: Locale = { 4 | LiFlow: { 5 | tooltipUndo: "Undo", 6 | tooltipRedo: "Redo", 7 | tooltipZoomIn: "Zoom In", 8 | tooltipZoomOut: "Zoom Out", 9 | tooltipAutoFit: "Auto Fit", 10 | nodeSequenceFlow: "Sequence Flow", 11 | nodeStartEvent: "Start Event", 12 | nodeEndEvent: "End Event", 13 | nodeGateway: "Gateway", 14 | nodeExclusiveGateway: "Exclusive Gateway", 15 | nodeApproverTask: "Approver Task", 16 | nodeWebhookTask: "Webhook Task", 17 | }, 18 | }; 19 | 20 | export default enUS; 21 | -------------------------------------------------------------------------------- /li-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "li-web", 3 | "version": "0.0.0", 4 | "private": true, 5 | "workspaces": [ 6 | "apps/*", 7 | "packages/*" 8 | ], 9 | "scripts": { 10 | "build": "turbo run build", 11 | "dev": "turbo run dev --parallel", 12 | "lint": "turbo run lint", 13 | "format": "prettier -c --write \"**/*.{ts,tsx,md}\" --end-of-line auto" 14 | }, 15 | "devDependencies": { 16 | "@arco-design/web-react": "^2.32.2", 17 | "prettier": "^2.6.2", 18 | "turbo": "^1.2.6" 19 | }, 20 | "engines": { 21 | "npm": ">=7.0.0", 22 | "node": ">=14.0.0" 23 | }, 24 | "packageManager": "pnpm@6.32.1" 25 | } 26 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/chart/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 图表图片导出, 只支持 renderer = 'canvas' 3 | * @param chart chart 实例 4 | * @param name 图片名称,可选,默认名为 'download' 5 | */ 6 | export function downloadImage(chart: any, name: string = "download") { 7 | if (!chart) return; 8 | const canvas = chart.getCanvas(); 9 | canvas.get("timeline").stopAllAnimations(); 10 | const dataURL = canvas.get("el").toDataURL({ 11 | format: "png", 12 | quality: 1, 13 | }); 14 | let a: HTMLAnchorElement | null = document.createElement("a"); 15 | a.href = dataURL; 16 | a.download = `${name}-${new Date().toLocaleDateString()}.png`; 17 | a.click(); 18 | } 19 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/hooks/useAttach.ts: -------------------------------------------------------------------------------- 1 | import { useRef, useEffect } from "react"; 2 | 3 | interface IRecycleTarget { 4 | onMount: () => void; 5 | onUnmount: () => void; 6 | } 7 | 8 | export const useAttach = (target: T): T => { 9 | const oldTargetRef = useRef(null); 10 | useEffect(() => { 11 | if (oldTargetRef.current && target !== oldTargetRef.current) { 12 | oldTargetRef.current.onUnmount(); 13 | } 14 | oldTargetRef.current = target; 15 | target.onMount(); 16 | return () => { 17 | target.onUnmount(); 18 | }; 19 | }, [target]); 20 | return target; 21 | }; 22 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/chart/Chart.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Card } from "@arco-design/web-react"; 3 | import FormGrid, { IFormGridProps } from "../form-grid"; 4 | import ChartAutoChart from "./Chart.AutoChart"; 5 | 6 | export type ComposedChart = React.FC< 7 | React.PropsWithChildren 8 | > & { 9 | AutoChart?: React.FC; 10 | }; 11 | 12 | export const Chart: ComposedChart = (props) => { 13 | return ( 14 | 15 | {props.children} 16 | 17 | ); 18 | }; 19 | 20 | Chart.AutoChart = ChartAutoChart; 21 | 22 | export default Chart; 23 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/hooks/useFieldProps.ts: -------------------------------------------------------------------------------- 1 | import { useContext, useRef } from "react"; 2 | import { 3 | Schema, 4 | SchemaExpressionScopeContext, 5 | SchemaOptionsContext, 6 | } from "@formily/react"; 7 | 8 | export const useFieldProps = (schema: Schema) => { 9 | const options = useContext(SchemaOptionsContext); 10 | const scope = useContext(SchemaExpressionScopeContext); 11 | const scopeRef = useRef(); 12 | scopeRef.current = scope; 13 | return schema.toFieldProps({ 14 | ...options, 15 | get scope() { 16 | return { 17 | ...options.scope, 18 | ...scopeRef.current, 19 | }; 20 | }, 21 | }) as any; 22 | }; 23 | -------------------------------------------------------------------------------- /li-engine/view/node/node_form.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-engine/ac" 5 | "github.com/BeanWei/li/li-engine/view/ui" 6 | ) 7 | 8 | func Form(name string) *formBuilder { 9 | return &formBuilder{&NodeBuilder{ 10 | schema: &ui.Schema{ 11 | Name: name, 12 | Type: ui.SchemaTypeObject, 13 | XComponent: ui.ComponentForm, 14 | }, 15 | }} 16 | } 17 | 18 | type formBuilder struct { 19 | *NodeBuilder 20 | } 21 | 22 | func (b *formBuilder) AC(f ac.AC) *formBuilder { 23 | b.schema.AC = f 24 | return b 25 | } 26 | 27 | func (b *formBuilder) DecoratorCard() *formBuilder { 28 | b.schema.XDecorator = ui.DecoratorCardItem 29 | return b 30 | } 31 | -------------------------------------------------------------------------------- /li-app/internal/cmd/cmd_run.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/BeanWei/li/li-app/internal/app/admin" 7 | "github.com/BeanWei/li/li-app/internal/middleware" 8 | "github.com/gogf/gf/v2/frame/g" 9 | "github.com/gogf/gf/v2/os/gcmd" 10 | "github.com/gogf/gf/v2/os/gsession" 11 | ) 12 | 13 | func run(ctx context.Context, parser *gcmd.Parser) (err error) { 14 | s := g.Server() 15 | s.SetSessionStorage(gsession.NewStorageRedis(g.Redis())) 16 | s.Use( 17 | middleware.ErrorHandler, 18 | middleware.CORS, 19 | middleware.Ctx, 20 | // TODO: I18N 21 | // middleware.I18N, 22 | middleware.Authentication, 23 | ) 24 | admin.Init() 25 | s.Run() 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/avatar/index.tsx: -------------------------------------------------------------------------------- 1 | import { Avatar as ArcoAvatar, AvatarProps } from "@arco-design/web-react"; 2 | import React from "react"; 3 | 4 | export const Avatar: React.FC< 5 | React.PropsWithChildren<{ 6 | shape?: AvatarProps["shape"]; 7 | size?: AvatarProps["size"]; 8 | alt?: string; 9 | src?: string; 10 | }> 11 | > = (props) => { 12 | if (props.src) { 13 | return ( 14 | 15 | {props.alt} 16 | 17 | ); 18 | } 19 | return {props.children}; 20 | }; 21 | 22 | export default Avatar; 23 | -------------------------------------------------------------------------------- /li-web/packages/pro-components/src/li-flow/nodes/index.ts: -------------------------------------------------------------------------------- 1 | import LogicFlow from "@logicflow/core"; 2 | import EndEvent from "./EndEvent"; 3 | import SequenceFlow from "./SequenceFlow"; 4 | import StartEvent from "./StartEvent"; 5 | import ApproverTask from "./ApproverTask"; 6 | import ExclusiveGateway from "./ExclusiveGateway"; 7 | import WebhookTask from "./WebhookTask"; 8 | import { eletype } from "../config"; 9 | 10 | export const registerNodes = (lf: LogicFlow) => { 11 | lf.register(StartEvent); 12 | lf.register(EndEvent); 13 | lf.register(ApproverTask); 14 | lf.register(WebhookTask); 15 | lf.register(SequenceFlow); 16 | lf.register(ExclusiveGateway); 17 | lf.setDefaultEdgeType(eletype.sequenceflow); 18 | }; 19 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/select/shared.ts: -------------------------------------------------------------------------------- 1 | import { toArr } from "@formily/shared"; 2 | 3 | export const getCurrentOptions = (values: any, dataSource: any) => { 4 | values = toArr(values).map((val) => 5 | typeof val === "object" ? val.value : val 6 | ); 7 | const findOptions = (options: any[]): any => { 8 | let current = []; 9 | for (const option of options) { 10 | if (values.includes(option.value)) { 11 | current.push(option); 12 | } 13 | const children = option.options; 14 | if (Array.isArray(children)) { 15 | current.push(...findOptions(children)); 16 | } 17 | } 18 | return current; 19 | }; 20 | return findOptions(dataSource); 21 | }; 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | *.DS_Store 15 | .idea/ 16 | .vscode/ 17 | *exvim* 18 | *vendor* 19 | 20 | # ent 仅保留schema文件目录和generate/entc文件 21 | **/ent/* 22 | !**/ent/schema 23 | !**/ent/generate.go 24 | !**/ent/entc.go 25 | !li-engine/contrib/liflow/ent/* 26 | 27 | # frontend 28 | node_modules/ 29 | npm-debug.log 30 | yarn-error.log 31 | package-lock.json 32 | 33 | # backend 34 | vender/ 35 | log/ 36 | bin/ 37 | cbuild 38 | config.yaml 39 | main 40 | 41 | # app 42 | li-app/tmp/ 43 | li-app/*go.sum 44 | _PERSISTENT_/ -------------------------------------------------------------------------------- /li-engine/contrib/lient/sqlx/utils.go: -------------------------------------------------------------------------------- 1 | package sqlx 2 | 3 | import "strings" 4 | 5 | // escape escapes w with the default escape character ('/'), 6 | // to be used by the pattern matching functions below. 7 | // The second return value indicates if w was escaped or not. 8 | func escape(w string) (string, bool) { 9 | var n int 10 | for i := range w { 11 | if c := w[i]; c == '%' || c == '_' || c == '\\' { 12 | n++ 13 | } 14 | } 15 | // No characters to escape. 16 | if n == 0 { 17 | return w, false 18 | } 19 | var b strings.Builder 20 | b.Grow(len(w) + n) 21 | for i := range w { 22 | if c := w[i]; c == '%' || c == '_' || c == '\\' { 23 | b.WriteByte('\\') 24 | } 25 | b.WriteByte(w[i]) 26 | } 27 | return b.String(), true 28 | } 29 | -------------------------------------------------------------------------------- /li-app/internal/middleware/err.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "github.com/gogf/gf/v2/errors/gcode" 5 | "github.com/gogf/gf/v2/errors/gerror" 6 | "github.com/gogf/gf/v2/net/ghttp" 7 | ) 8 | 9 | // ErrorHandler 用来兜底的错误处理 10 | func ErrorHandler(r *ghttp.Request) { 11 | r.Middleware.Next() 12 | if err := r.GetError(); err != nil { 13 | r.Response.ClearBuffer() 14 | var ( 15 | code = gerror.Code(err) 16 | msg string 17 | ) 18 | if code == gcode.CodeNil { 19 | code = gcode.CodeInternalError 20 | msg = err.Error() 21 | } else { 22 | code = gcode.CodeInternalError 23 | msg = "Oops, 服务器居然开小差了, 请稍后再试吧" 24 | } 25 | r.Response.WriteJson(ghttp.DefaultHandlerResponse{ 26 | Code: code.Code(), 27 | Message: msg, 28 | }) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/array-base/index.less: -------------------------------------------------------------------------------- 1 | @import '~@arco-design/web-react/lib/style/theme/default.less'; 2 | 3 | @array-base-prefix-cls: ~'@{prefix}-formily-array-base'; 4 | 5 | .@{array-base-prefix-cls}-remove { 6 | transition: all 0.25s ease-in-out; 7 | font-size: 16px; 8 | } 9 | 10 | .@{array-base-prefix-cls}-sort-handle { 11 | cursor: move; 12 | color: #888 !important; 13 | } 14 | 15 | .@{array-base-prefix-cls}-addition { 16 | transition: all 0.25s ease-in-out; 17 | } 18 | 19 | .@{array-base-prefix-cls}-move-down { 20 | transition: all 0.25s ease-in-out; 21 | font-size: 16px; 22 | margin-left: 6px; 23 | } 24 | 25 | .@{array-base-prefix-cls}-move-up { 26 | transition: all 0.25s ease-in-out; 27 | font-size: 16px; 28 | margin-left: 6px; 29 | } 30 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/components/list/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from "react"; 2 | import { TableProps } from "@arco-design/web-react"; 3 | import { Result } from "pro-utils"; 4 | import { ListProps } from "./types"; 5 | 6 | export type ReloadData = { 7 | page?: number; 8 | limit?: number; 9 | query?: string; 10 | sorter?: Record; 11 | filter?: Record; 12 | }; 13 | 14 | export type ListContextProps = { 15 | result?: Result; 16 | reload?: (values?: ReloadData) => void; 17 | tableProps?: TableProps & { 18 | onSearch?: (values: Record) => void; 19 | filter?: ListProps["filter"]; 20 | }; 21 | selectedKeys?: (string | number)[]; 22 | }; 23 | 24 | export const ListContext = createContext({}); 25 | -------------------------------------------------------------------------------- /li-web/apps/admin/mock/listUser.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | { id: "1", nickname: "A", email: "a@li.com", money: 178343434.89 }, 3 | { 4 | id: "2", 5 | nickname: "B", 6 | email: "b@li.com", 7 | likes: "LOL", 8 | friends: [ 9 | { id: "1", nickname: "A", email: "a@li.com", money: 178343434.89 }, 10 | { 11 | id: "3", 12 | nickname: "C", 13 | email: "c@li.com", 14 | avatar: 15 | "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/a8c8cdb109cb051163646151a4a5083b.png~tplv-uwbnlip3yd-webp.webp", 16 | }, 17 | ], 18 | }, 19 | { 20 | id: "3", 21 | nickname: "C", 22 | email: "c@li.com", 23 | avatar: 24 | "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/a8c8cdb109cb051163646151a4a5083b.png~tplv-uwbnlip3yd-webp.webp", 25 | }, 26 | ]; 27 | -------------------------------------------------------------------------------- /li-engine/view/node/node_actionformmodalcancel.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-engine/ac" 5 | "github.com/BeanWei/li/li-engine/view/ui" 6 | ) 7 | 8 | func ActionFormModalCancel(name string) *actionformmodalcancelBuilder { 9 | return &actionformmodalcancelBuilder{&NodeBuilder{ 10 | schema: &ui.Schema{ 11 | Name: name, 12 | Type: ui.SchemaTypeVoid, 13 | XComponent: ui.ComponentActionFormModalCancel, 14 | }, 15 | }} 16 | } 17 | 18 | type actionformmodalcancelBuilder struct { 19 | *NodeBuilder 20 | } 21 | 22 | func (b *actionformmodalcancelBuilder) AC(f ac.AC) *actionformmodalcancelBuilder { 23 | b.schema.AC = f 24 | return b 25 | } 26 | 27 | func (b *actionformmodalcancelBuilder) Title(title string) *actionformmodalcancelBuilder { 28 | b.SetTitle(title) 29 | return b 30 | } 31 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/locale/types.ts: -------------------------------------------------------------------------------- 1 | import { Locale as ArcoLocale } from "@arco-design/web-react/es/locale/interface"; 2 | 3 | export type Locale = ArcoLocale & { 4 | Chart: { 5 | nodata: string; 6 | }; 7 | ColorSelect: { 8 | red: string; 9 | orangered: string; 10 | orange: string; 11 | gold: string; 12 | lime: string; 13 | green: string; 14 | cyan: string; 15 | blue: string; 16 | arcobule: string; 17 | purple: string; 18 | pinkpurple: string; 19 | magenta: string; 20 | gray: string; 21 | }; 22 | List: { 23 | query: string; 24 | reset: string; 25 | search: string; 26 | confirmDelete: string; 27 | }; 28 | ListFilter: { 29 | yes: string; 30 | no: string; 31 | }; 32 | RecordPicker: { 33 | drawerTitle: string; 34 | }; 35 | }; 36 | -------------------------------------------------------------------------------- /li-engine/view/node/node_actionformdrawercancel.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-engine/ac" 5 | "github.com/BeanWei/li/li-engine/view/ui" 6 | ) 7 | 8 | func ActionFormDrawerCancel(name string) *actionformdrawercancelBuilder { 9 | return &actionformdrawercancelBuilder{&NodeBuilder{ 10 | schema: &ui.Schema{ 11 | Name: name, 12 | Type: ui.SchemaTypeVoid, 13 | XComponent: ui.ComponentActionFormDrawerCancel, 14 | }, 15 | }} 16 | } 17 | 18 | type actionformdrawercancelBuilder struct { 19 | *NodeBuilder 20 | } 21 | 22 | func (b *actionformdrawercancelBuilder) AC(f ac.AC) *actionformdrawercancelBuilder { 23 | b.schema.AC = f 24 | return b 25 | } 26 | 27 | func (b *actionformdrawercancelBuilder) Title(title string) *actionformdrawercancelBuilder { 28 | b.SetTitle(title) 29 | return b 30 | } 31 | -------------------------------------------------------------------------------- /li-web/packages/schema-components/src/locale/zh-CN.tsx: -------------------------------------------------------------------------------- 1 | import ArcoZhCN from "@arco-design/web-react/es/locale/zh-CN"; 2 | import { Locale } from "./types"; 3 | 4 | export const zhCN: Locale = { 5 | ...ArcoZhCN, 6 | Chart: { 7 | nodata: "暂无数据", 8 | }, 9 | ColorSelect: { 10 | red: "浪漫红", 11 | orangered: "晚秋黄", 12 | orange: "活力橙", 13 | gold: "黄昏", 14 | lime: "新生绿", 15 | green: "仙野绿", 16 | cyan: "碧涛青", 17 | blue: "海蔚蓝", 18 | arcobule: "极致蓝", 19 | purple: "暗夜紫", 20 | pinkpurple: "青春紫", 21 | magenta: "品红", 22 | gray: "中性灰", 23 | }, 24 | List: { 25 | query: "查询", 26 | reset: "重置", 27 | search: "搜索", 28 | confirmDelete: "你确定要删除吗?", 29 | }, 30 | ListFilter: { 31 | yes: "是", 32 | no: "否", 33 | }, 34 | RecordPicker: { 35 | drawerTitle: "请选择", 36 | }, 37 | }; 38 | -------------------------------------------------------------------------------- /li-engine/contrib/liflow/executor/exclusive_gateway.go: -------------------------------------------------------------------------------- 1 | package executor 2 | 3 | import "github.com/BeanWei/li/li-engine/contrib/liflow" 4 | 5 | type ExclusiveGatewayExecutor struct { 6 | ElementExecutor 7 | } 8 | 9 | func (e *ExclusiveGatewayExecutor) Execute(ctx *liflow.FlowCtx) error { 10 | // TODO: 2022/05/01 Support hook 11 | ctx.CurrentNodeInstance.FlowInstanceDataID = ctx.InstanceDataID 12 | ctx.CurrentNodeInstance.Status = liflow.FlowNodeInstanceStatusCompleted 13 | ctx.NodeInstanceList = append(ctx.NodeInstanceList, *ctx.CurrentNodeInstance) 14 | return nil 15 | } 16 | 17 | func (e *ExclusiveGatewayExecutor) GetExecuteExecutor(ctx *liflow.FlowCtx) liflow.Executor { 18 | nextNode := ctx.CalculateNextNode(ctx.CurrentNodeModel, ctx.InstanceDataMap) 19 | ctx.CurrentNodeModel = nextNode 20 | return liflow.GetElementExecutor(nextNode.Type) 21 | } 22 | -------------------------------------------------------------------------------- /li-engine/view/node/node_dropdownmenuitem.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-engine/ac" 5 | "github.com/BeanWei/li/li-engine/view/ui" 6 | ) 7 | 8 | func DropdownMenuItem(name string) *dropdownmenuitemBuilder { 9 | return &dropdownmenuitemBuilder{&NodeBuilder{ 10 | schema: &ui.Schema{ 11 | Name: name, 12 | Type: ui.SchemaTypeVoid, 13 | XComponent: ui.ComponentDropdownMenuItem, 14 | XComponentProps: make(map[string]interface{}), 15 | }, 16 | }} 17 | } 18 | 19 | type dropdownmenuitemBuilder struct { 20 | *NodeBuilder 21 | } 22 | 23 | func (b *dropdownmenuitemBuilder) AC(f ac.AC) *dropdownmenuitemBuilder { 24 | b.schema.AC = f 25 | return b 26 | } 27 | 28 | func (b *dropdownmenuitemBuilder) Title(title string) *dropdownmenuitemBuilder { 29 | b.SetTitle(title) 30 | return b 31 | } 32 | -------------------------------------------------------------------------------- /li-engine/view/node/node_arrayitemsindex.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-engine/ac" 5 | "github.com/BeanWei/li/li-engine/view/ui" 6 | ) 7 | 8 | func ArrayItemsIndex(name string) *arrayitemsindexBuilder { 9 | return &arrayitemsindexBuilder{&NodeBuilder{ 10 | schema: &ui.Schema{ 11 | Name: name, 12 | Type: ui.SchemaTypeVoid, 13 | XComponent: ui.ComponentArrayItemsIndex, 14 | XComponentProps: make(map[string]interface{}), 15 | }, 16 | }} 17 | } 18 | 19 | type arrayitemsindexBuilder struct { 20 | *NodeBuilder 21 | } 22 | 23 | func (b *arrayitemsindexBuilder) AC(f ac.AC) *arrayitemsindexBuilder { 24 | b.schema.AC = f 25 | return b 26 | } 27 | 28 | func (b *arrayitemsindexBuilder) Title(title string) *arrayitemsindexBuilder { 29 | b.schema.XComponentProps["title"] = title 30 | return b 31 | } 32 | -------------------------------------------------------------------------------- /li-engine/view/node/node_arraytableindex.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | import ( 4 | "github.com/BeanWei/li/li-engine/ac" 5 | "github.com/BeanWei/li/li-engine/view/ui" 6 | ) 7 | 8 | func ArrayTableIndex(name string) *arraytableindexBuilder { 9 | return &arraytableindexBuilder{&NodeBuilder{ 10 | schema: &ui.Schema{ 11 | Name: name, 12 | Type: ui.SchemaTypeVoid, 13 | XComponent: ui.ComponentArrayTableIndex, 14 | XComponentProps: make(map[string]interface{}), 15 | }, 16 | }} 17 | } 18 | 19 | type arraytableindexBuilder struct { 20 | *NodeBuilder 21 | } 22 | 23 | func (b *arraytableindexBuilder) AC(f ac.AC) *arraytableindexBuilder { 24 | b.schema.AC = f 25 | return b 26 | } 27 | 28 | func (b *arraytableindexBuilder) Title(title string) *arraytableindexBuilder { 29 | b.schema.XComponentProps["title"] = title 30 | return b 31 | } 32 | -------------------------------------------------------------------------------- /li-web/apps/admin/src/modules/schema-components/theme-switch/index.tsx: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { Button, ButtonProps } from "@arco-design/web-react"; 3 | import { IconMoonFill, IconSunFill } from "@arco-design/web-react/icon"; 4 | import { observer } from "@formily/react"; 5 | import { GlobalContext } from "../../../context"; 6 | 7 | export const ThemeSwitch: React.FC = observer((props) => { 8 | const { theme, setTheme } = useContext(GlobalContext); 9 | 10 | return ( 11 |