@v-c/picker 1.2.0 → 1.2.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.
@@ -1,4 +1,4 @@
1
- import { MouseEventHandler } from '../../../../util/src/EventInterface';
1
+ import { MouseEventHandler } from '@v-c/util/dist/EventInterface';
2
2
  import { InputHTMLAttributes } from 'vue';
3
3
  import { RangeTimeProps, SharedPickerProps, SharedTimeProps, ValueDate } from '../../interface';
4
4
  import { FooterProps } from './Footer';
@@ -45,7 +45,8 @@ var Popup = /* @__PURE__ */ defineComponent((props) => {
45
45
  }
46
46
  return;
47
47
  }
48
- arrowOffset.value = (rtl.value ? activeInputRight - arrowWidth : activeInputLeft) - wrapperRect.left;
48
+ const nextArrowOffset = (rtl.value ? activeInputRight - arrowWidth : activeInputLeft) - wrapperRect.left;
49
+ arrowOffset.value = nextArrowOffset;
49
50
  if (containerWidth.value && containerWidth.value < selectorWidth) {
50
51
  const offset = rtl.value ? wrapperRect.right - (activeInputRight - arrowWidth + containerWidth.value) : activeInputLeft + arrowWidth - wrapperRect.left - containerWidth.value;
51
52
  containerOffset.value = Math.max(0, offset);
@@ -1,4 +1,4 @@
1
- import { VueNode } from '../../../util/src/type';
1
+ import { VueNode } from '@v-c/util/dist/type';
2
2
  import { BaseInfo, PanelMode, RangeTimeProps, SharedPickerProps, ValueDate } from '../interface';
3
3
  import { SelectorIdType } from './Selector/RangeSelector';
4
4
  export interface BaseRangePickerProps<DateType extends object> extends Omit<SharedPickerProps<DateType>, 'showTime' | 'id'> {
@@ -128,7 +128,9 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
128
128
  if (!showTime.value) return null;
129
129
  const { disabledTime } = showTime.value;
130
130
  const proxyDisabledTime = disabledTime ? (date) => {
131
- return disabledTime(date, getActiveRange(activeIndex.value), { from: getFromDate(calendarValue.value, activeIndexList.value, activeIndex.value) });
131
+ const range = getActiveRange(activeIndex.value);
132
+ const fromDate = getFromDate(calendarValue.value, activeIndexList.value, activeIndex.value);
133
+ return disabledTime(date, range, { from: fromDate });
132
134
  } : void 0;
133
135
  return {
134
136
  ...showTime.value,
@@ -239,7 +241,8 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
239
241
  lastOperation("panel");
240
242
  };
241
243
  const onSelectorChange = (date, index) => {
242
- triggerCalendarChange(fillCalendarValue(date, index));
244
+ const clone = fillCalendarValue(date, index);
245
+ triggerCalendarChange(clone);
243
246
  };
244
247
  const onSelectorInputChange = () => {
245
248
  lastOperation("input");
@@ -257,7 +260,8 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
257
260
  onKeyDown.value?.(event, preventDefault);
258
261
  };
259
262
  const onPanelSelect = (date) => {
260
- triggerCalendarChange(fillIndex(calendarValue.value, activeIndex.value, date));
263
+ const clone = fillIndex(calendarValue.value, activeIndex.value, date);
264
+ triggerCalendarChange(clone);
261
265
  if (!needConfirm.value && !complexPicker.value && internalPicker.value === internalMode.value) triggerPartConfirm(date);
262
266
  };
263
267
  const onPopupClose = () => {
@@ -779,6 +783,13 @@ var RangePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
779
783
  default: void 0
780
784
  },
781
785
  class: {
786
+ type: [
787
+ Boolean,
788
+ null,
789
+ String,
790
+ Object,
791
+ Array
792
+ ],
782
793
  required: false,
783
794
  default: void 0
784
795
  },
@@ -1,4 +1,4 @@
1
- import { VueNode } from '../../../../util/src/type';
1
+ import { VueNode } from '@v-c/util/dist/type';
2
2
  export interface IconProps {
3
3
  icon?: VueNode;
4
4
  type: 'suffix' | 'clear';
@@ -75,7 +75,8 @@ var Input = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
75
75
  };
76
76
  const onFormatMouseUp = (event) => {
77
77
  const { selectionStart: start } = event.target;
78
- focusCellIndex.value = maskFormat.value.getMaskCellIndex(start);
78
+ const closeMaskIndex = maskFormat.value.getMaskCellIndex(start);
79
+ focusCellIndex.value = closeMaskIndex;
79
80
  forceSelectionSyncMark.value = {};
80
81
  props.onMouseUp?.(event);
81
82
  mouseDownRef.value = false;
@@ -158,7 +159,10 @@ var Input = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
158
159
  focusCellText.value = "";
159
160
  }
160
161
  }
161
- if (nextFillText !== null) triggerInputChange((inputValue.value.slice(0, selectionStart.value) + leftPad(nextFillText, maskCellLen) + inputValue.value.slice(selectionEnd.value)).slice(0, props.format.length));
162
+ if (nextFillText !== null) {
163
+ const nextFocusValue = inputValue.value.slice(0, selectionStart.value) + leftPad(nextFillText, maskCellLen) + inputValue.value.slice(selectionEnd.value);
164
+ triggerInputChange(nextFocusValue.slice(0, props.format.length));
165
+ }
162
166
  forceSelectionSyncMark.value = {};
163
167
  };
164
168
  const rafRef = ref();
@@ -1,4 +1,4 @@
1
- import { VueNode } from '../../../../util/src/type';
1
+ import { VueNode } from '@v-c/util/dist/type';
2
2
  import { SelectorProps } from '../../interface';
3
3
  export type SelectorIdType = string | {
4
4
  start?: string;
@@ -334,6 +334,13 @@ var RangeSelector = /* @__PURE__ */ defineComponent((props, { attrs, expose }) =
334
334
  default: void 0
335
335
  },
336
336
  class: {
337
+ type: [
338
+ Boolean,
339
+ null,
340
+ String,
341
+ Object,
342
+ Array
343
+ ],
337
344
  required: false,
338
345
  default: void 0
339
346
  },
@@ -1,4 +1,4 @@
1
- import { VueNode } from '../../../../../util/src/type';
1
+ import { VueNode } from '@v-c/util/dist/type';
2
2
  export interface MultipleDatesProps<DateType extends object = any> {
3
3
  prefixCls: string;
4
4
  value: DateType[];
@@ -313,6 +313,13 @@ var SingleSelector = /* @__PURE__ */ defineComponent((props, { attrs, expose })
313
313
  default: void 0
314
314
  },
315
315
  class: {
316
+ type: [
317
+ Boolean,
318
+ null,
319
+ String,
320
+ Object,
321
+ Array
322
+ ],
316
323
  required: false,
317
324
  default: void 0
318
325
  },
@@ -1,4 +1,4 @@
1
- import { VueNode } from '../../../../../util/src/type';
1
+ import { VueNode } from '@v-c/util/dist/type';
2
2
  import { ComputedRef, Ref } from 'vue';
3
3
  export declare function fillClearIcon(prefixCls: string, allowClear?: boolean | {
4
4
  clearIcon?: VueNode;
@@ -11,7 +11,7 @@ export declare function fillClearIcon(prefixCls: string, allowClear?: boolean |
11
11
  [key: string]: any;
12
12
  }> | (string | number | boolean | void | import('vue').Component | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
13
13
  [key: string]: any;
14
- }> | null | undefined)[] | import("vue/jsx-runtime").JSX.Element | null;
14
+ }> | null | undefined)[] | null;
15
15
  export default function useClearIcon(prefixCls: Ref<string>, allowClear?: Ref<boolean | {
16
16
  clearIcon?: VueNode;
17
17
  }>, clearIcon?: ComputedRef<VueNode>): ComputedRef<VueNode>;
@@ -1,4 +1,4 @@
1
- import { VueNode } from '../../../../../util/src';
1
+ import { VueNode } from '@v-c/util';
2
2
  import { ComputedRef } from 'vue';
3
3
  import { SelectorProps } from '../../../interface';
4
4
  export interface InputProps {
@@ -206,7 +206,8 @@ var SinglePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
206
206
  onSetHover(nextValue, "preset");
207
207
  };
208
208
  const onPresetSubmit = (nextValue) => {
209
- if (triggerSubmitChange(multiple.value ? toggleDates(getCalendarValue.value, nextValue) : [nextValue]) && !multiple.value) triggerOpen(false, { force: true });
209
+ const nextCalendarValues = multiple.value ? toggleDates(getCalendarValue.value, nextValue) : [nextValue];
210
+ if (triggerSubmitChange(nextCalendarValues) && !multiple.value) triggerOpen(false, { force: true });
210
211
  };
211
212
  const onNow = (now) => {
212
213
  onPresetSubmit(now);
@@ -221,7 +222,8 @@ var SinglePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
221
222
  const onPanelSelect = (date) => {
222
223
  lastOperation("panel");
223
224
  if (multiple.value && internalMode.value !== picker.value) return;
224
- triggerCalendarChange(multiple.value ? toggleDates(getCalendarValue.value, date) : [date]);
225
+ const nextValues = multiple.value ? toggleDates(getCalendarValue.value, date) : [date];
226
+ triggerCalendarChange(nextValues);
225
227
  if (!needConfirm.value && !complexPicker.value && internalPicker.value === internalMode.value) triggerConfirm();
226
228
  };
227
229
  const onPopupClose = () => {
@@ -750,6 +752,13 @@ var SinglePicker = /* @__PURE__ */ defineComponent((props, { expose }) => {
750
752
  default: void 0
751
753
  },
752
754
  class: {
755
+ type: [
756
+ Boolean,
757
+ null,
758
+ String,
759
+ Object,
760
+ Array
761
+ ],
753
762
  required: false,
754
763
  default: void 0
755
764
  },
@@ -117,7 +117,8 @@ function useRangeValue(info, mergedValue, setInnerValue, getCalendarValue, trigg
117
117
  return allPassed;
118
118
  };
119
119
  const flushSubmit = (index, needTriggerChange) => {
120
- setSubmitValue(fillIndex(submitValue.value, index, getCalendarValue()[index]));
120
+ const nextSubmitValue = fillIndex(submitValue.value, index, getCalendarValue()[index]);
121
+ setSubmitValue(nextSubmitValue);
121
122
  if (needTriggerChange) triggerSubmit();
122
123
  };
123
124
  const interactiveFinished = computed(() => !focused.value && !open.value);
@@ -55,9 +55,8 @@ var TimeColumn = /* @__PURE__ */ defineComponent((props) => {
55
55
  const { prefixCls, cellRender, now, locale, classNames: panelClassNames, styles } = context.value;
56
56
  const panelPrefixCls = `${prefixCls}-time-panel`;
57
57
  const cellPrefixCls = `${prefixCls}-time-panel-cell`;
58
- const columnPrefixCls = `${panelPrefixCls}-column`;
59
58
  return createVNode("ul", {
60
- "class": columnPrefixCls,
59
+ "class": `${panelPrefixCls}-column`,
61
60
  "ref": ulRef,
62
61
  "data-type": type,
63
62
  "onScroll": onInternalScroll
@@ -67,7 +67,8 @@ var TimePanelBody = /* @__PURE__ */ defineComponent((props) => {
67
67
  }];
68
68
  })();
69
69
  const triggerChange = (nextDate) => {
70
- onSelect(getValidTime(nextDate));
70
+ const validateDate = getValidTime(nextDate);
71
+ onSelect(validateDate);
71
72
  };
72
73
  const triggerDateTmpl = (() => {
73
74
  let tmpl = value.value || context.value.pickerValue || generateConfig.value.getNow();
@@ -14,8 +14,7 @@ var TimePanel = /* @__PURE__ */ defineComponent((props) => {
14
14
  return () => {
15
15
  const { prefixCls, value, locale, generateConfig, showTime } = props;
16
16
  const format = typeof showTime === "object" && showTime && showTime.format ? showTime.format : locale?.fieldTimeFormat || "HH:mm:ss";
17
- const panelPrefixCls = `${prefixCls}-time-panel`;
18
- return createVNode("div", { "class": clsx(panelPrefixCls) }, [createVNode(PanelHeader, null, { default: () => [value ? formatValue(value, {
17
+ return createVNode("div", { "class": clsx(`${prefixCls}-time-panel`) }, [createVNode(PanelHeader, null, { default: () => [value ? formatValue(value, {
19
18
  locale,
20
19
  format,
21
20
  generateConfig
@@ -1,4 +1,4 @@
1
- import { VueNode } from '../../../util/src/type';
1
+ import { VueNode } from '@v-c/util/dist/type';
2
2
  import { CSSProperties, HTMLAttributes } from 'vue';
3
3
  import { CellRender, Components, Locale, OnPanelChange, PanelMode, PanelSemanticName, PickerMode, SharedPanelProps, SharedTimeProps } from '../interface';
4
4
  export interface PickerPanelRef {
@@ -73,7 +73,10 @@ var PickerPanel = /* @__PURE__ */ defineComponent((props, { attrs }) => {
73
73
  };
74
74
  const onInternalSelect = (newDate) => {
75
75
  props.onSelect?.(newDate);
76
- if (mergedMode.value === props.picker) triggerChange(props.multiple ? toggleDates(mergedValue.value, newDate) : [newDate]);
76
+ if (mergedMode.value === props.picker) {
77
+ const nextValues = props.multiple ? toggleDates(mergedValue.value, newDate) : [newDate];
78
+ triggerChange(nextValues);
79
+ }
77
80
  };
78
81
  const internalPickerValueState = ref(props.defaultPickerValue || mergedValue.value[0] || now.value);
79
82
  const mergedPickerValue = computed(() => props.pickerValue !== void 0 ? props.pickerValue : internalPickerValueState.value);
@@ -1,4 +1,4 @@
1
- import { AlignType, BuildInPlacements } from '../../../trigger/src';
1
+ import { AlignType, BuildInPlacements } from '@v-c/trigger';
2
2
  import { CSSProperties } from 'vue';
3
3
  export interface PickerTriggerProps {
4
4
  popupElement?: any;
@@ -38,8 +38,6 @@ var localeMap = {
38
38
  function parseLocale(locale) {
39
39
  return localeMap[locale] || locale.split("_")[0];
40
40
  }
41
- /* istanbul ignore next */
42
- function parseNoMatchNotice() {}
43
41
  var generateConfig = {
44
42
  getNow: () => {
45
43
  const now = dayjs();
@@ -91,13 +89,12 @@ var generateConfig = {
91
89
  const nextWeek = firstWeek.add(j, "week");
92
90
  if (nextWeek.format("Wo") === weekStr) return nextWeek;
93
91
  }
94
- parseNoMatchNotice();
95
92
  return null;
96
93
  }
97
94
  const date = dayjs(formatText, format, true).locale(localeStr);
98
95
  if (date.isValid()) return date;
99
96
  }
100
- if (text) parseNoMatchNotice();
97
+ if (text) {}
101
98
  return null;
102
99
  }
103
100
  }
@@ -1,5 +1,5 @@
1
- import { AlignType, BuildInPlacements } from '../../trigger/src';
2
- import { VueNode } from '../../util/src/type';
1
+ import { AlignType, BuildInPlacements } from '@v-c/trigger';
2
+ import { VueNode } from '@v-c/util/dist/type';
3
3
  import { CSSProperties, DefineComponent, HTMLAttributes, InputHTMLAttributes, VNode } from 'vue';
4
4
  import { GenerateConfig } from './generate';
5
5
  export type NullableDateType<DateType> = DateType | null | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/picker",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.2",
5
5
  "description": "picker ui component for vue",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -77,13 +77,13 @@
77
77
  }
78
78
  },
79
79
  "dependencies": {
80
- "@v-c/overflow": "^1.1.0",
81
- "@v-c/resize-observer": "^1.1.2",
82
- "@v-c/trigger": "^1.0.16",
83
- "@v-c/util": "^1.0.19"
80
+ "@v-c/util": "^1.0.21",
81
+ "@v-c/resize-observer": "^1.1.3",
82
+ "@v-c/trigger": "^1.0.18",
83
+ "@v-c/overflow": "^1.1.1"
84
84
  },
85
85
  "devDependencies": {
86
- "@types/luxon": "^3.7.1"
86
+ "@types/luxon": "^3.7.2"
87
87
  },
88
88
  "scripts": {
89
89
  "build": "vite build",