@skyfox2000/webui 1.3.8 → 1.3.10
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/lib/assets/modules/{file-upload-D7ysapQL.js → file-upload-CwyUkWwi.js} +1 -1
- package/lib/assets/modules/{index-_foSmXoy.js → index-BRWQ6SRp.js} +1 -1
- package/lib/assets/modules/{index-BiXvleeT.js → index-B_XPl41L.js} +2 -2
- package/lib/assets/modules/{index-tow3C94d.js → index-DHWlaZL2.js} +2 -2
- package/lib/assets/modules/{menuTabs-CmB2d0Wh.js → menuTabs-NoNLt_B5.js} +2 -2
- package/lib/assets/modules/{toolIcon-IR6jQE0h.js → toolIcon-BSjgzw0G.js} +1 -1
- package/lib/assets/modules/{uploadList-BNx4hnQX.js → uploadList-1Zmhwr0q.js} +4 -4
- package/lib/assets/modules/{uploadList-DoiSzbHZ.js → uploadList-B4wb8I9a.js} +285 -281
- package/lib/es/AceEditor/index.js +3 -3
- package/lib/es/BasicLayout/index.js +3 -3
- package/lib/es/Error403/index.js +1 -1
- package/lib/es/Error404/index.js +1 -1
- package/lib/es/ExcelForm/index.js +5 -5
- package/lib/es/UploadForm/index.js +4 -4
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +307 -298
- package/package.json +1 -1
- package/src/components/common/icon/helper.vue +3 -7
- package/src/components/content/form/formItem.vue +9 -19
- package/src/components/form/select/index.vue +1 -2
- package/src/components/form/treeSelect/index.vue +16 -5
- package/src/utils/page.ts +15 -9
package/package.json
CHANGED
|
@@ -19,18 +19,14 @@ const attrs = useAttrs(); // 手动获取 $attrs
|
|
|
19
19
|
<Popover placement="topRight">
|
|
20
20
|
<template #content>
|
|
21
21
|
<slot>
|
|
22
|
-
<div class="text-[14px]" :
|
|
22
|
+
<div class="text-[14px]" :class="[maxWidth]">
|
|
23
23
|
{{ text }}
|
|
24
24
|
</div>
|
|
25
25
|
</slot>
|
|
26
26
|
</template>
|
|
27
27
|
<span class="ml-2">
|
|
28
|
-
<ToolIcon
|
|
29
|
-
|
|
30
|
-
class="text-[#888]"
|
|
31
|
-
:class="[size ? 'w-' + size + ' h-' + size : 'w-5 h-5']"
|
|
32
|
-
v-bind="attrs"
|
|
33
|
-
/>
|
|
28
|
+
<ToolIcon icon="icon-question-circle" class="text-[#888]"
|
|
29
|
+
:class="[size ? 'w-' + size + ' h-' + size : 'w-5 h-5']" v-bind="attrs" />
|
|
34
30
|
</span>
|
|
35
31
|
</Popover>
|
|
36
32
|
</template>
|
|
@@ -60,6 +60,7 @@ const getRule = (rule: Array<string>, ruleObj: Record<string, any> | undefined):
|
|
|
60
60
|
if (rule.length === 1) {
|
|
61
61
|
return ruleObj[key];
|
|
62
62
|
}
|
|
63
|
+
if (!ruleObj[key]) return undefined;
|
|
63
64
|
return getRule(rest, ruleObj[key].fields as Record<string, any>);
|
|
64
65
|
};
|
|
65
66
|
/**
|
|
@@ -92,18 +93,13 @@ const required = computed(() => {
|
|
|
92
93
|
</script>
|
|
93
94
|
<template>
|
|
94
95
|
<div :class="['relative', bottomMargin ? bottomMargin : 'mb-1']">
|
|
95
|
-
<FormItem
|
|
96
|
-
v-
|
|
97
|
-
:required="required"
|
|
98
|
-
class="relative"
|
|
99
|
-
:class="[nextLine ? 'mb-0' : rule ? '' : 'mb-3']"
|
|
100
|
-
v-bind="attrs"
|
|
101
|
-
>
|
|
96
|
+
<FormItem v-if="visible" :required="required" class="relative" :class="[nextLine ? 'mb-0' : rule ? '' : 'mb-3']"
|
|
97
|
+
v-bind="attrs">
|
|
102
98
|
<template #label>
|
|
103
99
|
<span :class="[errInfo.errClass ? 'text-[#ff4d4f]' : '', 'w-full']"> {{ label }}</span>
|
|
104
100
|
</template>
|
|
105
|
-
<div class="flex items-center" :class="width ? width : 'w-full'"
|
|
106
|
-
<div class="flex-grow">
|
|
101
|
+
<div class="flex items-center" :class="width ? width : 'w-full'">
|
|
102
|
+
<div class="flex-grow" v-if="!nextLine">
|
|
107
103
|
<slot></slot>
|
|
108
104
|
</div>
|
|
109
105
|
<div class="w-8 mt-[-2px]">
|
|
@@ -113,18 +109,12 @@ const required = computed(() => {
|
|
|
113
109
|
</div>
|
|
114
110
|
</div>
|
|
115
111
|
</FormItem>
|
|
116
|
-
<div
|
|
117
|
-
|
|
118
|
-
class="w-[95%] flex items-center relative"
|
|
119
|
-
:class="[nextLine ? (rule ? 'mb-7' : 'mb-3') : '']"
|
|
120
|
-
>
|
|
112
|
+
<div v-if="nextLine" class="w-[95%] flex items-center relative"
|
|
113
|
+
:class="[nextLine ? (rule ? 'mb-7' : 'mb-3') : '']">
|
|
121
114
|
<slot></slot>
|
|
122
115
|
</div>
|
|
123
|
-
<span
|
|
124
|
-
|
|
125
|
-
class="absolute bottom-[3px] text-[12px] text-[#ff4d4fcc]"
|
|
126
|
-
v-if="errInfo.errClass"
|
|
127
|
-
>
|
|
116
|
+
<span :style="{ left: nextLine ? '2px' : labelWidth }" class="absolute bottom-[3px] text-[12px] text-[#ff4d4fcc]"
|
|
117
|
+
v-if="errInfo.errClass">
|
|
128
118
|
{{ errInfo.msg }}
|
|
129
119
|
</span>
|
|
130
120
|
</div>
|
|
@@ -66,8 +66,7 @@ const defaultVal = ref(props.value);
|
|
|
66
66
|
const placeholder = ref(attrs.placeholder);
|
|
67
67
|
|
|
68
68
|
/// 避免类型错误
|
|
69
|
-
|
|
70
|
-
const innerValue = ref<string | number | string[] | number[] | undefined>(undefined);
|
|
69
|
+
const innerValue = ref<string | number | string[] | number[] | undefined>(optionCtrl?.selected.value || undefined);
|
|
71
70
|
const emit = defineEmits(['change', 'update:value', 'update:label', 'update:labels']);
|
|
72
71
|
inputFactory.inputEmit = emit;
|
|
73
72
|
|
|
@@ -30,7 +30,7 @@ const props = defineProps({
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
// 如果初始value为undefined,自动设置undefValue为true
|
|
33
|
-
const
|
|
33
|
+
const undefVal = props.value === undefined ? true : props.undefValue;
|
|
34
34
|
|
|
35
35
|
const treeCtrl = props.treeCtrl;
|
|
36
36
|
|
|
@@ -54,6 +54,12 @@ watch(
|
|
|
54
54
|
},
|
|
55
55
|
{ immediate: true },
|
|
56
56
|
);
|
|
57
|
+
watch(
|
|
58
|
+
() => currentValue.value,
|
|
59
|
+
(newVal) => {
|
|
60
|
+
emit('update:value', newVal);
|
|
61
|
+
},
|
|
62
|
+
);
|
|
57
63
|
|
|
58
64
|
// 监听树数据变化
|
|
59
65
|
watch(
|
|
@@ -71,10 +77,14 @@ const handleChange = (value: SelectValue) => {
|
|
|
71
77
|
if (props.multiple) {
|
|
72
78
|
currentValue.value = value ?? [];
|
|
73
79
|
} else {
|
|
74
|
-
|
|
80
|
+
// 修复原始代码中的逻辑错误
|
|
81
|
+
if (value === undefined || value === null) {
|
|
82
|
+
currentValue.value = undefVal ? undefined : null;
|
|
83
|
+
} else {
|
|
84
|
+
currentValue.value = value;
|
|
85
|
+
}
|
|
75
86
|
}
|
|
76
87
|
emit('change', currentValue.value);
|
|
77
|
-
emit('update:value', currentValue.value);
|
|
78
88
|
};
|
|
79
89
|
|
|
80
90
|
// 组件挂载时加载数据
|
|
@@ -94,8 +104,9 @@ onMounted(() => {
|
|
|
94
104
|
queryTree(props.treeCtrl);
|
|
95
105
|
}
|
|
96
106
|
});
|
|
107
|
+
|
|
97
108
|
const onClear = () => {
|
|
98
|
-
currentValue.value =
|
|
109
|
+
currentValue.value = undefVal ? undefined : null;
|
|
99
110
|
};
|
|
100
111
|
</script>
|
|
101
112
|
|
|
@@ -109,4 +120,4 @@ const onClear = () => {
|
|
|
109
120
|
border-color: #ef444480;
|
|
110
121
|
box-shadow: 0 0 3px 0 #ff4d4f;
|
|
111
122
|
}
|
|
112
|
-
</style>
|
|
123
|
+
</style>
|
package/src/utils/page.ts
CHANGED
|
@@ -85,6 +85,17 @@ export const initPageFactory = (options: {
|
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
const initUrls = (apiUrls: ApiUrls) => {
|
|
89
|
+
for (let urlKey in apiUrls.urls) {
|
|
90
|
+
if (!apiUrls.urls[urlKey]!.api) {
|
|
91
|
+
apiUrls.urls[urlKey]!.api = apiUrls.api;
|
|
92
|
+
}
|
|
93
|
+
if (!apiUrls.urls[urlKey]!.authorize) {
|
|
94
|
+
apiUrls.urls[urlKey]!.authorize = apiUrls.authorize;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
88
99
|
/**
|
|
89
100
|
* 编辑器工厂处理
|
|
90
101
|
*
|
|
@@ -100,6 +111,7 @@ export const useEditorFactory = <T, E>(
|
|
|
100
111
|
defaultData?: Partial<E>,
|
|
101
112
|
formRules?: Record<string, ValidateRule>,
|
|
102
113
|
) => {
|
|
114
|
+
initUrls(urls);
|
|
103
115
|
/**
|
|
104
116
|
* 表单数据交互控制
|
|
105
117
|
*/
|
|
@@ -133,6 +145,7 @@ export const useEditorFactory = <T, E>(
|
|
|
133
145
|
* @returns
|
|
134
146
|
*/
|
|
135
147
|
export const useGridFactory = <T, G>(urls: ApiUrls, pageCtrl: PageControl<T>, columns?: Record<string, any>[]) => {
|
|
148
|
+
initUrls(urls);
|
|
136
149
|
/**
|
|
137
150
|
* 表格数据交互控制
|
|
138
151
|
*/
|
|
@@ -194,6 +207,7 @@ export const useGridFactory = <T, G>(urls: ApiUrls, pageCtrl: PageControl<T>, co
|
|
|
194
207
|
* @returns
|
|
195
208
|
*/
|
|
196
209
|
export const useTreeFactory = <T>(urls: ApiUrls, pageCtrl: PageControl<T>) => {
|
|
210
|
+
initUrls(urls);
|
|
197
211
|
/**
|
|
198
212
|
* 树数据交互控制
|
|
199
213
|
*/
|
|
@@ -306,15 +320,7 @@ export const usePageFactory = <T>(
|
|
|
306
320
|
defaultData?: Partial<T>,
|
|
307
321
|
formRules?: Record<string, ValidateRule>,
|
|
308
322
|
) => {
|
|
309
|
-
|
|
310
|
-
// api 默认
|
|
311
|
-
// authorize 默认
|
|
312
|
-
for (const key in urls.urls) {
|
|
313
|
-
if (urls.urls[key]) {
|
|
314
|
-
if (!urls.urls[key].api) urls.urls[key].api = urls.api;
|
|
315
|
-
if (urls.urls[key].authorize === undefined) urls.urls[key].authorize = urls.authorize;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
323
|
+
initUrls(urls);
|
|
318
324
|
|
|
319
325
|
/**
|
|
320
326
|
* 页面交互主数据
|