@neatui/nuxt 1.5.4 → 1.6.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/package.json +1 -1
- package/src/components/form/Checkbox.vue +61 -46
- package/src/components/form/CheckboxGroup.vue +74 -0
- package/src/components/form/CheckboxItem.vue +87 -0
- package/src/components/form/DateView@v3.vue +38 -19
- package/src/components/form/Input@v3.vue +2 -25
- package/src/components/form/InputNumber.vue +2 -4
- package/src/components/form/{Textarea@v2.vue → Textarea.vue} +1 -3
- package/src/components/form/index.ts +4 -2
- package/src/components/loader/FormLoader/{FormLoader@v2.vue → FormLoader.vue} +3 -1
- package/src/components/loader/index.ts +1 -1
- package/src/components/form/DateRangePicker@v2.vue.backup +0 -224
- package/src/components/form/Input.vue.backup +0 -230
- package/src/components/form/MoreSelect.vue.backup +0 -144
- package/src/components/form/SearchSelect.vue.backup +0 -194
- package/src/components/form/TextArea.vue +0 -193
- package/src/components/form/date.ts +0 -321
- package/src/components/loader/FormLoader/FormLoader@v3.vue.backup +0 -399
- package/src/components/loader/FormLoader/FormRender@v3.vue.backup +0 -4
- package/src/components/loader/FormLoader@v1/FormLoader.vue +0 -506
- package/src/components/loader/FormLoader@v1/FormRender.vue +0 -302
package/package.json
CHANGED
|
@@ -1,64 +1,79 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<CheckboxGroup v-if="isMultiple" v-bind="groupBindings" :modelValue="arrayValue" @update:modelValue="emitValue">
|
|
3
|
+
<template #default="slotProps">
|
|
4
|
+
<slot v-bind="slotProps" />
|
|
5
|
+
</template>
|
|
6
|
+
</CheckboxGroup>
|
|
7
|
+
<Checkbox v-else v-bind="singleBindings" :modelValue="modelValue" @update:modelValue="emitValue">
|
|
8
|
+
<template #default="slotProps">
|
|
9
|
+
<slot v-bind="slotProps" />
|
|
10
|
+
</template>
|
|
11
|
+
</Checkbox>
|
|
10
12
|
</template>
|
|
13
|
+
|
|
11
14
|
<script setup lang="ts">
|
|
12
|
-
import {
|
|
15
|
+
import { computed } from 'vue';
|
|
16
|
+
import Checkbox from './CheckboxItem.vue';
|
|
17
|
+
import CheckboxGroup from './CheckboxGroup.vue';
|
|
18
|
+
|
|
19
|
+
type ValueType = any | { label?: string; value: any };
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
interface OptionsTypes {
|
|
21
|
+
interface OptionType {
|
|
16
22
|
label: string;
|
|
17
|
-
value
|
|
23
|
+
value?: any;
|
|
18
24
|
disabled?: boolean;
|
|
19
25
|
}
|
|
26
|
+
|
|
20
27
|
interface Props {
|
|
21
|
-
modelValue
|
|
22
|
-
|
|
28
|
+
modelValue?: any | any[];
|
|
29
|
+
label?: string;
|
|
30
|
+
disabled?: boolean;
|
|
23
31
|
theme?: string;
|
|
32
|
+
attrs?: any;
|
|
33
|
+
checkedValue?: ValueType;
|
|
34
|
+
defaultValue?: ValueType;
|
|
35
|
+
options?: (OptionType | string)[] | [ValueType, ValueType];
|
|
36
|
+
required?: boolean;
|
|
24
37
|
}
|
|
25
|
-
|
|
38
|
+
|
|
26
39
|
const props = withDefaults(defineProps<Props>(), {
|
|
40
|
+
modelValue: () => false,
|
|
27
41
|
theme: '@a',
|
|
28
|
-
|
|
42
|
+
disabled: false,
|
|
43
|
+
label: '',
|
|
44
|
+
attrs: () => ({}),
|
|
45
|
+
checkedValue: () => true,
|
|
46
|
+
defaultValue: () => false,
|
|
47
|
+
required: false,
|
|
29
48
|
options: () => [],
|
|
30
49
|
});
|
|
31
50
|
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
const emit = defineEmits<{
|
|
52
|
+
(e: 'update:modelValue', value: any | any[]): void;
|
|
53
|
+
}>();
|
|
34
54
|
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
const isMultiple = computed(() => Array.isArray(props.modelValue));
|
|
56
|
+
const arrayValue = computed(() => (Array.isArray(props.modelValue) ? props.modelValue : []));
|
|
57
|
+
|
|
58
|
+
const singleOptions = computed(() => (Array.isArray(props.options) && props.options.length === 2 ? (props.options as [ValueType, ValueType]) : undefined));
|
|
59
|
+
|
|
60
|
+
const singleBindings = computed(() => ({
|
|
61
|
+
label: props.label,
|
|
62
|
+
disabled: props.disabled,
|
|
63
|
+
theme: props.theme,
|
|
64
|
+
attrs: props.attrs,
|
|
65
|
+
checkedValue: props.checkedValue,
|
|
66
|
+
defaultValue: props.defaultValue,
|
|
67
|
+
options: singleOptions.value,
|
|
68
|
+
required: props.required,
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
const groupBindings = computed(() => ({
|
|
72
|
+
options: props.options as (OptionType | string)[],
|
|
73
|
+
disabled: props.disabled,
|
|
74
|
+
theme: props.theme,
|
|
75
|
+
attrs: props.attrs,
|
|
76
|
+
}));
|
|
39
77
|
|
|
40
|
-
|
|
41
|
-
watch(
|
|
42
|
-
[() => props.options, () => props.modelValue],
|
|
43
|
-
([options, value]) => {
|
|
44
|
-
const lists = options?.map((item) => ({ ...item, __checked: value?.includes(item.value) }));
|
|
45
|
-
// 只有在内容变化时才更新
|
|
46
|
-
if (JSON.stringify(state.lists) !== JSON.stringify(lists)) {
|
|
47
|
-
state.lists = lists;
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
immediate: true,
|
|
52
|
-
},
|
|
53
|
-
);
|
|
54
|
-
watch(
|
|
55
|
-
() => state.lists,
|
|
56
|
-
(val) => {
|
|
57
|
-
const value = val.filter((item: any) => item.__checked).map((item: any) => item.value);
|
|
58
|
-
emits('update:modelValue', value);
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
deep: true,
|
|
62
|
-
},
|
|
63
|
-
);
|
|
78
|
+
const emitValue = (value: any | any[]) => emit('update:modelValue', value);
|
|
64
79
|
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form class="m-sm-sub">
|
|
3
|
+
<label v-for="(item, idx) in normalizedOptions" :key="idx" :ui-form="`${theme} type:checkbox${item.disabled ? ' disabled' : ''}`" v-bind="attrs">
|
|
4
|
+
<input type="checkbox" :checked="isChecked(item.value)" :disabled="item.disabled" @change="handleChange(item.value, $event)" />
|
|
5
|
+
<slot :item="item" :index="idx">
|
|
6
|
+
<span>{{ item.label }}</span>
|
|
7
|
+
</slot>
|
|
8
|
+
</label>
|
|
9
|
+
</form>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { computed } from 'vue';
|
|
14
|
+
|
|
15
|
+
interface OptionType {
|
|
16
|
+
label: string;
|
|
17
|
+
value?: any;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
modelValue?: any[];
|
|
23
|
+
options?: (OptionType | string)[];
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
theme?: string;
|
|
26
|
+
attrs?: any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
+
modelValue: () => [],
|
|
31
|
+
options: () => [],
|
|
32
|
+
disabled: false,
|
|
33
|
+
theme: '@a',
|
|
34
|
+
attrs: () => ({}),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const emits = defineEmits<{
|
|
38
|
+
(e: 'update:modelValue', value: any[]): void;
|
|
39
|
+
}>();
|
|
40
|
+
|
|
41
|
+
// 规范化 options
|
|
42
|
+
const normalizedOptions = computed(() => {
|
|
43
|
+
return props.options.map((item) =>
|
|
44
|
+
typeof item === 'string'
|
|
45
|
+
? { label: item, value: item, disabled: props.disabled }
|
|
46
|
+
: {
|
|
47
|
+
label: item?.label ?? '',
|
|
48
|
+
value: 'value' in item ? item.value : item?.label,
|
|
49
|
+
disabled: item?.disabled ?? props.disabled,
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// 判断某个值是否被选中
|
|
55
|
+
const isChecked = (value: any) => {
|
|
56
|
+
return props.modelValue.includes(value);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// 处理选中状态变化
|
|
60
|
+
const handleChange = (value: any, e: Event) => {
|
|
61
|
+
const checked = (e.target as HTMLInputElement).checked;
|
|
62
|
+
let newValue: any[];
|
|
63
|
+
|
|
64
|
+
if (checked) {
|
|
65
|
+
// 添加到选中列表
|
|
66
|
+
newValue = [...props.modelValue, value];
|
|
67
|
+
} else {
|
|
68
|
+
// 从选中列表移除
|
|
69
|
+
newValue = props.modelValue.filter((v) => v !== value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
emits('update:modelValue', newValue);
|
|
73
|
+
};
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label :ui-form="`${theme} type:checkbox${disabled ? ' disabled' : ''}`" v-bind="attrs">
|
|
3
|
+
<input type="checkbox" :checked="isChecked" :disabled="disabled" @change="handleChange" />
|
|
4
|
+
<slot :item="slotItem">
|
|
5
|
+
<span v-if="label">{{ label }}</span>
|
|
6
|
+
</slot>
|
|
7
|
+
</label>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { computed, onMounted } from 'vue';
|
|
12
|
+
|
|
13
|
+
type ValueType = any | { label?: string; value: any };
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
modelValue?: any;
|
|
17
|
+
label?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
theme?: string;
|
|
20
|
+
attrs?: any;
|
|
21
|
+
checkedValue?: ValueType;
|
|
22
|
+
defaultValue?: ValueType;
|
|
23
|
+
options?: [ValueType, ValueType]; // [checkedValue, defaultValue]
|
|
24
|
+
required?: boolean; // 是否必填,必填时自动初始化为 defaultValue
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
28
|
+
modelValue: () => false,
|
|
29
|
+
theme: '@a',
|
|
30
|
+
disabled: false,
|
|
31
|
+
label: '',
|
|
32
|
+
attrs: () => ({}),
|
|
33
|
+
checkedValue: () => true,
|
|
34
|
+
defaultValue: () => false,
|
|
35
|
+
required: false,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const emits = defineEmits<{
|
|
39
|
+
(e: 'update:modelValue', value: any): void;
|
|
40
|
+
}>();
|
|
41
|
+
|
|
42
|
+
// 获取实际的值(支持对象和基本类型)
|
|
43
|
+
const getActualValue = (val: ValueType) => {
|
|
44
|
+
return val && typeof val === 'object' && 'value' in val ? val.value : val;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// 优先使用 options,否则使用 checkedValue/defaultValue
|
|
48
|
+
const actualCheckedValue = computed(() => {
|
|
49
|
+
const checkedVal = props.options ? props.options[0] : props.checkedValue;
|
|
50
|
+
return getActualValue(checkedVal);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const actualDefaultValue = computed(() => {
|
|
54
|
+
const defaultVal = props.options ? props.options[1] : props.defaultValue;
|
|
55
|
+
return getActualValue(defaultVal);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const slotItem = computed(() => {
|
|
59
|
+
if (props.options && props.options.length) {
|
|
60
|
+
const checkedVal = props.options[0];
|
|
61
|
+
const label = checkedVal && typeof checkedVal === 'object' && 'label' in checkedVal ? checkedVal.label : props.label;
|
|
62
|
+
return { label, value: getActualValue(checkedVal) };
|
|
63
|
+
}
|
|
64
|
+
return { label: props.label, value: actualCheckedValue.value };
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// 判断是否选中
|
|
68
|
+
const isChecked = computed(() => {
|
|
69
|
+
return props.modelValue === actualCheckedValue.value;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const handleChange = (e: Event) => {
|
|
73
|
+
const checked = (e.target as HTMLInputElement).checked;
|
|
74
|
+
emits('update:modelValue', checked ? actualCheckedValue.value : actualDefaultValue.value);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// 如果是必填项,且值不是有效的 checkedValue 或 defaultValue,自动初始化为 defaultValue
|
|
78
|
+
onMounted(() => {
|
|
79
|
+
if (props.required) {
|
|
80
|
+
const currentVal = props.modelValue;
|
|
81
|
+
const isValidValue = currentVal === actualCheckedValue.value || currentVal === actualDefaultValue.value;
|
|
82
|
+
if (!isValidValue) {
|
|
83
|
+
emits('update:modelValue', actualDefaultValue.value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
@@ -30,11 +30,7 @@
|
|
|
30
30
|
<div v-if="state.type === 2" class="full">
|
|
31
31
|
<ul ui-grid="mob:4" class="n-ms ny-sm-sub">
|
|
32
32
|
<li v-for="(year, idx) in panel.years" :key="idx" ui-flex="col cm" @click="setDateValue('y', year)">
|
|
33
|
-
<div
|
|
34
|
-
ui-flex="col cm"
|
|
35
|
-
class="w-ss h-xs ac ux-none r-sm"
|
|
36
|
-
:class="isSelectedYear(year) ? 'active bg-main-o-lm co-w' : 'co-main:hover'"
|
|
37
|
-
>
|
|
33
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedYear(year) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">
|
|
38
34
|
{{ year }}
|
|
39
35
|
</div>
|
|
40
36
|
</li>
|
|
@@ -42,18 +38,42 @@
|
|
|
42
38
|
</div>
|
|
43
39
|
<div v-else-if="state.type === 1" class="full">
|
|
44
40
|
<ul ui-grid="mob:4" class="n-ms ny-sm-sub">
|
|
45
|
-
<li ui-flex="col cm" @click="setDateValue('m', 1)"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<li ui-flex="col cm" @click="setDateValue('m',
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<li ui-flex="col cm" @click="setDateValue('m',
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<li ui-flex="col cm" @click="setDateValue('m',
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
<li ui-flex="col cm" @click="setDateValue('m', 1)">
|
|
42
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(1) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">1月</div>
|
|
43
|
+
</li>
|
|
44
|
+
<li ui-flex="col cm" @click="setDateValue('m', 2)">
|
|
45
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(2) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">2月</div>
|
|
46
|
+
</li>
|
|
47
|
+
<li ui-flex="col cm" @click="setDateValue('m', 3)">
|
|
48
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(3) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">3月</div>
|
|
49
|
+
</li>
|
|
50
|
+
<li ui-flex="col cm" @click="setDateValue('m', 4)">
|
|
51
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(4) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">4月</div>
|
|
52
|
+
</li>
|
|
53
|
+
<li ui-flex="col cm" @click="setDateValue('m', 5)">
|
|
54
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(5) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">5月</div>
|
|
55
|
+
</li>
|
|
56
|
+
<li ui-flex="col cm" @click="setDateValue('m', 6)">
|
|
57
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(6) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">6月</div>
|
|
58
|
+
</li>
|
|
59
|
+
<li ui-flex="col cm" @click="setDateValue('m', 7)">
|
|
60
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(7) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">7月</div>
|
|
61
|
+
</li>
|
|
62
|
+
<li ui-flex="col cm" @click="setDateValue('m', 8)">
|
|
63
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(8) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">8月</div>
|
|
64
|
+
</li>
|
|
65
|
+
<li ui-flex="col cm" @click="setDateValue('m', 9)">
|
|
66
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(9) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">9月</div>
|
|
67
|
+
</li>
|
|
68
|
+
<li ui-flex="col cm" @click="setDateValue('m', 10)">
|
|
69
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(10) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">10月</div>
|
|
70
|
+
</li>
|
|
71
|
+
<li ui-flex="col cm" @click="setDateValue('m', 11)">
|
|
72
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(11) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">11月</div>
|
|
73
|
+
</li>
|
|
74
|
+
<li ui-flex="col cm" @click="setDateValue('m', 12)">
|
|
75
|
+
<div ui-flex="col cm" class="w-ss h-xs ac ux-none r-sm" :class="isSelectedMonth(12) ? 'active bg-main-o-lm co-w' : 'co-main:hover'">12月</div>
|
|
76
|
+
</li>
|
|
57
77
|
</ul>
|
|
58
78
|
</div>
|
|
59
79
|
<div v-else class="full">
|
|
@@ -161,8 +181,7 @@
|
|
|
161
181
|
</template>
|
|
162
182
|
<script setup lang="ts">
|
|
163
183
|
import { computed, ref, reactive, watch, onMounted } from 'vue';
|
|
164
|
-
import { isDateString, isObject, isString } from '@fekit/utils';
|
|
165
|
-
import { idate } from './date';
|
|
184
|
+
import { idate, isDateString, isObject, isString } from '@fekit/utils';
|
|
166
185
|
import { Icon } from '../basic';
|
|
167
186
|
|
|
168
187
|
const normalizeDateInput = (value: any) => {
|
|
@@ -124,33 +124,15 @@
|
|
|
124
124
|
// 错误
|
|
125
125
|
error: {},
|
|
126
126
|
});
|
|
127
|
-
//
|
|
127
|
+
// 外部传入交互标识,主要用于外部没有输入但点击了提交,或表单提交成功后重置状态
|
|
128
128
|
watch(
|
|
129
129
|
() => props.interacted,
|
|
130
130
|
(interacted: any) => {
|
|
131
|
-
|
|
132
|
-
state.interacted = interacted;
|
|
133
|
-
}
|
|
131
|
+
state.interacted = interacted;
|
|
134
132
|
},
|
|
135
133
|
{ deep: true, immediate: true },
|
|
136
134
|
);
|
|
137
135
|
|
|
138
|
-
// 监听外部数据
|
|
139
|
-
// watch(
|
|
140
|
-
// () => props.modelValue,
|
|
141
|
-
// (value: any) => {
|
|
142
|
-
// state.value = value;
|
|
143
|
-
// },
|
|
144
|
-
// { deep: true, immediate: true }
|
|
145
|
-
// );
|
|
146
|
-
// watch(
|
|
147
|
-
// () => state.value,
|
|
148
|
-
// (value: any) => {
|
|
149
|
-
// emits('update:modelValue', value);
|
|
150
|
-
// },
|
|
151
|
-
// { deep: true, immediate: true }
|
|
152
|
-
// );
|
|
153
|
-
|
|
154
136
|
// 校验
|
|
155
137
|
watch(
|
|
156
138
|
[() => state.interacted, () => props.modelValue],
|
|
@@ -230,11 +212,6 @@
|
|
|
230
212
|
e.target.value = props.modelValue;
|
|
231
213
|
return false;
|
|
232
214
|
}
|
|
233
|
-
// 数字类型 - 移除有问题的逻辑,允许用户正常删除数字
|
|
234
|
-
// if (props.type === 'number' && !value && props.modelValue?.length !== 1) {
|
|
235
|
-
// e.target.value = props.modelValue;
|
|
236
|
-
// return false;
|
|
237
|
-
// }
|
|
238
215
|
// 输入事件
|
|
239
216
|
emits('input', e, state);
|
|
240
217
|
emits('update:modelValue', value || null);
|
|
@@ -86,13 +86,11 @@
|
|
|
86
86
|
// 错误
|
|
87
87
|
error: {}
|
|
88
88
|
});
|
|
89
|
-
//
|
|
89
|
+
// 外部传入交互标识,主要用于外部没有输入但点击了提交,或表单提交成功后重置状态
|
|
90
90
|
watch(
|
|
91
91
|
() => props.interacted,
|
|
92
92
|
(interacted: any) => {
|
|
93
|
-
|
|
94
|
-
state.interacted = interacted;
|
|
95
|
-
}
|
|
93
|
+
state.interacted = interacted;
|
|
96
94
|
},
|
|
97
95
|
{ deep: true, immediate: true }
|
|
98
96
|
);
|
|
@@ -4,6 +4,8 @@ import Switch from './Switch.vue';
|
|
|
4
4
|
import Textarea from './Textarea@v2.vue';
|
|
5
5
|
|
|
6
6
|
import Checkbox from './Checkbox.vue';
|
|
7
|
+
import CheckboxItem from './CheckboxItem.vue';
|
|
8
|
+
import CheckboxGroup from './CheckboxGroup.vue';
|
|
7
9
|
import Select from './Select@v3.vue';
|
|
8
10
|
import SelectList from './SelectList.vue';
|
|
9
11
|
import SelectTags from './SelectTags.vue';
|
|
@@ -17,8 +19,6 @@ import SearchMoreSelect from './SearchMoreSelect.vue';
|
|
|
17
19
|
import PageSelect from './PageSelect.vue';
|
|
18
20
|
import SelectTree from './SelectTree/SelectTree@v1.vue';
|
|
19
21
|
|
|
20
|
-
// import DateView from './DateView.vue';
|
|
21
|
-
// import DateView from './DateView@v2.vue';
|
|
22
22
|
import DateView from './DateView@v3.vue';
|
|
23
23
|
import DateRangeView from './DateRangeView@v3.vue';
|
|
24
24
|
import DatePicker from './DatePicker.vue';
|
|
@@ -34,6 +34,8 @@ export {
|
|
|
34
34
|
Switch,
|
|
35
35
|
Textarea,
|
|
36
36
|
Checkbox,
|
|
37
|
+
CheckboxItem,
|
|
38
|
+
CheckboxGroup,
|
|
37
39
|
Select,
|
|
38
40
|
SelectList,
|
|
39
41
|
SelectTags,
|
|
@@ -153,6 +153,7 @@
|
|
|
153
153
|
v-bind="{ ...(col.model[1] || {}) }"
|
|
154
154
|
></Textarea>
|
|
155
155
|
<Switch v-else-if="col.model[0] === 'Switch'" v-model="col._data[col.field]" :interacted="interacted" :rules="col.rules" v-bind="{ ...(col.model[1] || {}) }" />
|
|
156
|
+
<Checkbox v-else-if="col.model[0] === 'Checkbox'" v-model="col._data[col.field]" :interacted="interacted" :rules="col.rules" v-bind="{ ...(col.model[1] || {}) }" />
|
|
156
157
|
<Tree v-else-if="col.model[0] === 'Tree'" v-model="col._data[col.field]" :interacted="interacted" :rules="col.rules" class="mt-sm" v-bind="{ ...(col.model[1] || {}) }" />
|
|
157
158
|
<Cascader
|
|
158
159
|
v-else-if="col.model[0] === 'Cascader'"
|
|
@@ -170,7 +171,7 @@
|
|
|
170
171
|
</template>
|
|
171
172
|
</div>
|
|
172
173
|
</template>
|
|
173
|
-
<div :ui-flex="`${vertical ? 'col xm' : 'row xt'}`">
|
|
174
|
+
<div v-if="$slots.submit" :ui-flex="`${vertical ? 'col xm' : 'row xt'}`">
|
|
174
175
|
<div v-if="vertical">
|
|
175
176
|
<slot name="submit"></slot>
|
|
176
177
|
</div>
|
|
@@ -187,6 +188,7 @@
|
|
|
187
188
|
import {
|
|
188
189
|
Input,
|
|
189
190
|
Switch,
|
|
191
|
+
Checkbox,
|
|
190
192
|
Textarea,
|
|
191
193
|
Select,
|
|
192
194
|
SelectList,
|