@pixelium/web-vue 0.0.1-beta → 0.0.2
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 +5368 -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 +674 -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,30 @@
|
|
|
1
|
+
import type { NumberOrPercentage } from '../share/type';
|
|
2
|
+
export type InputGroupProps = {
|
|
3
|
+
/**
|
|
4
|
+
* @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
|
|
5
|
+
* @version 0.0.2
|
|
6
|
+
*/
|
|
7
|
+
borderRadius?: NumberOrPercentage | NumberOrPercentage[];
|
|
8
|
+
/**
|
|
9
|
+
* @property {'default' | 'round'} [shape='default']
|
|
10
|
+
* @version 0.0.2
|
|
11
|
+
*/
|
|
12
|
+
shape?: 'default' | 'round';
|
|
13
|
+
/**
|
|
14
|
+
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
15
|
+
* @version 0.0.2
|
|
16
|
+
*/
|
|
17
|
+
size?: 'medium' | 'large' | 'small';
|
|
18
|
+
/**
|
|
19
|
+
* @property {boolean} [disabled=false]
|
|
20
|
+
* @version 0.0.2
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type InputGroupSlots = {
|
|
25
|
+
/**
|
|
26
|
+
* @slot default
|
|
27
|
+
* @version 0.0.2
|
|
28
|
+
*/
|
|
29
|
+
default: {};
|
|
30
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RgbaColor } from '../share/type';
|
|
2
|
+
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number, inner: boolean, first: boolean, last: boolean) => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { r as rgbaColor2string } from "../share/util/color.js";
|
|
2
|
+
import { d as drawCircle } from "../share/util/plot.js";
|
|
3
|
+
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, inner, first, last) => {
|
|
4
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
5
|
+
for (let i = 0; i < 4; i++) {
|
|
6
|
+
if (borderRadius[i] > pixelSize) {
|
|
7
|
+
if (i === 1 || i === 2 ? inner && last || !inner : true) {
|
|
8
|
+
drawCircle(
|
|
9
|
+
ctx,
|
|
10
|
+
center[i][0],
|
|
11
|
+
center[i][1],
|
|
12
|
+
borderRadius[i],
|
|
13
|
+
rad[i][0],
|
|
14
|
+
rad[i][1],
|
|
15
|
+
pixelSize
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (center[1][0] + pixelSize > center[0][0]) {
|
|
21
|
+
ctx.fillRect(center[0][0], 0, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
22
|
+
}
|
|
23
|
+
if (center[2][1] + pixelSize > center[1][1] && (inner && last || !inner)) {
|
|
24
|
+
ctx.fillRect(
|
|
25
|
+
width - pixelSize,
|
|
26
|
+
center[1][1],
|
|
27
|
+
pixelSize,
|
|
28
|
+
center[2][1] - center[1][1] + pixelSize
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
if (center[3][0] < center[2][0] + pixelSize) {
|
|
32
|
+
ctx.fillRect(
|
|
33
|
+
center[3][0],
|
|
34
|
+
height - pixelSize,
|
|
35
|
+
center[2][0] - center[3][0] + pixelSize,
|
|
36
|
+
pixelSize
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const flag = inner && !first;
|
|
40
|
+
if (!flag && center[3][1] + pixelSize > center[0][1]) {
|
|
41
|
+
ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
42
|
+
}
|
|
43
|
+
if (inner && !first) {
|
|
44
|
+
ctx.fillRect(pixelSize / 2, 0, pixelSize / 2, height);
|
|
45
|
+
}
|
|
46
|
+
if (inner && !last) {
|
|
47
|
+
ctx.fillRect(width - 2 * pixelSize - 1, 0, pixelSize, height);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
drawBorder as d
|
|
52
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.px-input-group-label-canvas {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 50%;
|
|
4
|
+
left: 50%;
|
|
5
|
+
transform: translate(-50%, -50%);
|
|
6
|
+
z-index: -1;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
}
|
|
9
|
+
div.px-input-group-label {
|
|
10
|
+
font-size: var(--text-size);
|
|
11
|
+
}
|
|
12
|
+
.px-input-group-label {
|
|
13
|
+
--input-group-label-size: var(--px-medium-size);
|
|
14
|
+
--px-medium-padding-x: var(--px-interval-3);
|
|
15
|
+
--px-large-padding-x: var(--px-interval-4);
|
|
16
|
+
--px-small-padding-x: var(--px-interval-2);
|
|
17
|
+
--padding-x-size: var(--px-medium-padding-x);
|
|
18
|
+
--text-color: var(--px-neutral-10);
|
|
19
|
+
--text-size: var(--px-medium-font-size);
|
|
20
|
+
height: var(--input-group-label-size);
|
|
21
|
+
padding-left: var(--padding-x-size);
|
|
22
|
+
padding-right: var(--padding-x-size);
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
border-color: transparent;
|
|
25
|
+
border-width: var(--px-bit);
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
position: relative;
|
|
29
|
+
color: var(--text-color);
|
|
30
|
+
transition: 0.25s;
|
|
31
|
+
z-index: 0;
|
|
32
|
+
font-size: var(--text-size);
|
|
33
|
+
}
|
|
34
|
+
.px-input-group-label__inner {
|
|
35
|
+
transition: none;
|
|
36
|
+
padding-right: calc(var(--padding-x-size) + 1px + 1 * var(--px-bit));
|
|
37
|
+
}
|
|
38
|
+
.px-input-group-label__inner:last-child {
|
|
39
|
+
padding-right: var(--padding-x-size);
|
|
40
|
+
}
|
|
41
|
+
.px-input-group-label__large {
|
|
42
|
+
--padding-x-size: var(--px-large-padding-x);
|
|
43
|
+
--input-group-label-size: var(--px-large-size);
|
|
44
|
+
--text-size: var(--px-large-font-size);
|
|
45
|
+
}
|
|
46
|
+
.px-input-group-label__small {
|
|
47
|
+
--padding-x-size: var(--px-small-padding-x);
|
|
48
|
+
--input-group-label-size: var(--px-small-size);
|
|
49
|
+
--text-size: var(--px-small-font-size);
|
|
50
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InputGroupLabelProps } 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<InputGroupLabelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<InputGroupLabelProps> & Readonly<{}>, {
|
|
7
|
+
shape: "default" | "round";
|
|
8
|
+
size: "medium" | "large" | "small";
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { defineComponent, getCurrentInstance, ref, inject, computed, shallowRef, onMounted, nextTick, watch, createElementBlock, openBlock, normalizeClass, createElementVNode, renderSlot } from "vue";
|
|
3
|
+
import { a as canvasPreprocess, c as calcPixelSize, g as getBorderRadius, b as calcBorderCornerCenter, f as floodFill } from "../share/util/plot.js";
|
|
4
|
+
import { g as getGlobalThemeColor, p as parseColor } from "../share/util/color.js";
|
|
5
|
+
import { _ as _sfc_main$1 } from "../input-group/index.js";
|
|
6
|
+
import { d as drawBorder } from "./draw.js";
|
|
7
|
+
import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
8
|
+
import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
9
|
+
import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
10
|
+
import { u as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
|
|
11
|
+
import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
|
|
12
|
+
import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
|
|
13
|
+
import { B as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
14
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
|
+
...{
|
|
16
|
+
name: "InputGroupLabel"
|
|
17
|
+
},
|
|
18
|
+
__name: "index",
|
|
19
|
+
props: {
|
|
20
|
+
backgroundColor: null,
|
|
21
|
+
borderRadius: null,
|
|
22
|
+
shape: { default: "default" },
|
|
23
|
+
size: { default: "medium" }
|
|
24
|
+
},
|
|
25
|
+
setup(__props) {
|
|
26
|
+
var _a;
|
|
27
|
+
const props = __props;
|
|
28
|
+
const instance = getCurrentInstance();
|
|
29
|
+
const innerInputGroup = ref(((_a = instance == null ? void 0 : instance.parent) == null ? void 0 : _a.type) === _sfc_main$1);
|
|
30
|
+
const [_, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [ref(0), ref(false), ref(false)];
|
|
31
|
+
const inputGroupProps = inject(INPUT_GROUP_PROVIDE);
|
|
32
|
+
const borderRadiusComputed = computed(() => {
|
|
33
|
+
return innerInputGroup.value && inputGroupProps ? inputGroupProps.borderRadius : props.borderRadius;
|
|
34
|
+
});
|
|
35
|
+
const sizeComputed = computed(() => {
|
|
36
|
+
return innerInputGroup.value && inputGroupProps ? inputGroupProps.size : props.size;
|
|
37
|
+
});
|
|
38
|
+
const shapeComputed = computed(() => {
|
|
39
|
+
return innerInputGroup.value && inputGroupProps ? inputGroupProps.shape : props.shape;
|
|
40
|
+
});
|
|
41
|
+
const hoverFlag = ref(false);
|
|
42
|
+
const activeFlag = ref(false);
|
|
43
|
+
const darkMode = useDarkMode();
|
|
44
|
+
const canvasRef = shallowRef(null);
|
|
45
|
+
const labelRef = shallowRef(null);
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
nextTick(() => {
|
|
48
|
+
drawPixel();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
watch([borderRadiusComputed, shapeComputed, hoverFlag, activeFlag, darkMode], () => {
|
|
52
|
+
drawPixel();
|
|
53
|
+
});
|
|
54
|
+
watch([first, last], () => {
|
|
55
|
+
drawPixel();
|
|
56
|
+
});
|
|
57
|
+
const drawPixel = () => {
|
|
58
|
+
const preprocessData = canvasPreprocess(labelRef, canvasRef);
|
|
59
|
+
if (!preprocessData) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const { ctx, width, height, canvas } = preprocessData;
|
|
63
|
+
const pixelSize = calcPixelSize();
|
|
64
|
+
const borderRadius = getBorderRadius(
|
|
65
|
+
canvas,
|
|
66
|
+
pixelSize,
|
|
67
|
+
borderRadiusComputed.value,
|
|
68
|
+
shapeComputed.value,
|
|
69
|
+
sizeComputed.value || "medium",
|
|
70
|
+
innerInputGroup.value,
|
|
71
|
+
first.value,
|
|
72
|
+
last.value
|
|
73
|
+
);
|
|
74
|
+
const borderColor = getGlobalThemeColor("neutral", 10);
|
|
75
|
+
const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
|
|
76
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
77
|
+
drawBorder(
|
|
78
|
+
ctx,
|
|
79
|
+
width,
|
|
80
|
+
height,
|
|
81
|
+
center,
|
|
82
|
+
borderRadius,
|
|
83
|
+
rad,
|
|
84
|
+
borderColor,
|
|
85
|
+
pixelSize,
|
|
86
|
+
innerInputGroup.value,
|
|
87
|
+
first.value,
|
|
88
|
+
last.value
|
|
89
|
+
);
|
|
90
|
+
const backgroundColor = props.backgroundColor ? parseColor(props.backgroundColor) : getGlobalThemeColor("neutral", 3);
|
|
91
|
+
floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
|
|
92
|
+
};
|
|
93
|
+
useResizeObserver(labelRef, drawPixel);
|
|
94
|
+
useWatchGlobalCssVal(drawPixel);
|
|
95
|
+
return (_ctx, _cache) => {
|
|
96
|
+
return openBlock(), createElementBlock(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
class: normalizeClass(["pixelium px-input-group-label", {
|
|
100
|
+
"px-input-group-label__large": sizeComputed.value === "large",
|
|
101
|
+
"px-input-group-label__small": sizeComputed.value === "small",
|
|
102
|
+
"px-input-group-label__inner": innerInputGroup.value
|
|
103
|
+
}]),
|
|
104
|
+
ref_key: "labelRef",
|
|
105
|
+
ref: labelRef
|
|
106
|
+
},
|
|
107
|
+
[
|
|
108
|
+
createElementVNode(
|
|
109
|
+
"canvas",
|
|
110
|
+
{
|
|
111
|
+
ref_key: "canvasRef",
|
|
112
|
+
ref: canvasRef,
|
|
113
|
+
class: "px-input-group-label-canvas"
|
|
114
|
+
},
|
|
115
|
+
null,
|
|
116
|
+
512
|
|
117
|
+
/* NEED_PATCH */
|
|
118
|
+
),
|
|
119
|
+
renderSlot(_ctx.$slots, "default")
|
|
120
|
+
],
|
|
121
|
+
2
|
|
122
|
+
/* CLASS */
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
export {
|
|
128
|
+
_sfc_main as _
|
|
129
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { NumberOrPercentage } from '../share/type';
|
|
2
|
+
export type InputGroupLabelProps = {
|
|
3
|
+
/**
|
|
4
|
+
* @property {string} [backgroundColor]
|
|
5
|
+
* @version 0.0.2
|
|
6
|
+
*/
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
|
|
10
|
+
* @version 0.0.2
|
|
11
|
+
*/
|
|
12
|
+
borderRadius?: NumberOrPercentage | NumberOrPercentage[];
|
|
13
|
+
/**
|
|
14
|
+
* @property {'default' | 'round'} [shape='default']
|
|
15
|
+
* @version 0.0.2
|
|
16
|
+
*/
|
|
17
|
+
shape?: 'default' | 'round';
|
|
18
|
+
/**
|
|
19
|
+
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
20
|
+
* @version 0.0.2
|
|
21
|
+
*/
|
|
22
|
+
size?: 'medium' | 'large' | 'small';
|
|
23
|
+
};
|
|
24
|
+
export type InputGroupLabelSlots = {
|
|
25
|
+
/**
|
|
26
|
+
* @slot default
|
|
27
|
+
* @version 0.0.2
|
|
28
|
+
*/
|
|
29
|
+
default: {};
|
|
30
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RgbaColor } from '../share/type';
|
|
2
|
+
export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number, inner: boolean, first: boolean, last: boolean) => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { d as drawCircle } from "../share/util/plot.js";
|
|
2
|
+
import { r as rgbaColor2string } from "../share/util/color.js";
|
|
3
|
+
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, inner, first, last) => {
|
|
4
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
5
|
+
for (let i = 0; i < 4; i++) {
|
|
6
|
+
if (borderRadius[i] <= pixelSize) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
if (i === 1 || i === 2 ? inner && last || !inner : true) {
|
|
10
|
+
drawCircle(
|
|
11
|
+
ctx,
|
|
12
|
+
center[i][0],
|
|
13
|
+
center[i][1],
|
|
14
|
+
borderRadius[i],
|
|
15
|
+
rad[i][0],
|
|
16
|
+
rad[i][1],
|
|
17
|
+
pixelSize
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (center[1][0] + pixelSize > center[0][0]) {
|
|
22
|
+
ctx.fillRect(center[0][0], 0, center[1][0] - center[0][0] + pixelSize, pixelSize);
|
|
23
|
+
}
|
|
24
|
+
if (center[2][1] + pixelSize > center[1][1] && (inner && last || !inner)) {
|
|
25
|
+
ctx.fillRect(
|
|
26
|
+
width - pixelSize,
|
|
27
|
+
center[1][1],
|
|
28
|
+
pixelSize,
|
|
29
|
+
center[2][1] - center[1][1] + pixelSize
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (center[3][0] < center[2][0] + pixelSize) {
|
|
33
|
+
ctx.fillRect(
|
|
34
|
+
center[3][0],
|
|
35
|
+
height - pixelSize,
|
|
36
|
+
center[2][0] - center[3][0] + pixelSize,
|
|
37
|
+
pixelSize
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (center[3][1] + pixelSize > center[0][1] && !(inner && !first)) {
|
|
41
|
+
ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
42
|
+
}
|
|
43
|
+
if (inner && !first) {
|
|
44
|
+
ctx.fillRect(pixelSize / 2, 0, pixelSize / 2, height);
|
|
45
|
+
}
|
|
46
|
+
if (inner && !last) {
|
|
47
|
+
ctx.fillRect(width - 2 * pixelSize - 1, 0, pixelSize, height);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
drawBorder as d
|
|
52
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
div.px-input-number {
|
|
2
|
+
font-size: var(--text-size);
|
|
3
|
+
}
|
|
4
|
+
.px-input-number {
|
|
5
|
+
--input-number-size: var(--px-medium-size);
|
|
6
|
+
--px-medium-padding-x: var(--px-interval-2);
|
|
7
|
+
--px-large-padding-x: var(--px-interval-3);
|
|
8
|
+
--px-small-padding-x: var(--px-interval-2);
|
|
9
|
+
--padding-x-size: var(--px-medium-padding-x);
|
|
10
|
+
--text-size: var(--px-medium-font-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
|
+
padding: 0 var(--padding-x-size);
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
height: var(--input-number-size);
|
|
22
|
+
}
|
|
23
|
+
.px-input-number__inner {
|
|
24
|
+
padding-right: calc(var(--padding-x-size) + 1px + 1 * var(--px-bit));
|
|
25
|
+
}
|
|
26
|
+
.px-input-number__inner:last-child {
|
|
27
|
+
padding-right: var(--padding-x-size);
|
|
28
|
+
}
|
|
29
|
+
.px-input-number-inner {
|
|
30
|
+
height: 100%;
|
|
31
|
+
border: 0;
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
width: 100%;
|
|
35
|
+
font-size: var(--text-size);
|
|
36
|
+
line-height: var(--px-line-height);
|
|
37
|
+
font-family: var(--px-font);
|
|
38
|
+
padding: 0;
|
|
39
|
+
}
|
|
40
|
+
.px-input-number-inner:focus-visible {
|
|
41
|
+
outline-color: var(--px-neutral-10);
|
|
42
|
+
outline-offset: var(--px-bit);
|
|
43
|
+
}
|
|
44
|
+
.px-input-number-inner:disabled {
|
|
45
|
+
color: var(--px-neutral-10);
|
|
46
|
+
}
|
|
47
|
+
.px-input-number-inner::placeholder {
|
|
48
|
+
color: var(--px-neutral-8);
|
|
49
|
+
opacity: 1;
|
|
50
|
+
}
|
|
51
|
+
.px-input-number__large {
|
|
52
|
+
--padding-x-size: var(--px-large-padding-x);
|
|
53
|
+
--text-size: var(--px-large-font-size);
|
|
54
|
+
--input-number-size: var(--px-large-size);
|
|
55
|
+
}
|
|
56
|
+
.px-input-number__small {
|
|
57
|
+
--padding-x-size: var(--px-small-padding-x);
|
|
58
|
+
--input-number-size: var(--px-small-size);
|
|
59
|
+
--text-size: var(--px-small-font-size);
|
|
60
|
+
}
|
|
61
|
+
.px-input-number__disabled {
|
|
62
|
+
cursor: not-allowed;
|
|
63
|
+
}
|
|
64
|
+
.px-input-number__disabled .px-input-number-inner:disabled {
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
color: var(--px-neutral-8);
|
|
67
|
+
}
|
|
68
|
+
.px-input-number-setting-prefix-wrapper,
|
|
69
|
+
.px-input-number-setting-suffix-wrapper,
|
|
70
|
+
.px-input-number-prefix-wrapper,
|
|
71
|
+
.px-input-number-suffix-wrapper,
|
|
72
|
+
.px-input-number-loading-wrapper,
|
|
73
|
+
.px-input-number-close-wrapper {
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
}
|
|
78
|
+
.px-input-number-setting-prefix-wrapper,
|
|
79
|
+
.px-input-number-prefix-wrapper {
|
|
80
|
+
margin-right: var(--px-interval-2);
|
|
81
|
+
}
|
|
82
|
+
.px-input-number-setting-suffix-wrapper,
|
|
83
|
+
.px-input-number-suffix-wrapper,
|
|
84
|
+
.px-input-number-loading-wrapper,
|
|
85
|
+
.px-input-number-close-wrapper {
|
|
86
|
+
margin-left: var(--px-interval-2);
|
|
87
|
+
}
|
|
88
|
+
.px-input-number-close-wrapper .px-input-number-icon-placeholder {
|
|
89
|
+
width: var(--text-size);
|
|
90
|
+
height: var(--text-size);
|
|
91
|
+
}
|
|
92
|
+
.px-input-number-close-wrapper .px-input-number-icon {
|
|
93
|
+
width: var(--text-size);
|
|
94
|
+
height: var(--text-size);
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
fill: var(--px-neutral-8);
|
|
97
|
+
transition: 0.25s;
|
|
98
|
+
}
|
|
99
|
+
.px-input-number-close-wrapper .px-input-number-icon:hover {
|
|
100
|
+
fill: var(--px-neutral-7);
|
|
101
|
+
}
|
|
102
|
+
.px-input-number-close-wrapper .px-input-number-icon:active {
|
|
103
|
+
fill: var(--px-neutral-9);
|
|
104
|
+
}
|
|
105
|
+
.px-input-number-loading-wrapper .px-input-number-icon {
|
|
106
|
+
width: var(--text-size);
|
|
107
|
+
height: var(--text-size);
|
|
108
|
+
fill: var(--px-primary-6);
|
|
109
|
+
}
|
|
110
|
+
.px-input-number-prefix-wrapper,
|
|
111
|
+
.px-input-number-suffix-wrapper {
|
|
112
|
+
color: var(--px-neutral-10);
|
|
113
|
+
}
|
|
114
|
+
.px-input-number-setting-prefix-wrapper .px-input-number-icon,
|
|
115
|
+
.px-input-number-setting-suffix-wrapper .px-input-number-icon {
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
width: var(--text-size);
|
|
118
|
+
height: var(--text-size);
|
|
119
|
+
fill: var(--px-neutral-8);
|
|
120
|
+
transition: 0.25s;
|
|
121
|
+
margin-right: var(--px-interval-2);
|
|
122
|
+
}
|
|
123
|
+
.px-input-number-setting-prefix-wrapper .px-input-number-icon:hover,
|
|
124
|
+
.px-input-number-setting-suffix-wrapper .px-input-number-icon:hover {
|
|
125
|
+
fill: var(--px-primary-6);
|
|
126
|
+
}
|
|
127
|
+
.px-input-number-setting-prefix-wrapper .px-input-number-icon:active,
|
|
128
|
+
.px-input-number-setting-suffix-wrapper .px-input-number-icon:active {
|
|
129
|
+
fill: var(--px-neutral-9);
|
|
130
|
+
}
|
|
131
|
+
.px-input-number-setting-prefix-wrapper .px-input-number-icon:last-of-type,
|
|
132
|
+
.px-input-number-setting-suffix-wrapper .px-input-number-icon:last-of-type {
|
|
133
|
+
margin-right: 0;
|
|
134
|
+
}
|
|
135
|
+
.px-input-number-setting-prefix-wrapper .px-input-number-icon.px-input-number-icon__disabled,
|
|
136
|
+
.px-input-number-setting-suffix-wrapper .px-input-number-icon.px-input-number-icon__disabled {
|
|
137
|
+
cursor: not-allowed;
|
|
138
|
+
fill: var(--px-neutral-7);
|
|
139
|
+
}
|
|
140
|
+
.px-input-number-setting-prefix-wrapper__reverse,
|
|
141
|
+
.px-input-number-setting-suffix-wrapper__reverse {
|
|
142
|
+
flex-direction: row-reverse;
|
|
143
|
+
}
|
|
144
|
+
.px-input-number-setting-prefix-wrapper__reverse .px-input-number-icon,
|
|
145
|
+
.px-input-number-setting-suffix-wrapper__reverse .px-input-number-icon {
|
|
146
|
+
margin-right: 0;
|
|
147
|
+
margin-left: var(--px-interval-2);
|
|
148
|
+
}
|
|
149
|
+
.px-input-number-setting-prefix-wrapper__reverse .px-input-number-icon:last-of-type,
|
|
150
|
+
.px-input-number-setting-suffix-wrapper__reverse .px-input-number-icon:last-of-type {
|
|
151
|
+
margin-right: 0;
|
|
152
|
+
margin-left: 0;
|
|
153
|
+
}
|
|
154
|
+
.px-input-number-canvas {
|
|
155
|
+
position: absolute;
|
|
156
|
+
top: 50%;
|
|
157
|
+
left: 50%;
|
|
158
|
+
transform: translate(-50%, -50%);
|
|
159
|
+
z-index: -1;
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { InputNumberProps } from './type';
|
|
2
|
+
declare var __VLS_1: {}, __VLS_52: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
prefix?: (props: typeof __VLS_1) => any;
|
|
5
|
+
} & {
|
|
6
|
+
suffix?: (props: typeof __VLS_52) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<InputNumberProps, {
|
|
9
|
+
focus: () => void;
|
|
10
|
+
blur: () => void;
|
|
11
|
+
clear: () => Promise<void>;
|
|
12
|
+
select: () => void;
|
|
13
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
input: (value: number, e: Event) => any;
|
|
15
|
+
change: (value: number, e?: Event | undefined) => any;
|
|
16
|
+
clear: (value: number) => any;
|
|
17
|
+
blur: (e: FocusEvent) => any;
|
|
18
|
+
focus: (e: FocusEvent) => any;
|
|
19
|
+
"update:modelValue": (value: number) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<InputNumberProps> & Readonly<{
|
|
21
|
+
onInput?: ((value: number, e: Event) => any) | undefined;
|
|
22
|
+
onChange?: ((value: number, e?: Event | undefined) => any) | undefined;
|
|
23
|
+
onClear?: ((value: number) => any) | undefined;
|
|
24
|
+
onBlur?: ((e: FocusEvent) => any) | undefined;
|
|
25
|
+
onFocus?: ((e: FocusEvent) => any) | undefined;
|
|
26
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
shape: "default" | "round";
|
|
29
|
+
size: "medium" | "large" | "small";
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
loading: boolean;
|
|
32
|
+
readonly: boolean;
|
|
33
|
+
clearable: boolean;
|
|
34
|
+
status: "success" | "warning" | "error" | "normal";
|
|
35
|
+
max: number;
|
|
36
|
+
min: number;
|
|
37
|
+
step: number;
|
|
38
|
+
strickStep: boolean;
|
|
39
|
+
buttonPlacement: "start" | "end" | "both" | "start-reverse" | "end-reverse" | "both-reverse";
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
44
|
+
new (): {
|
|
45
|
+
$slots: S;
|
|
46
|
+
};
|
|
47
|
+
};
|