@nutui/nutui 4.3.4 → 4.3.6
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 -1
- package/dist/nutui.es.js +1 -1
- package/dist/nutui.js +5358 -5629
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/audio/Audio.js +2 -1
- package/dist/packages/audiooperate/AudioOperate.js +2 -1
- package/dist/packages/cell/Cell.js +89 -80
- package/dist/packages/cellgroup/CellGroup.js +44 -21
- package/dist/packages/checkbox/Checkbox.js +1 -1
- package/dist/packages/{common-DRG0ue26.js → common-BH7uB7Cn.js} +4 -2
- package/dist/packages/countdown/Countdown.js +130 -173
- package/dist/packages/form/Form.js +5 -5
- package/dist/packages/formitem/FormItem.js +5 -5
- package/dist/packages/grid/Grid.js +68 -5
- package/dist/packages/griditem/GridItem.js +61 -81
- package/dist/packages/input/Input.js +1 -1
- package/dist/packages/inputnumber/InputNumber.js +7 -7
- package/dist/packages/invoice/Invoice.js +4 -4
- package/dist/packages/picker/Picker.js +1 -1
- package/dist/packages/radio/Radio.js +112 -1
- package/dist/packages/radiogroup/RadioGroup.js +60 -1
- package/dist/packages/range/Range.js +1 -1
- package/dist/packages/rate/Rate.js +1 -1
- package/dist/packages/searchbar/Searchbar.js +1 -1
- package/dist/packages/skeleton/Skeleton.js +88 -123
- package/dist/packages/step/Step.js +64 -83
- package/dist/packages/steps/Steps.js +44 -40
- package/dist/packages/switch/Switch.js +1 -1
- package/dist/packages/tabpane/TabPane.js +2 -1
- package/dist/packages/tabs/Tabs.js +2 -1
- package/dist/packages/textarea/Textarea.js +1 -1
- package/dist/packages/types-BMA1Y94E.js +4 -0
- package/dist/packages/types-BXlnzugj.js +4 -0
- package/dist/packages/types-CJeZIBld.js +4 -0
- package/dist/packages/uploader/Uploader.js +1 -1
- package/dist/smartips/web-types.json +446 -26
- package/dist/types/__VUE/audio/index.vue.d.ts +2 -2
- package/dist/types/__VUE/audio/types.d.ts +2 -0
- package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cell/cell.vue.d.ts +113 -0
- package/dist/types/__VUE/cell/index.d.ts +6 -0
- package/dist/types/__VUE/cellgroup/cell-group.vue.d.ts +55 -0
- package/dist/types/__VUE/cellgroup/index.d.ts +5 -0
- package/dist/types/__VUE/countdown/countdown.vue.d.ts +108 -0
- package/dist/types/__VUE/countdown/index.d.ts +5 -0
- package/dist/types/__VUE/countdown/util.d.ts +14 -0
- package/dist/types/__VUE/form/common.d.ts +1 -0
- package/dist/types/__VUE/grid/grid.vue.d.ts +87 -0
- package/dist/types/__VUE/grid/index.d.ts +6 -0
- package/dist/types/__VUE/grid/types.d.ts +2 -0
- package/dist/types/__VUE/griditem/grid-item.vue.d.ts +64 -0
- package/dist/types/__VUE/griditem/index.d.ts +5 -0
- package/dist/types/__VUE/navbar/navbar.vue.d.ts +1 -1
- package/dist/types/__VUE/picker/Column.vue.d.ts +2 -2
- package/dist/types/__VUE/radio/index.d.ts +6 -0
- package/dist/types/__VUE/radio/radio.vue.d.ts +74 -0
- package/dist/types/__VUE/radiogroup/index.d.ts +5 -0
- package/dist/types/__VUE/radiogroup/radio-group.vue.d.ts +66 -0
- package/dist/types/__VUE/skeleton/index.d.ts +5 -0
- package/dist/types/__VUE/skeleton/skeleton.vue.d.ts +102 -0
- package/dist/types/__VUE/step/index.d.ts +5 -0
- package/dist/types/__VUE/step/step.vue.d.ts +55 -0
- package/dist/types/__VUE/steps/index.d.ts +6 -0
- package/dist/types/__VUE/steps/steps.vue.d.ts +64 -0
- package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabs/index.vue.d.ts +1 -1
- package/dist/types/__VUE/tabs/types.d.ts +1 -0
- package/dist/types/__VUE/uploader/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +21 -11
- package/dist/types/utils/Interceptor.d.ts +2 -2
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/useRelation/useParent.d.ts +1 -1
- package/package.json +1 -1
- package/dist/packages/common-Chr7cC9o.js +0 -145
- package/dist/packages/index.vue_vue_type_script_lang-CTQUvlgN.js +0 -99
- package/dist/packages/index.vue_vue_type_script_lang-CaSiRl9x.js +0 -46
- package/dist/types/__VUE/audiooperate/types.d.ts +0 -1
- package/dist/types/__VUE/cell/index.vue.d.ts +0 -120
- package/dist/types/__VUE/cellgroup/index.vue.d.ts +0 -33
- package/dist/types/__VUE/countdown/index.vue.d.ts +0 -125
- package/dist/types/__VUE/grid/common.d.ts +0 -73
- package/dist/types/__VUE/grid/index.vue.d.ts +0 -84
- package/dist/types/__VUE/griditem/index.vue.d.ts +0 -47
- package/dist/types/__VUE/radio/index.vue.d.ts +0 -64
- package/dist/types/__VUE/radiogroup/index.vue.d.ts +0 -49
- package/dist/types/__VUE/skeleton/index.vue.d.ts +0 -117
- package/dist/types/__VUE/step/index.vue.d.ts +0 -42
- package/dist/types/__VUE/steps/index.vue.d.ts +0 -48
|
@@ -17,11 +17,9 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import {
|
|
21
|
-
import { c as createComponent } from "../component-DQf3CENX.js";
|
|
20
|
+
import { defineComponent, ref, computed, onBeforeMount, watch, openBlock, createElementBlock, renderSlot, createElementVNode } from "vue";
|
|
22
21
|
import { p as padZero } from "../util-DnfK0Qan.js";
|
|
23
|
-
import {
|
|
24
|
-
import { _ as _export_sfc } from "../_plugin-vue_export-helper-1tPrXgE0.js";
|
|
22
|
+
import { w as withInstall } from "../with-install-Ch3FF0uS.js";
|
|
25
23
|
const getTimeStamp = (timeStr) => {
|
|
26
24
|
if (!timeStr)
|
|
27
25
|
return Date.now();
|
|
@@ -29,54 +27,78 @@ const getTimeStamp = (timeStr) => {
|
|
|
29
27
|
t = +t > 0 ? +t : t.toString().replace(/-/g, "/");
|
|
30
28
|
return new Date(t).getTime();
|
|
31
29
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
default: false,
|
|
64
|
-
type: Boolean
|
|
65
|
-
},
|
|
66
|
-
// 时间格式化
|
|
67
|
-
format: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: "HH:mm:ss"
|
|
70
|
-
},
|
|
71
|
-
autoStart: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: true
|
|
74
|
-
},
|
|
75
|
-
// 倒计时时长,单位毫秒
|
|
76
|
-
time: {
|
|
77
|
-
type: [Number, String],
|
|
78
|
-
default: 0
|
|
30
|
+
const parseFormat = (time, format) => {
|
|
31
|
+
let { h, m, s, ms } = time;
|
|
32
|
+
const { d } = time;
|
|
33
|
+
if (format.includes("DD")) {
|
|
34
|
+
format = format.replace("DD", padZero(d));
|
|
35
|
+
} else {
|
|
36
|
+
h += Number(d) * 24;
|
|
37
|
+
}
|
|
38
|
+
if (format.includes("HH")) {
|
|
39
|
+
format = format.replace("HH", padZero(h));
|
|
40
|
+
} else {
|
|
41
|
+
m += Number(h) * 60;
|
|
42
|
+
}
|
|
43
|
+
if (format.includes("mm")) {
|
|
44
|
+
format = format.replace("mm", padZero(m));
|
|
45
|
+
} else {
|
|
46
|
+
s += Number(m) * 60;
|
|
47
|
+
}
|
|
48
|
+
if (format.includes("ss")) {
|
|
49
|
+
format = format.replace("ss", padZero(s));
|
|
50
|
+
} else {
|
|
51
|
+
ms += Number(s) * 1e3;
|
|
52
|
+
}
|
|
53
|
+
if (format.includes("S")) {
|
|
54
|
+
const msC = padZero(ms, 3).toString();
|
|
55
|
+
if (format.includes("SSS")) {
|
|
56
|
+
format = format.replace("SSS", msC);
|
|
57
|
+
} else if (format.includes("SS")) {
|
|
58
|
+
format = format.replace("SS", msC.slice(0, 2));
|
|
59
|
+
} else if (format.includes("S")) {
|
|
60
|
+
format = format.replace("S", msC.slice(0, 1));
|
|
79
61
|
}
|
|
62
|
+
}
|
|
63
|
+
return format;
|
|
64
|
+
};
|
|
65
|
+
const formatRemainTime = (t, format, type) => {
|
|
66
|
+
const ts = t;
|
|
67
|
+
const rest = {
|
|
68
|
+
d: 0,
|
|
69
|
+
h: 0,
|
|
70
|
+
m: 0,
|
|
71
|
+
s: 0,
|
|
72
|
+
ms: 0
|
|
73
|
+
};
|
|
74
|
+
const SECOND = 1e3;
|
|
75
|
+
const MINUTE = 60 * SECOND;
|
|
76
|
+
const HOUR = 60 * MINUTE;
|
|
77
|
+
const DAY = 24 * HOUR;
|
|
78
|
+
if (ts > 0) {
|
|
79
|
+
rest.d = ts >= SECOND ? Math.floor(ts / DAY) : 0;
|
|
80
|
+
rest.h = Math.floor(ts % DAY / HOUR);
|
|
81
|
+
rest.m = Math.floor(ts % HOUR / MINUTE);
|
|
82
|
+
rest.s = Math.floor(ts % MINUTE / SECOND);
|
|
83
|
+
rest.ms = Math.floor(ts % SECOND);
|
|
84
|
+
}
|
|
85
|
+
return type == "custom" ? rest : parseFormat(__spreadValues({}, rest), format);
|
|
86
|
+
};
|
|
87
|
+
const _hoisted_1 = { class: "nut-countdown" };
|
|
88
|
+
const _hoisted_2 = ["innerHTML"];
|
|
89
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
90
|
+
name: "NutCountdown"
|
|
91
|
+
}), {
|
|
92
|
+
__name: "countdown",
|
|
93
|
+
props: {
|
|
94
|
+
modelValue: {},
|
|
95
|
+
paused: { type: Boolean, default: false },
|
|
96
|
+
startTime: { default: "" },
|
|
97
|
+
endTime: { default: "" },
|
|
98
|
+
millisecond: { type: Boolean, default: false },
|
|
99
|
+
format: { default: "HH:mm:ss" },
|
|
100
|
+
autoStart: { type: Boolean, default: true },
|
|
101
|
+
time: { default: 0 }
|
|
80
102
|
},
|
|
81
103
|
emits: [
|
|
82
104
|
"input",
|
|
@@ -89,38 +111,33 @@ const _sfc_main = create({
|
|
|
89
111
|
"onRestart",
|
|
90
112
|
"onPaused"
|
|
91
113
|
],
|
|
92
|
-
setup(
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
handleEndTime: Date.now(),
|
|
101
|
-
// 最终截止时间
|
|
102
|
-
diffTime: 0
|
|
103
|
-
// 设置了 startTime 时,与 date.now() 的差异
|
|
104
|
-
});
|
|
114
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
115
|
+
const props = __props;
|
|
116
|
+
const emit = __emit;
|
|
117
|
+
const restTime = ref(0);
|
|
118
|
+
const timer = ref(null);
|
|
119
|
+
const counting = ref(!props.paused && props.autoStart);
|
|
120
|
+
const handleEndTime = ref(Date.now());
|
|
121
|
+
const diffTime = ref(0);
|
|
105
122
|
const renderTime = computed(() => {
|
|
106
|
-
return formatRemainTime(
|
|
123
|
+
return formatRemainTime(restTime.value, props.format);
|
|
107
124
|
});
|
|
108
125
|
const initTime = () => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (!
|
|
112
|
-
|
|
126
|
+
handleEndTime.value = Number(props.endTime);
|
|
127
|
+
diffTime.value = Date.now() - getTimeStamp(props.startTime);
|
|
128
|
+
if (!counting.value)
|
|
129
|
+
counting.value = true;
|
|
113
130
|
tick();
|
|
114
131
|
};
|
|
115
132
|
const tick = () => {
|
|
116
133
|
if (window !== void 0) {
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
const currentTime = Date.now() -
|
|
120
|
-
const remainTime = Math.max(
|
|
121
|
-
|
|
134
|
+
timer.value = requestAnimationFrame(() => {
|
|
135
|
+
if (counting.value) {
|
|
136
|
+
const currentTime = Date.now() - diffTime.value;
|
|
137
|
+
const remainTime = Math.max(handleEndTime.value - currentTime, 0);
|
|
138
|
+
restTime.value = remainTime;
|
|
122
139
|
if (!remainTime) {
|
|
123
|
-
|
|
140
|
+
counting.value = false;
|
|
124
141
|
pause();
|
|
125
142
|
emit("end");
|
|
126
143
|
emit("onEnd");
|
|
@@ -132,95 +149,43 @@ const _sfc_main = create({
|
|
|
132
149
|
});
|
|
133
150
|
}
|
|
134
151
|
};
|
|
135
|
-
const formatRemainTime = (t, type) => {
|
|
136
|
-
const ts = t;
|
|
137
|
-
let rest = {
|
|
138
|
-
d: 0,
|
|
139
|
-
h: 0,
|
|
140
|
-
m: 0,
|
|
141
|
-
s: 0,
|
|
142
|
-
ms: 0
|
|
143
|
-
};
|
|
144
|
-
const SECOND = 1e3;
|
|
145
|
-
const MINUTE = 60 * SECOND;
|
|
146
|
-
const HOUR = 60 * MINUTE;
|
|
147
|
-
const DAY = 24 * HOUR;
|
|
148
|
-
if (ts > 0) {
|
|
149
|
-
rest.d = ts >= SECOND ? Math.floor(ts / DAY) : 0;
|
|
150
|
-
rest.h = Math.floor(ts % DAY / HOUR);
|
|
151
|
-
rest.m = Math.floor(ts % HOUR / MINUTE);
|
|
152
|
-
rest.s = Math.floor(ts % MINUTE / SECOND);
|
|
153
|
-
rest.ms = Math.floor(ts % SECOND);
|
|
154
|
-
}
|
|
155
|
-
return type == "custom" ? rest : parseFormat(__spreadValues({}, rest));
|
|
156
|
-
};
|
|
157
|
-
const parseFormat = (time) => {
|
|
158
|
-
let { d, h, m, s, ms } = time;
|
|
159
|
-
let format = props.format;
|
|
160
|
-
if (format.includes("DD")) {
|
|
161
|
-
format = format.replace("DD", padZero(d));
|
|
162
|
-
} else {
|
|
163
|
-
h += Number(d) * 24;
|
|
164
|
-
}
|
|
165
|
-
if (format.includes("HH")) {
|
|
166
|
-
format = format.replace("HH", padZero(h));
|
|
167
|
-
} else {
|
|
168
|
-
m += Number(h) * 60;
|
|
169
|
-
}
|
|
170
|
-
if (format.includes("mm")) {
|
|
171
|
-
format = format.replace("mm", padZero(m));
|
|
172
|
-
} else {
|
|
173
|
-
s += Number(m) * 60;
|
|
174
|
-
}
|
|
175
|
-
if (format.includes("ss")) {
|
|
176
|
-
format = format.replace("ss", padZero(s));
|
|
177
|
-
} else {
|
|
178
|
-
ms += Number(s) * 1e3;
|
|
179
|
-
}
|
|
180
|
-
if (format.includes("S")) {
|
|
181
|
-
const msC = padZero(ms, 3).toString();
|
|
182
|
-
if (format.includes("SSS")) {
|
|
183
|
-
format = format.replace("SSS", msC);
|
|
184
|
-
} else if (format.includes("SS")) {
|
|
185
|
-
format = format.replace("SS", msC.slice(0, 2));
|
|
186
|
-
} else if (format.includes("S")) {
|
|
187
|
-
format = format.replace("S", msC.slice(0, 1));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return format;
|
|
191
|
-
};
|
|
192
152
|
const start = () => {
|
|
193
|
-
if (!
|
|
194
|
-
|
|
195
|
-
|
|
153
|
+
if (!counting.value && !props.autoStart) {
|
|
154
|
+
counting.value = true;
|
|
155
|
+
handleEndTime.value = Date.now() + Number(restTime.value);
|
|
196
156
|
tick();
|
|
197
|
-
emit("restart",
|
|
198
|
-
emit("onRestart",
|
|
157
|
+
emit("restart", restTime.value);
|
|
158
|
+
emit("onRestart", restTime.value);
|
|
199
159
|
}
|
|
200
160
|
};
|
|
201
161
|
const pause = () => {
|
|
202
|
-
cancelAnimationFrame(
|
|
203
|
-
|
|
204
|
-
emit("
|
|
205
|
-
emit("
|
|
162
|
+
cancelAnimationFrame(timer.value);
|
|
163
|
+
counting.value = false;
|
|
164
|
+
emit("restart", restTime.value);
|
|
165
|
+
emit("onRestart", restTime.value);
|
|
206
166
|
};
|
|
207
167
|
const reset = () => {
|
|
208
168
|
if (!props.autoStart) {
|
|
209
169
|
pause();
|
|
210
|
-
|
|
170
|
+
restTime.value = Number(props.time);
|
|
211
171
|
}
|
|
212
172
|
};
|
|
173
|
+
__expose({
|
|
174
|
+
start,
|
|
175
|
+
pause,
|
|
176
|
+
reset
|
|
177
|
+
});
|
|
213
178
|
onBeforeMount(() => {
|
|
214
179
|
if (props.autoStart) {
|
|
215
180
|
initTime();
|
|
216
181
|
} else {
|
|
217
|
-
|
|
182
|
+
restTime.value = Number(props.time);
|
|
218
183
|
}
|
|
219
184
|
});
|
|
220
185
|
watch(
|
|
221
|
-
() =>
|
|
186
|
+
() => restTime.value,
|
|
222
187
|
(value) => {
|
|
223
|
-
|
|
188
|
+
const tranTime = formatRemainTime(value, props.format, "custom");
|
|
224
189
|
emit("update:modelValue", tranTime);
|
|
225
190
|
emit("input", tranTime);
|
|
226
191
|
}
|
|
@@ -229,17 +194,17 @@ const _sfc_main = create({
|
|
|
229
194
|
() => props.paused,
|
|
230
195
|
(v, ov) => {
|
|
231
196
|
if (!ov) {
|
|
232
|
-
if (
|
|
197
|
+
if (counting.value) {
|
|
233
198
|
pause();
|
|
234
199
|
}
|
|
235
200
|
} else {
|
|
236
|
-
if (!
|
|
237
|
-
|
|
238
|
-
|
|
201
|
+
if (!counting.value) {
|
|
202
|
+
counting.value = true;
|
|
203
|
+
handleEndTime.value = Date.now() + Number(restTime.value);
|
|
239
204
|
tick();
|
|
240
205
|
}
|
|
241
|
-
emit("restart",
|
|
242
|
-
emit("onRestart",
|
|
206
|
+
emit("restart", restTime.value);
|
|
207
|
+
emit("onRestart", restTime.value);
|
|
243
208
|
}
|
|
244
209
|
}
|
|
245
210
|
);
|
|
@@ -255,28 +220,20 @@ const _sfc_main = create({
|
|
|
255
220
|
initTime();
|
|
256
221
|
}
|
|
257
222
|
);
|
|
258
|
-
return
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
223
|
+
return (_ctx, _cache) => {
|
|
224
|
+
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
225
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
226
|
+
createElementVNode("view", {
|
|
227
|
+
class: "nut-countdown__content",
|
|
228
|
+
innerHTML: renderTime.value
|
|
229
|
+
}, null, 8, _hoisted_2)
|
|
230
|
+
])
|
|
231
|
+
]);
|
|
232
|
+
};
|
|
266
233
|
}
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
const _hoisted_2 = ["innerHTML"];
|
|
270
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
271
|
-
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
272
|
-
_ctx.slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock("view", {
|
|
273
|
-
key: 1,
|
|
274
|
-
class: "nut-countdown__content",
|
|
275
|
-
innerHTML: _ctx.renderTime
|
|
276
|
-
}, null, 8, _hoisted_2))
|
|
277
|
-
]);
|
|
278
|
-
}
|
|
279
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
234
|
+
}));
|
|
235
|
+
withInstall(_sfc_main);
|
|
280
236
|
export {
|
|
281
|
-
|
|
237
|
+
_sfc_main as Countdown,
|
|
238
|
+
_sfc_main as default
|
|
282
239
|
};
|
|
@@ -49,11 +49,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
49
49
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
import { defineComponent, computed, reactive, provide, watch, openBlock, createElementBlock, withModifiers, createVNode, withCtx, renderSlot } from "vue";
|
|
52
|
+
import { defineComponent, computed, reactive, provide, watch, openBlock, createElementBlock, withModifiers, createVNode, unref, withCtx, renderSlot } from "vue";
|
|
53
53
|
import { u as useChildren } from "../useChildren-BZ4-J79J.js";
|
|
54
54
|
import { g as getPropByPath, f as isPromise } from "../util-DnfK0Qan.js";
|
|
55
|
-
import
|
|
56
|
-
import { F as
|
|
55
|
+
import { CellGroup as _sfc_main$1 } from "../cellgroup/CellGroup.js";
|
|
56
|
+
import { F as FORM_TIP_KEY, a as FORM_KEY, b as FORM_DISABLED_KEY } from "../common-BH7uB7Cn.js";
|
|
57
57
|
import { w as withInstall } from "../with-install-Ch3FF0uS.js";
|
|
58
58
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
59
59
|
name: "NutForm"
|
|
@@ -75,7 +75,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
75
75
|
const { linkChildren: linkChildren2 } = useChildren(FORM_DISABLED_KEY);
|
|
76
76
|
linkChildren2({ props });
|
|
77
77
|
const formErrorTip = computed(() => reactive({}));
|
|
78
|
-
provide(
|
|
78
|
+
provide(FORM_TIP_KEY, formErrorTip);
|
|
79
79
|
const clearErrorTips = () => {
|
|
80
80
|
Object.keys(formErrorTip.value).forEach((item) => {
|
|
81
81
|
formErrorTip.value[item] = "";
|
|
@@ -199,7 +199,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
199
199
|
action: "#",
|
|
200
200
|
onSubmit: withModifiers(() => false, ["prevent"])
|
|
201
201
|
}, [
|
|
202
|
-
createVNode(
|
|
202
|
+
createVNode(unref(_sfc_main$1), null, {
|
|
203
203
|
default: withCtx(() => [
|
|
204
204
|
renderSlot(_ctx.$slots, "default")
|
|
205
205
|
]),
|
|
@@ -17,10 +17,10 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, computed, inject, openBlock, createBlock,
|
|
20
|
+
import { defineComponent, computed, inject, openBlock, createBlock, unref, normalizeClass, normalizeStyle, withCtx, createElementBlock, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode } from "vue";
|
|
21
21
|
import { p as pxCheck } from "../pxCheck-DN6FYV6q.js";
|
|
22
|
-
import
|
|
23
|
-
import { F as FORM_KEY } from "../common-
|
|
22
|
+
import { Cell as _sfc_main$1 } from "../cell/Cell.js";
|
|
23
|
+
import { F as FORM_TIP_KEY, a as FORM_KEY } from "../common-BH7uB7Cn.js";
|
|
24
24
|
import { u as useParent } from "../useParent-D6DiuxZZ.js";
|
|
25
25
|
import { w as withInstall } from "../with-install-Ch3FF0uS.js";
|
|
26
26
|
const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
|
|
@@ -67,7 +67,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
67
67
|
const position = props.starPosition ? props.starPosition : starPosition;
|
|
68
68
|
return position !== "left" ? `nut-form-item__star-${position}` : "";
|
|
69
69
|
});
|
|
70
|
-
const parent = inject(
|
|
70
|
+
const parent = inject(FORM_TIP_KEY);
|
|
71
71
|
const labelStyle = computed(() => {
|
|
72
72
|
return {
|
|
73
73
|
width: pxCheck(props.labelWidth),
|
|
@@ -85,7 +85,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
85
85
|
};
|
|
86
86
|
});
|
|
87
87
|
return (_ctx, _cache) => {
|
|
88
|
-
return openBlock(), createBlock(
|
|
88
|
+
return openBlock(), createBlock(unref(_sfc_main$1), {
|
|
89
89
|
class: normalizeClass(["nut-form-item", [{ error: unref(parent)[_ctx.prop], line: _ctx.showErrorLine }, _ctx.$attrs.class, labelPositionClass.value]]),
|
|
90
90
|
style: normalizeStyle(_ctx.$attrs.style)
|
|
91
91
|
}, {
|
|
@@ -1,8 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } from "vue";
|
|
21
|
+
import { u as useChildren } from "../useChildren-BZ4-J79J.js";
|
|
22
|
+
import { p as pxCheck } from "../pxCheck-DN6FYV6q.js";
|
|
23
|
+
import { G as GRID_KEY } from "../types-CJeZIBld.js";
|
|
24
|
+
import { w as withInstall } from "../with-install-Ch3FF0uS.js";
|
|
25
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
26
|
+
name: "NutGrid"
|
|
27
|
+
}), {
|
|
28
|
+
__name: "grid",
|
|
29
|
+
props: {
|
|
30
|
+
columnNum: { default: 4 },
|
|
31
|
+
border: { type: Boolean, default: true },
|
|
32
|
+
gutter: { default: 0 },
|
|
33
|
+
center: { type: Boolean, default: true },
|
|
34
|
+
square: { type: Boolean, default: false },
|
|
35
|
+
reverse: { type: Boolean, default: false },
|
|
36
|
+
direction: {},
|
|
37
|
+
clickable: { type: Boolean, default: false }
|
|
38
|
+
},
|
|
39
|
+
setup(__props) {
|
|
40
|
+
const props = __props;
|
|
41
|
+
const { linkChildren } = useChildren(GRID_KEY);
|
|
42
|
+
linkChildren({ props });
|
|
43
|
+
const rootClass = computed(() => {
|
|
44
|
+
const prefixCls = "nut-grid";
|
|
45
|
+
return {
|
|
46
|
+
[prefixCls]: true,
|
|
47
|
+
[`${prefixCls}--border`]: props.border && !props.gutter
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const rootStyle = computed(() => {
|
|
51
|
+
const style = {};
|
|
52
|
+
if (props.gutter) {
|
|
53
|
+
style.paddingLeft = pxCheck(props.gutter);
|
|
54
|
+
}
|
|
55
|
+
return style;
|
|
56
|
+
});
|
|
57
|
+
return (_ctx, _cache) => {
|
|
58
|
+
return openBlock(), createElementBlock("view", {
|
|
59
|
+
class: normalizeClass(rootClass.value),
|
|
60
|
+
style: normalizeStyle(rootStyle.value)
|
|
61
|
+
}, [
|
|
62
|
+
renderSlot(_ctx.$slots, "default")
|
|
63
|
+
], 6);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
withInstall(_sfc_main);
|
|
6
68
|
export {
|
|
69
|
+
_sfc_main as Grid,
|
|
7
70
|
_sfc_main as default
|
|
8
71
|
};
|