@v-c/picker 1.0.4 → 1.1.0-rc.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.
- package/dist/PickerInput/Popup/Footer.js +12 -18
- package/dist/PickerInput/Popup/PopupPanel.js +14 -18
- package/dist/PickerInput/Popup/PresetPanel.js +8 -10
- package/dist/PickerInput/Popup/index.js +19 -29
- package/dist/PickerInput/RangePicker.js +25 -17
- package/dist/PickerInput/Selector/Icon.js +6 -9
- package/dist/PickerInput/Selector/Input.js +13 -14
- package/dist/PickerInput/Selector/MaskFormat.js +5 -1
- package/dist/PickerInput/Selector/RangeSelector.js +29 -53
- package/dist/PickerInput/Selector/SingleSelector/MultipleDates.d.ts +7 -0
- package/dist/PickerInput/Selector/SingleSelector/MultipleDates.js +22 -12
- package/dist/PickerInput/Selector/SingleSelector/index.d.ts +7 -0
- package/dist/PickerInput/Selector/SingleSelector/index.js +34 -48
- package/dist/PickerInput/Selector/hooks/useClearIcon.js +2 -0
- package/dist/PickerInput/Selector/hooks/useInputHooks.js +2 -0
- package/dist/PickerInput/Selector/hooks/useRootProps.js +2 -0
- package/dist/PickerInput/Selector/util.js +2 -0
- package/dist/PickerInput/SinglePicker.d.ts +9 -0
- package/dist/PickerInput/SinglePicker.js +24 -14
- package/dist/PickerInput/context.js +2 -0
- package/dist/PickerInput/hooks/useCellRender.js +2 -0
- package/dist/PickerInput/hooks/useDelayState.js +2 -0
- package/dist/PickerInput/hooks/useDisabledBoundary.js +5 -0
- package/dist/PickerInput/hooks/useFieldFormat.js +2 -0
- package/dist/PickerInput/hooks/useFieldsInvalidate.js +5 -0
- package/dist/PickerInput/hooks/useFilledProps.js +10 -0
- package/dist/PickerInput/hooks/useInputReadOnly.js +2 -0
- package/dist/PickerInput/hooks/useInvalidate.js +5 -0
- package/dist/PickerInput/hooks/useLockEffect.js +6 -0
- package/dist/PickerInput/hooks/useOpen.js +6 -0
- package/dist/PickerInput/hooks/usePresets.js +2 -0
- package/dist/PickerInput/hooks/useRangeActive.js +7 -0
- package/dist/PickerInput/hooks/useRangeDisabledDate.js +6 -0
- package/dist/PickerInput/hooks/useRangePickerValue.js +2 -0
- package/dist/PickerInput/hooks/useRangeValue.d.ts +9 -2
- package/dist/PickerInput/hooks/useRangeValue.js +8 -2
- package/dist/PickerInput/hooks/useShowNow.js +2 -0
- package/dist/PickerPanel/DatePanel/index.js +15 -21
- package/dist/PickerPanel/DateTimePanel/index.js +13 -19
- package/dist/PickerPanel/DecadePanel/index.js +14 -20
- package/dist/PickerPanel/MonthPanel/index.js +14 -20
- package/dist/PickerPanel/PanelBody.js +10 -16
- package/dist/PickerPanel/PanelHeader.js +4 -2
- package/dist/PickerPanel/QuarterPanel/index.js +14 -20
- package/dist/PickerPanel/TimePanel/TimePanelBody/TimeColumn.js +8 -10
- package/dist/PickerPanel/TimePanel/TimePanelBody/index.js +10 -8
- package/dist/PickerPanel/TimePanel/TimePanelBody/useScrollTo.js +2 -0
- package/dist/PickerPanel/TimePanel/index.js +14 -20
- package/dist/PickerPanel/WeekPanel/index.js +12 -18
- package/dist/PickerPanel/YearPanel/index.js +14 -20
- package/dist/PickerPanel/context.js +2 -0
- package/dist/PickerPanel/index.js +23 -21
- package/dist/PickerTrigger/index.js +4 -2
- package/dist/PickerTrigger/util.js +2 -0
- package/dist/generate/dateFns.js +23 -10
- package/dist/generate/dayjs.js +4 -2
- package/dist/generate/luxon.js +29 -2
- package/dist/generate/moment.js +4 -2
- package/dist/hooks/useLocale.js +8 -3
- package/dist/hooks/useSemantic.js +5 -0
- package/dist/hooks/useSyncState.js +7 -0
- package/dist/hooks/useTimeConfig.js +11 -0
- package/dist/hooks/useTimeInfo.js +10 -2
- package/dist/hooks/useToggleDates.js +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -5
- package/dist/locale/am_ET.js +4 -2
- package/dist/locale/ar_EG.js +4 -2
- package/dist/locale/az_AZ.js +4 -2
- package/dist/locale/bg_BG.js +4 -2
- package/dist/locale/bn_BD.js +4 -2
- package/dist/locale/by_BY.js +4 -2
- package/dist/locale/ca_ES.js +4 -2
- package/dist/locale/common.js +3 -1
- package/dist/locale/cs_CZ.js +4 -2
- package/dist/locale/da_DK.js +4 -2
- package/dist/locale/de_DE.js +4 -2
- package/dist/locale/el_GR.js +4 -2
- package/dist/locale/en_GB.js +4 -2
- package/dist/locale/en_US.js +4 -2
- package/dist/locale/es_ES.js +4 -2
- package/dist/locale/es_MX.js +4 -2
- package/dist/locale/et_EE.js +4 -2
- package/dist/locale/eu_ES.js +4 -2
- package/dist/locale/fa_IR.js +4 -2
- package/dist/locale/fi_FI.js +4 -2
- package/dist/locale/fr_BE.js +4 -2
- package/dist/locale/fr_CA.js +4 -2
- package/dist/locale/fr_FR.js +4 -2
- package/dist/locale/ga_IE.js +4 -2
- package/dist/locale/gl_ES.js +4 -2
- package/dist/locale/he_IL.js +4 -2
- package/dist/locale/hi_IN.js +4 -2
- package/dist/locale/hr_HR.js +4 -2
- package/dist/locale/hu_HU.js +4 -2
- package/dist/locale/id_ID.js +4 -2
- package/dist/locale/is_IS.js +4 -2
- package/dist/locale/it_IT.js +4 -2
- package/dist/locale/ja_JP.js +4 -2
- package/dist/locale/ka_GE.js +4 -2
- package/dist/locale/kk_KZ.js +4 -2
- package/dist/locale/km_KH.js +4 -2
- package/dist/locale/kmr_IQ.js +4 -2
- package/dist/locale/kn_IN.js +4 -2
- package/dist/locale/ko_KR.js +4 -2
- package/dist/locale/lt_LT.js +4 -2
- package/dist/locale/lv_LV.js +4 -2
- package/dist/locale/mk_MK.js +4 -2
- package/dist/locale/ml_IN.js +4 -2
- package/dist/locale/mn_MN.js +4 -2
- package/dist/locale/mr_IN.js +4 -2
- package/dist/locale/ms_MY.js +4 -2
- package/dist/locale/my_MM.js +4 -2
- package/dist/locale/nb_NO.js +4 -2
- package/dist/locale/ne_NP.js +4 -2
- package/dist/locale/nl_BE.js +4 -2
- package/dist/locale/nl_NL.js +4 -2
- package/dist/locale/pl_PL.js +4 -2
- package/dist/locale/pt_BR.js +4 -2
- package/dist/locale/pt_PT.js +4 -2
- package/dist/locale/ro_RO.js +4 -2
- package/dist/locale/ru_RU.js +4 -2
- package/dist/locale/si_LK.js +4 -2
- package/dist/locale/sk_SK.js +4 -2
- package/dist/locale/sl_SI.js +4 -2
- package/dist/locale/sr_Cyrl_RS.js +4 -2
- package/dist/locale/sr_RS.js +4 -2
- package/dist/locale/sv_SE.js +4 -2
- package/dist/locale/ta_IN.js +4 -2
- package/dist/locale/te_IN.js +4 -2
- package/dist/locale/th_TH.js +4 -2
- package/dist/locale/tk_TK.js +4 -2
- package/dist/locale/tr_TR.js +4 -2
- package/dist/locale/ug_CN.js +4 -2
- package/dist/locale/uk_UA.js +4 -2
- package/dist/locale/ur_PK.js +4 -2
- package/dist/locale/uz_UZ.js +4 -2
- package/dist/locale/vi_VN.js +4 -2
- package/dist/locale/zh_CN.js +4 -2
- package/dist/locale/zh_TW.js +4 -2
- package/dist/utils/dateUtil.js +17 -1
- package/dist/utils/getClearIcon.js +2 -0
- package/dist/utils/miscUtil.js +6 -0
- package/dist/utils/uiUtil.js +2 -0
- package/dist/utils/valueUtil.js +2 -0
- package/dist/utils/warnUtil.js +2 -0
- package/package.json +4 -4
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { usePickerContext } from "../context.js";
|
|
2
2
|
import useInputProps from "./hooks/useInputHooks.js";
|
|
3
3
|
import useRootProps from "./hooks/useRootProps.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import Icon, { ClearIcon } from "./Icon.js";
|
|
5
|
+
import Input from "./Input.js";
|
|
6
6
|
import { computed, createVNode, defineComponent, mergeProps, ref, watch } from "vue";
|
|
7
7
|
import { clsx } from "@v-c/util";
|
|
8
8
|
import ResizeObserver from "@v-c/resize-observer";
|
|
9
|
-
|
|
9
|
+
//#region src/PickerInput/Selector/RangeSelector.tsx
|
|
10
|
+
var RangeSelector = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
|
|
10
11
|
const pickerContext = usePickerContext();
|
|
11
12
|
const prefixCls = computed(() => pickerContext.value.prefixCls);
|
|
12
13
|
const classNames = computed(() => pickerContext.value.classNames);
|
|
@@ -100,14 +101,14 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
100
101
|
"class": clsx(`${prefixCls.value}-prefix`, classNames.value.prefix),
|
|
101
102
|
"style": styles.value.prefix
|
|
102
103
|
}, [prefix]),
|
|
103
|
-
createVNode(
|
|
104
|
+
createVNode(Input, mergeProps({ "ref": inputStartRef }, getInputProps(0), {
|
|
104
105
|
"class": `${prefixCls.value}-input-start`,
|
|
105
106
|
"autofocus": startAutoFocus.value,
|
|
106
107
|
"tabindex": tabIndex.value,
|
|
107
108
|
"data-range": "start"
|
|
108
109
|
}), null),
|
|
109
110
|
createVNode("div", { "class": `${prefixCls.value}-range-separator` }, [separator ?? "~"]),
|
|
110
|
-
createVNode(
|
|
111
|
+
createVNode(Input, mergeProps({ "ref": inputEndRef }, getInputProps(1), {
|
|
111
112
|
"class": `${prefixCls.value}-input-end`,
|
|
112
113
|
"autofocus": endAutoFocus.value,
|
|
113
114
|
"tabindex": tabIndex.value,
|
|
@@ -117,7 +118,7 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
117
118
|
"class": `${prefixCls.value}-active-bar`,
|
|
118
119
|
"style": activeBarStyle.value
|
|
119
120
|
}, null),
|
|
120
|
-
createVNode(
|
|
121
|
+
createVNode(Icon, {
|
|
121
122
|
"type": "suffix",
|
|
122
123
|
"icon": suffixIcon
|
|
123
124
|
}, null),
|
|
@@ -136,8 +137,7 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
136
137
|
},
|
|
137
138
|
activeIndex: {
|
|
138
139
|
type: [Number, null],
|
|
139
|
-
required: true
|
|
140
|
-
default: void 0
|
|
140
|
+
required: true
|
|
141
141
|
},
|
|
142
142
|
separator: {
|
|
143
143
|
type: [
|
|
@@ -159,18 +159,15 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
159
159
|
},
|
|
160
160
|
onChange: {
|
|
161
161
|
type: Function,
|
|
162
|
-
required: true
|
|
163
|
-
default: void 0
|
|
162
|
+
required: true
|
|
164
163
|
},
|
|
165
164
|
disabled: {
|
|
166
165
|
type: Array,
|
|
167
|
-
required: true
|
|
168
|
-
default: void 0
|
|
166
|
+
required: true
|
|
169
167
|
},
|
|
170
168
|
allHelp: {
|
|
171
169
|
type: Boolean,
|
|
172
|
-
required: true
|
|
173
|
-
default: void 0
|
|
170
|
+
required: true
|
|
174
171
|
},
|
|
175
172
|
placeholder: {
|
|
176
173
|
type: [String, Array],
|
|
@@ -179,8 +176,7 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
179
176
|
},
|
|
180
177
|
invalid: {
|
|
181
178
|
type: Array,
|
|
182
|
-
required: true
|
|
183
|
-
default: void 0
|
|
179
|
+
required: true
|
|
184
180
|
},
|
|
185
181
|
placement: {
|
|
186
182
|
type: String,
|
|
@@ -204,13 +200,11 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
204
200
|
},
|
|
205
201
|
onActiveInfo: {
|
|
206
202
|
type: Function,
|
|
207
|
-
required: true
|
|
208
|
-
default: void 0
|
|
203
|
+
required: true
|
|
209
204
|
},
|
|
210
205
|
picker: {
|
|
211
206
|
type: String,
|
|
212
|
-
required: true
|
|
213
|
-
default: void 0
|
|
207
|
+
required: true
|
|
214
208
|
},
|
|
215
209
|
prefix: {
|
|
216
210
|
type: [
|
|
@@ -268,23 +262,17 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
268
262
|
},
|
|
269
263
|
focused: {
|
|
270
264
|
type: Boolean,
|
|
271
|
-
required: true
|
|
272
|
-
default: void 0
|
|
265
|
+
required: true
|
|
273
266
|
},
|
|
274
267
|
onFocus: {
|
|
275
268
|
type: Function,
|
|
276
|
-
required: true
|
|
277
|
-
default: void 0
|
|
269
|
+
required: true
|
|
278
270
|
},
|
|
279
271
|
onBlur: {
|
|
280
272
|
type: Function,
|
|
281
|
-
required: true
|
|
282
|
-
default: void 0
|
|
283
|
-
},
|
|
284
|
-
onSubmit: {
|
|
285
|
-
required: true,
|
|
286
|
-
default: void 0
|
|
273
|
+
required: true
|
|
287
274
|
},
|
|
275
|
+
onSubmit: { required: true },
|
|
288
276
|
onKeyDown: {
|
|
289
277
|
type: Function,
|
|
290
278
|
required: false,
|
|
@@ -292,13 +280,11 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
292
280
|
},
|
|
293
281
|
locale: {
|
|
294
282
|
type: Object,
|
|
295
|
-
required: true
|
|
296
|
-
default: void 0
|
|
283
|
+
required: true
|
|
297
284
|
},
|
|
298
285
|
generateConfig: {
|
|
299
286
|
type: Object,
|
|
300
|
-
required: true
|
|
301
|
-
default: void 0
|
|
287
|
+
required: true
|
|
302
288
|
},
|
|
303
289
|
direction: {
|
|
304
290
|
type: String,
|
|
@@ -307,31 +293,22 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
307
293
|
},
|
|
308
294
|
onClick: {
|
|
309
295
|
type: [Function, Array],
|
|
310
|
-
required: true
|
|
311
|
-
default: void 0
|
|
312
|
-
},
|
|
313
|
-
onClear: {
|
|
314
|
-
required: true,
|
|
315
|
-
default: void 0
|
|
296
|
+
required: true
|
|
316
297
|
},
|
|
298
|
+
onClear: { required: true },
|
|
317
299
|
format: {
|
|
318
300
|
type: Array,
|
|
319
|
-
required: true
|
|
320
|
-
default: void 0
|
|
301
|
+
required: true
|
|
321
302
|
},
|
|
322
303
|
maskFormat: {
|
|
323
304
|
type: String,
|
|
324
305
|
required: false,
|
|
325
306
|
default: void 0
|
|
326
307
|
},
|
|
327
|
-
onInputChange: {
|
|
328
|
-
required: true,
|
|
329
|
-
default: void 0
|
|
330
|
-
},
|
|
308
|
+
onInputChange: { required: true },
|
|
331
309
|
onInvalid: {
|
|
332
310
|
type: Function,
|
|
333
|
-
required: true
|
|
334
|
-
default: void 0
|
|
311
|
+
required: true
|
|
335
312
|
},
|
|
336
313
|
preserveInvalidOnBlur: {
|
|
337
314
|
type: Boolean,
|
|
@@ -340,13 +317,11 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
340
317
|
},
|
|
341
318
|
open: {
|
|
342
319
|
type: Boolean,
|
|
343
|
-
required: true
|
|
344
|
-
default: void 0
|
|
320
|
+
required: true
|
|
345
321
|
},
|
|
346
322
|
onOpenChange: {
|
|
347
323
|
type: Function,
|
|
348
|
-
required: true
|
|
349
|
-
default: void 0
|
|
324
|
+
required: true
|
|
350
325
|
},
|
|
351
326
|
inputReadOnly: {
|
|
352
327
|
type: Boolean,
|
|
@@ -1383,4 +1358,5 @@ var RangeSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, exp
|
|
|
1383
1358
|
name: "RangeSelector",
|
|
1384
1359
|
inheritAttrs: false
|
|
1385
1360
|
});
|
|
1386
|
-
|
|
1361
|
+
//#endregion
|
|
1362
|
+
export { RangeSelector as default };
|
|
@@ -8,6 +8,13 @@ export interface MultipleDatesProps<DateType extends object = any> {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
placeholder?: VueNode;
|
|
10
10
|
maxTagCount?: number | 'responsive';
|
|
11
|
+
tagRender?: (props: {
|
|
12
|
+
label: VueNode;
|
|
13
|
+
value: DateType;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
onClose: (event?: MouseEvent) => void;
|
|
16
|
+
closable: boolean;
|
|
17
|
+
}) => VueNode;
|
|
11
18
|
}
|
|
12
19
|
declare const MultipleDates: import('vue').DefineSetupFnComponent<MultipleDatesProps<any>, {}, {}, MultipleDatesProps<any> & {}, import('vue').PublicProps>;
|
|
13
20
|
export default MultipleDates;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createVNode, defineComponent } from "vue";
|
|
2
2
|
import { clsx } from "@v-c/util";
|
|
3
3
|
import Overflow from "@v-c/overflow";
|
|
4
|
-
|
|
4
|
+
//#region src/PickerInput/Selector/SingleSelector/MultipleDates.tsx
|
|
5
|
+
var MultipleDates = /* @__PURE__ */ defineComponent((props) => {
|
|
5
6
|
return () => {
|
|
6
|
-
const { prefixCls, value, onRemove, removeIcon = "×", formatDate, disabled, maxTagCount, placeholder } = props;
|
|
7
|
+
const { prefixCls, value, onRemove, removeIcon = "×", formatDate, disabled, maxTagCount, placeholder, tagRender } = props;
|
|
7
8
|
const selectorCls = `${prefixCls}-selector`;
|
|
8
9
|
const selectionCls = `${prefixCls}-selection`;
|
|
9
10
|
const overflowCls = `${selectionCls}-overflow`;
|
|
@@ -23,8 +24,15 @@ var MultipleDates_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
23
24
|
const displayLabel = formatDate(date);
|
|
24
25
|
const onClose = (event) => {
|
|
25
26
|
if (event) event.stopPropagation();
|
|
26
|
-
onRemove(date);
|
|
27
|
+
if (!disabled) onRemove(date);
|
|
27
28
|
};
|
|
29
|
+
if (tagRender) return tagRender({
|
|
30
|
+
label: displayLabel,
|
|
31
|
+
value: date,
|
|
32
|
+
disabled: !!disabled,
|
|
33
|
+
onClose,
|
|
34
|
+
closable: !disabled
|
|
35
|
+
});
|
|
28
36
|
return renderSelector(displayLabel, onClose);
|
|
29
37
|
}
|
|
30
38
|
function renderRest(omittedValues) {
|
|
@@ -43,18 +51,15 @@ var MultipleDates_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
43
51
|
props: {
|
|
44
52
|
prefixCls: {
|
|
45
53
|
type: String,
|
|
46
|
-
required: true
|
|
47
|
-
default: void 0
|
|
54
|
+
required: true
|
|
48
55
|
},
|
|
49
56
|
value: {
|
|
50
57
|
type: Array,
|
|
51
|
-
required: true
|
|
52
|
-
default: void 0
|
|
58
|
+
required: true
|
|
53
59
|
},
|
|
54
60
|
onRemove: {
|
|
55
61
|
type: Function,
|
|
56
|
-
required: true
|
|
57
|
-
default: void 0
|
|
62
|
+
required: true
|
|
58
63
|
},
|
|
59
64
|
removeIcon: {
|
|
60
65
|
type: [
|
|
@@ -71,8 +76,7 @@ var MultipleDates_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
71
76
|
},
|
|
72
77
|
formatDate: {
|
|
73
78
|
type: Function,
|
|
74
|
-
required: true
|
|
75
|
-
default: void 0
|
|
79
|
+
required: true
|
|
76
80
|
},
|
|
77
81
|
disabled: {
|
|
78
82
|
type: Boolean,
|
|
@@ -96,8 +100,14 @@ var MultipleDates_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
96
100
|
type: [Number, String],
|
|
97
101
|
required: false,
|
|
98
102
|
default: void 0
|
|
103
|
+
},
|
|
104
|
+
tagRender: {
|
|
105
|
+
type: Function,
|
|
106
|
+
required: false,
|
|
107
|
+
default: void 0
|
|
99
108
|
}
|
|
100
109
|
},
|
|
101
110
|
name: "MultipleDates"
|
|
102
111
|
});
|
|
103
|
-
|
|
112
|
+
//#endregion
|
|
113
|
+
export { MultipleDates as default };
|
|
@@ -13,6 +13,13 @@ export interface SingleSelectorProps<DateType extends object = any> extends Sele
|
|
|
13
13
|
removeIcon?: any;
|
|
14
14
|
maxTagCount?: number | 'responsive';
|
|
15
15
|
multiple?: boolean;
|
|
16
|
+
tagRender?: (props: {
|
|
17
|
+
label: any;
|
|
18
|
+
value: DateType;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
onClose: (event?: MouseEvent) => void;
|
|
21
|
+
closable: boolean;
|
|
22
|
+
}) => any;
|
|
16
23
|
onMouseDown?: (e: MouseEvent) => void;
|
|
17
24
|
autoFocus?: boolean;
|
|
18
25
|
tabIndex?: number | string;
|
|
@@ -2,12 +2,13 @@ import { usePickerContext } from "../../context.js";
|
|
|
2
2
|
import { isSame } from "../../../utils/dateUtil.js";
|
|
3
3
|
import useInputProps from "../hooks/useInputHooks.js";
|
|
4
4
|
import useRootProps from "../hooks/useRootProps.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import Icon, { ClearIcon } from "../Icon.js";
|
|
6
|
+
import Input from "../Input.js";
|
|
7
|
+
import MultipleDates from "./MultipleDates.js";
|
|
8
8
|
import { Fragment, computed, createVNode, defineComponent, mergeProps, ref } from "vue";
|
|
9
9
|
import { clsx } from "@v-c/util";
|
|
10
|
-
|
|
10
|
+
//#region src/PickerInput/Selector/SingleSelector/index.tsx
|
|
11
|
+
var SingleSelector = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
|
|
11
12
|
const rtl = computed(() => props.direction === "rtl");
|
|
12
13
|
const ctx = usePickerContext();
|
|
13
14
|
const prefixCls = computed(() => ctx.value.prefixCls);
|
|
@@ -42,10 +43,10 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
42
43
|
active: props.focused
|
|
43
44
|
}));
|
|
44
45
|
return () => {
|
|
45
|
-
const { prefix, clearIcon, suffixIcon, placeholder, onClick, onClear, multiple, maxTagCount, removeIcon, onMouseDown, value, disabled, invalid, autoFocus, tabIndex } = props;
|
|
46
|
+
const { prefix, clearIcon, suffixIcon, placeholder, onClick, onClear, multiple, maxTagCount, removeIcon, tagRender, onMouseDown, value, disabled, invalid, autoFocus, tabIndex } = props;
|
|
46
47
|
const showClear = !!(clearIcon && value && value.length && !disabled);
|
|
47
48
|
const selectorNode = multiple ? createVNode(Fragment, null, [
|
|
48
|
-
createVNode(
|
|
49
|
+
createVNode(MultipleDates, {
|
|
49
50
|
"prefixCls": prefixCls.value,
|
|
50
51
|
"value": value,
|
|
51
52
|
"onRemove": onMultipleRemove,
|
|
@@ -53,7 +54,8 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
53
54
|
"maxTagCount": maxTagCount,
|
|
54
55
|
"disabled": disabled,
|
|
55
56
|
"removeIcon": removeIcon,
|
|
56
|
-
"placeholder": placeholder
|
|
57
|
+
"placeholder": placeholder,
|
|
58
|
+
"tagRender": tagRender
|
|
57
59
|
}, null),
|
|
58
60
|
createVNode("input", {
|
|
59
61
|
"class": `${prefixCls.value}-multiple-input`,
|
|
@@ -63,7 +65,7 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
63
65
|
"autofocus": autoFocus,
|
|
64
66
|
"tabindex": tabIndex
|
|
65
67
|
}, null),
|
|
66
|
-
createVNode(
|
|
68
|
+
createVNode(Icon, {
|
|
67
69
|
"type": "suffix",
|
|
68
70
|
"icon": suffixIcon
|
|
69
71
|
}, null),
|
|
@@ -71,7 +73,7 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
71
73
|
"icon": clearIcon,
|
|
72
74
|
"onClear": onClear
|
|
73
75
|
}, null)
|
|
74
|
-
]) : createVNode(
|
|
76
|
+
]) : createVNode(Input, mergeProps({ "ref": inputRef }, getInputProps(), {
|
|
75
77
|
"autofocus": autoFocus,
|
|
76
78
|
"tabindex": tabIndex,
|
|
77
79
|
"suffixIcon": suffixIcon,
|
|
@@ -119,13 +121,11 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
119
121
|
},
|
|
120
122
|
onChange: {
|
|
121
123
|
type: Function,
|
|
122
|
-
required: true
|
|
123
|
-
default: void 0
|
|
124
|
+
required: true
|
|
124
125
|
},
|
|
125
126
|
internalPicker: {
|
|
126
127
|
type: String,
|
|
127
|
-
required: true
|
|
128
|
-
default: void 0
|
|
128
|
+
required: true
|
|
129
129
|
},
|
|
130
130
|
disabled: {
|
|
131
131
|
type: Boolean,
|
|
@@ -149,8 +149,7 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
149
149
|
},
|
|
150
150
|
onInvalid: {
|
|
151
151
|
type: Function,
|
|
152
|
-
required: true
|
|
153
|
-
default: void 0
|
|
152
|
+
required: true
|
|
154
153
|
},
|
|
155
154
|
removeIcon: {
|
|
156
155
|
required: false,
|
|
@@ -166,6 +165,11 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
166
165
|
required: false,
|
|
167
166
|
default: void 0
|
|
168
167
|
},
|
|
168
|
+
tagRender: {
|
|
169
|
+
type: Function,
|
|
170
|
+
required: false,
|
|
171
|
+
default: void 0
|
|
172
|
+
},
|
|
169
173
|
onMouseDown: {
|
|
170
174
|
type: Function,
|
|
171
175
|
required: false,
|
|
@@ -183,8 +187,7 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
183
187
|
},
|
|
184
188
|
picker: {
|
|
185
189
|
type: String,
|
|
186
|
-
required: true
|
|
187
|
-
default: void 0
|
|
190
|
+
required: true
|
|
188
191
|
},
|
|
189
192
|
prefix: {
|
|
190
193
|
type: [
|
|
@@ -242,23 +245,17 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
242
245
|
},
|
|
243
246
|
focused: {
|
|
244
247
|
type: Boolean,
|
|
245
|
-
required: true
|
|
246
|
-
default: void 0
|
|
248
|
+
required: true
|
|
247
249
|
},
|
|
248
250
|
onFocus: {
|
|
249
251
|
type: Function,
|
|
250
|
-
required: true
|
|
251
|
-
default: void 0
|
|
252
|
+
required: true
|
|
252
253
|
},
|
|
253
254
|
onBlur: {
|
|
254
255
|
type: Function,
|
|
255
|
-
required: true
|
|
256
|
-
default: void 0
|
|
257
|
-
},
|
|
258
|
-
onSubmit: {
|
|
259
|
-
required: true,
|
|
260
|
-
default: void 0
|
|
256
|
+
required: true
|
|
261
257
|
},
|
|
258
|
+
onSubmit: { required: true },
|
|
262
259
|
onKeyDown: {
|
|
263
260
|
type: Function,
|
|
264
261
|
required: false,
|
|
@@ -266,13 +263,11 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
266
263
|
},
|
|
267
264
|
locale: {
|
|
268
265
|
type: Object,
|
|
269
|
-
required: true
|
|
270
|
-
default: void 0
|
|
266
|
+
required: true
|
|
271
267
|
},
|
|
272
268
|
generateConfig: {
|
|
273
269
|
type: Object,
|
|
274
|
-
required: true
|
|
275
|
-
default: void 0
|
|
270
|
+
required: true
|
|
276
271
|
},
|
|
277
272
|
direction: {
|
|
278
273
|
type: String,
|
|
@@ -281,27 +276,19 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
281
276
|
},
|
|
282
277
|
onClick: {
|
|
283
278
|
type: [Function, Array],
|
|
284
|
-
required: true
|
|
285
|
-
default: void 0
|
|
286
|
-
},
|
|
287
|
-
onClear: {
|
|
288
|
-
required: true,
|
|
289
|
-
default: void 0
|
|
279
|
+
required: true
|
|
290
280
|
},
|
|
281
|
+
onClear: { required: true },
|
|
291
282
|
format: {
|
|
292
283
|
type: Array,
|
|
293
|
-
required: true
|
|
294
|
-
default: void 0
|
|
284
|
+
required: true
|
|
295
285
|
},
|
|
296
286
|
maskFormat: {
|
|
297
287
|
type: String,
|
|
298
288
|
required: false,
|
|
299
289
|
default: void 0
|
|
300
290
|
},
|
|
301
|
-
onInputChange: {
|
|
302
|
-
required: true,
|
|
303
|
-
default: void 0
|
|
304
|
-
},
|
|
291
|
+
onInputChange: { required: true },
|
|
305
292
|
preserveInvalidOnBlur: {
|
|
306
293
|
type: Boolean,
|
|
307
294
|
required: false,
|
|
@@ -309,13 +296,11 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
309
296
|
},
|
|
310
297
|
open: {
|
|
311
298
|
type: Boolean,
|
|
312
|
-
required: true
|
|
313
|
-
default: void 0
|
|
299
|
+
required: true
|
|
314
300
|
},
|
|
315
301
|
onOpenChange: {
|
|
316
302
|
type: Function,
|
|
317
|
-
required: true
|
|
318
|
-
default: void 0
|
|
303
|
+
required: true
|
|
319
304
|
},
|
|
320
305
|
inputReadOnly: {
|
|
321
306
|
type: Boolean,
|
|
@@ -1352,4 +1337,5 @@ var SingleSelector_default = /* @__PURE__ */ defineComponent((props, { attrs, ex
|
|
|
1352
1337
|
name: "SingleSelector",
|
|
1353
1338
|
inheritAttrs: false
|
|
1354
1339
|
});
|
|
1355
|
-
|
|
1340
|
+
//#endregion
|
|
1341
|
+
export { SingleSelector as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, createVNode } from "vue";
|
|
2
2
|
import { warning } from "@v-c/util";
|
|
3
|
+
//#region src/PickerInput/Selector/hooks/useClearIcon.tsx
|
|
3
4
|
function fillClearIcon(prefixCls, allowClear, clearIcon) {
|
|
4
5
|
if (process.env.NODE_ENV !== "production" && clearIcon) warning(false, "`clearIcon` will be removed in future. Please use `allowClear` instead.");
|
|
5
6
|
if (allowClear === false) return null;
|
|
@@ -8,4 +9,5 @@ function fillClearIcon(prefixCls, allowClear, clearIcon) {
|
|
|
8
9
|
function useClearIcon(prefixCls, allowClear, clearIcon) {
|
|
9
10
|
return computed(() => fillClearIcon(prefixCls.value, allowClear?.value, clearIcon?.value));
|
|
10
11
|
}
|
|
12
|
+
//#endregion
|
|
11
13
|
export { useClearIcon as default, fillClearIcon };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import { warning } from "@v-c/util";
|
|
3
|
+
//#region src/PickerInput/Selector/hooks/useInputHooks.ts
|
|
3
4
|
function formatValue(value, { generateConfig, locale, format }) {
|
|
4
5
|
if (!value) return "";
|
|
5
6
|
if (typeof format === "function") return format(value);
|
|
@@ -117,4 +118,5 @@ function useInputProps(props, postProps) {
|
|
|
117
118
|
};
|
|
118
119
|
return [getInputProps, getText];
|
|
119
120
|
}
|
|
121
|
+
//#endregion
|
|
120
122
|
export { useInputProps as default };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { pickProps } from "../../../utils/miscUtil.js";
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
+
//#region src/PickerInput/Selector/hooks/useRootProps.ts
|
|
3
4
|
var propNames = ["onMouseEnter", "onMouseLeave"];
|
|
4
5
|
function useRootProps(props) {
|
|
5
6
|
return computed(() => {
|
|
6
7
|
return pickProps(props, propNames);
|
|
7
8
|
});
|
|
8
9
|
}
|
|
10
|
+
//#endregion
|
|
9
11
|
export { useRootProps as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/PickerInput/Selector/util.ts
|
|
1
2
|
function getMaskRange(key) {
|
|
2
3
|
return {
|
|
3
4
|
YYYY: [
|
|
@@ -27,4 +28,5 @@ function raf(callback, delayFrames = 1) {
|
|
|
27
28
|
raf.cancel = (id) => {
|
|
28
29
|
cancelAnimationFrame(id);
|
|
29
30
|
};
|
|
31
|
+
//#endregion
|
|
30
32
|
export { getMaskRange, raf };
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { BaseInfo, PanelMode, SharedPickerProps, SharedTimeProps, ValueDate } from '../interface';
|
|
2
|
+
export interface CustomTagProps<DateType extends object = any> {
|
|
3
|
+
label: any;
|
|
4
|
+
value: DateType;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
onClose: (event?: MouseEvent) => void;
|
|
7
|
+
closable: boolean;
|
|
8
|
+
}
|
|
2
9
|
export interface BasePickerProps<DateType extends object = any> extends SharedPickerProps<DateType> {
|
|
3
10
|
id?: string;
|
|
4
11
|
/** Not support `time` or `datetime` picker */
|
|
@@ -6,6 +13,8 @@ export interface BasePickerProps<DateType extends object = any> extends SharedPi
|
|
|
6
13
|
removeIcon?: any;
|
|
7
14
|
/** Only work when `multiple` is in used */
|
|
8
15
|
maxTagCount?: number | 'responsive';
|
|
16
|
+
/** Only works when `multiple` is in use */
|
|
17
|
+
tagRender?: (props: CustomTagProps<DateType>) => any;
|
|
9
18
|
value?: DateType | DateType[] | string | string[] | null;
|
|
10
19
|
defaultValue?: DateType | DateType[] | string | string[];
|
|
11
20
|
onChange?: (date: DateType | DateType[] | string | string[] | null, dateString: string | string[]) => void;
|