@nutui/nutui 4.0.11 → 4.0.12
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/dist/nutui.es.js +1 -1
- package/dist/nutui.js +2 -2
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +48 -48
- package/dist/styles/themes/jdb.scss +48 -48
- package/dist/styles/themes/jddkh.scss +48 -48
- package/dist/styles/themes/jdt.scss +48 -48
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -4
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,125 +1,196 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var __objRest = (source, exclude) => {
|
|
5
|
+
var target = {};
|
|
6
|
+
for (var prop in source)
|
|
7
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8
|
+
target[prop] = source[prop];
|
|
9
|
+
if (source != null && __getOwnPropSymbols)
|
|
10
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
11
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
12
|
+
target[prop] = source[prop];
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
11
15
|
};
|
|
12
|
-
import { g as
|
|
13
|
-
import { computed
|
|
14
|
-
import
|
|
15
|
-
import { _ as
|
|
16
|
+
import { g as isObject, h as getPropByPath, f as isPromise, c as createComponent } from "./component-81a4c1d0.js";
|
|
17
|
+
import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, withModifiers, createVNode, withCtx, renderSlot } from "vue";
|
|
18
|
+
import CellGroup from "./CellGroup.js";
|
|
19
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
16
20
|
import "../locale/lang";
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
rules: {
|
|
24
|
-
type: Object,
|
|
25
|
-
default: {}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
components: l,
|
|
29
|
-
emits: ["validate"],
|
|
30
|
-
setup(i, { emit: m, slots: o }) {
|
|
31
|
-
const f = q(() => G({}));
|
|
32
|
-
U("formErrorTip", f);
|
|
33
|
-
const _ = () => {
|
|
34
|
-
Object.keys(f.value).forEach((s) => {
|
|
35
|
-
f.value[s] = "";
|
|
36
|
-
});
|
|
37
|
-
}, g = () => {
|
|
38
|
-
_();
|
|
39
|
-
};
|
|
40
|
-
z(
|
|
41
|
-
() => i.modelValue,
|
|
42
|
-
() => {
|
|
43
|
-
_();
|
|
21
|
+
const component = (components) => {
|
|
22
|
+
return {
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: {}
|
|
44
27
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
E ? V(!0) : (P(p), V(p));
|
|
81
|
-
}).catch((E) => B(E));
|
|
28
|
+
rules: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: {}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
components,
|
|
34
|
+
emits: ["validate"],
|
|
35
|
+
setup(props, { emit, slots }) {
|
|
36
|
+
const formErrorTip = computed(() => reactive({}));
|
|
37
|
+
provide("formErrorTip", formErrorTip);
|
|
38
|
+
const clearErrorTips = () => {
|
|
39
|
+
Object.keys(formErrorTip.value).forEach((item) => {
|
|
40
|
+
formErrorTip.value[item] = "";
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const reset = () => {
|
|
44
|
+
clearErrorTips();
|
|
45
|
+
};
|
|
46
|
+
watch(
|
|
47
|
+
() => props.modelValue,
|
|
48
|
+
() => {
|
|
49
|
+
clearErrorTips();
|
|
50
|
+
},
|
|
51
|
+
{ immediate: true }
|
|
52
|
+
);
|
|
53
|
+
const findFormItem = (vnodes) => {
|
|
54
|
+
let task = [];
|
|
55
|
+
vnodes.forEach((vnode) => {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
let type = vnode.type;
|
|
58
|
+
type = type.name || type;
|
|
59
|
+
if (type == "nut-form-item" || (type == null ? void 0 : type.toString().endsWith("form-item"))) {
|
|
60
|
+
task.push({
|
|
61
|
+
prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
|
|
62
|
+
rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
|
|
82
63
|
});
|
|
83
|
-
if (
|
|
84
|
-
|
|
64
|
+
} else if (Array.isArray(vnode.children) && ((_c = vnode.children) == null ? void 0 : _c.length)) {
|
|
65
|
+
task = task.concat(findFormItem(vnode.children));
|
|
66
|
+
} else if (isObject(vnode.children) && Object.keys(vnode.children)) {
|
|
67
|
+
if ((_d = vnode.children) == null ? void 0 : _d.default) {
|
|
68
|
+
vnode.children = vnode.children.default();
|
|
69
|
+
task = task.concat(findFormItem(vnode.children));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return task;
|
|
74
|
+
};
|
|
75
|
+
const tipMessage = (errorMsg) => {
|
|
76
|
+
if (errorMsg.message) {
|
|
77
|
+
emit("validate", errorMsg);
|
|
85
78
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
79
|
+
formErrorTip.value[errorMsg.prop] = errorMsg.message;
|
|
80
|
+
};
|
|
81
|
+
const checkRule = (item) => {
|
|
82
|
+
const { rules, prop } = item;
|
|
83
|
+
const _Promise = (errorMsg) => {
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
try {
|
|
86
|
+
tipMessage(errorMsg);
|
|
87
|
+
resolve(errorMsg);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
reject(error);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
if (!prop) {
|
|
94
|
+
console.warn("[NutUI] <FormItem> 使用 rules 校验规则时 , 必须设置 prop 参数");
|
|
95
|
+
}
|
|
96
|
+
const value = getPropByPath(props.modelValue, prop || "");
|
|
97
|
+
tipMessage({ prop, message: "" });
|
|
98
|
+
const formRules = props.rules || {};
|
|
99
|
+
const _rules = [...(formRules == null ? void 0 : formRules[prop]) || [], ...rules];
|
|
100
|
+
while (_rules.length) {
|
|
101
|
+
const rule = _rules.shift();
|
|
102
|
+
const _a = rule, { validator } = _a, ruleWithoutValidator = __objRest(_a, ["validator"]);
|
|
103
|
+
const { required, regex, message } = ruleWithoutValidator;
|
|
104
|
+
const errorMsg = { prop, message };
|
|
105
|
+
if (required) {
|
|
106
|
+
if (!value && value !== 0) {
|
|
107
|
+
return _Promise(errorMsg);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (regex && !regex.test(String(value))) {
|
|
111
|
+
return _Promise(errorMsg);
|
|
112
|
+
}
|
|
113
|
+
if (validator) {
|
|
114
|
+
const result = validator(value, ruleWithoutValidator);
|
|
115
|
+
if (isPromise(result)) {
|
|
116
|
+
return new Promise((r, j) => {
|
|
117
|
+
result.then((res) => {
|
|
118
|
+
if (!res) {
|
|
119
|
+
tipMessage(errorMsg);
|
|
120
|
+
r(errorMsg);
|
|
121
|
+
} else {
|
|
122
|
+
r(true);
|
|
123
|
+
}
|
|
124
|
+
}).catch((e) => j(e));
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
if (!result) {
|
|
128
|
+
return _Promise(errorMsg);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return Promise.resolve(true);
|
|
134
|
+
};
|
|
135
|
+
const validate = (customProp = "") => {
|
|
136
|
+
return new Promise((resolve, reject) => {
|
|
137
|
+
try {
|
|
138
|
+
const task = findFormItem(slots.default());
|
|
139
|
+
const errors = task.map((item) => {
|
|
140
|
+
if (customProp) {
|
|
141
|
+
if (customProp == item.prop) {
|
|
142
|
+
return checkRule(item);
|
|
143
|
+
} else {
|
|
144
|
+
return Promise.resolve(true);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
return checkRule(item);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Promise.all(errors).then((errorRes) => {
|
|
151
|
+
errorRes = errorRes.filter((item) => item != true);
|
|
152
|
+
const res = { valid: true, errors: [] };
|
|
153
|
+
if (errorRes.length) {
|
|
154
|
+
res.valid = false;
|
|
155
|
+
res.errors = errorRes;
|
|
156
|
+
}
|
|
157
|
+
resolve(res);
|
|
158
|
+
});
|
|
159
|
+
} catch (error) {
|
|
160
|
+
reject(error);
|
|
161
|
+
}
|
|
95
162
|
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
163
|
+
};
|
|
164
|
+
const submit = () => {
|
|
165
|
+
validate();
|
|
166
|
+
return false;
|
|
167
|
+
};
|
|
168
|
+
return { validate, reset, submit, formErrorTip };
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const { create } = createComponent("form");
|
|
173
|
+
const _sfc_main = create(
|
|
174
|
+
component({
|
|
175
|
+
[CellGroup.name]: CellGroup
|
|
105
176
|
})
|
|
106
177
|
);
|
|
107
|
-
function
|
|
108
|
-
const
|
|
109
|
-
return
|
|
178
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
179
|
+
const _component_nut_cell_group = resolveComponent("nut-cell-group");
|
|
180
|
+
return openBlock(), createElementBlock("form", {
|
|
110
181
|
class: "nut-form",
|
|
111
182
|
action: "#",
|
|
112
|
-
onSubmit:
|
|
183
|
+
onSubmit: _cache[0] || (_cache[0] = withModifiers(() => false, ["prevent"]))
|
|
113
184
|
}, [
|
|
114
|
-
|
|
115
|
-
default:
|
|
116
|
-
|
|
185
|
+
createVNode(_component_nut_cell_group, null, {
|
|
186
|
+
default: withCtx(() => [
|
|
187
|
+
renderSlot(_ctx.$slots, "default")
|
|
117
188
|
]),
|
|
118
189
|
_: 3
|
|
119
190
|
})
|
|
120
191
|
], 32);
|
|
121
192
|
}
|
|
122
|
-
const
|
|
193
|
+
const Form = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
123
194
|
export {
|
|
124
|
-
|
|
195
|
+
Form as default
|
|
125
196
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { inject
|
|
3
|
-
import { c as
|
|
4
|
-
import
|
|
5
|
-
import { _ as
|
|
1
|
+
import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
|
|
2
|
+
import { inject, provide, computed, resolveComponent, openBlock, createBlock, normalizeClass, normalizeStyle, withCtx, createElementBlock, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode } from "vue";
|
|
3
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
4
|
+
import Cell from "./Cell.js";
|
|
5
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
6
6
|
import "../locale/lang";
|
|
7
|
-
import "./index-
|
|
7
|
+
import "./index-54d03fc1.js";
|
|
8
8
|
import "@nutui/icons-vue";
|
|
9
|
-
const { componentName
|
|
10
|
-
|
|
9
|
+
const { componentName, create } = createComponent("form-item");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
inheritAttrs: false,
|
|
11
12
|
props: {
|
|
12
13
|
prop: {
|
|
13
14
|
type: String,
|
|
@@ -19,19 +20,21 @@ const { componentName: I, create: k } = C("form-item"), B = k({
|
|
|
19
20
|
},
|
|
20
21
|
rules: {
|
|
21
22
|
type: Array,
|
|
22
|
-
default: () =>
|
|
23
|
+
default: () => {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
23
26
|
},
|
|
24
27
|
required: {
|
|
25
28
|
type: Boolean,
|
|
26
|
-
default:
|
|
29
|
+
default: false
|
|
27
30
|
},
|
|
28
31
|
showErrorMessage: {
|
|
29
32
|
type: Boolean,
|
|
30
|
-
default:
|
|
33
|
+
default: true
|
|
31
34
|
},
|
|
32
35
|
showErrorLine: {
|
|
33
36
|
type: Boolean,
|
|
34
|
-
default:
|
|
37
|
+
default: true
|
|
35
38
|
},
|
|
36
39
|
labelWidth: {
|
|
37
40
|
type: [String, Number],
|
|
@@ -51,59 +54,69 @@ const { componentName: I, create: k } = C("form-item"), B = k({
|
|
|
51
54
|
}
|
|
52
55
|
},
|
|
53
56
|
components: {
|
|
54
|
-
[
|
|
57
|
+
[Cell.name]: Cell
|
|
55
58
|
},
|
|
56
59
|
emits: [""],
|
|
57
|
-
setup(
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
props
|
|
60
|
+
setup(props, { emit, slots }) {
|
|
61
|
+
const parent = inject("formErrorTip");
|
|
62
|
+
provide("form", {
|
|
63
|
+
props
|
|
61
64
|
});
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
const labelStyle = computed(() => {
|
|
66
|
+
return {
|
|
67
|
+
width: pxCheck(props.labelWidth),
|
|
68
|
+
textAlign: props.labelAlign
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
const bodyStyle = computed(() => {
|
|
72
|
+
return {
|
|
73
|
+
textAlign: props.bodyAlign
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const errorMessageStyle = computed(() => {
|
|
77
|
+
return {
|
|
78
|
+
textAlign: props.errorMessageAlign
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
const getSlots = (name) => slots[name];
|
|
82
|
+
return { parent, labelStyle, bodyStyle, errorMessageStyle, getSlots };
|
|
71
83
|
}
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
});
|
|
85
|
+
const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
|
|
86
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
87
|
+
const _component_nut_cell = resolveComponent("nut-cell");
|
|
88
|
+
return openBlock(), createBlock(_component_nut_cell, {
|
|
89
|
+
class: normalizeClass(["nut-form-item", [{ error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }, _ctx.$attrs.class]]),
|
|
90
|
+
style: normalizeStyle(_ctx.$attrs.style)
|
|
78
91
|
}, {
|
|
79
|
-
default:
|
|
80
|
-
|
|
92
|
+
default: withCtx(() => [
|
|
93
|
+
_ctx.label || _ctx.getSlots("label") ? (openBlock(), createElementBlock("view", {
|
|
81
94
|
key: 0,
|
|
82
|
-
class:
|
|
83
|
-
style:
|
|
95
|
+
class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
|
|
96
|
+
style: normalizeStyle(_ctx.labelStyle)
|
|
84
97
|
}, [
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
99
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
87
100
|
])
|
|
88
|
-
], 6)) :
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
], 6)) : createCommentVNode("", true),
|
|
102
|
+
createElementVNode("view", _hoisted_1, [
|
|
103
|
+
createElementVNode("view", {
|
|
91
104
|
class: "nut-form-item__body__slots",
|
|
92
|
-
style:
|
|
105
|
+
style: normalizeStyle(_ctx.bodyStyle)
|
|
93
106
|
}, [
|
|
94
|
-
|
|
107
|
+
renderSlot(_ctx.$slots, "default")
|
|
95
108
|
], 4),
|
|
96
|
-
|
|
109
|
+
_ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
|
|
97
110
|
key: 0,
|
|
98
111
|
class: "nut-form-item__body__tips",
|
|
99
|
-
style:
|
|
100
|
-
},
|
|
112
|
+
style: normalizeStyle(_ctx.errorMessageStyle)
|
|
113
|
+
}, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
|
|
101
114
|
])
|
|
102
115
|
]),
|
|
103
116
|
_: 3
|
|
104
117
|
}, 8, ["class", "style"]);
|
|
105
118
|
}
|
|
106
|
-
const
|
|
119
|
+
const FormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
107
120
|
export {
|
|
108
|
-
|
|
121
|
+
FormItem as default
|
|
109
122
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
2
2
|
import "vue";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as component } from "./common-b9a5e726.js";
|
|
4
4
|
import "../locale/lang";
|
|
5
|
-
import "./pxCheck-
|
|
6
|
-
const { create
|
|
5
|
+
import "./pxCheck-c6b9f6b7.js";
|
|
6
|
+
const { create } = createComponent("grid");
|
|
7
|
+
const _sfc_main = create(component);
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
_sfc_main as default
|
|
9
10
|
};
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import { inject
|
|
2
|
-
import { u as
|
|
3
|
-
import { c as
|
|
4
|
-
import { p as
|
|
5
|
-
import { G as
|
|
6
|
-
import { _ as
|
|
1
|
+
import { inject, getCurrentInstance, onUnmounted, computed, ref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, Fragment, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { u as useRouter } from "./index-54d03fc1.js";
|
|
3
|
+
import { c as createComponent } from "./component-81a4c1d0.js";
|
|
4
|
+
import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
|
|
5
|
+
import { G as GRID_KEY } from "./common-b9a5e726.js";
|
|
6
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
7
7
|
import "../locale/lang";
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
function useInject(key) {
|
|
9
|
+
const parent = inject(key, null);
|
|
10
|
+
if (parent) {
|
|
11
|
+
const instance = getCurrentInstance();
|
|
12
|
+
const { add, remove, internalChildren } = parent;
|
|
13
|
+
add(instance);
|
|
14
|
+
onUnmounted(() => remove(instance));
|
|
15
|
+
const index2 = computed(() => internalChildren.indexOf(instance));
|
|
14
16
|
return {
|
|
15
|
-
parent
|
|
16
|
-
index:
|
|
17
|
+
parent,
|
|
18
|
+
index: index2
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
21
|
return {
|
|
20
22
|
parent: null,
|
|
21
|
-
index:
|
|
23
|
+
index: ref(-1)
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
|
-
const { create
|
|
26
|
+
const { create, componentName } = createComponent("grid-item");
|
|
27
|
+
const _sfc_main = create({
|
|
25
28
|
props: {
|
|
26
29
|
text: {
|
|
27
30
|
type: String
|
|
@@ -36,63 +39,86 @@ const { create: E, componentName: C } = B("grid-item"), I = E({
|
|
|
36
39
|
},
|
|
37
40
|
replace: {
|
|
38
41
|
type: Boolean,
|
|
39
|
-
default:
|
|
42
|
+
default: false
|
|
40
43
|
}
|
|
41
44
|
},
|
|
42
45
|
emits: ["click"],
|
|
43
|
-
setup(
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
46
|
+
setup(props, { emit }) {
|
|
47
|
+
const Parent = useInject(GRID_KEY);
|
|
48
|
+
if (!Parent.parent)
|
|
46
49
|
return {};
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const index2 = Parent.index;
|
|
51
|
+
const parent = Parent.parent.props;
|
|
52
|
+
const rootClass = computed(() => {
|
|
53
|
+
const prefixCls = componentName;
|
|
54
|
+
return {
|
|
55
|
+
[prefixCls]: true
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
const rootStyle = computed(() => {
|
|
59
|
+
const style = {
|
|
60
|
+
flexBasis: `${100 / +parent.columnNum}%`
|
|
52
61
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
if (parent.square) {
|
|
63
|
+
style.paddingTop = `${100 / +parent.columnNum}%`;
|
|
64
|
+
} else if (parent.gutter) {
|
|
65
|
+
style.paddingRight = pxCheck(parent.gutter);
|
|
66
|
+
if (index2.value >= parent.columnNum) {
|
|
67
|
+
style.marginTop = pxCheck(parent.gutter);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return style;
|
|
71
|
+
});
|
|
72
|
+
const contentClass = computed(() => {
|
|
73
|
+
const prefixCls = `${componentName}__content`;
|
|
56
74
|
return {
|
|
57
|
-
[`${
|
|
58
|
-
[`${
|
|
59
|
-
[`${
|
|
60
|
-
[`${
|
|
61
|
-
[`${
|
|
62
|
-
[`${
|
|
63
|
-
[`${
|
|
64
|
-
[`${
|
|
75
|
+
[`${prefixCls}`]: true,
|
|
76
|
+
[`${prefixCls}--border`]: parent.border,
|
|
77
|
+
[`${prefixCls}--surround`]: parent.border && parent.gutter,
|
|
78
|
+
[`${prefixCls}--center`]: parent.center,
|
|
79
|
+
[`${prefixCls}--square`]: parent.square,
|
|
80
|
+
[`${prefixCls}--reverse`]: parent.reverse,
|
|
81
|
+
[`${prefixCls}--${parent.direction}`]: !!parent.direction,
|
|
82
|
+
[`${prefixCls}--clickable`]: parent.clickable || props.to || props.url
|
|
65
83
|
};
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
});
|
|
85
|
+
const router = useRouter();
|
|
86
|
+
const handleClick = (event) => {
|
|
87
|
+
emit("click", event);
|
|
88
|
+
if (props.to && router) {
|
|
89
|
+
router[props.replace ? "replace" : "push"](props.to);
|
|
90
|
+
} else if (props.url) {
|
|
91
|
+
props.replace ? location.replace(props.url) : location.href = props.url;
|
|
73
92
|
}
|
|
74
93
|
};
|
|
94
|
+
return {
|
|
95
|
+
rootClass,
|
|
96
|
+
rootStyle,
|
|
97
|
+
contentClass,
|
|
98
|
+
handleClick
|
|
99
|
+
};
|
|
75
100
|
}
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
});
|
|
102
|
+
const _hoisted_1 = { class: "nut-grid-item__text" };
|
|
103
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
104
|
+
return openBlock(), createElementBlock("view", {
|
|
105
|
+
class: normalizeClass(_ctx.rootClass),
|
|
106
|
+
style: normalizeStyle(_ctx.rootStyle),
|
|
107
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
82
108
|
}, [
|
|
83
|
-
|
|
84
|
-
class:
|
|
109
|
+
createElementVNode("view", {
|
|
110
|
+
class: normalizeClass(_ctx.contentClass)
|
|
85
111
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
], 64)) :
|
|
112
|
+
renderSlot(_ctx.$slots, "default"),
|
|
113
|
+
createElementVNode("view", _hoisted_1, [
|
|
114
|
+
_ctx.text ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
115
|
+
createTextVNode(toDisplayString(_ctx.text), 1)
|
|
116
|
+
], 64)) : renderSlot(_ctx.$slots, "text", { key: 1 })
|
|
91
117
|
])
|
|
92
118
|
], 2)
|
|
93
119
|
], 6);
|
|
94
120
|
}
|
|
95
|
-
const
|
|
121
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
96
122
|
export {
|
|
97
|
-
|
|
123
|
+
index as default
|
|
98
124
|
};
|