starfish-form-custom 1.0.0
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/README.md +2 -0
- package/auto-imports.d.ts +9 -0
- package/components.d.ts +68 -0
- package/dist/formAction-28d86b6a.mjs +446 -0
- package/dist/index-04830c0b.mjs +126 -0
- package/dist/index-eab8ef70.mjs +519 -0
- package/dist/index-f7ea052c.mjs +241 -0
- package/dist/main-96327b2e.mjs +5051 -0
- package/dist/starfish-form-a18a5409.mjs +328 -0
- package/dist/starfish-form.mjs +36 -0
- package/dist/style.css +377 -0
- package/dist/types/form/src/common/Loading.vue.d.ts +3 -0
- package/dist/types/form/src/env.d.ts +15 -0
- package/dist/types/form/src/main.d.ts +43 -0
- package/dist/types/form/src/starfish-form.vue.d.ts +40 -0
- package/dist/types/form/src/utils/customHooks.d.ts +2 -0
- package/dist/types/form/src/utils/fieldConfig.d.ts +78 -0
- package/dist/types/form/src/utils/fieldProps.d.ts +43 -0
- package/dist/types/starfish-form.d.ts +3 -0
- package/package.json +42 -0
- package/src/common/KeyValueConfig.vue +145 -0
- package/src/common/KeyValueConfigMult.vue +139 -0
- package/src/common/Loading.vue +14 -0
- package/src/common/action.vue +76 -0
- package/src/common/formAction.vue +298 -0
- package/src/common/listConfig.vue +45 -0
- package/src/common/panel.vue +61 -0
- package/src/common/radiogroup.vue +31 -0
- package/src/components/CheckBox/index.vue +42 -0
- package/src/components/ColorSelect/index.vue +49 -0
- package/src/components/Date/index.vue +39 -0
- package/src/components/DateTime/index.vue +39 -0
- package/src/components/InputNumber/index.vue +48 -0
- package/src/components/JsonEditor/index.vue +167 -0
- package/src/components/Radio/index.vue +42 -0
- package/src/components/RichText/index.vue +60 -0
- package/src/components/Rule/index.vue +365 -0
- package/src/components/Rule/ruleform.json +315 -0
- package/src/components/Rule/rules.js +91 -0
- package/src/components/Selected/index.vue +50 -0
- package/src/components/Selecteds/index.vue +50 -0
- package/src/components/ShowRule/index.vue +50 -0
- package/src/components/Slider/index.vue +38 -0
- package/src/components/Switch/index.vue +61 -0
- package/src/components/Text/index.vue +48 -0
- package/src/components/TextArea/index.vue +49 -0
- package/src/components/Time/index.vue +36 -0
- package/src/env.d.ts +15 -0
- package/src/layout/Divider.vue +30 -0
- package/src/layout/Info.vue +69 -0
- package/src/layout/Tabs.vue +75 -0
- package/src/layout/collapse.vue +78 -0
- package/src/layout/grid.vue +88 -0
- package/src/layout/table.vue +80 -0
- package/src/main.ts +62 -0
- package/src/starfish-form.vue +265 -0
- package/src/styles/action.scss +25 -0
- package/src/styles/collapse.scss +15 -0
- package/src/styles/custom-cpm.scss +5 -0
- package/src/styles/divider.scss +16 -0
- package/src/styles/form-action.scss +92 -0
- package/src/styles/formedit.scss +69 -0
- package/src/styles/grid.scss +12 -0
- package/src/styles/index.scss +12 -0
- package/src/styles/keyvalueConfig.scss +56 -0
- package/src/styles/rule.scss +17 -0
- package/src/styles/showrule.scss +5 -0
- package/src/styles/table.scss +19 -0
- package/src/styles/tabs.scss +5 -0
- package/src/utils/customHooks.ts +22 -0
- package/src/utils/fieldConfig.ts +961 -0
- package/src/utils/fieldProps.ts +50 -0
- package/stats.html +4949 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem starfish-formitem-nomiddle" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist }">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{ width: labelWidth + 'px' }">
|
|
4
|
+
<label>{{ item.data.label }}{{ suffix }}</label>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="control" :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }">
|
|
7
|
+
<el-row v-for="(items, index) in data[item.data.fieldName]" :key="index" :gutter="10" style="margin-bottom: 10px;">
|
|
8
|
+
<el-input-number v-model="items.span" :min="0" size="small" controls-position="right" />
|
|
9
|
+
<el-button type="danger" circle size="small" @click="onDelete(index)" style="margin-left: 5px;">
|
|
10
|
+
<el-icon><Delete /></el-icon>
|
|
11
|
+
</el-button>
|
|
12
|
+
</el-row>
|
|
13
|
+
<el-button plain @click="onAdd" size="small">添加</el-button>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { defineComponent } from "vue";
|
|
19
|
+
import fieldProps from "../utils/fieldProps";
|
|
20
|
+
import { Delete } from "@element-plus/icons-vue";
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
ControlType: "ListConfig", // 必须与文件名匹配
|
|
23
|
+
nameCn: "栅格列表配置",
|
|
24
|
+
isHide: true,
|
|
25
|
+
props: {
|
|
26
|
+
...fieldProps,
|
|
27
|
+
},
|
|
28
|
+
components: {
|
|
29
|
+
Delete,
|
|
30
|
+
},
|
|
31
|
+
setup(props: any) {
|
|
32
|
+
return {
|
|
33
|
+
onAdd() {
|
|
34
|
+
props.data[props.item.data.fieldName].push({
|
|
35
|
+
span: 12,
|
|
36
|
+
list: [],
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
onDelete(index: number) {
|
|
40
|
+
props.data[props.item.data.fieldName].splice(index, 1);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem starfish-formitem-nomiddle" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist }">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{ width: labelWidth + 'px' }">
|
|
4
|
+
<label>{{ item.data.label }}{{ suffix }}</label>
|
|
5
|
+
<el-tooltip class="item" effect="dark" content="可拖拽调整顺序" placement="top">
|
|
6
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
7
|
+
</el-tooltip>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="control" :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }">
|
|
10
|
+
<el-row>
|
|
11
|
+
<el-col :span="24">
|
|
12
|
+
<draggable :list="data[item.data.fieldName]" class="list-group" handle=".handle" item-key="name" ghostClass="itemGhost">
|
|
13
|
+
<template #item="{ element, index }">
|
|
14
|
+
<el-row :gutter="10">
|
|
15
|
+
<el-col :span="1.5">
|
|
16
|
+
<i class="iconfontui icon-bars handle"></i>
|
|
17
|
+
</el-col>
|
|
18
|
+
<el-col class="list-group-item" :span="14">
|
|
19
|
+
<el-input size="small" v-model="element.name" clearable />
|
|
20
|
+
</el-col>
|
|
21
|
+
<el-col :span="2">
|
|
22
|
+
<el-button type="danger" circle size="small" @click="removeAt(index)">
|
|
23
|
+
<el-icon><Delete /></el-icon>
|
|
24
|
+
</el-button>
|
|
25
|
+
</el-col>
|
|
26
|
+
</el-row>
|
|
27
|
+
</template>
|
|
28
|
+
</draggable>
|
|
29
|
+
</el-col>
|
|
30
|
+
<el-button type="primary" text @click="add" size="small">添加面板</el-button>
|
|
31
|
+
</el-row>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
import { defineComponent } from "vue";
|
|
37
|
+
import fieldProps from "../utils/fieldProps";
|
|
38
|
+
import { Delete } from "@element-plus/icons-vue";
|
|
39
|
+
export default defineComponent({
|
|
40
|
+
ControlType: "Panel", // 必须与文件名匹配
|
|
41
|
+
isHide: true,
|
|
42
|
+
components: {
|
|
43
|
+
Delete,
|
|
44
|
+
},
|
|
45
|
+
props: {
|
|
46
|
+
...fieldProps,
|
|
47
|
+
},
|
|
48
|
+
setup(props) {
|
|
49
|
+
return {
|
|
50
|
+
removeAt(idx: number) {
|
|
51
|
+
props.data[props.item.data.fieldName].splice(idx, 1);
|
|
52
|
+
},
|
|
53
|
+
add: function () {
|
|
54
|
+
debugger;
|
|
55
|
+
const len = props.data[props.item.data.fieldName].length + 1;
|
|
56
|
+
props.data[props.item.data.fieldName].push({ name: props.data.name + len, list: [] });
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="drag ? 'formCover' : ''">
|
|
3
|
+
<div class="label">
|
|
4
|
+
<label>{{ item.data.label }}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control">
|
|
11
|
+
<el-radio-group v-model="data[item.data.fieldName]" size="mini">
|
|
12
|
+
<el-radio-button v-for="(sitem, sindex) in item.data.itemConfig.items" :key="sindex" :label="sitem.value"></el-radio-button>
|
|
13
|
+
</el-radio-group>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { defineComponent } from "vue";
|
|
19
|
+
import fieldProps from "../utils/fieldProps";
|
|
20
|
+
import { useWatch } from "../utils/customHooks";
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
ControlType: "RadioGroup", // 必须与文件名匹配
|
|
23
|
+
isHide: true,
|
|
24
|
+
props: {
|
|
25
|
+
...fieldProps,
|
|
26
|
+
},
|
|
27
|
+
setup(props) {
|
|
28
|
+
useWatch(props);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist}">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{width: labelWidth + 'px'}">
|
|
4
|
+
<label>{{ item.data.label }}{{suffix}}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control" :style="{marginLeft: labelalign != 'top'?labelWidth + 'px': ''}">
|
|
11
|
+
<el-checkbox-group v-model="data[item.data.fieldName]" v-if="!drag && data[item.data.fieldName]" :size="size">
|
|
12
|
+
<el-checkbox v-for="(sitem, sindex) in item.data.itemConfig.items" :key="sindex" :label="sitem.value">{{ sitem.label }}</el-checkbox>
|
|
13
|
+
</el-checkbox-group>
|
|
14
|
+
<el-checkbox-group v-model="item.data.itemConfig.value" v-if="drag" :size="size">
|
|
15
|
+
<el-checkbox v-for="(sitem, sindex) in item.data.itemConfig.items" :key="sindex" :label="sitem.value">{{ sitem.label }}</el-checkbox>
|
|
16
|
+
</el-checkbox-group>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { defineComponent } from "vue";
|
|
22
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
23
|
+
import fieldProps from "../../utils/fieldProps";
|
|
24
|
+
import { useWatch } from "../../utils/customHooks";
|
|
25
|
+
export default defineComponent({
|
|
26
|
+
ControlType: "CheckBox", // 必须与文件名匹配
|
|
27
|
+
nameCn: "复选框",
|
|
28
|
+
icon: "icon-fuxuankuang_xuanzhong",
|
|
29
|
+
formConfig: getFormConfig("CheckBox", [
|
|
30
|
+
{ fieldName: "itemConfig", component: "KeyValueConfigMult" },
|
|
31
|
+
{ fieldName: "arrangeMent", component: "Radio" },
|
|
32
|
+
{ fieldName: "state", component: "Radio" },
|
|
33
|
+
]),
|
|
34
|
+
props: {
|
|
35
|
+
...fieldProps,
|
|
36
|
+
},
|
|
37
|
+
actionType: ["onChange"],
|
|
38
|
+
setup(props) {
|
|
39
|
+
useWatch(props);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist}">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{width: labelWidth + 'px'}">
|
|
4
|
+
<label>{{ item.data.label }}{{suffix}}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control" :style="{marginLeft: labelalign != 'top'?labelWidth + 'px': ''}">
|
|
11
|
+
<div v-if="drag">
|
|
12
|
+
<el-input v-model="item.data.default" :placeholder="item.data.placeholder" size="small" style="width: 150px;"/>
|
|
13
|
+
<el-color-picker v-model="item.data.default" show-alpha :size="size"></el-color-picker>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-if="!drag">
|
|
16
|
+
<el-input v-model="data[item.data.fieldName]" :placeholder="item.data.placeholder" size="small" style="width: 150px;"/>
|
|
17
|
+
<el-color-picker v-model="data[item.data.fieldName]" show-alpha :size="size"></el-color-picker>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { defineComponent } from "vue";
|
|
24
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
25
|
+
import fieldProps from "../../utils/fieldProps";
|
|
26
|
+
import { useWatch } from "../../utils/customHooks";
|
|
27
|
+
export default defineComponent({
|
|
28
|
+
ControlType: "ColorSelect", // 必须与文件名匹配
|
|
29
|
+
nameCn: "颜色选择",
|
|
30
|
+
icon: "icon-sen103",
|
|
31
|
+
formConfig: getFormConfig("ColorSelect", [{ fieldName: "default", component: "ColorSelect" }]),
|
|
32
|
+
props: {
|
|
33
|
+
...fieldProps,
|
|
34
|
+
},
|
|
35
|
+
actionType: ["onChange"],
|
|
36
|
+
setup(props) {
|
|
37
|
+
useWatch(props);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
<style scoped lang="scss">
|
|
42
|
+
.control {
|
|
43
|
+
width: 240px;
|
|
44
|
+
> div {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist}">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{width: labelWidth + 'px'}">
|
|
4
|
+
<label>{{ item.data.label }}{{suffix}}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control" :style="{marginLeft: labelalign != 'top'?labelWidth + 'px': ''}">
|
|
11
|
+
<el-date-picker v-model="item.data.default" type="date" :placeholder="item.data.placeholder" v-if="drag" :size="size"> </el-date-picker>
|
|
12
|
+
<el-date-picker v-model="data[item.data.fieldName]" type="date" :placeholder="item.data.placeholder" v-if="!drag" :size="size"> </el-date-picker>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent } from "vue";
|
|
18
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
19
|
+
import fieldProps from "../../utils/fieldProps";
|
|
20
|
+
import { useWatch } from "../../utils/customHooks";
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
ControlType: "Date", // 必须与文件名匹配
|
|
23
|
+
nameCn: "日期选择",
|
|
24
|
+
icon: "icon-24gl-calendar",
|
|
25
|
+
formConfig: getFormConfig("Date", [
|
|
26
|
+
{ fieldName: "default", component: "Date" },
|
|
27
|
+
{ fieldName: "placeholder", component: "Text" },
|
|
28
|
+
{ fieldName: "format", component: "Selected" },
|
|
29
|
+
{ fieldName: "state", component: "Radio" },
|
|
30
|
+
]),
|
|
31
|
+
actionType: ["onChange"],
|
|
32
|
+
props: {
|
|
33
|
+
...fieldProps,
|
|
34
|
+
},
|
|
35
|
+
setup(props) {
|
|
36
|
+
useWatch(props);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist}">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{width: labelWidth + 'px'}">
|
|
4
|
+
<label>{{ item.data.label }}{{suffix}}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control" :style="{marginLeft: labelalign != 'top'?labelWidth + 'px': ''}">
|
|
11
|
+
<el-date-picker v-model="item.data.default" type="datetime" :placeholder="item.data.placeholder" v-if="drag" :size="size"> </el-date-picker>
|
|
12
|
+
<el-date-picker v-model="data[item.data.fieldName]" type="datetime" :placeholder="item.data.placeholder" v-if="!drag" :size="size"> </el-date-picker>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent } from "vue";
|
|
18
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
19
|
+
import fieldProps from "../../utils/fieldProps";
|
|
20
|
+
import { useWatch } from "../../utils/customHooks";
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
ControlType: "DateTime", // 必须与文件名匹配
|
|
23
|
+
nameCn: "日期时间选择",
|
|
24
|
+
icon: "icon-riqishijian",
|
|
25
|
+
formConfig: getFormConfig("DateTime", [
|
|
26
|
+
{ fieldName: "default", component: "DateTime" },
|
|
27
|
+
{ fieldName: "placeholder", component: "Text" },
|
|
28
|
+
{ fieldName: "format", component: "Selected" },
|
|
29
|
+
{ fieldName: "state", component: "Radio" },
|
|
30
|
+
]),
|
|
31
|
+
actionType: ["onChange"],
|
|
32
|
+
props: {
|
|
33
|
+
...fieldProps,
|
|
34
|
+
},
|
|
35
|
+
setup(props) {
|
|
36
|
+
useWatch(props);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist }">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{ width: labelWidth + 'px' }">
|
|
4
|
+
<label>{{ item.data.label }}{{ suffix }}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control" :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }">
|
|
11
|
+
<el-input-number v-model="item.data.default" :controls-position="item.data.type == 2 ? 'right' : ''" :size="item.data.size" v-if="drag" />
|
|
12
|
+
<el-input-number v-model="data[item.data.fieldName]" v-if="!drag" :controls-position="item.data.type == 2 ? 'right' : ''" :size="item.data.size" @focus="execFunc('onFocus')" @blur="execFunc('onBlur')" />
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent, getCurrentInstance, ComponentInternalInstance } from "vue";
|
|
18
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
19
|
+
import fieldProps from "../../utils/fieldProps";
|
|
20
|
+
import { useWatch } from "../../utils/customHooks";
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
ControlType: "InputNumber", // 必须与文件名匹配
|
|
23
|
+
nameCn: "计数器",
|
|
24
|
+
icon: "icon-jishuqi",
|
|
25
|
+
formConfig: getFormConfig("InputNumber", [
|
|
26
|
+
{ fieldName: "default", component: "InputNumber" },
|
|
27
|
+
{ fieldName: "type", component: "Radio" },
|
|
28
|
+
{ fieldName: "size", component: "Radio" },
|
|
29
|
+
{ fieldName: "precision", component: "InputNumber" },
|
|
30
|
+
{ fieldName: "state", component: "Radio" },
|
|
31
|
+
]),
|
|
32
|
+
props: {
|
|
33
|
+
...fieldProps,
|
|
34
|
+
},
|
|
35
|
+
actionType: ["onChange", "onFocus", "onBlur"],
|
|
36
|
+
setup(props) {
|
|
37
|
+
const vm = getCurrentInstance() as ComponentInternalInstance;
|
|
38
|
+
useWatch(props);
|
|
39
|
+
return {
|
|
40
|
+
execFunc(type: string) {
|
|
41
|
+
if (props.item.data.action && props.item.data.action[type]) {
|
|
42
|
+
window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [props.item.data.fieldName]);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="starfish-formitem"
|
|
4
|
+
:class="{
|
|
5
|
+
formCover: drag,
|
|
6
|
+
'starfish-vertical': labelalign != 'top',
|
|
7
|
+
[item.data.csslist?.join(' ')]: !!item.data.csslist,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="label"
|
|
12
|
+
:class="'label_' + labelalign"
|
|
13
|
+
:style="{ width: labelWidth + 'px' }"
|
|
14
|
+
>
|
|
15
|
+
<label>{{ item.data.label }}{{ suffix }}</label>
|
|
16
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
17
|
+
<el-tooltip
|
|
18
|
+
v-if="item.data.tip"
|
|
19
|
+
class="item"
|
|
20
|
+
effect="dark"
|
|
21
|
+
:content="item.data.tip"
|
|
22
|
+
placement="top"
|
|
23
|
+
>
|
|
24
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
25
|
+
</el-tooltip>
|
|
26
|
+
</div>
|
|
27
|
+
<div
|
|
28
|
+
class="control"
|
|
29
|
+
:style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }"
|
|
30
|
+
>
|
|
31
|
+
<div id="jsoneditor" ref="jsoneditor">
|
|
32
|
+
<div class="fullScreen" @click="showCustomDialog">
|
|
33
|
+
<i class="iconfontui icon-quanping"></i>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<CustomDialog ref="myDialog" :width="'60%'">
|
|
38
|
+
<el-main style="padding: 0">
|
|
39
|
+
<el-container style="height: 100%">
|
|
40
|
+
<el-main class="my-pageMain">
|
|
41
|
+
<div
|
|
42
|
+
ref="JsonViewerDialogDom"
|
|
43
|
+
style="height: calc(100% - 24px)"
|
|
44
|
+
></div>
|
|
45
|
+
</el-main>
|
|
46
|
+
<el-footer
|
|
47
|
+
class="my-Footer"
|
|
48
|
+
style="height: 60px; padding-top: 10px; text-align: right"
|
|
49
|
+
>
|
|
50
|
+
<el-button type="primary" @click="saveJson">保存</el-button>
|
|
51
|
+
<el-button @click="closeDialog">关闭</el-button>
|
|
52
|
+
</el-footer>
|
|
53
|
+
</el-container>
|
|
54
|
+
</el-main>
|
|
55
|
+
</CustomDialog>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
<script lang="ts">
|
|
59
|
+
import { defineComponent, watch, ref, nextTick, onMounted } from "vue";
|
|
60
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
61
|
+
import fieldProps from "../../utils/fieldProps";
|
|
62
|
+
import { useWatch } from "../../utils/customHooks";
|
|
63
|
+
import JSONEditor from 'jsoneditor'
|
|
64
|
+
import _ from "@/utils/_";
|
|
65
|
+
interface jsonEditor {
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
}
|
|
68
|
+
export default defineComponent({
|
|
69
|
+
ControlType: "JsonEditor", // 必须与文件名匹配
|
|
70
|
+
nameCn: "JSON编辑",
|
|
71
|
+
icon: "icon-json-full",
|
|
72
|
+
rule: _.getJsonValidate(),
|
|
73
|
+
formConfig: getFormConfig("JsonEditor", [
|
|
74
|
+
{ fieldName: "default", component: "JsonEditor" },
|
|
75
|
+
]),
|
|
76
|
+
props: {
|
|
77
|
+
...fieldProps,
|
|
78
|
+
},
|
|
79
|
+
actionType: ["onChange"],
|
|
80
|
+
setup(props) {
|
|
81
|
+
/**
|
|
82
|
+
* json dom
|
|
83
|
+
*/
|
|
84
|
+
const jsoneditor = ref<jsonEditor>({});
|
|
85
|
+
/**
|
|
86
|
+
* dialog 初始化jsoneditor对象
|
|
87
|
+
*/
|
|
88
|
+
let jsonEditorDialog: any = null;
|
|
89
|
+
/**
|
|
90
|
+
* jsoneditor对象
|
|
91
|
+
*/
|
|
92
|
+
let jsonEditors: any = null;
|
|
93
|
+
/**
|
|
94
|
+
* dialog dom
|
|
95
|
+
*/
|
|
96
|
+
const JsonViewerDialogDom = ref<any>();
|
|
97
|
+
const myDialog = ref<any>();
|
|
98
|
+
useWatch(props);
|
|
99
|
+
function initJson() {
|
|
100
|
+
const container = jsoneditor.value;
|
|
101
|
+
const data: any = props.data;
|
|
102
|
+
const item: any = props.item;
|
|
103
|
+
const fieldName = item.data.fieldName;
|
|
104
|
+
const options = {
|
|
105
|
+
modes: ["text", "code", "view"],
|
|
106
|
+
mode: "code",
|
|
107
|
+
search: false,
|
|
108
|
+
onChange() {
|
|
109
|
+
data[fieldName] = jsonEditors?.getText();
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
jsonEditors = new JSONEditor(container, options);
|
|
113
|
+
if (props.drag) {
|
|
114
|
+
jsonEditors?.set(_.tryParseJson(item.data.default));
|
|
115
|
+
} else {
|
|
116
|
+
jsonEditors?.set(_.tryParseJson(data[item.data.fieldName]));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
onMounted(() => {
|
|
120
|
+
initJson();
|
|
121
|
+
});
|
|
122
|
+
watch(
|
|
123
|
+
() => props.item,
|
|
124
|
+
(newValue: any) => {
|
|
125
|
+
if (props.drag) {
|
|
126
|
+
jsonEditors?.set(_.tryParseJson(newValue.data.default));
|
|
127
|
+
} else {
|
|
128
|
+
const data: any = props.data;
|
|
129
|
+
const item: any = props.item;
|
|
130
|
+
jsonEditors?.set(_.tryParseJson(data[item.data.fieldName]));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
return {
|
|
135
|
+
myDialog,
|
|
136
|
+
jsoneditor,
|
|
137
|
+
JsonViewerDialogDom,
|
|
138
|
+
async showCustomDialog() {
|
|
139
|
+
const myDialogDom: any = myDialog.value;
|
|
140
|
+
myDialogDom.show();
|
|
141
|
+
myDialogDom.init("JSON编辑", "icon-json-full");
|
|
142
|
+
await nextTick();
|
|
143
|
+
const container = JsonViewerDialogDom.value;
|
|
144
|
+
const options = {
|
|
145
|
+
modes: ["text", "code", "view"],
|
|
146
|
+
mode: "code",
|
|
147
|
+
search: false,
|
|
148
|
+
};
|
|
149
|
+
jsonEditorDialog = new JSONEditor(container, options);
|
|
150
|
+
jsonEditorDialog?.set(_.tryParseJson(jsonEditors.getText()));
|
|
151
|
+
},
|
|
152
|
+
closeDialog() {
|
|
153
|
+
myDialog.value.close();
|
|
154
|
+
},
|
|
155
|
+
saveJson() {
|
|
156
|
+
jsonEditors?.set(_.tryParseJson(jsonEditorDialog.getText()));
|
|
157
|
+
const data: any = props.data;
|
|
158
|
+
const item: any = props.item;
|
|
159
|
+
const fieldName = item.data.fieldName;
|
|
160
|
+
data[fieldName] = jsonEditors?.getText();
|
|
161
|
+
myDialog.value.close();
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
</script>
|
|
167
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist }">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{ width: labelWidth + 'px' }">
|
|
4
|
+
<label>{{ item.data.label }}{{ suffix }}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control" :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }">
|
|
11
|
+
<el-radio-group v-if="!drag" v-model="data[item.data.fieldName]" :size="size">
|
|
12
|
+
<el-radio v-for="(sitem, sindex) in item.data.itemConfig.items" :key="sindex" :label="sitem.value">{{ sitem.label }}</el-radio>
|
|
13
|
+
</el-radio-group>
|
|
14
|
+
<el-radio-group v-if="drag" v-model="item.data.itemConfig.value" :size="size">
|
|
15
|
+
<el-radio v-for="(sitem, sindex) in item.data.itemConfig.items" :key="sindex" :label="sitem.value">{{ sitem.label }}</el-radio>
|
|
16
|
+
</el-radio-group>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { defineComponent } from "vue";
|
|
22
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
23
|
+
import fieldProps from "../../utils/fieldProps";
|
|
24
|
+
import { useWatch } from "../../utils/customHooks";
|
|
25
|
+
export default defineComponent({
|
|
26
|
+
ControlType: "Radio", // 必须与文件名匹配
|
|
27
|
+
nameCn: "单选框",
|
|
28
|
+
icon: "icon-danxuankuang",
|
|
29
|
+
formConfig: getFormConfig("Radio", [
|
|
30
|
+
{ fieldName: "itemConfig", component: "KeyValueConfig" },
|
|
31
|
+
{ fieldName: "arrangeMent", component: "Radio" },
|
|
32
|
+
{ fieldName: "state", component: "Radio" },
|
|
33
|
+
]),
|
|
34
|
+
props: {
|
|
35
|
+
...fieldProps,
|
|
36
|
+
},
|
|
37
|
+
actionType: ["onChange"],
|
|
38
|
+
setup(props) {
|
|
39
|
+
useWatch(props);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="starfish-formitem" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top', [item.data.csslist?.join(' ')]: !!item.data.csslist}">
|
|
3
|
+
<div class="label" :class="'label_' + labelalign" :style="{width: labelWidth + 'px'}">
|
|
4
|
+
<label>{{ item.data.label }}{{suffix}}</label>
|
|
5
|
+
<span v-if="item.data.required" class="item_require">*</span>
|
|
6
|
+
<el-tooltip v-if="item.data.tip" class="item" effect="dark" :content="item.data.tip" placement="top">
|
|
7
|
+
<span class="tip iconfontui icon-tishi"></span>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="control" :style="{marginLeft: labelalign != 'top'?labelWidth + 'px': ''}">
|
|
11
|
+
<div ref="richText" v-if="drag" ></div>
|
|
12
|
+
<div ref="richText" v-if="!drag" ></div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent, onMounted, ref, onUnmounted } from "vue";
|
|
18
|
+
import E from "wangeditor";
|
|
19
|
+
import { getFormConfig } from "../../utils/fieldConfig";
|
|
20
|
+
import fieldProps from "../../utils/fieldProps";
|
|
21
|
+
import { useWatch } from "../../utils/customHooks";
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
ControlType: "RichText", // 必须与文件名匹配
|
|
24
|
+
nameCn: "富文本",
|
|
25
|
+
icon: "icon-textEdit",
|
|
26
|
+
formConfig: getFormConfig("RichText", [{ fieldName: "state", component: "Radio" }]),
|
|
27
|
+
props: {
|
|
28
|
+
...fieldProps,
|
|
29
|
+
},
|
|
30
|
+
setup(props) {
|
|
31
|
+
const richText = ref();
|
|
32
|
+
let editor: any = null;
|
|
33
|
+
useWatch(props);
|
|
34
|
+
onMounted(() => {
|
|
35
|
+
if (props.drag) {
|
|
36
|
+
editor = new E(richText.value);
|
|
37
|
+
editor.config.focus = false;
|
|
38
|
+
editor.create();
|
|
39
|
+
} else {
|
|
40
|
+
editor = new E(richText.value);
|
|
41
|
+
editor.config.focus = false;
|
|
42
|
+
editor.create();
|
|
43
|
+
const data: any = props.data;
|
|
44
|
+
const item: any = props.item;
|
|
45
|
+
editor.config.onchange = function (newHtml: string) {
|
|
46
|
+
console.log("onblur", newHtml); // 获取最新的 html 内容
|
|
47
|
+
data[item.data.fieldName] = newHtml;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
onUnmounted(() => {
|
|
52
|
+
editor.destroy();
|
|
53
|
+
editor = null;
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
richText
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
</script>
|