@nutui/nutui 4.0.5 → 4.0.6-beta.2

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.
@@ -168,30 +168,7 @@ const _sfc_main = create({
168
168
  range: [minSeconds, maxSeconds]
169
169
  }
170
170
  ];
171
- switch (props.type) {
172
- case "date":
173
- result = result.slice(0, 3);
174
- break;
175
- case "datetime":
176
- result = result.slice(0, 5);
177
- break;
178
- case "time":
179
- result = result.slice(3, 6);
180
- break;
181
- case "year-month":
182
- result = result.slice(0, 2);
183
- break;
184
- case "month-day":
185
- result = result.slice(1, 3);
186
- break;
187
- case "datehour":
188
- result = result.slice(0, 4);
189
- break;
190
- case "hour-minute":
191
- result = result.slice(3, 5);
192
- break;
193
- }
194
- return result;
171
+ return generateList(result);
195
172
  });
196
173
  const columns = computed(() => {
197
174
  const val = ranges.value.map((res, columnIndex) => {
@@ -281,6 +258,43 @@ const _sfc_main = create({
281
258
  const confirm = (val) => {
282
259
  emit("confirm", val);
283
260
  };
261
+ const generateList = (list) => {
262
+ switch (props.type) {
263
+ case "date":
264
+ list = list.slice(0, 3);
265
+ break;
266
+ case "datetime":
267
+ list = list.slice(0, 5);
268
+ break;
269
+ case "time":
270
+ list = list.slice(3, 6);
271
+ break;
272
+ case "year-month":
273
+ list = list.slice(0, 2);
274
+ break;
275
+ case "month-day":
276
+ list = list.slice(1, 3);
277
+ break;
278
+ case "datehour":
279
+ list = list.slice(0, 4);
280
+ break;
281
+ case "hour-minute":
282
+ list = list.slice(3, 5);
283
+ break;
284
+ }
285
+ return list;
286
+ };
287
+ const getSelectedValue = (time) => {
288
+ const res = [
289
+ time.getFullYear(),
290
+ time.getMonth() + 1,
291
+ time.getDate(),
292
+ time.getHours(),
293
+ time.getMinutes(),
294
+ time.getSeconds()
295
+ ];
296
+ return generateList(res.map((i) => String(i)));
297
+ };
284
298
  onBeforeMount(() => {
285
299
  state.currentDate = formatValue(props.modelValue);
286
300
  });
@@ -291,6 +305,7 @@ const _sfc_main = create({
291
305
  const isSameValue = JSON.stringify(newValues) === JSON.stringify(state.currentDate);
292
306
  if (!isSameValue) {
293
307
  state.currentDate = newValues;
308
+ state.selectedValue = getSelectedValue(newValues);
294
309
  }
295
310
  }
296
311
  );
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { ref, onMounted, watch, computed, resolveComponent, openBlock, createBlock, normalizeStyle, withCtx, createElementVNode, normalizeClass, createElementBlock, renderSlot, Fragment, createTextVNode, toDisplayString, createCommentVNode, resolveDynamicComponent, h } from "vue";
8
8
  import { c as createComponent } from "./component-81a4c1d0.js";
9
- import { f as funInterceptor } from "./interceptor-956b24fc.js";
9
+ import { f as funInterceptor } from "./Interceptor-956b24fc.js";
10
10
  import { P as Popup, p as popupProps } from "./index-c55ad69e.js";
11
11
  import Button from "./Button.js";
12
12
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
@@ -14,7 +14,7 @@ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
14
14
  import { CircleClose } from "@nutui/icons-vue";
15
15
  import { P as Popup } from "./index-c55ad69e.js";
16
16
  import Swiper from "./Swiper.js";
17
- import { f as funInterceptor } from "./interceptor-956b24fc.js";
17
+ import { f as funInterceptor } from "./Interceptor-956b24fc.js";
18
18
  import "../locale/lang";
19
19
  import { C as CreateComponent } from "./mountComponent-8b24c346.js";
20
20
  import Overlay from "./Overlay.js";
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { reactive, computed, h, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString, createVNode } from "vue";
8
8
  import { c as createComponent } from "./component-81a4c1d0.js";
9
- import { f as funInterceptor } from "./interceptor-956b24fc.js";
9
+ import { f as funInterceptor } from "./Interceptor-956b24fc.js";
10
10
  import Progress from "./Progress.js";
11
11
  import { Photograph, Failure, Loading, Del, Link } from "@nutui/icons-vue";
12
12
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "NutUI",
5
- "version": "4.0.5",
5
+ "version": "4.0.6-beta.2",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "tags": [
@@ -1687,7 +1687,7 @@
1687
1687
  {
1688
1688
  "name": "type",
1689
1689
  "default": "`date`",
1690
- "description": "时间类型,可选值 `date`(年月日) `time`(时分秒) `year-month`(年月) `month-day`(月日) `datehour`(年月日时) `hour-minute`(时分)",
1690
+ "description": "时间类型,可选值 `date`(年月日) `time`(时分秒) `year-month`(年月) `month-day`(月日) `datehour`(年月日时) `hour-minute`(时分`v4.0.5`)",
1691
1691
  "value": {
1692
1692
  "type": "string",
1693
1693
  "kind": "expression"