diff --git a/packages/taro-components/types/Editor.d.ts b/packages/taro-components/types/Editor.d.ts index 13718a1402c6..7bc3c50a0260 100644 --- a/packages/taro-components/types/Editor.d.ts +++ b/packages/taro-components/types/Editor.d.ts @@ -3,48 +3,48 @@ import { StandardProps, CommonEventFunction } from './common' interface EditorProps extends StandardProps { /** 设置编辑器为只读 * @default false - * @supported weapp + * @supported weapp, jd */ readOnly?: boolean /** 提示信息 - * @supported weapp + * @supported weapp, jd */ placeholder?: string /** 点击图片时显示图片大小控件 * @default false - * @supported weapp + * @supported weapp, jd */ showImgSize?: boolean /** 点击图片时显示工具栏控件 * @default false - * @supported weapp + * @supported weapp, jd */ showImgToolbar?: boolean /** 点击图片时显示修改尺寸控件 * @default false - * @supported weapp + * @supported weapp, jd */ showImgResize?: boolean /** 编辑器初始化完成时触发 - * @supported weapp + * @supported weapp, jd */ onReady?: CommonEventFunction /** 编辑器聚焦时触发 - * @supported weapp + * @supported weapp, jd */ onFocus?: CommonEventFunction /** 编辑器失去焦点时触发 * detail = { html, text, delta } - * @supported weapp + * @supported weapp, jd */ onBlur?: CommonEventFunction /** 编辑器内容改变时触发 * detail = { html, text, delta } - * @supported weapp + * @supported weapp, jd */ onInput?: CommonEventFunction /** 通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式 - * @supported weapp + * @supported weapp, jd */ onStatusChange?: CommonEventFunction } @@ -67,7 +67,7 @@ declare namespace EditorProps { * * *编辑器内支持部分 HTML 标签和内联样式,不支持 **class** 和 **id*** * @classification forms - * @supported weapp + * @supported weapp, jd * @example_react * ```tsx * class App extends Components { diff --git a/packages/taro-components/types/MatchMedia.d.ts b/packages/taro-components/types/MatchMedia.d.ts index a11f91527b5a..2a89a5e933d6 100644 --- a/packages/taro-components/types/MatchMedia.d.ts +++ b/packages/taro-components/types/MatchMedia.d.ts @@ -2,37 +2,37 @@ import { ComponentType } from 'react' import { StandardProps } from './common' interface MatchMediaProps extends StandardProps { /** 页面最小宽度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ minWidth?: number /** 页面最大宽度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ maxWidth?: number /** 页面宽度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ width?: number /** 页面最小高度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ minHeight?: number /** 页面最大高度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ maxHeight?: number /** 页面高度( px 为单位) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ height?: number /** 屏幕方向( landscape 或 portrait ) - * @supported weapp, alipay + * @supported weapp, alipay, jd */ orientation?: string } /** media query 匹配检测节点。可以指定一组 media query 规则,满足时,这个节点才会被展示。 * 通过这个节点可以实现“页面宽高在某个范围时才展示某个区域”这样的效果。 - * @supported weapp, alipay + * @supported weapp, alipay, jd * @classification viewContainer * @example_react * ```tsx diff --git a/packages/taro-components/types/PageContainer.d.ts b/packages/taro-components/types/PageContainer.d.ts index df909fcd7926..fabdc0d4f3e4 100644 --- a/packages/taro-components/types/PageContainer.d.ts +++ b/packages/taro-components/types/PageContainer.d.ts @@ -3,12 +3,12 @@ import { StandardProps, CommonEventFunction } from './common' interface PageContainerProps extends StandardProps { /** 是否显示容器组件 * @default false - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ show?: boolean /** 动画时长,单位毫秒 * @default 300 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ duration?: number /** z-index 层级 @@ -18,58 +18,58 @@ interface PageContainerProps extends StandardProps { zIndex?: number /** 是否显示遮罩层 * @default true - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ overlay?: boolean /** 弹出位置,可选值为 top bottom right center * @default bottom - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ position?: keyof PageContainerProps.Position /** 是否显示圆角 * @default false - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ round?: boolean /** 自定义遮罩层样式 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ overlayStyle?: string /** 自定义弹出层样式 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ customStyle?: string /** 是否在下滑一段距离后关闭 - * @supported weapp, alipay + * @supported weapp, alipay, jd * @default false */ closeOnSlideDown?: boolean /** 进入前触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onBeforeEnter?: CommonEventFunction /** 进入中触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onEnter?: CommonEventFunction /** 进入后触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onAfterEnter?: CommonEventFunction /** 离开前触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onBeforeLeave?: CommonEventFunction /** 离开中触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onLeave?: CommonEventFunction /** 离开后触发 - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn */ onAfterLeave?: CommonEventFunction /** 点击遮罩层时触发 - * @supported weapp, alipay + * @supported weapp, alipay, jd */ onClickOverlay?: CommonEventFunction /** 进入被打断时触发(通过 a: if 打断时不会触发)。 @@ -103,7 +103,7 @@ declare namespace PageContainerProps { * 1. tip: 当前页面最多只有 1 个容器,若已存在容器的情况下,无法增加新的容器 * 2. tip: wx.navigateBack 无法在页面栈顶调用,此时没有上一级页面 * @classification viewContainer - * @supported weapp, alipay, rn + * @supported weapp, alipay, jd, rn * @see https://developers.weixin.qq.com/miniprogram/dev/component/page-container.html */ declare const PageContainer: ComponentType diff --git a/packages/taro-components/types/RichText.d.ts b/packages/taro-components/types/RichText.d.ts index f09f5a69e1c3..106dac705288 100644 --- a/packages/taro-components/types/RichText.d.ts +++ b/packages/taro-components/types/RichText.d.ts @@ -3,15 +3,15 @@ import { CommonEventFunction, StandardProps } from './common' interface RichTextProps extends StandardProps { /** 文本是否可选,该属性会使节点显示为 block * @default false - * @supported weapp, h5, harmony_hybrid + * @supported weapp, jd, h5, harmony_hybrid */ userSelect?: boolean /** 节点列表/ HTML String - * @supported weapp, alipay, swan, tt, qq, h5, rn, harmony, harmony_hybrid + * @supported weapp, jd, alipay, swan, tt, qq, h5, rn, harmony, harmony_hybrid */ nodes?: Nodes /** 显示连续空格 - * @supported weapp, alipay, tt, qq, h5, rn, harmony_hybrid + * @supported weapp, jd, alipay, tt, qq, h5, rn, harmony_hybrid */ space?: keyof RichTextProps.TSpace /** 富文本是否可以长按选中,可用于复制,粘贴,长按搜索等场景 @@ -99,7 +99,7 @@ declare namespace RichTextProps { } /** 富文本 * @classification base - * @supported weapp, swan, alipay, tt, h5, rn, harmony, harmony_hybrid + * @supported weapp, jd, swan, alipay, tt, h5, rn, harmony, harmony_hybrid * @example_react * ```tsx * class App extends Components { diff --git a/packages/taro-platform-jd/src/components-react.ts b/packages/taro-platform-jd/src/components-react.ts index 9fd382a64b86..27af3ddd2e3a 100644 --- a/packages/taro-platform-jd/src/components-react.ts +++ b/packages/taro-platform-jd/src/components-react.ts @@ -3,3 +3,4 @@ export * from '@tarojs/components/mini' export const Editor = 'editor' export const PageContainer = 'page-container' export const RootPortal = 'root-portal' +export const MatchMedia = 'match-media' diff --git a/packages/taro-platform-jd/src/components.ts b/packages/taro-platform-jd/src/components.ts index fe021ea580f1..dc5ac18920d4 100644 --- a/packages/taro-platform-jd/src/components.ts +++ b/packages/taro-platform-jd/src/components.ts @@ -1,63 +1,80 @@ import { singleQuote } from '@tarojs/shared' +const _true = 'true' +const _false = 'false' +const _empty = '' + export const components = { // ======== 调整属性 ======== Swiper: { 'easing-function': singleQuote('default') }, Canvas: { - type: '' + type: _empty }, Button: { - bindGetPhoneNumber: '' + bindGetPhoneNumber: _empty }, Map: { - bindRegionChange: '' + bindRegionChange: _empty }, WebView: { - height: '' + height: _empty }, Input: { - 'adjust-position': 'true', + 'adjust-position': _true, }, Textarea: { - 'show-confirm-bar': 'true', - 'adjust-position': 'true', - 'disable-default-padding': 'false', + 'show-confirm-bar': _true, + 'adjust-position': _true, + 'disable-default-padding': _false, }, RootPortal: { - enable: 'true' + enable: _true }, Editor: { - 'read-only': 'false', - placeholder: '', - 'show-img-size': 'false', - 'show-img-toolbar': 'false', - 'show-img-resize': 'false', - focus: 'false', - bindReady: '', - bindFocus: '', - bindBlur: '', - bindInput: '', - bindStatusChange: '', - name: '' + 'read-only': _false, + placeholder: _empty, + 'show-img-size': _false, + 'show-img-toolbar': _false, + 'show-img-resize': _false, + focus: _false, + bindReady: _empty, + bindFocus: _empty, + bindBlur: _empty, + bindInput: _empty, + bindStatusChange: _empty, + name: _empty }, PageContainer: { - show: 'false', + show: _false, duration: '300', 'z-index': '100', - overlay: 'true', + overlay: _true, position: "'bottom'", - round: 'false', - 'close-on-slide-down': 'false', - 'overlay-style': '', - 'custom-style': '', - bindBeforeEnter: '', - bindEnter: '', - bindAfterEnter: '', - bindBeforeLeave: '', - bindLeave: '', - bindAfterLeave: '', - bindClickOverlay: '' + round: _false, + 'close-on-slide-down': _false, + 'overlay-style': _empty, + 'custom-style': _empty, + bindBeforeEnter: _empty, + bindEnter: _empty, + bindAfterEnter: _empty, + bindBeforeLeave: _empty, + bindLeave: _empty, + bindAfterLeave: _empty, + bindClickOverlay: _empty + }, + MatchMedia: { + 'min-width': _empty, + 'max-width': _empty, + width: _empty, + 'min-height': _empty, + 'max-height': _empty, + height: _empty, + orientation: _empty + }, + RichText: { + space: _empty, + 'user-select': _false }, } diff --git a/tests/__tests__/__snapshots__/mini-platform.spec.ts.snap b/tests/__tests__/__snapshots__/mini-platform.spec.ts.snap index 8f2cea582e98..0fe88b853dd0 100644 --- a/tests/__tests__/__snapshots__/mini-platform.spec.ts.snap +++ b/tests/__tests__/__snapshots__/mini-platform.spec.ts.snap @@ -2800,64 +2800,80 @@ require("./runtime"); } }; } + const _true = "true"; + const _false = "false"; + const _empty = ""; const components = { Swiper: { "easing-function": singleQuote("default") }, Canvas: { - type: "" + type: _empty }, Button: { - bindGetPhoneNumber: "" + bindGetPhoneNumber: _empty }, Map: { - bindRegionChange: "" + bindRegionChange: _empty }, WebView: { - height: "" + height: _empty }, Input: { - "adjust-position": "true" + "adjust-position": _true }, Textarea: { - "show-confirm-bar": "true", - "adjust-position": "true", - "disable-default-padding": "false" + "show-confirm-bar": _true, + "adjust-position": _true, + "disable-default-padding": _false }, RootPortal: { - enable: "true" + enable: _true }, Editor: { - "read-only": "false", - placeholder: "", - "show-img-size": "false", - "show-img-toolbar": "false", - "show-img-resize": "false", - focus: "false", - bindReady: "", - bindFocus: "", - bindBlur: "", - bindInput: "", - bindStatusChange: "", - name: "" + "read-only": _false, + placeholder: _empty, + "show-img-size": _false, + "show-img-toolbar": _false, + "show-img-resize": _false, + focus: _false, + bindReady: _empty, + bindFocus: _empty, + bindBlur: _empty, + bindInput: _empty, + bindStatusChange: _empty, + name: _empty }, PageContainer: { - show: "false", + show: _false, duration: "300", "z-index": "100", - overlay: "true", + overlay: _true, position: "'bottom'", - round: "false", - "close-on-slide-down": "false", - "overlay-style": "", - "custom-style": "", - bindBeforeEnter: "", - bindEnter: "", - bindAfterEnter: "", - bindBeforeLeave: "", - bindLeave: "", - bindAfterLeave: "", - bindClickOverlay: "" + round: _false, + "close-on-slide-down": _false, + "overlay-style": _empty, + "custom-style": _empty, + bindBeforeEnter: _empty, + bindEnter: _empty, + bindAfterEnter: _empty, + bindBeforeLeave: _empty, + bindLeave: _empty, + bindAfterLeave: _empty, + bindClickOverlay: _empty + }, + MatchMedia: { + "min-width": _empty, + "max-width": _empty, + width: _empty, + "min-height": _empty, + "max-height": _empty, + height: _empty, + orientation: _empty + }, + RichText: { + space: _empty, + "user-select": _false } }; const hostConfig = {