@sdata/web-vue 3.20.0 → 3.21.0

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,20 +1,32 @@
1
1
  import type { CascaderModelValue, CascaderOption } from './interface';
2
2
  import type { CascaderProps } from './types';
3
- declare var __VLS_30: any, __VLS_33: {}, __VLS_36: {}, __VLS_39: {}, __VLS_42: {}, __VLS_52: {}, __VLS_61: {};
3
+ declare var __VLS_16: {
4
+ value: CascaderModelValue;
5
+ displayValue: string | string[];
6
+ inputValue: string;
7
+ selectedOptions: CascaderOption[];
8
+ selectedPaths: CascaderOption[][];
9
+ popupVisible: boolean;
10
+ disabled: boolean;
11
+ loading: boolean;
12
+ multiple: boolean;
13
+ }, __VLS_32: any, __VLS_35: {}, __VLS_38: {}, __VLS_41: {}, __VLS_44: {}, __VLS_54: {}, __VLS_63: {};
4
14
  type __VLS_Slots = {} & {
5
- label?: (props: typeof __VLS_30) => any;
15
+ trigger?: (props: typeof __VLS_16) => any;
16
+ } & {
17
+ label?: (props: typeof __VLS_32) => any;
6
18
  } & {
7
- prefix?: (props: typeof __VLS_33) => any;
19
+ prefix?: (props: typeof __VLS_35) => any;
8
20
  } & {
9
- 'arrow-icon'?: (props: typeof __VLS_36) => any;
21
+ 'arrow-icon'?: (props: typeof __VLS_38) => any;
10
22
  } & {
11
- 'loading-icon'?: (props: typeof __VLS_39) => any;
23
+ 'loading-icon'?: (props: typeof __VLS_41) => any;
12
24
  } & {
13
- 'search-icon'?: (props: typeof __VLS_42) => any;
25
+ 'search-icon'?: (props: typeof __VLS_44) => any;
14
26
  } & {
15
- empty?: (props: typeof __VLS_52) => any;
27
+ empty?: (props: typeof __VLS_54) => any;
16
28
  } & {
17
- empty?: (props: typeof __VLS_61) => any;
29
+ empty?: (props: typeof __VLS_63) => any;
18
30
  };
19
31
  declare const __VLS_base: import("vue").DefineComponent<CascaderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
32
  search: (value: string) => any;
@@ -136,6 +136,11 @@ var cascader_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
136
136
  var _props$defaultValue;
137
137
  const props = __props;
138
138
  const emit = __emit;
139
+ /**
140
+ * @zh 自定义触发元素
141
+ * @en Custom trigger element
142
+ * @slot trigger
143
+ */
139
144
  const attrs = useAttrs();
140
145
  const slots = useSlots();
141
146
  const configCtx = inject(configProviderInjectionKey, void 0);
@@ -484,6 +489,21 @@ var cascader_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
484
489
  });
485
490
  return result;
486
491
  });
492
+ const triggerValue = computed(() => {
493
+ var _values$2;
494
+ const values = Array.from(computedValueMap.value.values());
495
+ return props.multiple ? values : (_values$2 = values[0]) !== null && _values$2 !== void 0 ? _values$2 : "";
496
+ });
497
+ const triggerDisplayValue = computed(() => {
498
+ var _labels$;
499
+ const labels = selectViewValue.value.map((item) => item.label);
500
+ return props.multiple ? labels : (_labels$ = labels[0]) !== null && _labels$ !== void 0 ? _labels$ : "";
501
+ });
502
+ const triggerSelectedPaths = computed(() => Array.from(computedValueMap.value.keys()).map((key) => {
503
+ var _leafOptionMap$get;
504
+ return (_leafOptionMap$get = leafOptionMap.get(key)) === null || _leafOptionMap$get === void 0 ? void 0 : _leafOptionMap$get.path.map((item) => item.raw);
505
+ }).filter((path) => Boolean(path)));
506
+ const triggerSelectedOptions = computed(() => triggerSelectedPaths.value.map((path) => path.at(-1)).filter((option) => Boolean(option)));
487
507
  return (_ctx, _cache) => {
488
508
  return openBlock(), createBlock(unref(Tooltip), {
489
509
  "popup-visible": unref(tipVisible),
@@ -556,7 +576,17 @@ var cascader_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
556
576
  "spin-props",
557
577
  "virtual-list-props"
558
578
  ]))]),
559
- default: withCtx(() => [createVNode(unref(select_view_default), mergeProps({
579
+ default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {
580
+ value: triggerValue.value,
581
+ displayValue: triggerDisplayValue.value,
582
+ inputValue: computedInputValue.value,
583
+ selectedOptions: triggerSelectedOptions.value,
584
+ selectedPaths: triggerSelectedPaths.value,
585
+ popupVisible: unref(computedPopupVisible),
586
+ disabled: unref(mergedDisabled),
587
+ loading: unref(loading),
588
+ multiple: unref(multiple)
589
+ }, () => [createVNode(unref(select_view_default), mergeProps({
560
590
  "model-value": selectViewValue.value,
561
591
  "input-value": computedInputValue.value,
562
592
  disabled: unref(mergedDisabled),
@@ -624,7 +654,7 @@ var cascader_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
624
654
  "tag-nowrap",
625
655
  "input-attrs",
626
656
  "onKeydown"
627
- ])]),
657
+ ])])]),
628
658
  _: 3
629
659
  }, 16, [
630
660
  "floating-options",
@@ -10,6 +10,6 @@ declare const Cascader: CascaderComponent;
10
10
  export type CascaderInstance = InstanceType<typeof _Cascader>;
11
11
  export type CascaderPanelInstance = InstanceType<typeof _CascaderPanel>;
12
12
  export type { CascaderChangeHandler, CascaderFallback, CascaderFieldNames, CascaderFormatLabel, CascaderLoadMore, CascaderModelValue, CascaderOption, CascaderOptionValue, CascaderPathValue, CascaderSearchHandler, CascaderSingleValue, } from './interface';
13
- export type { CascaderEmits, CascaderPanelEmits, CascaderPanelProps, CascaderProps } from './types';
13
+ export type { CascaderEmits, CascaderPanelEmits, CascaderPanelProps, CascaderProps, CascaderTriggerSlotProps, } from './types';
14
14
  export { _CascaderPanel as CascaderPanel };
15
15
  export default Cascader;
@@ -6,6 +6,17 @@ import type { SpinProps } from '../spin';
6
6
  import type { TriggerProps } from '../trigger';
7
7
  import type { CascaderFallback, CascaderFieldNames, CascaderFormatLabel, CascaderLoadMore, CascaderModelValue, CascaderOption } from './interface';
8
8
  export type CascaderExpandTrigger = 'click' | 'hover';
9
+ export interface CascaderTriggerSlotProps {
10
+ value: CascaderModelValue;
11
+ displayValue: string | string[];
12
+ inputValue: string;
13
+ selectedOptions: CascaderOption[];
14
+ selectedPaths: CascaderOption[][];
15
+ popupVisible: boolean;
16
+ disabled: boolean;
17
+ loading: boolean;
18
+ multiple: boolean;
19
+ }
9
20
  export interface CascaderProps extends FitWidthProps {
10
21
  pathMode?: boolean;
11
22
  multiple?: boolean;
@@ -273,7 +273,19 @@ var color_picker_default = /* @__PURE__ */ defineComponent({
273
273
  "content": readonlyTipText.value,
274
274
  "position": "top"
275
275
  }, { default: () => [createVNode(Trigger, mergeProps({ "onPopupVisibleChange": onPopupVisibleChange }, mergedTriggerProps.value), {
276
- default: () => [slots.default ? slots.default() : renderTriggerInput()],
276
+ default: () => {
277
+ var _ref, _slots$trigger, _slots$trigger2, _slots$default;
278
+ return [(_ref = (_slots$trigger = (_slots$trigger2 = slots.trigger) === null || _slots$trigger2 === void 0 ? void 0 : _slots$trigger2.call(slots, {
279
+ value: mergedValue.value,
280
+ displayValue: triggerInputValue.value,
281
+ color: getColorObject(colorState.value),
282
+ popupVisible: popupVisible.value,
283
+ disabled: props.disabled,
284
+ readonly: Boolean(props.readonly),
285
+ format: normalizedFormat.value,
286
+ previewStyle: previewStyle.value
287
+ })) !== null && _slots$trigger !== void 0 ? _slots$trigger : (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)) !== null && _ref !== void 0 ? _ref : renderTriggerInput()];
288
+ },
277
289
  content: renderPanel
278
290
  })] });
279
291
  };
@@ -311,6 +311,6 @@ declare const ColorPicker: {
311
311
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
312
312
  install: (app: App, options?: SDOptions) => void;
313
313
  };
314
- export type { RGB, HSV, HSVA, Color, ColorMode, ColorModes, ColorFormat, ColorObject, ColorValueState, ColorPickerChangeTrigger, GradientColorPoint, RecentColorsValue, } from './interface';
314
+ export type { RGB, HSV, HSVA, Color, ColorMode, ColorModes, ColorFormat, ColorObject, ColorValueState, ColorPickerChangeTrigger, ColorPickerTriggerSlotProps, GradientColorPoint, RecentColorsValue, } from './interface';
315
315
  export type ColorPickerInstance = InstanceType<typeof _ColorPicker>;
316
316
  export default ColorPicker;
@@ -35,6 +35,16 @@ export type ColorFormat = 'HEX' | 'HEX8' | 'RGB' | 'RGBA' | 'HSL' | 'HSLA' | 'HS
35
35
  export type RecentColorsValue = string[] | boolean | null;
36
36
  export type ColorModes = ColorMode[];
37
37
  export type ColorPickerChangeTrigger = 'palette-saturation-brightness' | 'palette-saturation' | 'palette-brightness' | 'palette-hue-bar' | 'palette-alpha-bar' | 'input' | 'preset' | 'recent' | 'clear';
38
+ export interface ColorPickerTriggerSlotProps {
39
+ value: string;
40
+ displayValue: string;
41
+ color: ColorObject;
42
+ popupVisible: boolean;
43
+ disabled: boolean;
44
+ readonly: boolean;
45
+ format: ColorFormat;
46
+ previewStyle: Record<string, string>;
47
+ }
38
48
  export interface ColorObject {
39
49
  alpha: number;
40
50
  css: string;
@@ -7,7 +7,7 @@ import _QuarterPicker from './pickers/quarter-picker';
7
7
  import _WeekPicker from './pickers/week-picker';
8
8
  import _YearPicker from './pickers/year-picker';
9
9
  import _RangePicker from './range-picker.vue';
10
- export type { CalendarValue, DatePickerProps, DisabledDate, DisabledTime, DisabledTimeProps, FormatFunc, MonthPickerProps, PickerProps, QuarterPickerProps, RangeDisabledDate, RangeDisabledTime, RangePickerProps, ShortcutType, ValueFormat, WeekPickerProps, YearPickerProps, } from './interface';
10
+ export type { CalendarValue, DatePickerProps, DatePickerTriggerSlotProps, DisabledDate, DisabledTime, DisabledTimeProps, FormatFunc, MonthPickerProps, PickerProps, QuarterPickerProps, RangeDisabledDate, RangeDisabledTime, RangePickerProps, RangePickerTriggerSlotProps, ShortcutType, ValueFormat, WeekPickerProps, YearPickerProps, } from './interface';
11
11
  export type DatePickerChangeHandler = (value: CalendarValue | undefined, date: Date | undefined, dateString: string | undefined) => void;
12
12
  export type DatePickerSelectHandler = DatePickerChangeHandler;
13
13
  export type DatePickerOkHandler = DatePickerChangeHandler;
@@ -883,6 +883,17 @@ declare const DatePicker: {
883
883
  clearRangeOnReselect: boolean;
884
884
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
885
885
  $slots: {
886
+ trigger?: (props: {
887
+ value: (CalendarValue | undefined)[] | undefined;
888
+ date: (Date | undefined)[] | undefined;
889
+ displayValue: (string | undefined)[];
890
+ inputValue: (string | undefined)[] | undefined;
891
+ popupVisible: boolean;
892
+ disabled: boolean;
893
+ disabledInputs: boolean[];
894
+ readonly: boolean;
895
+ }) => any;
896
+ } & {
886
897
  default?: (props: {}) => any;
887
898
  } & {
888
899
  prefix?: (props: {}) => any;
@@ -22,6 +22,25 @@ export type RangeDisabledDate = (current: Date, type: 'start' | 'end') => boolea
22
22
  export type RangeDisabledTime = (current: Date, type: 'start' | 'end') => DisabledTimeProps;
23
23
  export type Mode = 'date' | 'year' | 'quarter' | 'month' | 'week';
24
24
  export type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
25
+ export interface DatePickerTriggerSlotProps {
26
+ value: CalendarValue | undefined;
27
+ date: Date | undefined;
28
+ displayValue: string;
29
+ inputValue: string | undefined;
30
+ popupVisible: boolean;
31
+ disabled: boolean;
32
+ readonly: boolean;
33
+ }
34
+ export interface RangePickerTriggerSlotProps {
35
+ value: Array<CalendarValue | undefined> | undefined;
36
+ date: Array<Date | undefined> | undefined;
37
+ displayValue: Array<string | undefined>;
38
+ inputValue: Array<string | undefined> | undefined;
39
+ popupVisible: boolean;
40
+ disabled: boolean;
41
+ disabledInputs: boolean[];
42
+ readonly: boolean;
43
+ }
25
44
  export interface DatePickerProps {
26
45
  dayStartOfWeek: WeekStart;
27
46
  format?: string | FormatFunc;
@@ -15,7 +15,15 @@ declare function onPanelShortcutClick(value: Dayjs, shortcut: ShortcutType): voi
15
15
  declare function onPanelHeaderLabelClick(type: 'year' | 'month'): void;
16
16
  declare function onMonthHeaderClick(): void;
17
17
  declare function onPanelHeaderSelect(date: Dayjs): void;
18
- declare var __VLS_10: {}, __VLS_26: {}, __VLS_29: {}, __VLS_37: {
18
+ declare var __VLS_10: {
19
+ value: string | number | Date | undefined;
20
+ date: Date | undefined;
21
+ displayValue: string;
22
+ inputValue: string | undefined;
23
+ popupVisible: boolean;
24
+ disabled: boolean;
25
+ readonly: boolean;
26
+ }, __VLS_12: {}, __VLS_28: {}, __VLS_31: {}, __VLS_39: {
19
27
  component: {
20
28
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
21
29
  mode: {
@@ -465,9 +473,9 @@ declare var __VLS_10: {}, __VLS_26: {}, __VLS_29: {}, __VLS_37: {
465
473
  shortcutsPosition: "left" | "right" | "bottom";
466
474
  hideTrigger: boolean;
467
475
  };
468
- }, __VLS_46: {}, __VLS_49: {
476
+ }, __VLS_48: {}, __VLS_51: {
469
477
  date: Date;
470
- }, __VLS_51: {
478
+ }, __VLS_53: {
471
479
  component: {
472
480
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
473
481
  mode: {
@@ -917,27 +925,29 @@ declare var __VLS_10: {}, __VLS_26: {}, __VLS_29: {}, __VLS_37: {
917
925
  shortcutsPosition: "left" | "right" | "bottom";
918
926
  hideTrigger: boolean;
919
927
  };
920
- }, __VLS_60: {}, __VLS_63: {
928
+ }, __VLS_62: {}, __VLS_65: {
921
929
  date: Date;
922
930
  };
923
931
  type __VLS_Slots = {} & {
924
- default?: (props: typeof __VLS_10) => any;
932
+ trigger?: (props: typeof __VLS_10) => any;
933
+ } & {
934
+ default?: (props: typeof __VLS_12) => any;
925
935
  } & {
926
- prefix?: (props: typeof __VLS_26) => any;
936
+ prefix?: (props: typeof __VLS_28) => any;
927
937
  } & {
928
- 'suffix-icon'?: (props: typeof __VLS_29) => any;
938
+ 'suffix-icon'?: (props: typeof __VLS_31) => any;
929
939
  } & {
930
- panelRender?: (props: typeof __VLS_37) => any;
940
+ panelRender?: (props: typeof __VLS_39) => any;
931
941
  } & {
932
- extra?: (props: typeof __VLS_46) => any;
942
+ extra?: (props: typeof __VLS_48) => any;
933
943
  } & {
934
- cell?: (props: typeof __VLS_49) => any;
944
+ cell?: (props: typeof __VLS_51) => any;
935
945
  } & {
936
- panelRender?: (props: typeof __VLS_51) => any;
946
+ panelRender?: (props: typeof __VLS_53) => any;
937
947
  } & {
938
- extra?: (props: typeof __VLS_60) => any;
948
+ extra?: (props: typeof __VLS_62) => any;
939
949
  } & {
940
- cell?: (props: typeof __VLS_63) => any;
950
+ cell?: (props: typeof __VLS_65) => any;
941
951
  };
942
952
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
943
953
  locale: {
@@ -282,6 +282,11 @@ var picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
282
282
  const props = __props;
283
283
  const emit = __emit;
284
284
  /**
285
+ * @zh 自定义触发元素
286
+ * @en Custom trigger element
287
+ * @slot trigger
288
+ */
289
+ /**
285
290
  * @zh 自定义渲染面板
286
291
  * @en Customize panel rendering
287
292
  * @slot panelRender
@@ -445,6 +450,14 @@ var picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
445
450
  return (_ref = (_previewValue$value = previewValue.value) !== null && _previewValue$value !== void 0 ? _previewValue$value : processValue.value) !== null && _ref !== void 0 ? _ref : selectedValue.value;
446
451
  });
447
452
  const [inputValue, setInputValue] = useState();
453
+ const triggerLocalValue = computed(() => selectedValue.value ? toLocal(selectedValue.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value) : void 0);
454
+ const triggerValue = computed(() => selectedValue.value ? getReturnValue(selectedValue.value) : void 0);
455
+ const triggerDate = computed(() => getDateValue(triggerLocalValue.value));
456
+ const triggerDisplayValue = computed(() => {
457
+ var _getFormattedValue;
458
+ if (!triggerLocalValue.value) return "";
459
+ return isFunction(inputFormat.value) ? inputFormat.value(triggerLocalValue.value) : (_getFormattedValue = getFormattedValue(triggerLocalValue.value, inputFormat.value)) !== null && _getFormattedValue !== void 0 ? _getFormattedValue : "";
460
+ });
448
461
  const [panelVisible, setLocalPanelVisible] = useMergeState(defaultPopupVisible.value, reactive({ value: popupVisible }));
449
462
  const setPanelVisible = (newVisible) => {
450
463
  if (panelVisible.value !== newVisible) {
@@ -678,7 +691,15 @@ var picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
678
691
  fn: withCtx((scope) => [renderSlot(_ctx.$slots, "cell", normalizeProps(guardReactiveProps(scope)))]),
679
692
  key: "1"
680
693
  } : void 0]), 1040))])]),
681
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(input_default, mergeProps(_ctx.$attrs, {
694
+ default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {
695
+ value: triggerValue.value,
696
+ date: triggerDate.value,
697
+ displayValue: triggerDisplayValue.value,
698
+ inputValue: unref(inputValue),
699
+ popupVisible: unref(panelVisible),
700
+ disabled: unref(mergedDisabled),
701
+ readonly: Boolean(unref(readonly))
702
+ }, () => [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(input_default, mergeProps(_ctx.$attrs, {
682
703
  ref_key: "refInput",
683
704
  ref: refInput,
684
705
  size: __props.size,
@@ -725,7 +746,7 @@ var picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
725
746
  "input-value",
726
747
  "value",
727
748
  "format"
728
- ])])]),
749
+ ])])])]),
729
750
  _: 3
730
751
  }, 16, [
731
752
  "floating-options",
@@ -16,7 +16,16 @@ declare function onPanelShortcutMouseEnter(value: Array<Dayjs | undefined>): voi
16
16
  declare function onPanelShortcutMouseLeave(): void;
17
17
  declare function onPanelShortcutClick(value: Array<Dayjs | undefined>, shortcut: ShortcutType): void;
18
18
  declare function onPanelConfirm(): void;
19
- declare var __VLS_10: {}, __VLS_25: {}, __VLS_28: {}, __VLS_36: {}, __VLS_39: {
19
+ declare var __VLS_10: {
20
+ value: (CalendarValue | undefined)[] | undefined;
21
+ date: (Date | undefined)[] | undefined;
22
+ displayValue: (string | undefined)[];
23
+ inputValue: (string | undefined)[] | undefined;
24
+ popupVisible: boolean;
25
+ disabled: boolean;
26
+ disabledInputs: boolean[];
27
+ readonly: boolean;
28
+ }, __VLS_12: {}, __VLS_27: {}, __VLS_30: {}, __VLS_38: {}, __VLS_41: {
20
29
  component: {
21
30
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
22
31
  mode: {
@@ -652,10 +661,10 @@ declare var __VLS_10: {}, __VLS_25: {}, __VLS_28: {}, __VLS_36: {}, __VLS_39: {
652
661
  shortcutsPosition: "left" | "right" | "bottom";
653
662
  hideTrigger: boolean;
654
663
  };
655
- }, __VLS_48: {}, __VLS_51: {
664
+ }, __VLS_50: {}, __VLS_53: {
656
665
  type: string;
657
666
  date: Date;
658
- }, __VLS_53: {
667
+ }, __VLS_55: {
659
668
  component: {
660
669
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
661
670
  mode: {
@@ -1291,30 +1300,32 @@ declare var __VLS_10: {}, __VLS_25: {}, __VLS_28: {}, __VLS_36: {}, __VLS_39: {
1291
1300
  shortcutsPosition: "left" | "right" | "bottom";
1292
1301
  hideTrigger: boolean;
1293
1302
  };
1294
- }, __VLS_62: {}, __VLS_65: {
1303
+ }, __VLS_64: {}, __VLS_67: {
1295
1304
  type: string;
1296
1305
  date: Date;
1297
1306
  };
1298
1307
  type __VLS_Slots = {} & {
1299
- default?: (props: typeof __VLS_10) => any;
1308
+ trigger?: (props: typeof __VLS_10) => any;
1309
+ } & {
1310
+ default?: (props: typeof __VLS_12) => any;
1300
1311
  } & {
1301
- prefix?: (props: typeof __VLS_25) => any;
1312
+ prefix?: (props: typeof __VLS_27) => any;
1302
1313
  } & {
1303
- 'suffix-icon'?: (props: typeof __VLS_28) => any;
1314
+ 'suffix-icon'?: (props: typeof __VLS_30) => any;
1304
1315
  } & {
1305
- separator?: (props: typeof __VLS_36) => any;
1316
+ separator?: (props: typeof __VLS_38) => any;
1306
1317
  } & {
1307
- panelRender?: (props: typeof __VLS_39) => any;
1318
+ panelRender?: (props: typeof __VLS_41) => any;
1308
1319
  } & {
1309
- extra?: (props: typeof __VLS_48) => any;
1320
+ extra?: (props: typeof __VLS_50) => any;
1310
1321
  } & {
1311
- cell?: (props: typeof __VLS_51) => any;
1322
+ cell?: (props: typeof __VLS_53) => any;
1312
1323
  } & {
1313
- panelRender?: (props: typeof __VLS_53) => any;
1324
+ panelRender?: (props: typeof __VLS_55) => any;
1314
1325
  } & {
1315
- extra?: (props: typeof __VLS_62) => any;
1326
+ extra?: (props: typeof __VLS_64) => any;
1316
1327
  } & {
1317
- cell?: (props: typeof __VLS_65) => any;
1328
+ cell?: (props: typeof __VLS_67) => any;
1318
1329
  };
1319
1330
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
1320
1331
  mode: {
@@ -372,6 +372,16 @@ var range_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
372
372
  return (_ref = (_previewValue$value = previewValue.value) !== null && _previewValue$value !== void 0 ? _previewValue$value : processValue.value) !== null && _ref !== void 0 ? _ref : selectedValue.value;
373
373
  });
374
374
  const [inputValue, setInputValue] = useState();
375
+ const triggerLocalValue = computed(() => {
376
+ var _selectedValue$value;
377
+ return (_selectedValue$value = selectedValue.value) === null || _selectedValue$value === void 0 ? void 0 : _selectedValue$value.map((item) => item ? toLocal(item, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value) : void 0);
378
+ });
379
+ const triggerValue = computed(() => selectedValue.value ? getReturnRangeValue(selectedValue.value, returnValueFormat.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value) : void 0);
380
+ const triggerDate = computed(() => getDateValue(triggerLocalValue.value));
381
+ const triggerDisplayValue = computed(() => {
382
+ var _getFormattedValue;
383
+ return (_getFormattedValue = getFormattedValue(triggerLocalValue.value, computedFormat.value)) !== null && _getFormattedValue !== void 0 ? _getFormattedValue : [];
384
+ });
375
385
  const startHeaderMode = ref();
376
386
  const endHeaderMode = ref();
377
387
  const [panelVisible, setLocalPanelVisible] = useMergeState(defaultPopupVisible.value, reactive({ value: popupVisible }));
@@ -705,7 +715,16 @@ var range_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
705
715
  fn: withCtx((scope) => [renderSlot(_ctx.$slots, "cell", normalizeProps(guardReactiveProps(scope)))]),
706
716
  key: "1"
707
717
  } : void 0]), 1040))])]),
708
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(input_range_default, mergeProps({
718
+ default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {
719
+ value: triggerValue.value,
720
+ date: triggerDate.value,
721
+ displayValue: triggerDisplayValue.value,
722
+ inputValue: unref(inputValue),
723
+ popupVisible: unref(panelVisible),
724
+ disabled: triggerDisabled.value,
725
+ disabledInputs: disabledArray.value,
726
+ readonly: Boolean(__props.readonly)
727
+ }, () => [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(input_range_default, mergeProps({
709
728
  ref_key: "refInput",
710
729
  ref: refInput
711
730
  }, _ctx.$attrs, {
@@ -756,7 +775,7 @@ var range_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
756
775
  "input-value",
757
776
  "value",
758
777
  "format"
759
- ])])]),
778
+ ])])])]),
760
779
  _: 3
761
780
  }, 16, [
762
781
  "floating-options",
@@ -2932,5 +2932,5 @@ declare const Select: {
2932
2932
  install: (app: App, options?: SDOptions) => void;
2933
2933
  };
2934
2934
  export type SelectInstance = InstanceType<typeof _Select>;
2935
- export type { SelectProps, SelectOption, SelectOptionData, SelectOptionGroup, SelectFieldNames, FilterOption, SelectFallbackOption, } from './interface';
2935
+ export type { SelectProps, SelectOption, SelectOptionData, SelectOptionGroup, SelectFieldNames, SelectTriggerSlotProps, FilterOption, SelectFallbackOption, } from './interface';
2936
2936
  export default Select;
@@ -5,6 +5,16 @@ import type { ScrollbarProps } from '../scrollbar';
5
5
  import type { TriggerProps } from '../trigger';
6
6
  export type SelectOptionValue = string | number | boolean | Record<string, unknown>;
7
7
  export type SelectModelValue = SelectOptionValue | SelectOptionValue[] | null | undefined;
8
+ export interface SelectTriggerSlotProps {
9
+ value: SelectModelValue;
10
+ displayValue: string | string[];
11
+ inputValue: string;
12
+ selectedOptions: SelectOptionData[];
13
+ popupVisible: boolean;
14
+ disabled: boolean;
15
+ loading: boolean;
16
+ multiple: boolean;
17
+ }
8
18
  export interface OptionValueWithKey {
9
19
  value: SelectOptionValue;
10
20
  key: string;
@@ -468,6 +468,16 @@ var select_default = /* @__PURE__ */ defineComponent({
468
468
  }
469
469
  return result;
470
470
  });
471
+ const triggerValue = computed(() => {
472
+ const values = computedValueObjects.value.map((item) => item.value);
473
+ return props.multiple ? values : values[0];
474
+ });
475
+ const triggerDisplayValue = computed(() => {
476
+ var _labels$;
477
+ const labels = selectViewValue.value.map((item) => String(item.label));
478
+ return props.multiple ? labels : (_labels$ = labels[0]) !== null && _labels$ !== void 0 ? _labels$ : "";
479
+ });
480
+ const triggerSelectedOptions = computed(() => selectViewValue.value.map((item) => item.option).filter((option) => Boolean(option)));
471
481
  const ellipsisPrefixCls = getPrefixCls("ellipsis");
472
482
  const renderOptionEllipsis = (label) => createVNode("span", { "class": [ellipsisPrefixCls, `${ellipsisPrefixCls}--single-line`] }, [createVNode("span", { "class": `${ellipsisPrefixCls}-content` }, [label])]);
473
483
  const getOptionContentFunc = (optionInfo) => {
@@ -610,7 +620,16 @@ var select_default = /* @__PURE__ */ defineComponent({
610
620
  }, props.triggerProps, { "floatingOptions": (_props$floatingOption = props.floatingOptions) !== null && _props$floatingOption !== void 0 ? _props$floatingOption : (_props$triggerProps = props.triggerProps) === null || _props$triggerProps === void 0 ? void 0 : _props$triggerProps.floatingOptions }), {
611
621
  default: () => {
612
622
  var _slots$trigger, _slots$trigger2;
613
- return [(_slots$trigger = (_slots$trigger2 = slots.trigger) === null || _slots$trigger2 === void 0 ? void 0 : _slots$trigger2.call(slots)) !== null && _slots$trigger !== void 0 ? _slots$trigger : createVNode(select_view_default, mergeProps({
623
+ return [(_slots$trigger = (_slots$trigger2 = slots.trigger) === null || _slots$trigger2 === void 0 ? void 0 : _slots$trigger2.call(slots, {
624
+ value: triggerValue.value,
625
+ displayValue: triggerDisplayValue.value,
626
+ inputValue: computedInputValue.value,
627
+ selectedOptions: triggerSelectedOptions.value,
628
+ popupVisible: computedPopupVisible.value,
629
+ disabled: mergedDisabled.value,
630
+ loading: props.loading,
631
+ multiple: props.multiple
632
+ })) !== null && _slots$trigger !== void 0 ? _slots$trigger : createVNode(select_view_default, mergeProps({
614
633
  "ref": selectViewRef,
615
634
  "class": prefixCls,
616
635
  "modelValue": selectViewValue.value,
@@ -368,6 +368,17 @@ declare const TimePicker: {
368
368
  hideDisabledOptions: boolean;
369
369
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
370
370
  $slots: {
371
+ trigger?: (props: {
372
+ value: string | (string | undefined)[] | undefined;
373
+ date: Date | (Date | undefined)[] | undefined;
374
+ displayValue: string | (string | undefined)[];
375
+ inputValue: string | (string | undefined)[] | undefined;
376
+ popupVisible: boolean;
377
+ disabled: boolean;
378
+ readonly: boolean;
379
+ range: boolean;
380
+ }) => any;
381
+ } & {
371
382
  prefix?: (props: {}) => any;
372
383
  } & {
373
384
  'suffix-icon'?: (props: {}) => any;
@@ -378,5 +389,5 @@ declare const TimePicker: {
378
389
  install: (app: App, options?: SDOptions) => void;
379
390
  };
380
391
  export type TimePickerInstance = InstanceType<typeof _TimePicker>;
381
- export type { TimeValue } from './interface';
392
+ export type { TimePickerTriggerSlotProps, TimeValue } from './interface';
382
393
  export default TimePicker;
@@ -1,5 +1,15 @@
1
1
  import { Dayjs } from 'dayjs';
2
2
  export type TimeValue = Date | string | number;
3
+ export interface TimePickerTriggerSlotProps {
4
+ value: string | Array<string | undefined> | undefined;
5
+ date: Date | Array<Date | undefined> | undefined;
6
+ displayValue: string | Array<string | undefined>;
7
+ inputValue: string | Array<string | undefined> | undefined;
8
+ popupVisible: boolean;
9
+ disabled: boolean;
10
+ readonly: boolean;
11
+ range: boolean;
12
+ }
3
13
  export interface BasePanelProps {
4
14
  disableConfirm: boolean;
5
15
  use12Hours: boolean;
@@ -2,13 +2,24 @@ import { PropType } from 'vue';
2
2
  import type { FloatingOptions } from '../_utils/floating';
3
3
  import { Size } from '../_utils/constant';
4
4
  import { TriggerProps } from '../trigger';
5
- declare var __VLS_21: {}, __VLS_24: {}, __VLS_42: {};
5
+ declare var __VLS_10: {
6
+ value: string | (string | undefined)[] | undefined;
7
+ date: Date | (Date | undefined)[] | undefined;
8
+ displayValue: string | (string | undefined)[];
9
+ inputValue: string | (string | undefined)[] | undefined;
10
+ popupVisible: boolean;
11
+ disabled: boolean;
12
+ readonly: boolean;
13
+ range: boolean;
14
+ }, __VLS_23: {}, __VLS_26: {}, __VLS_44: {};
6
15
  type __VLS_Slots = {} & {
7
- prefix?: (props: typeof __VLS_21) => any;
16
+ trigger?: (props: typeof __VLS_10) => any;
17
+ } & {
18
+ prefix?: (props: typeof __VLS_23) => any;
8
19
  } & {
9
- 'suffix-icon'?: (props: typeof __VLS_24) => any;
20
+ 'suffix-icon'?: (props: typeof __VLS_26) => any;
10
21
  } & {
11
- extra?: (props: typeof __VLS_42) => any;
22
+ extra?: (props: typeof __VLS_44) => any;
12
23
  };
13
24
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
14
25
  type: {
@@ -201,6 +201,11 @@ var time_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
201
201
  const props = __props;
202
202
  const emit = __emit;
203
203
  /**
204
+ * @zh 自定义触发元素
205
+ * @en Custom trigger element
206
+ * @slot trigger
207
+ */
208
+ /**
204
209
  * @zh 输入框前缀
205
210
  * @en Input box prefix
206
211
  * @slot prefix
@@ -236,6 +241,12 @@ var time_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
236
241
  isRange,
237
242
  format: computedFormat
238
243
  }));
244
+ const triggerValue = computed(() => getFormattedValue(computedValue.value, computedFormat.value));
245
+ const triggerDate = computed(() => getDateValue(computedValue.value));
246
+ const triggerDisplayValue = computed(() => {
247
+ var _triggerValue$value;
248
+ return (_triggerValue$value = triggerValue.value) !== null && _triggerValue$value !== void 0 ? _triggerValue$value : isRange.value ? [] : "";
249
+ });
239
250
  const [panelVisible, setLocalVisible] = useMergeState(defaultPopupVisible.value, reactive({ value: popupVisible }));
240
251
  const setPanelVisible = (newVisible) => {
241
252
  if (newVisible !== panelVisible.value) {
@@ -438,7 +449,16 @@ var time_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
438
449
  "hide-disabled-options",
439
450
  "hide-footer"
440
451
  ]))], 2)]),
441
- default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(InputComponent.value), mergeProps(_objectSpread2(_objectSpread2({}, _ctx.$attrs), inputProps.value), {
452
+ default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {
453
+ value: triggerValue.value,
454
+ date: triggerDate.value,
455
+ displayValue: triggerDisplayValue.value,
456
+ inputValue: unref(inputValue),
457
+ popupVisible: unref(panelVisible),
458
+ disabled: unref(mergedDisabled),
459
+ readonly: Boolean(__props.readonly),
460
+ range: isRange.value
461
+ }, () => [(openBlock(), createBlock(resolveDynamicComponent(InputComponent.value), mergeProps(_objectSpread2(_objectSpread2({}, _ctx.$attrs), inputProps.value), {
442
462
  ref_key: "refInput",
443
463
  ref: refInput,
444
464
  "input-value": unref(inputValue),
@@ -483,7 +503,7 @@ var time_picker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
483
503
  "fit-width-fallback",
484
504
  "fit-width-fallback-text",
485
505
  "onClear"
486
- ]))]),
506
+ ]))])]),
487
507
  _: 3
488
508
  }, 16, [
489
509
  "position",
@@ -1,7 +1,7 @@
1
1
  import type { SFCWithInstall } from '../_utils/types';
2
2
  import type { TreeSelectProps } from './interface';
3
3
  import _TreeSelect from './tree-select.vue';
4
- export type { ChangeHandler as TreeSelectChangeHandler, ClearHandler as TreeSelectClearHandler, FallbackOption as TreeSelectFallbackOption, FilterTreeNode as TreeSelectFilterTreeNode, LabelValue, PopupVisibleChangeHandler as TreeSelectPopupVisibleChangeHandler, SearchHandler as TreeSelectSearchHandler, TreeSelectProps, TreeSelectValue, } from './interface';
4
+ export type { ChangeHandler as TreeSelectChangeHandler, ClearHandler as TreeSelectClearHandler, FallbackOption as TreeSelectFallbackOption, FilterTreeNode as TreeSelectFilterTreeNode, LabelValue, PopupVisibleChangeHandler as TreeSelectPopupVisibleChangeHandler, SearchHandler as TreeSelectSearchHandler, TreeSelectProps, TreeSelectTriggerSlotProps, TreeSelectValue, } from './interface';
5
5
  declare const TreeSelect: SFCWithInstall<typeof _TreeSelect>;
6
6
  export type TreeSelectInstance = InstanceType<typeof _TreeSelect>;
7
7
  export type TreeSelectLoadMore = NonNullable<TreeSelectProps['loadMore']>;
@@ -9,6 +9,16 @@ export interface LabelValue {
9
9
  label: string | number;
10
10
  }
11
11
  export type TreeSelectValue = TreeNodeKey | TreeNodeKey[] | LabelValue | LabelValue[];
12
+ export interface TreeSelectTriggerSlotProps {
13
+ value: TreeSelectValue | undefined;
14
+ displayValue: string | string[];
15
+ inputValue: string;
16
+ selectedOptions: TreeNodeData[];
17
+ popupVisible: boolean;
18
+ disabled: boolean;
19
+ loading: boolean;
20
+ multiple: boolean;
21
+ }
12
22
  export type FilterTreeNode = (searchKey: string, nodeData: TreeNodeData) => boolean;
13
23
  export type FallbackOption = boolean | ((key: TreeNodeKey) => TreeNodeData | boolean);
14
24
  export type ChangeHandler = (selectedValue: TreeSelectValue | undefined) => void;
@@ -7,7 +7,16 @@ import { ScrollbarProps } from '../scrollbar';
7
7
  import { TreeFieldNames, TreeNodeData, TreeProps } from '../tree/interface';
8
8
  import { TriggerProps } from '../trigger';
9
9
  import { LabelValue, TreeSelectValue } from './interface';
10
- declare var __VLS_16: {}, __VLS_32: {}, __VLS_35: any, __VLS_38: {
10
+ declare var __VLS_16: {
11
+ value: TreeSelectValue | undefined;
12
+ displayValue: string | string[];
13
+ inputValue: string;
14
+ selectedOptions: TreeNodeData[];
15
+ popupVisible: boolean;
16
+ disabled: boolean;
17
+ loading: boolean;
18
+ multiple: boolean;
19
+ }, __VLS_32: {}, __VLS_35: any, __VLS_38: {
11
20
  data: any;
12
21
  }, __VLS_41: {}, __VLS_43: {}, __VLS_50: {}, __VLS_64: {};
13
22
  type __VLS_Slots = {} & {
@@ -504,6 +504,16 @@ var tree_select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
504
504
  return _objectSpread2(_objectSpread2({}, i), {}, { option: node === null || node === void 0 ? void 0 : node.treeNodeData });
505
505
  });
506
506
  });
507
+ const triggerValue = computed(() => {
508
+ const values = labelInValue.value ? selectedValue.value : selectedKeys.value;
509
+ return isMultiple.value ? values : values === null || values === void 0 ? void 0 : values[0];
510
+ });
511
+ const triggerDisplayValue = computed(() => {
512
+ var _labels$;
513
+ const labels = selectViewValue.value.map((item) => String(item.label));
514
+ return isMultiple.value ? labels : (_labels$ = labels[0]) !== null && _labels$ !== void 0 ? _labels$ : "";
515
+ });
516
+ const triggerSelectedOptions = computed(() => selectViewValue.value.map((item) => item.option).filter((option) => Boolean(option)));
507
517
  const setSelectedKeys = (newVal) => {
508
518
  setLocalSelectedKeys(newVal);
509
519
  nextTick(() => {
@@ -692,7 +702,16 @@ var tree_select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
692
702
  class: normalizeClass(`${unref(prefixCls)}-footer`)
693
703
  }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("", true)
694
704
  ], 6)]),
695
- default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {}, () => [createVNode(unref(select_view_default), mergeProps({
705
+ default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {
706
+ value: triggerValue.value,
707
+ displayValue: triggerDisplayValue.value,
708
+ inputValue: computedInputValue.value,
709
+ selectedOptions: triggerSelectedOptions.value,
710
+ popupVisible: unref(panelVisible),
711
+ disabled: unref(mergedDisabled),
712
+ loading: __props.loading,
713
+ multiple: isMultiple.value
714
+ }, () => [createVNode(unref(select_view_default), mergeProps({
696
715
  ref_key: "refSelectView",
697
716
  ref: refSelectView,
698
717
  "model-value": selectViewValue.value,
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "@sdata/web-vue",
5
- "version": "3.19.0",
5
+ "version": "3.20.0",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdata/web-vue",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "SD Design Vue: A Vue.js 3 UI Library",
5
5
  "keywords": [
6
6
  "sd",