@pixelium/web-vue 0.0.2 → 0.0.3-alpha
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 +42 -0
- package/README.zh.md +6 -3
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1602 -248
- package/dist/normalize.css +2 -0
- package/dist/pixelium-vue-icon-hn.cjs +1 -1
- package/dist/pixelium-vue-icon-hn.css +2 -1
- package/dist/pixelium-vue-icon-hn.js +8533 -8154
- package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.css +2 -1
- package/dist/pixelium-vue-icon-pa.js +10625 -10143
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
- package/dist/pixelium-vue.cjs +2 -2
- package/dist/pixelium-vue.css +2 -1
- package/dist/pixelium-vue.js +7407 -5852
- package/dist/pixelium-vue.umd.cjs +2 -2
- package/es/aside/index.css +1 -0
- package/es/aside/index.js +46 -151
- package/es/auto-complete/draw.d.ts +1 -1
- package/es/auto-complete/draw.js +26 -51
- package/es/auto-complete/index.css +92 -32
- package/es/auto-complete/index.d.ts +12 -15
- package/es/auto-complete/index.js +338 -400
- package/es/auto-complete/type.d.ts +25 -13
- package/es/avatar/css.js +2 -0
- package/es/avatar/draw.d.ts +2 -0
- package/es/avatar/draw.js +11 -0
- package/es/avatar/index.css +49 -0
- package/es/avatar/index.d.ts +15 -0
- package/es/avatar/index.js +110 -0
- package/es/avatar/type.d.ts +34 -0
- package/es/button/draw.d.ts +4 -4
- package/es/button/draw.js +213 -297
- package/es/button/index.css +40 -30
- package/es/button/index.d.ts +0 -4
- package/es/button/index.js +230 -256
- package/es/button/type.d.ts +3 -3
- package/es/button-group/index.css +0 -3
- package/es/button-group/index.d.ts +1 -2
- package/es/button-group/index.js +59 -31
- package/es/button-group/type.d.ts +21 -4
- package/es/checkbox/css.js +2 -0
- package/es/checkbox/draw.d.ts +4 -0
- package/es/checkbox/draw.js +46 -0
- package/es/checkbox/index.css +85 -0
- package/es/checkbox/index.d.ts +31 -0
- package/es/checkbox/index.js +206 -0
- package/es/checkbox/type.d.ts +88 -0
- package/es/checkbox-group/css.js +2 -0
- package/es/checkbox-group/index.css +20 -0
- package/es/checkbox-group/index.d.ts +23 -0
- package/es/checkbox-group/index.js +84 -0
- package/es/checkbox-group/type.d.ts +78 -0
- package/es/col/index.d.ts +2 -2
- package/es/col/index.js +43 -58
- package/es/container/index.css +1 -0
- package/es/container/index.js +18 -31
- package/es/divider/index.js +39 -53
- package/es/empty/index.css +4 -4
- package/es/empty/index.js +16 -71
- package/es/entry.js +102 -0
- package/es/footer/index.css +1 -0
- package/es/footer/index.js +31 -40
- package/es/form/css.js +1 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +125 -0
- package/es/form/type.d.ts +238 -0
- package/es/form/use-form.d.ts +4 -0
- package/es/form/use-form.js +48 -0
- package/es/form-item/css.js +2 -0
- package/es/form-item/index.css +77 -0
- package/es/form-item/index.d.ts +37 -0
- package/es/form-item/index.js +318 -0
- package/es/form-item/type.d.ts +96 -0
- package/es/grid/index.js +56 -75
- package/es/grid-item/css.js +0 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +85 -121
- package/es/header/index.css +1 -0
- package/es/header/index.js +31 -40
- package/es/icon/index.js +44 -55
- package/es/icons/css-hn.js +0 -1
- package/es/icons/css-pa.js +0 -1
- package/es/icons/icon-hn.js +10337 -15986
- package/es/icons/icon-pa.js +12573 -17447
- package/es/image/css.js +2 -0
- package/es/image/index.css +69 -0
- package/es/image/index.d.ts +35 -0
- package/es/image/index.js +199 -0
- package/es/image/type.d.ts +126 -0
- package/es/index.css +1 -515
- package/es/index.d.ts +22 -2
- package/es/index.js +144 -123
- package/es/input/draw.d.ts +1 -1
- package/es/input/draw.js +26 -51
- package/es/input/index.css +85 -33
- package/es/input/index.d.ts +9 -16
- package/es/input/index.js +319 -423
- package/es/input/type.d.ts +3 -3
- package/es/input-group/index.css +0 -1
- package/es/input-group/index.d.ts +2 -2
- package/es/input-group/index.js +66 -37
- package/es/input-group/type.d.ts +16 -4
- package/es/input-group-label/draw.d.ts +1 -1
- package/es/input-group-label/draw.js +26 -51
- package/es/input-group-label/index.css +33 -22
- package/es/input-group-label/index.d.ts +1 -4
- package/es/input-group-label/index.js +104 -127
- package/es/input-group-label/type.d.ts +3 -3
- package/es/input-number/draw.d.ts +1 -1
- package/es/input-number/draw.js +26 -51
- package/es/input-number/index.css +90 -35
- package/es/input-number/index.d.ts +9 -16
- package/es/input-number/index.js +428 -536
- package/es/input-number/type.d.ts +3 -3
- package/es/input-tag/draw.d.ts +1 -1
- package/es/input-tag/draw.js +26 -48
- package/es/input-tag/index.css +100 -33
- package/es/input-tag/index.d.ts +7 -13
- package/es/input-tag/index.js +442 -467
- package/es/input-tag/type.d.ts +24 -13
- package/es/link/index.js +75 -106
- package/es/main/index.css +4 -0
- package/es/main/index.d.ts +4 -1
- package/es/main/index.js +15 -15
- package/es/main/type.d.ts +7 -0
- package/es/mask/index.js +94 -115
- package/es/message/index.css +1 -1
- package/es/message/index.js +168 -346
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +98 -114
- package/es/message-box/message-box-wrapped.js +33 -46
- package/es/message-box/message-box.js +79 -111
- package/es/option-list/index.css +13 -13
- package/es/option-list/index.d.ts +4 -31
- package/es/option-list/index.js +99 -167
- package/es/option-list/type.d.ts +5 -1
- package/es/pixelate/pixel.d.ts +5 -0
- package/es/pixelate/pixel.js +70 -0
- package/es/pixelate/pixelate.worker.d.ts +1 -0
- package/es/popover/index.d.ts +13 -99
- package/es/popover/index.js +75 -238
- package/es/popover/type.d.ts +7 -2
- package/es/popup/css.js +1 -0
- package/es/popup/index.d.ts +210 -0
- package/es/popup/index.js +203 -0
- package/es/popup/type.d.ts +105 -0
- package/es/popup-content/draw.d.ts +2 -2
- package/es/popup-content/draw.js +98 -143
- package/es/popup-content/index.css +11 -11
- package/es/popup-content/index.d.ts +1 -0
- package/es/popup-content/index.js +253 -1576
- package/es/popup-content/type.d.ts +1 -0
- package/es/popup-trigger/index.d.ts +8 -2
- package/es/popup-trigger/index.js +122 -95
- package/es/popup-trigger/type.d.ts +4 -1
- package/es/popup-wrapper/css.js +2 -0
- package/es/popup-wrapper/index.css +14 -0
- package/es/popup-wrapper/index.d.ts +18 -0
- package/es/popup-wrapper/index.js +67 -0
- package/es/popup-wrapper/type.d.ts +9 -0
- package/es/radio/css.js +1 -0
- package/es/radio/draw.d.ts +4 -0
- package/es/radio/draw.js +47 -0
- package/es/radio/index.d.ts +30 -0
- package/es/radio/index.js +190 -0
- package/es/radio/style.css +73 -0
- package/es/radio/type.d.ts +76 -0
- package/es/radio-group/css.js +2 -0
- package/es/radio-group/index.css +20 -0
- package/es/radio-group/index.d.ts +23 -0
- package/es/radio-group/index.js +77 -0
- package/es/radio-group/type.d.ts +77 -0
- package/es/row/index.js +56 -70
- package/es/select/draw.d.ts +1 -1
- package/es/select/draw.js +26 -51
- package/es/select/index.css +118 -36
- package/es/select/index.d.ts +14 -16
- package/es/select/index.js +625 -672
- package/es/select/type.d.ts +60 -25
- package/es/share/const/event-bus-key.js +1 -6
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +22 -24
- package/es/share/const/provide-key.d.ts +5 -0
- package/es/share/const/provide-key.js +6 -5
- package/es/share/const/style.d.ts +6 -0
- package/es/share/const/style.js +7 -0
- package/es/share/hook/use-cancelable-delay.d.ts +1 -0
- package/es/share/hook/use-cancelable-delay.js +42 -0
- package/es/share/hook/use-click-outside-listener.d.ts +1 -1
- package/es/share/hook/use-click-outside-listener.js +28 -41
- package/es/share/hook/use-composition.js +17 -15
- package/es/share/hook/use-controlled-mode.d.ts +3 -3
- package/es/share/hook/use-controlled-mode.js +20 -23
- package/es/share/hook/use-dark-mode.js +51 -65
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +47 -45
- package/es/share/hook/use-lazy-load.d.ts +10 -0
- package/es/share/hook/use-lazy-load.js +133 -0
- package/es/share/hook/use-props-detect.d.ts +2 -0
- package/es/share/hook/use-resize-observer.d.ts +1 -2
- package/es/share/hook/use-resize-observer.js +28 -20
- package/es/share/hook/use-screen-width.js +27 -36
- package/es/share/hook/use-smooth-transition.d.ts +2 -0
- package/es/share/hook/use-smooth-transition.js +65 -0
- package/es/share/hook/use-textarea-height.js +86 -92
- package/es/share/hook/use-theme-mode.js +41 -42
- package/es/share/hook/use-transition-end.d.ts +2 -0
- package/es/share/hook/use-transition-end.js +12 -0
- package/es/share/hook/use-watch-global-css-var.js +12 -16
- package/es/share/hook/use-window-resize-listener.d.ts +1 -0
- package/es/share/hook/use-window-resize-listener.js +15 -0
- package/es/share/hook/use-z-index.js +30 -27
- package/es/share/style/index.css +5 -0
- package/es/share/type/index.d.ts +18 -3
- package/es/share/util/color.d.ts +5 -3
- package/es/share/util/color.js +156 -149
- package/es/share/util/common.d.ts +7 -2
- package/es/share/util/common.js +127 -65
- package/es/share/util/console.d.ts +3 -3
- package/es/share/util/console.js +10 -7
- package/es/share/util/dom.d.ts +19 -0
- package/es/share/util/dom.js +88 -0
- package/es/share/util/env.d.ts +1 -0
- package/es/share/util/env.js +5 -4
- package/es/share/util/event-bus.js +3 -20
- package/es/share/util/lru-cache.js +29 -33
- package/es/share/util/pixel.d.ts +4 -0
- package/es/share/util/plot.d.ts +8 -3
- package/es/share/util/plot.js +457 -229
- package/es/share/util/reactivity.d.ts +8 -0
- package/es/share/util/reactivity.js +23 -0
- package/es/share/util/render.js +31 -41
- package/es/share/util/theme.d.ts +3 -0
- package/es/share/util/theme.js +77 -57
- package/es/slider/css.js +2 -0
- package/es/slider/draw.d.ts +25 -0
- package/es/slider/draw.js +113 -0
- package/es/slider/index.css +119 -0
- package/es/slider/index.d.ts +66 -0
- package/es/slider/index.js +503 -0
- package/es/slider/type.d.ts +162 -0
- package/es/slider/util.d.ts +37 -0
- package/es/slider/util.js +130 -0
- package/es/space/index.css +24 -29
- package/es/space/index.js +73 -97
- package/es/spin/index.css +18 -17
- package/es/spin/index.js +72 -102
- package/es/spin/type.d.ts +11 -5
- package/es/switch/css.js +2 -0
- package/es/switch/draw.d.ts +2 -0
- package/es/switch/draw.js +18 -0
- package/es/switch/index.css +121 -0
- package/es/switch/index.d.ts +42 -0
- package/es/switch/index.js +259 -0
- package/es/switch/type.d.ts +133 -0
- package/es/tag/draw.d.ts +2 -2
- package/es/tag/draw.js +80 -127
- package/es/tag/index.css +38 -22
- package/es/tag/index.d.ts +2 -2
- package/es/tag/index.js +121 -190
- package/es/tag/type.d.ts +3 -3
- package/es/text-outline/css.js +2 -0
- package/es/text-outline/index.css +4 -0
- package/es/text-outline/index.d.ts +17 -0
- package/es/text-outline/index.js +33 -0
- package/es/text-outline/type.d.ts +23 -0
- package/es/textarea/draw.js +9 -11
- package/es/textarea/index.css +37 -23
- package/es/textarea/index.d.ts +8 -14
- package/es/textarea/index.js +274 -262
- package/es/tooltip/index.d.ts +100 -4
- package/es/tooltip/index.js +70 -226
- package/es/tooltip/type.d.ts +7 -2
- package/es/vendor.js +504 -0
- package/es/virtual-list/css.js +2 -0
- package/es/virtual-list/index.css +25 -0
- package/es/virtual-list/index.d.ts +11 -0
- package/es/virtual-list/index.js +313 -0
- package/es/virtual-list/type.d.ts +26 -0
- package/package.json +10 -16
- package/es/grid-item/index.css +0 -0
- /package/es/message-box/{message-box.css → index.css} +0 -0
package/es/textarea/index.js
CHANGED
|
@@ -1,267 +1,279 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
import { O as Ue, V as spinner_third_solid_default, _ as E, l as times_circle_solid_default } from "../vendor.js";
|
|
3
|
+
import { i as canvasPreprocess, n as calcPixelSize } from "../share/util/plot.js";
|
|
4
|
+
import { n as getGlobalThemeColor } from "../share/util/color.js";
|
|
5
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
6
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
7
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
8
|
+
import { i as FORM_ITEM_PROVIDE } from "../share/const/provide-key.js";
|
|
9
|
+
import { t as createProvideComputed } from "../share/util/reactivity.js";
|
|
10
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
11
|
+
import { t as useComposition } from "../share/hook/use-composition.js";
|
|
12
|
+
import { t as useControlledMode } from "../share/hook/use-controlled-mode.js";
|
|
13
|
+
import { t as draw } from "./draw.js";
|
|
14
|
+
import { t as useTextareaHeight } from "../share/hook/use-textarea-height.js";
|
|
15
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderSlot, shallowRef, toDisplayString, unref, watch, withModifiers } from "vue";
|
|
16
|
+
var _hoisted_1 = [
|
|
17
|
+
"value",
|
|
18
|
+
"placeholder",
|
|
19
|
+
"disabled",
|
|
20
|
+
"autofocus",
|
|
21
|
+
"rows"
|
|
22
|
+
];
|
|
23
|
+
var _hoisted_2 = { class: "px-textarea-addition-wrapper" };
|
|
24
|
+
var _hoisted_3 = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "px-textarea-close-wrapper"
|
|
19
27
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
var _hoisted_4 = {
|
|
29
|
+
key: 1,
|
|
30
|
+
class: "px-textarea-count-wrapper"
|
|
23
31
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
var _hoisted_5 = {
|
|
33
|
+
key: 2,
|
|
34
|
+
class: "px-textarea-loading-wrapper"
|
|
27
35
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
36
|
+
var textarea_default = /* @__PURE__ */ defineComponent({
|
|
37
|
+
name: "Textarea",
|
|
38
|
+
__name: "index",
|
|
39
|
+
props: {
|
|
40
|
+
modelValue: null,
|
|
41
|
+
defaultValue: null,
|
|
42
|
+
rows: null,
|
|
43
|
+
minRows: { default: 1 },
|
|
44
|
+
maxRows: { default: Infinity },
|
|
45
|
+
autoResize: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
resize: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
placeholder: null,
|
|
54
|
+
disabled: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
readonly: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
clearable: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
loading: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
size: null,
|
|
71
|
+
maxLength: null,
|
|
72
|
+
showCount: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
},
|
|
76
|
+
countGraphemes: { type: Function },
|
|
77
|
+
sliceGraphemes: { type: Function },
|
|
78
|
+
status: { default: "normal" },
|
|
79
|
+
autofocus: { type: Boolean }
|
|
80
|
+
},
|
|
81
|
+
emits: [
|
|
82
|
+
"input",
|
|
83
|
+
"update:modelValue",
|
|
84
|
+
"change",
|
|
85
|
+
"clear",
|
|
86
|
+
"blur",
|
|
87
|
+
"focus"
|
|
88
|
+
],
|
|
89
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
90
|
+
const props = __props;
|
|
91
|
+
const formItemProvide = inject(FORM_ITEM_PROVIDE, void 0);
|
|
92
|
+
const emits = __emit;
|
|
93
|
+
const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({ afterComposition: (e) => {
|
|
94
|
+
nextTick(() => {
|
|
95
|
+
inputHandler(e);
|
|
96
|
+
});
|
|
97
|
+
} });
|
|
98
|
+
const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
|
|
99
|
+
defaultField: "defaultValue",
|
|
100
|
+
transform: (e) => {
|
|
101
|
+
return e || "";
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const disabledComputed = createProvideComputed("disabled", [formItemProvide, props], "or");
|
|
105
|
+
const readonlyComputed = createProvideComputed("readonly", [formItemProvide, props], "or");
|
|
106
|
+
const sizeComputed = createProvideComputed("size", () => [
|
|
107
|
+
props.size && props,
|
|
108
|
+
formItemProvide,
|
|
109
|
+
props
|
|
110
|
+
], "nullish", (val) => val || "medium");
|
|
111
|
+
const statusComputed = createProvideComputed("status", [formItemProvide, props]);
|
|
112
|
+
const wrapperRef = shallowRef(null);
|
|
113
|
+
const canvasRef = shallowRef(null);
|
|
114
|
+
const inputRef = shallowRef(null);
|
|
115
|
+
const [height, minHeight, maxHeight, refreshHeight] = useTextareaHeight(inputRef, props);
|
|
116
|
+
const currentLength = computed(() => {
|
|
117
|
+
return modelValue.value ? props.countGraphemes ? props.countGraphemes(modelValue.value) : modelValue.value.length : 0;
|
|
118
|
+
});
|
|
119
|
+
const inputHandler = async (e) => {
|
|
120
|
+
let newValue = e.target.value;
|
|
121
|
+
modelValue.value = newValue;
|
|
122
|
+
if (isComposing.value) return;
|
|
123
|
+
if (props.maxLength) if (props.countGraphemes && props.sliceGraphemes) {
|
|
124
|
+
await nextTick();
|
|
125
|
+
newValue = props.sliceGraphemes(newValue, props.maxLength);
|
|
126
|
+
} else newValue = newValue.slice(0, props.maxLength);
|
|
127
|
+
modelValue.value = newValue;
|
|
128
|
+
emits("input", newValue, e);
|
|
129
|
+
updateModelValue(newValue);
|
|
130
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.inputHandler();
|
|
131
|
+
};
|
|
132
|
+
const clearHandler = async () => {
|
|
133
|
+
await updateModelValue("");
|
|
134
|
+
emits("change", "");
|
|
135
|
+
emits("clear", "");
|
|
136
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
137
|
+
};
|
|
138
|
+
const changeHandler = (e) => {
|
|
139
|
+
const target = e.target;
|
|
140
|
+
refreshHeight();
|
|
141
|
+
emits("change", target.value, e);
|
|
142
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
143
|
+
};
|
|
144
|
+
const focusMode = ref(false);
|
|
145
|
+
const setHeight = () => {
|
|
146
|
+
if (props.autoResize && inputRef.value && height.value) inputRef.value.style.height = height.value + "px";
|
|
147
|
+
};
|
|
148
|
+
watch(height, () => {
|
|
149
|
+
setHeight();
|
|
150
|
+
});
|
|
151
|
+
const blurHandler = (e) => {
|
|
152
|
+
setHeight();
|
|
153
|
+
focusMode.value = false;
|
|
154
|
+
emits("blur", e);
|
|
155
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.blurHandler();
|
|
156
|
+
};
|
|
157
|
+
const focusHandler = (e) => {
|
|
158
|
+
setHeight();
|
|
159
|
+
focusMode.value = true;
|
|
160
|
+
emits("focus", e);
|
|
161
|
+
};
|
|
162
|
+
const showClose = computed(() => {
|
|
163
|
+
return props.clearable && focusMode.value && !disabledComputed.value && !readonlyComputed.value && !!modelValue.value;
|
|
164
|
+
});
|
|
165
|
+
const focusInputHandler = () => {
|
|
166
|
+
var _inputRef$value;
|
|
167
|
+
(_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 || _inputRef$value.focus();
|
|
168
|
+
};
|
|
169
|
+
const hoverFlag = ref(false);
|
|
170
|
+
const mouseenterHandler = () => {
|
|
171
|
+
hoverFlag.value = true;
|
|
172
|
+
};
|
|
173
|
+
const mouseleaveHandler = () => {
|
|
174
|
+
hoverFlag.value = false;
|
|
175
|
+
};
|
|
176
|
+
__expose({
|
|
177
|
+
focus: () => {
|
|
178
|
+
var _inputRef$value2;
|
|
179
|
+
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 || _inputRef$value2.focus();
|
|
180
|
+
},
|
|
181
|
+
blur: () => {
|
|
182
|
+
var _inputRef$value3;
|
|
183
|
+
(_inputRef$value3 = inputRef.value) === null || _inputRef$value3 === void 0 || _inputRef$value3.blur();
|
|
184
|
+
},
|
|
185
|
+
clear: () => clearHandler(),
|
|
186
|
+
select: () => {
|
|
187
|
+
var _inputRef$value4;
|
|
188
|
+
(_inputRef$value4 = inputRef.value) === null || _inputRef$value4 === void 0 || _inputRef$value4.select();
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
watch([
|
|
192
|
+
sizeComputed,
|
|
193
|
+
disabledComputed,
|
|
194
|
+
readonlyComputed,
|
|
195
|
+
useDarkMode(),
|
|
196
|
+
hoverFlag,
|
|
197
|
+
focusMode,
|
|
198
|
+
statusComputed
|
|
199
|
+
], () => {
|
|
200
|
+
setTimeout(() => {
|
|
201
|
+
drawPixelDebounce();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
const drawPixel = () => {
|
|
205
|
+
const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
|
|
206
|
+
if (!preprocessData) return;
|
|
207
|
+
const { ctx, width, height: height$1 } = preprocessData;
|
|
208
|
+
const pixelSize = calcPixelSize();
|
|
209
|
+
const borderColor = statusComputed.value !== "normal" ? getGlobalThemeColor(statusComputed.value === "error" ? "danger" : statusComputed.value, 6) : (hoverFlag.value || focusMode.value) && !disabledComputed.value && !readonlyComputed.value ? getGlobalThemeColor("primary", 6) : getGlobalThemeColor("neutral", 10);
|
|
210
|
+
const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
|
|
211
|
+
if (borderColor && backgroundColor) draw(ctx, width, height$1, borderColor, backgroundColor, pixelSize);
|
|
212
|
+
};
|
|
213
|
+
const drawPixelDebounce = Ue(drawPixel, 0, { maxWait: 50 });
|
|
214
|
+
onMounted(() => {
|
|
215
|
+
nextTick(() => {
|
|
216
|
+
drawPixel();
|
|
217
|
+
});
|
|
218
|
+
setTimeout(() => {
|
|
219
|
+
setHeight();
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
useResizeObserver(wrapperRef, drawPixelDebounce);
|
|
223
|
+
useWatchGlobalCssVal(drawPixelDebounce);
|
|
224
|
+
useTransitionEnd(wrapperRef, drawPixel);
|
|
225
|
+
return (_ctx, _cache) => {
|
|
226
|
+
return openBlock(), createElementBlock("div", {
|
|
227
|
+
class: normalizeClass(["pixelium px-textarea", {
|
|
228
|
+
[`px-textarea__${unref(sizeComputed)}`]: !!unref(sizeComputed),
|
|
229
|
+
"px-textarea__disabled": !!unref(disabledComputed),
|
|
230
|
+
"px-textarea__resize": !!props.resize
|
|
231
|
+
}]),
|
|
232
|
+
ref_key: "wrapperRef",
|
|
233
|
+
ref: wrapperRef,
|
|
234
|
+
onClick: focusInputHandler,
|
|
235
|
+
onMouseenter: mouseenterHandler,
|
|
236
|
+
onMouseleave: mouseleaveHandler,
|
|
237
|
+
onFocusout: blurHandler,
|
|
238
|
+
onFocusin: focusHandler
|
|
239
|
+
}, [
|
|
240
|
+
createElementVNode("textarea", {
|
|
241
|
+
class: "px-textarea-inner",
|
|
242
|
+
value: unref(modelValue),
|
|
243
|
+
ref_key: "inputRef",
|
|
244
|
+
ref: inputRef,
|
|
245
|
+
placeholder: props.placeholder,
|
|
246
|
+
disabled: unref(disabledComputed) || unref(readonlyComputed),
|
|
247
|
+
autofocus: __props.autofocus,
|
|
248
|
+
rows: props.rows,
|
|
249
|
+
style: normalizeStyle({
|
|
250
|
+
minHeight: unref(minHeight) ? unref(minHeight) + "px" : void 0,
|
|
251
|
+
maxHeight: unref(maxHeight) ? unref(maxHeight) + "px" : void 0
|
|
252
|
+
}),
|
|
253
|
+
onInput: withModifiers(inputHandler, ["stop"]),
|
|
254
|
+
onChange: withModifiers(changeHandler, ["stop"]),
|
|
255
|
+
onCompositionstart: _cache[0] || (_cache[0] = (...args) => unref(compositionStartHandler) && unref(compositionStartHandler)(...args)),
|
|
256
|
+
onCompositionend: _cache[1] || (_cache[1] = (...args) => unref(compositionUpdateHandler) && unref(compositionUpdateHandler)(...args))
|
|
257
|
+
}, null, 44, _hoisted_1),
|
|
258
|
+
createElementVNode("div", _hoisted_2, [
|
|
259
|
+
showClose.value ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(unref(times_circle_solid_default), {
|
|
260
|
+
class: "px-textarea-icon",
|
|
261
|
+
onClick: clearHandler
|
|
262
|
+
})])) : createCommentVNode("v-if", true),
|
|
263
|
+
props.showCount ? (openBlock(), createElementBlock("div", _hoisted_4, [renderSlot(_ctx.$slots, "count", {
|
|
264
|
+
value: unref(modelValue),
|
|
265
|
+
count: currentLength.value,
|
|
266
|
+
maxLength: props.maxLength
|
|
267
|
+
}, () => [createElementVNode("span", null, toDisplayString(currentLength.value) + toDisplayString(unref(E)(props.maxLength) ? "" : " / " + props.maxLength), 1)])])) : createCommentVNode("v-if", true),
|
|
268
|
+
props.loading ? (openBlock(), createElementBlock("div", _hoisted_5, [createVNode(unref(spinner_third_solid_default), { class: "px-textarea-icon px-animation__loading" })])) : createCommentVNode("v-if", true)
|
|
269
|
+
]),
|
|
270
|
+
createElementVNode("canvas", {
|
|
271
|
+
class: "px-textarea-canvas",
|
|
272
|
+
ref_key: "canvasRef",
|
|
273
|
+
ref: canvasRef
|
|
274
|
+
}, null, 512)
|
|
275
|
+
], 34);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
264
278
|
});
|
|
265
|
-
export {
|
|
266
|
-
_sfc_main as _
|
|
267
|
-
};
|
|
279
|
+
export { textarea_default as t };
|