@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,432 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { defineComponent, createElementBlock, openBlock, normalizeStyle, createElementVNode, getCurrentInstance, ref, inject, computed, shallowRef, useSlots, watch, onMounted, nextTick, normalizeClass, createCommentVNode, unref, renderSlot, withModifiers, createBlock, toDisplayString, createVNode } from "vue";
|
|
3
|
+
import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
4
|
+
import { d as drawBorder } from "./draw.js";
|
|
5
|
+
import { g as getGlobalThemeColor } from "../share/util/color.js";
|
|
6
|
+
import { a as canvasPreprocess, c as calcPixelSize, g as getBorderRadius, b as calcBorderCornerCenter, f as floodFill } from "../share/util/plot.js";
|
|
7
|
+
import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
8
|
+
import { u as useComposition } from "../share/hook/use-composition.js";
|
|
9
|
+
import { T as TimesCircleSolid, S as SpinnerThirdSolid } from "../auto-complete/index.js";
|
|
10
|
+
import { N } from "../aside/index.js";
|
|
11
|
+
import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
12
|
+
import { _ as _sfc_main$1 } from "../input-group/index.js";
|
|
13
|
+
import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
|
|
14
|
+
import { u as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
|
|
15
|
+
import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
|
|
16
|
+
import { B as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
17
|
+
import { u as useControlledMode } from "../share/hook/use-controlled-mode.js";
|
|
18
|
+
const Eye = /* @__PURE__ */ defineComponent({
|
|
19
|
+
props: {
|
|
20
|
+
size: {},
|
|
21
|
+
color: {}
|
|
22
|
+
},
|
|
23
|
+
setup(__props) {
|
|
24
|
+
const props = __props;
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
class: "px-icon-hn",
|
|
30
|
+
style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
|
|
31
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32
|
+
viewBox: "0 0 24 24"
|
|
33
|
+
},
|
|
34
|
+
[..._cache[0] || (_cache[0] = [
|
|
35
|
+
createElementVNode(
|
|
36
|
+
"path",
|
|
37
|
+
{ d: "M16 11h1v2h-1zM16 13v2h-1v1h-2v-1h1v-1h1v-1zM16 9v2h-1v-1h-1V9h-1V8h2v1zM11 16h2v1h-2zM11 15v1H9v-1H8v-2h1v1h1v1zM13 7v1h-1v3h-1v1H8v1H7v-2h1V9h1V8h2V7z" },
|
|
38
|
+
null,
|
|
39
|
+
-1
|
|
40
|
+
/* CACHED */
|
|
41
|
+
),
|
|
42
|
+
createElementVNode(
|
|
43
|
+
"path",
|
|
44
|
+
{ d: "M22 11V9h-1V8h-1V7h-1V6h-2V5H7v1H5v1H4v1H3v1H2v2H1v2h1v2h1v1h1v1h1v1h2v1h10v-1h2v-1h1v-1h1v-1h1v-2h1v-2zm-1 3h-1v1h-1v1h-1v1h-2v1H8v-1H7v-1H5v-1H4v-1H3v-4h1V9h1V8h1V7h2V6h8v1h2v1h1v1h1v1h1z" },
|
|
45
|
+
null,
|
|
46
|
+
-1
|
|
47
|
+
/* CACHED */
|
|
48
|
+
)
|
|
49
|
+
])],
|
|
50
|
+
4
|
|
51
|
+
/* STYLE */
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const EyeCross = /* @__PURE__ */ defineComponent({
|
|
57
|
+
props: {
|
|
58
|
+
size: {},
|
|
59
|
+
color: {}
|
|
60
|
+
},
|
|
61
|
+
setup(__props) {
|
|
62
|
+
const props = __props;
|
|
63
|
+
return (_ctx, _cache) => {
|
|
64
|
+
return openBlock(), createElementBlock(
|
|
65
|
+
"svg",
|
|
66
|
+
{
|
|
67
|
+
class: "px-icon-hn",
|
|
68
|
+
style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
|
|
69
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
70
|
+
viewBox: "0 0 24 24"
|
|
71
|
+
},
|
|
72
|
+
[..._cache[0] || (_cache[0] = [
|
|
73
|
+
createElementVNode(
|
|
74
|
+
"path",
|
|
75
|
+
{ d: "M15 13h1v2h-1v1h-2v-1h1v-1h1zM16 11h1v2h-1z" },
|
|
76
|
+
null,
|
|
77
|
+
-1
|
|
78
|
+
/* CACHED */
|
|
79
|
+
),
|
|
80
|
+
createElementVNode(
|
|
81
|
+
"path",
|
|
82
|
+
{ d: "M23 11v2h-1v2h-1v1h-1v1h-1v1h-2v1H9v-1h7v-1h2v-1h1v-1h1v-1h1v-4h-1V9h-1V8h2v1h1v2zM2 13H1v-2h1V9h1V8h1V7h1V6h2V5h8v1H8v1H6v1H5v1H4v1H3v4h1v1h1v1H3v-1H2z" },
|
|
83
|
+
null,
|
|
84
|
+
-1
|
|
85
|
+
/* CACHED */
|
|
86
|
+
),
|
|
87
|
+
createElementVNode(
|
|
88
|
+
"path",
|
|
89
|
+
{ d: "M13 7v1h-1v1h-1v1h-1v1H9v1H8v1H7v-2h1V9h1V8h2V7zM9 17H8v1H7v1H6v1H5v1H4v1H3v-1H2v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1V9h1V8h1V7h1V6h1V5h1V4h1V3h1V2h1v1h1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1H9zM11 16h2v1h-2z" },
|
|
90
|
+
null,
|
|
91
|
+
-1
|
|
92
|
+
/* CACHED */
|
|
93
|
+
)
|
|
94
|
+
])],
|
|
95
|
+
4
|
|
96
|
+
/* STYLE */
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const _hoisted_1 = {
|
|
102
|
+
key: 0,
|
|
103
|
+
class: "px-input-prefix-wrapper"
|
|
104
|
+
};
|
|
105
|
+
const _hoisted_2 = ["value", "placeholder", "disabled", "autofocus", "type"];
|
|
106
|
+
const _hoisted_3 = {
|
|
107
|
+
key: 1,
|
|
108
|
+
class: "px-input-close-wrapper"
|
|
109
|
+
};
|
|
110
|
+
const _hoisted_4 = {
|
|
111
|
+
key: 1,
|
|
112
|
+
class: "px-input-icon-placeholder"
|
|
113
|
+
};
|
|
114
|
+
const _hoisted_5 = {
|
|
115
|
+
key: 2,
|
|
116
|
+
class: "px-input-password-wrapper"
|
|
117
|
+
};
|
|
118
|
+
const _hoisted_6 = {
|
|
119
|
+
key: 3,
|
|
120
|
+
class: "px-input-count-wrapper"
|
|
121
|
+
};
|
|
122
|
+
const _hoisted_7 = {
|
|
123
|
+
key: 4,
|
|
124
|
+
class: "px-input-loading-wrapper"
|
|
125
|
+
};
|
|
126
|
+
const _hoisted_8 = {
|
|
127
|
+
key: 5,
|
|
128
|
+
class: "px-input-suffix-wrapper"
|
|
129
|
+
};
|
|
130
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
131
|
+
...{
|
|
132
|
+
name: "Input"
|
|
133
|
+
},
|
|
134
|
+
__name: "index",
|
|
135
|
+
props: {
|
|
136
|
+
modelValue: null,
|
|
137
|
+
defaultValue: null,
|
|
138
|
+
placeholder: null,
|
|
139
|
+
password: { type: Boolean, default: false },
|
|
140
|
+
disabled: { type: Boolean, default: false },
|
|
141
|
+
readonly: { type: Boolean, default: false },
|
|
142
|
+
clearable: { type: Boolean, default: false },
|
|
143
|
+
loading: { type: Boolean, default: false },
|
|
144
|
+
size: { default: "medium" },
|
|
145
|
+
shape: { default: "default" },
|
|
146
|
+
borderRadius: null,
|
|
147
|
+
maxLength: null,
|
|
148
|
+
showCount: { type: Boolean, default: false },
|
|
149
|
+
countGraphemes: { type: Function },
|
|
150
|
+
sliceGraphemes: { type: Function },
|
|
151
|
+
status: { default: "normal" },
|
|
152
|
+
autofocus: { type: Boolean },
|
|
153
|
+
nativeType: null
|
|
154
|
+
},
|
|
155
|
+
emits: ["input", "update:modelValue", "change", "clear", "blur", "focus"],
|
|
156
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
157
|
+
var _a;
|
|
158
|
+
const props = __props;
|
|
159
|
+
const emits = __emit;
|
|
160
|
+
const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({
|
|
161
|
+
afterComposition: (e) => {
|
|
162
|
+
nextTick(() => {
|
|
163
|
+
inputHandler(e);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const instance = getCurrentInstance();
|
|
168
|
+
const innerInputGroup = ref(((_a = instance == null ? void 0 : instance.parent) == null ? void 0 : _a.type) === _sfc_main$1);
|
|
169
|
+
const [_, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [ref(0), ref(false), ref(false)];
|
|
170
|
+
const inputGroupProps = inject(INPUT_GROUP_PROVIDE);
|
|
171
|
+
const borderRadiusComputed = computed(() => {
|
|
172
|
+
return innerInputGroup.value && inputGroupProps ? inputGroupProps.borderRadius : props.borderRadius;
|
|
173
|
+
});
|
|
174
|
+
const sizeComputed = computed(() => {
|
|
175
|
+
return innerInputGroup.value && inputGroupProps ? inputGroupProps.size : props.size;
|
|
176
|
+
});
|
|
177
|
+
const shapeComputed = computed(() => {
|
|
178
|
+
return innerInputGroup.value && inputGroupProps ? inputGroupProps.shape : props.shape;
|
|
179
|
+
});
|
|
180
|
+
const disabledComputed = computed(() => {
|
|
181
|
+
return innerInputGroup.value && inputGroupProps ? inputGroupProps.disabled || props.disabled : props.disabled;
|
|
182
|
+
});
|
|
183
|
+
const [inputValue, updateInputValue] = useControlledMode("modelValue", props, emits, {
|
|
184
|
+
defaultField: "defaultValue",
|
|
185
|
+
transform: (nextValue) => {
|
|
186
|
+
return nextValue || "";
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const wrapperRef = shallowRef(null);
|
|
190
|
+
const canvasRef = shallowRef(null);
|
|
191
|
+
const inputRef = shallowRef(null);
|
|
192
|
+
const currentLength = computed(() => {
|
|
193
|
+
return props.countGraphemes ? props.countGraphemes(inputValue.value) : inputValue.value.length;
|
|
194
|
+
});
|
|
195
|
+
const inputHandler = async (e) => {
|
|
196
|
+
const target = e.target;
|
|
197
|
+
let newValue = target.value;
|
|
198
|
+
inputValue.value = newValue;
|
|
199
|
+
if (isComposing.value) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
emits("input", newValue, e);
|
|
203
|
+
if (props.maxLength) {
|
|
204
|
+
if (props.countGraphemes && props.sliceGraphemes) {
|
|
205
|
+
await nextTick();
|
|
206
|
+
newValue = props.sliceGraphemes(inputValue.value, props.maxLength);
|
|
207
|
+
} else {
|
|
208
|
+
newValue = inputValue.value.slice(0, props.maxLength);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
updateInputValue(newValue);
|
|
212
|
+
};
|
|
213
|
+
const clearHandler = async () => {
|
|
214
|
+
await updateInputValue("");
|
|
215
|
+
emits("change", "");
|
|
216
|
+
emits("clear", "");
|
|
217
|
+
};
|
|
218
|
+
const changeHandler = (e) => {
|
|
219
|
+
const target = e.target;
|
|
220
|
+
emits("change", target.value, e);
|
|
221
|
+
};
|
|
222
|
+
const focusMode = ref(false);
|
|
223
|
+
const blurHandler = () => {
|
|
224
|
+
focusMode.value = false;
|
|
225
|
+
};
|
|
226
|
+
const focusHandler = () => {
|
|
227
|
+
focusMode.value = true;
|
|
228
|
+
};
|
|
229
|
+
const focusInputHandler = () => {
|
|
230
|
+
var _a2;
|
|
231
|
+
(_a2 = inputRef.value) == null ? void 0 : _a2.focus();
|
|
232
|
+
};
|
|
233
|
+
const hoverFlag = ref(false);
|
|
234
|
+
const mouseenterHandler = () => {
|
|
235
|
+
hoverFlag.value = true;
|
|
236
|
+
};
|
|
237
|
+
const mouseleaveHandler = () => {
|
|
238
|
+
hoverFlag.value = false;
|
|
239
|
+
};
|
|
240
|
+
const showClose = computed(() => {
|
|
241
|
+
return props.clearable && !disabledComputed.value && !props.readonly;
|
|
242
|
+
});
|
|
243
|
+
const showPassword = ref(false);
|
|
244
|
+
const toggleShowPassword = () => {
|
|
245
|
+
showPassword.value = !showPassword.value;
|
|
246
|
+
};
|
|
247
|
+
const typeComputed = computed(() => {
|
|
248
|
+
if (props.nativeType) {
|
|
249
|
+
return props.nativeType;
|
|
250
|
+
}
|
|
251
|
+
if (props.password) {
|
|
252
|
+
return showPassword.value ? "text" : "password";
|
|
253
|
+
}
|
|
254
|
+
return "text";
|
|
255
|
+
});
|
|
256
|
+
const slots = useSlots();
|
|
257
|
+
__expose({
|
|
258
|
+
focus: () => {
|
|
259
|
+
var _a2;
|
|
260
|
+
(_a2 = inputRef.value) == null ? void 0 : _a2.focus();
|
|
261
|
+
},
|
|
262
|
+
blur: () => {
|
|
263
|
+
var _a2;
|
|
264
|
+
(_a2 = inputRef.value) == null ? void 0 : _a2.blur();
|
|
265
|
+
},
|
|
266
|
+
clear: () => clearHandler(),
|
|
267
|
+
select: () => {
|
|
268
|
+
var _a2;
|
|
269
|
+
(_a2 = inputRef.value) == null ? void 0 : _a2.select();
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
const darkMode = useDarkMode();
|
|
273
|
+
watch(
|
|
274
|
+
[
|
|
275
|
+
first,
|
|
276
|
+
last,
|
|
277
|
+
borderRadiusComputed,
|
|
278
|
+
shapeComputed,
|
|
279
|
+
sizeComputed,
|
|
280
|
+
disabledComputed,
|
|
281
|
+
() => slots,
|
|
282
|
+
darkMode,
|
|
283
|
+
focusMode,
|
|
284
|
+
hoverFlag
|
|
285
|
+
],
|
|
286
|
+
() => {
|
|
287
|
+
setTimeout(() => {
|
|
288
|
+
drawPixel();
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
const drawPixel = () => {
|
|
293
|
+
const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
|
|
294
|
+
if (!preprocessData) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const { ctx, width, height, canvas } = preprocessData;
|
|
298
|
+
const pixelSize = calcPixelSize();
|
|
299
|
+
const borderRadius = getBorderRadius(
|
|
300
|
+
canvas,
|
|
301
|
+
pixelSize,
|
|
302
|
+
borderRadiusComputed.value,
|
|
303
|
+
shapeComputed.value,
|
|
304
|
+
sizeComputed.value || "medium",
|
|
305
|
+
innerInputGroup.value,
|
|
306
|
+
first.value,
|
|
307
|
+
last.value
|
|
308
|
+
);
|
|
309
|
+
const borderColor = props.status !== "normal" ? getGlobalThemeColor(props.status === "error" ? "danger" : props.status, 6) : (hoverFlag.value || focusMode.value) && !disabledComputed.value && !props.readonly ? getGlobalThemeColor("primary", 6) : getGlobalThemeColor("neutral", 10);
|
|
310
|
+
const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
|
|
311
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
312
|
+
drawBorder(
|
|
313
|
+
ctx,
|
|
314
|
+
width,
|
|
315
|
+
height,
|
|
316
|
+
center,
|
|
317
|
+
borderRadius,
|
|
318
|
+
rad,
|
|
319
|
+
borderColor,
|
|
320
|
+
pixelSize,
|
|
321
|
+
innerInputGroup.value,
|
|
322
|
+
first.value,
|
|
323
|
+
last.value
|
|
324
|
+
);
|
|
325
|
+
const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
|
|
326
|
+
floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
|
|
327
|
+
};
|
|
328
|
+
onMounted(() => {
|
|
329
|
+
nextTick(() => {
|
|
330
|
+
drawPixel();
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
useResizeObserver(wrapperRef, drawPixel);
|
|
334
|
+
useWatchGlobalCssVal(drawPixel);
|
|
335
|
+
return (_ctx, _cache) => {
|
|
336
|
+
return openBlock(), createElementBlock(
|
|
337
|
+
"div",
|
|
338
|
+
{
|
|
339
|
+
class: normalizeClass(["pixelium px-input", {
|
|
340
|
+
[`px-input__${sizeComputed.value}`]: !!sizeComputed.value,
|
|
341
|
+
[`px-input__${shapeComputed.value}`]: !!shapeComputed.value,
|
|
342
|
+
"px-input__inner": innerInputGroup.value,
|
|
343
|
+
"px-input__disabled": !!disabledComputed.value
|
|
344
|
+
}]),
|
|
345
|
+
ref_key: "wrapperRef",
|
|
346
|
+
ref: wrapperRef,
|
|
347
|
+
onClick: focusInputHandler,
|
|
348
|
+
onMouseenter: mouseenterHandler,
|
|
349
|
+
onMouseleave: mouseleaveHandler
|
|
350
|
+
},
|
|
351
|
+
[
|
|
352
|
+
unref(slots).prefix ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
353
|
+
renderSlot(_ctx.$slots, "prefix")
|
|
354
|
+
])) : createCommentVNode("v-if", true),
|
|
355
|
+
createElementVNode("input", {
|
|
356
|
+
class: "px-input-inner",
|
|
357
|
+
value: unref(inputValue),
|
|
358
|
+
ref_key: "inputRef",
|
|
359
|
+
ref: inputRef,
|
|
360
|
+
placeholder: props.placeholder,
|
|
361
|
+
disabled: disabledComputed.value || props.readonly,
|
|
362
|
+
autofocus: __props.autofocus,
|
|
363
|
+
type: typeComputed.value,
|
|
364
|
+
onInput: withModifiers(inputHandler, ["stop"]),
|
|
365
|
+
onChange: withModifiers(changeHandler, ["stop"]),
|
|
366
|
+
onBlur: blurHandler,
|
|
367
|
+
onFocus: focusHandler,
|
|
368
|
+
onCompositionstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
369
|
+
(...args) => unref(compositionStartHandler) && unref(compositionStartHandler)(...args)),
|
|
370
|
+
onCompositionend: _cache[1] || (_cache[1] = //@ts-ignore
|
|
371
|
+
(...args) => unref(compositionUpdateHandler) && unref(compositionUpdateHandler)(...args))
|
|
372
|
+
}, null, 40, _hoisted_2),
|
|
373
|
+
showClose.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
374
|
+
hoverFlag.value && !!unref(inputValue) ? (openBlock(), createBlock(unref(TimesCircleSolid), {
|
|
375
|
+
key: 0,
|
|
376
|
+
class: "px-input-icon",
|
|
377
|
+
onClick: clearHandler
|
|
378
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_4))
|
|
379
|
+
])) : createCommentVNode("v-if", true),
|
|
380
|
+
props.password ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
381
|
+
!showPassword.value ? (openBlock(), createBlock(unref(Eye), {
|
|
382
|
+
key: 0,
|
|
383
|
+
class: "px-input-icon",
|
|
384
|
+
onClick: toggleShowPassword
|
|
385
|
+
})) : (openBlock(), createBlock(unref(EyeCross), {
|
|
386
|
+
key: 1,
|
|
387
|
+
class: "px-input-icon",
|
|
388
|
+
onClick: toggleShowPassword
|
|
389
|
+
}))
|
|
390
|
+
])) : createCommentVNode("v-if", true),
|
|
391
|
+
props.showCount ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
392
|
+
renderSlot(_ctx.$slots, "count", {
|
|
393
|
+
value: unref(inputValue),
|
|
394
|
+
count: currentLength.value,
|
|
395
|
+
maxLength: props.maxLength
|
|
396
|
+
}, () => [
|
|
397
|
+
createElementVNode(
|
|
398
|
+
"span",
|
|
399
|
+
null,
|
|
400
|
+
toDisplayString(currentLength.value) + toDisplayString(unref(N)(props.maxLength) ? "" : " / " + props.maxLength),
|
|
401
|
+
1
|
|
402
|
+
/* TEXT */
|
|
403
|
+
)
|
|
404
|
+
])
|
|
405
|
+
])) : createCommentVNode("v-if", true),
|
|
406
|
+
props.loading ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
407
|
+
createVNode(unref(SpinnerThirdSolid), { class: "px-input-icon px-animation__loading" })
|
|
408
|
+
])) : createCommentVNode("v-if", true),
|
|
409
|
+
unref(slots).suffix ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
410
|
+
renderSlot(_ctx.$slots, "suffix")
|
|
411
|
+
])) : createCommentVNode("v-if", true),
|
|
412
|
+
createElementVNode(
|
|
413
|
+
"canvas",
|
|
414
|
+
{
|
|
415
|
+
class: "px-input-canvas",
|
|
416
|
+
ref_key: "canvasRef",
|
|
417
|
+
ref: canvasRef
|
|
418
|
+
},
|
|
419
|
+
null,
|
|
420
|
+
512
|
|
421
|
+
/* NEED_PATCH */
|
|
422
|
+
)
|
|
423
|
+
],
|
|
424
|
+
34
|
|
425
|
+
/* CLASS, NEED_HYDRATION */
|
|
426
|
+
);
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
export {
|
|
431
|
+
_sfc_main as _
|
|
432
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { NumberOrPercentage } from '../share/type';
|
|
2
|
+
export type InputProps = {
|
|
3
|
+
/**
|
|
4
|
+
* @property {string | null} [modelValue]
|
|
5
|
+
* @version 0.0.2
|
|
6
|
+
*/
|
|
7
|
+
modelValue?: string | null;
|
|
8
|
+
/**
|
|
9
|
+
* @property {string | null} [defaultValue]
|
|
10
|
+
* @version 0.0.2
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* @property {string} [placeholder]
|
|
15
|
+
* @version 0.0.2
|
|
16
|
+
*/
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @property {boolean} [password=false]
|
|
20
|
+
* @version 0.0.2
|
|
21
|
+
*/
|
|
22
|
+
password?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @property {boolean} [disabled=false]
|
|
25
|
+
* @version 0.0.2
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @property {boolean} [readonly=false]
|
|
30
|
+
* @version 0.0.2
|
|
31
|
+
*/
|
|
32
|
+
readonly?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @property {boolean} [clearable=false]
|
|
35
|
+
* @version 0.0.2
|
|
36
|
+
*/
|
|
37
|
+
clearable?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @property {boolean} [loading=false]
|
|
40
|
+
* @version 0.0.2
|
|
41
|
+
*/
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
45
|
+
* @version 0.0.2
|
|
46
|
+
*/
|
|
47
|
+
size?: 'medium' | 'large' | 'small';
|
|
48
|
+
/**
|
|
49
|
+
* @property {'default' | 'round'} [shape='default']
|
|
50
|
+
* @version 0.0.2
|
|
51
|
+
*/
|
|
52
|
+
shape?: 'default' | 'round';
|
|
53
|
+
/**
|
|
54
|
+
* @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
|
|
55
|
+
* @version 0.0.2
|
|
56
|
+
*/
|
|
57
|
+
borderRadius?: NumberOrPercentage | NumberOrPercentage[];
|
|
58
|
+
/**
|
|
59
|
+
* @property {number} [maxLength]
|
|
60
|
+
* @version 0.0.2
|
|
61
|
+
*/
|
|
62
|
+
maxLength?: number;
|
|
63
|
+
/**
|
|
64
|
+
* @property {boolean} [showCount=false]
|
|
65
|
+
* @version 0.0.2
|
|
66
|
+
*/
|
|
67
|
+
showCount?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @property {(value: string) => number} [countGraphemes]
|
|
70
|
+
* @version 0.0.2
|
|
71
|
+
*/
|
|
72
|
+
countGraphemes?: (value: string) => number;
|
|
73
|
+
/**
|
|
74
|
+
* @property {(value: string, limit: number) => string} [sliceGraphemes]
|
|
75
|
+
* @version 0.0.2
|
|
76
|
+
*/
|
|
77
|
+
sliceGraphemes?: (value: string, limit: number) => string;
|
|
78
|
+
/**
|
|
79
|
+
* @property {'success' | 'warning' | 'error' | 'normal'} [status='normal']
|
|
80
|
+
* @version 0.0.2
|
|
81
|
+
*/
|
|
82
|
+
status?: 'success' | 'warning' | 'error' | 'normal';
|
|
83
|
+
/**
|
|
84
|
+
* @property {boolean} [autofocus=false]
|
|
85
|
+
* @version 0.0.2
|
|
86
|
+
*/
|
|
87
|
+
autofocus?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* @property {'text' | 'password' | 'email' | 'tel' | 'url' | 'search'} [nativeType='text']
|
|
90
|
+
* @version 0.0.2
|
|
91
|
+
*/
|
|
92
|
+
nativeType?: 'text' | 'password' | 'email' | 'tel' | 'url' | 'search';
|
|
93
|
+
};
|
|
94
|
+
export type InputEvents = {
|
|
95
|
+
/**
|
|
96
|
+
* @event input
|
|
97
|
+
* @param {string} value
|
|
98
|
+
* @param {Event} e
|
|
99
|
+
* @version 0.0.2
|
|
100
|
+
*/
|
|
101
|
+
input: [value: string, e: Event];
|
|
102
|
+
/**
|
|
103
|
+
* @event update:modelValue
|
|
104
|
+
* @param {string} value
|
|
105
|
+
* @version 0.0.2
|
|
106
|
+
*/
|
|
107
|
+
'update:modelValue': [value: string];
|
|
108
|
+
/**
|
|
109
|
+
* @event change
|
|
110
|
+
* @param {string} value
|
|
111
|
+
* @param {Event | undefined} e
|
|
112
|
+
* @version 0.0.2
|
|
113
|
+
*/
|
|
114
|
+
change: [value: string, e?: Event];
|
|
115
|
+
/**
|
|
116
|
+
* @event clear
|
|
117
|
+
* @param {string} value
|
|
118
|
+
* @version 0.0.2
|
|
119
|
+
*/
|
|
120
|
+
clear: [value: string];
|
|
121
|
+
/**
|
|
122
|
+
* @event blur
|
|
123
|
+
* @param {FocusEvent} e
|
|
124
|
+
* @version 0.0.2
|
|
125
|
+
*/
|
|
126
|
+
blur: [e: FocusEvent];
|
|
127
|
+
/**
|
|
128
|
+
* @event focus
|
|
129
|
+
* @param {FocusEvent} e
|
|
130
|
+
* @version 0.0.2
|
|
131
|
+
*/
|
|
132
|
+
focus: [e: FocusEvent];
|
|
133
|
+
};
|
|
134
|
+
export type InputSlots = {
|
|
135
|
+
/**
|
|
136
|
+
* @slot prefix
|
|
137
|
+
* @version 0.0.2
|
|
138
|
+
*/
|
|
139
|
+
prefix: {};
|
|
140
|
+
/**
|
|
141
|
+
* @slot suffix
|
|
142
|
+
* @version 0.0.2
|
|
143
|
+
*/
|
|
144
|
+
suffix: {};
|
|
145
|
+
/**
|
|
146
|
+
* @slot count
|
|
147
|
+
* @param {number} inputValue
|
|
148
|
+
* @param {number} currentLength
|
|
149
|
+
* @param {number} maxLength
|
|
150
|
+
* @version 0.0.2
|
|
151
|
+
*/
|
|
152
|
+
count: {};
|
|
153
|
+
};
|
|
154
|
+
export type InputExpose = {
|
|
155
|
+
/**
|
|
156
|
+
* @property {() => void} focus
|
|
157
|
+
* @version 0.0.2
|
|
158
|
+
*/
|
|
159
|
+
focus: () => void;
|
|
160
|
+
/**
|
|
161
|
+
* @property {() => void} blur
|
|
162
|
+
* @version 0.0.2
|
|
163
|
+
*/
|
|
164
|
+
blur: () => void;
|
|
165
|
+
/**
|
|
166
|
+
* @property {() => void} clear
|
|
167
|
+
* @version 0.0.2
|
|
168
|
+
*/
|
|
169
|
+
clear: () => void;
|
|
170
|
+
/**
|
|
171
|
+
* @property {() => void} select
|
|
172
|
+
* @version 0.0.2
|
|
173
|
+
*/
|
|
174
|
+
select: () => void;
|
|
175
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.px-input-group {
|
|
2
|
+
height: var(--button-size);
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: start;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
.px-input-group > .px-button,
|
|
8
|
+
.px-input-group > .px-input,
|
|
9
|
+
.px-input-group > .px-input-number,
|
|
10
|
+
.px-input-group > .px-auto-complete,
|
|
11
|
+
.px-input-group > .px-input-tag,
|
|
12
|
+
.px-input-group > .px-select,
|
|
13
|
+
.px-input-group > .px-input-group-label {
|
|
14
|
+
margin-left: calc(-2 * var(--px-bit) - 1px);
|
|
15
|
+
}
|
|
16
|
+
.px-input-group > .px-button:first-child,
|
|
17
|
+
.px-input-group > .px-input:first-child,
|
|
18
|
+
.px-input-group > .px-input-number:first-child,
|
|
19
|
+
.px-input-group > .px-auto-complete:first-child,
|
|
20
|
+
.px-input-group > .px-input-tag:first-child,
|
|
21
|
+
.px-input-group > .px-select:first-child,
|
|
22
|
+
.px-input-group > .px-input-group-label:first-child {
|
|
23
|
+
margin-left: 0;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InputGroupProps } from './type';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<InputGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<InputGroupProps> & Readonly<{}>, {
|
|
7
|
+
shape: "default" | "round";
|
|
8
|
+
size: "medium" | "large" | "small";
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { defineComponent, provide, createElementBlock, openBlock, renderSlot } from "vue";
|
|
3
|
+
import { e as emitParentUpdate } from "../share/hook/use-index-of-children.js";
|
|
4
|
+
import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
|
|
5
|
+
import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
class: "pixelium px-input-group",
|
|
8
|
+
ref: "slotWrapper"
|
|
9
|
+
};
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
...{
|
|
12
|
+
name: "InputGroup"
|
|
13
|
+
},
|
|
14
|
+
__name: "index",
|
|
15
|
+
props: {
|
|
16
|
+
borderRadius: null,
|
|
17
|
+
shape: { default: "default" },
|
|
18
|
+
size: { default: "medium" },
|
|
19
|
+
disabled: { type: Boolean, default: false }
|
|
20
|
+
},
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
provide(INPUT_GROUP_PROVIDE, props);
|
|
24
|
+
emitParentUpdate(INPUT_GROUP_UPDATE);
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock(
|
|
27
|
+
"div",
|
|
28
|
+
_hoisted_1,
|
|
29
|
+
[
|
|
30
|
+
renderSlot(_ctx.$slots, "default")
|
|
31
|
+
],
|
|
32
|
+
512
|
|
33
|
+
/* NEED_PATCH */
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
_sfc_main as _
|
|
40
|
+
};
|