urnovl-web-components 0.0.81 → 0.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/button-base-91029a09.js +304 -0
- package/dist/cjs/button-base-91029a09.js.map +1 -0
- package/dist/cjs/index-7381c6b8.js +320 -0
- package/dist/cjs/index-7381c6b8.js.map +1 -0
- package/dist/cjs/{index-7073bfb2.js → index-97f5d458.js} +23 -22
- package/dist/cjs/index-97f5d458.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{button-base-d245378c.js → ripple-mixin-039d4676.js} +4 -301
- package/dist/cjs/ripple-mixin-039d4676.js.map +1 -0
- package/dist/cjs/ur-button-arrow-left_2.cjs.entry.js +27 -26
- package/dist/cjs/ur-button-arrow-left_2.cjs.entry.js.map +1 -1
- package/dist/cjs/ur-button.cjs.entry.js +29 -0
- package/dist/cjs/ur-button.cjs.entry.js.map +1 -0
- package/dist/cjs/ur-checkbox.cjs.entry.js +27 -0
- package/dist/cjs/ur-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/ur-loader.cjs.entry.js +1 -1
- package/dist/cjs/ur-locale-filter-button.cjs.entry.js +4 -3
- package/dist/cjs/ur-locale-filter-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ur-locale-filter-panel.cjs.entry.js +8 -320
- package/dist/cjs/ur-locale-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/ur-novl-carousel.cjs.entry.js +1 -1
- package/dist/cjs/ur-novl.cjs.entry.js +3 -3
- package/dist/cjs/ur-profile.cjs.entry.js +6 -5
- package/dist/cjs/ur-profile.cjs.entry.js.map +1 -1
- package/dist/cjs/ur-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/urnovl-web-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ur-button/ur-button.css +7 -0
- package/dist/collection/components/ur-button/ur-button.js +102 -0
- package/dist/collection/components/ur-button/ur-button.js.map +1 -0
- package/dist/collection/components/ur-button-arrow-left/ur-button-arrow-left.js +1 -1
- package/dist/collection/components/ur-button-arrow-right/ur-button-arrow-right.js +1 -1
- package/dist/collection/components/ur-checkbox/ur-checkbox.css +3 -0
- package/dist/collection/components/ur-checkbox/ur-checkbox.js +64 -0
- package/dist/collection/components/ur-checkbox/ur-checkbox.js.map +1 -0
- package/dist/collection/components/ur-loader/ur-loader.js +1 -1
- package/dist/collection/components/ur-locale-filter-button/ur-locale-filter-button.js +1 -1
- package/dist/collection/components/ur-locale-filter-panel/ur-locale-filter-panel.css +20 -3
- package/dist/collection/components/ur-locale-filter-panel/ur-locale-filter-panel.js +2 -2
- package/dist/collection/components/ur-locale-filter-panel/ur-locale-filter-panel.js.map +1 -1
- package/dist/collection/components/ur-novl/ur-novl.js +3 -3
- package/dist/collection/components/ur-novl-carousel/ur-novl-carousel.js +1 -1
- package/dist/collection/components/ur-profile/ur-profile.js +3 -3
- package/dist/collection/components/ur-user-profile/ur-user-profile.js +1 -1
- package/dist/collection/stories/Buttons.stories.js +56 -0
- package/dist/collection/stories/Buttons.stories.js.map +1 -1
- package/dist/collection/stories/Checkboxes.stories.js +34 -0
- package/dist/collection/stories/Checkboxes.stories.js.map +1 -0
- package/dist/components/{p-8d317ae7.js → p-04200444.js} +3 -3
- package/dist/components/{p-8d317ae7.js.map → p-04200444.js.map} +1 -1
- package/dist/components/{p-d617ec5b.js → p-2f7a77dc.js} +3 -2
- package/dist/components/p-2f7a77dc.js.map +1 -0
- package/dist/components/p-40c5666d.js +301 -0
- package/dist/components/p-40c5666d.js.map +1 -0
- package/dist/components/{p-44e60664.js → p-5042260e.js} +3 -2
- package/dist/components/p-5042260e.js.map +1 -0
- package/dist/components/{p-4e440d42.js → p-63eff32a.js} +4 -4
- package/dist/components/{p-4e440d42.js.map → p-63eff32a.js.map} +1 -1
- package/dist/components/{p-f321fb39.js → p-69a0abad.js} +3 -3
- package/dist/components/{p-f321fb39.js.map → p-69a0abad.js.map} +1 -1
- package/dist/{esm/button-base-1f8dc1c6.js → components/p-c0137a00.js} +4 -300
- package/dist/components/p-c0137a00.js.map +1 -0
- package/dist/components/p-f1a968b2.js +318 -0
- package/dist/components/p-f1a968b2.js.map +1 -0
- package/dist/components/ur-button-arrow-left.js +1 -1
- package/dist/components/ur-button-arrow-right.js +1 -1
- package/dist/components/ur-button.d.ts +11 -0
- package/dist/components/ur-button.js +47 -0
- package/dist/components/ur-button.js.map +1 -0
- package/dist/components/ur-checkbox.d.ts +11 -0
- package/dist/components/ur-checkbox.js +43 -0
- package/dist/components/ur-checkbox.js.map +1 -0
- package/dist/components/ur-loader.js +1 -1
- package/dist/components/ur-locale-filter-button.js +2 -2
- package/dist/components/ur-locale-filter-panel.js +7 -322
- package/dist/components/ur-locale-filter-panel.js.map +1 -1
- package/dist/components/ur-novl-carousel.js +4 -4
- package/dist/components/ur-novl.js +1 -1
- package/dist/components/ur-profile.js +4 -4
- package/dist/components/ur-user-profile.js +1 -1
- package/dist/esm/button-base-bfdb3113.js +301 -0
- package/dist/esm/button-base-bfdb3113.js.map +1 -0
- package/dist/esm/{index-7b83adf4.js → index-9ab96733.js} +3 -2
- package/dist/esm/index-9ab96733.js.map +1 -0
- package/dist/esm/index-f1ce3a40.js +318 -0
- package/dist/esm/index-f1ce3a40.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/{components/p-112b399c.js → esm/ripple-mixin-b59b19bf.js} +2390 -2686
- package/dist/esm/ripple-mixin-b59b19bf.js.map +1 -0
- package/dist/esm/ur-button-arrow-left_2.entry.js +4 -3
- package/dist/esm/ur-button-arrow-left_2.entry.js.map +1 -1
- package/dist/esm/ur-button.entry.js +25 -0
- package/dist/esm/ur-button.entry.js.map +1 -0
- package/dist/esm/ur-checkbox.entry.js +23 -0
- package/dist/esm/ur-checkbox.entry.js.map +1 -0
- package/dist/esm/ur-loader.entry.js +1 -1
- package/dist/esm/ur-locale-filter-button.entry.js +4 -3
- package/dist/esm/ur-locale-filter-button.entry.js.map +1 -1
- package/dist/esm/ur-locale-filter-panel.entry.js +11 -323
- package/dist/esm/ur-locale-filter-panel.entry.js.map +1 -1
- package/dist/esm/ur-novl-carousel.entry.js +1 -1
- package/dist/esm/ur-novl.entry.js +3 -3
- package/dist/esm/ur-profile.entry.js +6 -5
- package/dist/esm/ur-profile.entry.js.map +1 -1
- package/dist/esm/ur-user-profile.entry.js +1 -1
- package/dist/esm/urnovl-web-components.js +1 -1
- package/dist/types/components/ur-button/ur-button.d.ts +8 -0
- package/dist/types/components/ur-checkbox/ur-checkbox.d.ts +6 -0
- package/dist/types/components.d.ts +38 -0
- package/dist/types/stories/Buttons.stories.d.ts +41 -0
- package/dist/types/stories/Checkboxes.stories.d.ts +28 -0
- package/dist/urnovl-web-components/{p-90352e64.entry.js → p-163d6d1a.entry.js} +2 -2
- package/dist/urnovl-web-components/p-222b9610.entry.js +2 -0
- package/dist/urnovl-web-components/p-222b9610.entry.js.map +1 -0
- package/dist/urnovl-web-components/p-2f7a77dc.js +4 -0
- package/dist/urnovl-web-components/{p-8fc24cd3.js.map → p-2f7a77dc.js.map} +1 -1
- package/dist/urnovl-web-components/p-3e1c832c.entry.js +2 -0
- package/dist/urnovl-web-components/p-3e1c832c.entry.js.map +1 -0
- package/dist/urnovl-web-components/p-40c5666d.js +2 -0
- package/dist/urnovl-web-components/p-40c5666d.js.map +1 -0
- package/dist/urnovl-web-components/p-7276bbf7.entry.js +2 -0
- package/dist/urnovl-web-components/p-88706665.entry.js +2 -0
- package/dist/urnovl-web-components/{p-8903759a.entry.js.map → p-88706665.entry.js.map} +1 -1
- package/dist/urnovl-web-components/{p-8d9be614.entry.js → p-b83b816f.entry.js} +2 -2
- package/dist/urnovl-web-components/p-c0137a00.js +92 -0
- package/dist/urnovl-web-components/p-c0137a00.js.map +1 -0
- package/dist/urnovl-web-components/p-c506300f.entry.js +2 -0
- package/dist/urnovl-web-components/p-c506300f.entry.js.map +1 -0
- package/dist/urnovl-web-components/p-c66441f9.entry.js +2 -0
- package/dist/urnovl-web-components/{p-c6fc77f7.entry.js.map → p-c66441f9.entry.js.map} +1 -1
- package/dist/urnovl-web-components/{p-540d6120.entry.js → p-d867747d.entry.js} +2 -2
- package/dist/urnovl-web-components/p-d990c5dc.entry.js +4 -0
- package/dist/urnovl-web-components/{p-01ce85a0.entry.js.map → p-d990c5dc.entry.js.map} +1 -1
- package/dist/urnovl-web-components/p-f1a968b2.js +7 -0
- package/dist/urnovl-web-components/p-f1a968b2.js.map +1 -0
- package/dist/urnovl-web-components/urnovl-web-components.esm.js +1 -1
- package/dist/urnovl-web-components/urnovl-web-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/button-base-d245378c.js.map +0 -1
- package/dist/cjs/index-7073bfb2.js.map +0 -1
- package/dist/components/p-112b399c.js.map +0 -1
- package/dist/components/p-44e60664.js.map +0 -1
- package/dist/components/p-d617ec5b.js.map +0 -1
- package/dist/esm/button-base-1f8dc1c6.js.map +0 -1
- package/dist/esm/index-7b83adf4.js.map +0 -1
- package/dist/urnovl-web-components/p-01ce85a0.entry.js +0 -4
- package/dist/urnovl-web-components/p-3bdfbfd3.js +0 -92
- package/dist/urnovl-web-components/p-3bdfbfd3.js.map +0 -1
- package/dist/urnovl-web-components/p-8903759a.entry.js +0 -2
- package/dist/urnovl-web-components/p-8fc24cd3.js +0 -4
- package/dist/urnovl-web-components/p-c5f0d9a9.entry.js +0 -2
- package/dist/urnovl-web-components/p-c6fc77f7.entry.js +0 -2
- package/dist/urnovl-web-components/p-e01ce908.entry.js +0 -7
- package/dist/urnovl-web-components/p-e01ce908.entry.js.map +0 -1
- /package/dist/urnovl-web-components/{p-90352e64.entry.js.map → p-163d6d1a.entry.js.map} +0 -0
- /package/dist/urnovl-web-components/{p-c5f0d9a9.entry.js.map → p-7276bbf7.entry.js.map} +0 -0
- /package/dist/urnovl-web-components/{p-8d9be614.entry.js.map → p-b83b816f.entry.js.map} +0 -0
- /package/dist/urnovl-web-components/{p-540d6120.entry.js.map → p-d867747d.entry.js.map} +0 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const rippleMixin = require('./ripple-mixin-039d4676.js');
|
|
4
|
+
|
|
5
|
+
const nothingTemplate = rippleMixin.ke `${rippleMixin.D}`;
|
|
6
|
+
|
|
7
|
+
function cc(names) {
|
|
8
|
+
if (typeof names === "string" || typeof names === "number") return "" + names
|
|
9
|
+
|
|
10
|
+
let out = "";
|
|
11
|
+
|
|
12
|
+
if (Array.isArray(names)) {
|
|
13
|
+
for (let i = 0, tmp; i < names.length; i++) {
|
|
14
|
+
if ((tmp = cc(names[i])) !== "") {
|
|
15
|
+
out += (out && " ") + tmp;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
for (let k in names) {
|
|
20
|
+
if (names[k]) out += (out && " ") + k;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return out
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const AnchorMixin = (superclass) => {
|
|
28
|
+
class AnchorMixinClass extends superclass {
|
|
29
|
+
renderAnchor({ id, className, part, content = rippleMixin.ke `<slot></slot>`, refDirective, tabIndex, }) {
|
|
30
|
+
return rippleMixin.ke `<a ${refDirective} id="${rippleMixin.to(id)}" class="_a ${className ? className : ''}" part="${rippleMixin.to(part)}" href="${rippleMixin.to(this.href)}" download="${rippleMixin.to(this.download)}" target="${rippleMixin.to(this.target)}" rel="${rippleMixin.to(this.rel)}" tabindex="${rippleMixin.to(tabIndex)}">${content}</a>`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
rippleMixin.__decorate([
|
|
34
|
+
rippleMixin.n({ reflect: true })
|
|
35
|
+
], AnchorMixinClass.prototype, "href", void 0);
|
|
36
|
+
rippleMixin.__decorate([
|
|
37
|
+
rippleMixin.n({ reflect: true })
|
|
38
|
+
], AnchorMixinClass.prototype, "download", void 0);
|
|
39
|
+
rippleMixin.__decorate([
|
|
40
|
+
rippleMixin.n({ reflect: true })
|
|
41
|
+
], AnchorMixinClass.prototype, "target", void 0);
|
|
42
|
+
rippleMixin.__decorate([
|
|
43
|
+
rippleMixin.n({ reflect: true })
|
|
44
|
+
], AnchorMixinClass.prototype, "rel", void 0);
|
|
45
|
+
return AnchorMixinClass;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const style = rippleMixin.i `:host{position:relative;display:inline-block;flex-shrink:0;width:2.5rem;height:2.5rem;stroke:rgb(var(--mdui-color-primary))}.progress{position:relative;display:inline-block;width:100%;height:100%;text-align:left;transition:opacity var(--mdui-motion-duration-medium1) var(--mdui-motion-easing-linear)}.determinate svg{transform:rotate(-90deg);fill:transparent}.determinate .track{stroke:transparent}.determinate .circle{stroke:inherit;transition:stroke-dashoffset var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate{font-size:0;letter-spacing:0;white-space:nowrap;animation:mdui-comp-circular-progress-rotate 1568ms var(--mdui-motion-easing-linear) infinite}.indeterminate .circle,.indeterminate .layer{position:absolute;width:100%;height:100%}.indeterminate .layer{animation:mdui-comp-circular-progress-layer-rotate 5332ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .circle{fill:transparent;stroke:inherit}.indeterminate .gap-patch{position:absolute;top:0;left:47.5%;width:5%;height:100%;overflow:hidden}.indeterminate .gap-patch .circle{left:-900%;width:2000%;transform:rotate(180deg)}.indeterminate .clipper{position:relative;display:inline-block;width:50%;height:100%;overflow:hidden}.indeterminate .clipper .circle{width:200%}.indeterminate .clipper.left .circle{animation:mdui-comp-circular-progress-left-spin 1333ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .clipper.right .circle{left:-100%;animation:mdui-comp-circular-progress-right-spin 1333ms var(--mdui-motion-easing-standard) infinite both}@keyframes mdui-comp-circular-progress-rotate{to{transform:rotate(360deg)}}@keyframes mdui-comp-circular-progress-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdui-comp-circular-progress-left-spin{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes mdui-comp-circular-progress-right-spin{0%{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}100%{transform:rotate(-265deg)}}`;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @summary 圆形进度指示器组件
|
|
52
|
+
*
|
|
53
|
+
* ```html
|
|
54
|
+
* <mdui-circular-progress></mdui-circular-progress>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
let CircularProgress = class CircularProgress extends rippleMixin.MduiElement {
|
|
58
|
+
constructor() {
|
|
59
|
+
super(...arguments);
|
|
60
|
+
/**
|
|
61
|
+
* 进度指示器的最大值。默认为 `1`
|
|
62
|
+
*/
|
|
63
|
+
this.max = 1;
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const isDeterminate = !rippleMixin.isUndefined(this.value);
|
|
67
|
+
return rippleMixin.ke `<div class="progress ${rippleMixin.Rt({
|
|
68
|
+
determinate: isDeterminate,
|
|
69
|
+
indeterminate: !isDeterminate,
|
|
70
|
+
})}">${isDeterminate ? this.renderDeterminate() : this.renderInDeterminate()}</div>`;
|
|
71
|
+
}
|
|
72
|
+
renderDeterminate() {
|
|
73
|
+
const value = this.value;
|
|
74
|
+
const strokeWidth = 4; // 圆环宽度
|
|
75
|
+
const circleRadius = 18; // 圆环宽度中心点的半径
|
|
76
|
+
const π = 3.1415926;
|
|
77
|
+
const center = circleRadius + strokeWidth / 2;
|
|
78
|
+
const circumference = 2 * π * circleRadius;
|
|
79
|
+
const determinateStrokeDashOffset = (1 - value / Math.max(this.max ?? value, value)) * circumference;
|
|
80
|
+
return rippleMixin.ke `<svg viewBox="0 0 ${center * 2} ${center * 2}"><circle class="track" cx="${center}" cy="${center}" r="${circleRadius}" stroke-width="${strokeWidth}"></circle><circle class="circle" cx="${center}" cy="${center}" r="${circleRadius}" stroke-dasharray="${2 * π * circleRadius}" stroke-dashoffset="${determinateStrokeDashOffset}" stroke-width="${strokeWidth}"></circle></svg>`;
|
|
81
|
+
}
|
|
82
|
+
renderInDeterminate() {
|
|
83
|
+
const strokeWidth = 4; // 圆环宽度
|
|
84
|
+
const circleRadius = 18; // 圆环宽度中心点的半径
|
|
85
|
+
const π = 3.1415926;
|
|
86
|
+
const center = circleRadius + strokeWidth / 2;
|
|
87
|
+
const circumference = 2 * π * circleRadius;
|
|
88
|
+
const halfCircumference = 0.5 * circumference;
|
|
89
|
+
const circle = (thisStrokeWidth) => rippleMixin.ke `<svg class="circle" viewBox="0 0 ${center * 2} ${center * 2}"><circle cx="${center}" cy="${center}" r="${circleRadius}" stroke-dasharray="${circumference}" stroke-dashoffset="${halfCircumference}" stroke-width="${thisStrokeWidth}"></circle></svg>`;
|
|
90
|
+
return rippleMixin.ke `<div class="layer"><div class="clipper left">${circle(strokeWidth)}</div><div class="gap-patch">${circle(strokeWidth * 0.8)}</div><div class="clipper right">${circle(strokeWidth)}</div></div>`;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
CircularProgress.styles = [rippleMixin.componentStyle, style];
|
|
94
|
+
rippleMixin.__decorate([
|
|
95
|
+
rippleMixin.n({ type: Number, reflect: true })
|
|
96
|
+
], CircularProgress.prototype, "max", void 0);
|
|
97
|
+
rippleMixin.__decorate([
|
|
98
|
+
rippleMixin.n({ type: Number })
|
|
99
|
+
], CircularProgress.prototype, "value", void 0);
|
|
100
|
+
CircularProgress = rippleMixin.__decorate([
|
|
101
|
+
rippleMixin.t('mdui-circular-progress')
|
|
102
|
+
], CircularProgress);
|
|
103
|
+
|
|
104
|
+
const buttonBaseStyle = rippleMixin.i `.button{position:relative;display:inline-flex;align-items:center;justify-content:center;height:100%;padding:0;overflow:hidden;color:inherit;font-size:inherit;font-family:inherit;font-weight:inherit;letter-spacing:inherit;white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background:0 0;border:none;outline:0;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}`;
|
|
105
|
+
|
|
106
|
+
class ButtonBase extends AnchorMixin(rippleMixin.RippleMixin(rippleMixin.FocusableMixin(rippleMixin.MduiElement))) {
|
|
107
|
+
constructor() {
|
|
108
|
+
super(...arguments);
|
|
109
|
+
/**
|
|
110
|
+
* 是否禁用
|
|
111
|
+
*/
|
|
112
|
+
this.disabled = false;
|
|
113
|
+
/**
|
|
114
|
+
* 是否处于加载中状态
|
|
115
|
+
*/
|
|
116
|
+
this.loading = false;
|
|
117
|
+
/**
|
|
118
|
+
* 按钮的名称,将与表单数据一起提交。
|
|
119
|
+
*
|
|
120
|
+
* **Note**:仅在未设置 `href` 属性时,此属性才有效。
|
|
121
|
+
*/
|
|
122
|
+
this.name = '';
|
|
123
|
+
/**
|
|
124
|
+
* 按钮的初始值,将与表单数据一起提交。
|
|
125
|
+
*
|
|
126
|
+
* **Note**:仅在未设置 `href` 属性时,此属性才有效。
|
|
127
|
+
*/
|
|
128
|
+
this.value = '';
|
|
129
|
+
/**
|
|
130
|
+
* 按钮的类型。默认类型为 `button`。可选类型包括:
|
|
131
|
+
*
|
|
132
|
+
* * `submit`:点击按钮会提交表单数据到服务器
|
|
133
|
+
* * `reset`:点击按钮会将表单中的所有字段重置为初始值
|
|
134
|
+
* * `button`:此类型的按钮没有默认行为
|
|
135
|
+
*
|
|
136
|
+
* **Note**:仅在未指定 `href` 属性时,此属性才有效。
|
|
137
|
+
*/
|
|
138
|
+
this.type = 'button';
|
|
139
|
+
/**
|
|
140
|
+
* 如果设置了此属性,表单提交时将不执行表单验证。
|
|
141
|
+
*
|
|
142
|
+
* 如果设置了此属性,将覆盖 `<form>` 元素的 `novalidate` 属性。
|
|
143
|
+
*
|
|
144
|
+
* **Note**:仅在未设置 `href` 属性且 `type="submit"` 时,此属性才有效。
|
|
145
|
+
*/
|
|
146
|
+
this.formNoValidate = false;
|
|
147
|
+
this.formController = new rippleMixin.FormController(this);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
151
|
+
*/
|
|
152
|
+
get validity() {
|
|
153
|
+
if (this.isButton()) {
|
|
154
|
+
return this.focusElement.validity;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
159
|
+
*/
|
|
160
|
+
get validationMessage() {
|
|
161
|
+
if (this.isButton()) {
|
|
162
|
+
return this.focusElement.validationMessage;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
get rippleDisabled() {
|
|
166
|
+
return this.disabled || this.loading;
|
|
167
|
+
}
|
|
168
|
+
get focusElement() {
|
|
169
|
+
return this.isButton()
|
|
170
|
+
? this.renderRoot?.querySelector('._button')
|
|
171
|
+
: !this.focusDisabled
|
|
172
|
+
? this.renderRoot?.querySelector('._a')
|
|
173
|
+
: this;
|
|
174
|
+
}
|
|
175
|
+
get focusDisabled() {
|
|
176
|
+
return this.disabled || this.loading;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
180
|
+
*/
|
|
181
|
+
checkValidity() {
|
|
182
|
+
if (this.isButton()) {
|
|
183
|
+
const valid = this.focusElement.checkValidity();
|
|
184
|
+
if (!valid) {
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
this.emit('invalid', {
|
|
187
|
+
bubbles: false,
|
|
188
|
+
cancelable: true,
|
|
189
|
+
composed: false,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return valid;
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
198
|
+
*
|
|
199
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
200
|
+
*/
|
|
201
|
+
reportValidity() {
|
|
202
|
+
if (this.isButton()) {
|
|
203
|
+
const invalid = !this.focusElement.reportValidity();
|
|
204
|
+
if (invalid) {
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
this.emit('invalid', {
|
|
207
|
+
bubbles: false,
|
|
208
|
+
cancelable: true,
|
|
209
|
+
composed: false,
|
|
210
|
+
});
|
|
211
|
+
// todo 考虑是否要支持 preventDefault() 方法,当前 invalid 状态没有样式
|
|
212
|
+
}
|
|
213
|
+
return !invalid;
|
|
214
|
+
}
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
219
|
+
*
|
|
220
|
+
* @param message 自定义的错误提示文本
|
|
221
|
+
*/
|
|
222
|
+
setCustomValidity(message) {
|
|
223
|
+
if (this.isButton()) {
|
|
224
|
+
this.focusElement.setCustomValidity(message);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
firstUpdated(_changedProperties) {
|
|
228
|
+
super.firstUpdated(_changedProperties);
|
|
229
|
+
this.addEventListener('click', () => {
|
|
230
|
+
if (this.type === 'submit') {
|
|
231
|
+
this.formController.submit(this);
|
|
232
|
+
}
|
|
233
|
+
if (this.type === 'reset') {
|
|
234
|
+
this.formController.reset(this);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
renderLoading() {
|
|
239
|
+
return this.loading
|
|
240
|
+
? rippleMixin.ke `<mdui-circular-progress part="loading"></mdui-circular-progress>`
|
|
241
|
+
: nothingTemplate;
|
|
242
|
+
}
|
|
243
|
+
renderButton({ id, className, part, content = rippleMixin.ke `<slot></slot>`, }) {
|
|
244
|
+
return rippleMixin.ke `<button id="${rippleMixin.to(id)}" class="${cc(['_button', className])}" part="${rippleMixin.to(part)}" ?disabled="${this.rippleDisabled || this.focusDisabled}">${content}</button>`;
|
|
245
|
+
}
|
|
246
|
+
isButton() {
|
|
247
|
+
return !this.href;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
ButtonBase.styles = [
|
|
251
|
+
rippleMixin.componentStyle,
|
|
252
|
+
buttonBaseStyle,
|
|
253
|
+
];
|
|
254
|
+
rippleMixin.__decorate([
|
|
255
|
+
rippleMixin.n({
|
|
256
|
+
type: Boolean,
|
|
257
|
+
reflect: true,
|
|
258
|
+
converter: rippleMixin.booleanConverter,
|
|
259
|
+
})
|
|
260
|
+
], ButtonBase.prototype, "disabled", void 0);
|
|
261
|
+
rippleMixin.__decorate([
|
|
262
|
+
rippleMixin.n({
|
|
263
|
+
type: Boolean,
|
|
264
|
+
reflect: true,
|
|
265
|
+
converter: rippleMixin.booleanConverter,
|
|
266
|
+
})
|
|
267
|
+
], ButtonBase.prototype, "loading", void 0);
|
|
268
|
+
rippleMixin.__decorate([
|
|
269
|
+
rippleMixin.n({ reflect: true })
|
|
270
|
+
], ButtonBase.prototype, "name", void 0);
|
|
271
|
+
rippleMixin.__decorate([
|
|
272
|
+
rippleMixin.n({ reflect: true })
|
|
273
|
+
], ButtonBase.prototype, "value", void 0);
|
|
274
|
+
rippleMixin.__decorate([
|
|
275
|
+
rippleMixin.n({ reflect: true })
|
|
276
|
+
], ButtonBase.prototype, "type", void 0);
|
|
277
|
+
rippleMixin.__decorate([
|
|
278
|
+
rippleMixin.n({ reflect: true })
|
|
279
|
+
], ButtonBase.prototype, "form", void 0);
|
|
280
|
+
rippleMixin.__decorate([
|
|
281
|
+
rippleMixin.n({ reflect: true, attribute: 'formaction' })
|
|
282
|
+
], ButtonBase.prototype, "formAction", void 0);
|
|
283
|
+
rippleMixin.__decorate([
|
|
284
|
+
rippleMixin.n({ reflect: true, attribute: 'formenctype' })
|
|
285
|
+
], ButtonBase.prototype, "formEnctype", void 0);
|
|
286
|
+
rippleMixin.__decorate([
|
|
287
|
+
rippleMixin.n({ reflect: true, attribute: 'formmethod' })
|
|
288
|
+
], ButtonBase.prototype, "formMethod", void 0);
|
|
289
|
+
rippleMixin.__decorate([
|
|
290
|
+
rippleMixin.n({
|
|
291
|
+
type: Boolean,
|
|
292
|
+
reflect: true,
|
|
293
|
+
converter: rippleMixin.booleanConverter,
|
|
294
|
+
attribute: 'formnovalidate',
|
|
295
|
+
})
|
|
296
|
+
], ButtonBase.prototype, "formNoValidate", void 0);
|
|
297
|
+
rippleMixin.__decorate([
|
|
298
|
+
rippleMixin.n({ reflect: true, attribute: 'formtarget' })
|
|
299
|
+
], ButtonBase.prototype, "formTarget", void 0);
|
|
300
|
+
|
|
301
|
+
exports.ButtonBase = ButtonBase;
|
|
302
|
+
exports.nothingTemplate = nothingTemplate;
|
|
303
|
+
|
|
304
|
+
//# sourceMappingURL=button-base-91029a09.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"button-base-91029a09.js","mappings":";;;;AACY,MAAC,eAAe,GAAGA,cAAI,CAAC,CAAC,EAAEC,aAAO,CAAC;;ACDhC,SAAS,EAAE,CAAC,KAAK,EAAE;AAClC,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK;AAC/E;AACA,EAAE,IAAI,GAAG,GAAG,GAAE;AACd;AACA,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAC5B,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAChD,MAAM,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE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AAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC/B,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AACzCD,sBAAU,CAAC;AACX,IAAIC,aAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AACxD,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/CD,sBAAU,CAAC;AACX,IAAIC,aAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;AACzD,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;AAChDD,sBAAU,CAAC;AACX,IAAIC,aAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AACxD,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/CD,sBAAU,CAAC;AACX,IAAIC,aAAQ,CAAC;AACb,QAAQ,IAAI,EAAE,OAAO;AACrB,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,SAAS,EAAEU,4BAAgB;AACnC,QAAQ,SAAS,EAAE,gBAAgB;AACnC,KAAK,CAAC;AACN,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC;AACnDX,sBAAU,CAAC;AACX,IAAIC,aAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AACxD,CAAC,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;;;;;","names":["html","nothing","ifDefined","__decorate","property","css","MduiElement","isUndefined","classMap","componentStyle","customElement","RippleMixin","FocusableMixin","FormController","booleanConverter"],"sources":["node_modules/@mdui/shared/helpers/template.js","node_modules/classcat/index.js","node_modules/@mdui/shared/mixins/anchor.js","node_modules/mdui/components/circular-progress/style.js","node_modules/mdui/components/circular-progress/index.js","node_modules/mdui/components/button/button-base-style.js","node_modules/mdui/components/button/button-base.js"],"sourcesContent":["import { html, nothing } from 'lit';\nexport const nothingTemplate = html `${nothing}`;\n","export default function cc(names) {\n if (typeof names === \"string\" || typeof names === \"number\") return \"\" + names\n\n let out = \"\"\n\n if (Array.isArray(names)) {\n for (let i = 0, tmp; i < names.length; i++) {\n if ((tmp = cc(names[i])) !== \"\") {\n out += (out && \" \") + tmp\n }\n }\n } else {\n for (let k in names) {\n if (names[k]) out += (out && \" \") + k\n }\n }\n\n return out\n}\n","import { __decorate } from \"tslib\";\nimport { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nexport const AnchorMixin = (superclass) => {\n class AnchorMixinClass extends superclass {\n renderAnchor({ id, className, part, content = html `<slot></slot>`, refDirective, tabIndex, }) {\n return html `<a ${refDirective} id=\"${ifDefined(id)}\" class=\"_a ${className ? className : ''}\" part=\"${ifDefined(part)}\" href=\"${ifDefined(this.href)}\" download=\"${ifDefined(this.download)}\" target=\"${ifDefined(this.target)}\" rel=\"${ifDefined(this.rel)}\" tabindex=\"${ifDefined(tabIndex)}\">${content}</a>`;\n }\n }\n __decorate([\n property({ reflect: true })\n ], AnchorMixinClass.prototype, \"href\", void 0);\n __decorate([\n property({ reflect: true })\n ], AnchorMixinClass.prototype, \"download\", void 0);\n __decorate([\n property({ reflect: true })\n ], AnchorMixinClass.prototype, \"target\", void 0);\n __decorate([\n property({ reflect: true })\n ], AnchorMixinClass.prototype, \"rel\", void 0);\n return AnchorMixinClass;\n};\n","import { css } from 'lit';\nexport const style = css `:host{position:relative;display:inline-block;flex-shrink:0;width:2.5rem;height:2.5rem;stroke:rgb(var(--mdui-color-primary))}.progress{position:relative;display:inline-block;width:100%;height:100%;text-align:left;transition:opacity var(--mdui-motion-duration-medium1) var(--mdui-motion-easing-linear)}.determinate svg{transform:rotate(-90deg);fill:transparent}.determinate .track{stroke:transparent}.determinate .circle{stroke:inherit;transition:stroke-dashoffset var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate{font-size:0;letter-spacing:0;white-space:nowrap;animation:mdui-comp-circular-progress-rotate 1568ms var(--mdui-motion-easing-linear) infinite}.indeterminate .circle,.indeterminate .layer{position:absolute;width:100%;height:100%}.indeterminate .layer{animation:mdui-comp-circular-progress-layer-rotate 5332ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .circle{fill:transparent;stroke:inherit}.indeterminate .gap-patch{position:absolute;top:0;left:47.5%;width:5%;height:100%;overflow:hidden}.indeterminate .gap-patch .circle{left:-900%;width:2000%;transform:rotate(180deg)}.indeterminate .clipper{position:relative;display:inline-block;width:50%;height:100%;overflow:hidden}.indeterminate .clipper .circle{width:200%}.indeterminate .clipper.left .circle{animation:mdui-comp-circular-progress-left-spin 1333ms var(--mdui-motion-easing-standard) infinite both}.indeterminate .clipper.right .circle{left:-100%;animation:mdui-comp-circular-progress-right-spin 1333ms var(--mdui-motion-easing-standard) infinite both}@keyframes mdui-comp-circular-progress-rotate{to{transform:rotate(360deg)}}@keyframes mdui-comp-circular-progress-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdui-comp-circular-progress-left-spin{0%{transform:rotate(265deg)}50%{transform:rotate(130deg)}100%{transform:rotate(265deg)}}@keyframes mdui-comp-circular-progress-right-spin{0%{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}100%{transform:rotate(-265deg)}}`;\n","import { __decorate } from \"tslib\";\nimport { html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { isUndefined } from '@mdui/jq/shared/helper.js';\nimport { MduiElement } from '@mdui/shared/base/mdui-element.js';\nimport { componentStyle } from '@mdui/shared/lit-styles/component-style.js';\nimport { style } from './style.js';\n/**\n * @summary 圆形进度指示器组件\n *\n * ```html\n * <mdui-circular-progress></mdui-circular-progress>\n * ```\n */\nlet CircularProgress = class CircularProgress extends MduiElement {\n constructor() {\n super(...arguments);\n /**\n * 进度指示器的最大值。默认为 `1`\n */\n this.max = 1;\n }\n render() {\n const isDeterminate = !isUndefined(this.value);\n return html `<div class=\"progress ${classMap({\n determinate: isDeterminate,\n indeterminate: !isDeterminate,\n })}\">${isDeterminate ? this.renderDeterminate() : this.renderInDeterminate()}</div>`;\n }\n renderDeterminate() {\n const value = this.value;\n const strokeWidth = 4; // 圆环宽度\n const circleRadius = 18; // 圆环宽度中心点的半径\n const π = 3.1415926;\n const center = circleRadius + strokeWidth / 2;\n const circumference = 2 * π * circleRadius;\n const determinateStrokeDashOffset = (1 - value / Math.max(this.max ?? value, value)) * circumference;\n return html `<svg viewBox=\"0 0 ${center * 2} ${center * 2}\"><circle class=\"track\" cx=\"${center}\" cy=\"${center}\" r=\"${circleRadius}\" stroke-width=\"${strokeWidth}\"></circle><circle class=\"circle\" cx=\"${center}\" cy=\"${center}\" r=\"${circleRadius}\" stroke-dasharray=\"${2 * π * circleRadius}\" stroke-dashoffset=\"${determinateStrokeDashOffset}\" stroke-width=\"${strokeWidth}\"></circle></svg>`;\n }\n renderInDeterminate() {\n const strokeWidth = 4; // 圆环宽度\n const circleRadius = 18; // 圆环宽度中心点的半径\n const π = 3.1415926;\n const center = circleRadius + strokeWidth / 2;\n const circumference = 2 * π * circleRadius;\n const halfCircumference = 0.5 * circumference;\n const circle = (thisStrokeWidth) => html `<svg class=\"circle\" viewBox=\"0 0 ${center * 2} ${center * 2}\"><circle cx=\"${center}\" cy=\"${center}\" r=\"${circleRadius}\" stroke-dasharray=\"${circumference}\" stroke-dashoffset=\"${halfCircumference}\" stroke-width=\"${thisStrokeWidth}\"></circle></svg>`;\n return html `<div class=\"layer\"><div class=\"clipper left\">${circle(strokeWidth)}</div><div class=\"gap-patch\">${circle(strokeWidth * 0.8)}</div><div class=\"clipper right\">${circle(strokeWidth)}</div></div>`;\n }\n};\nCircularProgress.styles = [componentStyle, style];\n__decorate([\n property({ type: Number, reflect: true })\n], CircularProgress.prototype, \"max\", void 0);\n__decorate([\n property({ type: Number })\n], CircularProgress.prototype, \"value\", void 0);\nCircularProgress = __decorate([\n customElement('mdui-circular-progress')\n], CircularProgress);\nexport { CircularProgress };\n","import { css } from 'lit';\nexport const buttonBaseStyle = css `.button{position:relative;display:inline-flex;align-items:center;justify-content:center;height:100%;padding:0;overflow:hidden;color:inherit;font-size:inherit;font-family:inherit;font-weight:inherit;letter-spacing:inherit;white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background:0 0;border:none;outline:0;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}`;\n","import { __decorate } from \"tslib\";\nimport { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport cc from 'classcat';\nimport { MduiElement } from '@mdui/shared/base/mdui-element.js';\nimport { FormController } from '@mdui/shared/controllers/form.js';\nimport { booleanConverter } from '@mdui/shared/helpers/decorator.js';\nimport { nothingTemplate } from '@mdui/shared/helpers/template.js';\nimport { componentStyle } from '@mdui/shared/lit-styles/component-style.js';\nimport { AnchorMixin } from '@mdui/shared/mixins/anchor.js';\nimport { FocusableMixin } from '@mdui/shared/mixins/focusable.js';\nimport '../circular-progress.js';\nimport { RippleMixin } from '../ripple/ripple-mixin.js';\nimport { buttonBaseStyle } from './button-base-style.js';\nexport class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) {\n constructor() {\n super(...arguments);\n /**\n * 是否禁用\n */\n this.disabled = false;\n /**\n * 是否处于加载中状态\n */\n this.loading = false;\n /**\n * 按钮的名称,将与表单数据一起提交。\n *\n * **Note**:仅在未设置 `href` 属性时,此属性才有效。\n */\n this.name = '';\n /**\n * 按钮的初始值,将与表单数据一起提交。\n *\n * **Note**:仅在未设置 `href` 属性时,此属性才有效。\n */\n this.value = '';\n /**\n * 按钮的类型。默认类型为 `button`。可选类型包括:\n *\n * * `submit`:点击按钮会提交表单数据到服务器\n * * `reset`:点击按钮会将表单中的所有字段重置为初始值\n * * `button`:此类型的按钮没有默认行为\n *\n * **Note**:仅在未指定 `href` 属性时,此属性才有效。\n */\n this.type = 'button';\n /**\n * 如果设置了此属性,表单提交时将不执行表单验证。\n *\n * 如果设置了此属性,将覆盖 `<form>` 元素的 `novalidate` 属性。\n *\n * **Note**:仅在未设置 `href` 属性且 `type=\"submit\"` 时,此属性才有效。\n */\n this.formNoValidate = false;\n this.formController = new FormController(this);\n }\n /**\n * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)\n */\n get validity() {\n if (this.isButton()) {\n return this.focusElement.validity;\n }\n }\n /**\n * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串\n */\n get validationMessage() {\n if (this.isButton()) {\n return this.focusElement.validationMessage;\n }\n }\n get rippleDisabled() {\n return this.disabled || this.loading;\n }\n get focusElement() {\n return this.isButton()\n ? this.renderRoot?.querySelector('._button')\n : !this.focusDisabled\n ? this.renderRoot?.querySelector('._a')\n : this;\n }\n get focusDisabled() {\n return this.disabled || this.loading;\n }\n /**\n * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`\n */\n checkValidity() {\n if (this.isButton()) {\n const valid = this.focusElement.checkValidity();\n if (!valid) {\n // @ts-ignore\n this.emit('invalid', {\n bubbles: false,\n cancelable: true,\n composed: false,\n });\n }\n return valid;\n }\n return true;\n }\n /**\n * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。\n *\n * 如果验证未通过,还会在组件上显示验证失败的提示。\n */\n reportValidity() {\n if (this.isButton()) {\n const invalid = !this.focusElement.reportValidity();\n if (invalid) {\n // @ts-ignore\n this.emit('invalid', {\n bubbles: false,\n cancelable: true,\n composed: false,\n });\n // todo 考虑是否要支持 preventDefault() 方法,当前 invalid 状态没有样式\n }\n return !invalid;\n }\n return true;\n }\n /**\n * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证\n *\n * @param message 自定义的错误提示文本\n */\n setCustomValidity(message) {\n if (this.isButton()) {\n this.focusElement.setCustomValidity(message);\n }\n }\n firstUpdated(_changedProperties) {\n super.firstUpdated(_changedProperties);\n this.addEventListener('click', () => {\n if (this.type === 'submit') {\n this.formController.submit(this);\n }\n if (this.type === 'reset') {\n this.formController.reset(this);\n }\n });\n }\n renderLoading() {\n return this.loading\n ? html `<mdui-circular-progress part=\"loading\"></mdui-circular-progress>`\n : nothingTemplate;\n }\n renderButton({ id, className, part, content = html `<slot></slot>`, }) {\n return html `<button id=\"${ifDefined(id)}\" class=\"${cc(['_button', className])}\" part=\"${ifDefined(part)}\" ?disabled=\"${this.rippleDisabled || this.focusDisabled}\">${content}</button>`;\n }\n isButton() {\n return !this.href;\n }\n}\nButtonBase.styles = [\n componentStyle,\n buttonBaseStyle,\n];\n__decorate([\n property({\n type: Boolean,\n reflect: true,\n converter: booleanConverter,\n })\n], ButtonBase.prototype, \"disabled\", void 0);\n__decorate([\n property({\n type: Boolean,\n reflect: true,\n converter: booleanConverter,\n })\n], ButtonBase.prototype, \"loading\", void 0);\n__decorate([\n property({ reflect: true })\n], ButtonBase.prototype, \"name\", void 0);\n__decorate([\n property({ reflect: true })\n], ButtonBase.prototype, \"value\", void 0);\n__decorate([\n property({ reflect: true })\n], ButtonBase.prototype, \"type\", void 0);\n__decorate([\n property({ reflect: true })\n], ButtonBase.prototype, \"form\", void 0);\n__decorate([\n property({ reflect: true, attribute: 'formaction' })\n], ButtonBase.prototype, \"formAction\", void 0);\n__decorate([\n property({ reflect: true, attribute: 'formenctype' })\n], ButtonBase.prototype, \"formEnctype\", void 0);\n__decorate([\n property({ reflect: true, attribute: 'formmethod' })\n], ButtonBase.prototype, \"formMethod\", void 0);\n__decorate([\n property({\n type: Boolean,\n reflect: true,\n converter: booleanConverter,\n attribute: 'formnovalidate',\n })\n], ButtonBase.prototype, \"formNoValidate\", void 0);\n__decorate([\n property({ reflect: true, attribute: 'formtarget' })\n], ButtonBase.prototype, \"formTarget\", void 0);\n"],"version":3}
|