@pixelium/web-vue 0.0.1-beta → 0.0.2-fix
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 +21 -10
- package/README.zh.md +21 -10
- package/dist/icon-pa.d.ts +490 -0
- package/dist/index.d.ts +1586 -10
- package/dist/pixelium-vue-icon-pa.cjs +1 -0
- package/dist/pixelium-vue-icon-pa.css +1 -0
- package/dist/pixelium-vue-icon-pa.js +10143 -0
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -0
- package/dist/pixelium-vue.cjs +12 -1
- package/dist/pixelium-vue.css +1 -1
- package/dist/pixelium-vue.js +5370 -1093
- package/dist/pixelium-vue.umd.cjs +12 -1
- package/es/aside/css.js +1 -1
- package/es/aside/index.js +60 -13
- package/es/auto-complete/css.js +2 -0
- package/es/auto-complete/draw.d.ts +2 -0
- package/es/auto-complete/draw.js +52 -0
- package/es/auto-complete/index.css +123 -0
- package/es/auto-complete/index.d.ts +35 -0
- package/es/auto-complete/index.js +402 -0
- package/es/auto-complete/type.d.ts +192 -0
- package/es/button/css.js +1 -1
- package/es/button/draw.d.ts +1 -2
- package/es/button/draw.js +105 -123
- package/es/button/index.css +24 -14
- package/es/button/index.js +70 -121
- package/es/button-group/css.js +1 -1
- package/es/button-group/index.d.ts +0 -1
- package/es/button-group/index.js +11 -37
- package/es/button-group/type.d.ts +1 -1
- package/es/col/css.js +1 -1
- package/es/col/index.d.ts +2 -2
- package/es/container/css.js +1 -1
- package/es/divider/css.js +1 -1
- package/es/empty/css.js +2 -0
- package/es/empty/index.css +19 -0
- package/es/empty/index.d.ts +17 -0
- package/es/empty/index.js +73 -0
- package/es/empty/type.d.ts +19 -0
- package/es/footer/css.js +1 -1
- package/es/grid/css.js +1 -1
- package/es/grid/index.js +5 -1
- package/es/grid-item/css.js +1 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +7 -3
- package/es/header/css.js +1 -1
- package/es/icon/css.js +1 -1
- package/es/icon/index.css +0 -3
- package/es/icon/index.js +1 -1
- package/es/icons/css-pa.js +2 -0
- package/es/icons/icon-hn.js +1 -1
- package/es/icons/icon-pa.css +9 -0
- package/es/icons/icon-pa.d.ts +490 -0
- package/es/icons/icon-pa.js +17449 -0
- package/es/index.css +22 -8
- package/es/index.d.ts +18 -1
- package/es/index.js +63 -2
- package/es/input/css.js +2 -0
- package/es/input/draw.d.ts +2 -0
- package/es/input/draw.js +52 -0
- package/es/input/index.css +138 -0
- package/es/input/index.d.ts +50 -0
- package/es/input/index.js +432 -0
- package/es/input/type.d.ts +175 -0
- package/es/input-group/css.js +2 -0
- package/es/input-group/index.css +24 -0
- package/es/input-group/index.d.ts +17 -0
- package/es/input-group/index.js +40 -0
- package/es/input-group/type.d.ts +30 -0
- package/es/input-group-label/css.js +2 -0
- package/es/input-group-label/draw.d.ts +2 -0
- package/es/input-group-label/draw.js +52 -0
- package/es/input-group-label/index.css +50 -0
- package/es/input-group-label/index.d.ts +16 -0
- package/es/input-group-label/index.js +129 -0
- package/es/input-group-label/type.d.ts +30 -0
- package/es/input-number/css.js +2 -0
- package/es/input-number/draw.d.ts +2 -0
- package/es/input-number/draw.js +52 -0
- package/es/input-number/index.css +161 -0
- package/es/input-number/index.d.ts +47 -0
- package/es/input-number/index.js +543 -0
- package/es/input-number/type.d.ts +183 -0
- package/es/input-tag/css.js +2 -0
- package/es/input-tag/draw.d.ts +2 -0
- package/es/input-tag/draw.js +49 -0
- package/es/input-tag/index.css +133 -0
- package/es/input-tag/index.d.ts +73 -0
- package/es/input-tag/index.js +474 -0
- package/es/input-tag/type.d.ts +212 -0
- package/es/link/css.js +1 -1
- package/es/link/index.css +2 -5
- package/es/link/index.js +10 -6
- package/es/main/css.js +1 -1
- package/es/mask/css.js +2 -0
- package/es/mask/index.css +17 -0
- package/es/mask/index.d.ts +8 -0
- package/es/mask/index.js +117 -0
- package/es/mask/type.d.ts +27 -0
- package/es/message/css.js +1 -1
- package/es/message/index.css +26 -26
- package/es/message/index.d.ts +1 -1
- package/es/message/index.js +22 -50
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +40 -30
- package/es/message-box/message-box-wrapped.d.ts +0 -1
- package/es/message-box/message-box-wrapped.js +2 -2
- package/es/message-box/message-box.d.ts +2 -1
- package/es/message-box/message-box.js +10 -8
- package/es/message-box/type.d.ts +14 -4
- package/es/option-list/css.js +2 -0
- package/es/option-list/index.css +57 -0
- package/es/option-list/index.d.ts +38 -0
- package/es/option-list/index.js +169 -0
- package/es/option-list/type.d.ts +16 -0
- package/es/popover/css.js +1 -0
- package/es/popover/index.d.ts +203 -0
- package/es/popover/index.js +240 -0
- package/es/popover/type.d.ts +100 -0
- package/es/popup-content/css.js +2 -0
- package/es/popup-content/draw.d.ts +6 -0
- package/es/popup-content/draw.js +151 -0
- package/es/popup-content/index.css +99 -0
- package/es/popup-content/index.d.ts +30 -0
- package/es/popup-content/index.js +1578 -0
- package/es/popup-content/type.d.ts +20 -0
- package/es/popup-trigger/css.js +1 -0
- package/es/popup-trigger/index.d.ts +22 -0
- package/es/popup-trigger/index.js +97 -0
- package/es/popup-trigger/type.d.ts +9 -0
- package/es/row/css.js +1 -1
- package/es/select/css.js +2 -0
- package/es/select/draw.d.ts +2 -0
- package/es/select/draw.js +52 -0
- package/es/select/index.css +152 -0
- package/es/select/index.d.ts +44 -0
- package/es/select/index.js +677 -0
- package/es/select/type.d.ts +252 -0
- package/es/share/const/event-bus-key.d.ts +4 -0
- package/es/share/const/event-bus-key.js +10 -0
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +11 -2
- package/es/share/const/provide-key.d.ts +3 -0
- package/es/share/const/provide-key.js +8 -0
- package/es/share/hook/use-click-outside-listener.d.ts +4 -0
- package/es/share/hook/use-click-outside-listener.js +44 -0
- package/es/share/hook/use-composition.d.ts +5 -0
- package/es/share/hook/use-composition.js +17 -0
- package/es/share/hook/use-controlled-mode.d.ts +6 -0
- package/es/share/hook/use-controlled-mode.js +25 -0
- package/es/share/hook/use-dark-mode.js +11 -3
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +25 -35
- package/es/share/hook/use-resize-observer.js +1 -1
- package/es/share/hook/use-textarea-height.d.ts +5 -0
- package/es/share/hook/use-textarea-height.js +116 -0
- package/es/share/hook/use-watch-global-css-var.d.ts +1 -0
- package/es/share/hook/use-watch-global-css-var.js +19 -0
- package/es/share/hook/use-z-index.d.ts +6 -0
- package/es/share/hook/use-z-index.js +32 -0
- package/es/share/type/index.d.ts +9 -1
- package/es/share/util/color.js +4 -2
- package/es/share/util/common.d.ts +5 -0
- package/es/share/util/common.js +71 -0
- package/es/share/util/event-bus.d.ts +1 -0
- package/es/share/util/event-bus.js +20 -0
- package/es/share/util/plot.d.ts +15 -2
- package/es/share/util/plot.js +200 -30
- package/es/share/util/render.d.ts +1 -0
- package/es/share/util/render.js +10 -2
- package/es/share/util/theme.js +23 -4
- package/es/space/css.js +1 -1
- package/es/space/index.css +5 -0
- package/es/space/index.js +2 -2
- package/es/spin/css.js +2 -0
- package/es/spin/index.css +66 -0
- package/es/spin/index.d.ts +24 -0
- package/es/spin/index.js +104 -0
- package/es/spin/type.d.ts +54 -0
- package/es/tag/css.js +2 -0
- package/es/tag/draw.d.ts +6 -0
- package/es/tag/draw.js +135 -0
- package/es/tag/index.css +372 -0
- package/es/tag/index.d.ts +23 -0
- package/es/tag/index.js +193 -0
- package/es/tag/type.d.ts +58 -0
- package/es/textarea/css.js +2 -0
- package/es/textarea/draw.d.ts +2 -0
- package/es/textarea/draw.js +13 -0
- package/es/textarea/index.css +108 -0
- package/es/textarea/index.d.ts +49 -0
- package/es/textarea/index.js +267 -0
- package/es/textarea/type.d.ts +169 -0
- package/es/tooltip/css.js +1 -0
- package/es/tooltip/index.d.ts +20 -0
- package/es/tooltip/index.js +228 -0
- package/es/tooltip/type.d.ts +77 -0
- package/package.json +17 -3
- package/es/icons/{css.js → css-hn.js} +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
div.px-textarea {
|
|
2
|
+
font-size: var(--text-size);
|
|
3
|
+
}
|
|
4
|
+
.px-textarea {
|
|
5
|
+
--px-medium-padding-x: var(--px-interval-2);
|
|
6
|
+
--px-large-padding-x: var(--px-interval-3);
|
|
7
|
+
--px-small-padding-x: var(--px-interval-2);
|
|
8
|
+
--padding-x-size: var(--px-medium-padding-x);
|
|
9
|
+
--text-size: var(--px-medium-font-size);
|
|
10
|
+
--textarea-size: var(--px-medium-size);
|
|
11
|
+
z-index: 0;
|
|
12
|
+
position: relative;
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
border-color: transparent;
|
|
15
|
+
border-width: var(--px-bit);
|
|
16
|
+
border-style: solid;
|
|
17
|
+
color: var(--px-neutral-10);
|
|
18
|
+
display: flex;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
.px-textarea-inner {
|
|
22
|
+
height: 100%;
|
|
23
|
+
border: 0;
|
|
24
|
+
background-color: transparent;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
width: 100%;
|
|
27
|
+
font-size: var(--text-size);
|
|
28
|
+
line-height: var(--px-line-height);
|
|
29
|
+
font-family: var(--px-font);
|
|
30
|
+
padding: 0 var(--padding-x-size);
|
|
31
|
+
min-height: calc(var(--textarea-size) - var(--px-bit) * 2);
|
|
32
|
+
resize: none;
|
|
33
|
+
}
|
|
34
|
+
.px-textarea-inner:focus-visible {
|
|
35
|
+
outline-color: var(--px-neutral-10);
|
|
36
|
+
outline-offset: var(--px-bit);
|
|
37
|
+
}
|
|
38
|
+
.px-textarea-inner:disabled {
|
|
39
|
+
color: var(--px-neutral-10);
|
|
40
|
+
}
|
|
41
|
+
.px-textarea-inner::placeholder {
|
|
42
|
+
color: var(--px-neutral-8);
|
|
43
|
+
opacity: 1;
|
|
44
|
+
}
|
|
45
|
+
.px-textarea__resize .px-textarea-inner {
|
|
46
|
+
resize: vertical;
|
|
47
|
+
}
|
|
48
|
+
.px-textarea__large {
|
|
49
|
+
--padding-x-size: var(--px-large-padding-x);
|
|
50
|
+
--text-size: var(--px-large-font-size);
|
|
51
|
+
--input-size: var(--px-large-size);
|
|
52
|
+
}
|
|
53
|
+
.px-textarea__small {
|
|
54
|
+
--padding-x-size: var(--px-small-padding-x);
|
|
55
|
+
--input-size: var(--px-small-size);
|
|
56
|
+
--text-size: var(--px-small-font-size);
|
|
57
|
+
}
|
|
58
|
+
.px-textarea__disabled {
|
|
59
|
+
cursor: not-allowed;
|
|
60
|
+
}
|
|
61
|
+
.px-textarea__disabled .px-textarea-inner:disabled {
|
|
62
|
+
cursor: not-allowed;
|
|
63
|
+
color: var(--px-neutral-8);
|
|
64
|
+
}
|
|
65
|
+
.px-textarea-addition-wrapper {
|
|
66
|
+
position: absolute;
|
|
67
|
+
bottom: 0;
|
|
68
|
+
right: var(--padding-x-size);
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
}
|
|
72
|
+
.px-textarea-count-wrapper,
|
|
73
|
+
.px-textarea-loading-wrapper,
|
|
74
|
+
.px-textarea-close-wrapper {
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
margin-left: var(--px-interval-2);
|
|
79
|
+
}
|
|
80
|
+
.px-textarea-close-wrapper .px-textarea-icon {
|
|
81
|
+
width: var(--text-size);
|
|
82
|
+
height: var(--text-size);
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
fill: var(--px-neutral-8);
|
|
85
|
+
transition: 0.25s;
|
|
86
|
+
}
|
|
87
|
+
.px-textarea-close-wrapper .px-textarea-icon:hover {
|
|
88
|
+
fill: var(--px-neutral-7);
|
|
89
|
+
}
|
|
90
|
+
.px-textarea-close-wrapper .px-textarea-icon:active {
|
|
91
|
+
fill: var(--px-neutral-9);
|
|
92
|
+
}
|
|
93
|
+
.px-textarea-loading-wrapper .px-textarea-icon {
|
|
94
|
+
width: var(--text-size);
|
|
95
|
+
height: var(--text-size);
|
|
96
|
+
fill: var(--px-primary-6);
|
|
97
|
+
}
|
|
98
|
+
.px-textarea-count-wrapper {
|
|
99
|
+
color: var(--px-neutral-8);
|
|
100
|
+
}
|
|
101
|
+
.px-textarea-canvas {
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: 50%;
|
|
104
|
+
left: 50%;
|
|
105
|
+
transform: translate(-50%, -50%);
|
|
106
|
+
z-index: -1;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TextareaProps } from './type';
|
|
2
|
+
import { type Nullish } from 'parsnip-kit';
|
|
3
|
+
declare var __VLS_9: {
|
|
4
|
+
value: string | Nullish;
|
|
5
|
+
count: number;
|
|
6
|
+
maxLength: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_Slots = {} & {
|
|
9
|
+
count?: (props: typeof __VLS_9) => any;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_component: import("vue").DefineComponent<TextareaProps, {
|
|
12
|
+
focus: () => void;
|
|
13
|
+
blur: () => void;
|
|
14
|
+
clear: () => Promise<void>;
|
|
15
|
+
select: () => void;
|
|
16
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
input: (value: string, e: Event) => any;
|
|
18
|
+
change: (value: string, e?: Event | undefined) => any;
|
|
19
|
+
clear: (value: string) => any;
|
|
20
|
+
blur: (e: FocusEvent) => any;
|
|
21
|
+
focus: (e: FocusEvent) => any;
|
|
22
|
+
"update:modelValue": (value: string) => any;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<TextareaProps> & Readonly<{
|
|
24
|
+
onInput?: ((value: string, e: Event) => any) | undefined;
|
|
25
|
+
onChange?: ((value: string, e?: Event | undefined) => any) | undefined;
|
|
26
|
+
onClear?: ((value: string) => any) | undefined;
|
|
27
|
+
onBlur?: ((e: FocusEvent) => any) | undefined;
|
|
28
|
+
onFocus?: ((e: FocusEvent) => any) | undefined;
|
|
29
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
size: "medium" | "large" | "small";
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
loading: boolean;
|
|
34
|
+
resize: boolean;
|
|
35
|
+
readonly: boolean;
|
|
36
|
+
clearable: boolean;
|
|
37
|
+
showCount: boolean;
|
|
38
|
+
status: "success" | "warning" | "error" | "normal";
|
|
39
|
+
minRows: number;
|
|
40
|
+
maxRows: number;
|
|
41
|
+
autoResize: boolean;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { defineComponent, shallowRef, computed, ref, watch, onMounted, nextTick, createElementBlock, openBlock, normalizeClass, createElementVNode, unref, withModifiers, normalizeStyle, createCommentVNode, createVNode, renderSlot, toDisplayString } from "vue";
|
|
3
|
+
import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
4
|
+
import { d as draw } from "./draw.js";
|
|
5
|
+
import { g as getGlobalThemeColor } from "../share/util/color.js";
|
|
6
|
+
import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
7
|
+
import { u as useComposition } from "../share/hook/use-composition.js";
|
|
8
|
+
import { T as TimesCircleSolid, S as SpinnerThirdSolid } from "../auto-complete/index.js";
|
|
9
|
+
import { a as Ne, N } from "../aside/index.js";
|
|
10
|
+
import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
11
|
+
import { u as useTextareaHeight } from "../share/hook/use-textarea-height.js";
|
|
12
|
+
import { a as canvasPreprocess, c as calcPixelSize } from "../share/util/plot.js";
|
|
13
|
+
import { u as useControlledMode } from "../share/hook/use-controlled-mode.js";
|
|
14
|
+
const _hoisted_1 = ["value", "placeholder", "disabled", "autofocus", "rows"];
|
|
15
|
+
const _hoisted_2 = { class: "px-textarea-addition-wrapper" };
|
|
16
|
+
const _hoisted_3 = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "px-textarea-close-wrapper"
|
|
19
|
+
};
|
|
20
|
+
const _hoisted_4 = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "px-textarea-count-wrapper"
|
|
23
|
+
};
|
|
24
|
+
const _hoisted_5 = {
|
|
25
|
+
key: 2,
|
|
26
|
+
class: "px-textarea-loading-wrapper"
|
|
27
|
+
};
|
|
28
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
29
|
+
...{
|
|
30
|
+
name: "Textarea"
|
|
31
|
+
},
|
|
32
|
+
__name: "index",
|
|
33
|
+
props: {
|
|
34
|
+
modelValue: null,
|
|
35
|
+
defaultValue: null,
|
|
36
|
+
rows: null,
|
|
37
|
+
minRows: { default: 1 },
|
|
38
|
+
maxRows: { default: Infinity },
|
|
39
|
+
autoResize: { type: Boolean, default: false },
|
|
40
|
+
resize: { type: Boolean, default: true },
|
|
41
|
+
placeholder: null,
|
|
42
|
+
disabled: { type: Boolean, default: false },
|
|
43
|
+
readonly: { type: Boolean, default: false },
|
|
44
|
+
clearable: { type: Boolean, default: false },
|
|
45
|
+
loading: { type: Boolean, default: false },
|
|
46
|
+
size: { default: "medium" },
|
|
47
|
+
maxLength: null,
|
|
48
|
+
showCount: { type: Boolean, default: false },
|
|
49
|
+
countGraphemes: { type: Function },
|
|
50
|
+
sliceGraphemes: { type: Function },
|
|
51
|
+
status: { default: "normal" },
|
|
52
|
+
autofocus: { type: Boolean }
|
|
53
|
+
},
|
|
54
|
+
emits: ["input", "update:modelValue", "change", "clear", "blur", "focus"],
|
|
55
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
56
|
+
const props = __props;
|
|
57
|
+
const emits = __emit;
|
|
58
|
+
const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({
|
|
59
|
+
afterComposition: (e) => {
|
|
60
|
+
nextTick(() => {
|
|
61
|
+
inputHandler(e);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
|
|
66
|
+
defaultField: "defaultValue",
|
|
67
|
+
transform: (e) => {
|
|
68
|
+
return e || "";
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const wrapperRef = shallowRef(null);
|
|
72
|
+
const canvasRef = shallowRef(null);
|
|
73
|
+
const inputRef = shallowRef(null);
|
|
74
|
+
const [height, minHeight, maxHeight, refreshHeight] = useTextareaHeight(inputRef, props);
|
|
75
|
+
const currentLength = computed(() => {
|
|
76
|
+
return modelValue.value ? props.countGraphemes ? props.countGraphemes(modelValue.value) : modelValue.value.length : 0;
|
|
77
|
+
});
|
|
78
|
+
const inputHandler = async (e) => {
|
|
79
|
+
const target = e.target;
|
|
80
|
+
let newValue = target.value;
|
|
81
|
+
modelValue.value = newValue;
|
|
82
|
+
if (isComposing.value) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (props.maxLength) {
|
|
86
|
+
if (props.countGraphemes && props.sliceGraphemes) {
|
|
87
|
+
await nextTick();
|
|
88
|
+
newValue = props.sliceGraphemes(newValue, props.maxLength);
|
|
89
|
+
} else {
|
|
90
|
+
newValue = newValue.slice(0, props.maxLength);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
modelValue.value = newValue;
|
|
94
|
+
emits("input", newValue, e);
|
|
95
|
+
updateModelValue(newValue);
|
|
96
|
+
};
|
|
97
|
+
const clearHandler = async () => {
|
|
98
|
+
await updateModelValue("");
|
|
99
|
+
emits("change", "");
|
|
100
|
+
emits("clear", "");
|
|
101
|
+
};
|
|
102
|
+
const changeHandler = (e) => {
|
|
103
|
+
const target = e.target;
|
|
104
|
+
refreshHeight();
|
|
105
|
+
emits("change", target.value, e);
|
|
106
|
+
};
|
|
107
|
+
const focusMode = ref(false);
|
|
108
|
+
const setHeight = () => {
|
|
109
|
+
if (props.autoResize && inputRef.value && height.value) {
|
|
110
|
+
inputRef.value.style.height = height.value + "px";
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
watch(height, () => {
|
|
114
|
+
setHeight();
|
|
115
|
+
});
|
|
116
|
+
const blurHandler = () => {
|
|
117
|
+
setHeight();
|
|
118
|
+
focusMode.value = false;
|
|
119
|
+
};
|
|
120
|
+
const focusHandler = () => {
|
|
121
|
+
setHeight();
|
|
122
|
+
focusMode.value = true;
|
|
123
|
+
};
|
|
124
|
+
const showClose = computed(() => {
|
|
125
|
+
return props.clearable && focusMode.value && !props.disabled && !props.readonly && !!modelValue.value;
|
|
126
|
+
});
|
|
127
|
+
const focusInputHandler = () => {
|
|
128
|
+
var _a;
|
|
129
|
+
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
130
|
+
};
|
|
131
|
+
const hoverFlag = ref(false);
|
|
132
|
+
const mouseenterHandler = () => {
|
|
133
|
+
hoverFlag.value = true;
|
|
134
|
+
};
|
|
135
|
+
const mouseleaveHandler = () => {
|
|
136
|
+
hoverFlag.value = false;
|
|
137
|
+
};
|
|
138
|
+
__expose({
|
|
139
|
+
focus: () => {
|
|
140
|
+
var _a;
|
|
141
|
+
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
142
|
+
},
|
|
143
|
+
blur: () => {
|
|
144
|
+
var _a;
|
|
145
|
+
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
146
|
+
},
|
|
147
|
+
clear: () => clearHandler(),
|
|
148
|
+
select: () => {
|
|
149
|
+
var _a;
|
|
150
|
+
(_a = inputRef.value) == null ? void 0 : _a.select();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
const darkMode = useDarkMode();
|
|
154
|
+
watch([() => props.size, () => props.disabled, darkMode, hoverFlag, focusMode], () => {
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
drawPixelDebounce();
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
const drawPixel = () => {
|
|
160
|
+
const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
|
|
161
|
+
if (!preprocessData) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const { ctx, width, height: height2 } = preprocessData;
|
|
165
|
+
const pixelSize = calcPixelSize();
|
|
166
|
+
const borderColor = props.status !== "normal" ? getGlobalThemeColor(props.status === "error" ? "danger" : props.status, 6) : (hoverFlag.value || focusMode.value) && !props.disabled && !props.readonly ? getGlobalThemeColor("primary", 6) : getGlobalThemeColor("neutral", 10);
|
|
167
|
+
const backgroundColor = props.disabled ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
|
|
168
|
+
draw(ctx, width, height2, borderColor, backgroundColor, pixelSize);
|
|
169
|
+
};
|
|
170
|
+
const drawPixelDebounce = Ne(drawPixel, 0, {
|
|
171
|
+
maxWait: 50
|
|
172
|
+
});
|
|
173
|
+
onMounted(() => {
|
|
174
|
+
nextTick(() => {
|
|
175
|
+
drawPixel();
|
|
176
|
+
});
|
|
177
|
+
setTimeout(() => {
|
|
178
|
+
setHeight();
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
useResizeObserver(wrapperRef, drawPixelDebounce);
|
|
182
|
+
useWatchGlobalCssVal(drawPixelDebounce);
|
|
183
|
+
return (_ctx, _cache) => {
|
|
184
|
+
return openBlock(), createElementBlock(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
class: normalizeClass(["pixelium px-textarea", {
|
|
188
|
+
[`px-textarea__${props.size}`]: !!props.size,
|
|
189
|
+
"px-textarea__disabled": !!props.disabled,
|
|
190
|
+
"px-textarea__resize": !!props.resize
|
|
191
|
+
}]),
|
|
192
|
+
ref_key: "wrapperRef",
|
|
193
|
+
ref: wrapperRef,
|
|
194
|
+
onClick: focusInputHandler,
|
|
195
|
+
onMouseenter: mouseenterHandler,
|
|
196
|
+
onMouseleave: mouseleaveHandler
|
|
197
|
+
},
|
|
198
|
+
[
|
|
199
|
+
createElementVNode("textarea", {
|
|
200
|
+
class: "px-textarea-inner",
|
|
201
|
+
value: unref(modelValue),
|
|
202
|
+
ref_key: "inputRef",
|
|
203
|
+
ref: inputRef,
|
|
204
|
+
placeholder: props.placeholder,
|
|
205
|
+
disabled: props.disabled || props.readonly,
|
|
206
|
+
autofocus: __props.autofocus,
|
|
207
|
+
rows: props.rows,
|
|
208
|
+
style: normalizeStyle({
|
|
209
|
+
minHeight: unref(minHeight) ? unref(minHeight) + "px" : void 0,
|
|
210
|
+
maxHeight: unref(maxHeight) ? unref(maxHeight) + "px" : void 0
|
|
211
|
+
}),
|
|
212
|
+
onInput: withModifiers(inputHandler, ["stop"]),
|
|
213
|
+
onChange: withModifiers(changeHandler, ["stop"]),
|
|
214
|
+
onBlur: blurHandler,
|
|
215
|
+
onFocus: focusHandler,
|
|
216
|
+
onCompositionstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
217
|
+
(...args) => unref(compositionStartHandler) && unref(compositionStartHandler)(...args)),
|
|
218
|
+
onCompositionend: _cache[1] || (_cache[1] = //@ts-ignore
|
|
219
|
+
(...args) => unref(compositionUpdateHandler) && unref(compositionUpdateHandler)(...args))
|
|
220
|
+
}, null, 44, _hoisted_1),
|
|
221
|
+
createElementVNode("div", _hoisted_2, [
|
|
222
|
+
showClose.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
223
|
+
createVNode(unref(TimesCircleSolid), {
|
|
224
|
+
class: "px-textarea-icon",
|
|
225
|
+
onClick: clearHandler
|
|
226
|
+
})
|
|
227
|
+
])) : createCommentVNode("v-if", true),
|
|
228
|
+
props.showCount ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
229
|
+
renderSlot(_ctx.$slots, "count", {
|
|
230
|
+
value: unref(modelValue),
|
|
231
|
+
count: currentLength.value,
|
|
232
|
+
maxLength: props.maxLength
|
|
233
|
+
}, () => [
|
|
234
|
+
createElementVNode(
|
|
235
|
+
"span",
|
|
236
|
+
null,
|
|
237
|
+
toDisplayString(currentLength.value) + toDisplayString(unref(N)(props.maxLength) ? "" : " / " + props.maxLength),
|
|
238
|
+
1
|
|
239
|
+
/* TEXT */
|
|
240
|
+
)
|
|
241
|
+
])
|
|
242
|
+
])) : createCommentVNode("v-if", true),
|
|
243
|
+
props.loading ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
244
|
+
createVNode(unref(SpinnerThirdSolid), { class: "px-textarea-icon px-animation__loading" })
|
|
245
|
+
])) : createCommentVNode("v-if", true)
|
|
246
|
+
]),
|
|
247
|
+
createElementVNode(
|
|
248
|
+
"canvas",
|
|
249
|
+
{
|
|
250
|
+
class: "px-textarea-canvas",
|
|
251
|
+
ref_key: "canvasRef",
|
|
252
|
+
ref: canvasRef
|
|
253
|
+
},
|
|
254
|
+
null,
|
|
255
|
+
512
|
|
256
|
+
/* NEED_PATCH */
|
|
257
|
+
)
|
|
258
|
+
],
|
|
259
|
+
34
|
|
260
|
+
/* CLASS, NEED_HYDRATION */
|
|
261
|
+
);
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
export {
|
|
266
|
+
_sfc_main as _
|
|
267
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export type TextareaProps = {
|
|
2
|
+
/**
|
|
3
|
+
* @property {string | null} [modelValue]
|
|
4
|
+
* @version 0.0.2
|
|
5
|
+
*/
|
|
6
|
+
modelValue?: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* @property {string | null} [defaultValue]
|
|
9
|
+
* @version 0.0.2
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* @property {number} [rows]
|
|
14
|
+
* @version 0.0.2
|
|
15
|
+
*/
|
|
16
|
+
rows?: number;
|
|
17
|
+
/**
|
|
18
|
+
* @property {number} [minRows=1]
|
|
19
|
+
* @version 0.0.2
|
|
20
|
+
*/
|
|
21
|
+
minRows?: number;
|
|
22
|
+
/**
|
|
23
|
+
* @property {number} [maxRows=Infinity]
|
|
24
|
+
* @version 0.0.2
|
|
25
|
+
*/
|
|
26
|
+
maxRows?: number;
|
|
27
|
+
/**
|
|
28
|
+
* @property {boolean} [autoResize=false]
|
|
29
|
+
* @version 0.0.2
|
|
30
|
+
*/
|
|
31
|
+
autoResize?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @property {boolean} [resize=true]
|
|
34
|
+
* @version 0.0.2
|
|
35
|
+
*/
|
|
36
|
+
resize?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @property {string} [placeholder]
|
|
39
|
+
* @version 0.0.2
|
|
40
|
+
*/
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
/**
|
|
43
|
+
* @property {boolean} [disabled=false]
|
|
44
|
+
* @version 0.0.2
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @property {boolean} [readonly=false]
|
|
49
|
+
* @version 0.0.2
|
|
50
|
+
*/
|
|
51
|
+
readonly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @property {boolean} [clearable=false]
|
|
54
|
+
* @version 0.0.2
|
|
55
|
+
*/
|
|
56
|
+
clearable?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* @property {boolean} [loading=false]
|
|
59
|
+
* @version 0.0.2
|
|
60
|
+
*/
|
|
61
|
+
loading?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
64
|
+
* @version 0.0.2
|
|
65
|
+
*/
|
|
66
|
+
size?: 'medium' | 'large' | 'small';
|
|
67
|
+
/**
|
|
68
|
+
* @property {number} [maxLength]
|
|
69
|
+
* @version 0.0.2
|
|
70
|
+
*/
|
|
71
|
+
maxLength?: number;
|
|
72
|
+
/**
|
|
73
|
+
* @property {boolean} [showCount=false]
|
|
74
|
+
* @version 0.0.2
|
|
75
|
+
*/
|
|
76
|
+
showCount?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* @property {(value: string) => number} [countGraphemes]
|
|
79
|
+
* @version 0.0.2
|
|
80
|
+
*/
|
|
81
|
+
countGraphemes?: (value: string) => number;
|
|
82
|
+
/**
|
|
83
|
+
* @property {(value: string, limit: number) => string} [sliceGraphemes]
|
|
84
|
+
* @version 0.0.2
|
|
85
|
+
*/
|
|
86
|
+
sliceGraphemes?: (value: string, limit: number) => string;
|
|
87
|
+
/**
|
|
88
|
+
* @property {'success' | 'warning' | 'error' | 'normal'} [status='normal']
|
|
89
|
+
* @version 0.0.2
|
|
90
|
+
*/
|
|
91
|
+
status?: 'success' | 'warning' | 'error' | 'normal';
|
|
92
|
+
/**
|
|
93
|
+
* @property {boolean} [autofocus=false]
|
|
94
|
+
* @version 0.0.2
|
|
95
|
+
*/
|
|
96
|
+
autofocus?: boolean;
|
|
97
|
+
};
|
|
98
|
+
export type TextareaEvents = {
|
|
99
|
+
/**
|
|
100
|
+
* @event input
|
|
101
|
+
* @param {string} value
|
|
102
|
+
* @param {Event} e
|
|
103
|
+
* @version 0.0.2
|
|
104
|
+
*/
|
|
105
|
+
input: [value: string, e: Event];
|
|
106
|
+
/**
|
|
107
|
+
* @event update:modelValue
|
|
108
|
+
* @param {string} value
|
|
109
|
+
* @version 0.0.2
|
|
110
|
+
*/
|
|
111
|
+
'update:modelValue': [value: string];
|
|
112
|
+
/**
|
|
113
|
+
* @event change
|
|
114
|
+
* @param {string} value
|
|
115
|
+
* @param {Event | undefined} e
|
|
116
|
+
* @version 0.0.2
|
|
117
|
+
*/
|
|
118
|
+
change: [value: string, e?: Event];
|
|
119
|
+
/**
|
|
120
|
+
* @event clear
|
|
121
|
+
* @param {string} value
|
|
122
|
+
* @version 0.0.2
|
|
123
|
+
*/
|
|
124
|
+
clear: [value: string];
|
|
125
|
+
/**
|
|
126
|
+
* @event blur
|
|
127
|
+
* @param {FocusEvent} e
|
|
128
|
+
* @version 0.0.2
|
|
129
|
+
*/
|
|
130
|
+
blur: [e: FocusEvent];
|
|
131
|
+
/**
|
|
132
|
+
* @event focus
|
|
133
|
+
* @param {FocusEvent} e
|
|
134
|
+
* @version 0.0.2
|
|
135
|
+
*/
|
|
136
|
+
focus: [e: FocusEvent];
|
|
137
|
+
};
|
|
138
|
+
export type TextareaSlots = {
|
|
139
|
+
/**
|
|
140
|
+
* @slot count
|
|
141
|
+
* @param {number} inputValue
|
|
142
|
+
* @param {number} currentLength
|
|
143
|
+
* @param {number} maxLength
|
|
144
|
+
* @version 0.0.2
|
|
145
|
+
*/
|
|
146
|
+
count: {};
|
|
147
|
+
};
|
|
148
|
+
export type TextareaExpose = {
|
|
149
|
+
/**
|
|
150
|
+
* @property {() => void} focus
|
|
151
|
+
* @version 0.0.2
|
|
152
|
+
*/
|
|
153
|
+
focus: () => void;
|
|
154
|
+
/**
|
|
155
|
+
* @property {() => void} blur
|
|
156
|
+
* @version 0.0.2
|
|
157
|
+
*/
|
|
158
|
+
blur: () => void;
|
|
159
|
+
/**
|
|
160
|
+
* @property {() => void} clear
|
|
161
|
+
* @version 0.0.2
|
|
162
|
+
*/
|
|
163
|
+
clear: () => void;
|
|
164
|
+
/**
|
|
165
|
+
* @property {() => void} select
|
|
166
|
+
* @version 0.0.2
|
|
167
|
+
*/
|
|
168
|
+
select: () => void;
|
|
169
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../index.css'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TooltipProps } from './type';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<TooltipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
close: (e: MouseEvent) => any;
|
|
4
|
+
open: (e: MouseEvent) => any;
|
|
5
|
+
"update:visible": (value: boolean) => any;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<TooltipProps> & Readonly<{
|
|
7
|
+
onClose?: ((e: MouseEvent) => any) | undefined;
|
|
8
|
+
onOpen?: ((e: MouseEvent) => any) | undefined;
|
|
9
|
+
"onUpdate:visible"?: ((value: boolean) => any) | undefined;
|
|
10
|
+
}>, {
|
|
11
|
+
variant: "dark" | "light";
|
|
12
|
+
placement: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end";
|
|
13
|
+
root: HTMLElement | string;
|
|
14
|
+
offset: number;
|
|
15
|
+
visible: boolean | null;
|
|
16
|
+
defaultVisible: boolean | null;
|
|
17
|
+
arrow: boolean;
|
|
18
|
+
trigger: "hover" | "click";
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
export default _default;
|