fix: 本地 patch MDUI 以解决 tabindex = 0 导致的一系列玄学问题
This commit is contained in:
32
client/mdui_patched/components/linear-progress/index.d.ts
vendored
Normal file
32
client/mdui_patched/components/linear-progress/index.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
||||
import type { CSSResultGroup, TemplateResult } from 'lit';
|
||||
/**
|
||||
* @summary 线性进度指示器组件
|
||||
*
|
||||
* ```html
|
||||
* <mdui-linear-progress></mdui-linear-progress>
|
||||
* ```
|
||||
*
|
||||
* @csspart indicator - 指示器部分
|
||||
*
|
||||
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
||||
*/
|
||||
export declare class LinearProgress extends MduiElement<LinearProgressEventMap> {
|
||||
static styles: CSSResultGroup;
|
||||
/**
|
||||
* 进度指示器的最大值。默认为 `1`
|
||||
*/
|
||||
max: number;
|
||||
/**
|
||||
* 进度指示器的当前值。如果未指定该值,则处于不确定状态
|
||||
*/
|
||||
value?: number;
|
||||
protected render(): TemplateResult;
|
||||
}
|
||||
export interface LinearProgressEventMap {
|
||||
}
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'mdui-linear-progress': LinearProgress;
|
||||
}
|
||||
}
|
||||
49
client/mdui_patched/components/linear-progress/index.js
Normal file
49
client/mdui_patched/components/linear-progress/index.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { __decorate } from "tslib";
|
||||
import { html } from 'lit';
|
||||
import { customElement, property } from 'lit/decorators.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
import { isUndefined } from '@mdui/jq/shared/helper.js';
|
||||
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
||||
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
||||
import { style } from './style.js';
|
||||
/**
|
||||
* @summary 线性进度指示器组件
|
||||
*
|
||||
* ```html
|
||||
* <mdui-linear-progress></mdui-linear-progress>
|
||||
* ```
|
||||
*
|
||||
* @csspart indicator - 指示器部分
|
||||
*
|
||||
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
||||
*/
|
||||
let LinearProgress = class LinearProgress extends MduiElement {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
/**
|
||||
* 进度指示器的最大值。默认为 `1`
|
||||
*/
|
||||
this.max = 1;
|
||||
}
|
||||
render() {
|
||||
const isDeterminate = !isUndefined(this.value);
|
||||
if (isDeterminate) {
|
||||
const value = this.value;
|
||||
return html `<div part="indicator" class="determinate" style="${styleMap({
|
||||
width: `${(value / Math.max(this.max ?? value, value)) * 100}%`,
|
||||
})}"></div>`;
|
||||
}
|
||||
return html `<div part="indicator" class="indeterminate"></div>`;
|
||||
}
|
||||
};
|
||||
LinearProgress.styles = [componentStyle, style];
|
||||
__decorate([
|
||||
property({ type: Number, reflect: true })
|
||||
], LinearProgress.prototype, "max", void 0);
|
||||
__decorate([
|
||||
property({ type: Number })
|
||||
], LinearProgress.prototype, "value", void 0);
|
||||
LinearProgress = __decorate([
|
||||
customElement('mdui-linear-progress')
|
||||
], LinearProgress);
|
||||
export { LinearProgress };
|
||||
1
client/mdui_patched/components/linear-progress/style.d.ts
vendored
Normal file
1
client/mdui_patched/components/linear-progress/style.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const style: import("lit").CSSResult;
|
||||
2
client/mdui_patched/components/linear-progress/style.js
Normal file
2
client/mdui_patched/components/linear-progress/style.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import { css } from 'lit';
|
||||
export const style = css `:host{--shape-corner:var(--mdui-shape-corner-none);position:relative;display:inline-block;width:100%;overflow:hidden;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container-highest));height:.25rem}.determinate,.indeterminate{background-color:rgb(var(--mdui-color-primary))}.determinate{height:100%;transition:width var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate::before{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate 2s var(--mdui-motion-easing-linear) infinite;content:' '}.indeterminate::after{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate-short 2s var(--mdui-motion-easing-linear) infinite;content:' '}@keyframes mdui-comp-progress-indeterminate{0%{left:0;width:0}50%{left:30%;width:70%}75%{left:100%;width:0}}@keyframes mdui-comp-progress-indeterminate-short{0%{left:0;width:0}50%{left:0;width:0}75%{left:0;width:25%}100%{left:100%;width:0}}`;
|
||||
Reference in New Issue
Block a user