@nutui/nutui 3.1.11 → 3.1.13-beta.1
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/CHANGELOG.md +27 -0
- package/README.md +148 -37
- package/dist/nutui.d.ts +8 -2
- package/dist/nutui.es.js +5088 -3730
- package/dist/nutui.umd.js +5100 -3736
- package/dist/packages/_es/ActionSheet.js +1 -1
- package/dist/packages/_es/Address.js +3 -1
- package/dist/packages/_es/Avatar.js +1 -1
- package/dist/packages/_es/BackTop.js +1 -1
- package/dist/packages/_es/Badge.js +1 -1
- package/dist/packages/_es/Barrage.js +1 -1
- package/dist/packages/_es/Button.js +1 -1
- package/dist/packages/_es/Calendar.js +1 -1
- package/dist/packages/_es/Card.js +105 -0
- package/dist/packages/_es/Cascader.js +547 -0
- package/dist/packages/_es/Cell.js +1 -1
- package/dist/packages/_es/CellGroup.js +10 -4
- package/dist/packages/_es/Checkbox.js +1 -1
- package/dist/packages/_es/CheckboxGroup.js +2 -2
- package/dist/packages/_es/CircleProgress.js +1 -1
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +1 -1
- package/dist/packages/_es/CollapseItem.js +1 -1
- package/dist/packages/_es/CountDown.js +2 -2
- package/dist/packages/_es/CountUp.js +3 -1
- package/dist/packages/_es/DatePicker.js +2 -2
- package/dist/packages/_es/Dialog.js +10 -23
- package/dist/packages/_es/Divider.js +1 -1
- package/dist/packages/_es/Drag.js +1 -1
- package/dist/packages/_es/Elevator.js +3 -2
- package/dist/packages/_es/FixedNav.js +1 -1
- package/dist/packages/_es/Form.js +138 -0
- package/dist/packages/_es/FormItem.js +110 -0
- package/dist/packages/_es/Grid.js +12 -0
- package/dist/packages/_es/GridItem.js +149 -0
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +148 -32
- package/dist/packages/_es/InfiniteLoading.js +1 -1
- package/dist/packages/_es/Input.js +1 -1
- package/dist/packages/_es/InputNumber.js +1 -1
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/Menu.js +83 -167
- package/dist/packages/_es/MenuItem.js +154 -15
- package/dist/packages/_es/Navbar.js +1 -1
- package/dist/packages/_es/NoticeBar.js +6 -8
- package/dist/packages/_es/Notify.js +1 -1
- package/dist/packages/_es/NumberKeyboard.js +9 -7
- package/dist/packages/_es/OverLay.js +1 -1
- package/dist/packages/_es/Pagination.js +1 -1
- package/dist/packages/_es/Picker.js +2 -2
- package/dist/packages/_es/Popover.js +11 -17
- package/dist/packages/_es/Popup.js +52 -13
- package/dist/packages/_es/Price.js +1 -1
- package/dist/packages/_es/Progress.js +1 -1
- package/dist/packages/_es/Radio.js +1 -1
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +4 -32
- package/dist/packages/_es/Rate.js +19 -5
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +1 -1
- package/dist/packages/_es/ShortPassword.js +1 -1
- package/dist/packages/_es/Signature.js +1 -1
- package/dist/packages/_es/Sku.js +2 -37
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Swipe.js +2 -2
- package/dist/packages/_es/Swiper.js +11 -11
- package/dist/packages/_es/SwiperItem.js +3 -3
- package/dist/packages/_es/Switch.js +28 -8
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +1 -1
- package/dist/packages/_es/TabbarItem.js +1 -1
- package/dist/packages/_es/Tabs.js +6 -2
- package/dist/packages/_es/Tag.js +1 -1
- package/dist/packages/_es/TextArea.js +1 -1
- package/dist/packages/_es/TimeDetail.js +1 -1
- package/dist/packages/_es/TimePannel.js +1 -1
- package/dist/packages/_es/TimeSelect.js +1 -1
- package/dist/packages/_es/Toast.js +18 -8
- package/dist/packages/_es/Uploader.js +30 -22
- package/dist/packages/_es/Video.js +3 -3
- package/dist/packages/_es/common.js +136 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +7 -58
- package/dist/packages/_es/index2.js +58 -7
- package/dist/packages/_es/index3.js +36 -0
- package/dist/packages/_es/plugin-vue_export-helper.js +4 -3
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +47 -0
- package/dist/packages/button/index.scss +6 -0
- package/dist/packages/card/index.scss +97 -0
- package/dist/packages/cascader/index.scss +81 -0
- package/dist/packages/cellgroup/index.scss +9 -0
- package/dist/packages/checkbox/index.scss +1 -1
- package/dist/packages/dialog/index.scss +17 -0
- package/dist/packages/drag/index.scss +4 -0
- package/dist/packages/fixednav/index.scss +6 -1
- package/dist/packages/form/index.scss +2 -0
- package/dist/packages/formitem/index.scss +63 -0
- package/dist/packages/grid/index.scss +10 -0
- package/dist/packages/griditem/index.scss +92 -0
- package/dist/packages/icon/index.scss +2 -1
- package/dist/packages/menu/index.scss +32 -60
- package/dist/packages/menuitem/index.scss +36 -99
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/popover/index.scss +2 -2
- package/dist/packages/rate/index.scss +1 -0
- package/dist/packages/switch/index.scss +1 -1
- package/dist/packages/tabs/index.scss +16 -0
- package/dist/packages/textarea/index.scss +1 -0
- package/dist/packages/timedetail/index.scss +1 -2
- package/dist/packages/timeselect/index.scss +3 -0
- package/dist/packages/toast/index.scss +6 -0
- package/dist/style.css +1 -1
- package/dist/styles/font/config.json +2 -1
- package/dist/styles/font/demo_index.html +26 -3
- package/dist/styles/font/iconfont.css +7 -3
- package/dist/styles/font/iconfont.js +31 -32
- package/dist/styles/font/iconfont.json +7 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +39 -33
- package/dist/styles/variables.scss +54 -1
- package/package.json +3 -4
- package/dist/packages/_es/style.css +0 -160
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -26,7 +26,7 @@ import { reactive, computed, onMounted, watch, toRefs, resolveComponent, openBlo
|
|
|
26
26
|
import picker from "./Picker.js";
|
|
27
27
|
import { c as createComponent } from "./component.js";
|
|
28
28
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
-
import "./
|
|
29
|
+
import "./index2.js";
|
|
30
30
|
import "./Popup.js";
|
|
31
31
|
import "./OverLay.js";
|
|
32
32
|
import "./Icon.js";
|
|
@@ -22,7 +22,7 @@ var __publicField = (obj, key, value) => {
|
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
24
|
/*!
|
|
25
|
-
* @nutui/nutui v3.1.
|
|
25
|
+
* @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
|
|
26
26
|
* (c) 2021 @jdf2e.
|
|
27
27
|
* Released under the MIT License.
|
|
28
28
|
*/
|
|
@@ -86,25 +86,13 @@ const _sfc_main = create({
|
|
|
86
86
|
type: String,
|
|
87
87
|
default: "center"
|
|
88
88
|
},
|
|
89
|
-
onOk: {
|
|
90
|
-
type: Function,
|
|
91
|
-
default: null
|
|
92
|
-
},
|
|
93
|
-
onCancel: {
|
|
94
|
-
type: Function,
|
|
95
|
-
default: null
|
|
96
|
-
},
|
|
97
|
-
onClose: {
|
|
98
|
-
type: Function,
|
|
99
|
-
default: null
|
|
100
|
-
},
|
|
101
|
-
onClosed: {
|
|
102
|
-
type: Function,
|
|
103
|
-
default: null
|
|
104
|
-
},
|
|
105
89
|
closeOnPopstate: {
|
|
106
90
|
type: Boolean,
|
|
107
91
|
default: false
|
|
92
|
+
},
|
|
93
|
+
footerDirection: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: "horizontal"
|
|
108
96
|
}
|
|
109
97
|
}),
|
|
110
98
|
emits: ["update", "update:visible", "ok", "cancel", "open", "opened", "close", "closed"],
|
|
@@ -157,10 +145,6 @@ const _hoisted_1 = {
|
|
|
157
145
|
class: "nut-dialog__header"
|
|
158
146
|
};
|
|
159
147
|
const _hoisted_2 = ["innerHTML"];
|
|
160
|
-
const _hoisted_3 = {
|
|
161
|
-
key: 1,
|
|
162
|
-
class: "nut-dialog__footer"
|
|
163
|
-
};
|
|
164
148
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
165
149
|
const _component_nut_button = resolveComponent("nut-button");
|
|
166
150
|
const _component_nut_popup = resolveComponent("nut-popup");
|
|
@@ -192,7 +176,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
192
176
|
innerHTML: _ctx.content
|
|
193
177
|
}, null, 8, _hoisted_2))
|
|
194
178
|
], 4),
|
|
195
|
-
!_ctx.noFooter ? (openBlock(), createElementBlock("view",
|
|
179
|
+
!_ctx.noFooter ? (openBlock(), createElementBlock("view", {
|
|
180
|
+
key: 1,
|
|
181
|
+
class: normalizeClass(["nut-dialog__footer", { [_ctx.footerDirection]: _ctx.footerDirection }])
|
|
182
|
+
}, [
|
|
196
183
|
_ctx.$slots.footer ? renderSlot(_ctx.$slots, "footer", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
197
184
|
!_ctx.noCancelBtn ? (openBlock(), createBlock(_component_nut_button, {
|
|
198
185
|
key: 0,
|
|
@@ -221,7 +208,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
221
208
|
_: 1
|
|
222
209
|
}, 8, ["class", "disabled", "onClick"])) : createCommentVNode("", true)
|
|
223
210
|
], 64))
|
|
224
|
-
])) : createCommentVNode("", true)
|
|
211
|
+
], 2)) : createCommentVNode("", true)
|
|
225
212
|
], 2)
|
|
226
213
|
]),
|
|
227
214
|
_: 3
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -165,6 +165,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
165
165
|
return openBlock(), createElementBlock("view", {
|
|
166
166
|
class: "nut-elevator__list__item",
|
|
167
167
|
key: item[_ctx.acceptKey],
|
|
168
|
+
ref_for: true,
|
|
168
169
|
ref: _ctx.setListGroup
|
|
169
170
|
}, [
|
|
170
171
|
createElementVNode("view", _hoisted_1, toDisplayString(item[_ctx.acceptKey]), 1),
|
|
@@ -176,7 +177,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
176
177
|
innerHTML: subitem.name
|
|
177
178
|
}, null, 8, _hoisted_2);
|
|
178
179
|
}), 128))
|
|
179
|
-
]
|
|
180
|
+
]);
|
|
180
181
|
}), 128))
|
|
181
182
|
], 4),
|
|
182
183
|
_ctx.indexList.length ? withDirectives((openBlock(), createElementBlock("view", {
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
|
+
import { i as isPromise } from "./util.js";
|
|
8
|
+
import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, renderSlot } from "vue";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
|
+
const component = {
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: {}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
components: {},
|
|
18
|
+
emits: ["validate"],
|
|
19
|
+
setup(props, { emit, slots }) {
|
|
20
|
+
const formErrorTip = computed(() => reactive({}));
|
|
21
|
+
provide("formErrorTip", formErrorTip);
|
|
22
|
+
const init = (value = props.modelValue) => {
|
|
23
|
+
Object.keys(value).forEach((item) => {
|
|
24
|
+
formErrorTip.value[item] = "";
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const reset = () => {
|
|
28
|
+
init();
|
|
29
|
+
};
|
|
30
|
+
watch(() => props.modelValue, (value) => {
|
|
31
|
+
init(value);
|
|
32
|
+
}, { immediate: true });
|
|
33
|
+
const findFormItem = (vnodes) => {
|
|
34
|
+
let task = [];
|
|
35
|
+
vnodes.forEach((vnode, index2) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
let type = vnode.type;
|
|
38
|
+
type = type.name || type;
|
|
39
|
+
if (type == "nut-form-item") {
|
|
40
|
+
task.push({
|
|
41
|
+
prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
|
|
42
|
+
rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return task;
|
|
47
|
+
};
|
|
48
|
+
const tipMessage = (errorMsg) => {
|
|
49
|
+
if (errorMsg.message) {
|
|
50
|
+
emit("validate", errorMsg);
|
|
51
|
+
}
|
|
52
|
+
formErrorTip.value[errorMsg.prop] = errorMsg.message;
|
|
53
|
+
};
|
|
54
|
+
const checkRule = (item) => {
|
|
55
|
+
const { rules, prop } = item;
|
|
56
|
+
const _Promise = (errorMsg) => {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
tipMessage(errorMsg);
|
|
59
|
+
resolve(errorMsg);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const value = props.modelValue[prop];
|
|
63
|
+
tipMessage({ prop, message: "" });
|
|
64
|
+
while (rules.length) {
|
|
65
|
+
const { required, validator, regex, message } = rules.shift();
|
|
66
|
+
const errorMsg = { prop, message };
|
|
67
|
+
if (required) {
|
|
68
|
+
if (!value) {
|
|
69
|
+
return _Promise(errorMsg);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (regex && !regex.test(String(value))) {
|
|
73
|
+
return _Promise(errorMsg);
|
|
74
|
+
}
|
|
75
|
+
if (validator) {
|
|
76
|
+
const result = validator(value);
|
|
77
|
+
if (isPromise(result)) {
|
|
78
|
+
return new Promise((r, j) => {
|
|
79
|
+
result.then((res) => {
|
|
80
|
+
if (!res) {
|
|
81
|
+
tipMessage(errorMsg);
|
|
82
|
+
r(errorMsg);
|
|
83
|
+
} else {
|
|
84
|
+
r(true);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
if (!result) {
|
|
90
|
+
return _Promise(errorMsg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return Promise.resolve(true);
|
|
96
|
+
};
|
|
97
|
+
const validate = () => {
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
let task = findFormItem(slots.default());
|
|
100
|
+
let errors = task.map((item) => {
|
|
101
|
+
return checkRule(item);
|
|
102
|
+
});
|
|
103
|
+
Promise.all(errors).then((errorRes) => {
|
|
104
|
+
errorRes = errorRes.filter((item) => item != true);
|
|
105
|
+
const res = { valid: true, errors: [] };
|
|
106
|
+
if (errorRes.length) {
|
|
107
|
+
res.valid = false;
|
|
108
|
+
res.errors = errorRes;
|
|
109
|
+
}
|
|
110
|
+
resolve(res);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
const onSubmit = () => {
|
|
115
|
+
validate();
|
|
116
|
+
return false;
|
|
117
|
+
};
|
|
118
|
+
return { validate, reset, onSubmit, formErrorTip };
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const { create } = createComponent("form");
|
|
122
|
+
const _sfc_main = create(component);
|
|
123
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
124
|
+
const _component_nut_cell_group = resolveComponent("nut-cell-group");
|
|
125
|
+
return openBlock(), createElementBlock("form", {
|
|
126
|
+
class: "nut-form",
|
|
127
|
+
onSubmit: _cache[0] || (_cache[0] = (...args) => _ctx.onSubmit && _ctx.onSubmit(...args))
|
|
128
|
+
}, [
|
|
129
|
+
createVNode(_component_nut_cell_group, null, {
|
|
130
|
+
default: withCtx(() => [
|
|
131
|
+
renderSlot(_ctx.$slots, "default")
|
|
132
|
+
]),
|
|
133
|
+
_: 3
|
|
134
|
+
})
|
|
135
|
+
], 32);
|
|
136
|
+
}
|
|
137
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
138
|
+
export { index as default };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
7
|
+
import { inject, computed, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementBlock, normalizeStyle, toDisplayString, createCommentVNode, createElementVNode, renderSlot } from "vue";
|
|
8
|
+
import { c as createComponent } from "./component.js";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
|
+
const { componentName, create } = createComponent("form-item");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
prop: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default: () => {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
required: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
showErrorMessage: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
showErrorLine: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
labelWidth: {
|
|
41
|
+
type: [String, Number],
|
|
42
|
+
default: ""
|
|
43
|
+
},
|
|
44
|
+
labelAlign: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "left"
|
|
47
|
+
},
|
|
48
|
+
errorMessageAlign: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "left"
|
|
51
|
+
},
|
|
52
|
+
bodyAlign: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "left"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
components: {},
|
|
58
|
+
emits: [""],
|
|
59
|
+
setup(props, { emit }) {
|
|
60
|
+
const parent = inject("formErrorTip");
|
|
61
|
+
const labelStyle = computed(() => {
|
|
62
|
+
return {
|
|
63
|
+
width: pxCheck(props.labelWidth),
|
|
64
|
+
textAlign: props.labelAlign
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
const bodyStyle = computed(() => {
|
|
68
|
+
return {
|
|
69
|
+
textAlign: props.bodyAlign
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
const errorMessageStyle = computed(() => {
|
|
73
|
+
return {
|
|
74
|
+
textAlign: props.errorMessageAlign
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
return { parent, labelStyle, bodyStyle, errorMessageStyle };
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
|
|
81
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
82
|
+
const _component_nut_cell = resolveComponent("nut-cell");
|
|
83
|
+
return openBlock(), createBlock(_component_nut_cell, {
|
|
84
|
+
class: normalizeClass(["nut-form-item", { error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }])
|
|
85
|
+
}, {
|
|
86
|
+
default: withCtx(() => [
|
|
87
|
+
_ctx.label ? (openBlock(), createElementBlock("view", {
|
|
88
|
+
key: 0,
|
|
89
|
+
class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
|
|
90
|
+
style: normalizeStyle(_ctx.labelStyle)
|
|
91
|
+
}, toDisplayString(_ctx.label), 7)) : createCommentVNode("", true),
|
|
92
|
+
createElementVNode("view", _hoisted_1, [
|
|
93
|
+
createElementVNode("view", {
|
|
94
|
+
class: "nut-form-item__body__slots",
|
|
95
|
+
style: normalizeStyle(_ctx.bodyStyle)
|
|
96
|
+
}, [
|
|
97
|
+
renderSlot(_ctx.$slots, "default")
|
|
98
|
+
], 4),
|
|
99
|
+
_ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
|
|
100
|
+
key: 0,
|
|
101
|
+
class: "nut-form-item__body__tips",
|
|
102
|
+
style: normalizeStyle(_ctx.errorMessageStyle)
|
|
103
|
+
}, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
|
|
104
|
+
])
|
|
105
|
+
]),
|
|
106
|
+
_: 3
|
|
107
|
+
}, 8, ["class"]);
|
|
108
|
+
}
|
|
109
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
110
|
+
export { index as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
|
+
import { c as component } from "./common.js";
|
|
8
|
+
import "vue";
|
|
9
|
+
import "./pxCheck.js";
|
|
10
|
+
const { create } = createComponent("grid");
|
|
11
|
+
const _sfc_main = create(component);
|
|
12
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.13-beta.1 Mon Dec 13 2021 11:01:35 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { inject, getCurrentInstance, onUnmounted, computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, Fragment, createBlock, toDisplayString } from "vue";
|
|
7
|
+
import { useRouter } from "vue-router";
|
|
8
|
+
import { c as createComponent } from "./component.js";
|
|
9
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
10
|
+
import { G as GRID_KEY } from "./common.js";
|
|
11
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
12
|
+
function useInject(key) {
|
|
13
|
+
const parent = inject(key, null);
|
|
14
|
+
if (parent) {
|
|
15
|
+
const instance = getCurrentInstance();
|
|
16
|
+
const { add, remove, internalChildren } = parent;
|
|
17
|
+
add(instance);
|
|
18
|
+
onUnmounted(() => remove(instance));
|
|
19
|
+
const index2 = computed(() => internalChildren.indexOf(instance));
|
|
20
|
+
return {
|
|
21
|
+
parent,
|
|
22
|
+
index: index2
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
parent: null,
|
|
27
|
+
index: ref(-1)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const { create, componentName } = createComponent("grid-item");
|
|
31
|
+
const _sfc_main = create({
|
|
32
|
+
props: {
|
|
33
|
+
text: {
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
36
|
+
icon: {
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
iconSize: {
|
|
40
|
+
type: [Number, String]
|
|
41
|
+
},
|
|
42
|
+
iconColor: {
|
|
43
|
+
type: String
|
|
44
|
+
},
|
|
45
|
+
to: {
|
|
46
|
+
type: [String, Object]
|
|
47
|
+
},
|
|
48
|
+
url: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: ""
|
|
51
|
+
},
|
|
52
|
+
replace: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
emits: ["click"],
|
|
58
|
+
setup(props, { emit }) {
|
|
59
|
+
const Parent = useInject(GRID_KEY);
|
|
60
|
+
if (!Parent.parent)
|
|
61
|
+
return;
|
|
62
|
+
const index2 = Parent.index;
|
|
63
|
+
const parent = Parent.parent.props;
|
|
64
|
+
const rootClass = computed(() => {
|
|
65
|
+
const prefixCls = componentName;
|
|
66
|
+
return {
|
|
67
|
+
[prefixCls]: true
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
const rootStyle = computed(() => {
|
|
71
|
+
const style = {
|
|
72
|
+
flexBasis: `${100 / +parent.columnNum}%`
|
|
73
|
+
};
|
|
74
|
+
if (parent.square) {
|
|
75
|
+
style.paddingTop = `${100 / +parent.columnNum}%`;
|
|
76
|
+
} else if (parent.gutter) {
|
|
77
|
+
style.paddingRight = pxCheck(parent.gutter);
|
|
78
|
+
if (index2.value >= parent.columnNum) {
|
|
79
|
+
style.marginTop = pxCheck(parent.gutter);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return style;
|
|
83
|
+
});
|
|
84
|
+
const contentClass = computed(() => {
|
|
85
|
+
const prefixCls = `${componentName}__content`;
|
|
86
|
+
return {
|
|
87
|
+
[`${prefixCls}`]: true,
|
|
88
|
+
[`${prefixCls}--border`]: parent.border,
|
|
89
|
+
[`${prefixCls}--surround`]: parent.border && parent.gutter,
|
|
90
|
+
[`${prefixCls}--center`]: parent.center,
|
|
91
|
+
[`${prefixCls}--square`]: parent.square,
|
|
92
|
+
[`${prefixCls}--reverse`]: parent.reverse,
|
|
93
|
+
[`${prefixCls}--${parent.direction}`]: !!parent.direction,
|
|
94
|
+
[`${prefixCls}--clickable`]: parent.clickable || props.to || props.url
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
const iconProps = computed(() => {
|
|
98
|
+
return {
|
|
99
|
+
name: props.icon,
|
|
100
|
+
size: props.iconSize || parent.iconSize,
|
|
101
|
+
color: props.iconColor || parent.iconColor
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
const router = useRouter();
|
|
105
|
+
const handleClick = (event) => {
|
|
106
|
+
emit("click", event);
|
|
107
|
+
if (props.to && router) {
|
|
108
|
+
router[props.replace ? "replace" : "push"](props.to);
|
|
109
|
+
} else if (props.url) {
|
|
110
|
+
props.replace ? location.replace(props.url) : location.href = props.url;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
rootClass,
|
|
115
|
+
rootStyle,
|
|
116
|
+
contentClass,
|
|
117
|
+
iconProps,
|
|
118
|
+
handleClick
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const _hoisted_1 = {
|
|
123
|
+
key: 3,
|
|
124
|
+
class: "nut-grid-item__text"
|
|
125
|
+
};
|
|
126
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
127
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
128
|
+
return openBlock(), createElementBlock("view", {
|
|
129
|
+
class: normalizeClass(_ctx.rootClass),
|
|
130
|
+
style: normalizeStyle(_ctx.rootStyle),
|
|
131
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
132
|
+
}, [
|
|
133
|
+
createElementVNode("view", {
|
|
134
|
+
class: normalizeClass(_ctx.contentClass)
|
|
135
|
+
}, [
|
|
136
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
137
|
+
_ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 0 }) : (openBlock(), createBlock(_component_nut_icon, {
|
|
138
|
+
key: 1,
|
|
139
|
+
name: _ctx.iconProps.name,
|
|
140
|
+
size: _ctx.iconProps.size,
|
|
141
|
+
color: _ctx.iconProps.color
|
|
142
|
+
}, null, 8, ["name", "size", "color"])),
|
|
143
|
+
_ctx.$slots.text ? renderSlot(_ctx.$slots, "text", { key: 2 }) : (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.text), 1))
|
|
144
|
+
], 64))
|
|
145
|
+
], 2)
|
|
146
|
+
], 6);
|
|
147
|
+
}
|
|
148
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
149
|
+
export { index as default };
|