@deot/vc-components 1.0.9 → 1.0.10

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/index.cjs CHANGED
@@ -3126,6 +3126,10 @@ const props$Y = {
3126
3126
  changeOnSelect: {
3127
3127
  type: Boolean,
3128
3128
  default: false
3129
+ },
3130
+ nullValue: {
3131
+ type: [Number, String, Object],
3132
+ default: ""
3129
3133
  }
3130
3134
  };
3131
3135
 
@@ -4421,6 +4425,7 @@ const DEFAULT_FORMATS = {
4421
4425
  datetime: "YYYY-MM-DD HH:mm:ss",
4422
4426
  time: "HH:mm:ss",
4423
4427
  timerange: "HH:mm:ss",
4428
+ monthrange: "YYYY-MM",
4424
4429
  daterange: "YYYY-MM-DD",
4425
4430
  datetimerange: "YYYY-MM-DD HH:mm:ss"
4426
4431
  };
@@ -4968,8 +4973,8 @@ const useBase = () => {
4968
4973
  const props = instance.props;
4969
4974
  const isHover = vue.ref(false);
4970
4975
  const isActive = vue.ref(false);
4971
- const currentValue = vue.ref("");
4972
- const focusedDate = vue.ref(null);
4976
+ const currentValue = vue.ref([]);
4977
+ const focusedDate = vue.ref();
4973
4978
  const formItem = vue.inject("vc-form-item", {});
4974
4979
  const its = vcHooks.useAttrs({ merge: false });
4975
4980
  const formatDateText = (value) => {
@@ -5034,23 +5039,22 @@ const useBase = () => {
5034
5039
  };
5035
5040
  const parseValue = (val) => {
5036
5041
  if (isEmpty(val)) {
5037
- return isRange.value ? [null, null] : [];
5042
+ return [];
5038
5043
  }
5039
5044
  return parserDate(val);
5040
5045
  };
5041
- const rest = (date) => {
5042
- currentValue.value = date;
5046
+ const reset = (v) => {
5047
+ currentValue.value = value2Array(v);
5043
5048
  };
5044
5049
  const sync = (eventName, value) => {
5045
- const date = isRange.value || isQuarter.value ? value : value[0];
5046
- const dateString = formatDate(value);
5047
- emit("input", date);
5048
- emit("update:modelValue", dateString);
5050
+ const formatValue = formatDate(isRange.value || isQuarter.value ? value : value[0]) || props.nullValue;
5051
+ emit("update:modelValue", formatValue);
5049
5052
  eventName = typeof eventName === "string" ? [eventName] : eventName;
5050
5053
  eventName.forEach((name) => {
5051
- emit(name, dateString, rest);
5054
+ emit(name, formatValue, reset);
5052
5055
  });
5053
- formItem?.change?.(date);
5056
+ formItem?.change?.();
5057
+ return formatValue;
5054
5058
  };
5055
5059
  const executePromise = (promiseFn, cb, param) => {
5056
5060
  try {
@@ -5080,11 +5084,9 @@ const useBase = () => {
5080
5084
  };
5081
5085
  const handleClear = () => {
5082
5086
  const clear = () => {
5083
- const date = isRange.value ? [] : "";
5084
5087
  isActive.value = false;
5085
- currentValue.value = date;
5086
- sync("change", date);
5087
- emit("clear", date);
5088
+ currentValue.value = [];
5089
+ emit("clear", sync("change", []));
5088
5090
  };
5089
5091
  executePromise(instance.vnode.props?.onBeforeClear, clear);
5090
5092
  };
@@ -5101,10 +5103,10 @@ const useBase = () => {
5101
5103
  executePromise(instance.vnode.props?.onBeforeOk, ok, value);
5102
5104
  };
5103
5105
  const handleClose = () => {
5104
- const val = parseValue(props.modelValue);
5105
- const isSetValueProp = instance.props.modelValue;
5106
- if (!lodashEs.isEqualWith(currentValue.value, val) && isSetValueProp) {
5107
- currentValue.value = value2Array(val);
5106
+ const v = parseValue(props.modelValue);
5107
+ const isSetValueProp = props.modelValue;
5108
+ if (!lodashEs.isEqualWith(currentValue.value, v) && isSetValueProp) {
5109
+ currentValue.value = value2Array(v);
5108
5110
  }
5109
5111
  emit("close");
5110
5112
  };
@@ -5112,7 +5114,7 @@ const useBase = () => {
5112
5114
  () => props.modelValue,
5113
5115
  (v) => {
5114
5116
  v = parseValue(v);
5115
- focusedDate.value = v[0] || props.startDate || /* @__PURE__ */ new Date();
5117
+ focusedDate.value = v?.[0] || props.startDate || /* @__PURE__ */ new Date();
5116
5118
  currentValue.value = value2Array(v);
5117
5119
  },
5118
5120
  { immediate: true }
@@ -5148,7 +5150,7 @@ const useBase = () => {
5148
5150
 
5149
5151
  /** @jsxImportSource vue */
5150
5152
 
5151
- const COMPONENT_NAME$1l = 'vc-picker';
5153
+ const COMPONENT_NAME$1l = 'vc-date-picker';
5152
5154
  const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ vue.defineComponent({
5153
5155
  name: COMPONENT_NAME$1l,
5154
5156
  props: Object.assign(props$Y, pickerProps),
@@ -5206,7 +5208,7 @@ const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ vue.defineCompo
5206
5208
  "disabled": props.disabled,
5207
5209
  "modelValue": visibleValue.value,
5208
5210
  "allowDispatch": false,
5209
- "class": "vc-picker__input",
5211
+ "class": "vc-date-picker__input",
5210
5212
  "readonly": true,
5211
5213
  "placeholder": props.placeholder || '请选择'
5212
5214
  }, {
@@ -5214,7 +5216,7 @@ const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ vue.defineCompo
5214
5216
  return vue.createVNode("div", {
5215
5217
  "class": [{
5216
5218
  'is-clear': showClear
5217
- }, 'vc-picker__append']
5219
+ }, 'vc-date-picker__append']
5218
5220
  }, [vue.createVNode(Icon, {
5219
5221
  "type": showClear.value ? 'clear' : icon.value,
5220
5222
  "onClick": handleIconClick
@@ -10392,11 +10394,6 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
10392
10394
  };
10393
10395
  });
10394
10396
  vcHooks.useScrollbar(isActive);
10395
- vue.watch(() => props.modelValue, v => {
10396
- isActive.value = v;
10397
- }, {
10398
- immediate: true
10399
- });
10400
10397
  let startX = 0;
10401
10398
  let startY = 0;
10402
10399
  // Portal调用时,可作为初始值
@@ -10423,7 +10420,17 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
10423
10420
  }, 250, {
10424
10421
  leading: true
10425
10422
  });
10426
- const handleEnter = () => resetOrigin();
10423
+ const isTransitionEnd = vue.ref(false);
10424
+ const handleBeforeEnter = () => {
10425
+ isTransitionEnd.value = false;
10426
+ };
10427
+ const handleEnter = () => {
10428
+ resetOrigin();
10429
+ };
10430
+ const handleAfterEnter = () => {
10431
+ isTransitionEnd.value = true;
10432
+ resizer.value.refresh();
10433
+ };
10427
10434
  /**
10428
10435
  * 动画执行后关闭, 关闭事件都会被执行
10429
10436
  * visible-change 由移除之后触发
@@ -10494,11 +10501,15 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
10494
10501
  * 这里由于scroller的resize时,render会重置height(实际上就是保留height, 无法移除)
10495
10502
  * 1. 改用nextTick, 抖动严重
10496
10503
  * 2. resizer.value.refresh, 不抖动
10504
+ *
10505
+ * container在最大值时,需要移除,宽度才会缩回去
10497
10506
  */
10498
10507
  const handleContentResize = () => {
10499
- const has = !!scroller.value.wrapper.style.getPropertyValue('height');
10500
- has && scroller.value.wrapper.style.removeProperty('height');
10501
- has && resizer.value.refresh();
10508
+ const needRefreshScroller = !!scroller.value.wrapper.style.getPropertyValue('height');
10509
+ const needRefreshContainer = !!container.value.style.getPropertyValue('height');
10510
+ needRefreshContainer && container.value.style.removeProperty('height');
10511
+ needRefreshScroller && scroller.value.wrapper.style.removeProperty('height');
10512
+ needRefreshScroller && resizer.value.refresh();
10502
10513
  };
10503
10514
  const handleClick = e => {
10504
10515
  // isActive click先触发,后设置后
@@ -10563,6 +10574,11 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
10563
10574
  document.removeEventListener('mousemove', handleMouseMove);
10564
10575
  document.removeEventListener('mouseup', handleMouseUp);
10565
10576
  });
10577
+ vue.watch(() => props.modelValue, v => {
10578
+ isActive.value = v;
10579
+ }, {
10580
+ immediate: true
10581
+ });
10566
10582
  expose({
10567
10583
  isActive,
10568
10584
  // for portal
@@ -10591,7 +10607,9 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
10591
10607
  "onClick": e => handleClose(e, false)
10592
10608
  }, [vue.createVNode(TransitionScale, {
10593
10609
  "mode": "part",
10610
+ "onBeforeEnter": handleBeforeEnter,
10594
10611
  "onEnter": handleEnter,
10612
+ "onAfterEnter": handleAfterEnter,
10595
10613
  "onAfterLeave": handleRemove
10596
10614
  }, {
10597
10615
  default: () => [vue.withDirectives(vue.createVNode("div", {
@@ -10627,8 +10645,8 @@ const ModalView = /* @__PURE__ */ vue.defineComponent({
10627
10645
  return vue.createVNode(Scroller, {
10628
10646
  "ref": scroller,
10629
10647
  "native": false,
10630
- "always": true,
10631
- "height": row.height,
10648
+ "always": false,
10649
+ "height": isTransitionEnd.value ? row.height : void 0,
10632
10650
  "contentClass": [{
10633
10651
  'is-confirm': props.mode
10634
10652
  }, props.portalClass, 'vc-modal__content']
@@ -12173,7 +12191,7 @@ const Circle = /* @__PURE__ */ vue.defineComponent({
12173
12191
  "fill-opacity": "0"
12174
12192
  }, null)]), vue.createVNode("div", {
12175
12193
  "class": "vc-progress-circle__inner"
12176
- }, [slots.default ? slots.default() : vue.createVNode("span", null, [`${props.percent}%`])])])]);
12194
+ }, [slots.default ? slots.default() : props.showText && vue.createVNode("span", null, [`${props.percent}%`])])])]);
12177
12195
  };
12178
12196
  }
12179
12197
  });
@@ -15239,7 +15257,8 @@ const Upload = vue.defineComponent({
15239
15257
  const { mode, size } = props;
15240
15258
  const onRequest = instance.vnode.props?.onRequest || VcInstance.options.Upload?.onRequest || (() => {
15241
15259
  });
15242
- const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse;
15260
+ const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse || (() => {
15261
+ });
15243
15262
  const $mode = mode.replace(/s$/, "");
15244
15263
  const onError = async (originalResponse, internalMessage) => {
15245
15264
  delete requests[vFile.uploadId];
@@ -15248,9 +15267,17 @@ const Upload = vue.defineComponent({
15248
15267
  emitError(originalResponse, internalMessage);
15249
15268
  done(vFile);
15250
15269
  };
15251
- const onSuccess = async (originalResponse) => {
15270
+ const onSuccess = async (request) => {
15252
15271
  try {
15253
- const response = await onResponse(originalResponse, options) || originalResponse;
15272
+ let response = await onResponse(request, options) || request;
15273
+ if (response === request) {
15274
+ const text = request.responseType ? request.responseText : request.response;
15275
+ try {
15276
+ response = JSON.parse(text);
15277
+ } catch {
15278
+ response = text;
15279
+ }
15280
+ }
15254
15281
  delete requests[vFile.uploadId];
15255
15282
  cycle.success++;
15256
15283
  cycle.responses = [...cycle.responses, response];
@@ -15284,7 +15311,7 @@ const Upload = vue.defineComponent({
15284
15311
  xhr.onreadystatechange = () => {
15285
15312
  if (xhr.readyState !== 4 || xhr.status === 0) return;
15286
15313
  if (xhr.status >= 200 && xhr.status < 300) {
15287
- onSuccess(!xhr.responseType ? xhr.responseText : xhr.response);
15314
+ onSuccess(xhr);
15288
15315
  } else {
15289
15316
  onError({}, `服务异常`);
15290
15317
  }
package/dist/index.d.ts CHANGED
@@ -658,6 +658,10 @@ changeOnSelect: {
658
658
  type: BooleanConstructor;
659
659
  default: boolean;
660
660
  };
661
+ nullValue: {
662
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
663
+ default: string;
664
+ };
661
665
  disabled: {
662
666
  type: BooleanConstructor;
663
667
  default: boolean;
@@ -720,6 +724,10 @@ changeOnSelect: {
720
724
  type: BooleanConstructor;
721
725
  default: boolean;
722
726
  };
727
+ nullValue: {
728
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
729
+ default: string;
730
+ };
723
731
  disabled: {
724
732
  type: BooleanConstructor;
725
733
  default: boolean;
@@ -757,6 +765,7 @@ separator: string;
757
765
  splitPanels: boolean;
758
766
  steps: unknown[];
759
767
  changeOnSelect: boolean;
768
+ nullValue: string | number | Record<string, any>;
760
769
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
761
770
 
762
771
  declare const Debounce: DefineComponent<ExtractPropTypes< {
@@ -1859,11 +1868,11 @@ allowDispatch: boolean;
1859
1868
  bytes: boolean;
1860
1869
  controllable: boolean;
1861
1870
  required: boolean;
1871
+ nullValue: string | number | Record<string, any>;
1862
1872
  min: number;
1863
1873
  max: number;
1864
1874
  step: number | boolean;
1865
1875
  precision: number;
1866
- nullValue: string | number | Record<string, any>;
1867
1876
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
1868
1877
 
1869
1878
  export declare const InputSearch: DefineComponent<ExtractPropTypes< {
@@ -2685,6 +2694,10 @@ changeOnSelect: {
2685
2694
  type: BooleanConstructor;
2686
2695
  default: boolean;
2687
2696
  };
2697
+ nullValue: {
2698
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
2699
+ default: string;
2700
+ };
2688
2701
  disabled: {
2689
2702
  type: BooleanConstructor;
2690
2703
  default: boolean;
@@ -2747,6 +2760,10 @@ changeOnSelect: {
2747
2760
  type: BooleanConstructor;
2748
2761
  default: boolean;
2749
2762
  };
2763
+ nullValue: {
2764
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
2765
+ default: string;
2766
+ };
2750
2767
  disabled: {
2751
2768
  type: BooleanConstructor;
2752
2769
  default: boolean;
@@ -2784,6 +2801,7 @@ separator: string;
2784
2801
  splitPanels: boolean;
2785
2802
  steps: unknown[];
2786
2803
  changeOnSelect: boolean;
2804
+ nullValue: string | number | Record<string, any>;
2787
2805
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
2788
2806
 
2789
2807
  export declare const MDivider: DefineComponent<ExtractPropTypes< {
@@ -4093,11 +4111,11 @@ allowDispatch: boolean;
4093
4111
  bytes: boolean;
4094
4112
  controllable: boolean;
4095
4113
  required: boolean;
4114
+ nullValue: string | number | Record<string, any>;
4096
4115
  min: number;
4097
4116
  max: number;
4098
4117
  step: number | boolean;
4099
4118
  precision: number;
4100
- nullValue: string | number | Record<string, any>;
4101
4119
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
4102
4120
 
4103
4121
  export declare const MInputSearch: DefineComponent<ExtractPropTypes< {
@@ -6655,8 +6673,8 @@ arrow: boolean;
6655
6673
  autoWidth: boolean;
6656
6674
  trigger: string;
6657
6675
  separator: string;
6658
- max: number;
6659
6676
  nullValue: string | number | Record<string, any>;
6677
+ max: number;
6660
6678
  searchPlaceholder: string;
6661
6679
  searchable: boolean;
6662
6680
  numerable: boolean;
@@ -7217,6 +7235,10 @@ changeOnSelect: {
7217
7235
  type: BooleanConstructor;
7218
7236
  default: boolean;
7219
7237
  };
7238
+ nullValue: {
7239
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
7240
+ default: string;
7241
+ };
7220
7242
  disabled: {
7221
7243
  type: BooleanConstructor;
7222
7244
  default: boolean;
@@ -7279,6 +7301,10 @@ changeOnSelect: {
7279
7301
  type: BooleanConstructor;
7280
7302
  default: boolean;
7281
7303
  };
7304
+ nullValue: {
7305
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
7306
+ default: string;
7307
+ };
7282
7308
  disabled: {
7283
7309
  type: BooleanConstructor;
7284
7310
  default: boolean;
@@ -7316,6 +7342,7 @@ separator: string;
7316
7342
  splitPanels: boolean;
7317
7343
  steps: unknown[];
7318
7344
  changeOnSelect: boolean;
7345
+ nullValue: string | number | Record<string, any>;
7319
7346
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
7320
7347
 
7321
7348
  export declare const MToast: {
@@ -9999,8 +10026,8 @@ arrow: boolean;
9999
10026
  autoWidth: boolean;
10000
10027
  trigger: string;
10001
10028
  separator: string;
10002
- max: number;
10003
10029
  nullValue: string | number | Record<string, any>;
10030
+ max: number;
10004
10031
  searchPlaceholder: string;
10005
10032
  searchable: boolean;
10006
10033
  numerable: boolean;
@@ -10768,6 +10795,10 @@ changeOnSelect: {
10768
10795
  type: BooleanConstructor;
10769
10796
  default: boolean;
10770
10797
  };
10798
+ nullValue: {
10799
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
10800
+ default: string;
10801
+ };
10771
10802
  disabled: {
10772
10803
  type: BooleanConstructor;
10773
10804
  default: boolean;
@@ -10830,6 +10861,10 @@ changeOnSelect: {
10830
10861
  type: BooleanConstructor;
10831
10862
  default: boolean;
10832
10863
  };
10864
+ nullValue: {
10865
+ type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
10866
+ default: string;
10867
+ };
10833
10868
  disabled: {
10834
10869
  type: BooleanConstructor;
10835
10870
  default: boolean;
@@ -10867,6 +10902,7 @@ separator: string;
10867
10902
  splitPanels: boolean;
10868
10903
  steps: unknown[];
10869
10904
  changeOnSelect: boolean;
10905
+ nullValue: string | number | Record<string, any>;
10870
10906
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
10871
10907
 
10872
10908
  export declare const Toast: {
@@ -7643,6 +7643,10 @@ var VcComponents = (function (exports, vue) {
7643
7643
  changeOnSelect: {
7644
7644
  type: Boolean,
7645
7645
  default: false
7646
+ },
7647
+ nullValue: {
7648
+ type: [Number, String, Object],
7649
+ default: ""
7646
7650
  }
7647
7651
  };
7648
7652
 
@@ -9002,6 +9006,7 @@ var VcComponents = (function (exports, vue) {
9002
9006
  datetime: "YYYY-MM-DD HH:mm:ss",
9003
9007
  time: "HH:mm:ss",
9004
9008
  timerange: "HH:mm:ss",
9009
+ monthrange: "YYYY-MM",
9005
9010
  daterange: "YYYY-MM-DD",
9006
9011
  datetimerange: "YYYY-MM-DD HH:mm:ss"
9007
9012
  };
@@ -9549,8 +9554,8 @@ var VcComponents = (function (exports, vue) {
9549
9554
  const props = instance.props;
9550
9555
  const isHover = vue.ref(false);
9551
9556
  const isActive = vue.ref(false);
9552
- const currentValue = vue.ref("");
9553
- const focusedDate = vue.ref(null);
9557
+ const currentValue = vue.ref([]);
9558
+ const focusedDate = vue.ref();
9554
9559
  const formItem = vue.inject("vc-form-item", {});
9555
9560
  const its = useAttrs({ merge: false });
9556
9561
  const formatDateText = (value) => {
@@ -9615,23 +9620,22 @@ var VcComponents = (function (exports, vue) {
9615
9620
  };
9616
9621
  const parseValue = (val) => {
9617
9622
  if (isEmpty(val)) {
9618
- return isRange.value ? [null, null] : [];
9623
+ return [];
9619
9624
  }
9620
9625
  return parserDate(val);
9621
9626
  };
9622
- const rest = (date) => {
9623
- currentValue.value = date;
9627
+ const reset = (v) => {
9628
+ currentValue.value = value2Array(v);
9624
9629
  };
9625
9630
  const sync = (eventName, value) => {
9626
- const date = isRange.value || isQuarter.value ? value : value[0];
9627
- const dateString = formatDate(value);
9628
- emit("input", date);
9629
- emit("update:modelValue", dateString);
9631
+ const formatValue = formatDate(isRange.value || isQuarter.value ? value : value[0]) || props.nullValue;
9632
+ emit("update:modelValue", formatValue);
9630
9633
  eventName = typeof eventName === "string" ? [eventName] : eventName;
9631
9634
  eventName.forEach((name) => {
9632
- emit(name, dateString, rest);
9635
+ emit(name, formatValue, reset);
9633
9636
  });
9634
- formItem?.change?.(date);
9637
+ formItem?.change?.();
9638
+ return formatValue;
9635
9639
  };
9636
9640
  const executePromise = (promiseFn, cb, param) => {
9637
9641
  try {
@@ -9661,11 +9665,9 @@ var VcComponents = (function (exports, vue) {
9661
9665
  };
9662
9666
  const handleClear = () => {
9663
9667
  const clear = () => {
9664
- const date = isRange.value ? [] : "";
9665
9668
  isActive.value = false;
9666
- currentValue.value = date;
9667
- sync("change", date);
9668
- emit("clear", date);
9669
+ currentValue.value = [];
9670
+ emit("clear", sync("change", []));
9669
9671
  };
9670
9672
  executePromise(instance.vnode.props?.onBeforeClear, clear);
9671
9673
  };
@@ -9682,10 +9684,10 @@ var VcComponents = (function (exports, vue) {
9682
9684
  executePromise(instance.vnode.props?.onBeforeOk, ok, value);
9683
9685
  };
9684
9686
  const handleClose = () => {
9685
- const val = parseValue(props.modelValue);
9686
- const isSetValueProp = instance.props.modelValue;
9687
- if (!isEqualWith(currentValue.value, val) && isSetValueProp) {
9688
- currentValue.value = value2Array(val);
9687
+ const v = parseValue(props.modelValue);
9688
+ const isSetValueProp = props.modelValue;
9689
+ if (!isEqualWith(currentValue.value, v) && isSetValueProp) {
9690
+ currentValue.value = value2Array(v);
9689
9691
  }
9690
9692
  emit("close");
9691
9693
  };
@@ -9693,7 +9695,7 @@ var VcComponents = (function (exports, vue) {
9693
9695
  () => props.modelValue,
9694
9696
  (v) => {
9695
9697
  v = parseValue(v);
9696
- focusedDate.value = v[0] || props.startDate || /* @__PURE__ */ new Date();
9698
+ focusedDate.value = v?.[0] || props.startDate || /* @__PURE__ */ new Date();
9697
9699
  currentValue.value = value2Array(v);
9698
9700
  },
9699
9701
  { immediate: true }
@@ -9729,7 +9731,7 @@ var VcComponents = (function (exports, vue) {
9729
9731
 
9730
9732
  /** @jsxImportSource vue */
9731
9733
 
9732
- const COMPONENT_NAME$1l = 'vc-picker';
9734
+ const COMPONENT_NAME$1l = 'vc-date-picker';
9733
9735
  const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ vue.defineComponent({
9734
9736
  name: COMPONENT_NAME$1l,
9735
9737
  props: Object.assign(props$Y, pickerProps),
@@ -9787,7 +9789,7 @@ var VcComponents = (function (exports, vue) {
9787
9789
  "disabled": props.disabled,
9788
9790
  "modelValue": visibleValue.value,
9789
9791
  "allowDispatch": false,
9790
- "class": "vc-picker__input",
9792
+ "class": "vc-date-picker__input",
9791
9793
  "readonly": true,
9792
9794
  "placeholder": props.placeholder || '请选择'
9793
9795
  }, {
@@ -9795,7 +9797,7 @@ var VcComponents = (function (exports, vue) {
9795
9797
  return vue.createVNode("div", {
9796
9798
  "class": [{
9797
9799
  'is-clear': showClear
9798
- }, 'vc-picker__append']
9800
+ }, 'vc-date-picker__append']
9799
9801
  }, [vue.createVNode(Icon, {
9800
9802
  "type": showClear.value ? 'clear' : icon.value,
9801
9803
  "onClick": handleIconClick
@@ -16413,11 +16415,6 @@ var VcComponents = (function (exports, vue) {
16413
16415
  };
16414
16416
  });
16415
16417
  useScrollbar(isActive);
16416
- vue.watch(() => props.modelValue, v => {
16417
- isActive.value = v;
16418
- }, {
16419
- immediate: true
16420
- });
16421
16418
  let startX = 0;
16422
16419
  let startY = 0;
16423
16420
  // Portal调用时,可作为初始值
@@ -16444,7 +16441,17 @@ var VcComponents = (function (exports, vue) {
16444
16441
  }, 250, {
16445
16442
  leading: true
16446
16443
  });
16447
- const handleEnter = () => resetOrigin();
16444
+ const isTransitionEnd = vue.ref(false);
16445
+ const handleBeforeEnter = () => {
16446
+ isTransitionEnd.value = false;
16447
+ };
16448
+ const handleEnter = () => {
16449
+ resetOrigin();
16450
+ };
16451
+ const handleAfterEnter = () => {
16452
+ isTransitionEnd.value = true;
16453
+ resizer.value.refresh();
16454
+ };
16448
16455
  /**
16449
16456
  * 动画执行后关闭, 关闭事件都会被执行
16450
16457
  * visible-change 由移除之后触发
@@ -16515,11 +16522,15 @@ var VcComponents = (function (exports, vue) {
16515
16522
  * 这里由于scroller的resize时,render会重置height(实际上就是保留height, 无法移除)
16516
16523
  * 1. 改用nextTick, 抖动严重
16517
16524
  * 2. resizer.value.refresh, 不抖动
16525
+ *
16526
+ * container在最大值时,需要移除,宽度才会缩回去
16518
16527
  */
16519
16528
  const handleContentResize = () => {
16520
- const has = !!scroller.value.wrapper.style.getPropertyValue('height');
16521
- has && scroller.value.wrapper.style.removeProperty('height');
16522
- has && resizer.value.refresh();
16529
+ const needRefreshScroller = !!scroller.value.wrapper.style.getPropertyValue('height');
16530
+ const needRefreshContainer = !!container.value.style.getPropertyValue('height');
16531
+ needRefreshContainer && container.value.style.removeProperty('height');
16532
+ needRefreshScroller && scroller.value.wrapper.style.removeProperty('height');
16533
+ needRefreshScroller && resizer.value.refresh();
16523
16534
  };
16524
16535
  const handleClick = e => {
16525
16536
  // isActive click先触发,后设置后
@@ -16584,6 +16595,11 @@ var VcComponents = (function (exports, vue) {
16584
16595
  document.removeEventListener('mousemove', handleMouseMove);
16585
16596
  document.removeEventListener('mouseup', handleMouseUp);
16586
16597
  });
16598
+ vue.watch(() => props.modelValue, v => {
16599
+ isActive.value = v;
16600
+ }, {
16601
+ immediate: true
16602
+ });
16587
16603
  expose({
16588
16604
  isActive,
16589
16605
  // for portal
@@ -16612,7 +16628,9 @@ var VcComponents = (function (exports, vue) {
16612
16628
  "onClick": e => handleClose(e, false)
16613
16629
  }, [vue.createVNode(TransitionScale, {
16614
16630
  "mode": "part",
16631
+ "onBeforeEnter": handleBeforeEnter,
16615
16632
  "onEnter": handleEnter,
16633
+ "onAfterEnter": handleAfterEnter,
16616
16634
  "onAfterLeave": handleRemove
16617
16635
  }, {
16618
16636
  default: () => [vue.withDirectives(vue.createVNode("div", {
@@ -16648,8 +16666,8 @@ var VcComponents = (function (exports, vue) {
16648
16666
  return vue.createVNode(Scroller, {
16649
16667
  "ref": scroller,
16650
16668
  "native": false,
16651
- "always": true,
16652
- "height": row.height,
16669
+ "always": false,
16670
+ "height": isTransitionEnd.value ? row.height : void 0,
16653
16671
  "contentClass": [{
16654
16672
  'is-confirm': props.mode
16655
16673
  }, props.portalClass, 'vc-modal__content']
@@ -18194,7 +18212,7 @@ var VcComponents = (function (exports, vue) {
18194
18212
  "fill-opacity": "0"
18195
18213
  }, null)]), vue.createVNode("div", {
18196
18214
  "class": "vc-progress-circle__inner"
18197
- }, [slots.default ? slots.default() : vue.createVNode("span", null, [`${props.percent}%`])])])]);
18215
+ }, [slots.default ? slots.default() : props.showText && vue.createVNode("span", null, [`${props.percent}%`])])])]);
18198
18216
  };
18199
18217
  }
18200
18218
  });
@@ -21359,7 +21377,8 @@ var VcComponents = (function (exports, vue) {
21359
21377
  const { mode, size } = props;
21360
21378
  const onRequest = instance.vnode.props?.onRequest || VcInstance.options.Upload?.onRequest || (() => {
21361
21379
  });
21362
- const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse;
21380
+ const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse || (() => {
21381
+ });
21363
21382
  const $mode = mode.replace(/s$/, "");
21364
21383
  const onError = async (originalResponse, internalMessage) => {
21365
21384
  delete requests[vFile.uploadId];
@@ -21368,9 +21387,17 @@ var VcComponents = (function (exports, vue) {
21368
21387
  emitError(originalResponse, internalMessage);
21369
21388
  done(vFile);
21370
21389
  };
21371
- const onSuccess = async (originalResponse) => {
21390
+ const onSuccess = async (request) => {
21372
21391
  try {
21373
- const response = await onResponse(originalResponse, options) || originalResponse;
21392
+ let response = await onResponse(request, options) || request;
21393
+ if (response === request) {
21394
+ const text = request.responseType ? request.responseText : request.response;
21395
+ try {
21396
+ response = JSON.parse(text);
21397
+ } catch {
21398
+ response = text;
21399
+ }
21400
+ }
21374
21401
  delete requests[vFile.uploadId];
21375
21402
  cycle.success++;
21376
21403
  cycle.responses = [...cycle.responses, response];
@@ -21404,7 +21431,7 @@ var VcComponents = (function (exports, vue) {
21404
21431
  xhr.onreadystatechange = () => {
21405
21432
  if (xhr.readyState !== 4 || xhr.status === 0) return;
21406
21433
  if (xhr.status >= 200 && xhr.status < 300) {
21407
- onSuccess(!xhr.responseType ? xhr.responseText : xhr.response);
21434
+ onSuccess(xhr);
21408
21435
  } else {
21409
21436
  onError({}, `服务异常`);
21410
21437
  }
package/dist/index.js CHANGED
@@ -3104,6 +3104,10 @@ const props$Y = {
3104
3104
  changeOnSelect: {
3105
3105
  type: Boolean,
3106
3106
  default: false
3107
+ },
3108
+ nullValue: {
3109
+ type: [Number, String, Object],
3110
+ default: ""
3107
3111
  }
3108
3112
  };
3109
3113
 
@@ -4399,6 +4403,7 @@ const DEFAULT_FORMATS = {
4399
4403
  datetime: "YYYY-MM-DD HH:mm:ss",
4400
4404
  time: "HH:mm:ss",
4401
4405
  timerange: "HH:mm:ss",
4406
+ monthrange: "YYYY-MM",
4402
4407
  daterange: "YYYY-MM-DD",
4403
4408
  datetimerange: "YYYY-MM-DD HH:mm:ss"
4404
4409
  };
@@ -4946,8 +4951,8 @@ const useBase = () => {
4946
4951
  const props = instance.props;
4947
4952
  const isHover = ref(false);
4948
4953
  const isActive = ref(false);
4949
- const currentValue = ref("");
4950
- const focusedDate = ref(null);
4954
+ const currentValue = ref([]);
4955
+ const focusedDate = ref();
4951
4956
  const formItem = inject("vc-form-item", {});
4952
4957
  const its = useAttrs({ merge: false });
4953
4958
  const formatDateText = (value) => {
@@ -5012,23 +5017,22 @@ const useBase = () => {
5012
5017
  };
5013
5018
  const parseValue = (val) => {
5014
5019
  if (isEmpty(val)) {
5015
- return isRange.value ? [null, null] : [];
5020
+ return [];
5016
5021
  }
5017
5022
  return parserDate(val);
5018
5023
  };
5019
- const rest = (date) => {
5020
- currentValue.value = date;
5024
+ const reset = (v) => {
5025
+ currentValue.value = value2Array(v);
5021
5026
  };
5022
5027
  const sync = (eventName, value) => {
5023
- const date = isRange.value || isQuarter.value ? value : value[0];
5024
- const dateString = formatDate(value);
5025
- emit("input", date);
5026
- emit("update:modelValue", dateString);
5028
+ const formatValue = formatDate(isRange.value || isQuarter.value ? value : value[0]) || props.nullValue;
5029
+ emit("update:modelValue", formatValue);
5027
5030
  eventName = typeof eventName === "string" ? [eventName] : eventName;
5028
5031
  eventName.forEach((name) => {
5029
- emit(name, dateString, rest);
5032
+ emit(name, formatValue, reset);
5030
5033
  });
5031
- formItem?.change?.(date);
5034
+ formItem?.change?.();
5035
+ return formatValue;
5032
5036
  };
5033
5037
  const executePromise = (promiseFn, cb, param) => {
5034
5038
  try {
@@ -5058,11 +5062,9 @@ const useBase = () => {
5058
5062
  };
5059
5063
  const handleClear = () => {
5060
5064
  const clear = () => {
5061
- const date = isRange.value ? [] : "";
5062
5065
  isActive.value = false;
5063
- currentValue.value = date;
5064
- sync("change", date);
5065
- emit("clear", date);
5066
+ currentValue.value = [];
5067
+ emit("clear", sync("change", []));
5066
5068
  };
5067
5069
  executePromise(instance.vnode.props?.onBeforeClear, clear);
5068
5070
  };
@@ -5079,10 +5081,10 @@ const useBase = () => {
5079
5081
  executePromise(instance.vnode.props?.onBeforeOk, ok, value);
5080
5082
  };
5081
5083
  const handleClose = () => {
5082
- const val = parseValue(props.modelValue);
5083
- const isSetValueProp = instance.props.modelValue;
5084
- if (!isEqualWith(currentValue.value, val) && isSetValueProp) {
5085
- currentValue.value = value2Array(val);
5084
+ const v = parseValue(props.modelValue);
5085
+ const isSetValueProp = props.modelValue;
5086
+ if (!isEqualWith(currentValue.value, v) && isSetValueProp) {
5087
+ currentValue.value = value2Array(v);
5086
5088
  }
5087
5089
  emit("close");
5088
5090
  };
@@ -5090,7 +5092,7 @@ const useBase = () => {
5090
5092
  () => props.modelValue,
5091
5093
  (v) => {
5092
5094
  v = parseValue(v);
5093
- focusedDate.value = v[0] || props.startDate || /* @__PURE__ */ new Date();
5095
+ focusedDate.value = v?.[0] || props.startDate || /* @__PURE__ */ new Date();
5094
5096
  currentValue.value = value2Array(v);
5095
5097
  },
5096
5098
  { immediate: true }
@@ -5126,7 +5128,7 @@ const useBase = () => {
5126
5128
 
5127
5129
  /** @jsxImportSource vue */
5128
5130
 
5129
- const COMPONENT_NAME$1l = 'vc-picker';
5131
+ const COMPONENT_NAME$1l = 'vc-date-picker';
5130
5132
  const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ defineComponent({
5131
5133
  name: COMPONENT_NAME$1l,
5132
5134
  props: Object.assign(props$Y, pickerProps),
@@ -5184,7 +5186,7 @@ const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ defineComponent
5184
5186
  "disabled": props.disabled,
5185
5187
  "modelValue": visibleValue.value,
5186
5188
  "allowDispatch": false,
5187
- "class": "vc-picker__input",
5189
+ "class": "vc-date-picker__input",
5188
5190
  "readonly": true,
5189
5191
  "placeholder": props.placeholder || '请选择'
5190
5192
  }, {
@@ -5192,7 +5194,7 @@ const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ defineComponent
5192
5194
  return createVNode("div", {
5193
5195
  "class": [{
5194
5196
  'is-clear': showClear
5195
- }, 'vc-picker__append']
5197
+ }, 'vc-date-picker__append']
5196
5198
  }, [createVNode(Icon, {
5197
5199
  "type": showClear.value ? 'clear' : icon.value,
5198
5200
  "onClick": handleIconClick
@@ -10370,11 +10372,6 @@ const ModalView = /* @__PURE__ */ defineComponent({
10370
10372
  };
10371
10373
  });
10372
10374
  useScrollbar(isActive);
10373
- watch(() => props.modelValue, v => {
10374
- isActive.value = v;
10375
- }, {
10376
- immediate: true
10377
- });
10378
10375
  let startX = 0;
10379
10376
  let startY = 0;
10380
10377
  // Portal调用时,可作为初始值
@@ -10401,7 +10398,17 @@ const ModalView = /* @__PURE__ */ defineComponent({
10401
10398
  }, 250, {
10402
10399
  leading: true
10403
10400
  });
10404
- const handleEnter = () => resetOrigin();
10401
+ const isTransitionEnd = ref(false);
10402
+ const handleBeforeEnter = () => {
10403
+ isTransitionEnd.value = false;
10404
+ };
10405
+ const handleEnter = () => {
10406
+ resetOrigin();
10407
+ };
10408
+ const handleAfterEnter = () => {
10409
+ isTransitionEnd.value = true;
10410
+ resizer.value.refresh();
10411
+ };
10405
10412
  /**
10406
10413
  * 动画执行后关闭, 关闭事件都会被执行
10407
10414
  * visible-change 由移除之后触发
@@ -10472,11 +10479,15 @@ const ModalView = /* @__PURE__ */ defineComponent({
10472
10479
  * 这里由于scroller的resize时,render会重置height(实际上就是保留height, 无法移除)
10473
10480
  * 1. 改用nextTick, 抖动严重
10474
10481
  * 2. resizer.value.refresh, 不抖动
10482
+ *
10483
+ * container在最大值时,需要移除,宽度才会缩回去
10475
10484
  */
10476
10485
  const handleContentResize = () => {
10477
- const has = !!scroller.value.wrapper.style.getPropertyValue('height');
10478
- has && scroller.value.wrapper.style.removeProperty('height');
10479
- has && resizer.value.refresh();
10486
+ const needRefreshScroller = !!scroller.value.wrapper.style.getPropertyValue('height');
10487
+ const needRefreshContainer = !!container.value.style.getPropertyValue('height');
10488
+ needRefreshContainer && container.value.style.removeProperty('height');
10489
+ needRefreshScroller && scroller.value.wrapper.style.removeProperty('height');
10490
+ needRefreshScroller && resizer.value.refresh();
10480
10491
  };
10481
10492
  const handleClick = e => {
10482
10493
  // isActive click先触发,后设置后
@@ -10541,6 +10552,11 @@ const ModalView = /* @__PURE__ */ defineComponent({
10541
10552
  document.removeEventListener('mousemove', handleMouseMove);
10542
10553
  document.removeEventListener('mouseup', handleMouseUp);
10543
10554
  });
10555
+ watch(() => props.modelValue, v => {
10556
+ isActive.value = v;
10557
+ }, {
10558
+ immediate: true
10559
+ });
10544
10560
  expose({
10545
10561
  isActive,
10546
10562
  // for portal
@@ -10569,7 +10585,9 @@ const ModalView = /* @__PURE__ */ defineComponent({
10569
10585
  "onClick": e => handleClose(e, false)
10570
10586
  }, [createVNode(TransitionScale, {
10571
10587
  "mode": "part",
10588
+ "onBeforeEnter": handleBeforeEnter,
10572
10589
  "onEnter": handleEnter,
10590
+ "onAfterEnter": handleAfterEnter,
10573
10591
  "onAfterLeave": handleRemove
10574
10592
  }, {
10575
10593
  default: () => [withDirectives(createVNode("div", {
@@ -10605,8 +10623,8 @@ const ModalView = /* @__PURE__ */ defineComponent({
10605
10623
  return createVNode(Scroller, {
10606
10624
  "ref": scroller,
10607
10625
  "native": false,
10608
- "always": true,
10609
- "height": row.height,
10626
+ "always": false,
10627
+ "height": isTransitionEnd.value ? row.height : void 0,
10610
10628
  "contentClass": [{
10611
10629
  'is-confirm': props.mode
10612
10630
  }, props.portalClass, 'vc-modal__content']
@@ -12151,7 +12169,7 @@ const Circle = /* @__PURE__ */ defineComponent({
12151
12169
  "fill-opacity": "0"
12152
12170
  }, null)]), createVNode("div", {
12153
12171
  "class": "vc-progress-circle__inner"
12154
- }, [slots.default ? slots.default() : createVNode("span", null, [`${props.percent}%`])])])]);
12172
+ }, [slots.default ? slots.default() : props.showText && createVNode("span", null, [`${props.percent}%`])])])]);
12155
12173
  };
12156
12174
  }
12157
12175
  });
@@ -15217,7 +15235,8 @@ const Upload = defineComponent({
15217
15235
  const { mode, size } = props;
15218
15236
  const onRequest = instance.vnode.props?.onRequest || VcInstance.options.Upload?.onRequest || (() => {
15219
15237
  });
15220
- const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse;
15238
+ const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse || (() => {
15239
+ });
15221
15240
  const $mode = mode.replace(/s$/, "");
15222
15241
  const onError = async (originalResponse, internalMessage) => {
15223
15242
  delete requests[vFile.uploadId];
@@ -15226,9 +15245,17 @@ const Upload = defineComponent({
15226
15245
  emitError(originalResponse, internalMessage);
15227
15246
  done(vFile);
15228
15247
  };
15229
- const onSuccess = async (originalResponse) => {
15248
+ const onSuccess = async (request) => {
15230
15249
  try {
15231
- const response = await onResponse(originalResponse, options) || originalResponse;
15250
+ let response = await onResponse(request, options) || request;
15251
+ if (response === request) {
15252
+ const text = request.responseType ? request.responseText : request.response;
15253
+ try {
15254
+ response = JSON.parse(text);
15255
+ } catch {
15256
+ response = text;
15257
+ }
15258
+ }
15232
15259
  delete requests[vFile.uploadId];
15233
15260
  cycle.success++;
15234
15261
  cycle.responses = [...cycle.responses, response];
@@ -15262,7 +15289,7 @@ const Upload = defineComponent({
15262
15289
  xhr.onreadystatechange = () => {
15263
15290
  if (xhr.readyState !== 4 || xhr.status === 0) return;
15264
15291
  if (xhr.status >= 200 && xhr.status < 300) {
15265
- onSuccess(!xhr.responseType ? xhr.responseText : xhr.response);
15292
+ onSuccess(xhr);
15266
15293
  } else {
15267
15294
  onError({}, `服务异常`);
15268
15295
  }
@@ -7646,6 +7646,10 @@
7646
7646
  changeOnSelect: {
7647
7647
  type: Boolean,
7648
7648
  default: false
7649
+ },
7650
+ nullValue: {
7651
+ type: [Number, String, Object],
7652
+ default: ""
7649
7653
  }
7650
7654
  };
7651
7655
 
@@ -9005,6 +9009,7 @@
9005
9009
  datetime: "YYYY-MM-DD HH:mm:ss",
9006
9010
  time: "HH:mm:ss",
9007
9011
  timerange: "HH:mm:ss",
9012
+ monthrange: "YYYY-MM",
9008
9013
  daterange: "YYYY-MM-DD",
9009
9014
  datetimerange: "YYYY-MM-DD HH:mm:ss"
9010
9015
  };
@@ -9552,8 +9557,8 @@
9552
9557
  const props = instance.props;
9553
9558
  const isHover = vue.ref(false);
9554
9559
  const isActive = vue.ref(false);
9555
- const currentValue = vue.ref("");
9556
- const focusedDate = vue.ref(null);
9560
+ const currentValue = vue.ref([]);
9561
+ const focusedDate = vue.ref();
9557
9562
  const formItem = vue.inject("vc-form-item", {});
9558
9563
  const its = useAttrs({ merge: false });
9559
9564
  const formatDateText = (value) => {
@@ -9618,23 +9623,22 @@
9618
9623
  };
9619
9624
  const parseValue = (val) => {
9620
9625
  if (isEmpty(val)) {
9621
- return isRange.value ? [null, null] : [];
9626
+ return [];
9622
9627
  }
9623
9628
  return parserDate(val);
9624
9629
  };
9625
- const rest = (date) => {
9626
- currentValue.value = date;
9630
+ const reset = (v) => {
9631
+ currentValue.value = value2Array(v);
9627
9632
  };
9628
9633
  const sync = (eventName, value) => {
9629
- const date = isRange.value || isQuarter.value ? value : value[0];
9630
- const dateString = formatDate(value);
9631
- emit("input", date);
9632
- emit("update:modelValue", dateString);
9634
+ const formatValue = formatDate(isRange.value || isQuarter.value ? value : value[0]) || props.nullValue;
9635
+ emit("update:modelValue", formatValue);
9633
9636
  eventName = typeof eventName === "string" ? [eventName] : eventName;
9634
9637
  eventName.forEach((name) => {
9635
- emit(name, dateString, rest);
9638
+ emit(name, formatValue, reset);
9636
9639
  });
9637
- formItem?.change?.(date);
9640
+ formItem?.change?.();
9641
+ return formatValue;
9638
9642
  };
9639
9643
  const executePromise = (promiseFn, cb, param) => {
9640
9644
  try {
@@ -9664,11 +9668,9 @@
9664
9668
  };
9665
9669
  const handleClear = () => {
9666
9670
  const clear = () => {
9667
- const date = isRange.value ? [] : "";
9668
9671
  isActive.value = false;
9669
- currentValue.value = date;
9670
- sync("change", date);
9671
- emit("clear", date);
9672
+ currentValue.value = [];
9673
+ emit("clear", sync("change", []));
9672
9674
  };
9673
9675
  executePromise(instance.vnode.props?.onBeforeClear, clear);
9674
9676
  };
@@ -9685,10 +9687,10 @@
9685
9687
  executePromise(instance.vnode.props?.onBeforeOk, ok, value);
9686
9688
  };
9687
9689
  const handleClose = () => {
9688
- const val = parseValue(props.modelValue);
9689
- const isSetValueProp = instance.props.modelValue;
9690
- if (!isEqualWith(currentValue.value, val) && isSetValueProp) {
9691
- currentValue.value = value2Array(val);
9690
+ const v = parseValue(props.modelValue);
9691
+ const isSetValueProp = props.modelValue;
9692
+ if (!isEqualWith(currentValue.value, v) && isSetValueProp) {
9693
+ currentValue.value = value2Array(v);
9692
9694
  }
9693
9695
  emit("close");
9694
9696
  };
@@ -9696,7 +9698,7 @@
9696
9698
  () => props.modelValue,
9697
9699
  (v) => {
9698
9700
  v = parseValue(v);
9699
- focusedDate.value = v[0] || props.startDate || /* @__PURE__ */ new Date();
9701
+ focusedDate.value = v?.[0] || props.startDate || /* @__PURE__ */ new Date();
9700
9702
  currentValue.value = value2Array(v);
9701
9703
  },
9702
9704
  { immediate: true }
@@ -9732,7 +9734,7 @@
9732
9734
 
9733
9735
  /** @jsxImportSource vue */
9734
9736
 
9735
- const COMPONENT_NAME$1l = 'vc-picker';
9737
+ const COMPONENT_NAME$1l = 'vc-date-picker';
9736
9738
  const createPicker = (pickerProps, usePicker) => /* @__PURE__ */ vue.defineComponent({
9737
9739
  name: COMPONENT_NAME$1l,
9738
9740
  props: Object.assign(props$Y, pickerProps),
@@ -9790,7 +9792,7 @@
9790
9792
  "disabled": props.disabled,
9791
9793
  "modelValue": visibleValue.value,
9792
9794
  "allowDispatch": false,
9793
- "class": "vc-picker__input",
9795
+ "class": "vc-date-picker__input",
9794
9796
  "readonly": true,
9795
9797
  "placeholder": props.placeholder || '请选择'
9796
9798
  }, {
@@ -9798,7 +9800,7 @@
9798
9800
  return vue.createVNode("div", {
9799
9801
  "class": [{
9800
9802
  'is-clear': showClear
9801
- }, 'vc-picker__append']
9803
+ }, 'vc-date-picker__append']
9802
9804
  }, [vue.createVNode(Icon, {
9803
9805
  "type": showClear.value ? 'clear' : icon.value,
9804
9806
  "onClick": handleIconClick
@@ -16416,11 +16418,6 @@
16416
16418
  };
16417
16419
  });
16418
16420
  useScrollbar(isActive);
16419
- vue.watch(() => props.modelValue, v => {
16420
- isActive.value = v;
16421
- }, {
16422
- immediate: true
16423
- });
16424
16421
  let startX = 0;
16425
16422
  let startY = 0;
16426
16423
  // Portal调用时,可作为初始值
@@ -16447,7 +16444,17 @@
16447
16444
  }, 250, {
16448
16445
  leading: true
16449
16446
  });
16450
- const handleEnter = () => resetOrigin();
16447
+ const isTransitionEnd = vue.ref(false);
16448
+ const handleBeforeEnter = () => {
16449
+ isTransitionEnd.value = false;
16450
+ };
16451
+ const handleEnter = () => {
16452
+ resetOrigin();
16453
+ };
16454
+ const handleAfterEnter = () => {
16455
+ isTransitionEnd.value = true;
16456
+ resizer.value.refresh();
16457
+ };
16451
16458
  /**
16452
16459
  * 动画执行后关闭, 关闭事件都会被执行
16453
16460
  * visible-change 由移除之后触发
@@ -16518,11 +16525,15 @@
16518
16525
  * 这里由于scroller的resize时,render会重置height(实际上就是保留height, 无法移除)
16519
16526
  * 1. 改用nextTick, 抖动严重
16520
16527
  * 2. resizer.value.refresh, 不抖动
16528
+ *
16529
+ * container在最大值时,需要移除,宽度才会缩回去
16521
16530
  */
16522
16531
  const handleContentResize = () => {
16523
- const has = !!scroller.value.wrapper.style.getPropertyValue('height');
16524
- has && scroller.value.wrapper.style.removeProperty('height');
16525
- has && resizer.value.refresh();
16532
+ const needRefreshScroller = !!scroller.value.wrapper.style.getPropertyValue('height');
16533
+ const needRefreshContainer = !!container.value.style.getPropertyValue('height');
16534
+ needRefreshContainer && container.value.style.removeProperty('height');
16535
+ needRefreshScroller && scroller.value.wrapper.style.removeProperty('height');
16536
+ needRefreshScroller && resizer.value.refresh();
16526
16537
  };
16527
16538
  const handleClick = e => {
16528
16539
  // isActive click先触发,后设置后
@@ -16587,6 +16598,11 @@
16587
16598
  document.removeEventListener('mousemove', handleMouseMove);
16588
16599
  document.removeEventListener('mouseup', handleMouseUp);
16589
16600
  });
16601
+ vue.watch(() => props.modelValue, v => {
16602
+ isActive.value = v;
16603
+ }, {
16604
+ immediate: true
16605
+ });
16590
16606
  expose({
16591
16607
  isActive,
16592
16608
  // for portal
@@ -16615,7 +16631,9 @@
16615
16631
  "onClick": e => handleClose(e, false)
16616
16632
  }, [vue.createVNode(TransitionScale, {
16617
16633
  "mode": "part",
16634
+ "onBeforeEnter": handleBeforeEnter,
16618
16635
  "onEnter": handleEnter,
16636
+ "onAfterEnter": handleAfterEnter,
16619
16637
  "onAfterLeave": handleRemove
16620
16638
  }, {
16621
16639
  default: () => [vue.withDirectives(vue.createVNode("div", {
@@ -16651,8 +16669,8 @@
16651
16669
  return vue.createVNode(Scroller, {
16652
16670
  "ref": scroller,
16653
16671
  "native": false,
16654
- "always": true,
16655
- "height": row.height,
16672
+ "always": false,
16673
+ "height": isTransitionEnd.value ? row.height : void 0,
16656
16674
  "contentClass": [{
16657
16675
  'is-confirm': props.mode
16658
16676
  }, props.portalClass, 'vc-modal__content']
@@ -18197,7 +18215,7 @@
18197
18215
  "fill-opacity": "0"
18198
18216
  }, null)]), vue.createVNode("div", {
18199
18217
  "class": "vc-progress-circle__inner"
18200
- }, [slots.default ? slots.default() : vue.createVNode("span", null, [`${props.percent}%`])])])]);
18218
+ }, [slots.default ? slots.default() : props.showText && vue.createVNode("span", null, [`${props.percent}%`])])])]);
18201
18219
  };
18202
18220
  }
18203
18221
  });
@@ -21362,7 +21380,8 @@
21362
21380
  const { mode, size } = props;
21363
21381
  const onRequest = instance.vnode.props?.onRequest || VcInstance.options.Upload?.onRequest || (() => {
21364
21382
  });
21365
- const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse;
21383
+ const onResponse = instance.vnode.props?.onResponse || VcInstance.options.Upload?.onResponse || (() => {
21384
+ });
21366
21385
  const $mode = mode.replace(/s$/, "");
21367
21386
  const onError = async (originalResponse, internalMessage) => {
21368
21387
  delete requests[vFile.uploadId];
@@ -21371,9 +21390,17 @@
21371
21390
  emitError(originalResponse, internalMessage);
21372
21391
  done(vFile);
21373
21392
  };
21374
- const onSuccess = async (originalResponse) => {
21393
+ const onSuccess = async (request) => {
21375
21394
  try {
21376
- const response = await onResponse(originalResponse, options) || originalResponse;
21395
+ let response = await onResponse(request, options) || request;
21396
+ if (response === request) {
21397
+ const text = request.responseType ? request.responseText : request.response;
21398
+ try {
21399
+ response = JSON.parse(text);
21400
+ } catch {
21401
+ response = text;
21402
+ }
21403
+ }
21377
21404
  delete requests[vFile.uploadId];
21378
21405
  cycle.success++;
21379
21406
  cycle.responses = [...cycle.responses, response];
@@ -21407,7 +21434,7 @@
21407
21434
  xhr.onreadystatechange = () => {
21408
21435
  if (xhr.readyState !== 4 || xhr.status === 0) return;
21409
21436
  if (xhr.status >= 200 && xhr.status < 300) {
21410
- onSuccess(!xhr.responseType ? xhr.responseText : xhr.response);
21437
+ onSuccess(xhr);
21411
21438
  } else {
21412
21439
  onError({}, `服务异常`);
21413
21440
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/vc-components",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",