Skip to content

Commit

Permalink
chore: release 1.10.7-naruto (#3426)
Browse files Browse the repository at this point in the history
* fix(colorPicker): fix colorMode i18n (#3403)

* fix(colorPicker): fix colorMode i18n

* feat: use common constants

* chore: update common

* chore: update common

* chore: update common

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Uyarn <uyarnchen@gmail.com>

* fix(table): resolve props.filterIcon not work (#3422)

* fix(table): resolve props.filterIcon not work

* chore: fix

* fix(Dialog): fix dialog props duplicate (#3423)

* fix(Dialog): fix dialog props duplicate

* fix(Dialog): fix dialog props duplicate

* chore: release 1.10.7 (#3425)

* chore: release 1.10.7

* chore: changelog's changes

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: release 1.10.7-naruto

---------

Co-authored-by: liweijie0812 <674416404@qq.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 276418b commit 2e62d7c
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 37 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ toc: false
docClass: timeline
---

## 🌈 1.10.7 `2024-12-16`
### 🐞 Bug Fixes
- `ColorPicker`: 修复颜色选择器的国际化配置问题 @liweijie0812 ([#3403](https://github.com/Tencent/tdesign-vue/pull/3403))
- `Dialog`: 修复`1.10.6`版本中`Dialog`组件 `props` 重复导致的异常问题 @uyarn ([#3423](https://github.com/Tencent/tdesign-vue/pull/3423))
- `Table`: 修复 `filterIcon` 不生效的问题 @liweijie0812 ([#3422](https://github.com/Tencent/tdesign-vue/pull/3422))




## 🌈 1.10.6 `2024-12-05`

### 🚀 Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tdesign-vue",
"purename": "tdesign",
"version": "1.10.6-naruto",
"version": "1.10.7-naruto",
"description": "tdesign-vue",
"title": "tdesign-vue",
"keywords": [
Expand Down
6 changes: 0 additions & 6 deletions src/color-picker/const.ts

This file was deleted.

5 changes: 2 additions & 3 deletions src/color-picker/panel/format/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import upperCase from 'lodash/upperCase';
import { TdColorHandler } from '../../../color-picker/interfaces';
import { TdColorPickerProps } from '../../type';
import props from '../../props';
import { FORMATS } from '../../const';
import { FORMATS } from '../../../_common/js/color-picker/constants';
import { Color } from '../../utils';
import { Select as TSelect, Option as TOption } from '../../../select';
import { Input as TInput } from '../../../input';
Expand Down Expand Up @@ -60,7 +60,6 @@ export default defineComponent({
};
},
render(h) {
const formats: TdColorPickerProps['format'][] = [...FORMATS];
const { baseClassName, handleModeChange } = this;
const newProps = {
...this.$props,
Expand All @@ -84,7 +83,7 @@ export default defineComponent({
onChange={handleModeChange}
disabled={this.disabled}
>
{formats.map((item) => (
{FORMATS.map((item) => (
<t-option key={item} value={item} label={upperCase(item)} style={{ fontSize: '12px' }} />
))}
</t-select>
Expand Down
36 changes: 18 additions & 18 deletions src/color-picker/panel/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import {
defineComponent, PropType, ref, watch,
} from 'vue';
import props from '../props';
import { COLOR_MODES } from '../const';
import { COLOR_MODES } from '../../_common/js/color-picker/constants';
import { RadioGroup as TRadioGroup, RadioButton as TRadioButton } from '../../radio';
import { TdColorHandler, TdColorModes } from '../interfaces';
import { useBaseClassName } from '../hooks';
import { useConfig } from '../../hooks';

export default defineComponent({
name: 'PanelHeader',
Expand All @@ -28,6 +29,7 @@ export default defineComponent({
},
},
setup(props) {
const { globalConfig } = useConfig('colorPicker');
const baseClassName = useBaseClassName();
const modeValue = ref(props.mode);
watch(
Expand All @@ -37,8 +39,10 @@ export default defineComponent({
},
);
return {
globalConfig,
baseClassName,
modeValue,
COLOR_MODES,
};
},
render() {
Expand All @@ -49,23 +53,19 @@ export default defineComponent({
return (
<div class={`${baseClassName}__head`}>
<div class={`${baseClassName}__mode`}>
{this.colorModes?.length === 1 ? (
COLOR_MODES[this.colorModes[0]]
) : (
<TRadioGroup
variant="default-filled"
size="small"
disabled={this.disabled}
v-model={this.modeValue}
onChange={this.handleModeChange}
>
{Object.keys(COLOR_MODES).map((key) => (
<TRadioButton key={key} value={key}>
{COLOR_MODES[key]}
</TRadioButton>
))}
</TRadioGroup>
)}
<TRadioGroup
variant="default-filled"
size="small"
disabled={this.disabled}
v-model={this.modeValue}
onChange={this.handleModeChange}
>
{this.colorModes.map((key) => (
<TRadioButton key={key} value={key}>
{Reflect.get(this.globalConfig, COLOR_MODES[key as keyof typeof COLOR_MODES])}
</TRadioButton>
))}
</TRadioGroup>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/color-picker/panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
DEFAULT_LINEAR_GRADIENT,
TD_COLOR_USED_COLORS_MAX_SIZE,
DEFAULT_SYSTEM_SWATCH_COLORS,
} from '../const';
} from '../../_common/js/color-picker/constants';
import PanelHeader from './header';
import LinearGradient from './linear-gradient';
import SaturationPanel from './saturation';
Expand Down
2 changes: 1 addition & 1 deletion src/color-picker/panel/linear-gradient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
computed, defineComponent, onBeforeUnmount, onMounted, reactive, ref, watch,
} from 'vue';
import cloneDeep from 'lodash/cloneDeep';
import { GRADIENT_SLIDER_DEFAULT_WIDTH } from '../const';
import { GRADIENT_SLIDER_DEFAULT_WIDTH } from '../../_common/js/color-picker/constants';
import { genGradientPoint, gradientColors2string, GradientColorPoint } from '../utils';
import { InputNumber as TInputNumber } from '../../input-number';
import { useBaseClassName } from '../hooks';
Expand Down
5 changes: 4 additions & 1 deletion src/color-picker/panel/saturation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import {
computed, defineComponent, nextTick, onBeforeUnmount, onMounted, reactive, ref,
} from 'vue';
import { SATURATION_PANEL_DEFAULT_HEIGHT, SATURATION_PANEL_DEFAULT_WIDTH } from '../const';
import {
SATURATION_PANEL_DEFAULT_HEIGHT,
SATURATION_PANEL_DEFAULT_WIDTH,
} from '../../_common/js/color-picker/constants';
import { Select as TSelect, Option as TOption } from '../../select';
import { Draggable, Coordinate } from '../utils';
import { useBaseClassName } from '../hooks';
Expand Down
2 changes: 1 addition & 1 deletion src/color-picker/panel/slider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
computed, defineComponent, onBeforeUnmount, onMounted, PropType, reactive, ref,
} from 'vue';
import { SLIDER_DEFAULT_WIDTH } from '../const';
import { SLIDER_DEFAULT_WIDTH } from '../../_common/js/color-picker/constants';
import { Select as TSelect, Option as TOption } from '../../select';
import { Draggable, Coordinate } from '../utils';
import { useBaseClassName } from '../hooks';
Expand Down
6 changes: 3 additions & 3 deletions src/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ export default mixins(ActionMixin, getConfigReceiverMixins<Vue, DialogConfig>('d
}
return topStyle;
},
dialogStyle(): Styles {
return !this.isFullScreen ? { width: getCSSValue(this.width) } : {}; // width全屏模式不生效;
computedDialogStyle(): Styles {
return !this.isFullScreen ? { width: getCSSValue(this.width), ...this.dialogStyle } : { ...this.dialogStyle }; // width全屏模式不生效;
},
},

Expand Down Expand Up @@ -477,7 +477,7 @@ export default mixins(ActionMixin, getConfigReceiverMixins<Vue, DialogConfig>('d
// 非模态形态下draggable为true才允许拖拽
<div class={this.wrapClass}>
<div class={this.positionClass} style={this.positionStyle} onClick={this.overlayAction} ref="dialogPosition">
<div key="dialog" ref="dialog" class={this.dialogClass} style={this.dialogStyle}>
<div key="dialog" ref="dialog" class={this.dialogClass} style={this.computedDialogStyle}>
<div class={headerClassName} onMousedown={this.onStopDown}>
<div class={`${this.componentName}__header-content`}>
{this.getIcon()}
Expand Down
50 changes: 50 additions & 0 deletions src/table/__tests__/base.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -563,5 +563,55 @@ TABLES.forEach((TTable) => {
expect(wrapper.find('.t-table__top-content').text()).toBe(topContentText);
});
});
describe(':props.filterIcon', () => {
it('props.filterIcon could be function', async () => {
const filterIconText = () => '筛';
const filterColumns = SIMPLE_COLUMNS.map((item) => ({
...item,
filter: { type: 'single', list: [{ label: 1, value: 2 }] },
}));

const wrapper = mount({
render() {
return <TTable filterIcon={filterIconText} rowKey="index" data={data} columns={filterColumns}></TTable>;
},
});

if (TTable.name === 'TBaseTable') {
expect(wrapper.find('.t-table__filter-icon').exists()).toBeFalsy();
} else {
expect(wrapper.find('.t-table__filter-icon').exists()).toBeTruthy();
expect(wrapper.find('.t-table__filter-icon').text()).toBe(filterIconText());
}
});

it('slots.filter-icon works fine', () => {
const filterIconText = (rowKey) => `筛${rowKey}`;
const filterColumns = SIMPLE_COLUMNS.map((item) => ({
...item,
filter: { type: 'single', list: [{ label: 1, value: 2 }] },
}));
const wrapper = mount({
render() {
return (
<TTable
scopedSlots={{ filterIcon: (col, colIndex) => filterIconText(col.col.colKey) }}
rowKey="index"
data={data}
columns={filterColumns}
></TTable>
);
},
});
if (TTable.name === 'TBaseTable') {
expect(wrapper.find('.t-table__filter-icon').exists()).toBeFalsy();
} else {
expect(wrapper.find('.t-table__filter-icon').exists()).toBeTruthy();
SIMPLE_COLUMNS.forEach((item, index) => {
expect(wrapper.findAll('.t-table__filter-icon').at(index).text()).toBe(filterIconText(item.colKey));
});
}
});
});
});
});
4 changes: 3 additions & 1 deletion src/table/filter-controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Input from '../input';
import TButton from '../button';
import { useTNodeDefault } from '../hooks/tnode';
import { useGlobalIcon } from '../hooks/useGlobalIcon';
import { PrimaryTableCol, FilterValue } from './type';
import { PrimaryTableCol, FilterValue, TdPrimaryTableProps } from './type';
import { useConfig } from '../config-provider/useConfig';
import log from '../_common/js/log';
import { AttachNode } from '../common';
Expand Down Expand Up @@ -46,6 +46,7 @@ export interface TableFilterControllerProps {
primaryTableElement: HTMLDivElement;
popupProps: PopupProps;
attach?: AttachNode;
filterIcon?: TdPrimaryTableProps['filterIcon'];
}

export default defineComponent({
Expand All @@ -62,6 +63,7 @@ export default defineComponent({
popupProps: Object as PropType<TableFilterControllerProps['popupProps']>,
attach: [String, Function] as PropType<TableFilterControllerProps['attach']>,
locale: Object,
filterIcon: [Function] as PropType<TableFilterControllerProps['filterIcon']>,
},

setup(props, { emit }) {
Expand Down

0 comments on commit 2e62d7c

Please sign in to comment.