@skyfox2000/webui 0.1.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/.eslintrc.js +23 -0
- package/.prettierrc +11 -0
- package/.vscode/settings.json +25 -0
- package/README.md +104 -0
- package/env.d.ts +11 -0
- package/index.html +19 -0
- package/lib/AceEditor.d.ts +4 -0
- package/lib/BasicLayout.d.ts +4 -0
- package/lib/Error403.d.ts +4 -0
- package/lib/Error404.d.ts +4 -0
- package/lib/ExcelForm.d.ts +4 -0
- package/lib/UploadForm.d.ts +4 -0
- package/lib/assets/modules/basicLayout-YP_-EySb.js +726 -0
- package/lib/assets/modules/error403-Bi0E2twj.js +33 -0
- package/lib/assets/modules/error404-BF7vasR_.js +33 -0
- package/lib/assets/modules/excelForm-Dzndz-SG.js +109 -0
- package/lib/assets/modules/excelForm-WJVQmaDT.js +317 -0
- package/lib/assets/modules/index-FzWSvscZ.js +107 -0
- package/lib/assets/modules/index-ekkaExvB.js +49 -0
- package/lib/assets/modules/uploadForm-BahGnrAq.js +415 -0
- package/lib/assets/modules/uploadForm-DEnOjhwc.js +308 -0
- package/lib/components/common/button/index.vue.d.ts +42 -0
- package/lib/components/common/button/index.vue.d.ts.map +1 -0
- package/lib/components/common/icon/appicon.vue.d.ts +12 -0
- package/lib/components/common/icon/appicon.vue.d.ts.map +1 -0
- package/lib/components/common/icon/fullscreen.vue.d.ts +4 -0
- package/lib/components/common/icon/fullscreen.vue.d.ts.map +1 -0
- package/lib/components/common/icon/helper.vue.d.ts +23 -0
- package/lib/components/common/icon/helper.vue.d.ts.map +1 -0
- package/lib/components/common/icon/index.vue.d.ts +244 -0
- package/lib/components/common/icon/index.vue.d.ts.map +1 -0
- package/lib/components/common/icon/layoutIcon.vue.d.ts +44 -0
- package/lib/components/common/icon/layoutIcon.vue.d.ts.map +1 -0
- package/lib/components/common/icon/projectIcon.vue.d.ts +60 -0
- package/lib/components/common/icon/projectIcon.vue.d.ts.map +1 -0
- package/lib/components/common/icon/toolIcon.vue.d.ts +44 -0
- package/lib/components/common/icon/toolIcon.vue.d.ts.map +1 -0
- package/lib/components/common/index.d.ts +19 -0
- package/lib/components/common/index.d.ts.map +1 -0
- package/lib/components/common/tooltip/index.vue.d.ts +22 -0
- package/lib/components/common/tooltip/index.vue.d.ts.map +1 -0
- package/lib/components/content/dialog/excelForm.vue.d.ts +31 -0
- package/lib/components/content/dialog/excelForm.vue.d.ts.map +1 -0
- package/lib/components/content/dialog/index.vue.d.ts +35 -0
- package/lib/components/content/dialog/index.vue.d.ts.map +1 -0
- package/lib/components/content/dialog/uploadForm.vue.d.ts +25 -0
- package/lib/components/content/dialog/uploadForm.vue.d.ts.map +1 -0
- package/lib/components/content/drawer/index.vue.d.ts +27 -0
- package/lib/components/content/drawer/index.vue.d.ts.map +1 -0
- package/lib/components/content/form/formItem.vue.d.ts +26 -0
- package/lib/components/content/form/formItem.vue.d.ts.map +1 -0
- package/lib/components/content/form/index.vue.d.ts +26 -0
- package/lib/components/content/form/index.vue.d.ts.map +1 -0
- package/lib/components/content/index.d.ts +27 -0
- package/lib/components/content/index.d.ts.map +1 -0
- package/lib/components/content/search/index.vue.d.ts +30 -0
- package/lib/components/content/search/index.vue.d.ts.map +1 -0
- package/lib/components/content/search/searchItem.vue.d.ts +24 -0
- package/lib/components/content/search/searchItem.vue.d.ts.map +1 -0
- package/lib/components/content/table/index.vue.d.ts +37 -0
- package/lib/components/content/table/index.vue.d.ts.map +1 -0
- package/lib/components/content/table/tableOperate.vue.d.ts +19 -0
- package/lib/components/content/table/tableOperate.vue.d.ts.map +1 -0
- package/lib/components/content/toolbar/icontool.vue.d.ts +8 -0
- package/lib/components/content/toolbar/icontool.vue.d.ts.map +1 -0
- package/lib/components/content/toolbar/index.vue.d.ts +19 -0
- package/lib/components/content/toolbar/index.vue.d.ts.map +1 -0
- package/lib/components/content/tree/index.vue.d.ts +47 -0
- package/lib/components/content/tree/index.vue.d.ts.map +1 -0
- package/lib/components/error/error403.vue.d.ts +4 -0
- package/lib/components/error/error403.vue.d.ts.map +1 -0
- package/lib/components/error/error404.vue.d.ts +4 -0
- package/lib/components/error/error404.vue.d.ts.map +1 -0
- package/lib/components/form/aceEditor/aceConfig.d.ts +9 -0
- package/lib/components/form/aceEditor/aceConfig.d.ts.map +1 -0
- package/lib/components/form/aceEditor/index.vue.d.ts +13 -0
- package/lib/components/form/aceEditor/index.vue.d.ts.map +1 -0
- package/lib/components/form/autoComplete/index.vue.d.ts +140 -0
- package/lib/components/form/autoComplete/index.vue.d.ts.map +1 -0
- package/lib/components/form/cascader/index.vue.d.ts +110 -0
- package/lib/components/form/cascader/index.vue.d.ts.map +1 -0
- package/lib/components/form/checkbox/index.vue.d.ts +129 -0
- package/lib/components/form/checkbox/index.vue.d.ts.map +1 -0
- package/lib/components/form/datePicker/index.vue.d.ts +7 -0
- package/lib/components/form/datePicker/index.vue.d.ts.map +1 -0
- package/lib/components/form/index.d.ts +41 -0
- package/lib/components/form/index.d.ts.map +1 -0
- package/lib/components/form/input/index.vue.d.ts +27 -0
- package/lib/components/form/input/index.vue.d.ts.map +1 -0
- package/lib/components/form/input/inputIcon.vue.d.ts +11 -0
- package/lib/components/form/input/inputIcon.vue.d.ts.map +1 -0
- package/lib/components/form/input/inputNumber.vue.d.ts +4 -0
- package/lib/components/form/input/inputNumber.vue.d.ts.map +1 -0
- package/lib/components/form/input/inputPassword.vue.d.ts +4 -0
- package/lib/components/form/input/inputPassword.vue.d.ts.map +1 -0
- package/lib/components/form/propEditor/index.vue.d.ts +13 -0
- package/lib/components/form/propEditor/index.vue.d.ts.map +1 -0
- package/lib/components/form/radio/index.vue.d.ts +134 -0
- package/lib/components/form/radio/index.vue.d.ts.map +1 -0
- package/lib/components/form/radio/radioStatus.vue.d.ts +32 -0
- package/lib/components/form/radio/radioStatus.vue.d.ts.map +1 -0
- package/lib/components/form/rangePicker/index.vue.d.ts +17 -0
- package/lib/components/form/rangePicker/index.vue.d.ts.map +1 -0
- package/lib/components/form/select/index.vue.d.ts +143 -0
- package/lib/components/form/select/index.vue.d.ts.map +1 -0
- package/lib/components/form/switch/index.vue.d.ts +44 -0
- package/lib/components/form/switch/index.vue.d.ts.map +1 -0
- package/lib/components/form/textarea/index.vue.d.ts +4 -0
- package/lib/components/form/textarea/index.vue.d.ts.map +1 -0
- package/lib/components/form/transfer/index.vue.d.ts +39 -0
- package/lib/components/form/transfer/index.vue.d.ts.map +1 -0
- package/lib/components/form/transfer/transferTable.vue.d.ts +39 -0
- package/lib/components/form/transfer/transferTable.vue.d.ts.map +1 -0
- package/lib/components/form/treeSelect/index.vue.d.ts +39 -0
- package/lib/components/form/treeSelect/index.vue.d.ts.map +1 -0
- package/lib/components/form/upload/uploadList.vue.d.ts +477 -0
- package/lib/components/form/upload/uploadList.vue.d.ts.map +1 -0
- package/lib/components/index.d.ts +9 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/layout/breadcrumb/index.vue.d.ts +4 -0
- package/lib/components/layout/breadcrumb/index.vue.d.ts.map +1 -0
- package/lib/components/layout/content/index.vue.d.ts +23 -0
- package/lib/components/layout/content/index.vue.d.ts.map +1 -0
- package/lib/components/layout/datetime/index.vue.d.ts +4 -0
- package/lib/components/layout/datetime/index.vue.d.ts.map +1 -0
- package/lib/components/layout/header/headerExits.vue.d.ts +4 -0
- package/lib/components/layout/header/headerExits.vue.d.ts.map +1 -0
- package/lib/components/layout/header/index.vue.d.ts +4 -0
- package/lib/components/layout/header/index.vue.d.ts.map +1 -0
- package/lib/components/layout/index.d.ts +17 -0
- package/lib/components/layout/index.d.ts.map +1 -0
- package/lib/components/layout/menu/index.vue.d.ts +7 -0
- package/lib/components/layout/menu/index.vue.d.ts.map +1 -0
- package/lib/components/layout/menu/menuTabs.vue.d.ts +4 -0
- package/lib/components/layout/menu/menuTabs.vue.d.ts.map +1 -0
- package/lib/components/layout/page/basicLayout.vue.d.ts +7 -0
- package/lib/components/layout/page/basicLayout.vue.d.ts.map +1 -0
- package/lib/es/AceEditor/index.js +168 -0
- package/lib/es/BasicLayout/index.js +4 -0
- package/lib/es/Error403/index.js +4 -0
- package/lib/es/Error404/index.js +4 -0
- package/lib/es/ExcelForm/index.js +5 -0
- package/lib/es/UploadForm/index.js +5 -0
- package/lib/index.d.ts +2 -0
- package/lib/webui.css +1 -0
- package/lib/webui.es.js +3349 -0
- package/package.json +66 -0
- package/plugins/vite-plugin-auto-generate-vue.ts +105 -0
- package/postcss.config.ts +6 -0
- package/src/assets/global.css +9 -0
- package/src/components/common/button/index.vue +126 -0
- package/src/components/common/icon/appicon.vue +28 -0
- package/src/components/common/icon/fullscreen.vue +13 -0
- package/src/components/common/icon/helper.vue +30 -0
- package/src/components/common/icon/index.vue +426 -0
- package/src/components/common/icon/layoutIcon.vue +33 -0
- package/src/components/common/icon/projectIcon.vue +41 -0
- package/src/components/common/icon/toolIcon.vue +33 -0
- package/src/components/common/index.ts +19 -0
- package/src/components/common/tooltip/index.vue +25 -0
- package/src/components/content/dialog/excelForm.vue +479 -0
- package/src/components/content/dialog/index.vue +149 -0
- package/src/components/content/dialog/uploadForm.vue +228 -0
- package/src/components/content/drawer/index.vue +93 -0
- package/src/components/content/form/formItem.vue +76 -0
- package/src/components/content/form/index.vue +48 -0
- package/src/components/content/index.ts +32 -0
- package/src/components/content/search/index.vue +135 -0
- package/src/components/content/search/searchItem.vue +52 -0
- package/src/components/content/table/index.vue +215 -0
- package/src/components/content/table/tableOperate.vue +131 -0
- package/src/components/content/toolbar/icontool.vue +151 -0
- package/src/components/content/toolbar/index.vue +107 -0
- package/src/components/content/tree/index.vue +140 -0
- package/src/components/error/error403.vue +14 -0
- package/src/components/error/error404.vue +14 -0
- package/src/components/form/aceEditor/aceConfig.ts +90 -0
- package/src/components/form/aceEditor/index.vue +175 -0
- package/src/components/form/autoComplete/index.vue +171 -0
- package/src/components/form/cascader/index.vue +110 -0
- package/src/components/form/checkbox/index.vue +108 -0
- package/src/components/form/datePicker/index.vue +29 -0
- package/src/components/form/index.ts +54 -0
- package/src/components/form/input/index.vue +70 -0
- package/src/components/form/input/inputIcon.vue +39 -0
- package/src/components/form/input/inputNumber.vue +23 -0
- package/src/components/form/input/inputPassword.vue +22 -0
- package/src/components/form/propEditor/index.vue +81 -0
- package/src/components/form/radio/index.vue +132 -0
- package/src/components/form/radio/radioStatus.vue +42 -0
- package/src/components/form/rangePicker/index.vue +64 -0
- package/src/components/form/select/index.vue +186 -0
- package/src/components/form/switch/index.vue +58 -0
- package/src/components/form/textarea/index.vue +23 -0
- package/src/components/form/transfer/index.vue +95 -0
- package/src/components/form/transfer/transferTable.vue +124 -0
- package/src/components/form/treeSelect/index.vue +108 -0
- package/src/components/form/upload/uploadList.vue +235 -0
- package/src/components/index.ts +97 -0
- package/src/components/layout/breadcrumb/index.vue +38 -0
- package/src/components/layout/content/index.vue +28 -0
- package/src/components/layout/datetime/index.vue +16 -0
- package/src/components/layout/header/headerExits.vue +28 -0
- package/src/components/layout/header/index.vue +43 -0
- package/src/components/layout/index.ts +16 -0
- package/src/components/layout/menu/index.vue +64 -0
- package/src/components/layout/menu/menuTabs.vue +56 -0
- package/src/components/layout/page/basicLayout.vue +67 -0
- package/src/vite-env.d.ts +8 -0
- package/tailwind.config.ts +11 -0
- package/tsconfig.json +53 -0
- package/vite.config.ts +117 -0
- package//344/273/243/347/240/201/350/247/204/350/214/203/345/217/212/351/243/216/346/240/274/346/214/207/345/215/227.md +116 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, onMounted, onUnmounted, useAttrs, watch } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
circleLoading,
|
|
5
|
+
useInputFactory,
|
|
6
|
+
OptionCommProps,
|
|
7
|
+
OptionItemProps,
|
|
8
|
+
loadOption,
|
|
9
|
+
unloadOption,
|
|
10
|
+
formValidate,
|
|
11
|
+
} from '@skyfox2000/webbase';
|
|
12
|
+
import { Cascader } from 'ant-design-vue';
|
|
13
|
+
import { DefaultOptionType, ValueType } from 'ant-design-vue/es/vc-cascader/Cascader';
|
|
14
|
+
import { IUrlInfo } from '@skyfox2000/fapi';
|
|
15
|
+
|
|
16
|
+
const props = defineProps(OptionCommProps);
|
|
17
|
+
|
|
18
|
+
// 关闭自动继承属性到根元素
|
|
19
|
+
defineOptions({
|
|
20
|
+
inheritAttrs: false,
|
|
21
|
+
});
|
|
22
|
+
const attrs = useAttrs(); // 手动获取 $attrs
|
|
23
|
+
|
|
24
|
+
const url = ref<IUrlInfo>({
|
|
25
|
+
...props.url,
|
|
26
|
+
url: props.url?.url || '',
|
|
27
|
+
fieldMap: props.fieldMap || props.url?.fieldMap,
|
|
28
|
+
params: props.params || props.url?.params,
|
|
29
|
+
loadingText: false,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const inputFactory = useInputFactory();
|
|
33
|
+
const { editorCtrl, errInfo, labelText } = inputFactory;
|
|
34
|
+
|
|
35
|
+
const placeholder = ref(attrs.placeholder);
|
|
36
|
+
watch(
|
|
37
|
+
() => url.value.loading,
|
|
38
|
+
(newVal) => {
|
|
39
|
+
if (newVal) placeholder.value = '';
|
|
40
|
+
else if (!placeholder.value) placeholder.value = '请选择' + labelText.value;
|
|
41
|
+
},
|
|
42
|
+
{ immediate: true },
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const emit = defineEmits(['change', 'update:labels', 'update:value']);
|
|
47
|
+
inputFactory.inputEmit = emit;
|
|
48
|
+
/**
|
|
49
|
+
* 实际的选择项
|
|
50
|
+
*/
|
|
51
|
+
const selectOptions = ref<OptionItemProps[]>([]);
|
|
52
|
+
|
|
53
|
+
const onChanged = (_: ValueType, selected: DefaultOptionType[]) => {
|
|
54
|
+
if (!selected || selected.length === 0) {
|
|
55
|
+
emit('update:labels', []);
|
|
56
|
+
emit('update:value', []);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const labels: string[] = selected.map((item) => item.label!);
|
|
60
|
+
|
|
61
|
+
emit('update:labels', labels);
|
|
62
|
+
emit(
|
|
63
|
+
'update:value',
|
|
64
|
+
selected.map((item) => item.value),
|
|
65
|
+
);
|
|
66
|
+
if (errInfo?.value.errClass && editorCtrl) {
|
|
67
|
+
/// 重新开始验证
|
|
68
|
+
formValidate(editorCtrl);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
onMounted(() => {
|
|
73
|
+
if (url.value && !url.value.fieldMap) {
|
|
74
|
+
url.value.fieldMap = {
|
|
75
|
+
title: 'Name',
|
|
76
|
+
label: 'Name',
|
|
77
|
+
value: 'Id',
|
|
78
|
+
key: 'Id',
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
loadOption(props.autoload, props, selectOptions, inputFactory, url.value, url.value.params);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
onUnmounted(() => {
|
|
85
|
+
unloadOption(props, inputFactory);
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
88
|
+
<template>
|
|
89
|
+
<div>
|
|
90
|
+
<div v-if="!selectOptions.length" class="absolute z-10 mt-[5px] mr-[10px] text-[#999] flex items-center">
|
|
91
|
+
<circleLoading class="text-[#555] mx-[5px] !ml-[10px] !w-4 !h-4" />
|
|
92
|
+
<span>数据加载中...</span>
|
|
93
|
+
</div>
|
|
94
|
+
<Cascader
|
|
95
|
+
:options="selectOptions"
|
|
96
|
+
:class="[errInfo?.errClass]"
|
|
97
|
+
:allow-clear="true"
|
|
98
|
+
:placeholder="selectOptions.length > 0 ? '请选择' + labelText : ''"
|
|
99
|
+
@change="onChanged"
|
|
100
|
+
v-bind="attrs"
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<style scoped>
|
|
106
|
+
.error :deep(.ant-select-selector) {
|
|
107
|
+
border-color: #ef444480;
|
|
108
|
+
box-shadow: 0 0 3px 0 #ff4d4f;
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, onMounted, onUnmounted, useAttrs } from 'vue';
|
|
3
|
+
import { Checkbox, CheckboxGroup } from 'ant-design-vue';
|
|
4
|
+
import {
|
|
5
|
+
// circleLoading,
|
|
6
|
+
getSelectedLabels,
|
|
7
|
+
loadOption,
|
|
8
|
+
onOptionChanged,
|
|
9
|
+
OptionItemProps,
|
|
10
|
+
SelectValue,
|
|
11
|
+
unloadOption,
|
|
12
|
+
useInputFactory,
|
|
13
|
+
} from '@skyfox2000/webbase';
|
|
14
|
+
import { CheckboxValueType } from 'ant-design-vue/es/checkbox/interface';
|
|
15
|
+
import { OptionCommProps } from '@skyfox2000/webbase';
|
|
16
|
+
import { IUrlInfo } from '@skyfox2000/fapi';
|
|
17
|
+
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
...OptionCommProps,
|
|
20
|
+
nodata: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: '',
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* 换行数量
|
|
26
|
+
*/
|
|
27
|
+
wrap: {
|
|
28
|
+
type: Number,
|
|
29
|
+
},
|
|
30
|
+
disabledItems: {
|
|
31
|
+
type: Array as () => string[],
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
// 关闭自动继承属性到根元素
|
|
35
|
+
defineOptions({
|
|
36
|
+
inheritAttrs: false,
|
|
37
|
+
});
|
|
38
|
+
const attrs = useAttrs(); // 手动获取 $attrs
|
|
39
|
+
|
|
40
|
+
const url = ref<IUrlInfo>({
|
|
41
|
+
...props.url,
|
|
42
|
+
url: props.url?.url || '',
|
|
43
|
+
fieldMap: props.fieldMap || props.url?.fieldMap,
|
|
44
|
+
params: props.params || props.url?.params,
|
|
45
|
+
loadingText: false,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const inputFactory = useInputFactory();
|
|
49
|
+
const { errInfo } = inputFactory;
|
|
50
|
+
const emit = defineEmits(['change', 'update:labels']);
|
|
51
|
+
inputFactory.inputEmit = emit;
|
|
52
|
+
|
|
53
|
+
const checkboxOptions = ref<OptionItemProps[]>([]);
|
|
54
|
+
|
|
55
|
+
const onChanged = (e: CheckboxValueType[]) => {
|
|
56
|
+
const checkedValue = e;
|
|
57
|
+
const selectedOptions = onOptionChanged(props, checkedValue as SelectValue, checkboxOptions, inputFactory);
|
|
58
|
+
const labels: string[] = getSelectedLabels(selectedOptions);
|
|
59
|
+
emit('update:labels', labels);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
if (url.value && !url.value.fieldMap) {
|
|
64
|
+
url.value.fieldMap = {
|
|
65
|
+
title: 'Name',
|
|
66
|
+
label: 'Name',
|
|
67
|
+
value: 'Id',
|
|
68
|
+
key: 'Id',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
loadOption(props.autoload, props, checkboxOptions, inputFactory, url.value, url.value.params);
|
|
72
|
+
});
|
|
73
|
+
onUnmounted(() => {
|
|
74
|
+
unloadOption(props, inputFactory);
|
|
75
|
+
});
|
|
76
|
+
</script>
|
|
77
|
+
<template>
|
|
78
|
+
<div class="min-h-[32px] pt-[5px]">
|
|
79
|
+
<!-- TODO 获取结果通知 -->
|
|
80
|
+
<!-- <div v-if="!checkboxOptions.length" class="absolute z-10 mt-[5px] mr-[10px] text-[#999] flex items-center">
|
|
81
|
+
<circleLoading class="text-[#555] mx-[5px] !ml-[10px] !w-4 !h-4" />
|
|
82
|
+
<span>数据加载中...</span>
|
|
83
|
+
</div> -->
|
|
84
|
+
<CheckboxGroup @change="onChanged" class="w-full mb-[-3px]" v-bind="attrs">
|
|
85
|
+
<template v-if="checkboxOptions.length > 0">
|
|
86
|
+
<Checkbox v-for="item in checkboxOptions" :key="item.value" :value="item.value"
|
|
87
|
+
:disabled="item.disabled || (item.value && disabledItems && disabledItems.indexOf(item.value.toString()) > -1)"
|
|
88
|
+
:class="[
|
|
89
|
+
errInfo?.errClass === 'error' ? 'error !text-red-400' : '',
|
|
90
|
+
'text-nowrap',
|
|
91
|
+
'pb-1',
|
|
92
|
+
wrap ? `w-1/${props.wrap}` : '',
|
|
93
|
+
]">
|
|
94
|
+
{{ item.label }}
|
|
95
|
+
</Checkbox>
|
|
96
|
+
</template>
|
|
97
|
+
<template v-else-if="nodata">
|
|
98
|
+
<div class="text-center text-gray-500">{{ nodata }}</div>
|
|
99
|
+
</template>
|
|
100
|
+
</CheckboxGroup>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
<style scoped>
|
|
104
|
+
.error :deep(input + span) {
|
|
105
|
+
border-color: #ff717190;
|
|
106
|
+
box-shadow: 0 0 3px 0 #ff4d4f;
|
|
107
|
+
}
|
|
108
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { DatePicker } from 'ant-design-vue';
|
|
4
|
+
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
|
|
5
|
+
import { formValidate, useInputFactory } from '@skyfox2000/webbase';
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
valueFormat?: string;
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const { editorCtrl, labelText, errInfo } = useInputFactory();
|
|
11
|
+
const onBlur = () => {
|
|
12
|
+
if (errInfo?.value.errClass && editorCtrl) {
|
|
13
|
+
/// 重新开始验证
|
|
14
|
+
formValidate(editorCtrl);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const dateFormat = ref<string>(props.valueFormat ?? 'YYYY-MM-DD');
|
|
19
|
+
</script>
|
|
20
|
+
<template>
|
|
21
|
+
<DatePicker
|
|
22
|
+
:class="[errInfo?.errClass === 'error' ? 'error !border-red-300 shadow-[0_0_3px_0px_#ff4d4f]' : '']"
|
|
23
|
+
class="w-full"
|
|
24
|
+
:placeholder="'请选择' + labelText"
|
|
25
|
+
:locale="locale"
|
|
26
|
+
:valueFormat="dateFormat"
|
|
27
|
+
@blur="onBlur"
|
|
28
|
+
/>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import AceEditor from './aceEditor/index.vue';
|
|
2
|
+
export { AceEditor };
|
|
3
|
+
|
|
4
|
+
import AutoComplete from './autoComplete/index.vue';
|
|
5
|
+
export { AutoComplete };
|
|
6
|
+
|
|
7
|
+
import Cascader from './cascader/index.vue';
|
|
8
|
+
export { Cascader };
|
|
9
|
+
|
|
10
|
+
import Checkbox from './checkbox/index.vue';
|
|
11
|
+
export { Checkbox };
|
|
12
|
+
|
|
13
|
+
import DatePicker from './datePicker/index.vue';
|
|
14
|
+
export { DatePicker };
|
|
15
|
+
|
|
16
|
+
import Input from './input/index.vue';
|
|
17
|
+
export { Input };
|
|
18
|
+
import InputIcon from './input/inputIcon.vue';
|
|
19
|
+
export { InputIcon };
|
|
20
|
+
import InputPassword from './input/inputPassword.vue';
|
|
21
|
+
export { InputPassword };
|
|
22
|
+
import InputNumber from './input/inputNumber.vue';
|
|
23
|
+
export { InputNumber };
|
|
24
|
+
|
|
25
|
+
import PropEditor from './propEditor/index.vue';
|
|
26
|
+
export { PropEditor };
|
|
27
|
+
|
|
28
|
+
import Radio from './radio/index.vue';
|
|
29
|
+
export { Radio };
|
|
30
|
+
import RadioStatus from './radio/radioStatus.vue';
|
|
31
|
+
export { RadioStatus };
|
|
32
|
+
|
|
33
|
+
import RangePicker from './rangePicker/index.vue';
|
|
34
|
+
export { RangePicker };
|
|
35
|
+
|
|
36
|
+
import Select from './select/index.vue';
|
|
37
|
+
export { Select };
|
|
38
|
+
|
|
39
|
+
import Switch from './switch/index.vue';
|
|
40
|
+
export { Switch };
|
|
41
|
+
|
|
42
|
+
import Textarea from './textarea/index.vue';
|
|
43
|
+
export { Textarea };
|
|
44
|
+
|
|
45
|
+
import Transfer from './transfer/index.vue';
|
|
46
|
+
export { Transfer };
|
|
47
|
+
import TransferTable from './transfer/transferTable.vue';
|
|
48
|
+
export { TransferTable };
|
|
49
|
+
|
|
50
|
+
import TreeSelect from './treeSelect/index.vue';
|
|
51
|
+
export { TreeSelect };
|
|
52
|
+
|
|
53
|
+
import UploadList from './upload/uploadList.vue';
|
|
54
|
+
export { UploadList };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { formValidate, useInputFactory } from '@skyfox2000/webbase';
|
|
3
|
+
import { Input } from 'ant-design-vue';
|
|
4
|
+
import { ref, watch } from 'vue';
|
|
5
|
+
|
|
6
|
+
const { editorCtrl, labelText, errInfo } = useInputFactory();
|
|
7
|
+
const onBlur = () => {
|
|
8
|
+
if (errInfo?.value.errClass && editorCtrl) {
|
|
9
|
+
/// 重新开始验证
|
|
10
|
+
formValidate(editorCtrl);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const props = defineProps<{
|
|
15
|
+
value?: any;
|
|
16
|
+
}>();
|
|
17
|
+
const emit = defineEmits(['update:value']);
|
|
18
|
+
// 内部值,拦截外部传入的 value
|
|
19
|
+
const innerValue = ref(props.value);
|
|
20
|
+
|
|
21
|
+
// 监听外部 value 的变化,更新内部值
|
|
22
|
+
watch(
|
|
23
|
+
() => props.value,
|
|
24
|
+
(newValue) => {
|
|
25
|
+
innerValue.value = newValue;
|
|
26
|
+
},
|
|
27
|
+
{ immediate: true }, // 立即同步初始值
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
watch(
|
|
31
|
+
() => innerValue.value,
|
|
32
|
+
(newValue) => {
|
|
33
|
+
if (innerValue.value === '') {
|
|
34
|
+
emit('update:value', undefined);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
emit('update:value', newValue);
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const onClear = () => {
|
|
42
|
+
if (innerValue.value === '') {
|
|
43
|
+
innerValue.value = undefined;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
<template>
|
|
48
|
+
<Input
|
|
49
|
+
:class="[
|
|
50
|
+
errInfo?.errClass,
|
|
51
|
+
errInfo?.errClass === 'error' && !$slots.addonBefore && !$slots.addonAfter
|
|
52
|
+
? '!border-red-300 shadow-[0_0_3px_0px_#ff4d4f]'
|
|
53
|
+
: '',
|
|
54
|
+
]"
|
|
55
|
+
v-model:value="innerValue"
|
|
56
|
+
autocomplete="new-password"
|
|
57
|
+
:allow-clear="true"
|
|
58
|
+
:placeholder="'请输入' + labelText"
|
|
59
|
+
@blur="onBlur"
|
|
60
|
+
@change="onClear"
|
|
61
|
+
v-bind="$attrs"
|
|
62
|
+
>
|
|
63
|
+
<template #addonBefore v-if="$slots.addonBefore">
|
|
64
|
+
<slot name="addonBefore"></slot>
|
|
65
|
+
</template>
|
|
66
|
+
<template #addonAfter v-if="$slots.addonAfter">
|
|
67
|
+
<slot name="addonAfter"></slot>
|
|
68
|
+
</template>
|
|
69
|
+
</Input>
|
|
70
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ToolIcon } from '../../common';
|
|
3
|
+
import Input from './index.vue';
|
|
4
|
+
import { ref, watch } from 'vue';
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
value?: string | null;
|
|
7
|
+
}>();
|
|
8
|
+
const emit = defineEmits(['update:value']);
|
|
9
|
+
const innerValue = ref<string | undefined>(undefined);
|
|
10
|
+
|
|
11
|
+
watch(
|
|
12
|
+
() => props.value,
|
|
13
|
+
(newValue) => {
|
|
14
|
+
innerValue.value = newValue ?? undefined;
|
|
15
|
+
},
|
|
16
|
+
{ immediate: true },
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
watch(
|
|
20
|
+
() => innerValue.value,
|
|
21
|
+
(newValue) => {
|
|
22
|
+
emit('update:value', newValue);
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
<template>
|
|
27
|
+
<Input :class="['w-[80%]']" v-model:value="innerValue" v-bind="$attrs">
|
|
28
|
+
<template #addonBefore>
|
|
29
|
+
<ToolIcon class="!w-4 !h-4" :icon="innerValue" />
|
|
30
|
+
</template>
|
|
31
|
+
</Input>
|
|
32
|
+
</template>
|
|
33
|
+
<style scoped>
|
|
34
|
+
.error :deep(.ant-input-group-addon),
|
|
35
|
+
.error :deep(.ant-input-affix-wrapper) {
|
|
36
|
+
border-color: #ff4d4f80;
|
|
37
|
+
box-shadow: 0 0 3px 0 #ff4d4f;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { formValidate, useInputFactory } from '@skyfox2000/webbase';
|
|
3
|
+
import { InputNumber } from 'ant-design-vue';
|
|
4
|
+
|
|
5
|
+
const { editorCtrl, labelText, errInfo } = useInputFactory();
|
|
6
|
+
const onBlur = () => {
|
|
7
|
+
if (errInfo?.value.errClass && editorCtrl) {
|
|
8
|
+
/// 重新开始验证
|
|
9
|
+
formValidate(editorCtrl);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
<template>
|
|
14
|
+
<InputNumber
|
|
15
|
+
:class="[errInfo?.errClass === 'error' ? 'error !border-red-300 shadow-[0_0_3px_0px_#ff4d4f]' : '']"
|
|
16
|
+
@blur="onBlur"
|
|
17
|
+
:allow-clear="false"
|
|
18
|
+
:placeholder="'请输入' + labelText"
|
|
19
|
+
class="w-[50%]"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
>
|
|
22
|
+
</InputNumber>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { formValidate, useInputFactory } from '@skyfox2000/webbase';
|
|
3
|
+
import { InputPassword } from 'ant-design-vue';
|
|
4
|
+
|
|
5
|
+
const { editorCtrl, labelText, errInfo } = useInputFactory();
|
|
6
|
+
const onBlur = () => {
|
|
7
|
+
if (errInfo?.value.errClass && editorCtrl) {
|
|
8
|
+
/// 重新开始验证
|
|
9
|
+
formValidate(editorCtrl);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
<template>
|
|
14
|
+
<InputPassword
|
|
15
|
+
:class="errInfo?.errClass === 'error' ? ['error', '!border-red-300', 'shadow-[0_0_3px_0px_#ff4d4f]'] : ''"
|
|
16
|
+
:allow-clear="true"
|
|
17
|
+
autocomplete="new-password"
|
|
18
|
+
:placeholder="'请输入' + labelText"
|
|
19
|
+
@blur="onBlur"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, watch } from 'vue';
|
|
3
|
+
import { Input, Button } from 'ant-design-vue';
|
|
4
|
+
|
|
5
|
+
interface ConfigItem {
|
|
6
|
+
id: number;
|
|
7
|
+
field: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
value: Record<string, string>;
|
|
13
|
+
labelHolder?: string;
|
|
14
|
+
valueHolder: string;
|
|
15
|
+
}>();
|
|
16
|
+
const emit = defineEmits(['update:value']);
|
|
17
|
+
|
|
18
|
+
const configList = ref<ConfigItem[]>([]);
|
|
19
|
+
let isInnerChange = false; // 标记是否为内部输入变更
|
|
20
|
+
|
|
21
|
+
const initConfigList = () => {
|
|
22
|
+
configList.value = Object.entries(props.value).map(([field, value]) => ({
|
|
23
|
+
id: Date.now() + Math.random(),
|
|
24
|
+
field,
|
|
25
|
+
value,
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
watch(() => props.value, () => {
|
|
30
|
+
if (!isInnerChange) {
|
|
31
|
+
initConfigList();
|
|
32
|
+
}
|
|
33
|
+
isInnerChange = false;
|
|
34
|
+
}, { immediate: true });
|
|
35
|
+
|
|
36
|
+
const updateConfig = () => {
|
|
37
|
+
const newConfig = configList.value.reduce((acc: Record<string, string>, item: ConfigItem) => {
|
|
38
|
+
if (item.field) {
|
|
39
|
+
acc[item.field] = item.value;
|
|
40
|
+
}
|
|
41
|
+
return acc;
|
|
42
|
+
}, {} as Record<string, string>);
|
|
43
|
+
isInnerChange = true;
|
|
44
|
+
emit('update:value', newConfig);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const addNewLine = () => {
|
|
48
|
+
configList.value.push({
|
|
49
|
+
id: Date.now() + Math.random(),
|
|
50
|
+
field: '',
|
|
51
|
+
value: '',
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleInputChange = () => {
|
|
56
|
+
updateConfig();
|
|
57
|
+
};
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div class="flex flex-col gap-2">
|
|
62
|
+
<div v-for="item in configList" :key="item.id" class="flex items-center gap-2">
|
|
63
|
+
<div class="w-[33%]">
|
|
64
|
+
<Input v-model:value="item.field" :title="item.field" class="w-full" :placeholder="labelHolder || '配置名'"
|
|
65
|
+
@input="handleInputChange" />
|
|
66
|
+
</div>
|
|
67
|
+
<div class="w-[3%]">
|
|
68
|
+
=
|
|
69
|
+
</div>
|
|
70
|
+
<div class="w-[64%]">
|
|
71
|
+
<Input v-model:value="item.value" :placeholder="valueHolder" @input="handleInputChange"
|
|
72
|
+
:title="item.value" />
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<Button @click="addNewLine"
|
|
76
|
+
class="mt-1 w-[80px] !text-[12px] text-[#666] bg-[#e6f7ff] border-[#b3e0ff] hover:bg-[#b3e0ff] hover:border-[#8abeff]"
|
|
77
|
+
size="small">
|
|
78
|
+
新增配置行
|
|
79
|
+
</Button>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, onMounted, onUnmounted, watch, useAttrs } from 'vue';
|
|
3
|
+
import { Radio, RadioChangeEvent, RadioGroup } from 'ant-design-vue';
|
|
4
|
+
import {
|
|
5
|
+
OptionCommProps,
|
|
6
|
+
loadOption,
|
|
7
|
+
onOptionChanged,
|
|
8
|
+
OptionItemProps,
|
|
9
|
+
unloadOption,
|
|
10
|
+
useInputFactory,
|
|
11
|
+
getSelectedLabels,
|
|
12
|
+
SelectValue,
|
|
13
|
+
} from '@skyfox2000/webbase';
|
|
14
|
+
import { IUrlInfo } from '@skyfox2000/fapi';
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
...OptionCommProps,
|
|
18
|
+
value: {
|
|
19
|
+
type: [String, Number, null, Array],
|
|
20
|
+
default: undefined,
|
|
21
|
+
},
|
|
22
|
+
nodata: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: '无数据',
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* 换行数量
|
|
28
|
+
*/
|
|
29
|
+
wrap: {
|
|
30
|
+
type: Number,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// 关闭自动继承属性到根元素
|
|
35
|
+
defineOptions({
|
|
36
|
+
inheritAttrs: false,
|
|
37
|
+
});
|
|
38
|
+
const attrs = useAttrs(); // 手动获取 $attrs
|
|
39
|
+
|
|
40
|
+
const url = ref<IUrlInfo>({
|
|
41
|
+
...props.url,
|
|
42
|
+
url: props.url?.url || '',
|
|
43
|
+
fieldMap: props.fieldMap || props.url?.fieldMap,
|
|
44
|
+
params: props.params || props.url?.params,
|
|
45
|
+
loadingText: false,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const innerValue = ref(props.value);
|
|
49
|
+
|
|
50
|
+
const inputFactory = useInputFactory();
|
|
51
|
+
const { errInfo } = inputFactory;
|
|
52
|
+
const radioOptions = ref<OptionItemProps[]>([]);
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits(['change', 'update:value', 'update:labels']);
|
|
55
|
+
inputFactory.inputEmit = emit;
|
|
56
|
+
|
|
57
|
+
watch(
|
|
58
|
+
() => innerValue.value,
|
|
59
|
+
(val) => {
|
|
60
|
+
emit('update:value', val);
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
// 检查两个值是否相等,支持数组比较
|
|
65
|
+
const isValueEqual = (val1: any, val2: any) => {
|
|
66
|
+
if (typeof val1 === 'object' && typeof val2 === 'object') {
|
|
67
|
+
const val = JSON.stringify(val1) === JSON.stringify(val2);
|
|
68
|
+
if (val) innerValue.value = val1;
|
|
69
|
+
return val;
|
|
70
|
+
}
|
|
71
|
+
return val1 === val2;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onChanged = (e: RadioChangeEvent) => {
|
|
75
|
+
const checkedValue = e.target.value;
|
|
76
|
+
const selectedOptions = onOptionChanged(props, checkedValue as SelectValue, radioOptions, inputFactory);
|
|
77
|
+
const labels: string[] = getSelectedLabels(selectedOptions);
|
|
78
|
+
emit('update:labels', labels);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
if (url.value && !url.value.fieldMap) {
|
|
83
|
+
url.value.fieldMap = {
|
|
84
|
+
label: 'Name',
|
|
85
|
+
value: 'Id',
|
|
86
|
+
key: 'Id',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
loadOption(props.autoload, props, radioOptions, inputFactory, url.value, url.value?.params);
|
|
90
|
+
});
|
|
91
|
+
onUnmounted(() => {
|
|
92
|
+
unloadOption(props, inputFactory);
|
|
93
|
+
});
|
|
94
|
+
</script>
|
|
95
|
+
<template>
|
|
96
|
+
<div class="min-h-[32px] pt-1">
|
|
97
|
+
<RadioGroup
|
|
98
|
+
v-model:value="innerValue"
|
|
99
|
+
:autocheck="false"
|
|
100
|
+
@change="onChanged"
|
|
101
|
+
class="w-full flex align-items flex-wrap mb-[-3px]"
|
|
102
|
+
v-bind="attrs"
|
|
103
|
+
>
|
|
104
|
+
<template v-if="radioOptions.length > 0">
|
|
105
|
+
<template v-for="item in radioOptions" :key="item.value">
|
|
106
|
+
<Radio
|
|
107
|
+
:checked="isValueEqual(item.value, props.value)"
|
|
108
|
+
v-if="item.visible !== false"
|
|
109
|
+
:value="item.value"
|
|
110
|
+
:class="[
|
|
111
|
+
errInfo?.errClass === 'error' ? 'error !text-red-400' : '',
|
|
112
|
+
'text-nowrap',
|
|
113
|
+
'pb-1',
|
|
114
|
+
wrap ? `w-1/${props.wrap}` : '',
|
|
115
|
+
]"
|
|
116
|
+
>
|
|
117
|
+
{{ item.label }}
|
|
118
|
+
</Radio>
|
|
119
|
+
</template>
|
|
120
|
+
</template>
|
|
121
|
+
<template v-else-if="nodata">
|
|
122
|
+
<div class="text-center text-gray-500">{{ nodata }}</div>
|
|
123
|
+
</template>
|
|
124
|
+
</RadioGroup>
|
|
125
|
+
</div>
|
|
126
|
+
</template>
|
|
127
|
+
<style scoped>
|
|
128
|
+
.error :deep(input + span) {
|
|
129
|
+
border-color: #ff7171;
|
|
130
|
+
box-shadow: 0 0 3px 0 #ff4d4f;
|
|
131
|
+
}
|
|
132
|
+
</style>
|