Skip to content

Commit 276418b

Browse files
uyarnWesley-0808morningbaobetavsmyronliu347
authored
chore: release 1.10.6-naruto (#3417)
* feat(icons): new version (#3392) * feat(Dialog&Drawer): support beforeOpen And beforeClose API (#3393) chore: docs * chore: replace version request (#3394) * fix(Transfer): 修复设置pageSizeOptions时切换pageSize无法生效得问题 (#3374) * docs(Transfer): update desc (#3398) * fix(input-number): limiting the input of numbers exceeding the range does not trigger the blur event (#3399) * fix(Space): fixed template white space bugs (#3401) * fix(TimePicker): fixed only support hh:mm format * fix(TimePicker): disabled position only is start * fix(Upload): fixed vue error on uploadPastedFiles is false * docs: add readonly in api * fix: fixed template white space bugs * chore: update snap * chore(deps): bump tdesign-icons-vue from 0.2.5 to 0.3.2 (#3408) --- updated-dependencies: - dependency-name: tdesign-icons-vue dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(Select): 增加option cache,避免搜索过滤时optionsList为空导致选中选项显示异常 (#3410) * feat(Form): form rule support multi trigger (#3323) * fix(TimePicker): fixed only support hh:mm format * fix(TimePicker): disabled position only is start * fix(Upload): fixed vue error on uploadPastedFiles is false * docs: add readonly in api * feat(Form): rule support array trigger * fix(transfer): fix tree disabled and drag sort bug (#3412) * fix(transfer): fix tree disabled and drag sort bug * chore: revert demo change * fix(Table): fixed treeNodeCol not update on columns change (#3400) * fix(TimePicker): fixed only support hh:mm format * fix(TimePicker): disabled position only is start * fix(Upload): fixed vue error on uploadPastedFiles is false * docs: add readonly in api * fix(Table): fixed treeNodeCol not update on columns change * fix(Slider): fix controlled usage (#3414) * fix(Slider): fix controlled usage * fix(Slider): fix default usage * chore: remove incorrect unit test * chore: add unit test * chore: add unit test * feat(tree): support scroll instance function and key param (#3415) * feat(DatePicker): support multiple API (#3407) * fix(datepicker): 增加多选模式 fix #3341 * refactor(datepicker): 修复props类型告警 * chore: update snapshot and fix type * chore: update snapshot and fix type * chore: fix render * chore: fix type * chore: fix * chore: fix * chore: update snapshot and fix type --------- Co-authored-by: Uyarn <[email protected]> * chore: release 1.10.6 (#3416) * Update package.json * chore: changelog's changes * chore: fix info --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore: release 1.10.6-naruto * chore: release 1.10.6-naruto --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Wesley <[email protected]> Co-authored-by: MorningUei <[email protected]> Co-authored-by: betavs <[email protected]> Co-authored-by: myron <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hkaikai <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 5174e54 commit 276418b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+776
-290
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,34 @@ toc: false
55
docClass: timeline
66
---
77

8+
## 🌈 1.10.6 `2024-12-05`
9+
10+
### 🚀 Features
11+
12+
- `Icon`: 图标库发布 `0.3.0`版本,新增 907 个新图标;命名优化`blockchain` 重命名改为`transform-1`,`gesture-pray-1`重命名为`gesture-open`,`gesture-ranslation-1`重命名为`wave-bye`, `gesture-up-1`重命名为`gesture-typing`,`gesture-up-2`重命名为`gesture-right-slip`,`logo-wechat`重命名为`logo-wechat-stroke-filled`,移除`tree-list``logo-adobe-photoshop-1` 等错误图标 @uyarn ([#3392](https://github.com/Tencent/tdesign-vue/pull/3392))
13+
- `DatePicker`: 新增 `multiple` API, 用于支持多选日期的场景 @hkaikai ([#3407](https://github.com/Tencent/tdesign-vue/pull/3407))
14+
- `Dialog`: 新增 `beforeOpen``beforeClose` API @Wesley-0808 ([#3393](https://github.com/Tencent/tdesign-vue/pull/3393))
15+
- `Drawer`: 新增 `beforeOpen``beforeClose` API @Wesley-0808 ([#3393](https://github.com/Tencent/tdesign-vue/pull/3393))
16+
- `Form`: 表单组件同时支持 `change``blur` 的校验触发方式 @myronliu347 ([#3323](https://github.com/Tencent/tdesign-vue/pull/3323))
17+
- `Tree`: 支持通过`scrollTo`方法滚动到指定节点,`scrollToElement`方法仍保留 @uyarn ([#3415](https://github.com/Tencent/tdesign-vue/pull/3415))
18+
- `Tree`: 支持`scrollTo`方法通过唯一`key`滚动到指定节点,减少业务计算`index`的需求,具体方法参考示例 @uyarn ([#3415](https://github.com/Tencent/tdesign-vue/pull/3415))
19+
20+
### 🐞 Bug Fixes
21+
22+
- `Transfer`: 修复设置 pageSizeOptions 时切换 pageSize 无法生效得问题 @morningbao ([#3374](https://github.com/Tencent/tdesign-vue/pull/3374))
23+
- `InputNumber`: 限制输入超过范围外的数字未触发 `blur` 事件 @betavs ([#3399](https://github.com/Tencent/tdesign-vue/pull/3399))
24+
- `Select`: 修复搜索过滤选项列表时选中值显示错误问题 @morningbao ([#3410](https://github.com/Tencent/tdesign-vue/pull/3410))
25+
- `Transfer`: 修复树形组件选项禁用在全选下仍可选中的缺陷 @uyarn ([#3412](https://github.com/Tencent/tdesign-vue/pull/3412))
26+
- `Transer`: 修复拖拽排序向后移动的功能异常 @uyarn ([#3412](https://github.com/Tencent/tdesign-vue/pull/3412))
27+
- `Table`: 修复树形表格列改变时渲染出错的问题 @myronliu347 ([#3400](https://github.com/Tencent/tdesign-vue/pull/3400))
28+
- `Slider`: 修复`Slider`组件不支持受控用法的问题 @uyarn ([#3414](https://github.com/Tencent/tdesign-vue/pull/3414))
29+
30+
### 📝 Documentation
31+
32+
- `Icon`: 优化图标检索功能,支持中英文搜索图标 @uyarn ([#3392](https://github.com/Tencent/tdesign-vue/pull/3392))
33+
34+
35+
836
## 🌈 1.10.5 `2024-11-08`
937
### 🚀 Features
1038
- `Switch`: 新增 `before-change` API, 用于需要发起异步请求的场景 @centuryPark ([#3386](https://github.com/Tencent/tdesign-vue/pull/3386))

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tdesign-vue",
33
"purename": "tdesign",
4-
"version": "1.10.5-naruto",
4+
"version": "1.10.6-naruto",
55
"description": "tdesign-vue",
66
"title": "tdesign-vue",
77
"keywords": [
@@ -97,7 +97,7 @@
9797
"mitt": "^3.0.0",
9898
"raf": "^3.4.1",
9999
"sortablejs": "^1.15.0",
100-
"tdesign-icons-vue": "^0.2.4",
100+
"tdesign-icons-vue": "^0.3.2",
101101
"tinycolor2": "^1.4.2",
102102
"validator": "^13.5.1"
103103
},
@@ -178,7 +178,7 @@
178178
"rollup-plugin-styles": "^4.0.0",
179179
"rollup-plugin-terser": "~7.0.2",
180180
"rollup-plugin-vue": "^5.1.9",
181-
"tdesign-icons-view": "^0.2.0",
181+
"tdesign-icons-view": "^0.3.0",
182182
"tdesign-publish-cli": "^0.0.12",
183183
"tdesign-site-components": "^0.13.0",
184184
"tdesign-theme-generator": "^1.0.5",

site/src/components/page.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const docsMap = {
2222
en: enDocs,
2323
};
2424
25-
const registryUrl = 'https://mirrors.tencent.com/npm/tdesign-vue';
25+
const registryUrl = 'https://service-edbzjd6y-1257786608.hk.apigw.tencentcs.com/release/npm/versions/tdesign-vue';
2626
2727
export default {
2828
data() {

src/_common

Submodule _common updated 90 files

src/avatar/type.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { ImageProps } from '../image';
88
import { PopupProps } from '../popup';
9-
import { TNode } from '../common';
9+
import { TNode, ShapeEnum } from '../common';
1010

1111
export interface TdAvatarProps {
1212
/**
@@ -81,6 +81,4 @@ export interface TdAvatarGroupProps {
8181
size?: string;
8282
}
8383

84-
export type ShapeEnum = 'circle' | 'round';
85-
8684
export type CascadingValue = 'left-up' | 'right-up';

src/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export type TreeOptionData<T = string | number> = {
5858

5959
export type SizeEnum = 'small' | 'medium' | 'large';
6060

61+
export type ShapeEnum = 'circle' | 'round';
62+
6163
export type HorizontalAlignEnum = 'left' | 'center' | 'right';
6264

6365
export type VerticalAlignEnum = 'top' | 'middle' | 'bottom';

src/date-picker/DatePicker.tsx

Lines changed: 73 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,30 @@ import dayjs from 'dayjs';
33
import { CalendarIcon as TdCalendarIcon } from 'tdesign-icons-vue';
44
import isDate from 'lodash/isDate';
55

6-
import { usePrefixClass } from '../hooks/useConfig';
6+
import { usePrefixClass, useConfig } from '../hooks/useConfig';
77
import { useGlobalIcon } from '../hooks/useGlobalIcon';
88
import useSingle from './hooks/useSingle';
99
import {
1010
parseToDayjs, getDefaultFormat, formatTime, formatDate,
1111
} from '../_common/js/date-picker/format';
1212
import {
13-
subtractMonth, addMonth, extractTimeObj, covertToDate,
13+
subtractMonth, addMonth, extractTimeObj, covertToDate, isSame,
1414
} from '../_common/js/date-picker/utils';
15-
import type { DateValue } from './type';
15+
import type { DateMultipleValue, DateValue } from './type';
1616
import props from './props';
1717

1818
import TSelectInput from '../select-input';
1919
import TSinglePanel from './panel/SinglePanel';
2020
import useFormDisabled from '../hooks/useFormDisabled';
21+
import type { TagInputRemoveContext } from '../tag-input';
2122

2223
export default defineComponent({
2324
name: 'TDatePicker',
2425
props,
2526
setup(props, { emit }) {
2627
const COMPONENT_NAME = usePrefixClass('date-picker');
2728
const { CalendarIcon } = useGlobalIcon({ CalendarIcon: TdCalendarIcon });
29+
const { global } = useConfig('datePicker');
2830

2931
const {
3032
inputValue,
@@ -45,13 +47,14 @@ export default defineComponent({
4547
mode: props.mode,
4648
format: props.format,
4749
valueType: props.valueType,
48-
enableTimePicker: props.enableTimePicker,
50+
enableTimePicker: props.multiple ? false : props.enableTimePicker,
4951
}));
5052

5153
const { formDisabled } = useFormDisabled();
5254
const isDisabled = computed(() => formDisabled.value || props.disabled);
5355

5456
watch(popupVisible, (visible) => {
57+
if (props.multiple) return;
5558
// Date valueType、week mode 、quarter mode nad empty string don't need to be parsed
5659
const dateValue = value.value && !isDate(value.value) && !['week', 'quarter'].includes(props.mode)
5760
? covertToDate(value.value as string, formatRef.value?.valueType)
@@ -66,8 +69,8 @@ export default defineComponent({
6669

6770
// 面板展开重置数据
6871
if (visible) {
69-
year.value = parseToDayjs(value.value, formatRef.value.format).year();
70-
month.value = parseToDayjs(value.value, formatRef.value.format).month();
72+
year.value = parseToDayjs(value.value as DateValue, formatRef.value.format).year();
73+
month.value = parseToDayjs(value.value as DateValue, formatRef.value.format).month();
7174
time.value = formatTime(value.value, formatRef.value.format, formatRef.value.timeFormat, props.defaultTime);
7275
} else {
7376
isHoverCell.value = false;
@@ -76,6 +79,7 @@ export default defineComponent({
7679

7780
// 日期 hover
7881
function onCellMouseEnter(date: Date) {
82+
if (props.multiple) return;
7983
isHoverCell.value = true;
8084
inputValue.value = formatDate(date, {
8185
format: formatRef.value.format,
@@ -84,6 +88,7 @@ export default defineComponent({
8488

8589
// 日期 leave
8690
function onCellMouseLeave() {
91+
if (props.multiple) return;
8792
isHoverCell.value = false;
8893
inputValue.value = formatDate(cacheValue.value, {
8994
format: formatRef.value.format,
@@ -103,6 +108,14 @@ export default defineComponent({
103108
format: formatRef.value.format,
104109
});
105110
} else {
111+
if (props.multiple) {
112+
const newDate = processDate(date);
113+
onChange?.(newDate, {
114+
dayjsValue: parseToDayjs(date, formatRef.value.format),
115+
trigger: 'pick',
116+
});
117+
return;
118+
}
106119
onChange?.(
107120
formatDate(date, {
108121
format: formatRef.value.format,
@@ -228,21 +241,56 @@ export default defineComponent({
228241
month.value = nextMonth;
229242
}
230243

244+
function processDate(date: Date) {
245+
const val = value.value as DateMultipleValue;
246+
const isSameDate = val.some((val) => isSame(dayjs(val).toDate(), date));
247+
let currentDate: DateMultipleValue;
248+
249+
if (!isSameDate) {
250+
currentDate = val.concat(
251+
formatDate(date, { format: formatRef.value.format, targetFormat: formatRef.value.valueType }),
252+
);
253+
} else {
254+
currentDate = val.filter(
255+
(val) => formatDate(val, { format: formatRef.value.format, targetFormat: formatRef.value.valueType })
256+
!== formatDate(date, { format: formatRef.value.format, targetFormat: formatRef.value.valueType }),
257+
);
258+
}
259+
260+
return currentDate.sort((a, b) => dayjs(a).valueOf() - dayjs(b).valueOf());
261+
}
262+
263+
const onTagRemoveClick = (ctx: TagInputRemoveContext) => {
264+
const removeDate = dayjs(ctx.item).toDate();
265+
const newDate = processDate(removeDate);
266+
onChange?.(newDate, {
267+
dayjsValue: parseToDayjs(removeDate, formatRef.value.format),
268+
trigger: 'tag-remove',
269+
});
270+
};
271+
272+
const onTagClearClick = ({ e }: { e: MouseEvent }) => {
273+
e.stopPropagation();
274+
popupVisible.value = false;
275+
onChange?.([], { dayjsValue: dayjs(), trigger: 'clear' });
276+
};
277+
231278
const panelProps: any = computed(() => ({
232-
value: cacheValue.value as string,
279+
value: cacheValue.value,
233280
year: year.value,
234281
month: month.value,
235282
format: formatRef.value.format,
236283
mode: props.mode,
237284
presets: props.presets,
238-
time: time.value as string,
285+
time: props.multiple ? '' : time.value,
239286
disableDate: props.disableDate,
240287
disableTime: props.disableTime,
241288
firstDayOfWeek: props.firstDayOfWeek,
242289
timePickerProps: props.timePickerProps,
243-
enableTimePicker: props.enableTimePicker,
290+
enableTimePicker: props.multiple ? false : props.enableTimePicker,
244291
presetsPlacement: props.presetsPlacement,
245292
popupVisible: popupVisible.value,
293+
multiple: props.multiple,
246294
onCellClick,
247295
onCellMouseEnter,
248296
onCellMouseLeave,
@@ -263,7 +311,10 @@ export default defineComponent({
263311
popupVisible,
264312
panelProps,
265313
isDisabled,
314+
onTagRemoveClick,
315+
onTagClearClick,
266316
CalendarIcon,
317+
global,
267318
};
268319
},
269320
render() {
@@ -275,6 +326,8 @@ export default defineComponent({
275326
popupVisible,
276327
panelProps,
277328
isDisabled,
329+
onTagRemoveClick,
330+
onTagClearClick,
278331
CalendarIcon,
279332
} = this;
280333

@@ -292,15 +345,25 @@ export default defineComponent({
292345
disabled={isDisabled}
293346
readonly={this.readonly}
294347
value={inputValue}
348+
inputValue={this.multiple ? '' : (inputValue as string)}
295349
label={this.label}
296350
status={this.status}
297351
tips={this.tips}
298352
popupProps={datePickerPopupProps}
299-
inputProps={{ suffixIcon: renderSuffixIcon(), ...datePickerInputProps }}
353+
inputProps={{ ...datePickerInputProps }}
300354
popupVisible={popupVisible}
301355
clearable={this.clearable}
302356
allowInput={this.allowInput && !this.readonly}
303357
panel={() => <TSinglePanel {...{ props: panelProps }} />}
358+
multiple={this.multiple}
359+
placeholder={
360+
this.placeholder ?? (this.global.placeholder as { [key in typeof this.mode]: string })[this.mode]
361+
}
362+
suffixIcon={renderSuffixIcon()}
363+
tagInputProps={{
364+
onRemove: onTagRemoveClick,
365+
}}
366+
onClear={onTagClearClick}
304367
/>
305368
</div>
306369
);

src/date-picker/DatePickerPanel.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default defineComponent({
6464
}
6565

6666
// 头部快速切换
67-
function onJumperClick({ trigger }: { trigger: string }) {
67+
function onJumperClick({ trigger }: { trigger: 'prev' | 'next' | 'current' }) {
6868
const triggerMap = {
6969
prev: 'arrow-previous',
7070
next: 'arrow-next',
@@ -95,24 +95,24 @@ export default defineComponent({
9595
if (year.value !== nextYear) {
9696
props.onYearChange?.({
9797
year: nextYear,
98-
date: dayjs(value.value).toDate(),
98+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
9999
trigger: trigger === 'current' ? 'today' : (`year-${triggerMap[trigger]}` as DatePickerYearChangeTrigger),
100100
});
101101
emit('year-change', {
102102
year: nextYear,
103-
date: dayjs(value.value).toDate(),
103+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
104104
trigger: trigger === 'current' ? 'today' : (`year-${triggerMap[trigger]}` as DatePickerYearChangeTrigger),
105105
});
106106
}
107107
if (month.value !== nextMonth) {
108108
props.onMonthChange?.({
109109
month: nextMonth,
110-
date: dayjs(value.value).toDate(),
110+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
111111
trigger: trigger === 'current' ? 'today' : (`month-${triggerMap[trigger]}` as DatePickerMonthChangeTrigger),
112112
});
113113
emit('month-change', {
114114
month: nextMonth,
115-
date: dayjs(value.value).toDate(),
115+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
116116
trigger: trigger === 'current' ? 'today' : (`month-${triggerMap[trigger]}` as DatePickerMonthChangeTrigger),
117117
});
118118
}
@@ -142,12 +142,12 @@ export default defineComponent({
142142

143143
props.onTimeChange?.({
144144
time: val,
145-
date: parseToDayjs(value.value, formatRef.value.format).toDate(),
145+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
146146
trigger: 'time-hour',
147147
});
148148
emit('time-change', {
149149
time: val,
150-
date: parseToDayjs(value.value, formatRef.value.format).toDate(),
150+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
151151
trigger: 'time-hour',
152152
});
153153
}
@@ -183,12 +183,12 @@ export default defineComponent({
183183

184184
props.onYearChange?.({
185185
year: year.value,
186-
date: parseToDayjs(value.value, formatRef.value.format).toDate(),
186+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
187187
trigger: 'year-select',
188188
});
189189
emit('year-change', {
190190
year: year.value,
191-
date: parseToDayjs(value.value, formatRef.value.format).toDate(),
191+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
192192
trigger: 'year-select',
193193
});
194194
}
@@ -198,12 +198,12 @@ export default defineComponent({
198198

199199
props.onMonthChange?.({
200200
month: month.value,
201-
date: parseToDayjs(value.value, formatRef.value.format).toDate(),
201+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
202202
trigger: 'month-select',
203203
});
204204
emit('month-change', {
205205
month: month.value,
206-
date: parseToDayjs(value.value, formatRef.value.format).toDate(),
206+
date: parseToDayjs(value.value as DateValue, formatRef.value.format).toDate(),
207207
trigger: 'month-select',
208208
});
209209
}

src/date-picker/DateRangePickerPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import TRangePanel from './panel/RangePanel';
1717
import useRangeValue from './hooks/useRangeValue';
1818
import { formatDate, getDefaultFormat, parseToDayjs } from '../_common/js/date-picker/format';
1919
import { subtractMonth, addMonth, extractTimeObj } from '../_common/js/date-picker/utils';
20+
import type { TdDateRangePickerProps } from './type';
2021
import { dateCorrection } from './utils';
2122

2223
export default defineComponent({
@@ -37,7 +38,7 @@ export default defineComponent({
3738
panelPreselection: dateRangePickerProps.panelPreselection,
3839
...dateRangePickerPanelProps,
3940
},
40-
setup(props: TdDateRangePickerPanelProps, { emit, attrs }) {
41+
setup(props: TdDateRangePickerPanelProps & { disableTime: TdDateRangePickerProps['disableTime'] }, { emit, attrs }) {
4142
const {
4243
value, year, month, time, cacheValue, isFirstValueSelected, onChange,
4344
} = useRangeValue(props);

0 commit comments

Comments
 (0)