@vyr/element-plus 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +24 -0
- package/src/actor/ElButtonActor.ts +42 -0
- package/src/actor/ElCascaderActor.ts +43 -0
- package/src/actor/ElCheckboxActor.ts +46 -0
- package/src/actor/ElColActor.ts +36 -0
- package/src/actor/ElDatePickerActor.ts +42 -0
- package/src/actor/ElDialogActor.ts +38 -0
- package/src/actor/ElFormActor.ts +46 -0
- package/src/actor/ElFormItemActor.ts +81 -0
- package/src/actor/ElInputActor.ts +47 -0
- package/src/actor/ElInputNumberActor.ts +38 -0
- package/src/actor/ElMenuActor.ts +35 -0
- package/src/actor/ElMenuItemActor.ts +46 -0
- package/src/actor/ElPaginationActor.ts +83 -0
- package/src/actor/ElRadioActor.ts +46 -0
- package/src/actor/ElRowActor.ts +37 -0
- package/src/actor/ElSelectActor.ts +49 -0
- package/src/actor/ElSubMenuActor.ts +46 -0
- package/src/actor/ElSwitchActor.ts +26 -0
- package/src/actor/ElTableActor.ts +35 -0
- package/src/actor/ElTableColumnActor.ts +72 -0
- package/src/actor/index.ts +20 -0
- package/src/asset/index.ts +17 -0
- package/src/descriptor/ElButtonDescriptor.ts +36 -0
- package/src/descriptor/ElCascaderDescriptor.ts +43 -0
- package/src/descriptor/ElCheckboxDescriptor.ts +41 -0
- package/src/descriptor/ElColDescriptor.ts +20 -0
- package/src/descriptor/ElDatePickerDescriptor.ts +43 -0
- package/src/descriptor/ElDialogDescriptor.ts +24 -0
- package/src/descriptor/ElFormDescriptor.ts +60 -0
- package/src/descriptor/ElFormItemDescriptor.ts +14 -0
- package/src/descriptor/ElInputDescriptor.ts +56 -0
- package/src/descriptor/ElInputNumberDescriptor.ts +38 -0
- package/src/descriptor/ElMenuDescriptor.ts +26 -0
- package/src/descriptor/ElMenuItemDescriptor.ts +22 -0
- package/src/descriptor/ElPaginationDescriptor.ts +52 -0
- package/src/descriptor/ElRadioDescriptor.ts +41 -0
- package/src/descriptor/ElRowDescriptor.ts +22 -0
- package/src/descriptor/ElSelectDescriptor.ts +43 -0
- package/src/descriptor/ElSubMenuDescriptor.ts +20 -0
- package/src/descriptor/ElSwitchDescriptor.ts +35 -0
- package/src/descriptor/ElTableColumnDescriptor.ts +41 -0
- package/src/descriptor/ElTableDescriptor.ts +26 -0
- package/src/descriptor/index.ts +20 -0
- package/src/index.ts +7 -0
- package/src/interpreter/ElButtonInterpreter.ts +18 -0
- package/src/interpreter/ElCascaderInterpreter.ts +18 -0
- package/src/interpreter/ElCheckboxInterpreter.ts +18 -0
- package/src/interpreter/ElColInterpreter.ts +18 -0
- package/src/interpreter/ElDatePickerInterpreter.ts +18 -0
- package/src/interpreter/ElDialogInterpreter.ts +18 -0
- package/src/interpreter/ElFormInterpreter.ts +18 -0
- package/src/interpreter/ElInputInterpreter.ts +18 -0
- package/src/interpreter/ElInputNumberInterpreter.ts +18 -0
- package/src/interpreter/ElMenuInterpreter.ts +18 -0
- package/src/interpreter/ElMenuItemInterpreter.ts +18 -0
- package/src/interpreter/ElPaginationInterpreter.ts +18 -0
- package/src/interpreter/ElRadioInterpreter.ts +18 -0
- package/src/interpreter/ElRowInterpreter.ts +18 -0
- package/src/interpreter/ElSelectInterpreter.ts +18 -0
- package/src/interpreter/ElSubMenuInterpreter.ts +18 -0
- package/src/interpreter/ElSwitchInterpreter.ts +18 -0
- package/src/interpreter/ElTableColumnInterpreter.ts +18 -0
- package/src/interpreter/ElTableInterpreter.ts +18 -0
- package/src/interpreter/index.ts +33 -0
- package/src/locale/Language.ts +10 -0
- package/src/locale/LanguageProvider.ts +64 -0
- package/src/locale/index.ts +2 -0
- package/src/preset/execute/ElDialog/close.ts +48 -0
- package/src/preset/execute/ElDialog/index.ts +2 -0
- package/src/preset/execute/ElDialog/open.ts +51 -0
- package/src/preset/execute/ElForm/branch.ts +47 -0
- package/src/preset/execute/ElForm/create.ts +31 -0
- package/src/preset/execute/ElForm/edit.ts +31 -0
- package/src/preset/execute/ElForm/getData.ts +51 -0
- package/src/preset/execute/ElForm/index.ts +5 -0
- package/src/preset/execute/ElForm/reset.ts +55 -0
- package/src/preset/execute/ElPagination/getData.ts +48 -0
- package/src/preset/execute/ElPagination/index.ts +2 -0
- package/src/preset/execute/ElPagination/reset.ts +46 -0
- package/src/preset/execute/ElTable/create.ts +38 -0
- package/src/preset/execute/ElTable/delete.ts +53 -0
- package/src/preset/execute/ElTable/edit.ts +38 -0
- package/src/preset/execute/ElTable/index.ts +3 -0
- package/src/preset/execute/ElTableColumn/formatter.ts +74 -0
- package/src/preset/execute/ElTableColumn/index.ts +1 -0
- package/src/preset/execute/index.ts +5 -0
- package/src/preset/index.ts +7 -0
- package/src/preset/routine/ElDialog/close.ts +26 -0
- package/src/preset/routine/ElDialog/index.ts +1 -0
- package/src/preset/routine/ElTable/create.ts +31 -0
- package/src/preset/routine/ElTable/delete.ts +31 -0
- package/src/preset/routine/ElTable/edit.ts +33 -0
- package/src/preset/routine/ElTable/index.ts +6 -0
- package/src/preset/routine/ElTable/list.ts +32 -0
- package/src/preset/routine/ElTable/reset.ts +31 -0
- package/src/preset/routine/ElTable/submit.ts +45 -0
- package/src/preset/routine/index.ts +2 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/utils/form.ts +72 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/style.ts +9 -0
- package/src/utils/validator.ts +30 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElMenuItemDescriptor } from "../descriptor";
|
|
5
|
+
import { ElMenuItemActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElMenuItemInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElMenuItemDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElMenuItemDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElMenuItemActor(descriptor.uuid)) as ElMenuItemActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElMenuItemInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElMenuItemInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElPaginationDescriptor } from "../descriptor";
|
|
5
|
+
import { ElPaginationActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElPaginationInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElPaginationDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElPaginationDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElPaginationActor(descriptor.uuid)) as ElPaginationActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElPaginationInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElPaginationInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElRadioDescriptor } from "../descriptor";
|
|
5
|
+
import { ElRadioActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElRadioInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElRadioDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElRadioDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElRadioActor(descriptor.uuid)) as ElRadioActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElRadioInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElRadioInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElRowDescriptor } from "../descriptor";
|
|
5
|
+
import { ElRowActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElRowInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElRowDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElRowDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElRowActor(descriptor.uuid)) as ElRowActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElRowInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElRowInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElSelectDescriptor } from "../descriptor";
|
|
5
|
+
import { ElSelectActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElSelectInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElSelectDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElSelectDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElSelectActor(descriptor.uuid)) as ElSelectActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElSelectInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElSelectInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElSubMenuDescriptor } from "../descriptor";
|
|
5
|
+
import { ElSubMenuActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElSubMenuInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElSubMenuDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElSubMenuDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElSubMenuActor(descriptor.uuid)) as ElSubMenuActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElSubMenuInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElSubMenuInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElSwitchDescriptor } from "../descriptor";
|
|
5
|
+
import { ElSwitchActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElSwitchInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElSwitchDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElSwitchDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElSwitchActor(descriptor.uuid)) as ElSwitchActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElSwitchInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElSwitchInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElTableColumnDescriptor } from "../descriptor";
|
|
5
|
+
import { ElTableColumnActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElTableColumnInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElTableColumnDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElTableColumnDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElTableColumnActor(descriptor.uuid)) as ElTableColumnActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElTableColumnInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElTableColumnInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
import { UpdateArgs } from "@vyr/engine";
|
|
3
|
+
import { VueInterpreter } from "@vyr/vue";
|
|
4
|
+
import { ElTableDescriptor } from "../descriptor";
|
|
5
|
+
import { ElTableActor } from "../actor";
|
|
6
|
+
|
|
7
|
+
class ElTableInterpreter extends VueInterpreter {
|
|
8
|
+
static type = ElTableDescriptor.type
|
|
9
|
+
|
|
10
|
+
protected createActor(descriptor: ElTableDescriptor, args: UpdateArgs) {
|
|
11
|
+
return reactive(new ElTableActor(descriptor.uuid)) as ElTableActor
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
VueInterpreter.register(ElTableInterpreter)
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ElTableInterpreter
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Element from 'element-plus'
|
|
2
|
+
//@ts-ignore
|
|
3
|
+
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
4
|
+
import 'element-plus/dist/index.css'
|
|
5
|
+
import { Locale } from '@vyr/locale'
|
|
6
|
+
import { VueDescriptor } from '@vyr/vue'
|
|
7
|
+
import { language } from '../locale'
|
|
8
|
+
|
|
9
|
+
VueDescriptor.use(Element, () => {
|
|
10
|
+
const current = Locale.getLanguage(language.name)
|
|
11
|
+
//@ts-ignore
|
|
12
|
+
if (current._provider.id === language._provider.id) return { locale: zhCn }
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export * from './ElButtonInterpreter'
|
|
16
|
+
export * from './ElRowInterpreter'
|
|
17
|
+
export * from './ElColInterpreter'
|
|
18
|
+
export * from './ElFormInterpreter'
|
|
19
|
+
export * from './ElInputInterpreter'
|
|
20
|
+
export * from './ElInputNumberInterpreter'
|
|
21
|
+
export * from './ElSelectInterpreter'
|
|
22
|
+
export * from './ElCascaderInterpreter'
|
|
23
|
+
export * from './ElCheckboxInterpreter'
|
|
24
|
+
export * from './ElDatePickerInterpreter'
|
|
25
|
+
export * from './ElRadioInterpreter'
|
|
26
|
+
export * from './ElSwitchInterpreter'
|
|
27
|
+
export * from './ElTableColumnInterpreter'
|
|
28
|
+
export * from './ElTableInterpreter'
|
|
29
|
+
export * from './ElDialogInterpreter'
|
|
30
|
+
export * from './ElPaginationInterpreter'
|
|
31
|
+
export * from './ElMenuInterpreter'
|
|
32
|
+
export * from './ElSubMenuInterpreter'
|
|
33
|
+
export * from './ElMenuItemInterpreter'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Locale } from "@vyr/locale";
|
|
2
|
+
import { zhCnLanguageProvider, ZhCNLanguageProvider } from "./LanguageProvider";
|
|
3
|
+
|
|
4
|
+
Locale.register(zhCnLanguageProvider)
|
|
5
|
+
|
|
6
|
+
const language = Locale.getLanguage<ZhCNLanguageProvider>(zhCnLanguageProvider.name)
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
language
|
|
10
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LanguageProvider } from '@vyr/locale'
|
|
2
|
+
|
|
3
|
+
interface ZhCNLanguageProvider extends LanguageProvider {
|
|
4
|
+
'utils.validator.required': string
|
|
5
|
+
|
|
6
|
+
'/virtual:/preset/ElForm/getData.ts': string
|
|
7
|
+
'/virtual:/preset/ElForm/reset.ts': string
|
|
8
|
+
'/virtual:/preset/ElForm/branch.ts': string
|
|
9
|
+
'/virtual:/preset/ElForm/branch/create.ts': string
|
|
10
|
+
'/virtual:/preset/ElForm/branch/edit.ts': string
|
|
11
|
+
|
|
12
|
+
'/virtual:/preset/ElPagination/getData.ts': string
|
|
13
|
+
'/virtual:/preset/ElPagination/reset.ts': string
|
|
14
|
+
|
|
15
|
+
'/virtual:/preset/ElTable/create.ts': string
|
|
16
|
+
|
|
17
|
+
'/virtual:/preset/ElTable/edit.ts': string
|
|
18
|
+
|
|
19
|
+
'/virtual:/preset/ElTable/delete.ts': string
|
|
20
|
+
|
|
21
|
+
'/virtual:/preset/ElTableColumn/formatter.ts': string
|
|
22
|
+
|
|
23
|
+
'/virtual:/preset/ElDialog/open.ts': string
|
|
24
|
+
|
|
25
|
+
'/virtual:/preset/ElDialog/close.ts': string
|
|
26
|
+
|
|
27
|
+
'preset.ElMessageBox.title': string
|
|
28
|
+
'preset.ElTable.delete.message': string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const zhCnLanguageProvider: ZhCNLanguageProvider = {
|
|
32
|
+
id: 'zh_CN',
|
|
33
|
+
name: '@vyr/element-plus',
|
|
34
|
+
'utils.validator.required': '{{name}}不能为空!',
|
|
35
|
+
|
|
36
|
+
'/virtual:/preset/ElForm/getData.ts': '获取表单数据',
|
|
37
|
+
'/virtual:/preset/ElForm/reset.ts': '重置表单',
|
|
38
|
+
'/virtual:/preset/ElForm/branch.ts': '是否为新增表单',
|
|
39
|
+
'/virtual:/preset/ElForm/branch/create.ts': '新增表单',
|
|
40
|
+
'/virtual:/preset/ElForm/branch/edit.ts': '编辑表单',
|
|
41
|
+
|
|
42
|
+
'/virtual:/preset/ElPagination/getData.ts': '获取分页数据',
|
|
43
|
+
'/virtual:/preset/ElPagination/reset.ts': '重置分页',
|
|
44
|
+
|
|
45
|
+
'/virtual:/preset/ElTable/create.ts': '新增表格项',
|
|
46
|
+
|
|
47
|
+
'/virtual:/preset/ElTable/edit.ts': '编辑表格项',
|
|
48
|
+
|
|
49
|
+
'/virtual:/preset/ElTable/delete.ts': '删除表格项',
|
|
50
|
+
|
|
51
|
+
'/virtual:/preset/ElTableColumn/formatter.ts': '格式化表格列',
|
|
52
|
+
|
|
53
|
+
'/virtual:/preset/ElDialog/open.ts': '打开弹窗',
|
|
54
|
+
|
|
55
|
+
'/virtual:/preset/ElDialog/close.ts': '关闭弹窗',
|
|
56
|
+
|
|
57
|
+
'preset.ElMessageBox.title': '系统提示',
|
|
58
|
+
'preset.ElTable.delete.message': '您确认删除该条数据吗?',
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
ZhCNLanguageProvider,
|
|
63
|
+
zhCnLanguageProvider,
|
|
64
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Asset, Descriptor, Graphics, RoutineNode, Scriptable, UpdateArgs } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
import { ElDialogDescriptor } from "../../../descriptor"
|
|
4
|
+
|
|
5
|
+
const scriptable = Asset.createVirtualUrl('preset/ElDialog/close.ts')
|
|
6
|
+
class RoutineScriptable extends Scriptable {
|
|
7
|
+
async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const { input } = args
|
|
10
|
+
const dialog = input?.user?.dialog.value ?? input.default.dialog.value
|
|
11
|
+
|
|
12
|
+
const dialogDescriptor = ElDialogDescriptor.get<ElDialogDescriptor>(dialog)
|
|
13
|
+
if (dialogDescriptor === null) return
|
|
14
|
+
|
|
15
|
+
dialogDescriptor.visible = false
|
|
16
|
+
|
|
17
|
+
dialogDescriptor.setNeedsUpdate()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
Asset.provider(scriptable, async () => ({ default: RoutineScriptable }))
|
|
21
|
+
|
|
22
|
+
const createExecuteInput = (args: any = {}) => {
|
|
23
|
+
const input = {
|
|
24
|
+
dialog: { value: args.dialog ?? '' }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return input
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
31
|
+
const executeNode: RoutineNode = {
|
|
32
|
+
id: options.id,
|
|
33
|
+
label: language.get(scriptable as any),
|
|
34
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
35
|
+
routine: 'Execute',
|
|
36
|
+
url: scriptable,
|
|
37
|
+
input: createExecuteInput(options.input)
|
|
38
|
+
}
|
|
39
|
+
return executeNode
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
scriptable,
|
|
44
|
+
createExecuteInput,
|
|
45
|
+
createExecuteNode,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Asset, Descriptor, Graphics, RoutineNode, Scriptable, UpdateArgs } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
import { ElDialogDescriptor } from "../../../descriptor"
|
|
4
|
+
|
|
5
|
+
const scriptable = Asset.createVirtualUrl('preset/ElDialog/open.ts')
|
|
6
|
+
class RoutineScriptable extends Scriptable {
|
|
7
|
+
async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const { input } = args
|
|
10
|
+
const dialog = input?.user?.dialog.value ?? input.default.dialog.value
|
|
11
|
+
const title = input?.user?.title.value ?? input.default.title.value
|
|
12
|
+
|
|
13
|
+
const dialogDescriptor = ElDialogDescriptor.get<ElDialogDescriptor>(dialog)
|
|
14
|
+
if (dialogDescriptor === null) return
|
|
15
|
+
|
|
16
|
+
dialogDescriptor.title = title
|
|
17
|
+
dialogDescriptor.visible = true
|
|
18
|
+
|
|
19
|
+
dialogDescriptor.setNeedsUpdate()
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
Asset.provider(scriptable, async () => ({ default: RoutineScriptable }))
|
|
23
|
+
|
|
24
|
+
const createExecuteInput = (args: any = {}) => {
|
|
25
|
+
const input = {
|
|
26
|
+
dialog: { value: args.dialog ?? '' },
|
|
27
|
+
title: { value: args.title ?? '系统弹窗' }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return input
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
34
|
+
const executeNode: RoutineNode = {
|
|
35
|
+
id: options.id,
|
|
36
|
+
label: language.get(scriptable as any),
|
|
37
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
38
|
+
routine: 'Execute',
|
|
39
|
+
url: scriptable,
|
|
40
|
+
input: createExecuteInput(options.input)
|
|
41
|
+
}
|
|
42
|
+
return executeNode
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
scriptable,
|
|
47
|
+
createExecuteInput,
|
|
48
|
+
createExecuteNode,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Asset, Descriptor, Graphics, RoutineNode, Scriptable, UpdateArgs } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
|
|
4
|
+
const scriptable = Asset.createVirtualUrl('preset/ElForm/branch.ts')
|
|
5
|
+
class RoutineScriptable extends Scriptable {
|
|
6
|
+
execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
|
|
7
|
+
//@ts-ignore
|
|
8
|
+
const { input, result } = args
|
|
9
|
+
const primaryKey = input?.user?.primaryKey.value ?? input.default.primaryKey.value
|
|
10
|
+
|
|
11
|
+
if (!primaryKey) return
|
|
12
|
+
|
|
13
|
+
const formData = result.get(input.previous)
|
|
14
|
+
|
|
15
|
+
const value = formData[primaryKey]
|
|
16
|
+
|
|
17
|
+
return ['number', 'string'].includes(typeof value) && value.length > 0 ? '1' : '0'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
Asset.provider(scriptable, async () => ({ default: RoutineScriptable }))
|
|
21
|
+
|
|
22
|
+
const createExecuteInput = (args: any = {}) => {
|
|
23
|
+
const input = {
|
|
24
|
+
primaryKey: { value: args.primaryKey ?? 'id' },
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return input
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
31
|
+
const executeNode: RoutineNode = {
|
|
32
|
+
id: options.id,
|
|
33
|
+
label: language.get(scriptable as any),
|
|
34
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
35
|
+
routine: 'Branch',
|
|
36
|
+
url: scriptable,
|
|
37
|
+
input: createExecuteInput(options.input)
|
|
38
|
+
}
|
|
39
|
+
return executeNode
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
scriptable,
|
|
44
|
+
createExecuteInput,
|
|
45
|
+
createExecuteNode,
|
|
46
|
+
}
|
|
47
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Asset, RoutineNode } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
|
|
4
|
+
const scriptable = Asset.createVirtualUrl('preset/ElForm/branch/create.ts')
|
|
5
|
+
|
|
6
|
+
const createExecuteInput = (args: any = {}) => {
|
|
7
|
+
const input = {
|
|
8
|
+
condition: { value: args.condition ?? '0' }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return input
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
15
|
+
const executeNode: RoutineNode = {
|
|
16
|
+
id: options.id,
|
|
17
|
+
label: language.get(scriptable as any),
|
|
18
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
19
|
+
routine: 'Condition',
|
|
20
|
+
url: '',
|
|
21
|
+
input: createExecuteInput(options.input)
|
|
22
|
+
}
|
|
23
|
+
return executeNode
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
scriptable,
|
|
28
|
+
createExecuteInput,
|
|
29
|
+
createExecuteNode,
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Asset, RoutineNode } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
|
|
4
|
+
const scriptable = Asset.createVirtualUrl('preset/ElForm/branch/edit.ts')
|
|
5
|
+
|
|
6
|
+
const createExecuteInput = (args: any = {}) => {
|
|
7
|
+
const input = {
|
|
8
|
+
condition: { value: args.condition ?? '1' }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return input
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
15
|
+
const executeNode: RoutineNode = {
|
|
16
|
+
id: options.id,
|
|
17
|
+
label: language.get(scriptable as any),
|
|
18
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
19
|
+
routine: 'Condition',
|
|
20
|
+
url: '',
|
|
21
|
+
input: createExecuteInput(options.input)
|
|
22
|
+
}
|
|
23
|
+
return executeNode
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
scriptable,
|
|
28
|
+
createExecuteInput,
|
|
29
|
+
createExecuteNode,
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Asset, Descriptor, Graphics, RoutineNode, Scriptable, UpdateArgs } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
import { ElFormDescriptor } from "../../../descriptor"
|
|
4
|
+
|
|
5
|
+
const scriptable = Asset.createVirtualUrl('preset/ElForm/getData.ts')
|
|
6
|
+
class RoutineScriptable extends Scriptable {
|
|
7
|
+
async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const { input } = args
|
|
10
|
+
const form = input?.user?.form.value ?? input.default.form.value
|
|
11
|
+
const validate = input?.user?.validate.value ?? input.default.validate.value
|
|
12
|
+
|
|
13
|
+
const formDescriptor = Descriptor.get<ElFormDescriptor>(form)
|
|
14
|
+
if (formDescriptor instanceof ElFormDescriptor) {
|
|
15
|
+
if (validate === '1') await formDescriptor.validate(graphics)
|
|
16
|
+
return await formDescriptor.getData(graphics)
|
|
17
|
+
} else {
|
|
18
|
+
return {}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
Asset.provider(scriptable, async () => ({ default: RoutineScriptable }))
|
|
23
|
+
|
|
24
|
+
const createExecuteInput = (args: any = {}) => {
|
|
25
|
+
const input = {
|
|
26
|
+
form: { value: args.form ?? '' },
|
|
27
|
+
validate: { value: args.validate ?? '0' },
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return input
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
34
|
+
const executeNode: RoutineNode = {
|
|
35
|
+
id: options.id,
|
|
36
|
+
label: language.get(scriptable as any),
|
|
37
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
38
|
+
routine: 'Execute',
|
|
39
|
+
url: scriptable,
|
|
40
|
+
input: createExecuteInput(options.input)
|
|
41
|
+
}
|
|
42
|
+
return executeNode
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
scriptable,
|
|
47
|
+
createExecuteInput,
|
|
48
|
+
createExecuteNode,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Asset, Descriptor, Graphics, RoutineNode, Scriptable, UpdateArgs, AsyncTask } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
import { ElFormDescriptor, ElFormItemDescriptor } from "../../../descriptor"
|
|
4
|
+
|
|
5
|
+
const scriptable = Asset.createVirtualUrl('preset/ElForm/reset.ts')
|
|
6
|
+
class RoutineScriptable extends Scriptable {
|
|
7
|
+
async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const { input } = args
|
|
10
|
+
const form = input?.user?.form.value ?? input.default.form.value
|
|
11
|
+
|
|
12
|
+
const formDescriptor = Descriptor.get<ElFormDescriptor>(form)
|
|
13
|
+
if (formDescriptor instanceof ElFormDescriptor) {
|
|
14
|
+
for (const item of formDescriptor.children) {
|
|
15
|
+
if (item instanceof ElFormItemDescriptor) {
|
|
16
|
+
item.modelValue = ''
|
|
17
|
+
item.setNeedsUpdate()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const task = new AsyncTask()
|
|
23
|
+
graphics.engine.listen('afterRender', () => { task.run() }, { once: true })
|
|
24
|
+
await task.done()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
Asset.provider(scriptable, async () => ({ default: RoutineScriptable }))
|
|
28
|
+
|
|
29
|
+
const createExecuteInput = (args: any = {}) => {
|
|
30
|
+
const input = {
|
|
31
|
+
form: { value: args.form ?? '' },
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return input
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
38
|
+
const executeNode: RoutineNode = {
|
|
39
|
+
id: options.id,
|
|
40
|
+
label: language.get(scriptable as any),
|
|
41
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
42
|
+
routine: 'Execute',
|
|
43
|
+
url: scriptable,
|
|
44
|
+
input: createExecuteInput(options.input)
|
|
45
|
+
}
|
|
46
|
+
return executeNode
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
scriptable,
|
|
51
|
+
createExecuteInput,
|
|
52
|
+
createExecuteNode,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Asset, Descriptor, Graphics, RoutineNode, Scriptable, UpdateArgs } from "@vyr/engine"
|
|
2
|
+
import { language } from '../../../locale'
|
|
3
|
+
import { ElPaginationDescriptor } from "../../../descriptor"
|
|
4
|
+
|
|
5
|
+
const scriptable = Asset.createVirtualUrl('preset/ElPagination/getData.ts')
|
|
6
|
+
class RoutineScriptable extends Scriptable {
|
|
7
|
+
execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const { input } = args
|
|
10
|
+
const pagination = input?.user?.pagination.value ?? input.default.pagination.value
|
|
11
|
+
|
|
12
|
+
const paginationDescriptor = Descriptor.get<ElPaginationDescriptor>(pagination)
|
|
13
|
+
if (paginationDescriptor instanceof ElPaginationDescriptor) {
|
|
14
|
+
return paginationDescriptor.getData(graphics)
|
|
15
|
+
} else {
|
|
16
|
+
return {}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
Asset.provider(scriptable, async () => ({ default: RoutineScriptable }))
|
|
21
|
+
|
|
22
|
+
const createExecuteInput = (args: any = {}) => {
|
|
23
|
+
const input = {
|
|
24
|
+
pagination: { value: args.pagination ?? '' }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return input
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
|
|
31
|
+
const executeNode: RoutineNode = {
|
|
32
|
+
id: options.id,
|
|
33
|
+
label: language.get(scriptable as any),
|
|
34
|
+
position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
|
|
35
|
+
routine: 'Execute',
|
|
36
|
+
url: scriptable,
|
|
37
|
+
input: createExecuteInput(options.input)
|
|
38
|
+
}
|
|
39
|
+
return executeNode
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
scriptable,
|
|
44
|
+
createExecuteInput,
|
|
45
|
+
createExecuteNode,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|