@cicctencent/formily 0.0.0-stage → 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/.eslintrc.js +40 -0
- package/.prettierrc.js +28 -0
- package/.vscode/launch.json +23 -0
- package/CHANGELOG.md +8 -0
- package/README.md +22 -2
- package/babel.config.js +3 -0
- package/build/build.js +96 -0
- package/build/rollup.config.bundle.js +63 -0
- package/build/update.version.js +35 -0
- package/dist/index.css +2516 -0
- package/dist/index.js +8377 -0
- package/dist/schema-field/index.css +2466 -0
- package/dist/schema-field/index.js +8213 -0
- package/dist/transform/index.js +551 -0
- package/dist/validate/index.js +1104 -0
- package/dist/vue-form/index.css +2516 -0
- package/dist/vue-form/index.js +8359 -0
- package/docs/.vuepress/client.ts +15 -0
- package/docs/.vuepress/components/code-preview.vue +203 -0
- package/docs/.vuepress/components/highlight.ts +53 -0
- package/docs/.vuepress/config.ts +39 -0
- package/docs/.vuepress/util.ts +7 -0
- package/docs/README.md +30 -0
- package/docs/components/anyOf.md +26 -0
- package/docs/components/array-cards.md +12 -0
- package/docs/components/array-collapse.md +12 -0
- package/docs/components/array-items.md +12 -0
- package/docs/components/array-table.md +12 -0
- package/docs/components/array-tabs.md +16 -0
- package/docs/components/cascader.md +12 -0
- package/docs/components/checkbox.md +12 -0
- package/docs/components/event.md +27 -0
- package/docs/components/hotArea.md +25 -0
- package/docs/components/index.md +4 -0
- package/docs/components/input.md +30 -0
- package/docs/components/layout-group.md +19 -0
- package/docs/components/link.md +22 -0
- package/docs/components/oneOf.md +8 -0
- package/docs/components/radio.md +12 -0
- package/docs/components/rich-editor.md +21 -0
- package/docs/components/select.md +34 -0
- package/docs/components/space.md +11 -0
- package/docs/components/switch.md +20 -0
- package/docs/components/text.md +21 -0
- package/docs/components/time-picker.md +11 -0
- package/docs/components/transfer.md +14 -0
- package/docs/components/upload-button.md +28 -0
- package/docs/demos/any-of/index.vue +66 -0
- package/docs/demos/array-cards/index.vue +105 -0
- package/docs/demos/array-collapse/index.vue +155 -0
- package/docs/demos/array-items/index.vue +171 -0
- package/docs/demos/array-table/index.vue +115 -0
- package/docs/demos/array-tabs/index.vue +56 -0
- package/docs/demos/cascader/index.vue +297 -0
- package/docs/demos/checkbox/index.vue +39 -0
- package/docs/demos/event/index.vue +436 -0
- package/docs/demos/hotArea/index.vue +240 -0
- package/docs/demos/index.vue +36 -0
- package/docs/demos/input/index.vue +46 -0
- package/docs/demos/layout-group/index.vue +51 -0
- package/docs/demos/link/index.vue +32 -0
- package/docs/demos/radio/index.vue +36 -0
- package/docs/demos/rich-editor/index.vue +22 -0
- package/docs/demos/select/index.vue +76 -0
- package/docs/demos/space/index.vue +93 -0
- package/docs/demos/switch/index.vue +31 -0
- package/docs/demos/text/index.vue +38 -0
- package/docs/demos/time-picker/index.vue +39 -0
- package/docs/demos/transfer/index.vue +26 -0
- package/docs/demos/upload-button/index.vue +27 -0
- package/docs/demos/x-data/add-button-title.vue +101 -0
- package/docs/demos/x-data/send-message.vue +33 -0
- package/docs/demos/x-reactions/any-of.vue +40 -0
- package/docs/demos/x-reactions/x-reactions.vue +39 -0
- package/docs/guide/component-extend.md +23 -0
- package/docs/guide/extra-bury-report.md +64 -0
- package/docs/guide/schema.md +22 -0
- package/docs/guide/x-data.md +41 -0
- package/docs/guide/x-reactions.md +20 -0
- package/example/.browserslistrc +4 -0
- package/example/.eslintrc.js +20 -0
- package/example/README.md +24 -0
- package/example/index.html +15 -0
- package/example/jest.config.js +26 -0
- package/example/package.json +50 -0
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +17 -0
- package/example/src/App.vue +25 -0
- package/example/src/assets/logo.png +0 -0
- package/example/src/components/HelloWorld.vue +148 -0
- package/example/src/components/group/index.vue +16 -0
- package/example/src/components/uploadBtn/index.vue +44 -0
- package/example/src/components/uploadBtn/upload-icon.svg +6 -0
- package/example/src/layout/component/Aside.vue +39 -0
- package/example/src/layout/component/Main.vue +9 -0
- package/example/src/layout/index.vue +15 -0
- package/example/src/main.ts +17 -0
- package/example/src/router/index.ts +99 -0
- package/example/src/shims-vue.d.ts +6 -0
- package/example/src/store/index.ts +9 -0
- package/example/src/views/demo/any-of/data.ts +38 -0
- package/example/src/views/demo/any-of/index.vue +35 -0
- package/example/src/views/demo/array-cards/data.ts +65 -0
- package/example/src/views/demo/array-cards/index.vue +33 -0
- package/example/src/views/demo/array-items/data.ts +29 -0
- package/example/src/views/demo/array-items/index.vue +33 -0
- package/example/src/views/demo/cloud-button/data.ts +14 -0
- package/example/src/views/demo/cloud-button/index.vue +22 -0
- package/example/src/views/demo/color-group/data.ts +15 -0
- package/example/src/views/demo/color-group/index.vue +22 -0
- package/example/src/views/demo/color-picker/data.ts +21 -0
- package/example/src/views/demo/color-picker/index.vue +33 -0
- package/example/src/views/demo/datatime/data.ts +62 -0
- package/example/src/views/demo/datatime/index.vue +22 -0
- package/example/src/views/demo/event/data.ts +184 -0
- package/example/src/views/demo/event/index.vue +33 -0
- package/example/src/views/demo/hot-area/data.ts +196 -0
- package/example/src/views/demo/hot-area/index.vue +33 -0
- package/example/src/views/demo/input/data.ts +39 -0
- package/example/src/views/demo/input/index.vue +33 -0
- package/example/src/views/demo/link/data.ts +23 -0
- package/example/src/views/demo/link/index.vue +22 -0
- package/example/src/views/demo/one-of/data.ts +139 -0
- package/example/src/views/demo/one-of/index.vue +33 -0
- package/example/src/views/demo/rich-editor/data.ts +12 -0
- package/example/src/views/demo/rich-editor/index.vue +24 -0
- package/example/src/views/demo/select/data.ts +38 -0
- package/example/src/views/demo/select/index.vue +33 -0
- package/example/src/views/demo/upload-button/data1.ts +11 -0
- package/example/src/views/demo/upload-button/data2.ts +12 -0
- package/example/src/views/demo/upload-button/index.vue +42 -0
- package/example/tsconfig.json +32 -0
- package/example/vite.config.ts +12 -0
- package/jest.config.js +4 -0
- package/package.json +92 -4
- package/src/components/__builtins__/configs/index.ts +1 -0
- package/src/components/__builtins__/index.ts +2 -0
- package/src/components/__builtins__/shared/create-context.ts +54 -0
- package/src/components/__builtins__/shared/index.ts +7 -0
- package/src/components/__builtins__/shared/loading.ts +20 -0
- package/src/components/__builtins__/shared/portal.ts +43 -0
- package/src/components/__builtins__/shared/resolve-component.ts +22 -0
- package/src/components/__builtins__/shared/transform-component.ts +33 -0
- package/src/components/__builtins__/shared/types.ts +8 -0
- package/src/components/__builtins__/shared/utils.ts +35 -0
- package/src/components/__builtins__/styles/common.scss +22 -0
- package/src/components/__builtins__/styles/element-plus.scss +1094 -0
- package/src/components/any-of/index.ts +20 -0
- package/src/components/array-base/index.ts +413 -0
- package/src/components/array-base/style.scss +53 -0
- package/src/components/array-base/style.ts +2 -0
- package/src/components/array-cards/index.ts +253 -0
- package/src/components/array-cards/style.scss +33 -0
- package/src/components/array-cards/style.ts +7 -0
- package/src/components/array-collapse/index.ts +381 -0
- package/src/components/array-collapse/style.scss +38 -0
- package/src/components/array-collapse/style.ts +10 -0
- package/src/components/array-items/index.ts +213 -0
- package/src/components/array-items/style.scss +82 -0
- package/src/components/array-items/style.ts +4 -0
- package/src/components/array-table/index.ts +567 -0
- package/src/components/array-table/style.scss +84 -0
- package/src/components/array-table/style.ts +11 -0
- package/src/components/array-tabs/index.ts +141 -0
- package/src/components/array-tabs/style.scss +16 -0
- package/src/components/array-tabs/style.ts +5 -0
- package/src/components/base/AnyOf/index.ts +155 -0
- package/src/components/base/AnyOf/index.vue +111 -0
- package/src/components/base/CloudButton/index.ts +46 -0
- package/src/components/base/CloudButton/index.vue +128 -0
- package/src/components/base/ColorGroup/index.ts +57 -0
- package/src/components/base/ColorGroup/index.vue +30 -0
- package/src/components/base/ColorPicker/index.ts +45 -0
- package/src/components/base/ColorPicker/index.vue +50 -0
- package/src/components/base/Container/index.vue +39 -0
- package/src/components/base/HotArea/index.ts +698 -0
- package/src/components/base/HotArea/index.vue +565 -0
- package/src/components/base/HotArea/type.ts +18 -0
- package/src/components/base/Input/index.vue +150 -0
- package/src/components/base/LayoutGroup/index.vue +40 -0
- package/src/components/base/Link/index.vue +43 -0
- package/src/components/base/Middleware/index.ts +235 -0
- package/src/components/base/Middleware/index.vue +169 -0
- package/src/components/base/OneOf/index.ts +105 -0
- package/src/components/base/OneOf/index.vue +85 -0
- package/src/components/base/RichEditor/index.ts +13 -0
- package/src/components/base/RichEditor/index.vue +120 -0
- package/src/components/base/RichEditor/options.ts +24 -0
- package/src/components/base/Select/index.ts +106 -0
- package/src/components/base/Select/index.vue +161 -0
- package/src/components/base/Switch/index.vue +42 -0
- package/src/components/base/Text/index.vue +47 -0
- package/src/components/base/event/index.ts +226 -0
- package/src/components/base/event/index.vue +356 -0
- package/src/components/cascader/index.ts +48 -0
- package/src/components/cascader/style.ts +5 -0
- package/src/components/checkbox/index.ts +166 -0
- package/src/components/checkbox/style.ts +5 -0
- package/src/components/cloud-button/index.ts +21 -0
- package/src/components/color-group/index.ts +18 -0
- package/src/components/color-picker/index.ts +18 -0
- package/src/components/container/index.ts +18 -0
- package/src/components/data-time/index.ts +24 -0
- package/src/components/date-picker/index.ts +51 -0
- package/src/components/date-picker/style.ts +4 -0
- package/src/components/editable/index.ts +261 -0
- package/src/components/editable/style.scss +55 -0
- package/src/components/editable/style.ts +5 -0
- package/src/components/el-form-item/index.ts +21 -0
- package/src/components/el-form-item/style.ts +3 -0
- package/src/components/event/index.ts +16 -0
- package/src/components/form/index.ts +94 -0
- package/src/components/form/style.scss +0 -0
- package/src/components/form/style.ts +3 -0
- package/src/components/form-button-group/index.ts +74 -0
- package/src/components/form-button-group/style.scss +0 -0
- package/src/components/form-button-group/style.ts +4 -0
- package/src/components/form-collapse/index.ts +215 -0
- package/src/components/form-collapse/style.scss +6 -0
- package/src/components/form-collapse/style.ts +4 -0
- package/src/components/form-dialog/index.ts +433 -0
- package/src/components/form-dialog/style.ts +4 -0
- package/src/components/form-drawer/index.ts +424 -0
- package/src/components/form-drawer/style.scss +21 -0
- package/src/components/form-drawer/style.ts +4 -0
- package/src/components/form-grid/index.ts +181 -0
- package/src/components/form-grid/style.scss +5 -0
- package/src/components/form-grid/style.ts +1 -0
- package/src/components/form-item/animation.scss +72 -0
- package/src/components/form-item/grid.scss +171 -0
- package/src/components/form-item/index.ts +642 -0
- package/src/components/form-item/style.scss +521 -0
- package/src/components/form-item/style.ts +2 -0
- package/src/components/form-item/var.scss +17 -0
- package/src/components/form-layout/index.ts +161 -0
- package/src/components/form-layout/style.scss +6 -0
- package/src/components/form-layout/style.ts +1 -0
- package/src/components/form-layout/useResponsiveFormLayout.ts +118 -0
- package/src/components/form-step/index.ts +210 -0
- package/src/components/form-step/style.ts +2 -0
- package/src/components/form-tab/index.ts +172 -0
- package/src/components/form-tab/style.scss +6 -0
- package/src/components/form-tab/style.ts +4 -0
- package/src/components/hot-area/index.ts +20 -0
- package/src/components/index.ts +49 -0
- package/src/components/input/index.ts +35 -0
- package/src/components/input/style.ts +4 -0
- package/src/components/input-number/index.ts +36 -0
- package/src/components/input-number/style.ts +3 -0
- package/src/components/layout-group/index.ts +18 -0
- package/src/components/link/index.ts +18 -0
- package/src/components/middleware/index.ts +21 -0
- package/src/components/one-of/index.ts +20 -0
- package/src/components/placeholder-input/index.ts +21 -0
- package/src/components/placeholder-input/index.vue +87 -0
- package/src/components/preview-text/index.ts +303 -0
- package/src/components/preview-text/style.ts +9 -0
- package/src/components/radio/index.ts +109 -0
- package/src/components/radio/style.ts +3 -0
- package/src/components/reset/index.ts +52 -0
- package/src/components/reset/style.ts +1 -0
- package/src/components/rich-editor/index.ts +18 -0
- package/src/components/row/index.ts +20 -0
- package/src/components/row/index.vue +53 -0
- package/src/components/select/index.ts +19 -0
- package/src/components/select/style.ts +5 -0
- package/src/components/space/index.ts +98 -0
- package/src/components/space/style.scss +24 -0
- package/src/components/space/style.ts +1 -0
- package/src/components/submit/index.ts +59 -0
- package/src/components/submit/style.ts +1 -0
- package/src/components/switch/index.ts +9 -0
- package/src/components/switch/style.ts +1 -0
- package/src/components/text/index.ts +21 -0
- package/src/components/time-picker/index.ts +21 -0
- package/src/components/time-picker/style.ts +4 -0
- package/src/components/transfer/index.ts +12 -0
- package/src/components/transfer/style.ts +1 -0
- package/src/components/upload/index.ts +136 -0
- package/src/components/upload/style.ts +2 -0
- package/src/components/upload-button/index.ts +21 -0
- package/src/components/upload-button/index.vue +199 -0
- package/src/createScemaField.ts +14 -0
- package/src/index.ts +41 -0
- package/src/schema-field/index.ts +11 -0
- package/src/scope.ts +29 -0
- package/src/transform/core.ts +404 -0
- package/src/transform/index.ts +11 -0
- package/src/transform/transform.ts +59 -0
- package/src/transform/utils/constant.ts +79 -0
- package/src/transform/utils/func.ts +145 -0
- package/src/typings/common.ts +37 -0
- package/src/typings/vue-shim.d.ts +7 -0
- package/src/typings/vue-test-utils.d.ts +11 -0
- package/src/utils/anyof_utils.ts +95 -0
- package/src/utils/common.ts +15 -0
- package/src/validate/index.ts +648 -0
- package/src/validate/utils/constant.ts +2 -0
- package/src/vue-form/index.ts +18 -0
- package/src/vue-form/index.vue +106 -0
- package/src/vue-form/useForm.ts +112 -0
- package/tests/data/anyof.ts +40 -0
- package/tests/data/image.ts +472 -0
- package/tests/fixtures/validate.ts +63 -0
- package/tests/unit/transform.spec.ts +253 -0
- package/tests/unit/utils.spec.ts +10 -0
- package/tests/unit/validate.spec.ts +256 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<VueForm :schema="schema" v-model="formData"></VueForm>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { ref } from 'vue'
|
|
9
|
+
const formData = ref({});
|
|
10
|
+
const schema = ref({
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties:{
|
|
13
|
+
demo1:{
|
|
14
|
+
type: 'void',
|
|
15
|
+
'x-component':'Text',
|
|
16
|
+
'x-component-props':{
|
|
17
|
+
text: '<strong>目前可传递的信息有四个,分别为componentId(组件id)、componentName(组件名称)、formData(表单数据)、component(组件对象)</strong>'
|
|
18
|
+
},
|
|
19
|
+
'x-data': {
|
|
20
|
+
extend: {
|
|
21
|
+
compoentId: '$componentId',//组件id
|
|
22
|
+
componentName: '$componentName',//组件名称
|
|
23
|
+
formData:'$formData',//表单数据
|
|
24
|
+
component:'$component',//组件对象
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
</script>
|
|
32
|
+
<style scoped>
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<VueForm :schema="schema" v-model="formData"></VueForm>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
const formData = ref({});
|
|
9
|
+
const schema = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties:{
|
|
12
|
+
userinfo:{
|
|
13
|
+
title: '是否渲染',
|
|
14
|
+
'x-component-props': {
|
|
15
|
+
type: 'switch',
|
|
16
|
+
required: false
|
|
17
|
+
},
|
|
18
|
+
'x-decorator-props': {
|
|
19
|
+
labelWrap: true,
|
|
20
|
+
},
|
|
21
|
+
anyOf:[{
|
|
22
|
+
title: '是',
|
|
23
|
+
properties:{
|
|
24
|
+
demo2:{
|
|
25
|
+
type: 'string'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},{
|
|
29
|
+
title: '否',
|
|
30
|
+
properties:{}
|
|
31
|
+
}]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<VueForm :schema="schema" v-model="formData"></VueForm>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
const formData = ref({});
|
|
9
|
+
const schema = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties:{
|
|
12
|
+
isRender:{
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
title: '是否渲染'
|
|
15
|
+
},
|
|
16
|
+
userinfo:{
|
|
17
|
+
'x-reactions':{
|
|
18
|
+
dependencies:['.isRender'],
|
|
19
|
+
fulfill:{
|
|
20
|
+
schema:{
|
|
21
|
+
"x-visible": "{{$deps[0] === true}}" //任意层次属性都支持表达式
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
type:'object',
|
|
26
|
+
properties:{
|
|
27
|
+
demo2:{
|
|
28
|
+
type: 'string'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style scoped>
|
|
38
|
+
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 组件扩展
|
|
3
|
+
lang: zh-cn
|
|
4
|
+
---
|
|
5
|
+
# 组件扩展
|
|
6
|
+
|
|
7
|
+
> @jv/formily 除了提供基础的表单组件外, 还提供了扩展自定义组件的能力来满足特殊场景的需求
|
|
8
|
+
|
|
9
|
+
``` ts
|
|
10
|
+
import { createApp } from 'vue';
|
|
11
|
+
|
|
12
|
+
import App from './App.vue';
|
|
13
|
+
|
|
14
|
+
import JvFormily from '@jv/formily'
|
|
15
|
+
|
|
16
|
+
import { JButton } from '../components/Button'
|
|
17
|
+
|
|
18
|
+
// 扩展Button 自定义组件
|
|
19
|
+
createApp(App).use(JvFormily, { expandComponents: { JButton }});
|
|
20
|
+
```
|
|
21
|
+
::: danger
|
|
22
|
+
扩展的自定义组件必须是以@formily/vue协议包裹的组件,详情请看 [@formily/vue](https://vue.formilyjs.org/api/shared/connect.html)
|
|
23
|
+
:::
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: extra-bury-report 埋点拓展
|
|
3
|
+
lang: zh-cn
|
|
4
|
+
---
|
|
5
|
+
# extra-bury-report 埋点拓展
|
|
6
|
+
|
|
7
|
+
在用户输入的埋点名称基础上,统一添加前缀或者后缀,使用时直接获取埋点,进行录入或者上报即可
|
|
8
|
+
|
|
9
|
+
### 示例
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties:{
|
|
15
|
+
buryReportName: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
default: '',
|
|
18
|
+
title: '埋点名称',
|
|
19
|
+
'err:required': '请输入埋点名称',
|
|
20
|
+
required: true,
|
|
21
|
+
description: '输入埋点名,系统将补全埋点信息: 例 运营.可视化创造.输入的埋点名.点击',
|
|
22
|
+
},
|
|
23
|
+
_extraBuryReport: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
description: '埋点名前缀,设置前缀会额外上报该前缀的埋点',
|
|
26
|
+
'x-hidden': true,
|
|
27
|
+
default: {
|
|
28
|
+
tjw: {
|
|
29
|
+
code: 'tjw-$0',
|
|
30
|
+
codeDes: '推荐位-$0',
|
|
31
|
+
actions: ['brow', 'click', 'long_tap'],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 使用方法
|
|
40
|
+
- 在properties中使用**buryReportName**和 **_extraBuryReport**属性,两者需要配合使用
|
|
41
|
+
|
|
42
|
+
| 属性 | 说明 | 类型 | 可选值 | 默认值 |
|
|
43
|
+
| ------ | -------- | ------- | ------ | ------ |
|
|
44
|
+
| buryReportName | 埋点名称 | string | — | — |
|
|
45
|
+
| _extraBuryReport | 埋点名拼接前后缀之后的对象信息 | string | — | — |
|
|
46
|
+
|
|
47
|
+
- _extraBuryReport对象中的default属性值说明
|
|
48
|
+
|
|
49
|
+
default属性内需要嵌套一个对象,该对象是包含了埋点名拼接前后缀之后的埋点相关信息,下面说明一下该对象属性
|
|
50
|
+
| 属性 | 说明 | 类型 | 例子 | 默认值 |
|
|
51
|
+
| ------ | -------- | ------- | ------ | ------ |
|
|
52
|
+
| code | 埋点元素代码 | string | xxx-$0 (其中'xxx-'为添加的前缀,'$0'是固定写法,会被替换成转码后buryReportName的值) | — |
|
|
53
|
+
| codeDes | 埋点元素 | string |推荐-$0 (其中'推荐-'为添加的前缀,'$0'是固定写法,会被替换成buryReportName的值) | — |
|
|
54
|
+
| actions | 埋点动作代码 | array | ['brow', 'click', 'long_tap'] | ['click'] |
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
以上示例,当buryReportName的值为“长封闭期”时,会新增导出以下埋点
|
|
58
|
+
|
|
59
|
+
| 事件代码 | 事件代码描述 |
|
|
60
|
+
| ------ | -------- |
|
|
61
|
+
| activity.lego.tjw-5fc15d7f-1c2ff04585-9681_brow | 运营.可视化创造.推荐位-长封闭期-公募运营页-视频_曝光 |
|
|
62
|
+
| activity.lego.tjw-5fc15d7f-1c2ff04585-9681_click | 运营.可视化创造.推荐位-长封闭期-公募运营页-视频_点击 |
|
|
63
|
+
| activity.lego.tjw-5fc15d7f-1c2ff04585-9681_long_tap | 运营.可视化创造.推荐位-长封闭期-公募运营页-视频_长按 |
|
|
64
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Schema配置
|
|
3
|
+
lang: zh-cn
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Schema配置
|
|
7
|
+
参考 [https://vue.formilyjs.org/api/shared/schema.html](https://vue.formilyjs.org/api/shared/schema.html)
|
|
8
|
+
|
|
9
|
+
## 扩展
|
|
10
|
+
|
|
11
|
+
### 类型判断
|
|
12
|
+
在不写 x-component 的情况下,我们会根据类型、或者某个属性去断言出该渲染的组件名
|
|
13
|
+
|
|
14
|
+
它们的优先级是 x-component -> ui:widget -> enum -> format -> type ->anyOf
|
|
15
|
+
::: warning
|
|
16
|
+
ui:widget、format、anyOf 是VJSF兼容的产物,不推荐在新的需求下使用
|
|
17
|
+
:::
|
|
18
|
+
|
|
19
|
+
### 属性扩展
|
|
20
|
+
| 属性 | 说明 | 类型 | 可选值 | 默认值 |
|
|
21
|
+
| ------ | -------- | ------- | ------ | ------ |
|
|
22
|
+
| unique | 全局唯一 (全局校验会用到) | boolean | — | — |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: x-data 扩展属性
|
|
3
|
+
lang: zh-cn
|
|
4
|
+
---
|
|
5
|
+
# x-data 扩展属性
|
|
6
|
+
|
|
7
|
+
主要用于扩展功能,如修改原有formily按钮文案或者传递一些信息
|
|
8
|
+
## 拓展功能1:修改原有按钮文案
|
|
9
|
+
### 示例
|
|
10
|
+
<code-preview demoPath="x-data/add-button-title" :collapsed="false"/>
|
|
11
|
+
|
|
12
|
+
### 使用方法
|
|
13
|
+
在x-data中使用**addButtonTitle**属性,并写上更改的按钮文案即可
|
|
14
|
+
| 属性 | 说明 | 类型 | 可选值 | 默认值 |
|
|
15
|
+
| ------ | -------- | ------- | ------ | ------ |
|
|
16
|
+
| addButtonTitle | 按钮文案 | string | — | — |
|
|
17
|
+
|
|
18
|
+
### 适用范围
|
|
19
|
+
只适用于type为array类型
|
|
20
|
+
|
|
21
|
+
## 拓展功能2:传递信息
|
|
22
|
+
目前可传递的信息有四个,分别为componentId(组件id)、componentName(组件名称)、formData(表单数据)、component(组件对象)
|
|
23
|
+
### 示例
|
|
24
|
+
<code-preview demoPath="x-data/send-message" :collapsed="false"/>
|
|
25
|
+
|
|
26
|
+
### 使用方法
|
|
27
|
+
在x-data中使用**extend**属性
|
|
28
|
+
- extend为对象类型,在该对象内写上传递信息的key和value
|
|
29
|
+
- key的值:由使用方和获取方进行约定
|
|
30
|
+
- value的值:目前只能有`$componentId`,`$componentName`,`$formData`,`$component`这四个值,编辑器对这四个值做了对应的处理,会将其替换为实际数据,分别是组件id、组件名称、表单数据、组件对象的实际数据
|
|
31
|
+
|
|
32
|
+
| 属性 | 说明 | 类型 | 可选值 | 默认值 |
|
|
33
|
+
| ------ | -------- | ------- | ------ | ------ |
|
|
34
|
+
| extend | 拓展对象 | object | — | — |
|
|
35
|
+
|
|
36
|
+
### 适用范围
|
|
37
|
+
无特殊限定,都可以使用
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
更多查看 [https://vue.formilyjs.org/api/shared/schema.html#%E6%8F%8F%E8%BF%B0](https://vue.formilyjs.org/api/shared/schema.html#%E6%8F%8F%E8%BF%B0)
|
|
41
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: x-reactions联动
|
|
3
|
+
lang: zh-cn
|
|
4
|
+
---
|
|
5
|
+
# x-reactions联动
|
|
6
|
+
<!-- ## anyof示例
|
|
7
|
+
<code-preview demoPath="x-reactions/any-of" :collapsed="false"/> -->
|
|
8
|
+
|
|
9
|
+
## 示例
|
|
10
|
+
<code-preview demoPath="x-reactions/x-reactions" :collapsed="false"/>
|
|
11
|
+
|
|
12
|
+
<!-- ::: danger
|
|
13
|
+
anyof 设计之初是把title作为唯一key,如果将来title变了, 会造成数据的不稳定性, 现在已经停止对anyof的维护,请使用 x-reactions 的方案
|
|
14
|
+
::: -->
|
|
15
|
+
::: warning
|
|
16
|
+
如果用到formily全局校验, x-reactions 必须使用被动联动的方式
|
|
17
|
+
:::
|
|
18
|
+
|
|
19
|
+
更多查看 [https://vue.formilyjs.org/api/shared/schema.html#schemareactions](https://vue.formilyjs.org/api/shared/schema.html#schemareactions)
|
|
20
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true,
|
|
5
|
+
},
|
|
6
|
+
extends: [
|
|
7
|
+
'plugin:vue/vue3-essential',
|
|
8
|
+
'eslint:recommended',
|
|
9
|
+
'@vue/typescript/recommended',
|
|
10
|
+
'plugin:prettier/recommended',
|
|
11
|
+
],
|
|
12
|
+
parserOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
17
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
18
|
+
'vue/multi-word-component-names': 'off'
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# demo-vue3
|
|
2
|
+
|
|
3
|
+
## Project setup
|
|
4
|
+
```
|
|
5
|
+
npm install
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
### Compiles and hot-reloads for development
|
|
9
|
+
```
|
|
10
|
+
npm run serve
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Compiles and minifies for production
|
|
14
|
+
```
|
|
15
|
+
npm run build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Lints and fixes files
|
|
19
|
+
```
|
|
20
|
+
npm run lint
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Customize configuration
|
|
24
|
+
See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Document</title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<div id="app"></div>
|
|
12
|
+
<script type="module" src="/src/main.ts"></script>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable prettier/prettier */
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
rootDir: path.resolve(__dirname),
|
|
6
|
+
clearMocks: true,
|
|
7
|
+
coverageDirectory: 'coverage',
|
|
8
|
+
coverageProvider: 'v8',
|
|
9
|
+
moduleFileExtensions: ['vue', 'js', 'json', 'jsx', 'ts', 'tsx', 'node'],
|
|
10
|
+
preset: 'ts-jest',
|
|
11
|
+
testEnvironment: 'jsdom',
|
|
12
|
+
testMatch: ['<rootDir>/src/__tests__/**/*.spec.(ts|tsx|js)'],
|
|
13
|
+
testPathIgnorePatterns: ['/node_modules/'],
|
|
14
|
+
transform: {
|
|
15
|
+
'^.+\\.vue$': 'vue-jest',
|
|
16
|
+
'^.+\\.(ts|tsx|js|jsx)$': [
|
|
17
|
+
'babel-jest', {
|
|
18
|
+
presets: [
|
|
19
|
+
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
20
|
+
['@babel/preset-typescript']
|
|
21
|
+
],
|
|
22
|
+
plugins: ['@vue/babel-plugin-jsx']
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jt/formily-demo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"preview": "vite preview"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"konva": "^8.3.9",
|
|
12
|
+
"vue": "^3.2.13",
|
|
13
|
+
"vue-konva": "^3.0.0",
|
|
14
|
+
"vue-router": "^4.0.3",
|
|
15
|
+
"vuex": "^4.0.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@babel/core": "^7.18.2",
|
|
19
|
+
"@babel/preset-env": "^7.18.2",
|
|
20
|
+
"@babel/preset-typescript": "^7.17.12",
|
|
21
|
+
"@jt/jtui": "^2.2.11-beta.2",
|
|
22
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
23
|
+
"@types/jest": "^28.1.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
25
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
26
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
27
|
+
"@vue/babel-plugin-jsx": "^1.1.1",
|
|
28
|
+
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
29
|
+
"@vue/cli-plugin-router": "~5.0.0",
|
|
30
|
+
"@vue/cli-plugin-typescript": "~5.0.0",
|
|
31
|
+
"@vue/cli-plugin-vuex": "~5.0.0",
|
|
32
|
+
"@vue/cli-service": "~5.0.0",
|
|
33
|
+
"@vue/eslint-config-typescript": "^9.1.0",
|
|
34
|
+
"@vue/test-utils": "^2.0.0-rc.18",
|
|
35
|
+
"babel-jest": "^26.0.0",
|
|
36
|
+
"eslint": "^7.32.0",
|
|
37
|
+
"eslint-config-prettier": "^8.3.0",
|
|
38
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
39
|
+
"eslint-plugin-vue": "^8.0.3",
|
|
40
|
+
"jest": "^26.0.0",
|
|
41
|
+
"prettier": "^2.4.1",
|
|
42
|
+
"raw-loader": "^4.0.2",
|
|
43
|
+
"sass": "^1.32.7",
|
|
44
|
+
"sass-loader": "^12.0.0",
|
|
45
|
+
"ts-jest": "^26.4.4",
|
|
46
|
+
"typescript": "~4.5.5",
|
|
47
|
+
"vite": "^4.3.9",
|
|
48
|
+
"vue-jest": "^5.0.0-alpha.10"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
+
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<noscript>
|
|
12
|
+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
13
|
+
</noscript>
|
|
14
|
+
<div id="app"></div>
|
|
15
|
+
<!-- built files will be auto injected -->
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="app-wrap">
|
|
3
|
+
<router-view />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style lang="scss">
|
|
8
|
+
.app-wrap {
|
|
9
|
+
display: flex;
|
|
10
|
+
}
|
|
11
|
+
.router-link-box {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
width: 200px;
|
|
15
|
+
align-items: center;
|
|
16
|
+
border: 1px dashed rgba(0, 0, 0, 0.3);
|
|
17
|
+
a {
|
|
18
|
+
margin-top: 24px;
|
|
19
|
+
font-size: 24px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.router-view-box {
|
|
23
|
+
flex: 1;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hello">
|
|
3
|
+
<h1>{{ msg }}</h1>
|
|
4
|
+
<p>
|
|
5
|
+
For a guide and recipes on how to configure / customize this
|
|
6
|
+
project,<br />
|
|
7
|
+
check out the
|
|
8
|
+
<a href="https://cli.vuejs.org" target="_blank" rel="noopener"
|
|
9
|
+
>vue-cli documentation</a
|
|
10
|
+
>.
|
|
11
|
+
</p>
|
|
12
|
+
<h3>Installed CLI Plugins</h3>
|
|
13
|
+
<ul>
|
|
14
|
+
<li>
|
|
15
|
+
<a
|
|
16
|
+
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router"
|
|
17
|
+
target="_blank"
|
|
18
|
+
rel="noopener"
|
|
19
|
+
>router</a
|
|
20
|
+
>
|
|
21
|
+
</li>
|
|
22
|
+
<li>
|
|
23
|
+
<a
|
|
24
|
+
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex"
|
|
25
|
+
target="_blank"
|
|
26
|
+
rel="noopener"
|
|
27
|
+
>vuex</a
|
|
28
|
+
>
|
|
29
|
+
</li>
|
|
30
|
+
<li>
|
|
31
|
+
<a
|
|
32
|
+
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
|
|
33
|
+
target="_blank"
|
|
34
|
+
rel="noopener"
|
|
35
|
+
>eslint</a
|
|
36
|
+
>
|
|
37
|
+
</li>
|
|
38
|
+
<li>
|
|
39
|
+
<a
|
|
40
|
+
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript"
|
|
41
|
+
target="_blank"
|
|
42
|
+
rel="noopener"
|
|
43
|
+
>typescript</a
|
|
44
|
+
>
|
|
45
|
+
</li>
|
|
46
|
+
</ul>
|
|
47
|
+
<h3>Essential Links</h3>
|
|
48
|
+
<ul>
|
|
49
|
+
<li>
|
|
50
|
+
<a href="https://vuejs.org" target="_blank" rel="noopener"
|
|
51
|
+
>Core Docs</a
|
|
52
|
+
>
|
|
53
|
+
</li>
|
|
54
|
+
<li>
|
|
55
|
+
<a href="https://forum.vuejs.org" target="_blank" rel="noopener"
|
|
56
|
+
>Forum</a
|
|
57
|
+
>
|
|
58
|
+
</li>
|
|
59
|
+
<li>
|
|
60
|
+
<a href="https://chat.vuejs.org" target="_blank" rel="noopener"
|
|
61
|
+
>Community Chat</a
|
|
62
|
+
>
|
|
63
|
+
</li>
|
|
64
|
+
<li>
|
|
65
|
+
<a
|
|
66
|
+
href="https://twitter.com/vuejs"
|
|
67
|
+
target="_blank"
|
|
68
|
+
rel="noopener"
|
|
69
|
+
>Twitter</a
|
|
70
|
+
>
|
|
71
|
+
</li>
|
|
72
|
+
<li>
|
|
73
|
+
<a href="https://news.vuejs.org" target="_blank" rel="noopener"
|
|
74
|
+
>News</a
|
|
75
|
+
>
|
|
76
|
+
</li>
|
|
77
|
+
</ul>
|
|
78
|
+
<h3>Ecosystem</h3>
|
|
79
|
+
<ul>
|
|
80
|
+
<li>
|
|
81
|
+
<a
|
|
82
|
+
href="https://router.vuejs.org"
|
|
83
|
+
target="_blank"
|
|
84
|
+
rel="noopener"
|
|
85
|
+
>vue-router</a
|
|
86
|
+
>
|
|
87
|
+
</li>
|
|
88
|
+
<li>
|
|
89
|
+
<a href="https://vuex.vuejs.org" target="_blank" rel="noopener"
|
|
90
|
+
>vuex</a
|
|
91
|
+
>
|
|
92
|
+
</li>
|
|
93
|
+
<li>
|
|
94
|
+
<a
|
|
95
|
+
href="https://github.com/vuejs/vue-devtools#vue-devtools"
|
|
96
|
+
target="_blank"
|
|
97
|
+
rel="noopener"
|
|
98
|
+
>vue-devtools</a
|
|
99
|
+
>
|
|
100
|
+
</li>
|
|
101
|
+
<li>
|
|
102
|
+
<a
|
|
103
|
+
href="https://vue-loader.vuejs.org"
|
|
104
|
+
target="_blank"
|
|
105
|
+
rel="noopener"
|
|
106
|
+
>vue-loader</a
|
|
107
|
+
>
|
|
108
|
+
</li>
|
|
109
|
+
<li>
|
|
110
|
+
<a
|
|
111
|
+
href="https://github.com/vuejs/awesome-vue"
|
|
112
|
+
target="_blank"
|
|
113
|
+
rel="noopener"
|
|
114
|
+
>awesome-vue</a
|
|
115
|
+
>
|
|
116
|
+
</li>
|
|
117
|
+
</ul>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<script lang="ts">
|
|
122
|
+
import { defineComponent } from 'vue';
|
|
123
|
+
|
|
124
|
+
export default defineComponent({
|
|
125
|
+
name: 'HelloWorld',
|
|
126
|
+
props: {
|
|
127
|
+
msg: String,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
133
|
+
<style scoped lang="scss">
|
|
134
|
+
h3 {
|
|
135
|
+
margin: 40px 0 0;
|
|
136
|
+
}
|
|
137
|
+
ul {
|
|
138
|
+
list-style-type: none;
|
|
139
|
+
padding: 0;
|
|
140
|
+
}
|
|
141
|
+
li {
|
|
142
|
+
display: inline-block;
|
|
143
|
+
margin: 0 10px;
|
|
144
|
+
}
|
|
145
|
+
a {
|
|
146
|
+
color: #42b983;
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="group-wrap">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts"></script>
|
|
8
|
+
|
|
9
|
+
<style scoped>
|
|
10
|
+
.group-wrap {
|
|
11
|
+
display: block;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
background-color: rgba(216, 220, 230, 0.2);
|
|
14
|
+
padding: 16px 16px 20px 16px;
|
|
15
|
+
}
|
|
16
|
+
</style>
|