@94ai/nf-form-item 3.1.13
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.cjs +49 -0
- package/README.md +16 -0
- package/components.d.ts +8 -0
- package/lib/index.d.ts +86 -0
- package/lib/nf-form-item.cjs.js +247 -0
- package/lib/nf-form-item.esm-bundler.js +247 -0
- package/lib/nf-form-item.vue.d.ts +37 -0
- package/lib/style/css.d.ts +1 -0
- package/lib/style/css.js +1 -0
- package/lib/style/index.d.ts +1 -0
- package/lib/style/index.js +1 -0
- package/package/index.ts +8 -0
- package/package/nf-form-item.vue +223 -0
- package/package/style/css.ts +1 -0
- package/package/style/index.ts +1 -0
- package/package.json +34 -0
- package/postcss.config.js +8 -0
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"root": true,
|
|
3
|
+
"env": {
|
|
4
|
+
"node": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"plugin:vue/essential"
|
|
8
|
+
],
|
|
9
|
+
"parser": "vue-eslint-parser",
|
|
10
|
+
"parserOptions": {
|
|
11
|
+
"parser": "@typescript-eslint/parser",
|
|
12
|
+
"ecmaVersion": 2020,
|
|
13
|
+
"sourceType": "module"
|
|
14
|
+
},
|
|
15
|
+
"rules": {
|
|
16
|
+
"@typescript-eslint/ban-ts-ignore": "off",
|
|
17
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
18
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
19
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
20
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
21
|
+
"vue/custom-event-name-casing": "off",
|
|
22
|
+
"no-use-before-define": "off",
|
|
23
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
24
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
25
|
+
"@typescript-eslint/ban-types": "off",
|
|
26
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
27
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
28
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
29
|
+
"vue/multi-word-component-names": [
|
|
30
|
+
"error",
|
|
31
|
+
{
|
|
32
|
+
"ignores": [
|
|
33
|
+
"index"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"no-console": "warn",
|
|
38
|
+
"no-debugger": "warn",
|
|
39
|
+
"prettier/prettier": [
|
|
40
|
+
"error",
|
|
41
|
+
{
|
|
42
|
+
"tabWidth": 2,
|
|
43
|
+
"singleQuote": true,
|
|
44
|
+
"semi": false,
|
|
45
|
+
"endOfLine": "auto"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# `@94ai/nf-form-item`
|
|
2
|
+
|
|
3
|
+
表单项折叠器
|
|
4
|
+
|
|
5
|
+
## HomePage
|
|
6
|
+
|
|
7
|
+
官网地址: https://oss.xccjh.top/common-ui/#/ai-index
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
import NfFormItem from '@94ai/nf-form-item' // or const NfFormItem = require('@94ai/nf-form-item');
|
|
14
|
+
|
|
15
|
+
Vue.use(NfFormItem)
|
|
16
|
+
```
|
package/components.d.ts
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { PluginObject } from 'vue-demi';
|
|
2
|
+
declare const _default: import("vue/types/v3-component-public-instance").ComponentPublicInstanceConstructor<import("vue/types/v3-component-public-instance").Vue3Instance<{
|
|
3
|
+
isExpand: boolean;
|
|
4
|
+
initExpand: boolean;
|
|
5
|
+
}, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
6
|
+
hidden: {
|
|
7
|
+
type: BooleanConstructor;
|
|
8
|
+
default: boolean;
|
|
9
|
+
};
|
|
10
|
+
}>>, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
11
|
+
hidden: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
}>>, {}, {
|
|
16
|
+
hidden: boolean;
|
|
17
|
+
}, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
18
|
+
hidden: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
}>>> & import("vue-demi").ShallowUnwrapRef<{}> & {
|
|
23
|
+
isExpand: boolean;
|
|
24
|
+
initExpand: boolean;
|
|
25
|
+
} & import("vue/types/v3-component-options").ExtractComputedReturns<import("vue-demi").ComponentComputedOptions & {
|
|
26
|
+
expandBtnTooltipDesc(): any;
|
|
27
|
+
shrinkBtnTooltipDesc(): any;
|
|
28
|
+
downIcon(): any;
|
|
29
|
+
upIcon(): any;
|
|
30
|
+
isCollapse(): any;
|
|
31
|
+
labelPosition(): any;
|
|
32
|
+
inline(): any;
|
|
33
|
+
columns(): any;
|
|
34
|
+
expandBtnType(): any;
|
|
35
|
+
expandBtnIcon(): any;
|
|
36
|
+
expandBtnPlain(): any;
|
|
37
|
+
expandBtnSize(): any;
|
|
38
|
+
expandBtnRound(): any;
|
|
39
|
+
expandBtnCircle(): any;
|
|
40
|
+
expandBtnLoading(): any;
|
|
41
|
+
expandBtnDisabled(): any;
|
|
42
|
+
showBtn(): boolean;
|
|
43
|
+
isLastItem(): boolean;
|
|
44
|
+
}> & import("vue-demi").ComponentMethodOptions & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
|
|
45
|
+
hidden: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
default: boolean;
|
|
48
|
+
};
|
|
49
|
+
}>>, any, any, any, import("vue-demi").ComponentComputedOptions, import("vue-demi").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
50
|
+
hidden: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: boolean;
|
|
53
|
+
};
|
|
54
|
+
}>>, {}, {
|
|
55
|
+
isExpand: boolean;
|
|
56
|
+
initExpand: boolean;
|
|
57
|
+
}, {
|
|
58
|
+
expandBtnTooltipDesc(): any;
|
|
59
|
+
shrinkBtnTooltipDesc(): any;
|
|
60
|
+
downIcon(): any;
|
|
61
|
+
upIcon(): any;
|
|
62
|
+
isCollapse(): any;
|
|
63
|
+
labelPosition(): any;
|
|
64
|
+
inline(): any;
|
|
65
|
+
columns(): any;
|
|
66
|
+
expandBtnType(): any;
|
|
67
|
+
expandBtnIcon(): any;
|
|
68
|
+
expandBtnPlain(): any;
|
|
69
|
+
expandBtnSize(): any;
|
|
70
|
+
expandBtnRound(): any;
|
|
71
|
+
expandBtnCircle(): any;
|
|
72
|
+
expandBtnLoading(): any;
|
|
73
|
+
expandBtnDisabled(): any;
|
|
74
|
+
showBtn(): boolean;
|
|
75
|
+
isLastItem(): boolean;
|
|
76
|
+
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, typeof import("element-ui").FormItem, {}, string, {
|
|
77
|
+
hidden: boolean;
|
|
78
|
+
}> & {
|
|
79
|
+
props: {
|
|
80
|
+
hidden: {
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
} & PluginObject<undefined>;
|
|
86
|
+
export default _default;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vueDemi = require("vue-demi");
|
|
4
|
+
const elementUi = require("element-ui");
|
|
5
|
+
const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
|
|
6
|
+
const _sfc_main = vueDemi.defineComponent({
|
|
7
|
+
name: "NfFormItem",
|
|
8
|
+
extends: elementUi.FormItem,
|
|
9
|
+
props: {
|
|
10
|
+
hidden: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
data() {
|
|
16
|
+
return {
|
|
17
|
+
isExpand: true,
|
|
18
|
+
initExpand: false
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
watch: {
|
|
22
|
+
labelPosition() {
|
|
23
|
+
this.refreshButtonList();
|
|
24
|
+
},
|
|
25
|
+
columns() {
|
|
26
|
+
this.refreshButtonList();
|
|
27
|
+
},
|
|
28
|
+
inline() {
|
|
29
|
+
this.refreshButtonList();
|
|
30
|
+
},
|
|
31
|
+
isCollapse() {
|
|
32
|
+
var _a;
|
|
33
|
+
this.isExpand = !((_a = this.form) == null ? void 0 : _a.isCollapse);
|
|
34
|
+
if (this.initExpand) {
|
|
35
|
+
this.switchMode();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
mounted() {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
if ((_a = this.form) == null ? void 0 : _a.init) {
|
|
42
|
+
(_b = this.form) == null ? void 0 : _b.getFormItems();
|
|
43
|
+
}
|
|
44
|
+
vueDemi.nextTick(() => {
|
|
45
|
+
var _a2;
|
|
46
|
+
if (!this.initExpand) {
|
|
47
|
+
this.isExpand = !((_a2 = this.form) == null ? void 0 : _a2.isCollapse);
|
|
48
|
+
if (!this.isExpand) {
|
|
49
|
+
this.refreshButtonList();
|
|
50
|
+
}
|
|
51
|
+
this.initExpand = true;
|
|
52
|
+
} else {
|
|
53
|
+
this.refreshButtonList();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
computed: {
|
|
58
|
+
expandBtnTooltipDesc() {
|
|
59
|
+
var _a;
|
|
60
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnTooltipDesc;
|
|
61
|
+
},
|
|
62
|
+
shrinkBtnTooltipDesc() {
|
|
63
|
+
var _a;
|
|
64
|
+
return (_a = this.form) == null ? void 0 : _a.shrinkBtnTooltipDesc;
|
|
65
|
+
},
|
|
66
|
+
downIcon() {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_a = this.form) == null ? void 0 : _a.downIcon;
|
|
69
|
+
},
|
|
70
|
+
upIcon() {
|
|
71
|
+
var _a;
|
|
72
|
+
return (_a = this.form) == null ? void 0 : _a.upIcon;
|
|
73
|
+
},
|
|
74
|
+
isCollapse() {
|
|
75
|
+
var _a;
|
|
76
|
+
return (_a = this.form) == null ? void 0 : _a.isCollapse;
|
|
77
|
+
},
|
|
78
|
+
labelPosition() {
|
|
79
|
+
var _a;
|
|
80
|
+
return (_a = this.form) == null ? void 0 : _a.labelPosition;
|
|
81
|
+
},
|
|
82
|
+
inline() {
|
|
83
|
+
var _a;
|
|
84
|
+
return (_a = this.form) == null ? void 0 : _a.inline;
|
|
85
|
+
},
|
|
86
|
+
columns() {
|
|
87
|
+
var _a;
|
|
88
|
+
return (_a = this.form) == null ? void 0 : _a.columns;
|
|
89
|
+
},
|
|
90
|
+
expandBtnType() {
|
|
91
|
+
var _a;
|
|
92
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnType;
|
|
93
|
+
},
|
|
94
|
+
expandBtnIcon() {
|
|
95
|
+
var _a;
|
|
96
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnIcon;
|
|
97
|
+
},
|
|
98
|
+
expandBtnPlain() {
|
|
99
|
+
var _a;
|
|
100
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnPlain;
|
|
101
|
+
},
|
|
102
|
+
expandBtnSize() {
|
|
103
|
+
var _a;
|
|
104
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnSize;
|
|
105
|
+
},
|
|
106
|
+
expandBtnRound() {
|
|
107
|
+
var _a;
|
|
108
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnRound;
|
|
109
|
+
},
|
|
110
|
+
expandBtnCircle() {
|
|
111
|
+
var _a;
|
|
112
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnCircle;
|
|
113
|
+
},
|
|
114
|
+
expandBtnLoading() {
|
|
115
|
+
var _a;
|
|
116
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnLoading;
|
|
117
|
+
},
|
|
118
|
+
expandBtnDisabled() {
|
|
119
|
+
var _a;
|
|
120
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnDisabled;
|
|
121
|
+
},
|
|
122
|
+
showBtn() {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
if (this.hidden)
|
|
125
|
+
return false;
|
|
126
|
+
if (!((_a = this.form) == null ? void 0 : _a.showBtn))
|
|
127
|
+
return false;
|
|
128
|
+
return ((_b = this.form) == null ? void 0 : _b.formItems.length) > this.columns;
|
|
129
|
+
},
|
|
130
|
+
isLastItem() {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
if (!this.showBtn)
|
|
133
|
+
return false;
|
|
134
|
+
const items = (_a = this.form) == null ? void 0 : _a.formItems;
|
|
135
|
+
return this._uid === ((_b = items == null ? void 0 : items[(items == null ? void 0 : items.length) - 1]) == null ? void 0 : _b._uid);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
methods: {
|
|
139
|
+
refreshButtonList() {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
if ((_a = this.form) == null ? void 0 : _a.showBtn) {
|
|
142
|
+
(_b = this.form) == null ? void 0 : _b.formItems.forEach((item, index) => {
|
|
143
|
+
var _a2, _b2;
|
|
144
|
+
const idx = index + 1;
|
|
145
|
+
item.$el.style.display = ((_a2 = this.form) == null ? void 0 : _a2.inline) ? "inline-block" : "block";
|
|
146
|
+
if (idx > this.columns - 1 && idx < ((_b2 = this.form) == null ? void 0 : _b2.formItems.length)) {
|
|
147
|
+
if (!this.isExpand) {
|
|
148
|
+
item.$el.style.display = "none";
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
// 切换显示模式
|
|
155
|
+
switchMode(e) {
|
|
156
|
+
var _a;
|
|
157
|
+
let target = event.target;
|
|
158
|
+
if (target.nodeName == "SPAN") {
|
|
159
|
+
target = event.target.parentNode;
|
|
160
|
+
} else if (target.nodeName == "I") {
|
|
161
|
+
target = event.target.parentNode.parentNode;
|
|
162
|
+
}
|
|
163
|
+
target.blur();
|
|
164
|
+
this.isExpand = !this.isExpand;
|
|
165
|
+
(_a = this.form) == null ? void 0 : _a.$emit("isCollapseChange", this.isExpand);
|
|
166
|
+
this.refreshButtonList();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
var _sfc_render = function render() {
|
|
171
|
+
var _vm = this, _c = _vm._self._c;
|
|
172
|
+
_vm._self._setupProxy;
|
|
173
|
+
return _c("div", {
|
|
174
|
+
staticClass: "el-form-item nf-form-item",
|
|
175
|
+
class: [{
|
|
176
|
+
"el-form-item--feedback": _vm.elForm && _vm.elForm.statusIcon,
|
|
177
|
+
"is-error": _vm.validateState === "error",
|
|
178
|
+
"is-validating": _vm.validateState === "validating",
|
|
179
|
+
"is-success": _vm.validateState === "success",
|
|
180
|
+
"is-required": _vm.isRequired || _vm.required,
|
|
181
|
+
"is-no-asterisk": _vm.elForm && _vm.elForm.hideRequiredAsterisk
|
|
182
|
+
}, _vm.sizeClass ? "el-form-item--" + _vm.sizeClass : ""]
|
|
183
|
+
}, [_c("label-wrap", {
|
|
184
|
+
attrs: {
|
|
185
|
+
"is-auto-width": _vm.labelStyle && _vm.labelStyle.width === "auto",
|
|
186
|
+
"update-all": _vm.form.labelWidth === "auto"
|
|
187
|
+
}
|
|
188
|
+
}, [_vm.label || _vm.$slots.label ? _c("label", {
|
|
189
|
+
staticClass: "el-form-item__label",
|
|
190
|
+
style: _vm.labelStyle,
|
|
191
|
+
attrs: {
|
|
192
|
+
"for": _vm.labelFor
|
|
193
|
+
}
|
|
194
|
+
}, [_vm._t("label", function() {
|
|
195
|
+
return [_vm._v(_vm._s(_vm.label + _vm.form.labelSuffix))];
|
|
196
|
+
})], 2) : _vm._e()]), _c("div", {
|
|
197
|
+
staticClass: "el-form-item__content",
|
|
198
|
+
style: _vm.contentStyle
|
|
199
|
+
}, [_vm.isLastItem ? _c("div", {
|
|
200
|
+
staticClass: "nf-flex"
|
|
201
|
+
}, [_vm._t("default"), _vm.showBtn ? _c("div", {
|
|
202
|
+
staticClass: "nf-ml10"
|
|
203
|
+
}, [_c("el-tooltip", {
|
|
204
|
+
attrs: {
|
|
205
|
+
"content": _vm.isExpand ? _vm.shrinkBtnTooltipDesc : _vm.expandBtnTooltipDesc,
|
|
206
|
+
"placement": "top"
|
|
207
|
+
}
|
|
208
|
+
}, [_c("nf-button", {
|
|
209
|
+
staticClass: "nf-pointer",
|
|
210
|
+
attrs: {
|
|
211
|
+
"type": _vm.expandBtnType,
|
|
212
|
+
"icon": _vm.expandBtnIcon,
|
|
213
|
+
"plain": _vm.expandBtnPlain,
|
|
214
|
+
"size": _vm.expandBtnSize,
|
|
215
|
+
"round": _vm.expandBtnRound,
|
|
216
|
+
"circle": _vm.expandBtnCircle,
|
|
217
|
+
"loading": _vm.expandBtnLoading,
|
|
218
|
+
"disabled": _vm.expandBtnDisabled
|
|
219
|
+
},
|
|
220
|
+
on: {
|
|
221
|
+
"click": _vm.switchMode
|
|
222
|
+
}
|
|
223
|
+
}, [_c("i", {
|
|
224
|
+
staticClass: "iconfont nf-fs12",
|
|
225
|
+
class: _vm.isExpand ? _vm.upIcon : _vm.downIcon
|
|
226
|
+
})])], 1)], 1) : _vm._e()], 2) : _vm._t("default"), _c("transition", {
|
|
227
|
+
attrs: {
|
|
228
|
+
"name": "el-zoom-in-top"
|
|
229
|
+
}
|
|
230
|
+
}, [_vm.validateState === "error" && _vm.showMessage && _vm.form.showMessage ? _vm._t("error", function() {
|
|
231
|
+
return [_c("div", {
|
|
232
|
+
staticClass: "el-form-item__error",
|
|
233
|
+
class: {
|
|
234
|
+
"el-form-item__error--inline": typeof _vm.inlineMessage === "boolean" ? _vm.inlineMessage : _vm.elForm && _vm.elForm.inlineMessage || false
|
|
235
|
+
}
|
|
236
|
+
}, [_vm._v(" " + _vm._s(_vm.validateMessage) + " ")])];
|
|
237
|
+
}, {
|
|
238
|
+
"error": _vm.validateMessage
|
|
239
|
+
}) : _vm._e()], 2)], 2)], 1);
|
|
240
|
+
};
|
|
241
|
+
var _sfc_staticRenderFns = [];
|
|
242
|
+
var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
243
|
+
const NfFormItem = __component__.exports;
|
|
244
|
+
NfFormItem.install = (app) => {
|
|
245
|
+
app.component("nf-form-item", NfFormItem);
|
|
246
|
+
};
|
|
247
|
+
exports.default = NfFormItem;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { defineComponent, nextTick } from "vue-demi";
|
|
2
|
+
import { FormItem } from "element-ui";
|
|
3
|
+
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
4
|
+
const _sfc_main = defineComponent({
|
|
5
|
+
name: "NfFormItem",
|
|
6
|
+
extends: FormItem,
|
|
7
|
+
props: {
|
|
8
|
+
hidden: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
data() {
|
|
14
|
+
return {
|
|
15
|
+
isExpand: true,
|
|
16
|
+
initExpand: false
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
watch: {
|
|
20
|
+
labelPosition() {
|
|
21
|
+
this.refreshButtonList();
|
|
22
|
+
},
|
|
23
|
+
columns() {
|
|
24
|
+
this.refreshButtonList();
|
|
25
|
+
},
|
|
26
|
+
inline() {
|
|
27
|
+
this.refreshButtonList();
|
|
28
|
+
},
|
|
29
|
+
isCollapse() {
|
|
30
|
+
var _a;
|
|
31
|
+
this.isExpand = !((_a = this.form) == null ? void 0 : _a.isCollapse);
|
|
32
|
+
if (this.initExpand) {
|
|
33
|
+
this.switchMode();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
mounted() {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
if ((_a = this.form) == null ? void 0 : _a.init) {
|
|
40
|
+
(_b = this.form) == null ? void 0 : _b.getFormItems();
|
|
41
|
+
}
|
|
42
|
+
nextTick(() => {
|
|
43
|
+
var _a2;
|
|
44
|
+
if (!this.initExpand) {
|
|
45
|
+
this.isExpand = !((_a2 = this.form) == null ? void 0 : _a2.isCollapse);
|
|
46
|
+
if (!this.isExpand) {
|
|
47
|
+
this.refreshButtonList();
|
|
48
|
+
}
|
|
49
|
+
this.initExpand = true;
|
|
50
|
+
} else {
|
|
51
|
+
this.refreshButtonList();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
computed: {
|
|
56
|
+
expandBtnTooltipDesc() {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnTooltipDesc;
|
|
59
|
+
},
|
|
60
|
+
shrinkBtnTooltipDesc() {
|
|
61
|
+
var _a;
|
|
62
|
+
return (_a = this.form) == null ? void 0 : _a.shrinkBtnTooltipDesc;
|
|
63
|
+
},
|
|
64
|
+
downIcon() {
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.form) == null ? void 0 : _a.downIcon;
|
|
67
|
+
},
|
|
68
|
+
upIcon() {
|
|
69
|
+
var _a;
|
|
70
|
+
return (_a = this.form) == null ? void 0 : _a.upIcon;
|
|
71
|
+
},
|
|
72
|
+
isCollapse() {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = this.form) == null ? void 0 : _a.isCollapse;
|
|
75
|
+
},
|
|
76
|
+
labelPosition() {
|
|
77
|
+
var _a;
|
|
78
|
+
return (_a = this.form) == null ? void 0 : _a.labelPosition;
|
|
79
|
+
},
|
|
80
|
+
inline() {
|
|
81
|
+
var _a;
|
|
82
|
+
return (_a = this.form) == null ? void 0 : _a.inline;
|
|
83
|
+
},
|
|
84
|
+
columns() {
|
|
85
|
+
var _a;
|
|
86
|
+
return (_a = this.form) == null ? void 0 : _a.columns;
|
|
87
|
+
},
|
|
88
|
+
expandBtnType() {
|
|
89
|
+
var _a;
|
|
90
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnType;
|
|
91
|
+
},
|
|
92
|
+
expandBtnIcon() {
|
|
93
|
+
var _a;
|
|
94
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnIcon;
|
|
95
|
+
},
|
|
96
|
+
expandBtnPlain() {
|
|
97
|
+
var _a;
|
|
98
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnPlain;
|
|
99
|
+
},
|
|
100
|
+
expandBtnSize() {
|
|
101
|
+
var _a;
|
|
102
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnSize;
|
|
103
|
+
},
|
|
104
|
+
expandBtnRound() {
|
|
105
|
+
var _a;
|
|
106
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnRound;
|
|
107
|
+
},
|
|
108
|
+
expandBtnCircle() {
|
|
109
|
+
var _a;
|
|
110
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnCircle;
|
|
111
|
+
},
|
|
112
|
+
expandBtnLoading() {
|
|
113
|
+
var _a;
|
|
114
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnLoading;
|
|
115
|
+
},
|
|
116
|
+
expandBtnDisabled() {
|
|
117
|
+
var _a;
|
|
118
|
+
return (_a = this.form) == null ? void 0 : _a.expandBtnDisabled;
|
|
119
|
+
},
|
|
120
|
+
showBtn() {
|
|
121
|
+
var _a, _b;
|
|
122
|
+
if (this.hidden)
|
|
123
|
+
return false;
|
|
124
|
+
if (!((_a = this.form) == null ? void 0 : _a.showBtn))
|
|
125
|
+
return false;
|
|
126
|
+
return ((_b = this.form) == null ? void 0 : _b.formItems.length) > this.columns;
|
|
127
|
+
},
|
|
128
|
+
isLastItem() {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
if (!this.showBtn)
|
|
131
|
+
return false;
|
|
132
|
+
const items = (_a = this.form) == null ? void 0 : _a.formItems;
|
|
133
|
+
return this._uid === ((_b = items == null ? void 0 : items[(items == null ? void 0 : items.length) - 1]) == null ? void 0 : _b._uid);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
methods: {
|
|
137
|
+
refreshButtonList() {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
if ((_a = this.form) == null ? void 0 : _a.showBtn) {
|
|
140
|
+
(_b = this.form) == null ? void 0 : _b.formItems.forEach((item, index) => {
|
|
141
|
+
var _a2, _b2;
|
|
142
|
+
const idx = index + 1;
|
|
143
|
+
item.$el.style.display = ((_a2 = this.form) == null ? void 0 : _a2.inline) ? "inline-block" : "block";
|
|
144
|
+
if (idx > this.columns - 1 && idx < ((_b2 = this.form) == null ? void 0 : _b2.formItems.length)) {
|
|
145
|
+
if (!this.isExpand) {
|
|
146
|
+
item.$el.style.display = "none";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
// 切换显示模式
|
|
153
|
+
switchMode(e) {
|
|
154
|
+
var _a;
|
|
155
|
+
let target = event.target;
|
|
156
|
+
if (target.nodeName == "SPAN") {
|
|
157
|
+
target = event.target.parentNode;
|
|
158
|
+
} else if (target.nodeName == "I") {
|
|
159
|
+
target = event.target.parentNode.parentNode;
|
|
160
|
+
}
|
|
161
|
+
target.blur();
|
|
162
|
+
this.isExpand = !this.isExpand;
|
|
163
|
+
(_a = this.form) == null ? void 0 : _a.$emit("isCollapseChange", this.isExpand);
|
|
164
|
+
this.refreshButtonList();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
var _sfc_render = function render() {
|
|
169
|
+
var _vm = this, _c = _vm._self._c;
|
|
170
|
+
_vm._self._setupProxy;
|
|
171
|
+
return _c("div", {
|
|
172
|
+
staticClass: "el-form-item nf-form-item",
|
|
173
|
+
class: [{
|
|
174
|
+
"el-form-item--feedback": _vm.elForm && _vm.elForm.statusIcon,
|
|
175
|
+
"is-error": _vm.validateState === "error",
|
|
176
|
+
"is-validating": _vm.validateState === "validating",
|
|
177
|
+
"is-success": _vm.validateState === "success",
|
|
178
|
+
"is-required": _vm.isRequired || _vm.required,
|
|
179
|
+
"is-no-asterisk": _vm.elForm && _vm.elForm.hideRequiredAsterisk
|
|
180
|
+
}, _vm.sizeClass ? "el-form-item--" + _vm.sizeClass : ""]
|
|
181
|
+
}, [_c("label-wrap", {
|
|
182
|
+
attrs: {
|
|
183
|
+
"is-auto-width": _vm.labelStyle && _vm.labelStyle.width === "auto",
|
|
184
|
+
"update-all": _vm.form.labelWidth === "auto"
|
|
185
|
+
}
|
|
186
|
+
}, [_vm.label || _vm.$slots.label ? _c("label", {
|
|
187
|
+
staticClass: "el-form-item__label",
|
|
188
|
+
style: _vm.labelStyle,
|
|
189
|
+
attrs: {
|
|
190
|
+
"for": _vm.labelFor
|
|
191
|
+
}
|
|
192
|
+
}, [_vm._t("label", function() {
|
|
193
|
+
return [_vm._v(_vm._s(_vm.label + _vm.form.labelSuffix))];
|
|
194
|
+
})], 2) : _vm._e()]), _c("div", {
|
|
195
|
+
staticClass: "el-form-item__content",
|
|
196
|
+
style: _vm.contentStyle
|
|
197
|
+
}, [_vm.isLastItem ? _c("div", {
|
|
198
|
+
staticClass: "nf-flex"
|
|
199
|
+
}, [_vm._t("default"), _vm.showBtn ? _c("div", {
|
|
200
|
+
staticClass: "nf-ml10"
|
|
201
|
+
}, [_c("el-tooltip", {
|
|
202
|
+
attrs: {
|
|
203
|
+
"content": _vm.isExpand ? _vm.shrinkBtnTooltipDesc : _vm.expandBtnTooltipDesc,
|
|
204
|
+
"placement": "top"
|
|
205
|
+
}
|
|
206
|
+
}, [_c("nf-button", {
|
|
207
|
+
staticClass: "nf-pointer",
|
|
208
|
+
attrs: {
|
|
209
|
+
"type": _vm.expandBtnType,
|
|
210
|
+
"icon": _vm.expandBtnIcon,
|
|
211
|
+
"plain": _vm.expandBtnPlain,
|
|
212
|
+
"size": _vm.expandBtnSize,
|
|
213
|
+
"round": _vm.expandBtnRound,
|
|
214
|
+
"circle": _vm.expandBtnCircle,
|
|
215
|
+
"loading": _vm.expandBtnLoading,
|
|
216
|
+
"disabled": _vm.expandBtnDisabled
|
|
217
|
+
},
|
|
218
|
+
on: {
|
|
219
|
+
"click": _vm.switchMode
|
|
220
|
+
}
|
|
221
|
+
}, [_c("i", {
|
|
222
|
+
staticClass: "iconfont nf-fs12",
|
|
223
|
+
class: _vm.isExpand ? _vm.upIcon : _vm.downIcon
|
|
224
|
+
})])], 1)], 1) : _vm._e()], 2) : _vm._t("default"), _c("transition", {
|
|
225
|
+
attrs: {
|
|
226
|
+
"name": "el-zoom-in-top"
|
|
227
|
+
}
|
|
228
|
+
}, [_vm.validateState === "error" && _vm.showMessage && _vm.form.showMessage ? _vm._t("error", function() {
|
|
229
|
+
return [_c("div", {
|
|
230
|
+
staticClass: "el-form-item__error",
|
|
231
|
+
class: {
|
|
232
|
+
"el-form-item__error--inline": typeof _vm.inlineMessage === "boolean" ? _vm.inlineMessage : _vm.elForm && _vm.elForm.inlineMessage || false
|
|
233
|
+
}
|
|
234
|
+
}, [_vm._v(" " + _vm._s(_vm.validateMessage) + " ")])];
|
|
235
|
+
}, {
|
|
236
|
+
"error": _vm.validateMessage
|
|
237
|
+
}) : _vm._e()], 2)], 2)], 1);
|
|
238
|
+
};
|
|
239
|
+
var _sfc_staticRenderFns = [];
|
|
240
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
241
|
+
const NfFormItem = __component__.exports;
|
|
242
|
+
NfFormItem.install = (app) => {
|
|
243
|
+
app.component("nf-form-item", NfFormItem);
|
|
244
|
+
};
|
|
245
|
+
export {
|
|
246
|
+
NfFormItem as default
|
|
247
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FormItem } from 'element-ui';
|
|
2
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
3
|
+
hidden: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: boolean;
|
|
6
|
+
};
|
|
7
|
+
}, {}, {
|
|
8
|
+
isExpand: boolean;
|
|
9
|
+
initExpand: boolean;
|
|
10
|
+
}, {
|
|
11
|
+
expandBtnTooltipDesc(): any;
|
|
12
|
+
shrinkBtnTooltipDesc(): any;
|
|
13
|
+
downIcon(): any;
|
|
14
|
+
upIcon(): any;
|
|
15
|
+
isCollapse(): any;
|
|
16
|
+
labelPosition(): any;
|
|
17
|
+
inline(): any;
|
|
18
|
+
columns(): any;
|
|
19
|
+
expandBtnType(): any;
|
|
20
|
+
expandBtnIcon(): any;
|
|
21
|
+
expandBtnPlain(): any;
|
|
22
|
+
expandBtnSize(): any;
|
|
23
|
+
expandBtnRound(): any;
|
|
24
|
+
expandBtnCircle(): any;
|
|
25
|
+
expandBtnLoading(): any;
|
|
26
|
+
expandBtnDisabled(): any;
|
|
27
|
+
showBtn(): boolean;
|
|
28
|
+
isLastItem(): boolean;
|
|
29
|
+
}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, typeof FormItem, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
30
|
+
hidden: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
}>>, {
|
|
35
|
+
hidden: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/lib/style/css.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@94ai/nf-theme-chalk/lib/css/nf-form-item.css'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@94ai/nf-theme-chalk/lib/nf-form-item.scss'
|
package/package/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import NfFormItem from './nf-form-item.vue'
|
|
2
|
+
import { Vue2, PluginObject } from 'vue-demi'
|
|
3
|
+
|
|
4
|
+
NfFormItem.install = (app: typeof Vue2) => {
|
|
5
|
+
app!.component('nf-form-item', NfFormItem)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default NfFormItem as typeof NfFormItem & PluginObject<undefined>
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
class="el-form-item nf-form-item"
|
|
5
|
+
:class="[{
|
|
6
|
+
'el-form-item--feedback': elForm && elForm.statusIcon,
|
|
7
|
+
'is-error': validateState === 'error',
|
|
8
|
+
'is-validating': validateState === 'validating',
|
|
9
|
+
'is-success': validateState === 'success',
|
|
10
|
+
'is-required': isRequired || required,
|
|
11
|
+
'is-no-asterisk': elForm && elForm.hideRequiredAsterisk,
|
|
12
|
+
},
|
|
13
|
+
sizeClass ? 'el-form-item--' + sizeClass : ''
|
|
14
|
+
]"
|
|
15
|
+
>
|
|
16
|
+
<label-wrap
|
|
17
|
+
:is-auto-width="labelStyle && labelStyle.width === 'auto'"
|
|
18
|
+
:update-all="form.labelWidth === 'auto'"
|
|
19
|
+
>
|
|
20
|
+
<label v-if="label || $slots.label" :for="labelFor" class="el-form-item__label" :style="labelStyle">
|
|
21
|
+
<slot name="label">{{ label + form.labelSuffix }}</slot>
|
|
22
|
+
</label>
|
|
23
|
+
</label-wrap>
|
|
24
|
+
<div class="el-form-item__content" :style="contentStyle">
|
|
25
|
+
<div v-if="isLastItem" class="nf-flex">
|
|
26
|
+
<slot />
|
|
27
|
+
<div v-if="showBtn" class="nf-ml10">
|
|
28
|
+
<el-tooltip :content="isExpand ? shrinkBtnTooltipDesc : expandBtnTooltipDesc" placement="top">
|
|
29
|
+
<nf-button
|
|
30
|
+
class="nf-pointer"
|
|
31
|
+
@click="switchMode"
|
|
32
|
+
:type="expandBtnType"
|
|
33
|
+
:icon="expandBtnIcon"
|
|
34
|
+
:plain="expandBtnPlain"
|
|
35
|
+
:size="expandBtnSize"
|
|
36
|
+
:round="expandBtnRound"
|
|
37
|
+
:circle="expandBtnCircle"
|
|
38
|
+
:loading="expandBtnLoading"
|
|
39
|
+
:disabled="expandBtnDisabled"
|
|
40
|
+
>
|
|
41
|
+
<i class="iconfont nf-fs12" :class="isExpand ? upIcon : downIcon" />
|
|
42
|
+
</nf-button>
|
|
43
|
+
</el-tooltip>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<slot v-else />
|
|
47
|
+
<transition name="el-zoom-in-top">
|
|
48
|
+
<slot
|
|
49
|
+
v-if="validateState === 'error' && showMessage && form.showMessage"
|
|
50
|
+
name="error"
|
|
51
|
+
:error="validateMessage"
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
class="el-form-item__error"
|
|
55
|
+
:class="{
|
|
56
|
+
'el-form-item__error--inline': typeof inlineMessage === 'boolean'
|
|
57
|
+
? inlineMessage
|
|
58
|
+
: (elForm && elForm.inlineMessage || false)
|
|
59
|
+
}"
|
|
60
|
+
>
|
|
61
|
+
{{ validateMessage }}
|
|
62
|
+
</div>
|
|
63
|
+
</slot>
|
|
64
|
+
</transition>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script lang="ts">
|
|
70
|
+
// @ts-nocheck
|
|
71
|
+
import { defineComponent, nextTick } from 'vue-demi'
|
|
72
|
+
import { FormItem } from 'element-ui'
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
export default defineComponent({
|
|
76
|
+
name: 'NfFormItem',
|
|
77
|
+
extends: FormItem,
|
|
78
|
+
props: {
|
|
79
|
+
hidden: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
data() {
|
|
85
|
+
return {
|
|
86
|
+
isExpand: true,
|
|
87
|
+
initExpand: false,
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
watch: {
|
|
91
|
+
labelPosition() {
|
|
92
|
+
this.refreshButtonList()
|
|
93
|
+
},
|
|
94
|
+
columns() {
|
|
95
|
+
this.refreshButtonList()
|
|
96
|
+
},
|
|
97
|
+
inline() {
|
|
98
|
+
this.refreshButtonList()
|
|
99
|
+
},
|
|
100
|
+
isCollapse() {
|
|
101
|
+
this.isExpand = !this.form?.isCollapse
|
|
102
|
+
if (this.initExpand) {
|
|
103
|
+
this.switchMode()
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
mounted() {
|
|
108
|
+
if (this.form?.init) {
|
|
109
|
+
this.form?.getFormItems()
|
|
110
|
+
}
|
|
111
|
+
nextTick(() => {
|
|
112
|
+
if (!this.initExpand) {
|
|
113
|
+
this.isExpand = !this.form?.isCollapse
|
|
114
|
+
if (!this.isExpand) {
|
|
115
|
+
this.refreshButtonList()
|
|
116
|
+
}
|
|
117
|
+
this.initExpand = true
|
|
118
|
+
} else {
|
|
119
|
+
this.refreshButtonList()
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
},
|
|
123
|
+
computed: {
|
|
124
|
+
expandBtnTooltipDesc() {
|
|
125
|
+
return this.form?.expandBtnTooltipDesc
|
|
126
|
+
},
|
|
127
|
+
shrinkBtnTooltipDesc() {
|
|
128
|
+
return this.form?.shrinkBtnTooltipDesc
|
|
129
|
+
},
|
|
130
|
+
downIcon() {
|
|
131
|
+
return this.form?.downIcon
|
|
132
|
+
},
|
|
133
|
+
upIcon() {
|
|
134
|
+
return this.form?.upIcon
|
|
135
|
+
},
|
|
136
|
+
isCollapse() {
|
|
137
|
+
return this.form?.isCollapse
|
|
138
|
+
},
|
|
139
|
+
labelPosition() {
|
|
140
|
+
return this.form?.labelPosition
|
|
141
|
+
},
|
|
142
|
+
inline() {
|
|
143
|
+
return this.form?.inline
|
|
144
|
+
},
|
|
145
|
+
columns() {
|
|
146
|
+
return this.form?.columns
|
|
147
|
+
},
|
|
148
|
+
expandBtnType() {
|
|
149
|
+
return this.form?.expandBtnType
|
|
150
|
+
},
|
|
151
|
+
expandBtnIcon() {
|
|
152
|
+
return this.form?.expandBtnIcon
|
|
153
|
+
},
|
|
154
|
+
expandBtnPlain() {
|
|
155
|
+
return this.form?.expandBtnPlain
|
|
156
|
+
},
|
|
157
|
+
expandBtnSize() {
|
|
158
|
+
return this.form?.expandBtnSize
|
|
159
|
+
},
|
|
160
|
+
expandBtnRound() {
|
|
161
|
+
return this.form?.expandBtnRound
|
|
162
|
+
},
|
|
163
|
+
expandBtnCircle() {
|
|
164
|
+
return this.form?.expandBtnCircle
|
|
165
|
+
},
|
|
166
|
+
expandBtnLoading() {
|
|
167
|
+
return this.form?.expandBtnLoading
|
|
168
|
+
},
|
|
169
|
+
expandBtnDisabled() {
|
|
170
|
+
return this.form?.expandBtnDisabled
|
|
171
|
+
},
|
|
172
|
+
showBtn() {
|
|
173
|
+
if (this.hidden) return false
|
|
174
|
+
if (!this.form?.showBtn) return false
|
|
175
|
+
return this.form?.formItems.length > this.columns
|
|
176
|
+
},
|
|
177
|
+
isLastItem() {
|
|
178
|
+
if (!this.showBtn) return false
|
|
179
|
+
// const uIds = []
|
|
180
|
+
// this.form?.formItems.forEach(item => {
|
|
181
|
+
// uIds.push(item._uid)
|
|
182
|
+
// })
|
|
183
|
+
// // 取最大值
|
|
184
|
+
// const max = Math.max(...uIds)
|
|
185
|
+
// return this._uid === max
|
|
186
|
+
const items = this.form?.formItems
|
|
187
|
+
return this._uid === items?.[items?.length - 1]?._uid
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
refreshButtonList() {
|
|
192
|
+
if (this.form?.showBtn) {
|
|
193
|
+
this.form?.formItems.forEach((item, index) => {
|
|
194
|
+
const idx = index + 1
|
|
195
|
+
// getComputedStyle(item.$el).display
|
|
196
|
+
item.$el.style.display = this.form?.inline ? 'inline-block' : 'block'
|
|
197
|
+
if (idx > this.columns - 1 && idx < this.form?.formItems.length) {
|
|
198
|
+
if (!this.isExpand) {
|
|
199
|
+
item.$el.style.display = 'none'
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
// 切换显示模式
|
|
206
|
+
switchMode(e) {
|
|
207
|
+
let target = event.target
|
|
208
|
+
// 点击的是i、span、button中的哪一个
|
|
209
|
+
if (target.nodeName == 'SPAN') {
|
|
210
|
+
target = event.target.parentNode
|
|
211
|
+
} else if (target.nodeName == 'I') {
|
|
212
|
+
target = event.target.parentNode.parentNode
|
|
213
|
+
}
|
|
214
|
+
target.blur()
|
|
215
|
+
this.isExpand = !this.isExpand
|
|
216
|
+
this.form?.$emit('isCollapseChange', this.isExpand)
|
|
217
|
+
this.refreshButtonList()
|
|
218
|
+
},
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
</script>
|
|
222
|
+
|
|
223
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@94ai/nf-theme-chalk/lib/css/nf-form-item.css'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@94ai/nf-theme-chalk/lib/nf-form-item.scss'
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@94ai/nf-form-item",
|
|
3
|
+
"version": "3.1.13",
|
|
4
|
+
"description": "> TODO: description",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
7
|
+
"homepage": "https://oss.xccjh.top/common-ui/#/ai-index",
|
|
8
|
+
"license": "ISC",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@94ai/nf-theme-chalk": "^3.1.13",
|
|
18
|
+
"vue-demi": "^0.14.5"
|
|
19
|
+
},
|
|
20
|
+
"peerDependenciesMeta": {
|
|
21
|
+
"@vue/composition-api": {
|
|
22
|
+
"optional": true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@vue/composition-api": "^1.0.0-rc.1",
|
|
27
|
+
"element-ui": ">=2.13.2",
|
|
28
|
+
"vue": "^2.0.0 || >=3.0.0"
|
|
29
|
+
},
|
|
30
|
+
"types": "lib/index.d.ts",
|
|
31
|
+
"main": "lib/nf-form-item.cjs.js",
|
|
32
|
+
"module": "lib/nf-form-item.esm-bundler.js",
|
|
33
|
+
"gitHead": "a8c56183ccc8e979008e2d38bfde2d7d1448654c"
|
|
34
|
+
}
|