@dhccmobile/vue3-lo-form 2.0.1 → 2.0.3
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/README.md +9 -2
- package/dist/demo.html +1 -10
- package/dist/vue3-lo-form.common.js +8578 -6930
- package/dist/vue3-lo-form.common.js.map +1 -1
- package/dist/vue3-lo-form.css +1 -1
- package/dist/vue3-lo-form.umd.js +8586 -6937
- package/dist/vue3-lo-form.umd.js.map +1 -1
- package/dist/vue3-lo-form.umd.min.js +1 -1
- package/dist/vue3-lo-form.umd.min.js.map +1 -1
- package/package.json +9 -10
- package/src/App.vue +1 -1
- package/src/components/form/DvFormLayout.vue +37 -0
- package/src/main.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhccmobile/vue3-lo-form",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "VUE3动态表单",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/vue3-lo-form.umd.js",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"clean:lib": "rimraf types && rimraf dist",
|
|
15
15
|
"build:lib": "npm run clean:lib && npm run tsc && npm run lib && npm pack",
|
|
16
16
|
"publish": "npm publish --registry https://registry.npmjs.org --access public",
|
|
17
|
-
"publish:lib": "npm run build:lib && npm run publish"
|
|
18
|
-
"publish:lib1": "npm run publish"
|
|
17
|
+
"publish:lib": "npm run build:lib && npm run publish"
|
|
19
18
|
},
|
|
20
19
|
"dependencies": {
|
|
21
20
|
"@ant-design/icons-vue": "^6.1.0",
|
|
@@ -43,18 +42,18 @@
|
|
|
43
42
|
"@types/moment": "^2.13.0",
|
|
44
43
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
45
44
|
"@typescript-eslint/parser": "^5.4.0",
|
|
46
|
-
"@vue/cli-plugin-babel": "~
|
|
47
|
-
"@vue/cli-plugin-eslint": "~
|
|
48
|
-
"@vue/cli-plugin-router": "~
|
|
49
|
-
"@vue/cli-plugin-typescript": "~
|
|
50
|
-
"@vue/cli-plugin-vuex": "~
|
|
51
|
-
"@vue/cli-service": "~
|
|
45
|
+
"@vue/cli-plugin-babel": "~5.0.0",
|
|
46
|
+
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
47
|
+
"@vue/cli-plugin-router": "~5.0.0",
|
|
48
|
+
"@vue/cli-plugin-typescript": "~5.0.0",
|
|
49
|
+
"@vue/cli-plugin-vuex": "~5.0.0",
|
|
50
|
+
"@vue/cli-service": "~5.0.0",
|
|
52
51
|
"@vue/compiler-sfc": "3.4.35",
|
|
53
52
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
54
53
|
"@vue/eslint-config-typescript": "^9.1.0",
|
|
55
54
|
"eslint": "^7.1.0",
|
|
56
55
|
"eslint-plugin-prettier": "^3.3.1",
|
|
57
|
-
"eslint-plugin-vue": "^
|
|
56
|
+
"eslint-plugin-vue": "^8.0.1",
|
|
58
57
|
"less": "^4.2.0",
|
|
59
58
|
"less-loader": "^11.0.0",
|
|
60
59
|
"prettier": "^2.2.1",
|
package/src/App.vue
CHANGED
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
</div>
|
|
103
103
|
<div class="lo-input">
|
|
104
104
|
<!--styleMode="credit-rd" :formId="'773549593606574080'"-->
|
|
105
|
-
<dy-form v-if="showForm" :formId="'
|
|
105
|
+
<dy-form v-if="showForm" :formId="'984034993956851712'" v-model:edit="formApi.edit" v-model:formApi="formApi" @change="onChange($event)" @click="onClick($event)" @focus="onFocus($event)" @blur="onBlur($event)" @addon-before="onAddonBeforeHandler($event)" @addon-after="onAddonAfterHandler($event)" @add-item="selectAddItem($event)">
|
|
106
106
|
<template #combinationSelector="{ control, onChange }">
|
|
107
107
|
<div class="lo-custom-control-box">
|
|
108
108
|
<a-input v-model:value="control.formControl.value" @input="onChange(control.formControl)" v-if="control && control.formControl" />
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
['form-model-item-' + controlAttr.boundProperty]: true,
|
|
18
18
|
['form-model-item-' + control.code]: true,
|
|
19
19
|
'lo-form-model-item-textarea-box': control.code === formFieldType.Textarea.code,
|
|
20
|
+
'lo-form-item-mobile': isMobileBrowser(),
|
|
20
21
|
}"
|
|
21
22
|
>
|
|
22
23
|
<template v-slot:label>
|
|
@@ -726,6 +727,9 @@ export default class DvFormLayout extends Vue {
|
|
|
726
727
|
get labelSpanWidth(): any {
|
|
727
728
|
const controlAttr: DesFormControl = this.controlAttr as DesFormControl;
|
|
728
729
|
const parentControlAttr: DesFormLayout = this.parentControlAttr as DesFormLayout;
|
|
730
|
+
if (this.isMobileBrowser()) {
|
|
731
|
+
return "120px";
|
|
732
|
+
}
|
|
729
733
|
if (controlAttr.titleWidth) {
|
|
730
734
|
return controlAttr.titleWidth;
|
|
731
735
|
} else if (parentControlAttr.labelSpan) {
|
|
@@ -1198,6 +1202,9 @@ export default class DvFormLayout extends Vue {
|
|
|
1198
1202
|
*/
|
|
1199
1203
|
get emptyLayoutContainerStyle(): any {
|
|
1200
1204
|
let style: any = {};
|
|
1205
|
+
if (this.isMobileBrowser()) {
|
|
1206
|
+
return { display: "flex", "flex-direction": "column" };
|
|
1207
|
+
}
|
|
1201
1208
|
if (this.isIe) {
|
|
1202
1209
|
style = { display: "flex", "flex-wrap": "wrap" };
|
|
1203
1210
|
} else {
|
|
@@ -1214,6 +1221,9 @@ export default class DvFormLayout extends Vue {
|
|
|
1214
1221
|
*/
|
|
1215
1222
|
get generalLayoutContainerStyle(): any {
|
|
1216
1223
|
let style: any = {};
|
|
1224
|
+
if (this.isMobileBrowser()) {
|
|
1225
|
+
return { display: "flex", "flex-direction": "column" };
|
|
1226
|
+
}
|
|
1217
1227
|
if (this.isIe) {
|
|
1218
1228
|
style = { display: "flex", "flex-wrap": "wrap" };
|
|
1219
1229
|
} else {
|
|
@@ -1226,6 +1236,23 @@ export default class DvFormLayout extends Vue {
|
|
|
1226
1236
|
}
|
|
1227
1237
|
return style;
|
|
1228
1238
|
}
|
|
1239
|
+
/**
|
|
1240
|
+
* 判断是否为移动端浏览器
|
|
1241
|
+
* @returns {boolean} true=移动端,false=PC端
|
|
1242
|
+
*/
|
|
1243
|
+
isMobileBrowser() {
|
|
1244
|
+
// 匹配常见移动端设备的User-Agent关键词
|
|
1245
|
+
const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i;
|
|
1246
|
+
// 排除平板设备(可选,根据业务需求调整)
|
|
1247
|
+
const tabletRegex = /iPad|Tablet|Nexus 7|Nexus 10/i;
|
|
1248
|
+
|
|
1249
|
+
const userAgent = navigator.userAgent;
|
|
1250
|
+
const isMobile = mobileRegex.test(userAgent);
|
|
1251
|
+
const isTablet = tabletRegex.test(userAgent);
|
|
1252
|
+
|
|
1253
|
+
// 业务逻辑:如果是平板,可根据需求返回true或false
|
|
1254
|
+
return isMobile && !isTablet;
|
|
1255
|
+
}
|
|
1229
1256
|
|
|
1230
1257
|
/**
|
|
1231
1258
|
* @description: 初始化部分数据
|
|
@@ -1566,4 +1593,14 @@ export default class DvFormLayout extends Vue {
|
|
|
1566
1593
|
</script>
|
|
1567
1594
|
<style lang="scss" scoped>
|
|
1568
1595
|
@import "../../styles/themes.scss";
|
|
1596
|
+
|
|
1597
|
+
.lo-form-item-mobile {
|
|
1598
|
+
display: flex;
|
|
1599
|
+
:deep(.ant-form-item-label) {
|
|
1600
|
+
flex: 1 !important;
|
|
1601
|
+
}
|
|
1602
|
+
:deep(.ant-form-item-control) {
|
|
1603
|
+
flex: 3 !important;
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1569
1606
|
</style>
|
package/src/main.ts
CHANGED
|
@@ -9,8 +9,8 @@ const app = createApp(App);
|
|
|
9
9
|
app.config.performance = true;
|
|
10
10
|
app
|
|
11
11
|
.use(VueLoForm, {
|
|
12
|
-
url: "http://
|
|
13
|
-
appId: "
|
|
12
|
+
url: "http://82.156.213.34:8080",
|
|
13
|
+
appId: "1009549397931601920",
|
|
14
14
|
onlySimpleLoadConfig: false,
|
|
15
15
|
loadMode: "dynamic",
|
|
16
16
|
})
|