Skip to content

Commit

Permalink
fix: fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
kagol committed Nov 18, 2024
2 parents 85e6737 + 10c65c8 commit 0ec45b2
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 175 deletions.
7 changes: 6 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [1, 'always', 150]
}
}
4 changes: 2 additions & 2 deletions examples/sites/demos/apis/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
type: 'string',
defaultValue: '',
desc: {
'zh-CN': '设置只读态时的文本内容区,如果没有则会使用 modelVale 的值作为只读文本',
'zh-CN': '设置只读态时的文本内容区,如果没有则会使用 modelValue 的值作为只读文本',
'en-US':
"Sets the text content area in the read-only state, if not, modelVale's value is used as the read-only text"
},
Expand Down Expand Up @@ -416,7 +416,7 @@ export default {
type: "'medium' | 'small' | 'mini'",
defaultValue: '',
desc: {
'zh-CN': '输入框尺寸,只在 type!="textarea" 时有效',
'zh-CN': '输入框尺寸,只在 type"textarea" 时有效',
'en-US': 'Size of the text box. This parameter is valid only when type!="textarea". '
},
mode: ['pc', 'mobile-first'],
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/base-select/size.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ test('mini 尺寸', async ({ page }) => {

await expect(input).toHaveClass(/tiny-input-mini/)
await expect(tag.nth(0)).toHaveClass(/tiny-tag--mini tiny-tag--light/)
expect(height).toBeCloseTo(27, 1)
expect(height).toBeCloseTo(28, 1)
})
95 changes: 0 additions & 95 deletions packages/renderless/src/base-select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,51 +61,6 @@ export const showTip =
}
}

export const gridOnQueryChange =
({ props, vm, constants, state }) =>
(value) => {
const { multiple, valueField, filterMethod, filterable, remote, remoteMethod } = props

if (filterable && typeof filterMethod === 'function') {
const table = vm.$refs.selectGrid.$refs.tinyTable
const fullData = table.afterFullData

vm.$refs.selectGrid.scrollTo(null, 0)

table.afterFullData = filterMethod(value, fullData) || []

vm.$refs.selectGrid
.handleTableData(!value)
.then(() => state.selectEmitter.emit(constants.EVENT_NAME.updatePopper))

state.previousQuery = value
} else if (remote && typeof remoteMethod === 'function') {
state.previousQuery = value
remoteMethod(value, props.extraQueryParams).then((data) => {
// 多选时取远端数据与当前已选数据的并集
if (multiple) {
const selectedIds = state.selected.map((sel) => sel[valueField])
vm.$refs.selectGrid.clearSelection()
vm.$refs.selectGrid.setSelection(
data.filter((row) => ~selectedIds.indexOf(row[valueField])),
true
)
state.remoteData = data.filter((row) => !~selectedIds.indexOf(row[valueField])).concat(state.selected)
} else {
vm.$refs.selectGrid.clearRadioRow()
vm.$refs.selectGrid.setRadioRow(find(data, (item) => props.modelValue === item[props.valueField]))
state.remoteData = data
}

vm.$refs.selectGrid.$refs.tinyTable.lastScrollTop = 0
vm.$refs.selectGrid.loadData(data)
vm.$refs.selectGrid
.handleTableData(!value)
.then(() => state.selectEmitter.emit(constants.EVENT_NAME.updatePopper))
})
}
}

export const defaultOnQueryChange =
({ props, state, constants, api, nextTick }) =>
(value, isInput) => {
Expand Down Expand Up @@ -366,7 +321,6 @@ export const setSelected =
}
state.selected.length && (state.selectedLabel = '')

vm.$refs.selectTree && vm.$refs.selectTree.setCheckedNodes && vm.$refs.selectTree.setCheckedNodes(state.selected)
state.tips = state.selected.map((item) => (item.state ? item.state.currentLabel : item.currentLabel)).join(',')

setFilteredSelectCls(nextTick, state, props)
Expand Down Expand Up @@ -1247,10 +1201,6 @@ export const toVisible =
if (vm.$refs.input && vm.$refs.input.value === '' && state.selected.length === 0) {
state.currentPlaceholder = state.cachedPlaceHolder
}

if (vm.$refs.selectGrid) {
vm.$refs.selectGrid.clearScroll()
}
})

postOperOfToVisible({ props, state, constants })
Expand Down Expand Up @@ -1284,31 +1234,6 @@ export const toHide =
}
}
}

if (vm.$refs.selectGrid) {
let { fullData } = vm.$refs.selectGrid.getTableData()
if (multiple) {
const selectedIds = state.selected.map((sel) => sel[valueField])
vm.$refs.selectGrid.clearSelection()
vm.$refs.selectGrid.setSelection(
fullData.filter((row) => ~selectedIds.indexOf(row[valueField])),
true
)
} else {
vm.$refs.selectGrid.clearRadioRow()
vm.$refs.selectGrid.setRadioRow(find(fullData, (item) => props.modelValue === item[valueField]))
}

if (filterable && typeof props.filterMethod === 'function') {
vm.$refs.selectGrid.handleTableData(true)
} else if (
filterable &&
remote &&
(typeof props.remoteMethod === 'function' || typeof props.initQuery === 'function')
) {
vm.$refs.selectGrid.handleTableData()
}
}
}

export const watchVisible =
Expand Down Expand Up @@ -1426,23 +1351,6 @@ export const handleCopyClick =
parent.$el.removeChild(input)
}

export const getcheckedData =
({ props, state }) =>
() => {
const checkedKey = []

if (!Array.isArray(state.selected)) {
return props.modelValue ? [props.modelValue] : [state.selected[props.valueField]]
} else {
state.selected.length > 0 &&
state.selected.forEach((item) => {
checkedKey.push(item[props.valueField])
})

return checkedKey
}
}

export const debouncRquest = ({ api, state, props }) =>
debounce(props.delay, () => {
if (props.filterable && state.query !== state.selectedLabel) {
Expand Down Expand Up @@ -1668,14 +1576,12 @@ export const initQuery =
return new Promise((resolve) => {
initData.then((selected) => {
state.remoteData = selected
vm.$refs.selectGrid.loadData(selected)
resolve(selected)
})
})
}
selected = initData
state.remoteData = selected
vm.$refs.selectGrid.loadData(selected)
}

return Promise.resolve(selected)
Expand All @@ -1684,7 +1590,6 @@ export const initQuery =
export const mounted =
({ api, parent, state, props, vm, designConfig }) =>
() => {
state.defaultCheckedKeys = state.gridCheckedData
const parentEl = parent.$el
const inputEl = parentEl.querySelector('input[data-tag="tiny-input-inner"]')

Expand Down
8 changes: 0 additions & 8 deletions packages/renderless/src/base-select/vue.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
debouncRquest,
getChildValue,
getcheckedData,
calcOverFlow,
toggleCheckAll,
handleCopyClick,
Expand Down Expand Up @@ -55,7 +54,6 @@ import {
onMouseenterNative,
onMouseleaveNative,
onCopying,
gridOnQueryChange,
defaultOnQueryChange,
queryChange,
toVisible,
Expand Down Expand Up @@ -263,8 +261,6 @@ const initStateAdd = ({ computed, props, api, parent }) => {
initialInputHeight: 0,
currentPlaceholder: props.placeholder,
filteredOptionsCount: 0,
gridData: [],
treeData: [],
remoteData: [],
currentKey: props.modelValue,
updateId: '',
Expand All @@ -277,12 +273,10 @@ const initStateAdd = ({ computed, props, api, parent }) => {
isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
isDisabled: computed(() => props.disabled || (parent.form || {}).disabled),
isShowTagText: computed(() => api.computedShowTagText()),
gridCheckedData: computed(() => api.getcheckedData()),
searchSingleCopy: computed(() => props.allowCopy && !props.multiple && props.filterable),
childrenName: computed(() => 'children'),
tooltipContent: {},
isHidden: false,
defaultCheckedKeys: [],
optionIndexArr: [],
showCollapseTag: false,
exceedMaxVisibleRow: false, // 是否超出默认最大显示行数
Expand Down Expand Up @@ -323,7 +317,6 @@ const initApi = ({
showTip: showTip({ props, state, vm }),
onOptionDestroy: onOptionDestroy(state),
setSoftFocus: setSoftFocus({ vm, state }),
getcheckedData: getcheckedData({ props, state }),
resetInputWidth: resetInputWidth({ vm, state }),
resetHoverIndex: resetHoverIndex({ props, state }),
resetDatas: resetDatas({ props, state }),
Expand All @@ -344,7 +337,6 @@ const initApi = ({
onMouseenterNative: onMouseenterNative({ state }),
onMouseleaveNative: onMouseleaveNative({ state }),
onCopying: onCopying({ state, vm }),
gridOnQueryChange: gridOnQueryChange({ props, vm, constants, state }),
watchHoverIndex: watchHoverIndex({ state }),
computeOptimizeOpts: computeOptimizeOpts({ props, designConfig }),
computeCollapseTags: computeCollapseTags(props),
Expand Down
2 changes: 1 addition & 1 deletion packages/renderless/src/input/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export const resizeTextarea =

const { autosize, type } = parent

if (type !== 'textarea') {
if (type !== 'textarea' || !vm.$refs.textarea) {
return
}

Expand Down
10 changes: 7 additions & 3 deletions packages/theme-saas/src/picker/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@apply fill-color-icon-primary;
}
}

.@{input-prefix-cls}__icon-container {
align-items: center;
display: flex;
Expand Down Expand Up @@ -58,6 +59,11 @@
.@{input-prefix-cls}__icon {
@apply cursor-pointer;

.baseClearicon {
@apply mr-2;
@apply !transform-none;
}

&:not(.@{range-prefix-cls}__icon) {
@apply flex;
}
Expand Down Expand Up @@ -106,15 +112,13 @@
@apply absolute;
@apply ~'right-1.5';
@apply text-base;
@apply w-4;
width: 25px;
float: right;
@apply leading-8;
@apply mr-5;
@apply flex;
@apply justify-center;
@apply items-center;
@apply h-5;
@apply mr-6;
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/theme/src/base/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@

@import './reset.less';
@import './vars.less';
// @import './old-theme.less';
@import './transition.less';
6 changes: 3 additions & 3 deletions packages/theme/src/base/old-theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@
--tv-size-height-xs: 24px; // mini 尺寸
--tv-size-height-sm: 28px; // small 尺寸
--tv-size-height-md: 32px; // medium 尺寸 - 默认
--tv-size-height-lg: 40px; // large 尺寸
--tv-size-height-xl: 48px; // xLarge 尺寸
--tv-size-height-default:var(--tv-size-height-sm);
--tv-size-height-lg: 36px; // large 尺寸
--tv-size-height-xl: 42px; // xLarge 尺寸
--tv-size-height-default: var(--tv-size-height-sm);

/** 7.2 图标大小 width, height **/
--tv-icon-size: 14px;
Expand Down
35 changes: 15 additions & 20 deletions packages/theme/src/input/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
.placeholder(@color: var(--tv-Input-placeholder-text-color));

&.@{input-prefix-cls}__mask {
font-family: serif;
color: #999;
}
}
Expand Down Expand Up @@ -149,8 +148,8 @@
&__prefix,
&__suffix {
position: absolute;
top: var(--tv-Input-suffix-top);
transform: translateY(-50%);
top: 0;
height: 100%;
transition: all 0.3s;
text-align: center;
color: var(--tv-Input-border-color);
Expand Down Expand Up @@ -204,13 +203,15 @@
line-height: var(--tv-Input-height);
text-align: center;
transition: all 0.3s;
font-size: var(--tv-Input-icon-font-size);
fill: var(--tv-Input-icon-color);
width: var(--tv-Input-suffix-icon-width);
height: var(--tv-Input-suffix-icon-height);

&:hover {
fill: var(--tv-Input-icon-active-border-color);
svg {
fill: var(--tv-Input-icon-color);
width: var(--tv-Input-suffix-icon-width);
height: var(--tv-Input-suffix-icon-height);

&:hover {
fill: var(--tv-Input-icon-active-border-color);
}
}

&:after {
Expand All @@ -236,6 +237,7 @@
padding-right: var(--tv-Input-prefix-padding-right);
}

// 输入字数统计
&-word-limit &__inner {
padding-right: 56px;
padding-left: 8px;
Expand All @@ -248,33 +250,25 @@

&-medium {
.input-size(var(--tv-Input-medium-height));
.@{input-prefix-cls}__suffix {
top: var(--tv-Input-suffix-top-medium);
}
}

&-small {
.input-size(var(--tv-Input-small-height));
font-size: var(--tv-Input-small-font-size);

.@{input-prefix-cls}__inner {
font-size: var(--tv-Input-small-font-size);
}
.@{input-prefix-cls}__suffix {
top: var(--tv-Input-suffix-top-small);
}
}

&-mini {
.input-size(var(--tv-Input-mini-height));
font-size: var(--tv-Input-small-font-size);

.@{input-prefix-cls}__inner {
font-size: var(--tv-Input-small-font-size);
}
.@{input-prefix-cls}__suffix {
top: var(--tv-Input-suffix-top-mini);
}
}

// 只读模式
&.is-display-only {
.@{input-prefix-cls}-display-only {
position: relative;
Expand Down Expand Up @@ -323,6 +317,7 @@
}
}

// 下边框模式
&.tiny-input-underline {
.tiny-input__inner {
border-radius: 0;
Expand Down
Loading

0 comments on commit 0ec45b2

Please sign in to comment.