@hbdlzy/ui-core 0.1.3 → 0.1.5
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/README.md +7 -0
- package/components.manifest.json +10 -0
- package/dist/components/BaseCard/BaseCard.types.d.ts +36 -36
- package/dist/components/BaseCard/BaseCard.vue.d.ts +122 -122
- package/dist/components/BaseCard/index.d.ts +3 -3
- package/dist/components/BaseEChart/BaseEChart.types.d.ts +26 -26
- package/dist/components/BaseEChart/BaseEChart.vue.d.ts +66 -66
- package/dist/components/BaseEChart/index.d.ts +3 -3
- package/dist/components/BaseExportButton/BaseExportButton.types.d.ts +21 -21
- package/dist/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -4
- package/dist/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -128
- package/dist/components/BaseExportButton/index.d.ts +5 -5
- package/dist/components/BaseTable/BaseTable.types.d.ts +163 -163
- package/dist/components/BaseTable/BaseTable.vue.d.ts +157 -157
- package/dist/components/BaseTable/index.d.ts +3 -3
- package/dist/components/OutlinedCascader/OutlinedCascader.types.d.ts +25 -25
- package/dist/components/OutlinedCascader/OutlinedCascader.vue.d.ts +85 -85
- package/dist/components/OutlinedCascader/index.d.ts +3 -3
- package/dist/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +27 -27
- package/dist/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +88 -88
- package/dist/components/OutlinedDatePicker/index.d.ts +3 -3
- package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +26 -26
- package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +97 -97
- package/dist/components/OutlinedDateTimePicker/index.d.ts +3 -3
- package/dist/components/OutlinedInput/OutlinedInput.types.d.ts +29 -29
- package/dist/components/OutlinedInput/OutlinedInput.vue.d.ts +97 -97
- package/dist/components/OutlinedInput/index.d.ts +3 -3
- package/dist/components/OutlinedSelect/OutlinedSelect.types.d.ts +38 -38
- package/dist/components/OutlinedSelect/OutlinedSelect.vue.d.ts +116 -116
- package/dist/components/OutlinedSelect/index.d.ts +3 -3
- package/dist/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +28 -28
- package/dist/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +94 -94
- package/dist/components/OutlinedTimePicker/index.d.ts +3 -3
- package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +46 -46
- package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +137 -137
- package/dist/components/OutlinedTreeSelect/index.d.ts +3 -3
- package/dist/echarts/index.d.ts +9 -9
- package/dist/excel/exportExcel.d.ts +18 -18
- package/dist/index.cjs +42 -1
- package/dist/index.d.ts +27 -26
- package/dist/index.js +169 -1
- package/dist/ripple/index.d.ts +2 -0
- package/package.json +6 -2
- package/src/index.ts +5 -0
- package/src/ripple/index.ts +213 -0
- package/src/components/BaseCard/BaseCard.types.d.ts +0 -36
- package/src/components/BaseCard/BaseCard.vue.d.ts +0 -122
- package/src/components/BaseCard/index.d.ts +0 -3
- package/src/components/BaseEChart/BaseEChart.types.d.ts +0 -26
- package/src/components/BaseEChart/BaseEChart.vue.d.ts +0 -66
- package/src/components/BaseEChart/index.d.ts +0 -3
- package/src/components/BaseExportButton/BaseExportButton.types.d.ts +0 -21
- package/src/components/BaseExportButton/BaseExportButton.utils.d.ts +0 -4
- package/src/components/BaseExportButton/BaseExportButton.vue.d.ts +0 -128
- package/src/components/BaseExportButton/index.d.ts +0 -5
- package/src/components/BaseTable/BaseTable.types.d.ts +0 -163
- package/src/components/BaseTable/BaseTable.vue.d.ts +0 -157
- package/src/components/BaseTable/index.d.ts +0 -3
- package/src/components/OutlinedCascader/OutlinedCascader.types.d.ts +0 -25
- package/src/components/OutlinedCascader/OutlinedCascader.vue.d.ts +0 -85
- package/src/components/OutlinedCascader/index.d.ts +0 -3
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +0 -27
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +0 -88
- package/src/components/OutlinedDatePicker/index.d.ts +0 -3
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +0 -26
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +0 -97
- package/src/components/OutlinedDateTimePicker/index.d.ts +0 -3
- package/src/components/OutlinedInput/OutlinedInput.types.d.ts +0 -29
- package/src/components/OutlinedInput/OutlinedInput.vue.d.ts +0 -97
- package/src/components/OutlinedInput/index.d.ts +0 -3
- package/src/components/OutlinedSelect/OutlinedSelect.types.d.ts +0 -38
- package/src/components/OutlinedSelect/OutlinedSelect.vue.d.ts +0 -116
- package/src/components/OutlinedSelect/index.d.ts +0 -3
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +0 -28
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +0 -94
- package/src/components/OutlinedTimePicker/index.d.ts +0 -3
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +0 -46
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +0 -137
- package/src/components/OutlinedTreeSelect/index.d.ts +0 -3
- package/src/echarts/index.d.ts +0 -9
- package/src/excel/exportExcel.d.ts +0 -18
- package/src/index.d.ts +0 -26
package/dist/index.js
CHANGED
|
@@ -4,6 +4,173 @@ import { defineComponent, useSlots, computed, openBlock, createElementBlock, nor
|
|
|
4
4
|
import { ElMessage } from "element-plus";
|
|
5
5
|
import ExcelJS from "exceljs";
|
|
6
6
|
import { saveAs } from "file-saver";
|
|
7
|
+
const HBDL_RIPPLE_KEY = "__HBDL_UI_RIPPLE__";
|
|
8
|
+
const RIPPLE_STYLE_ID = "hbdl-ui-ripple-style";
|
|
9
|
+
const RIPPLE_HOST_CLASS = "hbdl-ripple-host";
|
|
10
|
+
const RIPPLE_WAVE_CLASS = "hbdl-ripple__wave";
|
|
11
|
+
const RIPPLE_TARGET_SELECTOR = [
|
|
12
|
+
"button",
|
|
13
|
+
'[role="button"]',
|
|
14
|
+
".el-button",
|
|
15
|
+
".el-radio-button__inner",
|
|
16
|
+
".el-checkbox-button__inner"
|
|
17
|
+
].join(",");
|
|
18
|
+
const RIPPLE_DISABLED_SELECTOR = [
|
|
19
|
+
":disabled",
|
|
20
|
+
"[disabled]",
|
|
21
|
+
'[aria-disabled="true"]',
|
|
22
|
+
".is-disabled",
|
|
23
|
+
".is-loading"
|
|
24
|
+
].join(",");
|
|
25
|
+
const RIPPLE_SKIP_SELECTOR = '[data-hbdl-ripple="false"]';
|
|
26
|
+
const RIPPLE_STYLE = `
|
|
27
|
+
.${RIPPLE_HOST_CLASS} {
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
-webkit-tap-highlight-color: transparent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.${RIPPLE_HOST_CLASS} > .${RIPPLE_WAVE_CLASS} {
|
|
33
|
+
position: absolute;
|
|
34
|
+
left: var(--hbdl-ripple-x);
|
|
35
|
+
top: var(--hbdl-ripple-y);
|
|
36
|
+
width: var(--hbdl-ripple-size);
|
|
37
|
+
height: var(--hbdl-ripple-size);
|
|
38
|
+
border-radius: 999px;
|
|
39
|
+
background: var(--hbdl-ripple-color, currentColor);
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
opacity: 0;
|
|
42
|
+
transform: scale(0);
|
|
43
|
+
animation: hbdl-ripple-wave 560ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes hbdl-ripple-wave {
|
|
47
|
+
0% {
|
|
48
|
+
opacity: 0.22;
|
|
49
|
+
transform: scale(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
55% {
|
|
53
|
+
opacity: 0.18;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
100% {
|
|
57
|
+
opacity: 0;
|
|
58
|
+
transform: scale(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
.${RIPPLE_HOST_CLASS} > .${RIPPLE_WAVE_CLASS} {
|
|
64
|
+
animation-duration: 1ms;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
const noop = () => void 0;
|
|
69
|
+
function installRipple() {
|
|
70
|
+
if (!canUseDOM()) {
|
|
71
|
+
return noop;
|
|
72
|
+
}
|
|
73
|
+
const rippleWindow = window;
|
|
74
|
+
if (rippleWindow[HBDL_RIPPLE_KEY]) {
|
|
75
|
+
return rippleWindow[HBDL_RIPPLE_KEY].teardown;
|
|
76
|
+
}
|
|
77
|
+
injectRippleStyle();
|
|
78
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
79
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
80
|
+
const teardown = () => {
|
|
81
|
+
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
82
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
83
|
+
delete rippleWindow[HBDL_RIPPLE_KEY];
|
|
84
|
+
};
|
|
85
|
+
rippleWindow[HBDL_RIPPLE_KEY] = {
|
|
86
|
+
teardown
|
|
87
|
+
};
|
|
88
|
+
return teardown;
|
|
89
|
+
}
|
|
90
|
+
function uninstallRipple() {
|
|
91
|
+
var _a;
|
|
92
|
+
if (!canUseDOM()) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const rippleWindow = window;
|
|
96
|
+
(_a = rippleWindow[HBDL_RIPPLE_KEY]) == null ? void 0 : _a.teardown();
|
|
97
|
+
}
|
|
98
|
+
function canUseDOM() {
|
|
99
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
100
|
+
}
|
|
101
|
+
function injectRippleStyle() {
|
|
102
|
+
if (document.getElementById(RIPPLE_STYLE_ID)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const style = document.createElement("style");
|
|
106
|
+
style.id = RIPPLE_STYLE_ID;
|
|
107
|
+
style.textContent = RIPPLE_STYLE;
|
|
108
|
+
document.head.appendChild(style);
|
|
109
|
+
}
|
|
110
|
+
function handlePointerDown(event) {
|
|
111
|
+
if (event.defaultPrevented || event.button !== 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const target = findRippleTarget(event.target);
|
|
115
|
+
if (!target) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
createRipple(target, event.clientX, event.clientY);
|
|
119
|
+
}
|
|
120
|
+
function handleKeyDown(event) {
|
|
121
|
+
if (event.defaultPrevented || event.repeat || !isActivationKey(event.key)) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const target = findRippleTarget(event.target);
|
|
125
|
+
if (!target) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const rect = target.getBoundingClientRect();
|
|
129
|
+
createRipple(target, rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
130
|
+
}
|
|
131
|
+
function findRippleTarget(target) {
|
|
132
|
+
if (!(target instanceof Element)) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const rippleTarget = target.closest(RIPPLE_TARGET_SELECTOR);
|
|
136
|
+
if (!(rippleTarget instanceof HTMLElement)) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if (rippleTarget.closest(RIPPLE_SKIP_SELECTOR) || rippleTarget.closest(RIPPLE_DISABLED_SELECTOR)) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return rippleTarget;
|
|
143
|
+
}
|
|
144
|
+
function createRipple(target, clientX, clientY) {
|
|
145
|
+
const rect = target.getBoundingClientRect();
|
|
146
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const offsetX = clientX - rect.left;
|
|
150
|
+
const offsetY = clientY - rect.top;
|
|
151
|
+
const maxX = Math.max(offsetX, rect.width - offsetX);
|
|
152
|
+
const maxY = Math.max(offsetY, rect.height - offsetY);
|
|
153
|
+
const size = Math.ceil(Math.sqrt(maxX * maxX + maxY * maxY) * 2);
|
|
154
|
+
const ripple = document.createElement("span");
|
|
155
|
+
prepareRippleHost(target);
|
|
156
|
+
ripple.className = RIPPLE_WAVE_CLASS;
|
|
157
|
+
ripple.setAttribute("aria-hidden", "true");
|
|
158
|
+
ripple.style.setProperty("--hbdl-ripple-size", `${size}px`);
|
|
159
|
+
ripple.style.setProperty("--hbdl-ripple-x", `${offsetX - size / 2}px`);
|
|
160
|
+
ripple.style.setProperty("--hbdl-ripple-y", `${offsetY - size / 2}px`);
|
|
161
|
+
target.insertBefore(ripple, target.firstChild);
|
|
162
|
+
ripple.addEventListener("animationend", () => ripple.remove(), { once: true });
|
|
163
|
+
window.setTimeout(() => ripple.remove(), 700);
|
|
164
|
+
}
|
|
165
|
+
function prepareRippleHost(target) {
|
|
166
|
+
target.classList.add(RIPPLE_HOST_CLASS);
|
|
167
|
+
if (getComputedStyle(target).position === "static") {
|
|
168
|
+
target.style.position = "relative";
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function isActivationKey(key) {
|
|
172
|
+
return key === "Enter" || key === " " || key === "Spacebar";
|
|
173
|
+
}
|
|
7
174
|
var BaseCard_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
8
175
|
var _export_sfc = (sfc, props) => {
|
|
9
176
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -3573,4 +3740,5 @@ const _sfc_main = defineComponent({
|
|
|
3573
3740
|
}
|
|
3574
3741
|
});
|
|
3575
3742
|
var OutlinedTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8403e6ea"]]);
|
|
3576
|
-
|
|
3743
|
+
installRipple();
|
|
3744
|
+
export { BaseCard, BaseEChart, _sfc_main$7 as BaseExportButton, BaseTable, OutlinedCascader, OutlinedDatePicker, OutlinedDateTimePicker, OutlinedInput, OutlinedSelect, OutlinedTimePicker, OutlinedTreeSelect, downloadExportResponse, exportExcel, extractFileNameFromDisposition, installRipple, normalizeExportFileName, uninstallRipple };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hbdlzy/ui-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Company shared Vue UI core package.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,11 @@
|
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": [
|
|
39
39
|
"**/*.css",
|
|
40
|
-
"**/*.vue"
|
|
40
|
+
"**/*.vue",
|
|
41
|
+
"dist/index.js",
|
|
42
|
+
"dist/index.cjs",
|
|
43
|
+
"src/index.ts",
|
|
44
|
+
"src/ripple/index.ts"
|
|
41
45
|
],
|
|
42
46
|
"publishConfig": {
|
|
43
47
|
"access": "public",
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { installRipple } from './ripple'
|
|
2
|
+
|
|
3
|
+
installRipple()
|
|
4
|
+
|
|
1
5
|
export { echarts } from './echarts'
|
|
2
6
|
export type {
|
|
3
7
|
EChartInitOptions,
|
|
@@ -31,3 +35,4 @@ export { default as OutlinedTreeSelect } from './components/OutlinedTreeSelect'
|
|
|
31
35
|
export * from './components/OutlinedTreeSelect'
|
|
32
36
|
export { exportExcel } from './excel/exportExcel'
|
|
33
37
|
export type { ExcelCellValue, ExcelExportColumn, ExcelExportOptions } from './excel/exportExcel'
|
|
38
|
+
export { installRipple, uninstallRipple } from './ripple'
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
const HBDL_RIPPLE_KEY = '__HBDL_UI_RIPPLE__'
|
|
2
|
+
const RIPPLE_STYLE_ID = 'hbdl-ui-ripple-style'
|
|
3
|
+
const RIPPLE_HOST_CLASS = 'hbdl-ripple-host'
|
|
4
|
+
const RIPPLE_WAVE_CLASS = 'hbdl-ripple__wave'
|
|
5
|
+
|
|
6
|
+
const RIPPLE_TARGET_SELECTOR = [
|
|
7
|
+
'button',
|
|
8
|
+
'[role="button"]',
|
|
9
|
+
'.el-button',
|
|
10
|
+
'.el-radio-button__inner',
|
|
11
|
+
'.el-checkbox-button__inner'
|
|
12
|
+
].join(',')
|
|
13
|
+
|
|
14
|
+
const RIPPLE_DISABLED_SELECTOR = [
|
|
15
|
+
':disabled',
|
|
16
|
+
'[disabled]',
|
|
17
|
+
'[aria-disabled="true"]',
|
|
18
|
+
'.is-disabled',
|
|
19
|
+
'.is-loading'
|
|
20
|
+
].join(',')
|
|
21
|
+
|
|
22
|
+
const RIPPLE_SKIP_SELECTOR = '[data-hbdl-ripple="false"]'
|
|
23
|
+
|
|
24
|
+
const RIPPLE_STYLE = `
|
|
25
|
+
.${RIPPLE_HOST_CLASS} {
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
-webkit-tap-highlight-color: transparent;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.${RIPPLE_HOST_CLASS} > .${RIPPLE_WAVE_CLASS} {
|
|
31
|
+
position: absolute;
|
|
32
|
+
left: var(--hbdl-ripple-x);
|
|
33
|
+
top: var(--hbdl-ripple-y);
|
|
34
|
+
width: var(--hbdl-ripple-size);
|
|
35
|
+
height: var(--hbdl-ripple-size);
|
|
36
|
+
border-radius: 999px;
|
|
37
|
+
background: var(--hbdl-ripple-color, currentColor);
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transform: scale(0);
|
|
41
|
+
animation: hbdl-ripple-wave 560ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@keyframes hbdl-ripple-wave {
|
|
45
|
+
0% {
|
|
46
|
+
opacity: 0.22;
|
|
47
|
+
transform: scale(0);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
55% {
|
|
51
|
+
opacity: 0.18;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
100% {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transform: scale(1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (prefers-reduced-motion: reduce) {
|
|
61
|
+
.${RIPPLE_HOST_CLASS} > .${RIPPLE_WAVE_CLASS} {
|
|
62
|
+
animation-duration: 1ms;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`
|
|
66
|
+
|
|
67
|
+
interface RippleState {
|
|
68
|
+
teardown: () => void
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type RippleWindow = Window & {
|
|
72
|
+
[HBDL_RIPPLE_KEY]?: RippleState
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const noop = () => undefined
|
|
76
|
+
|
|
77
|
+
export function installRipple() {
|
|
78
|
+
if (!canUseDOM()) {
|
|
79
|
+
return noop
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const rippleWindow = window as RippleWindow
|
|
83
|
+
|
|
84
|
+
if (rippleWindow[HBDL_RIPPLE_KEY]) {
|
|
85
|
+
return rippleWindow[HBDL_RIPPLE_KEY].teardown
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
injectRippleStyle()
|
|
89
|
+
|
|
90
|
+
document.addEventListener('pointerdown', handlePointerDown, true)
|
|
91
|
+
document.addEventListener('keydown', handleKeyDown, true)
|
|
92
|
+
|
|
93
|
+
const teardown = () => {
|
|
94
|
+
document.removeEventListener('pointerdown', handlePointerDown, true)
|
|
95
|
+
document.removeEventListener('keydown', handleKeyDown, true)
|
|
96
|
+
delete rippleWindow[HBDL_RIPPLE_KEY]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
rippleWindow[HBDL_RIPPLE_KEY] = {
|
|
100
|
+
teardown
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return teardown
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function uninstallRipple() {
|
|
107
|
+
if (!canUseDOM()) {
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const rippleWindow = window as RippleWindow
|
|
112
|
+
rippleWindow[HBDL_RIPPLE_KEY]?.teardown()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function canUseDOM() {
|
|
116
|
+
return typeof window !== 'undefined' && typeof document !== 'undefined'
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function injectRippleStyle() {
|
|
120
|
+
if (document.getElementById(RIPPLE_STYLE_ID)) {
|
|
121
|
+
return
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const style = document.createElement('style')
|
|
125
|
+
style.id = RIPPLE_STYLE_ID
|
|
126
|
+
style.textContent = RIPPLE_STYLE
|
|
127
|
+
document.head.appendChild(style)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function handlePointerDown(event: PointerEvent) {
|
|
131
|
+
if (event.defaultPrevented || event.button !== 0) {
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const target = findRippleTarget(event.target)
|
|
136
|
+
|
|
137
|
+
if (!target) {
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
createRipple(target, event.clientX, event.clientY)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
145
|
+
if (event.defaultPrevented || event.repeat || !isActivationKey(event.key)) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const target = findRippleTarget(event.target)
|
|
150
|
+
|
|
151
|
+
if (!target) {
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const rect = target.getBoundingClientRect()
|
|
156
|
+
createRipple(target, rect.left + rect.width / 2, rect.top + rect.height / 2)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function findRippleTarget(target: EventTarget | null) {
|
|
160
|
+
if (!(target instanceof Element)) {
|
|
161
|
+
return null
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const rippleTarget = target.closest(RIPPLE_TARGET_SELECTOR)
|
|
165
|
+
|
|
166
|
+
if (!(rippleTarget instanceof HTMLElement)) {
|
|
167
|
+
return null
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (rippleTarget.closest(RIPPLE_SKIP_SELECTOR) || rippleTarget.closest(RIPPLE_DISABLED_SELECTOR)) {
|
|
171
|
+
return null
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return rippleTarget
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function createRipple(target: HTMLElement, clientX: number, clientY: number) {
|
|
178
|
+
const rect = target.getBoundingClientRect()
|
|
179
|
+
|
|
180
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const offsetX = clientX - rect.left
|
|
185
|
+
const offsetY = clientY - rect.top
|
|
186
|
+
const maxX = Math.max(offsetX, rect.width - offsetX)
|
|
187
|
+
const maxY = Math.max(offsetY, rect.height - offsetY)
|
|
188
|
+
const size = Math.ceil(Math.sqrt(maxX * maxX + maxY * maxY) * 2)
|
|
189
|
+
const ripple = document.createElement('span')
|
|
190
|
+
|
|
191
|
+
prepareRippleHost(target)
|
|
192
|
+
ripple.className = RIPPLE_WAVE_CLASS
|
|
193
|
+
ripple.setAttribute('aria-hidden', 'true')
|
|
194
|
+
ripple.style.setProperty('--hbdl-ripple-size', `${size}px`)
|
|
195
|
+
ripple.style.setProperty('--hbdl-ripple-x', `${offsetX - size / 2}px`)
|
|
196
|
+
ripple.style.setProperty('--hbdl-ripple-y', `${offsetY - size / 2}px`)
|
|
197
|
+
|
|
198
|
+
target.insertBefore(ripple, target.firstChild)
|
|
199
|
+
ripple.addEventListener('animationend', () => ripple.remove(), { once: true })
|
|
200
|
+
window.setTimeout(() => ripple.remove(), 700)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function prepareRippleHost(target: HTMLElement) {
|
|
204
|
+
target.classList.add(RIPPLE_HOST_CLASS)
|
|
205
|
+
|
|
206
|
+
if (getComputedStyle(target).position === 'static') {
|
|
207
|
+
target.style.position = 'relative'
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function isActivationKey(key: string) {
|
|
212
|
+
return key === 'Enter' || key === ' ' || key === 'Spacebar'
|
|
213
|
+
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type BaseCardCssValue = string | number;
|
|
2
|
-
export interface BaseCardDefaultExportPayload {
|
|
3
|
-
title?: string;
|
|
4
|
-
metaText?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface BaseCardProps {
|
|
7
|
-
title?: string;
|
|
8
|
-
metaText?: string;
|
|
9
|
-
showHeader?: boolean;
|
|
10
|
-
showRight?: boolean;
|
|
11
|
-
showTitleMarker?: boolean;
|
|
12
|
-
showExport?: boolean;
|
|
13
|
-
exportText?: string;
|
|
14
|
-
exportDisabled?: boolean;
|
|
15
|
-
exportPayload?: unknown;
|
|
16
|
-
padding?: BaseCardCssValue;
|
|
17
|
-
radius?: BaseCardCssValue;
|
|
18
|
-
borderColor?: string;
|
|
19
|
-
backgroundColor?: string;
|
|
20
|
-
shadowColor?: string;
|
|
21
|
-
headerGap?: BaseCardCssValue;
|
|
22
|
-
headerMarginBottom?: BaseCardCssValue;
|
|
23
|
-
leftGap?: BaseCardCssValue;
|
|
24
|
-
rightGap?: BaseCardCssValue;
|
|
25
|
-
titleColor?: string;
|
|
26
|
-
titleSize?: BaseCardCssValue;
|
|
27
|
-
titleWeight?: string | number;
|
|
28
|
-
markerColor?: string;
|
|
29
|
-
markerWidth?: BaseCardCssValue;
|
|
30
|
-
markerHeight?: BaseCardCssValue;
|
|
31
|
-
markerRadius?: BaseCardCssValue;
|
|
32
|
-
markerGap?: BaseCardCssValue;
|
|
33
|
-
metaColor?: string;
|
|
34
|
-
metaSize?: BaseCardCssValue;
|
|
35
|
-
exportColor?: string;
|
|
36
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import type { BaseCardCssValue, BaseCardProps } from './BaseCard.types';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseCardProps>, {
|
|
3
|
-
title: string;
|
|
4
|
-
metaText: string;
|
|
5
|
-
showHeader: boolean;
|
|
6
|
-
showRight: boolean;
|
|
7
|
-
showTitleMarker: boolean;
|
|
8
|
-
showExport: boolean;
|
|
9
|
-
exportText: string;
|
|
10
|
-
exportDisabled: boolean;
|
|
11
|
-
padding: number;
|
|
12
|
-
radius: number;
|
|
13
|
-
borderColor: string;
|
|
14
|
-
backgroundColor: string;
|
|
15
|
-
shadowColor: string;
|
|
16
|
-
headerGap: number;
|
|
17
|
-
headerMarginBottom: number;
|
|
18
|
-
leftGap: number;
|
|
19
|
-
rightGap: number;
|
|
20
|
-
titleColor: string;
|
|
21
|
-
titleSize: number;
|
|
22
|
-
titleWeight: number;
|
|
23
|
-
markerColor: string;
|
|
24
|
-
markerWidth: number;
|
|
25
|
-
markerHeight: number;
|
|
26
|
-
markerRadius: string;
|
|
27
|
-
markerGap: number;
|
|
28
|
-
metaColor: string;
|
|
29
|
-
metaSize: number;
|
|
30
|
-
exportColor: string;
|
|
31
|
-
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
|
-
export: (payload?: unknown) => void;
|
|
33
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseCardProps>, {
|
|
34
|
-
title: string;
|
|
35
|
-
metaText: string;
|
|
36
|
-
showHeader: boolean;
|
|
37
|
-
showRight: boolean;
|
|
38
|
-
showTitleMarker: boolean;
|
|
39
|
-
showExport: boolean;
|
|
40
|
-
exportText: string;
|
|
41
|
-
exportDisabled: boolean;
|
|
42
|
-
padding: number;
|
|
43
|
-
radius: number;
|
|
44
|
-
borderColor: string;
|
|
45
|
-
backgroundColor: string;
|
|
46
|
-
shadowColor: string;
|
|
47
|
-
headerGap: number;
|
|
48
|
-
headerMarginBottom: number;
|
|
49
|
-
leftGap: number;
|
|
50
|
-
rightGap: number;
|
|
51
|
-
titleColor: string;
|
|
52
|
-
titleSize: number;
|
|
53
|
-
titleWeight: number;
|
|
54
|
-
markerColor: string;
|
|
55
|
-
markerWidth: number;
|
|
56
|
-
markerHeight: number;
|
|
57
|
-
markerRadius: string;
|
|
58
|
-
markerGap: number;
|
|
59
|
-
metaColor: string;
|
|
60
|
-
metaSize: number;
|
|
61
|
-
exportColor: string;
|
|
62
|
-
}>>> & Readonly<{
|
|
63
|
-
onExport?: ((payload?: unknown) => any) | undefined;
|
|
64
|
-
}>, {
|
|
65
|
-
title: string;
|
|
66
|
-
metaText: string;
|
|
67
|
-
showHeader: boolean;
|
|
68
|
-
showRight: boolean;
|
|
69
|
-
showTitleMarker: boolean;
|
|
70
|
-
showExport: boolean;
|
|
71
|
-
exportText: string;
|
|
72
|
-
exportDisabled: boolean;
|
|
73
|
-
padding: BaseCardCssValue;
|
|
74
|
-
radius: BaseCardCssValue;
|
|
75
|
-
borderColor: string;
|
|
76
|
-
backgroundColor: string;
|
|
77
|
-
shadowColor: string;
|
|
78
|
-
headerGap: BaseCardCssValue;
|
|
79
|
-
headerMarginBottom: BaseCardCssValue;
|
|
80
|
-
leftGap: BaseCardCssValue;
|
|
81
|
-
rightGap: BaseCardCssValue;
|
|
82
|
-
titleColor: string;
|
|
83
|
-
titleSize: BaseCardCssValue;
|
|
84
|
-
titleWeight: string | number;
|
|
85
|
-
markerColor: string;
|
|
86
|
-
markerWidth: BaseCardCssValue;
|
|
87
|
-
markerHeight: BaseCardCssValue;
|
|
88
|
-
markerRadius: BaseCardCssValue;
|
|
89
|
-
markerGap: BaseCardCssValue;
|
|
90
|
-
metaColor: string;
|
|
91
|
-
metaSize: BaseCardCssValue;
|
|
92
|
-
exportColor: string;
|
|
93
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
94
|
-
"title-label"?(_: {}): any;
|
|
95
|
-
title?(_: {}): any;
|
|
96
|
-
"header-right"?(_: {}): any;
|
|
97
|
-
tip?(_: {}): any;
|
|
98
|
-
default?(_: {}): any;
|
|
99
|
-
}>;
|
|
100
|
-
export default _default;
|
|
101
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
102
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
103
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
104
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
105
|
-
} : {
|
|
106
|
-
type: import('vue').PropType<T[K]>;
|
|
107
|
-
required: true;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
type __VLS_WithDefaults<P, D> = {
|
|
111
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
112
|
-
default: D[K];
|
|
113
|
-
}> : P[K];
|
|
114
|
-
};
|
|
115
|
-
type __VLS_Prettify<T> = {
|
|
116
|
-
[K in keyof T]: T[K];
|
|
117
|
-
} & {};
|
|
118
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
119
|
-
new (): {
|
|
120
|
-
$slots: S;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { EChartInitOptions, EChartInstance, EChartLoadingOptions, EChartOption, EChartResizeOptions, EChartSetOptionOptions } from '../../echarts';
|
|
2
|
-
export interface BaseEChartProps {
|
|
3
|
-
option?: EChartOption;
|
|
4
|
-
theme?: string | Record<string, unknown>;
|
|
5
|
-
initOptions?: EChartInitOptions;
|
|
6
|
-
setOptionOptions?: boolean | EChartSetOptionOptions;
|
|
7
|
-
loading?: boolean;
|
|
8
|
-
loadingOptions?: EChartLoadingOptions;
|
|
9
|
-
autoResize?: boolean;
|
|
10
|
-
useDefaultColors?: boolean;
|
|
11
|
-
colorStorageKey?: string;
|
|
12
|
-
defaultColors?: string[];
|
|
13
|
-
group?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface BaseEChartExpose {
|
|
16
|
-
getInstance: () => EChartInstance | null;
|
|
17
|
-
setOption: (option: EChartOption, setOptionOptions?: boolean | EChartSetOptionOptions) => EChartInstance | null;
|
|
18
|
-
resize: (resizeOptions?: EChartResizeOptions) => void;
|
|
19
|
-
dispatchAction: (payload: Record<string, unknown>) => void;
|
|
20
|
-
showLoading: (type?: string, loadingOptions?: EChartLoadingOptions) => void;
|
|
21
|
-
hideLoading: () => void;
|
|
22
|
-
clear: () => void;
|
|
23
|
-
dispose: () => void;
|
|
24
|
-
on: (eventName: string, handler: (...args: any[]) => void, context?: unknown) => void;
|
|
25
|
-
off: (eventName?: string, handler?: (...args: any[]) => void) => void;
|
|
26
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { echarts } from '../../echarts';
|
|
2
|
-
import type { BaseEChartProps } from './BaseEChart.types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseEChartProps>, {
|
|
4
|
-
option: () => {};
|
|
5
|
-
initOptions: () => echarts.EChartsInitOpts;
|
|
6
|
-
setOptionOptions: () => echarts.SetOptionOpts;
|
|
7
|
-
loading: boolean;
|
|
8
|
-
autoResize: boolean;
|
|
9
|
-
useDefaultColors: boolean;
|
|
10
|
-
colorStorageKey: string;
|
|
11
|
-
defaultColors: () => never[];
|
|
12
|
-
group: undefined;
|
|
13
|
-
}>>, {
|
|
14
|
-
getInstance: () => echarts.ECharts | null;
|
|
15
|
-
setOption: (option: echarts.EChartsOption, setOptionOptions?: boolean | echarts.SetOptionOpts | undefined) => echarts.ECharts | null;
|
|
16
|
-
resize: (resizeOptions?: echarts.ResizeOpts | undefined) => void;
|
|
17
|
-
dispatchAction: (payload: Record<string, unknown>) => void;
|
|
18
|
-
showLoading: (type?: string | undefined, loadingOptions?: object | undefined) => void;
|
|
19
|
-
hideLoading: () => void;
|
|
20
|
-
clear: () => void;
|
|
21
|
-
dispose: () => void;
|
|
22
|
-
on: (eventName: string, handler: (...args: any[]) => void, context?: unknown) => void;
|
|
23
|
-
off: (eventName?: string | undefined, handler?: ((...args: any[]) => void) | undefined) => void;
|
|
24
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
-
ready: (chart: echarts.ECharts) => void;
|
|
26
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<BaseEChartProps>, {
|
|
27
|
-
option: () => {};
|
|
28
|
-
initOptions: () => echarts.EChartsInitOpts;
|
|
29
|
-
setOptionOptions: () => echarts.SetOptionOpts;
|
|
30
|
-
loading: boolean;
|
|
31
|
-
autoResize: boolean;
|
|
32
|
-
useDefaultColors: boolean;
|
|
33
|
-
colorStorageKey: string;
|
|
34
|
-
defaultColors: () => never[];
|
|
35
|
-
group: undefined;
|
|
36
|
-
}>>> & Readonly<{
|
|
37
|
-
onReady?: ((chart: echarts.ECharts) => any) | undefined;
|
|
38
|
-
}>, {
|
|
39
|
-
option: echarts.EChartsOption;
|
|
40
|
-
loading: boolean;
|
|
41
|
-
initOptions: echarts.EChartsInitOpts;
|
|
42
|
-
setOptionOptions: boolean | echarts.SetOptionOpts;
|
|
43
|
-
autoResize: boolean;
|
|
44
|
-
useDefaultColors: boolean;
|
|
45
|
-
colorStorageKey: string;
|
|
46
|
-
defaultColors: string[];
|
|
47
|
-
group: string;
|
|
48
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
|
-
export default _default;
|
|
50
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
51
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
52
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
53
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
54
|
-
} : {
|
|
55
|
-
type: import('vue').PropType<T[K]>;
|
|
56
|
-
required: true;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
type __VLS_WithDefaults<P, D> = {
|
|
60
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
61
|
-
default: D[K];
|
|
62
|
-
}> : P[K];
|
|
63
|
-
};
|
|
64
|
-
type __VLS_Prettify<T> = {
|
|
65
|
-
[K in keyof T]: T[K];
|
|
66
|
-
} & {};
|