starfish-form-custom 1.0.8 → 1.0.9

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.
@@ -1,50 +1,104 @@
1
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' }">
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
+ >
4
15
  <label>{{ item.data.label }}{{ suffix }}</label>
5
16
  <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">
17
+ <el-tooltip
18
+ v-if="item.data.tip"
19
+ class="item"
20
+ effect="dark"
21
+ :content="item.data.tip"
22
+ placement="top"
23
+ >
7
24
  <span class="tip iconfontui icon-tishi"></span>
8
25
  </el-tooltip>
9
26
  </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 :disabled="item.data.state === 'disabled'" :readonly="item.data.state === 'readonly'" :size="size">
12
- <el-option v-for="items in item.data.itemConfig.items" :key="items.value" :label="items.label" :value="items.value" />
27
+ <div
28
+ class="control"
29
+ :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }"
30
+ >
31
+ <el-select
32
+ v-model="item.data.itemConfig.value"
33
+ :placeholder="item.data.placeholder"
34
+ v-if="drag"
35
+ multiple
36
+ :disabled="item.data.state === 'disabled'"
37
+ :readonly="item.data.state === 'readonly'"
38
+ :size="size"
39
+ >
40
+ <el-option
41
+ v-for="items in item.data.itemConfig.items"
42
+ :key="items.value"
43
+ :label="items.label"
44
+ :value="items.value"
45
+ />
13
46
  </el-select>
14
- <el-select v-model="data[item.data.fieldName]" :placeholder="item.data.placeholder" v-if="!drag" multiple :size="size" :disabled="item.data.state === 'disabled'" :readonly="item.data.state === 'readonly'" @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" />
47
+ <el-select
48
+ v-model="data[item.data.fieldName]"
49
+ :placeholder="item.data.placeholder"
50
+ v-if="!drag"
51
+ multiple
52
+ :size="size"
53
+ :disabled="item.data.state === 'disabled'"
54
+ :readonly="item.data.state === 'readonly'"
55
+ @focus="execFunc('onFocus')"
56
+ @blur="execFunc('onBlur')"
57
+ >
58
+ <el-option
59
+ v-for="items in item.data.itemConfig.items"
60
+ :key="items.value"
61
+ :label="items.label"
62
+ :value="items.value"
63
+ />
16
64
  </el-select>
17
65
  </div>
18
66
  </div>
19
67
  </template>
20
68
  <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
- });
69
+ import {
70
+ defineComponent,
71
+ getCurrentInstance,
72
+ ComponentInternalInstance,
73
+ } from "vue";
74
+ import { getFormConfig } from "../../utils/fieldConfig";
75
+ import fieldProps from "../../utils/fieldProps";
76
+ import { useWatch } from "../../utils/customHooks";
77
+ export default defineComponent({
78
+ ControlType: "Selecteds", // 必须与文件名匹配
79
+ nameCn: "选择器多选",
80
+ icon: "icon-xuanzeqi",
81
+ formConfig: getFormConfig("Selecteds", [
82
+ { fieldName: "placeholder", component: "Text" },
83
+ { fieldName: "itemConfig", component: "KeyValueConfigMult" },
84
+ { fieldName: "state", component: "Radio" },
85
+ ]),
86
+ actionType: ["onChange", "onFocus", "onBlur"],
87
+ props: {
88
+ ...fieldProps,
89
+ },
90
+ setup(props) {
91
+ const vm = getCurrentInstance() as ComponentInternalInstance;
92
+ useWatch(props);
93
+ return {
94
+ execFunc(type: string) {
95
+ if (props.item.data.action && props.item.data.action[type]) {
96
+ window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [
97
+ props.item.data.fieldName,
98
+ ]);
99
+ }
100
+ },
101
+ };
102
+ },
103
+ });
50
104
  </script>
@@ -28,11 +28,17 @@
28
28
  class="control"
29
29
  :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }"
30
30
  >
31
- <el-switch v-model="item.data.default" v-if="drag" :size="size" />
31
+ <el-switch
32
+ v-model="item.data.default"
33
+ v-if="drag"
34
+ :size="size"
35
+ :disabled="item.data.state === 'disabled' || item.data.state === 'readonly'"
36
+ />
32
37
  <el-switch
33
38
  v-model="data[item.data.fieldName]"
34
39
  v-if="!drag"
35
40
  :size="size"
41
+ :disabled="item.data.state === 'disabled' || item.data.state === 'readonly'"
36
42
  />
37
43
  </div>
38
44
  </div>
@@ -1,48 +1,96 @@
1
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' }">
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
+ >
4
15
  <label>{{ item.data.label }}{{ suffix }}</label>
5
16
  <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">
17
+ <el-tooltip
18
+ v-if="item.data.tip"
19
+ class="item"
20
+ effect="dark"
21
+ :content="item.data.tip"
22
+ placement="top"
23
+ >
7
24
  <span class="tip iconfontui icon-tishi"></span>
8
25
  </el-tooltip>
9
26
  </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')" />
27
+ <div
28
+ class="control"
29
+ :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }"
30
+ >
31
+ <el-input
32
+ v-model="item.data.default"
33
+ :placeholder="item.data.placeholder"
34
+ v-if="drag"
35
+ :size="size"
36
+ clearable
37
+ :disabled="item.data.state === 'disabled'"
38
+ :readonly="item.data.state === 'readonly'"
39
+ :maxlength="item.data.maxLength"
40
+ :minlength="item.data.minLength"
41
+ />
42
+ <el-input
43
+ v-model="data[item.data.fieldName]"
44
+ :placeholder="item.data.placeholder"
45
+ v-if="!drag"
46
+ :size="size"
47
+ :disabled="item.data.state === 'disabled'"
48
+ :readonly="item.data.state === 'readonly'"
49
+ :maxlength="item.data.maxLength"
50
+ :minlength="item.data.minLength"
51
+ clearable
52
+ @focus="execFunc('onFocus')"
53
+ @blur="execFunc('onBlur')"
54
+ />
13
55
  </div>
14
56
  </div>
15
57
  </template>
16
58
  <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
- });
59
+ import {
60
+ defineComponent,
61
+ getCurrentInstance,
62
+ ComponentInternalInstance,
63
+ } from "vue";
64
+ import { getFormConfig } from "../../utils/fieldConfig";
65
+ import fieldProps from "../../utils/fieldProps";
66
+ import { useWatch } from "../../utils/customHooks";
67
+ export default defineComponent({
68
+ ControlType: "Text", // 必须与文件名匹配
69
+ nameCn: "文本框",
70
+ icon: "icon-wenbenkuang",
71
+ formConfig: getFormConfig("Text", [
72
+ { fieldName: "default", component: "Text" },
73
+ { fieldName: "placeholder", component: "Text" },
74
+ { fieldName: "maxLength", component: "InputNumber" },
75
+ { fieldName: "minLength", component: "InputNumber" },
76
+ { fieldName: "state", component: "Radio" },
77
+ ]),
78
+ actionType: ["onChange", "onFocus", "onBlur"],
79
+ props: {
80
+ ...fieldProps,
81
+ },
82
+ setup(props) {
83
+ const vm = getCurrentInstance() as ComponentInternalInstance;
84
+ useWatch(props);
85
+ return {
86
+ execFunc(type: string) {
87
+ if (props.item.data.action && props.item.data.action[type]) {
88
+ window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [
89
+ props.item.data.fieldName,
90
+ ]);
91
+ }
92
+ },
93
+ };
94
+ },
95
+ });
48
96
  </script>
@@ -1,49 +1,99 @@
1
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' }">
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
+ >
4
15
  <label>{{ item.data.label }}{{ suffix }}</label>
5
16
  <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">
17
+ <el-tooltip
18
+ v-if="item.data.tip"
19
+ class="item"
20
+ effect="dark"
21
+ :content="item.data.tip"
22
+ placement="top"
23
+ >
7
24
  <span class="tip iconfontui icon-tishi"></span>
8
25
  </el-tooltip>
9
26
  </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')" />
27
+ <div
28
+ class="control"
29
+ :style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }"
30
+ >
31
+ <el-input
32
+ type="textarea"
33
+ v-model="item.data.default"
34
+ :placeholder="item.data.placeholder"
35
+ v-if="drag"
36
+ :disabled="item.data.state === 'disabled'"
37
+ :readonly="item.data.state === 'readonly'"
38
+ :maxlength="item.data.maxLength"
39
+ :minlength="item.data.minLength"
40
+ :autosize="item.data.autoHeight"
41
+ :size="size"
42
+ />
43
+ <el-input
44
+ type="textarea"
45
+ v-if="!drag"
46
+ v-model="data[item.data.fieldName]"
47
+ :placeholder="item.data.placeholder"
48
+ :disabled="item.data.state === 'disabled'"
49
+ :readonly="item.data.state === 'readonly'"
50
+ :maxlength="item.data.maxLength"
51
+ :minlength="item.data.minLength"
52
+ :autosize="item.data.autoHeight"
53
+ :size="size"
54
+ @focus="execFunc('onFocus')"
55
+ @blur="execFunc('onBlur')"
56
+ />
13
57
  </div>
14
58
  </div>
15
59
  </template>
16
60
  <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
- });
61
+ import {
62
+ defineComponent,
63
+ getCurrentInstance,
64
+ ComponentInternalInstance,
65
+ } from "vue";
66
+ import { getFormConfig } from "../../utils/fieldConfig";
67
+ import fieldProps from "../../utils/fieldProps";
68
+ import { useWatch } from "../../utils/customHooks";
69
+ export default defineComponent({
70
+ ControlType: "TextArea", // 必须与文件名匹配
71
+ nameCn: "文本域",
72
+ icon: "icon-textarea",
73
+ formConfig: getFormConfig("TextArea", [
74
+ { fieldName: "default", component: "Text" },
75
+ { fieldName: "placeholder", component: "Text" },
76
+ { fieldName: "maxLength", component: "InputNumber" },
77
+ { fieldName: "minLength", component: "InputNumber" },
78
+ { fieldName: "autoHeight", component: "Switch" },
79
+ { fieldName: "state", component: "Radio" },
80
+ ]),
81
+ actionType: ["onChange", "onFocus", "onBlur"],
82
+ props: {
83
+ ...fieldProps,
84
+ },
85
+ setup(props) {
86
+ const vm = getCurrentInstance() as ComponentInternalInstance;
87
+ useWatch(props);
88
+ return {
89
+ execFunc(type: string) {
90
+ if (props.item.data.action && props.item.data.action[type]) {
91
+ window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [
92
+ props.item.data.fieldName,
93
+ ]);
94
+ }
95
+ },
96
+ };
97
+ },
98
+ });
49
99
  </script>
@@ -8,8 +8,10 @@
8
8
  </el-tooltip>
9
9
  </div>
10
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>
11
+ <el-time-select v-model="item.data.default" start="08:30" step="00:15" end="18:30" :size="size" :disabled="item.data.state === 'disabled'"
12
+ :readonly="item.data.state === 'readonly'" :placeholder="item.data.placeholder" v-if="drag"></el-time-select>
13
+ <el-time-select v-model="data[item.data.fieldName]" start="08:30" step="00:15" end="18:30" :size="size" :disabled="item.data.state === 'disabled'"
14
+ :readonly="item.data.state === 'readonly'" :placeholder="item.data.placeholder" v-if="!drag"></el-time-select>
13
15
  </div>
14
16
  </div>
15
17
  </template>
@@ -28,6 +28,10 @@
28
28
  align-items: center;
29
29
  .control {
30
30
  width: 100%;
31
+ .vertical-group {
32
+ display: flex;
33
+ flex-direction: column;
34
+ }
31
35
  }
32
36
  }
33
37
  &.formCover {