UNPKG

mdui

Version:

实现 material you 设计规范的 Web Components 组件库

1,524 lines (1,523 loc) 1.04 MB
{ "schemaVersion": "1.0.0", "readme": "", "modules": [ { "kind": "javascript-module", "path": "@mdui/shared/mixins/anchor.js", "declarations": [ { "kind": "class", "description": "", "name": "AnchorMixinInterface", "members": [ { "kind": "field", "name": "href", "type": { "text": "string | undefined" }, "privacy": "public" }, { "kind": "field", "name": "download", "type": { "text": "string | undefined" }, "privacy": "public" }, { "kind": "field", "name": "target", "type": { "text": "'_blank' | '_parent' | '_self' | '_top' | undefined" }, "privacy": "public" }, { "kind": "field", "name": "rel", "type": { "text": "| 'alternate'\n | 'author'\n | 'bookmark'\n | 'external'\n | 'help'\n | 'license'\n | 'me'\n | 'next'\n | 'nofollow'\n | 'noreferrer'\n | 'opener'\n | 'prev'\n | 'search'\n | 'tag' | undefined" }, "privacy": "public" }, { "kind": "method", "name": "renderAnchor", "privacy": "protected", "return": { "type": { "text": "TemplateResult" } }, "parameters": [ { "name": "options", "type": { "text": "RenderAnchorOptions" } } ] } ] }, { "kind": "mixin", "description": "", "name": "AnchorMixin", "members": [ { "kind": "field", "name": "href", "type": { "text": "string" }, "privacy": "public", "description": "链接的目标 URL。\n\n如果设置了此属性,组件内部将渲染为 `<a>` 元素,并可以使用链接相关的属性。", "attribute": "href", "reflects": true }, { "kind": "field", "name": "download", "type": { "text": "string" }, "privacy": "public", "description": "下载链接的目标。\n\n**Note**:仅在设置了 `href` 属性时,此属性才有效。", "attribute": "download", "reflects": true }, { "kind": "field", "name": "target", "type": { "text": "| /*在新窗口中打开链接*/ '_blank'\n | /*在父框架中打开链接*/ '_parent'\n | /*默认。在当前框架中打开链接*/ '_self'\n | /*在整个窗口中打开链接*/ '_top'" }, "privacy": "public", "description": "链接的打开方式。可选值包括:\n\n* `_blank`:在新窗口中打开链接\n* `_parent`:在父框架中打开链接\n* `_self`:默认。在当前框架中打开链接\n* `_top`:在整个窗口中打开链接\n\n**Note**:仅在设置了 `href` 属性时,此属性才有效。", "attribute": "target", "reflects": true }, { "kind": "field", "name": "rel", "type": { "text": "| /*当前文档的替代版本*/ 'alternate'\n | /*当前文档或文章的作者*/ 'author'\n | /*永久链接到最近的祖先章节*/ 'bookmark'\n | /*引用的文档与当前文档不在同一站点*/ 'external'\n | /*链接到相关的帮助文档*/ 'help'\n | /*当前文档的主要内容由被引用文件的版权许可覆盖*/ 'license'\n | /*当前文档代表链接内容的所有者*/ 'me'\n | /*当前文档是系列中的一部分,被引用的文档是系列的下一个文档*/ 'next'\n | /*当前文档的作者或发布者不认可被引用的文件*/ 'nofollow'\n | /*不包含 `Referer` 头。类似于 `noopener` 的效果*/ 'noreferrer'\n | /*如果超链接会创建一个顶级浏览上下文(即 `target` 属性值为 `_blank`),则创建一个辅助浏览上下文*/ 'opener'\n | /*当前文档是系列的一部分,被引用的文档是系列的上一个文档*/ 'prev'\n | /*提供一个资源链接,可用于搜索当前文件及其相关页面*/ 'search'\n | /*提供一个适用于当前文档的标签(由给定地址识别)*/ 'tag'" }, "privacy": "public", "description": "当前文档与被链接文档之间的关系。可选值包括:\n\n* `alternate`:当前文档的替代版本\n* `author`:当前文档或文章的作者\n* `bookmark`:永久链接到最近的祖先章节\n* `external`:引用的文档与当前文档不在同一站点\n* `help`:链接到相关的帮助文档\n* `license`:当前文档的主要内容由被引用文件的版权许可覆盖\n* `me`:当前文档代表链接内容的所有者\n* `next`:当前文档是系列中的一部分,被引用的文档是系列的下一个文档\n* `nofollow`:当前文档的作者或发布者不认可被引用的文件\n* `noreferrer`:不包含 `Referer` 头。类似于 `noopener` 的效果\n* `opener`:如果超链接会创建一个顶级浏览上下文(即 `target` 属性值为 `_blank`),则创建一个辅助浏览上下文\n* `prev`:当前文档是系列的一部分,被引用的文档是系列的上一个文档\n* `search`:提供一个资源链接,可用于搜索当前文件及其相关页面\n* `tag`:提供一个适用于当前文档的标签(由给定地址识别)\n\n**Note**:仅在指定了 `href` 属性时可用。", "attribute": "rel", "reflects": true }, { "kind": "method", "name": "renderAnchor", "privacy": "protected", "return": { "type": { "text": "TemplateResult" } }, "parameters": [ { "name": "{\n id,\n className,\n part,\n content = html`<slot></slot>`,\n refDirective,\n tabIndex,\n }", "type": { "text": "RenderAnchorOptions" } } ] } ], "attributes": [ { "name": "href", "type": { "text": "string" }, "description": "链接的目标 URL。\n\n如果设置了此属性,组件内部将渲染为 `<a>` 元素,并可以使用链接相关的属性。", "fieldName": "href" }, { "name": "download", "type": { "text": "string" }, "description": "下载链接的目标。\n\n**Note**:仅在设置了 `href` 属性时,此属性才有效。", "fieldName": "download" }, { "name": "target", "type": { "text": "| /*在新窗口中打开链接*/ '_blank'\n | /*在父框架中打开链接*/ '_parent'\n | /*默认。在当前框架中打开链接*/ '_self'\n | /*在整个窗口中打开链接*/ '_top'" }, "description": "链接的打开方式。可选值包括:\n\n* `_blank`:在新窗口中打开链接\n* `_parent`:在父框架中打开链接\n* `_self`:默认。在当前框架中打开链接\n* `_top`:在整个窗口中打开链接\n\n**Note**:仅在设置了 `href` 属性时,此属性才有效。", "fieldName": "target" }, { "name": "rel", "type": { "text": "| /*当前文档的替代版本*/ 'alternate'\n | /*当前文档或文章的作者*/ 'author'\n | /*永久链接到最近的祖先章节*/ 'bookmark'\n | /*引用的文档与当前文档不在同一站点*/ 'external'\n | /*链接到相关的帮助文档*/ 'help'\n | /*当前文档的主要内容由被引用文件的版权许可覆盖*/ 'license'\n | /*当前文档代表链接内容的所有者*/ 'me'\n | /*当前文档是系列中的一部分,被引用的文档是系列的下一个文档*/ 'next'\n | /*当前文档的作者或发布者不认可被引用的文件*/ 'nofollow'\n | /*不包含 `Referer` 头。类似于 `noopener` 的效果*/ 'noreferrer'\n | /*如果超链接会创建一个顶级浏览上下文(即 `target` 属性值为 `_blank`),则创建一个辅助浏览上下文*/ 'opener'\n | /*当前文档是系列的一部分,被引用的文档是系列的上一个文档*/ 'prev'\n | /*提供一个资源链接,可用于搜索当前文件及其相关页面*/ 'search'\n | /*提供一个适用于当前文档的标签(由给定地址识别)*/ 'tag'" }, "description": "当前文档与被链接文档之间的关系。可选值包括:\n\n* `alternate`:当前文档的替代版本\n* `author`:当前文档或文章的作者\n* `bookmark`:永久链接到最近的祖先章节\n* `external`:引用的文档与当前文档不在同一站点\n* `help`:链接到相关的帮助文档\n* `license`:当前文档的主要内容由被引用文件的版权许可覆盖\n* `me`:当前文档代表链接内容的所有者\n* `next`:当前文档是系列中的一部分,被引用的文档是系列的下一个文档\n* `nofollow`:当前文档的作者或发布者不认可被引用的文件\n* `noreferrer`:不包含 `Referer` 头。类似于 `noopener` 的效果\n* `opener`:如果超链接会创建一个顶级浏览上下文(即 `target` 属性值为 `_blank`),则创建一个辅助浏览上下文\n* `prev`:当前文档是系列的一部分,被引用的文档是系列的上一个文档\n* `search`:提供一个资源链接,可用于搜索当前文件及其相关页面\n* `tag`:提供一个适用于当前文档的标签(由给定地址识别)\n\n**Note**:仅在指定了 `href` 属性时可用。", "fieldName": "rel" } ], "parameters": [ { "name": "superclass", "type": { "text": "T" } } ] } ], "exports": [ { "kind": "js", "name": "AnchorMixinInterface", "declaration": { "name": "AnchorMixinInterface", "module": "@mdui/shared/mixins/anchor.js" } }, { "kind": "js", "name": "AnchorMixin", "declaration": { "name": "AnchorMixin", "module": "@mdui/shared/mixins/anchor.js" } } ] }, { "kind": "javascript-module", "path": "@mdui/shared/mixins/focusable.js", "declarations": [ { "kind": "class", "description": "", "name": "FocusableMixinInterface", "members": [ { "kind": "field", "name": "autofocus", "type": { "text": "boolean" }, "privacy": "public" }, { "kind": "field", "name": "tabIndex", "type": { "text": "number" }, "privacy": "public" }, { "kind": "field", "name": "focusDisabled", "type": { "text": "boolean" }, "privacy": "protected", "readonly": true }, { "kind": "field", "name": "focusElement", "type": { "text": "HTMLElement | null | undefined" }, "privacy": "protected", "readonly": true }, { "kind": "method", "name": "focus", "privacy": "public", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "options", "optional": true, "type": { "text": "FocusOptions" } } ] }, { "kind": "method", "name": "blur", "privacy": "public", "return": { "type": { "text": "void" } } }, { "kind": "method", "name": "click", "privacy": "public", "return": { "type": { "text": "void" } } } ] }, { "kind": "mixin", "description": "参考:https://github.com/adobe/spectrum-web-components/blob/main/tools/shared/src/focusable.ts", "name": "FocusableMixin", "members": [ { "kind": "field", "name": "autofocus", "type": { "text": "boolean" }, "privacy": "public", "default": "false", "description": "是否在页面加载完成后自动获取焦点", "attribute": "autofocus", "reflects": true }, { "kind": "field", "name": "focused", "type": { "text": "boolean" }, "privacy": "private", "default": "false", "description": "是否获得了焦点,不管是鼠标点击,还是键盘切换获得的焦点,都会添加该属性\n添加到 :host 元素上,供 CSS 选择器添加样式", "attribute": "focused", "reflects": true }, { "kind": "field", "name": "focusVisible", "type": { "text": "boolean" }, "privacy": "private", "default": "false", "description": "是否通过键盘切换获得了焦点\n添加到 :host 元素上,供 CSS 选择器添加样式", "attribute": "focus-visible", "reflects": true }, { "kind": "field", "name": "focusableDefinedController", "type": { "text": "DefinedController" }, "privacy": "protected", "default": "new DefinedController(this, { relatedElements: [''] })" }, { "kind": "field", "name": "_manipulatingTabindex", "type": { "text": "boolean" }, "privacy": "private", "default": "false" }, { "kind": "field", "name": "_tabIndex", "type": { "text": "number" }, "privacy": "private", "default": "0" }, { "kind": "field", "name": "_lastFocusDisabled", "type": { "text": "boolean | undefined" }, "privacy": "private" }, { "kind": "field", "name": "tabIndex", "type": { "text": "number" }, "privacy": "public", "description": "元素在使用 Tab 键切换焦点时的顺序", "attribute": "tabindex" }, { "kind": "field", "name": "focusDisabled", "type": { "text": "boolean" }, "privacy": "protected", "description": "父类要实现该属性,表示是否禁用 focus 状态", "readonly": true }, { "kind": "field", "name": "focusElement", "type": { "text": "HTMLElement | null | undefined" }, "privacy": "protected", "description": "最终获得焦点的元素", "readonly": true }, { "kind": "method", "name": "click", "privacy": "public", "return": { "type": { "text": "void" } }, "description": "模拟鼠标点击元素" }, { "kind": "method", "name": "focus", "privacy": "public", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "options", "optional": true, "type": { "text": "FocusOptions" } } ], "description": "将焦点设置到当前元素。\n\n可以传入一个对象作为参数,该对象的属性包括:\n\n* `preventScroll`:默认情况下,元素获取焦点后,页面会滚动以将该元素滚动到视图中。如果不希望页面滚动,可以将此属性设置为 `true`。" }, { "kind": "method", "name": "blur", "privacy": "public", "return": { "type": { "text": "void" } }, "description": "移除当前元素的焦点" }, { "kind": "method", "name": "manageFocusElementTabindex", "privacy": "private", "return": { "type": { "text": "Promise<void>" } }, "parameters": [ { "name": "tabIndex", "type": { "text": "number" } } ] }, { "kind": "method", "name": "manageAutoFocus", "privacy": "private", "return": { "type": { "text": "void" } } } ], "events": [ { "name": "keydown", "type": { "text": "KeyboardEvent" } } ], "attributes": [ { "name": "autofocus", "type": { "text": "boolean" }, "default": "false", "description": "是否在页面加载完成后自动获取焦点", "fieldName": "autofocus" }, { "name": "focused", "type": { "text": "boolean" }, "default": "false", "description": "是否获得了焦点,不管是鼠标点击,还是键盘切换获得的焦点,都会添加该属性\n添加到 :host 元素上,供 CSS 选择器添加样式", "fieldName": "focused" }, { "name": "focus-visible", "type": { "text": "boolean" }, "default": "false", "description": "是否通过键盘切换获得了焦点\n添加到 :host 元素上,供 CSS 选择器添加样式", "fieldName": "focusVisible" }, { "name": "tabindex", "type": { "text": "number" }, "description": "元素在使用 Tab 键切换焦点时的顺序", "fieldName": "tabIndex" } ], "parameters": [ { "name": "superclass", "type": { "text": "T" } } ] } ], "exports": [ { "kind": "js", "name": "FocusableMixinInterface", "declaration": { "name": "FocusableMixinInterface", "module": "@mdui/shared/mixins/focusable.js" } }, { "kind": "js", "name": "FocusableMixin", "declaration": { "name": "FocusableMixin", "module": "@mdui/shared/mixins/focusable.js" } } ] }, { "kind": "javascript-module", "path": "@mdui/shared/mixins/scrollBehavior.js", "declarations": [ { "kind": "class", "description": "", "name": "ScrollBehaviorMixinInterface", "members": [ { "kind": "field", "name": "scrollTarget", "type": { "text": "string | HTMLElement | JQ<HTMLElement> | undefined" }, "privacy": "public" }, { "kind": "field", "name": "scrollBehavior", "type": { "text": "ScrollBehavior | undefined" }, "privacy": "public" }, { "kind": "field", "name": "scrollThreshold", "type": { "text": "number | undefined" }, "privacy": "public" }, { "kind": "field", "name": "scrollBehaviorDefinedController", "type": { "text": "DefinedController" }, "privacy": "protected" }, { "kind": "method", "name": "updateContainerPadding", "privacy": "protected", "return": { "type": { "text": "void" } } }, { "kind": "method", "name": "hasScrollBehavior", "privacy": "protected", "return": { "type": { "text": "boolean" } }, "parameters": [ { "name": "behavior", "type": { "text": "ScrollBehavior | ScrollBehavior[]" } } ] } ] }, { "kind": "mixin", "description": "滚动行为\n\n父类需要实现", "name": "ScrollBehaviorMixin", "members": [ { "kind": "field", "name": "scrollTarget", "type": { "text": "string | HTMLElement | JQ<HTMLElement> | undefined" }, "privacy": "public", "description": "需要监听其滚动事件的元素。值可以是 CSS 选择器、DOM 元素、或 [JQ 对象](/docs/2/functions/jq)。默认监听 `window` 的滚动事件", "attribute": "scroll-target" }, { "kind": "field", "name": "scrollBehavior", "type": { "text": "'hide' | 'shrink' | 'elevate' | undefined" }, "privacy": "public", "description": "滚动行为。可选值为:\n* `hide`:滚动时隐藏\n* `shrink`:滚动时缩小\n* `elevate`:滚动时增加阴影\n\ntodo: 生成 custom-elements.json 时,属性名的注释用了父类的,属性枚举值的类型和注释用了该类的。期望都使用父类的。", "attribute": "scroll-behavior", "reflects": true }, { "kind": "field", "name": "scrollThreshold", "type": { "text": "number | undefined" }, "privacy": "public", "description": "在滚动多少距离之后触发滚动行为,单位为 `px`", "attribute": "scroll-threshold", "reflects": true }, { "kind": "field", "name": "scrollBehaviorDefinedController", "privacy": "protected", "default": "new DefinedController(this, { needDomReady: true, })" }, { "kind": "field", "name": "lastScrollTopThreshold", "type": { "text": "number" }, "privacy": "private", "default": "0", "description": "上次滚动后,垂直方向的距离(滚动距离超过 scrollThreshold 才记录)" }, { "kind": "field", "name": "lastScrollTopNoThreshold", "type": { "text": "number" }, "privacy": "private", "default": "0", "description": "上次滚动后,垂直方向的距离(无视 scrollThreshold,始终记录)" }, { "kind": "field", "name": "isParentLayout", "type": { "text": "boolean" }, "privacy": "private", "default": "false", "description": "父元素是否是 `mdui-layout`" }, { "kind": "field", "name": "scrollPaddingPosition", "type": { "text": "ScrollPaddingPosition" }, "privacy": "protected", "description": "滚动时,如果需要给 container 添加 padding,添加在顶部还是底部", "readonly": true }, { "kind": "method", "name": "onScrollTargetChange", "privacy": "private", "parameters": [ { "name": "oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ] }, { "kind": "method", "name": "onScrollBehaviorChange", "privacy": "private", "parameters": [ { "name": "oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ] }, { "kind": "method", "name": "hasScrollBehavior", "privacy": "protected", "return": { "type": { "text": "boolean" } }, "parameters": [ { "name": "behavior", "type": { "text": "ScrollBehavior | ScrollBehavior[]" }, "description": "为数组时,只要其中一个行为在 scrollBehavior 中,即返回 `true`" } ], "description": "scrollBehavior 包含多个滚动行为,用空格分割\n用该方法判断指定滚动行为是否在 scrollBehavior 中" }, { "kind": "method", "name": "runScrollThreshold", "privacy": "protected", "parameters": [ { "name": "isScrollingUp", "type": { "text": "boolean" }, "description": "是否向上滚动" }, { "name": "scrollTop", "type": { "text": "number" }, "description": "距离 scrollTarget 顶部的距离" } ], "description": "执行滚动事件,在滚动距离超过 scrollThreshold 时才会执行\nNote: 父类可以按需实现该方法" }, { "kind": "method", "name": "runScrollNoThreshold", "privacy": "protected", "parameters": [ { "name": "isScrollingUp", "type": { "text": "boolean" }, "description": "是否向上滚动" }, { "name": "scrollTop", "type": { "text": "number" }, "description": "距离 scrollTarget 顶部的距离" } ], "description": "执行滚动事件,会无视 scrollThreshold,始终会执行" }, { "kind": "method", "name": "updateContainerPadding", "privacy": "protected", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "withPadding", "default": "true", "description": "该值为 false 时,为移除 padding" } ], "description": "更新滚动容器的 padding,避免内容被 navigation-bar 覆盖\n仅 scrollBehavior 包含 hide、shrink 时,添加 padding" }, { "kind": "method", "name": "onListeningScroll", "privacy": "private" }, { "kind": "method", "name": "onScroll", "privacy": "private", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "listening", "type": { "text": "HTMLElement | Window" } } ], "description": "滚动事件,这里过滤掉不符合条件的滚动" }, { "kind": "method", "name": "updateScrollTop", "privacy": "private", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "listening", "type": { "text": "HTMLElement | Window" } } ], "description": "重新更新 lastScrollTopThreshold、lastScrollTopNoThreshold 的值\n用于在 scrollTarget、scrollBehavior 变更时,重新设置 lastScrollTopThreshold、lastScrollTopNoThreshold 的初始值" }, { "kind": "method", "name": "getListening", "privacy": "private", "return": { "type": { "text": "HTMLElement | Window | undefined" } }, "parameters": [ { "name": "target", "optional": true, "type": { "text": "string | HTMLElement | JQ<HTMLElement>" } } ], "description": "获取组件需要监听哪个元素的滚动状态" }, { "kind": "method", "name": "getContainer", "privacy": "private", "return": { "type": { "text": "HTMLElement | undefined" } }, "parameters": [ { "name": "target", "optional": true, "type": { "text": "string | HTMLElement | JQ<HTMLElement>" } } ], "description": "获取组件在哪个容器内滚动" } ], "attributes": [ { "name": "scroll-target", "type": { "text": "string | HTMLElement | JQ<HTMLElement> | undefined" }, "description": "需要监听其滚动事件的元素。值可以是 CSS 选择器、DOM 元素、或 [JQ 对象](/docs/2/functions/jq)。默认监听 `window` 的滚动事件", "fieldName": "scrollTarget" }, { "name": "scroll-behavior", "type": { "text": "'hide' | 'shrink' | 'elevate' | undefined" }, "description": "滚动行为。可选值为:\n* `hide`:滚动时隐藏\n* `shrink`:滚动时缩小\n* `elevate`:滚动时增加阴影\n\ntodo: 生成 custom-elements.json 时,属性名的注释用了父类的,属性枚举值的类型和注释用了该类的。期望都使用父类的。", "fieldName": "scrollBehavior" }, { "name": "scroll-threshold", "type": { "text": "number | undefined" }, "description": "在滚动多少距离之后触发滚动行为,单位为 `px`", "fieldName": "scrollThreshold" } ], "parameters": [ { "name": "superclass", "type": { "text": "T" } } ] } ], "exports": [ { "kind": "js", "name": "ScrollBehaviorMixinInterface", "declaration": { "name": "ScrollBehaviorMixinInterface", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "js", "name": "ScrollBehaviorMixin", "declaration": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } } ] }, { "kind": "javascript-module", "path": "components/avatar/index.js", "declarations": [ { "kind": "class", "description": "", "name": "Avatar", "cssProperties": [ { "description": "组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)", "name": "--shape-corner" } ], "cssParts": [ { "description": "使用图片作为头像时,组件内部的 `<img>` 元素", "name": "image" }, { "description": "使用图标作为头像时,组件内部的 `<mdui-icon>` 元素", "name": "icon" } ], "slots": [ { "description": "自定义头像内容,可以为字母、汉字、`<img>` 元素、图标等", "name": "" } ], "members": [ { "kind": "field", "name": "src", "type": { "text": "string | undefined" }, "privacy": "public", "description": "头像图片的 URL 地址", "attribute": "src", "reflects": true }, { "kind": "field", "name": "fit", "type": { "text": "| /*保持图片原有尺寸比例,内容会被等比例缩放*/ 'contain'\n | /*保持图片原有尺寸比例,但部分内容可能被剪切*/ 'cover'\n | /*默认值,不保持图片原有尺寸比例,内容会被拉伸以填充整个容器*/ 'fill'\n | /*保留图片原有尺寸,内容不会被缩放或拉伸*/ 'none'\n | /*保持图片原有尺寸比例,内容尺寸与 `none` 或 `contain` 中较小的一个相同*/ 'scale-down' | undefined" }, "privacy": "public", "description": "图片如何适应容器框,与原生的 [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) 属性相同。可选值包括:\n\n* `contain`:保持图片原有尺寸比例,内容会被等比例缩放\n* `cover`:保持图片原有尺寸比例,但部分内容可能被剪切\n* `fill`:默认值,不保持图片原有尺寸比例,内容会被拉伸以填充整个容器\n* `none`:保留图片原有尺寸,内容不会被缩放或拉伸\n* `scale-down`:保持图片原有尺寸比例,内容尺寸与 `none` 或 `contain` 中较小的一个相同", "attribute": "fit", "reflects": true }, { "kind": "field", "name": "icon", "type": { "text": "string | undefined" }, "privacy": "public", "description": "头像的 Material Icons 图标名", "attribute": "icon", "reflects": true }, { "kind": "field", "name": "label", "type": { "text": "string | undefined" }, "privacy": "public", "description": "头像的替代文本描述", "attribute": "label", "reflects": true }, { "kind": "field", "name": "hasSlotController", "privacy": "private", "readonly": true, "default": "new HasSlotController(this, '[default]')" } ], "attributes": [ { "name": "src", "type": { "text": "string | undefined" }, "description": "头像图片的 URL 地址", "fieldName": "src" }, { "name": "fit", "type": { "text": "| /*保持图片原有尺寸比例,内容会被等比例缩放*/ 'contain'\n | /*保持图片原有尺寸比例,但部分内容可能被剪切*/ 'cover'\n | /*默认值,不保持图片原有尺寸比例,内容会被拉伸以填充整个容器*/ 'fill'\n | /*保留图片原有尺寸,内容不会被缩放或拉伸*/ 'none'\n | /*保持图片原有尺寸比例,内容尺寸与 `none` 或 `contain` 中较小的一个相同*/ 'scale-down' | undefined" }, "description": "图片如何适应容器框,与原生的 [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) 属性相同。可选值包括:\n\n* `contain`:保持图片原有尺寸比例,内容会被等比例缩放\n* `cover`:保持图片原有尺寸比例,但部分内容可能被剪切\n* `fill`:默认值,不保持图片原有尺寸比例,内容会被拉伸以填充整个容器\n* `none`:保留图片原有尺寸,内容不会被缩放或拉伸\n* `scale-down`:保持图片原有尺寸比例,内容尺寸与 `none` 或 `contain` 中较小的一个相同", "fieldName": "fit" }, { "name": "icon", "type": { "text": "string | undefined" }, "description": "头像的 Material Icons 图标名", "fieldName": "icon" }, { "name": "label", "type": { "text": "string | undefined" }, "description": "头像的替代文本描述", "fieldName": "label" } ], "superclass": { "name": "MduiElement", "package": "@mdui/shared/base/mdui-element.js" }, "summary": "头像组件\n\n```html\n<mdui-avatar src=\"https://avatars.githubusercontent.com/u/3030330?s=40&v=4\"></mdui-avatar>\n```", "tagName": "mdui-avatar", "customElement": true } ], "exports": [ { "kind": "js", "name": "Avatar", "declaration": { "name": "Avatar", "module": "components/avatar/index.js" } }, { "kind": "custom-element-definition", "name": "mdui-avatar", "declaration": { "name": "Avatar", "module": "components/avatar/index.js" } } ] }, { "kind": "javascript-module", "path": "components/badge/index.js", "declarations": [ { "kind": "class", "description": "", "name": "Badge", "cssProperties": [ { "description": "组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)", "name": "--shape-corner" } ], "slots": [ { "description": "徽标中显示的文本", "name": "" } ], "members": [ { "kind": "field", "name": "variant", "type": { "text": "| /*小型徽标,不显示文本*/ 'small'\n | /*大型徽标,会显示文本*/ 'large'" }, "privacy": "public", "default": "'large'", "description": "徽标的形状。可选值包括:\n\n* `small`:小型徽标,不显示文本\n* `large`:大型徽标,会显示文本", "attribute": "variant", "reflects": true } ], "attributes": [ { "name": "variant", "type": { "text": "| /*小型徽标,不显示文本*/ 'small'\n | /*大型徽标,会显示文本*/ 'large'" }, "default": "'large'", "description": "徽标的形状。可选值包括:\n\n* `small`:小型徽标,不显示文本\n* `large`:大型徽标,会显示文本", "fieldName": "variant" } ], "superclass": { "name": "MduiElement", "package": "@mdui/shared/base/mdui-element.js" }, "summary": "徽标组件\n\n```html\n<mdui-badge>12</mdui-badge>\n```", "tagName": "mdui-badge", "customElement": true } ], "exports": [ { "kind": "js", "name": "Badge", "declaration": { "name": "Badge", "module": "components/badge/index.js" } }, { "kind": "custom-element-definition", "name": "mdui-badge", "declaration": { "name": "Badge", "module": "components/badge/index.js" } } ] }, { "kind": "javascript-module", "path": "components/bottom-app-bar/index.js", "declarations": [ { "kind": "class", "description": "", "name": "BottomAppBar", "cssProperties": [ { "description": "组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)", "name": "--shape-corner" }, { "description": "组件的 CSS `z-index` 值", "name": "--z-index" } ], "slots": [ { "description": "底部应用栏内部的元素", "name": "" } ], "members": [ { "kind": "field", "name": "hide", "type": { "text": "boolean" }, "privacy": "public", "default": "false", "description": "是否隐藏", "attribute": "hide", "reflects": true }, { "kind": "field", "name": "fabDetach", "type": { "text": "boolean" }, "privacy": "public", "default": "false", "description": "是否让底部应用栏中的 [`<mdui-fab>`](/docs/2/components/fab) 组件脱离应用栏。如果为 `true`,则当应用栏隐藏后,[`<mdui-fab>`](/docs/2/components/fab) 仍会停留在页面上", "attribute": "fab-detach", "reflects": true }, { "kind": "field", "name": "scrollBehavior", "type": { "text": "'hide' | 'shrink' | 'elevate' | undefined" }, "privacy": "public", "description": "滚动行为。可选值为:\n\n* `hide`:滚动时隐藏", "attribute": "scroll-behavior", "reflects": true, "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "scrollPaddingPosition", "type": { "text": "ScrollPaddingPosition" }, "privacy": "protected", "description": "滚动时,如果需要给 container 添加 padding,添加在顶部还是底部", "readonly": true, "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "layoutPlacement", "type": { "text": "LayoutPlacement" }, "privacy": "protected", "description": "当前布局组件所处的位置,父类必须实现该 getter", "readonly": true, "inheritedFrom": { "name": "LayoutItemBase", "module": "components/layout/layout-item-base.js" } }, { "kind": "method", "name": "runScrollThreshold", "privacy": "protected", "parameters": [ { "name": "isScrollingUp", "type": { "text": "boolean" } } ], "description": "滚动行为\n当前仅支持 hide 这一个行为,所以不做行为类型判断", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "scrollTarget", "type": { "text": "string | HTMLElement | JQ<HTMLElement> | undefined" }, "privacy": "public", "description": "需要监听其滚动事件的元素。值可以是 CSS 选择器、DOM 元素、或 [JQ 对象](/docs/2/functions/jq)。默认监听 `window` 的滚动事件", "attribute": "scroll-target", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "scrollThreshold", "type": { "text": "number | undefined" }, "privacy": "public", "description": "在滚动多少距离之后触发滚动行为,单位为 `px`", "attribute": "scroll-threshold", "reflects": true, "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "scrollBehaviorDefinedController", "privacy": "protected", "default": "new DefinedController(this, { needDomReady: true, })", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "lastScrollTopThreshold", "type": { "text": "number" }, "privacy": "private", "default": "0", "description": "上次滚动后,垂直方向的距离(滚动距离超过 scrollThreshold 才记录)", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "lastScrollTopNoThreshold", "type": { "text": "number" }, "privacy": "private", "default": "0", "description": "上次滚动后,垂直方向的距离(无视 scrollThreshold,始终记录)", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "field", "name": "isParentLayout", "type": { "text": "boolean" }, "privacy": "protected", "default": "false", "description": "父元素是否是 `mdui-layout`", "inheritedFrom": { "name": "LayoutItemBase", "module": "components/layout/layout-item-base.js" } }, { "kind": "method", "name": "onScrollTargetChange", "privacy": "private", "parameters": [ { "name": "oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ], "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "method", "name": "onScrollBehaviorChange", "privacy": "private", "parameters": [ { "name": "oldValue", "type": { "text": "string" } }, { "name": "newValue", "type": { "text": "string" } } ], "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "method", "name": "hasScrollBehavior", "privacy": "protected", "return": { "type": { "text": "boolean" } }, "parameters": [ { "name": "behavior", "type": { "text": "ScrollBehavior | ScrollBehavior[]" }, "description": "为数组时,只要其中一个行为在 scrollBehavior 中,即返回 `true`" } ], "description": "scrollBehavior 包含多个滚动行为,用空格分割\n用该方法判断指定滚动行为是否在 scrollBehavior 中", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "method", "name": "runScrollNoThreshold", "privacy": "protected", "parameters": [ { "name": "isScrollingUp", "type": { "text": "boolean" }, "description": "是否向上滚动" }, { "name": "scrollTop", "type": { "text": "number" }, "description": "距离 scrollTarget 顶部的距离" } ], "description": "执行滚动事件,会无视 scrollThreshold,始终会执行", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "method", "name": "updateContainerPadding", "privacy": "protected", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "withPadding", "default": "true", "description": "该值为 false 时,为移除 padding" } ], "description": "更新滚动容器的 padding,避免内容被 navigation-bar 覆盖\n仅 scrollBehavior 包含 hide、shrink 时,添加 padding", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "method", "name": "onListeningScroll", "privacy": "private", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "method", "name": "onScroll", "privacy": "private", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "listening", "type": { "text": "HTMLElement | Window" } } ], "description": "滚动事件,这里过滤掉不符合条件的滚动", "inheritedFrom": { "name": "ScrollBehaviorMixin", "module": "@mdui/shared/mixins/scrollBehavior.js" } }, { "kind": "method", "name": "updateScrollTop", "privacy": "private", "return": { "type": { "text": "void" } }, "parameters": [ { "name": "listening", "type": { "text": "HTMLElement | Window" } } ], "description": "重新更新 lastScrollTopThreshold、lastScrollTopNoThreshold 的值\n用于在 scrollTarget、scrollBehavior 变更时,重新设置 lastScrollTopThreshold、lastScrollTopNoThreshold 的初始值", "inheritedFrom": { "name": "ScrollBehaviorMixin",