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.
Files changed (73) hide show
  1. package/README.md +2 -0
  2. package/auto-imports.d.ts +9 -0
  3. package/components.d.ts +68 -0
  4. package/dist/formAction-28d86b6a.mjs +446 -0
  5. package/dist/index-04830c0b.mjs +126 -0
  6. package/dist/index-eab8ef70.mjs +519 -0
  7. package/dist/index-f7ea052c.mjs +241 -0
  8. package/dist/main-96327b2e.mjs +5051 -0
  9. package/dist/starfish-form-a18a5409.mjs +328 -0
  10. package/dist/starfish-form.mjs +36 -0
  11. package/dist/style.css +377 -0
  12. package/dist/types/form/src/common/Loading.vue.d.ts +3 -0
  13. package/dist/types/form/src/env.d.ts +15 -0
  14. package/dist/types/form/src/main.d.ts +43 -0
  15. package/dist/types/form/src/starfish-form.vue.d.ts +40 -0
  16. package/dist/types/form/src/utils/customHooks.d.ts +2 -0
  17. package/dist/types/form/src/utils/fieldConfig.d.ts +78 -0
  18. package/dist/types/form/src/utils/fieldProps.d.ts +43 -0
  19. package/dist/types/starfish-form.d.ts +3 -0
  20. package/package.json +42 -0
  21. package/src/common/KeyValueConfig.vue +145 -0
  22. package/src/common/KeyValueConfigMult.vue +139 -0
  23. package/src/common/Loading.vue +14 -0
  24. package/src/common/action.vue +76 -0
  25. package/src/common/formAction.vue +298 -0
  26. package/src/common/listConfig.vue +45 -0
  27. package/src/common/panel.vue +61 -0
  28. package/src/common/radiogroup.vue +31 -0
  29. package/src/components/CheckBox/index.vue +42 -0
  30. package/src/components/ColorSelect/index.vue +49 -0
  31. package/src/components/Date/index.vue +39 -0
  32. package/src/components/DateTime/index.vue +39 -0
  33. package/src/components/InputNumber/index.vue +48 -0
  34. package/src/components/JsonEditor/index.vue +167 -0
  35. package/src/components/Radio/index.vue +42 -0
  36. package/src/components/RichText/index.vue +60 -0
  37. package/src/components/Rule/index.vue +365 -0
  38. package/src/components/Rule/ruleform.json +315 -0
  39. package/src/components/Rule/rules.js +91 -0
  40. package/src/components/Selected/index.vue +50 -0
  41. package/src/components/Selecteds/index.vue +50 -0
  42. package/src/components/ShowRule/index.vue +50 -0
  43. package/src/components/Slider/index.vue +38 -0
  44. package/src/components/Switch/index.vue +61 -0
  45. package/src/components/Text/index.vue +48 -0
  46. package/src/components/TextArea/index.vue +49 -0
  47. package/src/components/Time/index.vue +36 -0
  48. package/src/env.d.ts +15 -0
  49. package/src/layout/Divider.vue +30 -0
  50. package/src/layout/Info.vue +69 -0
  51. package/src/layout/Tabs.vue +75 -0
  52. package/src/layout/collapse.vue +78 -0
  53. package/src/layout/grid.vue +88 -0
  54. package/src/layout/table.vue +80 -0
  55. package/src/main.ts +62 -0
  56. package/src/starfish-form.vue +265 -0
  57. package/src/styles/action.scss +25 -0
  58. package/src/styles/collapse.scss +15 -0
  59. package/src/styles/custom-cpm.scss +5 -0
  60. package/src/styles/divider.scss +16 -0
  61. package/src/styles/form-action.scss +92 -0
  62. package/src/styles/formedit.scss +69 -0
  63. package/src/styles/grid.scss +12 -0
  64. package/src/styles/index.scss +12 -0
  65. package/src/styles/keyvalueConfig.scss +56 -0
  66. package/src/styles/rule.scss +17 -0
  67. package/src/styles/showrule.scss +5 -0
  68. package/src/styles/table.scss +19 -0
  69. package/src/styles/tabs.scss +5 -0
  70. package/src/utils/customHooks.ts +22 -0
  71. package/src/utils/fieldConfig.ts +961 -0
  72. package/src/utils/fieldProps.ts +50 -0
  73. package/stats.html +4949 -0
@@ -0,0 +1,91 @@
1
+ /* eslint-disable no-useless-escape */
2
+ // 数字校验规则
3
+ const validateNumber = `(rule, value, callback) => {
4
+ console.log(rule);
5
+
6
+ if (value === "" || value == null) {
7
+ callback(new Error("请输入"));
8
+ } else if (!/^[0-9]*$/.test(value)) {
9
+ callback(new Error("必须为数字"));
10
+ }
11
+ callback();
12
+ }`;
13
+ // 数字校验规则(小数点保留两位)
14
+ const validateNumberD2 = `(rule, value, callback) => {
15
+ if (value === "" || value == null) {
16
+ callback(new Error("请输入"));
17
+ } else if (!/^([1-9]+[\d]*(.[0-9]{1,2})?)$/.test(value)) {
18
+ callback(new Error("必须为数字,且小数点最多两位"));
19
+ }
20
+ callback();
21
+ }`;
22
+
23
+ // 电话号码校验规则
24
+ const validatePhone = `(rule, value, callback) => {
25
+ if (value === "" || value == null) {
26
+ callback(new Error("请输入"));
27
+ } else if (!/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(value)) {
28
+ callback(new Error("请输入正确的值"));
29
+ }
30
+ callback();
31
+ }`;
32
+
33
+ // 身份证校验规则
34
+ const validateIdCard = `(rule, value, callback) => {
35
+ if (value === "" || value == null) {
36
+ callback(new Error("请输入"));
37
+ } else if (!/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(value)) {
38
+ callback(new Error("请输入正确的"));
39
+ }
40
+ callback();
41
+ }`;
42
+
43
+ // 邮箱校验规则
44
+ const validateEmail = `
45
+ (rule, value, callback) => {
46
+ if (value === "" || value == null) {
47
+ callback(new Error("请输入"));
48
+ } else if (!/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(value)) {
49
+ callback(new Error("请输入正确的值"));
50
+ }
51
+ callback();
52
+ }`;
53
+
54
+ // 大写字母单个校验
55
+ const validateBigEn = `
56
+ (rule, value, callback) => {
57
+ if (value === "" || value == null) {
58
+ callback(new Error("请输入"));
59
+ } else if (!/^[A-Z]$/.test(value)) {
60
+ callback(new Error("只能是大写字母"));
61
+ }
62
+ callback();
63
+ }`;
64
+
65
+ const ruleList = [
66
+ {
67
+ label: "数字校验规则",
68
+ validator: validateNumber,
69
+ },
70
+ {
71
+ label: "数字校验规则(小数点保留两位)",
72
+ validator: validateNumberD2,
73
+ },
74
+ {
75
+ label: "身份证校验规则",
76
+ validator: validateIdCard,
77
+ },
78
+ {
79
+ label: "电话号码校验规则",
80
+ validator: validatePhone,
81
+ },
82
+ {
83
+ label: "邮箱校验规则",
84
+ validator: validateEmail,
85
+ },
86
+ {
87
+ label: "大写字母单个校验",
88
+ validator: validateBigEn,
89
+ },
90
+ ];
91
+ export default ruleList;
@@ -0,0 +1,50 @@
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-select v-model="item.data.itemConfig.value" :placeholder="item.data.placeholder" v-if="drag" :size="size">
12
+ <el-option v-for="items in item.data.itemConfig.items" :key="items.value" :label="items.label" :value="items.value" />
13
+ </el-select>
14
+ <el-select v-model="data[item.data.fieldName]" :placeholder="item.data.placeholder" v-if="!drag" :size="size" @focus="execFunc('onFocus')" @blur="execFunc('onBlur')">
15
+ <el-option v-for="items in item.data.itemConfig.items" :key="items.value" :label="items.label" :value="items.value" />
16
+ </el-select>
17
+ </div>
18
+ </div>
19
+ </template>
20
+ <script lang="ts">
21
+ import { defineComponent, getCurrentInstance, ComponentInternalInstance } 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: "Selected", // 必须与文件名匹配
27
+ nameCn: "选择器",
28
+ icon: "icon-xuanzeqi",
29
+ formConfig: getFormConfig("Selected", [
30
+ { fieldName: "placeholder", component: "Text" },
31
+ { fieldName: "itemConfig", component: "KeyValueConfig" },
32
+ { fieldName: "state", component: "Radio" },
33
+ ]),
34
+ props: {
35
+ ...fieldProps,
36
+ },
37
+ actionType: ["onChange", "onFocus", "onBlur"],
38
+ setup(props) {
39
+ const vm = getCurrentInstance() as ComponentInternalInstance;
40
+ useWatch(props);
41
+ return {
42
+ execFunc(type: string) {
43
+ if (props.item.data.action && props.item.data.action[type]) {
44
+ window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [props.item.data.fieldName]);
45
+ }
46
+ },
47
+ };
48
+ },
49
+ });
50
+ </script>
@@ -0,0 +1,50 @@
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-select v-model="item.data.itemConfig.value" :placeholder="item.data.placeholder" v-if="drag" multiple :size="size">
12
+ <el-option v-for="items in item.data.itemConfig.items" :key="items.value" :label="items.label" :value="items.value" />
13
+ </el-select>
14
+ <el-select v-model="data[item.data.fieldName]" :placeholder="item.data.placeholder" v-if="!drag" multiple :size="size" @focus="execFunc('onFocus')" @blur="execFunc('onBlur')">
15
+ <el-option v-for="items in item.data.itemConfig.items" :key="items.value" :label="items.label" :value="items.value" />
16
+ </el-select>
17
+ </div>
18
+ </div>
19
+ </template>
20
+ <script lang="ts">
21
+ import { defineComponent, getCurrentInstance, ComponentInternalInstance } 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: "Selecteds", // 必须与文件名匹配
27
+ nameCn: "选择器多选",
28
+ icon: "icon-xuanzeqi",
29
+ formConfig: getFormConfig("Selecteds", [
30
+ { fieldName: "placeholder", component: "Text" },
31
+ { fieldName: "itemConfig", component: "KeyValueConfigMult" },
32
+ { fieldName: "state", component: "Radio" },
33
+ ]),
34
+ actionType: ["onChange", "onFocus", "onBlur"],
35
+ props: {
36
+ ...fieldProps,
37
+ },
38
+ setup(props) {
39
+ const vm = getCurrentInstance() as ComponentInternalInstance;
40
+ useWatch(props);
41
+ return {
42
+ execFunc(type: string) {
43
+ if (props.item.data.action && props.item.data.action[type]) {
44
+ window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [props.item.data.fieldName]);
45
+ }
46
+ },
47
+ };
48
+ },
49
+ });
50
+ </script>
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <div class="starfish-formitem starfish-editor-showrule" :class="{ formCover: drag, 'starfish-vertical': labelalign != 'top' }">
3
+ <div class="label" :class="'label_' + labelalign" :style="{ width: labelWidth + 'px' }">
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" :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }">
11
+ <el-button text type="primary" v-if="data.showRule != '{}'" :size="size">已设置</el-button>
12
+ <el-button text type="primary" v-else :size="size">未设置</el-button>
13
+ <div>
14
+ <el-button type="primary" :size="size" @click="onConditionSet">普通设置</el-button>
15
+ <el-button type="primary" :size="size" @click="onHighConditionSet">高级设置</el-button>
16
+ <ConditionSelect ref="ConditionSelect" :data="data" :item="item" @change="dataChange"></ConditionSelect>
17
+ <HighConditionSelect ref="highSelect" :data="data" :item="item" @change="dataChange"></HighConditionSelect>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </template>
22
+ <script lang="ts">
23
+ import { defineComponent, ref } from "vue";
24
+ import fieldProps from "../../utils/fieldProps";
25
+ import { useWatch } from "../../utils/customHooks";
26
+ export default defineComponent({
27
+ ControlType: "ShowRule", // 必须与文件名匹配
28
+ props: {
29
+ ...fieldProps,
30
+ },
31
+ setup(props) {
32
+ const ConditionSelect = ref();
33
+ const highSelect = ref();
34
+ useWatch(props);
35
+ return {
36
+ ConditionSelect,
37
+ highSelect,
38
+ onConditionSet() {
39
+ ConditionSelect.value?.show();
40
+ },
41
+ onHighConditionSet() {
42
+ highSelect.value?.show();
43
+ },
44
+ dataChange(result: any) {
45
+ (props.data as any)[props.item?.data.fieldName] = result;
46
+ },
47
+ };
48
+ },
49
+ });
50
+ </script>
@@ -0,0 +1,38 @@
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-slider v-model="item.data.default" v-if="drag" :min="Number(item.data.min)" :max="Number(item.data.max)" :size="size"></el-slider>
12
+ <el-slider v-model="data[item.data.fieldName]" v-if="!drag" :min="Number(item.data.min)" :max="Number(item.data.max)" :size="size"></el-slider>
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: "Slider", // 必须与文件名匹配
23
+ nameCn: "滑块",
24
+ icon: "icon-icon_huakuai",
25
+ formConfig: getFormConfig("Slider", [
26
+ { fieldName: "default", component: "InputNumber" },
27
+ { fieldName: "min", component: "Text" },
28
+ { fieldName: "max", component: "Text" },
29
+ ]),
30
+ props: {
31
+ ...fieldProps,
32
+ },
33
+ actionType: ["onChange"],
34
+ setup(props) {
35
+ useWatch(props);
36
+ },
37
+ });
38
+ </script>
@@ -0,0 +1,61 @@
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
+ <el-switch v-model="item.data.default" v-if="drag" :size="size" />
32
+ <el-switch
33
+ v-model="data[item.data.fieldName]"
34
+ v-if="!drag"
35
+ :size="size"
36
+ />
37
+ </div>
38
+ </div>
39
+ </template>
40
+ <script lang="ts">
41
+ import { defineComponent } from "vue";
42
+ import { getFormConfig } from "../../utils/fieldConfig";
43
+ import fieldProps from "../../utils/fieldProps";
44
+ import { useWatch } from "../../utils/customHooks";
45
+ export default defineComponent({
46
+ ControlType: "Switch", // 必须与文件名匹配
47
+ nameCn: "开关",
48
+ icon: "icon-kaiguanguan",
49
+ formConfig: getFormConfig("Switch", [
50
+ { fieldName: "default", component: "Switch" },
51
+ { fieldName: "state", component: "Radio" },
52
+ ]),
53
+ props: {
54
+ ...fieldProps,
55
+ },
56
+ actionType: ["onChange"],
57
+ setup(props) {
58
+ useWatch(props);
59
+ },
60
+ });
61
+ </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 v-model="item.data.default" :placeholder="item.data.placeholder" v-if="drag" :size="size" clearable />
12
+ <el-input v-model="data[item.data.fieldName]" :placeholder="item.data.placeholder" v-if="!drag" :size="size" clearable @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: "Text", // 必须与文件名匹配
23
+ nameCn: "文本框",
24
+ icon: "icon-wenbenkuang",
25
+ formConfig: getFormConfig("Text", [
26
+ { fieldName: "default", component: "Text" },
27
+ { fieldName: "placeholder", component: "Text" },
28
+ { fieldName: 'maxLength', component: 'InputNumber' },
29
+ { fieldName: 'minLength', component: 'InputNumber' },
30
+ { fieldName: 'state', component: 'Radio' },
31
+ ]),
32
+ actionType: ["onChange", "onFocus", "onBlur"],
33
+ props: {
34
+ ...fieldProps,
35
+ },
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,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
+ <el-input type="textarea" v-model="item.data.default" :placeholder="item.data.placeholder" v-if="drag" :size="size" />
12
+ <el-input type="textarea" v-model="data[item.data.fieldName]" :placeholder="item.data.placeholder" v-if="!drag" :size="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: "TextArea", // 必须与文件名匹配
23
+ nameCn: "文本域",
24
+ icon: "icon-textarea",
25
+ formConfig: getFormConfig("TextArea", [
26
+ { fieldName: "default", component: "Text" },
27
+ { fieldName: "placeholder", component: "Text" },
28
+ { fieldName: 'maxLength', component: 'InputNumber' },
29
+ { fieldName: 'minLength', component: 'InputNumber' },
30
+ { fieldName: 'autoHeight', component: 'Switch' },
31
+ { fieldName: 'state', component: 'Radio' },
32
+ ]),
33
+ actionType: ["onChange", "onFocus", "onBlur"],
34
+ props: {
35
+ ...fieldProps,
36
+ },
37
+ setup(props) {
38
+ const vm = getCurrentInstance() as ComponentInternalInstance;
39
+ useWatch(props);
40
+ return {
41
+ execFunc(type: string) {
42
+ if (props.item.data.action && props.item.data.action[type]) {
43
+ window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [props.item.data.fieldName]);
44
+ }
45
+ },
46
+ };
47
+ },
48
+ });
49
+ </script>
@@ -0,0 +1,36 @@
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-time-select v-model="item.data.default" start="08:30" step="00:15" end="18:30" :size="size" :placeholder="item.data.placeholder" v-if="drag"></el-time-select>
12
+ <el-time-select v-model="data[item.data.fieldName]" start="08:30" step="00:15" end="18:30" :size="size" :placeholder="item.data.placeholder" v-if="!drag"></el-time-select>
13
+ </div>
14
+ </div>
15
+ </template>
16
+ <script lang="ts">
17
+ import { defineComponent } from "vue";
18
+ import fieldProps from "../../utils/fieldProps";
19
+ import { getFormConfig } from "../../utils/fieldConfig";
20
+ import { useWatch } from "../../utils/customHooks";
21
+ export default defineComponent({
22
+ ControlType: "Time", // 必须与文件名匹配
23
+ nameCn: "时间选择",
24
+ icon: "icon-shijian",
25
+ formConfig: getFormConfig("DateTime", [
26
+ { fieldName: "default", component: "Time" },
27
+ { fieldName: "placeholder", component: "Text" },
28
+ ]),
29
+ props: {
30
+ ...fieldProps,
31
+ },
32
+ setup(props) {
33
+ useWatch(props);
34
+ },
35
+ });
36
+ </script>
package/src/env.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "*.vue" {
4
+ import type { DefineComponent } from "vue";
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6
+ const component: DefineComponent<{}, {}, any>;
7
+ export default component;
8
+ }
9
+
10
+ declare module "@codemirror/lang-javascript";
11
+
12
+ interface Window {
13
+ JSONEditor: any;
14
+ VApp: any;
15
+ }
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="starfish-formitem starfish-form-divider" :class="drag ? 'formCover' : ''">
3
+ <div class="control">
4
+ <div :style="{ color: item.data.color }">{{ item.data.label }}</div>
5
+ <el-divider class="divider" :style="{ background: item.data.dividerColor }"></el-divider>
6
+ </div>
7
+ </div>
8
+ </template>
9
+ <script lang="ts">
10
+ import { defineComponent } from "vue";
11
+ import { getFormConfig } from "../utils/fieldConfig";
12
+ import fieldProps from "../utils/fieldProps";
13
+ import { useWatch } from "../utils/customHooks";
14
+ export default defineComponent({
15
+ ControlType: "Divider", // 必须与文件名匹配
16
+ nameCn: "分割标题",
17
+ icon: "icon-fengexian1",
18
+ layout: true,
19
+ formConfig: getFormConfig("Divider", [
20
+ { fieldName: "color", component: "ColorSelect", label: "颜色设置" },
21
+ { fieldName: "dividerColor", component: "ColorSelect", label: "线条颜色设置" },
22
+ ], ['required', 'tip', 'rule']),
23
+ props: {
24
+ ...fieldProps,
25
+ },
26
+ setup(props) {
27
+ useWatch(props);
28
+ },
29
+ });
30
+ </script>
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div class="starfish-formitem" :class="{ formCover: drag }">
3
+ <div class="label" v-if="!item.data.labelShow">
4
+ <label>{{ item.data.label }}</label>
5
+ <el-tooltip
6
+ v-if="item.data.tip"
7
+ class="item"
8
+ effect="dark"
9
+ :content="item.data.tip"
10
+ placement="top"
11
+ >
12
+ <span class="tip iconfontui icon-tishi"></span>
13
+ </el-tooltip>
14
+ </div>
15
+ <div class="control">
16
+ <el-alert
17
+ :title="item.data.title"
18
+ :type="item.data.infotype"
19
+ :effect="item.data.effect"
20
+ :show-icon="item.data.showIcon"
21
+ :closable="item.data.closable"
22
+ :center="item.data.center"
23
+ :description="item.data.desc"
24
+ @close="execFunc('onClose')"
25
+ />
26
+ </div>
27
+ </div>
28
+ </template>
29
+ <script lang="ts">
30
+ import { defineComponent,getCurrentInstance,ComponentInternalInstance } from "vue";
31
+ import { getFormConfig } from "../utils/fieldConfig";
32
+ import fieldProps from "../utils/fieldProps";
33
+ import { useWatch } from "../utils/customHooks";
34
+ export default defineComponent({
35
+ ControlType: "Info", // 必须与文件名匹配
36
+ nameCn: "提示",
37
+ icon: "icon-jinggao",
38
+ layout: true,
39
+ formConfig: getFormConfig(
40
+ "Info",
41
+ [
42
+ { fieldName: "title", component: "Text", label: "标题" },
43
+ { fieldName: "desc", component: "Text", label: "文字描述" },
44
+ { fieldName: "labelShow", component: "Switch", label: "标签隐藏" },
45
+ { fieldName: "center", component: "Switch", label: "文字是否居中" },
46
+ { fieldName: "closable", component: "Switch", label: "是否可关闭" },
47
+ { fieldName: "showIcon", component: "Switch", label: " 是否显示类型图标" },
48
+ { fieldName: "effect", component: "Selected" },
49
+ { fieldName: "infotype", component: "Selected" },
50
+ ],
51
+ ["required", "tip", "rule"]
52
+ ),
53
+ actionType: ["onClose"],
54
+ props: {
55
+ ...fieldProps,
56
+ },
57
+ setup(props) {
58
+ const vm = getCurrentInstance() as ComponentInternalInstance;
59
+ useWatch(props);
60
+ return {
61
+ execFunc(type: string) {
62
+ if (props.item.data.action && props.item.data.action[type]) {
63
+ window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [props.item.data.fieldName]);
64
+ }
65
+ },
66
+ };
67
+ },
68
+ });
69
+ </script>