Skip to content

Commit

Permalink
chore(Mpx): compatible with Mpx framework (Tencent#3416)
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao authored Dec 31, 2024
1 parent 2d62ccc commit 620c173
Show file tree
Hide file tree
Showing 25 changed files with 22 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/avatar/avatar.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<template
wx:elif="{{iconName || _.isNoEmptyObj(iconData)}}"
is="icon"
data="{{class: classPrefix + '__icon', tClass: prefix + '-class-icon', name: iconName, ...iconData}}"
data="{{tClass: classPrefix + '__icon ' + prefix + '-class-icon', name: iconName, ...iconData}}"
/>
<view wx:else class="{{classPrefix}}__text {{prefix}}-class-content">
<slot />
Expand Down
2 changes: 1 addition & 1 deletion src/button/button.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<template
wx:if="{{_icon}}"
is="icon"
data="{{class: classPrefix + '__icon', tClass: prefix + '-class-icon', ariaHidden: true, name: iconName, ..._icon}}"
data="{{tClass: classPrefix + '__icon ' + prefix + '-class-icon', ariaHidden: true, name: iconName, ..._icon}}"
/>
<t-loading
wx:if="{{loading}}"
Expand Down
2 changes: 1 addition & 1 deletion src/calendar/template.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<block wx:elif="{{innerConfirmBtn}}">
<template
is="button"
data="{{ block: true, theme: 'primary', class: 't-calendar__confirm-btn', content: realLocalText.confirm, ...innerConfirmBtn }}"
data="{{ block: true, theme: 'primary', rootClass: 't-calendar__confirm-btn', content: realLocalText.confirm, ...innerConfirmBtn }}"
/>
</block>
</view>
Expand Down
2 changes: 0 additions & 2 deletions src/collapse/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ exports[`collapse :defaultExpandAll 1`] = `
class="t-cell__right t-class-right"
>
<t-icon
class=""
tClass="t-cell__right-icon t-class-right-icon"
bind:click=""
>
Expand Down Expand Up @@ -145,7 +144,6 @@ exports[`collapse :defaultExpandAll 1`] = `
class="t-cell__right t-class-right"
>
<t-icon
class=""
tClass="t-cell__right-icon t-class-right-icon"
bind:click=""
>
Expand Down
2 changes: 1 addition & 1 deletion src/common/template/badge.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
shape="{{shape || 'circle'}}"
show-zero="{{showZero || false}}"
size="{{size || 'medium'}}"
t-class="{{class}} {{tClass}}"
t-class="{{tClass}}"
t-class-content="{{tClassContent}}"
t-class-count="{{tClassCount}}"
/>
Expand Down
4 changes: 2 additions & 2 deletions src/common/template/button.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<t-button
t-id="{{tId || ''}}"
block="{{block || false}}"
class="{{class || ''}}"
t-class="{{externalClass}}"
class="{{rootClass || ''}}"
t-class="{{tClass}}"
disabled="{{disabled || false}}"
data-type="{{type}}"
data-extra="{{extra}}"
Expand Down
1 change: 0 additions & 1 deletion src/common/template/icon.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template name="icon">
<t-icon
style="{{style || ''}}"
class="{{class}}"
t-class="{{tClass}}"
prefix="{{prefix || ''}}"
name="{{name || ''}}"
Expand Down
1 change: 0 additions & 1 deletion src/common/template/image.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template name="image">
<t-image
class="{{class}}"
t-class="{{tClass}}"
t-class-load="{{tClassLoad}}"
style="{{style || ''}}"
Expand Down
4 changes: 2 additions & 2 deletions src/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export default class Dialog extends SuperComponent {
const btn = buttonMap[key];
const base: Record<string, any> = {
block: true,
class: [...cls, `${classPrefix}__button--${key}`],
externalClass: [...externalCls, `${prefix}-class-${key}`],
rootClass: [...cls, `${classPrefix}__button--${key}`],
tClass: [...externalCls, `${prefix}-class-${key}`],
variant: rect.buttonVariant,
openType: '',
};
Expand Down
2 changes: 1 addition & 1 deletion src/dialog/dialog.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<block wx:for="{{actions}}" wx:key="index">
<template
is="button"
data="{{block: true, type: 'action', extra: index, externalClass: prefix + '-class-action', class: this.getActionClass(classPrefix, buttonLayout), ...item }}"
data="{{block: true, type: 'action', extra: index, tClass: prefix + '-class-action', rootClass: this.getActionClass(classPrefix, buttonLayout), ...item }}"
/>
</block>
</block>
Expand Down
2 changes: 0 additions & 2 deletions src/dropdown-menu/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ exports[`dropdown-menu :base 1`] = `
菜单
</wx-view>
<t-icon
class=""
tClass="t-dropdown-menu__icon t-dropdown-menu__icon--active t-class-icon"
bind:click=""
>
Expand Down Expand Up @@ -59,7 +58,6 @@ exports[`dropdown-menu :base 1`] = `
单列多选
</wx-view>
<t-icon
class=""
tClass="t-dropdown-menu__icon t-dropdown-menu__icon-- t-class-icon"
bind:click=""
>
Expand Down
2 changes: 1 addition & 1 deletion src/empty/empty.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<template
wx:elif="{{iconName || _.isNoEmptyObj(iconData)}}"
is="icon"
data="{{class: classPrefix + '__icon', name: iconName, ...iconData}}"
data="{{tClass: classPrefix + '__icon', name: iconName, ...iconData}}"
/>
<slot wx:else name="image" />
</view>
Expand Down
2 changes: 1 addition & 1 deletion src/fab/fab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const baseButtonProps = {
size: 'large',
shape: 'circle',
theme: 'primary',
externalClass: `${prefix}-fab__button`,
tClass: `${prefix}-fab__button`,
};

@wxComponent()
Expand Down
2 changes: 1 addition & 1 deletion src/grid-item/grid-item.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<template
wx:if="{{iconName || _.isNoEmptyObj(iconData)}}"
is="icon"
data="{{class: classPrefix + '__icon', name: iconName, ...iconData}}"
data="{{tClass: classPrefix + '__icon', name: iconName, ...iconData}}"
/>
</view>
</t-badge>
Expand Down
2 changes: 0 additions & 2 deletions src/input/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ exports[`input props : clearable && label && suffix 1`] = `
bind:tap="clearInput"
>
<t-icon
class=""
tClass="t-class-clearable"
bind:click=""
>
Expand Down Expand Up @@ -102,7 +101,6 @@ exports[`input props : clearable && label && suffix 1`] = `
bind:tap="onSuffixIconClick"
>
<t-icon
class=""
tClass="t-class-suffix-icon"
bind:click=""
>
Expand Down
2 changes: 0 additions & 2 deletions src/message/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ exports[`message props : style && customStyle 1`] = `
class="t-message__icon--left"
>
<t-icon
class=""
tClass="t-class-icon"
bind:click=""
>
Expand Down Expand Up @@ -58,7 +57,6 @@ exports[`message props : style && customStyle 1`] = `
bind:tap="handleClose"
>
<t-icon
class=""
tClass="t-class-close-btn"
bind:click=""
>
Expand Down
1 change: 0 additions & 1 deletion src/notice-bar/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ exports[`notice-bar props : marquee 1`] = `
bind:tap="clickPrefixIcon"
>
<t-icon
class=""
tClass="t-class-prefix-icon"
bind:click=""
>
Expand Down
4 changes: 2 additions & 2 deletions src/progress/progress.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<template
wx:if="{{_.includes(this.STATUS, status)}}"
is="icon"
data="{{class: classPrefix + '__icon', size:'44rpx', name: this.LINE_STATUS_ICON[status]}}"
data="{{tClass: classPrefix + '__icon', size:'44rpx', name: this.LINE_STATUS_ICON[status]}}"
></template>
<text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
Expand Down Expand Up @@ -86,7 +86,7 @@
<template
wx:if="{{_.includes(this.STATUS, status)}}"
is="icon"
data="{{class: classPrefix + '__icon', size:'96rpx', name: this.CIRCLE_STATUS_ICON[status]}}"
data="{{tClass: classPrefix + '__icon', size:'96rpx', name: this.CIRCLE_STATUS_ICON[status]}}"
></template>
<text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
Expand Down
2 changes: 1 addition & 1 deletion src/result/result.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>
<view aria-hidden="true" class="{{classPrefix}}__thumb">
<t-image wx:if="{{image}}" t-class="{{prefix}}-class-image" src="{{image}}" mode="aspectFit" />
<template wx:elif="{{_icon}}" is="icon" data="{{class: classPrefix + '__icon', ..._icon }}" />
<template wx:elif="{{_icon}}" is="icon" data="{{tClass: classPrefix + '__icon', ..._icon }}" />
<slot name="image" />
</view>

Expand Down
2 changes: 1 addition & 1 deletion src/side-bar-item/side-bar-item.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<view class="{{classPrefix}}__prefix"></view>
<view class="{{classPrefix}}__suffix"></view>
</block>
<template wx:if="{{_icon}}" is="icon" data="{{ class: classPrefix + '__icon', ..._icon }}" />
<template wx:if="{{_icon}}" is="icon" data="{{ tClass: classPrefix + '__icon', ..._icon }}" />
<block wx:if="{{badgeProps}}">
<template is="badge" data="{{ ...badgeProps, content: label }}" />
</block>
Expand Down
4 changes: 2 additions & 2 deletions src/swipe-cell/swipe-cell.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<template
wx:if="{{item.icon}}"
is="icon"
data="{{class: classPrefix + '__icon', name: item.icon, ...item.icon}}"
data="{{tClass: classPrefix + '__icon', name: item.icon, ...item.icon}}"
></template>
<text wx:if="{{item.text}}" class="{{classPrefix}}__text">{{item.text}}</text>
</view>
Expand All @@ -51,7 +51,7 @@
<template
wx:if="{{item.icon}}"
is="icon"
data="{{class: classPrefix + '__icon', name: item.icon, ...item.icon}}"
data="{{tClass: classPrefix + '__icon', name: item.icon, ...item.icon}}"
></template>
<text wx:if="{{item.text}}" class="{{classPrefix}}__text">{{item.text}}</text>
</view>
Expand Down
2 changes: 1 addition & 1 deletion src/swiper/index.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function isNext(current, index, list) {
}

function getImageClass(prefix, current, index, list) {
var arr = [prefix + '-swiper__image', prefix + '-class-image'];
var arr = [prefix + '-swiper__image-host', prefix + '-swiper__image', prefix + '-class-image'];

if (isPrev(current, index, list)) {
arr.push(prefix + '-class-prev-image');
Expand Down
2 changes: 1 addition & 1 deletion src/swiper/swiper.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
>
<template
is="image"
data="{{ class: classPrefix + '__image-host', tClass: this.getImageClass(prefix, navCurrent, index, list), style: 'height: ' + _.addUnit(height), src: _.isObject(item) ? item.value : item, mode: 'aspectFill', dataset: index, ...imageProps, bindload: 'onImageLoad' }}"
data="{{tClass: this.getImageClass(prefix, navCurrent, index, list), style: 'height: ' + _.addUnit(height), src: _.isObject(item) ? item.value : item, mode: 'aspectFill', dataset: index, ...imageProps, bindload: 'onImageLoad' }}"
/>
</swiper-item>
</swiper>
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/tabs.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
class="{{_.cls(classPrefix + '__item-inner', [theme, ['active', currentIndex === index]])}}"
aria-hidden="{{ item.badgeProps.dot || item.badgeProps.count }}"
>
<template wx:if="{{item.icon}}" is="icon" data="{{ class: classPrefix + '__icon', ...item.icon }}" />
<template wx:if="{{item.icon}}" is="icon" data="{{ tClass: classPrefix + '__icon', ...item.icon }}" />
<block wx:if="{{item.badgeProps}}">
<template is="badge" data="{{ ...item.badgeProps, content: item.label }}" />
</block>
Expand Down
2 changes: 1 addition & 1 deletion src/tag/tag.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<template
wx:if="{{_closable}}"
is="icon"
data="{{class: classPrefix + '__icon-close', tClass: prefix + '-icon', bindclick: 'handleClose', ariaRole: 'button', ariaLabel: '关闭', ..._closable }}"
data="{{tClass: classPrefix + '__icon-close ' + prefix + '-icon', bindclick: 'handleClose', ariaRole: 'button', ariaLabel: '关闭', ..._closable }}"
catch:tap="handleClose"
/>
<slot wx:else name="closable" />
Expand Down

0 comments on commit 620c173

Please sign in to comment.