@nutui/nutui 3.1.6 → 3.1.7
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 +40 -0
- package/dist/nutui.d.ts +7 -1
- package/dist/nutui.es.js +1097 -517
- package/dist/nutui.umd.js +1158 -571
- package/dist/packages/_es/ActionSheet.js +158 -0
- package/dist/packages/_es/Address.js +525 -0
- package/dist/packages/_es/Avatar.js +87 -0
- package/dist/packages/_es/BackTop.js +159 -0
- package/dist/packages/_es/Badge.js +90 -0
- package/dist/packages/_es/Barrage.js +118 -0
- package/dist/packages/_es/Button.js +124 -0
- package/dist/packages/_es/Calendar.js +700 -0
- package/dist/packages/_es/Cell.js +95 -0
- package/dist/packages/_es/CellGroup.js +42 -0
- package/dist/packages/_es/Checkbox.js +109 -0
- package/dist/packages/_es/CheckboxGroup.js +62 -0
- package/dist/packages/_es/CircleProgress.js +109 -0
- package/dist/packages/_es/Col.js +53 -0
- package/dist/packages/_es/Collapse.js +89 -0
- package/dist/packages/_es/CollapseItem.js +257 -0
- package/dist/packages/_es/CountDown.js +224 -0
- package/dist/packages/_es/CountUp.js +547 -0
- package/dist/packages/_es/DatePicker.js +282 -0
- package/dist/packages/_es/Dialog.js +313 -0
- package/dist/packages/_es/Divider.js +49 -0
- package/dist/packages/_es/Drag.js +198 -0
- package/dist/packages/_es/Elevator.js +207 -0
- package/dist/packages/_es/FixedNav.js +127 -0
- package/dist/packages/_es/Icon.js +44 -0
- package/dist/packages/_es/ImagePreview.js +109 -0
- package/dist/packages/_es/InfiniteLoading.js +265 -0
- package/dist/packages/_es/Input.js +183 -0
- package/dist/packages/_es/InputNumber.js +172 -0
- package/dist/packages/_es/Layout.js +10 -0
- package/dist/packages/_es/MenuItem.js +180 -0
- package/dist/packages/_es/Navbar.js +160 -0
- package/dist/packages/_es/NoticeBar.js +389 -0
- package/dist/packages/_es/Notify.js +233 -0
- package/dist/packages/_es/NumberKeyboard.js +248 -0
- package/dist/packages/_es/OverLay.js +118 -0
- package/dist/packages/_es/Pagination.js +163 -0
- package/dist/packages/_es/Picker.js +485 -0
- package/dist/packages/_es/Popover.js +157 -0
- package/dist/packages/_es/Popup.js +268 -0
- package/dist/packages/_es/Price.js +104 -0
- package/dist/packages/_es/Progress.js +131 -0
- package/dist/packages/_es/Radio.js +72 -0
- package/dist/packages/_es/RadioGroup.js +37 -0
- package/dist/packages/_es/Range.js +350 -0
- package/dist/packages/_es/Rate.js +129 -0
- package/dist/packages/_es/Row.js +61 -0
- package/dist/packages/_es/ShortPassword.js +221 -0
- package/dist/packages/_es/Signature.js +167 -0
- package/dist/packages/_es/Step.js +116 -0
- package/dist/packages/_es/Steps.js +52 -0
- package/dist/packages/_es/Swipe.js +193 -0
- package/dist/packages/_es/Swiper.js +429 -0
- package/dist/packages/_es/SwiperItem.js +60 -0
- package/dist/packages/_es/Switch.js +90 -0
- package/dist/packages/_es/Tab.js +179 -0
- package/dist/packages/_es/TabPane.js +42 -0
- package/dist/packages/_es/TabPanel.js +30 -0
- package/dist/packages/_es/Tabbar.js +73 -0
- package/dist/packages/_es/TabbarItem.js +142 -0
- package/dist/packages/_es/Tag.js +98 -0
- package/dist/packages/_es/TextArea.js +127 -0
- package/dist/packages/_es/Toast.js +317 -0
- package/dist/packages/_es/Uploader.js +400 -0
- package/dist/packages/_es/Video.js +405 -0
- package/dist/packages/_es/component.js +26 -0
- package/dist/packages/_es/index.js +64 -0
- package/dist/packages/_es/index2.js +13 -0
- package/dist/packages/_es/plugin-vue_export-helper.js +12 -0
- package/dist/packages/_es/pxCheck.js +9 -0
- package/dist/packages/_es/raf.js +19 -0
- package/dist/packages/avatar/index.scss +0 -1
- package/dist/packages/badge/index.scss +35 -0
- package/dist/packages/calendar/index.scss +13 -0
- package/dist/packages/imagepreview/index.scss +48 -0
- package/dist/packages/input/index.scss +14 -7
- package/dist/packages/pagination/index.scss +51 -0
- package/dist/packages/popover/index.scss +159 -0
- package/dist/packages/shortpassword/index.scss +19 -7
- package/dist/packages/tabpane/index.scss +1 -0
- package/dist/packages/tabs/index.scss +1 -0
- package/dist/packages/tag/index.scss +47 -0
- package/dist/packages/uploader/index.scss +0 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +2 -1
- package/dist/styles/themes/default.scss +35 -28
- package/dist/styles/variables.scss +55 -32
- package/package.json +7 -7
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
/*!
|
|
21
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2021 @jdf2e.
|
|
23
|
+
* Released under the MIT License.
|
|
24
|
+
*/
|
|
25
|
+
import { reactive, computed, onMounted, watch, toRefs, resolveComponent, openBlock, createBlock } from "vue";
|
|
26
|
+
import picker from "./Picker.js";
|
|
27
|
+
import { c as createComponent } from "./component.js";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
+
import "./index.js";
|
|
30
|
+
import "./Popup.js";
|
|
31
|
+
import "./OverLay.js";
|
|
32
|
+
import "./Icon.js";
|
|
33
|
+
import "./pxCheck.js";
|
|
34
|
+
const { componentName, create } = createComponent("datepicker");
|
|
35
|
+
const currentYear = new Date().getFullYear();
|
|
36
|
+
function isDate(val) {
|
|
37
|
+
return Object.prototype.toString.call(val) === "[object Date]" && !isNaN(val.getTime());
|
|
38
|
+
}
|
|
39
|
+
const zhCNType = {
|
|
40
|
+
day: "\u65E5",
|
|
41
|
+
year: "\u5E74",
|
|
42
|
+
month: "\u6708",
|
|
43
|
+
hour: "\u65F6",
|
|
44
|
+
minute: "\u5206",
|
|
45
|
+
seconds: "\u79D2"
|
|
46
|
+
};
|
|
47
|
+
const _sfc_main = create({
|
|
48
|
+
components: {
|
|
49
|
+
[picker.name]: picker
|
|
50
|
+
},
|
|
51
|
+
props: {
|
|
52
|
+
modelValue: null,
|
|
53
|
+
visible: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
title: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ""
|
|
60
|
+
},
|
|
61
|
+
type: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "date"
|
|
64
|
+
},
|
|
65
|
+
isShowChinese: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: true
|
|
68
|
+
},
|
|
69
|
+
minuteStep: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: 1
|
|
72
|
+
},
|
|
73
|
+
minDate: {
|
|
74
|
+
type: Date,
|
|
75
|
+
default: () => new Date(currentYear - 10, 0, 1),
|
|
76
|
+
validator: isDate
|
|
77
|
+
},
|
|
78
|
+
maxDate: {
|
|
79
|
+
type: Date,
|
|
80
|
+
default: () => new Date(currentYear + 10, 11, 31),
|
|
81
|
+
validator: isDate
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
emits: ["click", "update:visible", "confirm"],
|
|
85
|
+
setup(props, { emit }) {
|
|
86
|
+
const state = reactive({
|
|
87
|
+
show: false,
|
|
88
|
+
currentDate: new Date(),
|
|
89
|
+
title: props.title
|
|
90
|
+
});
|
|
91
|
+
const formatValue = (value) => {
|
|
92
|
+
if (!isDate(value)) {
|
|
93
|
+
value = props.minDate;
|
|
94
|
+
}
|
|
95
|
+
let timestmp = Math.max(value.getTime(), props.minDate.getTime());
|
|
96
|
+
timestmp = Math.min(timestmp, props.maxDate.getTime());
|
|
97
|
+
return new Date(timestmp);
|
|
98
|
+
};
|
|
99
|
+
function getMonthEndDay(year, month) {
|
|
100
|
+
return 32 - new Date(year, month - 1, 32).getDate();
|
|
101
|
+
}
|
|
102
|
+
const getBoundary = (type, value) => {
|
|
103
|
+
const boundary = props[`${type}Date`];
|
|
104
|
+
const year = boundary.getFullYear();
|
|
105
|
+
let month = 1;
|
|
106
|
+
let date = 1;
|
|
107
|
+
let hour = 0;
|
|
108
|
+
let minute = 0;
|
|
109
|
+
if (type === "max") {
|
|
110
|
+
month = 12;
|
|
111
|
+
date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
|
112
|
+
hour = 23;
|
|
113
|
+
minute = 59;
|
|
114
|
+
}
|
|
115
|
+
const seconds = minute;
|
|
116
|
+
if (value.getFullYear() === year) {
|
|
117
|
+
month = boundary.getMonth() + 1;
|
|
118
|
+
if (value.getMonth() + 1 === month) {
|
|
119
|
+
date = boundary.getDate();
|
|
120
|
+
if (value.getDate() === date) {
|
|
121
|
+
hour = boundary.getHours();
|
|
122
|
+
if (value.getHours() === hour) {
|
|
123
|
+
minute = boundary.getMinutes();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
[`${type}Year`]: year,
|
|
130
|
+
[`${type}Month`]: month,
|
|
131
|
+
[`${type}Date`]: date,
|
|
132
|
+
[`${type}Hour`]: hour,
|
|
133
|
+
[`${type}Minute`]: minute,
|
|
134
|
+
[`${type}Seconds`]: seconds
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
const ranges = computed(() => {
|
|
138
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", state.currentDate);
|
|
139
|
+
const { minYear, minDate, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", state.currentDate);
|
|
140
|
+
let result = [
|
|
141
|
+
{
|
|
142
|
+
type: "year",
|
|
143
|
+
range: [minYear, maxYear]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: "month",
|
|
147
|
+
range: [minMonth, maxMonth]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: "day",
|
|
151
|
+
range: [minDate, maxDate]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: "hour",
|
|
155
|
+
range: [minHour, maxHour]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: "minute",
|
|
159
|
+
range: [minMinute, maxMinute]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: "seconds",
|
|
163
|
+
range: [minSeconds, maxSeconds]
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
switch (props.type) {
|
|
167
|
+
case "date":
|
|
168
|
+
result = result.slice(0, 3);
|
|
169
|
+
break;
|
|
170
|
+
case "datetime":
|
|
171
|
+
result = result.slice(0, 5);
|
|
172
|
+
break;
|
|
173
|
+
case "time":
|
|
174
|
+
result = result.slice(3, 6);
|
|
175
|
+
break;
|
|
176
|
+
case "month-day":
|
|
177
|
+
result = result.slice(1, 3);
|
|
178
|
+
break;
|
|
179
|
+
case "datehour":
|
|
180
|
+
result = result.slice(0, 4);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
return result;
|
|
184
|
+
});
|
|
185
|
+
const changeHandler = (val) => {
|
|
186
|
+
if (["date", "datetime"].includes(props.type)) {
|
|
187
|
+
let formatDate = [];
|
|
188
|
+
if (props.isShowChinese) {
|
|
189
|
+
formatDate = val.map((res) => {
|
|
190
|
+
return Number(res.slice(0, res.length - 1));
|
|
191
|
+
});
|
|
192
|
+
} else {
|
|
193
|
+
formatDate = val;
|
|
194
|
+
}
|
|
195
|
+
if (props.type === "date") {
|
|
196
|
+
state.currentDate = formatValue(new Date(formatDate[0], formatDate[1] - 1, Math.min(formatDate[2], getMonthEndDay(formatDate[0], formatDate[1]))));
|
|
197
|
+
} else if (props.type === "datetime") {
|
|
198
|
+
state.currentDate = formatValue(new Date(formatDate[0], formatDate[1] - 1, Math.min(formatDate[2], getMonthEndDay(formatDate[0], formatDate[1])), formatDate[3], formatDate[4]));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const generateValue = (min, max, val, type) => {
|
|
203
|
+
if (!(max > min))
|
|
204
|
+
return;
|
|
205
|
+
const arr = [];
|
|
206
|
+
let index2 = 0;
|
|
207
|
+
while (min <= max) {
|
|
208
|
+
if (props.isShowChinese) {
|
|
209
|
+
arr.push(min + zhCNType[type]);
|
|
210
|
+
} else {
|
|
211
|
+
arr.push(min);
|
|
212
|
+
}
|
|
213
|
+
if (type === "minute") {
|
|
214
|
+
min += props.minuteStep;
|
|
215
|
+
} else {
|
|
216
|
+
min++;
|
|
217
|
+
}
|
|
218
|
+
if (min <= val) {
|
|
219
|
+
index2++;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return { values: arr, defaultIndex: index2 };
|
|
223
|
+
};
|
|
224
|
+
const getDateIndex = (type) => {
|
|
225
|
+
if (type === "year") {
|
|
226
|
+
return state.currentDate.getFullYear();
|
|
227
|
+
} else if (type === "month") {
|
|
228
|
+
return state.currentDate.getMonth() + 1;
|
|
229
|
+
} else if (type === "day") {
|
|
230
|
+
return state.currentDate.getDate();
|
|
231
|
+
} else if (type === "hour") {
|
|
232
|
+
return state.currentDate.getHours();
|
|
233
|
+
} else if (type === "minute") {
|
|
234
|
+
return state.currentDate.getMinutes();
|
|
235
|
+
} else if (type === "seconds") {
|
|
236
|
+
return state.currentDate.getSeconds();
|
|
237
|
+
}
|
|
238
|
+
return 0;
|
|
239
|
+
};
|
|
240
|
+
const columns = computed(() => {
|
|
241
|
+
const val = ranges.value.map((res) => {
|
|
242
|
+
return generateValue(res.range[0], res.range[1], getDateIndex(res.type), res.type);
|
|
243
|
+
});
|
|
244
|
+
return val;
|
|
245
|
+
});
|
|
246
|
+
const closeHandler = () => {
|
|
247
|
+
emit("update:visible", false);
|
|
248
|
+
};
|
|
249
|
+
const confirm = (val) => {
|
|
250
|
+
emit("update:visible", false);
|
|
251
|
+
emit("confirm", val);
|
|
252
|
+
};
|
|
253
|
+
onMounted(() => {
|
|
254
|
+
state.currentDate = formatValue(props.modelValue);
|
|
255
|
+
});
|
|
256
|
+
watch(() => props.title, (val) => {
|
|
257
|
+
state.title = val;
|
|
258
|
+
});
|
|
259
|
+
watch(() => props.visible, (val) => {
|
|
260
|
+
state.show = val;
|
|
261
|
+
});
|
|
262
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
263
|
+
changeHandler,
|
|
264
|
+
closeHandler,
|
|
265
|
+
confirm,
|
|
266
|
+
columns
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
271
|
+
const _component_nut_picker = resolveComponent("nut-picker");
|
|
272
|
+
return openBlock(), createBlock(_component_nut_picker, {
|
|
273
|
+
visible: _ctx.show,
|
|
274
|
+
onClose: _ctx.closeHandler,
|
|
275
|
+
"list-data": _ctx.columns,
|
|
276
|
+
onChange: _ctx.changeHandler,
|
|
277
|
+
title: _ctx.title,
|
|
278
|
+
onConfirm: _ctx.confirm
|
|
279
|
+
}, null, 8, ["visible", "onClose", "list-data", "onChange", "title", "onConfirm"]);
|
|
280
|
+
}
|
|
281
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
282
|
+
export { index as default };
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __publicField = (obj, key, value) => {
|
|
21
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
/*!
|
|
25
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
26
|
+
* (c) 2021 @jdf2e.
|
|
27
|
+
* Released under the MIT License.
|
|
28
|
+
*/
|
|
29
|
+
import { ref, onMounted, watch, computed, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createElementBlock, renderSlot, Fragment, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, createVNode, render, h } from "vue";
|
|
30
|
+
import { c as createComponent } from "./component.js";
|
|
31
|
+
import Popup, { popupProps } from "./Popup.js";
|
|
32
|
+
import Button from "./Button.js";
|
|
33
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
34
|
+
import "./OverLay.js";
|
|
35
|
+
import "./Icon.js";
|
|
36
|
+
import "./pxCheck.js";
|
|
37
|
+
const { componentName, create } = createComponent("dialog");
|
|
38
|
+
const _sfc_main = create({
|
|
39
|
+
inheritAttrs: false,
|
|
40
|
+
components: {
|
|
41
|
+
[Popup.name]: Popup,
|
|
42
|
+
[Button.name]: Button
|
|
43
|
+
},
|
|
44
|
+
props: __spreadProps(__spreadValues({}, popupProps), {
|
|
45
|
+
closeOnClickOverlay: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: ""
|
|
52
|
+
},
|
|
53
|
+
content: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ""
|
|
56
|
+
},
|
|
57
|
+
noFooter: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
noOkBtn: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
noCancelBtn: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false
|
|
68
|
+
},
|
|
69
|
+
cancelText: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "\u53D6\u6D88"
|
|
72
|
+
},
|
|
73
|
+
okText: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "\u786E\u5B9A"
|
|
76
|
+
},
|
|
77
|
+
okBtnDisabled: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
cancelAutoClose: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: true
|
|
84
|
+
},
|
|
85
|
+
textAlign: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "center"
|
|
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
|
+
closeOnPopstate: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
110
|
+
emits: [
|
|
111
|
+
"update",
|
|
112
|
+
"update:visible",
|
|
113
|
+
"ok",
|
|
114
|
+
"cancel",
|
|
115
|
+
"open",
|
|
116
|
+
"opened",
|
|
117
|
+
"close",
|
|
118
|
+
"closed"
|
|
119
|
+
],
|
|
120
|
+
setup(props, { emit }) {
|
|
121
|
+
const showPopup = ref(props.visible);
|
|
122
|
+
onMounted(() => {
|
|
123
|
+
if (props.closeOnPopstate) {
|
|
124
|
+
window.addEventListener("popstate", function() {
|
|
125
|
+
closed();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
watch(() => props.visible, (value) => {
|
|
130
|
+
showPopup.value = value;
|
|
131
|
+
});
|
|
132
|
+
const classes = computed(() => {
|
|
133
|
+
return {
|
|
134
|
+
[componentName]: true
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
const update = (val) => {
|
|
138
|
+
emit("update", val);
|
|
139
|
+
emit("update:visible", val);
|
|
140
|
+
};
|
|
141
|
+
const closed = () => {
|
|
142
|
+
update(false);
|
|
143
|
+
emit("closed");
|
|
144
|
+
};
|
|
145
|
+
const onCancel = () => {
|
|
146
|
+
emit("cancel");
|
|
147
|
+
if (props.cancelAutoClose) {
|
|
148
|
+
closed();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const onOk = () => {
|
|
152
|
+
closed();
|
|
153
|
+
emit("ok");
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
closed,
|
|
157
|
+
classes,
|
|
158
|
+
onCancel,
|
|
159
|
+
onOk,
|
|
160
|
+
showPopup
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
const _hoisted_1 = {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: "nut-dialog__header"
|
|
167
|
+
};
|
|
168
|
+
const _hoisted_2 = ["innerHTML"];
|
|
169
|
+
const _hoisted_3 = {
|
|
170
|
+
key: 1,
|
|
171
|
+
class: "nut-dialog__footer"
|
|
172
|
+
};
|
|
173
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
174
|
+
const _component_nut_button = resolveComponent("nut-button");
|
|
175
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
176
|
+
return openBlock(), createBlock(_component_nut_popup, {
|
|
177
|
+
teleport: _ctx.teleport,
|
|
178
|
+
visible: _ctx.showPopup,
|
|
179
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.showPopup = $event),
|
|
180
|
+
"close-on-click-overlay": _ctx.closeOnClickOverlay,
|
|
181
|
+
"lock-scroll": _ctx.lockScroll,
|
|
182
|
+
round: "",
|
|
183
|
+
onClickOverlay: _ctx.closed,
|
|
184
|
+
onClickCloseIcon: _ctx.closed
|
|
185
|
+
}, {
|
|
186
|
+
default: withCtx(() => [
|
|
187
|
+
createElementVNode("view", {
|
|
188
|
+
class: normalizeClass(_ctx.classes)
|
|
189
|
+
}, [
|
|
190
|
+
_ctx.title ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
191
|
+
_ctx.$slots.header ? renderSlot(_ctx.$slots, "header", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
192
|
+
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
193
|
+
], 64))
|
|
194
|
+
])) : createCommentVNode("", true),
|
|
195
|
+
createElementVNode("view", {
|
|
196
|
+
class: "nut-dialog__content",
|
|
197
|
+
style: normalizeStyle({ textAlign: _ctx.textAlign })
|
|
198
|
+
}, [
|
|
199
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock("view", {
|
|
200
|
+
key: 1,
|
|
201
|
+
innerHTML: _ctx.content
|
|
202
|
+
}, null, 8, _hoisted_2))
|
|
203
|
+
], 4),
|
|
204
|
+
!_ctx.noFooter ? (openBlock(), createElementBlock("view", _hoisted_3, [
|
|
205
|
+
_ctx.$slots.footer ? renderSlot(_ctx.$slots, "footer", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
206
|
+
!_ctx.noCancelBtn ? (openBlock(), createBlock(_component_nut_button, {
|
|
207
|
+
key: 0,
|
|
208
|
+
size: "small",
|
|
209
|
+
plain: "",
|
|
210
|
+
type: "primary",
|
|
211
|
+
class: "nut-dialog__footer-cancel",
|
|
212
|
+
onClick: _ctx.onCancel
|
|
213
|
+
}, {
|
|
214
|
+
default: withCtx(() => [
|
|
215
|
+
createTextVNode(toDisplayString(_ctx.cancelText), 1)
|
|
216
|
+
]),
|
|
217
|
+
_: 1
|
|
218
|
+
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
219
|
+
!_ctx.noOkBtn ? (openBlock(), createBlock(_component_nut_button, {
|
|
220
|
+
key: 1,
|
|
221
|
+
size: "small",
|
|
222
|
+
type: "primary",
|
|
223
|
+
class: normalizeClass(["nut-dialog__footer-ok", { disabled: _ctx.okBtnDisabled }]),
|
|
224
|
+
disabled: _ctx.okBtnDisabled,
|
|
225
|
+
onClick: _ctx.onOk
|
|
226
|
+
}, {
|
|
227
|
+
default: withCtx(() => [
|
|
228
|
+
createTextVNode(toDisplayString(_ctx.okText), 1)
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 8, ["class", "disabled", "onClick"])) : createCommentVNode("", true)
|
|
232
|
+
], 64))
|
|
233
|
+
])) : createCommentVNode("", true)
|
|
234
|
+
], 2)
|
|
235
|
+
]),
|
|
236
|
+
_: 3
|
|
237
|
+
}, 8, ["teleport", "visible", "close-on-click-overlay", "lock-scroll", "onClickOverlay", "onClickCloseIcon"]);
|
|
238
|
+
}
|
|
239
|
+
var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
240
|
+
class DialogOptions {
|
|
241
|
+
constructor() {
|
|
242
|
+
__publicField(this, "title", "");
|
|
243
|
+
__publicField(this, "content", "");
|
|
244
|
+
__publicField(this, "cancelText", "\u53D6\u6D88");
|
|
245
|
+
__publicField(this, "okText", "\u786E\u5B9A");
|
|
246
|
+
__publicField(this, "textAlign", "center");
|
|
247
|
+
__publicField(this, "teleport", "body");
|
|
248
|
+
__publicField(this, "onUpdate", (value) => {
|
|
249
|
+
});
|
|
250
|
+
__publicField(this, "onOk", () => {
|
|
251
|
+
});
|
|
252
|
+
__publicField(this, "onCancel", () => {
|
|
253
|
+
});
|
|
254
|
+
__publicField(this, "onClose", () => {
|
|
255
|
+
});
|
|
256
|
+
__publicField(this, "onClosed", () => {
|
|
257
|
+
});
|
|
258
|
+
__publicField(this, "visible", true);
|
|
259
|
+
__publicField(this, "noFooter", false);
|
|
260
|
+
__publicField(this, "noOkBtn", false);
|
|
261
|
+
__publicField(this, "noCancelBtn", false);
|
|
262
|
+
__publicField(this, "okBtnDisabled", false);
|
|
263
|
+
__publicField(this, "closeOnPopstate", false);
|
|
264
|
+
__publicField(this, "lockScroll", false);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
class DialogFunction {
|
|
268
|
+
constructor(_options) {
|
|
269
|
+
__publicField(this, "options", new DialogOptions());
|
|
270
|
+
__publicField(this, "close", () => {
|
|
271
|
+
});
|
|
272
|
+
__publicField(this, "setDefaultOptions", (options) => {
|
|
273
|
+
});
|
|
274
|
+
__publicField(this, "resetDefaultOptions", () => {
|
|
275
|
+
});
|
|
276
|
+
let options = Object.assign(this.options, _options);
|
|
277
|
+
let elWarp = document.body;
|
|
278
|
+
let teleport = options.teleport;
|
|
279
|
+
if (teleport != "body") {
|
|
280
|
+
if (typeof teleport == "string") {
|
|
281
|
+
elWarp = document.querySelector(teleport);
|
|
282
|
+
} else {
|
|
283
|
+
elWarp = options.teleport;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const root = document.createElement("view");
|
|
287
|
+
root.id = "dialog-" + new Date().getTime();
|
|
288
|
+
const Wrapper = {
|
|
289
|
+
setup() {
|
|
290
|
+
options.onUpdate = (val) => {
|
|
291
|
+
if (val == false) {
|
|
292
|
+
elWarp.removeChild(root);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
options.teleport = `#${root.id}`;
|
|
296
|
+
return () => {
|
|
297
|
+
return h(Dialog, options);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const instance = createVNode(Wrapper);
|
|
302
|
+
elWarp.appendChild(root);
|
|
303
|
+
render(instance, root);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
const _Dialog = function(options) {
|
|
307
|
+
return new DialogFunction(options);
|
|
308
|
+
};
|
|
309
|
+
_Dialog.install = (app) => {
|
|
310
|
+
app.use(Dialog);
|
|
311
|
+
app.config.globalProperties.$dialog = _Dialog;
|
|
312
|
+
};
|
|
313
|
+
export { Dialog, DialogOptions, _Dialog as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { computed, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
const { componentName, create } = createComponent("divider");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
contentPosition: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "center"
|
|
15
|
+
},
|
|
16
|
+
dashed: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false
|
|
19
|
+
},
|
|
20
|
+
hairline: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
components: {},
|
|
26
|
+
setup(props, context) {
|
|
27
|
+
const classes = computed(() => {
|
|
28
|
+
const prefixCls = componentName;
|
|
29
|
+
return {
|
|
30
|
+
[prefixCls]: true,
|
|
31
|
+
[`${prefixCls}-center`]: context.slots.default,
|
|
32
|
+
[`${prefixCls}-left`]: props.contentPosition === "left",
|
|
33
|
+
[`${prefixCls}-right`]: props.contentPosition === "right",
|
|
34
|
+
[`${prefixCls}-dashed`]: props.dashed,
|
|
35
|
+
[`${prefixCls}-hairline`]: props.hairline
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
return { classes };
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
42
|
+
return openBlock(), createElementBlock("div", {
|
|
43
|
+
class: normalizeClass(_ctx.classes)
|
|
44
|
+
}, [
|
|
45
|
+
renderSlot(_ctx.$slots, "default")
|
|
46
|
+
], 2);
|
|
47
|
+
}
|
|
48
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
49
|
+
export { index as default };
|