@pixelium/web-vue 0.0.2 → 0.0.3-beta
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/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-final.json +106 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +926 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1593 -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 +7402 -5852
- package/dist/pixelium-vue.umd.cjs +2 -2
- 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.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.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.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 +143 -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.js +11 -15
- 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/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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Nullish } from 'parsnip-kit';
|
|
2
|
+
import type { LooseRequired, RemoveUndefinedFromFields } from '../share/type';
|
|
3
|
+
import type { SliderProps } from './type';
|
|
4
|
+
import { type ShallowRef } from 'vue';
|
|
5
|
+
export declare function clampValue(value: number, props: RemoveUndefinedFromFields<LooseRequired<SliderProps>, 'min' | 'max'>): number;
|
|
6
|
+
export declare const transformModelValue: (value: number | [number, number] | Nullish, props: RemoveUndefinedFromFields<LooseRequired<SliderProps>, "min" | "max">, emits: (evt: "update:modelValue", value: number | [number, number]) => void) => number | [number, number];
|
|
7
|
+
export declare const getTargetThumbEl: (e: MouseEvent | TouchEvent, direction: SliderProps["direction"], thumbStartRef: ShallowRef<HTMLDivElement | null>, thumbEndRef: ShallowRef<HTMLDivElement | null>) => {
|
|
8
|
+
thumbEl: HTMLDivElement | null;
|
|
9
|
+
targetType: "start";
|
|
10
|
+
} | {
|
|
11
|
+
thumbEl: HTMLDivElement | null;
|
|
12
|
+
targetType: "end";
|
|
13
|
+
};
|
|
14
|
+
export declare const calcValueFromEvent: (e: MouseEvent | TouchEvent, sliderEl: HTMLDivElement, thumbEl: HTMLDivElement, valueRange: number, props: RemoveUndefinedFromFields<LooseRequired<SliderProps>, "min" | "max">) => number;
|
|
15
|
+
export declare const calcThumbLeft: (value: number, sliderRect: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}, thumbRect: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}, valueRange: number, props: RemoveUndefinedFromFields<LooseRequired<SliderProps>, "min" | "max">) => number;
|
|
22
|
+
export declare const updateMarkPoints: (rect: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}, valueRange: number, props: RemoveUndefinedFromFields<LooseRequired<SliderProps>, "min" | "max">) => ({
|
|
26
|
+
value: number;
|
|
27
|
+
left: number;
|
|
28
|
+
markLeft: number;
|
|
29
|
+
label?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
value: number;
|
|
32
|
+
label: string | undefined;
|
|
33
|
+
left: number;
|
|
34
|
+
markLeft: number;
|
|
35
|
+
})[];
|
|
36
|
+
export declare const getRangeValue: (modelValue: SliderProps["modelValue"], index: 0 | 1, props: RemoveUndefinedFromFields<LooseRequired<SliderProps>, "min" | "max">) => number | null | undefined;
|
|
37
|
+
export declare const getSingleValue: (modelValue: SliderProps["modelValue"]) => number | null | undefined;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { D as S, P as ke, T as R, _ as E, g as A, j as en } from "../vendor.js";
|
|
2
|
+
import { i as fixedNumber } from "../share/util/common.js";
|
|
3
|
+
import { n as calcPixelSize } from "../share/util/plot.js";
|
|
4
|
+
import "vue";
|
|
5
|
+
function clampValue(value, props) {
|
|
6
|
+
const step = props.step;
|
|
7
|
+
if (!step || R(step)) return ke(A(props.precision) ? fixedNumber(value, props.precision) : value, props.min, props.max);
|
|
8
|
+
const marks = props.marks;
|
|
9
|
+
if (!(marks === null || marks === void 0 ? void 0 : marks.length)) if (!A(step)) return ke(A(props.precision) ? fixedNumber(value, props.precision) : value, props.min, props.max);
|
|
10
|
+
else {
|
|
11
|
+
let valueWithStep = Math.round((value - props.min) / step) * step + props.min;
|
|
12
|
+
if (valueWithStep < props.min) valueWithStep = Math.ceil((value - props.min) / step) * step + props.min;
|
|
13
|
+
if (valueWithStep > props.max) valueWithStep = Math.floor((value - props.min) / step) * step + props.min;
|
|
14
|
+
return A(props.precision) ? fixedNumber(valueWithStep, props.precision) : valueWithStep;
|
|
15
|
+
}
|
|
16
|
+
const markValues = marks.map((mark) => A(mark) ? mark : mark.value).filter((e) => e >= props.min && e <= props.max);
|
|
17
|
+
let closestStepPoint;
|
|
18
|
+
if (A(step)) if (value <= props.min) closestStepPoint = props.min;
|
|
19
|
+
else if (value >= props.max) closestStepPoint = props.max;
|
|
20
|
+
else {
|
|
21
|
+
const offset = value - props.min;
|
|
22
|
+
const factor = Math.floor(offset / step);
|
|
23
|
+
const candidate1 = props.min + factor * step;
|
|
24
|
+
const candidate2 = candidate1 + step;
|
|
25
|
+
const validCandidates = [candidate1];
|
|
26
|
+
if (candidate2 <= props.max) validCandidates.push(candidate2);
|
|
27
|
+
closestStepPoint = validCandidates.reduce((prev, curr) => {
|
|
28
|
+
const d1 = Math.abs(prev - value);
|
|
29
|
+
const d2 = Math.abs(curr - value);
|
|
30
|
+
return d2 < d1 || d2 === d1 && curr < prev ? curr : prev;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const candidates = markValues;
|
|
34
|
+
if (!en(closestStepPoint)) candidates.push(A(props.precision) ? fixedNumber(closestStepPoint, props.precision) : closestStepPoint);
|
|
35
|
+
return candidates.reduce((closest, curr) => {
|
|
36
|
+
const d1 = Math.abs(closest - value);
|
|
37
|
+
const d2 = Math.abs(curr - value);
|
|
38
|
+
return d2 < d1 || d2 === d1 && curr < closest ? curr : closest;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const transformModelValue = (value, props, emits) => {
|
|
42
|
+
if (E(value)) return props.range ? [clampValue(props.min, props), clampValue(props.min, props)] : clampValue(props.min, props);
|
|
43
|
+
if (props.range) if (A(value)) {
|
|
44
|
+
const nextValue = [clampValue(props.min, props), clampValue(value, props)];
|
|
45
|
+
if (nextValue[1] !== value) emits("update:modelValue", nextValue);
|
|
46
|
+
return nextValue;
|
|
47
|
+
} else {
|
|
48
|
+
const nextValue = value.map((e) => clampValue(e, props));
|
|
49
|
+
if (nextValue[0] !== value[0] || nextValue[1] !== value[1]) emits("update:modelValue", nextValue);
|
|
50
|
+
return nextValue;
|
|
51
|
+
}
|
|
52
|
+
else if (A(value)) {
|
|
53
|
+
const nextValue = clampValue(value, props);
|
|
54
|
+
if (nextValue !== value) emits("update:modelValue", nextValue);
|
|
55
|
+
return nextValue;
|
|
56
|
+
} else {
|
|
57
|
+
const nextValue = clampValue(value[1], props);
|
|
58
|
+
if (nextValue !== value[1]) emits("update:modelValue", nextValue);
|
|
59
|
+
return nextValue;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const getTargetThumbEl = (e, direction, thumbStartRef, thumbEndRef) => {
|
|
63
|
+
const clientX = e.clientX;
|
|
64
|
+
const clientY = e.clientY;
|
|
65
|
+
if ((thumbStartRef.value ? direction === "horizontal" ? Math.abs(clientX - thumbStartRef.value.getBoundingClientRect().left) : Math.abs(clientY - thumbStartRef.value.getBoundingClientRect().top) : Infinity) <= (thumbEndRef.value ? direction === "horizontal" ? Math.abs(clientX - thumbEndRef.value.getBoundingClientRect().left) : Math.abs(clientY - thumbEndRef.value.getBoundingClientRect().top) : Infinity)) return {
|
|
66
|
+
thumbEl: thumbStartRef.value,
|
|
67
|
+
targetType: "start"
|
|
68
|
+
};
|
|
69
|
+
else return {
|
|
70
|
+
thumbEl: thumbEndRef.value,
|
|
71
|
+
targetType: "end"
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const calcValueFromEvent = (e, sliderEl, thumbEl, valueRange, props) => {
|
|
75
|
+
const sliderRect = sliderEl.getBoundingClientRect();
|
|
76
|
+
const thumbRect = thumbEl.getBoundingClientRect();
|
|
77
|
+
let clientOffset;
|
|
78
|
+
if (e instanceof MouseEvent) clientOffset = props.direction === "horizontal" ? e.clientX : e.clientY;
|
|
79
|
+
else clientOffset = props.direction === "horizontal" ? e.touches[0].clientX : e.touches[0].clientY;
|
|
80
|
+
const padding = props.direction === "horizontal" ? Math.round(thumbRect.width / 2) : Math.round(thumbRect.height / 2);
|
|
81
|
+
const startBorder = props.direction === "horizontal" ? sliderRect.left + padding : sliderRect.top + padding;
|
|
82
|
+
const endBorder = props.direction === "horizontal" ? sliderRect.right - padding : sliderRect.bottom - padding;
|
|
83
|
+
const areaWidth = props.direction === "horizontal" ? sliderRect.width - thumbRect.width : sliderRect.height - thumbRect.height;
|
|
84
|
+
let percentage = (ke(clientOffset, startBorder, endBorder) - startBorder) / areaWidth;
|
|
85
|
+
if (props.direction === "vertical") percentage = 1 - percentage;
|
|
86
|
+
if (props.reverse) percentage = 1 - percentage;
|
|
87
|
+
return clampValue(props.min + percentage * valueRange, props);
|
|
88
|
+
};
|
|
89
|
+
const calcThumbLeft = (value, sliderRect, thumbRect, valueRange, props) => {
|
|
90
|
+
const areaWidth = props.direction === "horizontal" ? sliderRect.width - thumbRect.width : sliderRect.height - thumbRect.height;
|
|
91
|
+
let left = valueRange > 0 ? ke((value - props.min) / valueRange * areaWidth, 0, areaWidth) : 0;
|
|
92
|
+
if (props.reverse) left = areaWidth - left;
|
|
93
|
+
const pixelSize = calcPixelSize();
|
|
94
|
+
return left - pixelSize;
|
|
95
|
+
};
|
|
96
|
+
const updateMarkPoints = (rect, valueRange, props) => {
|
|
97
|
+
var _props$marks;
|
|
98
|
+
if (!((_props$marks = props.marks) === null || _props$marks === void 0 ? void 0 : _props$marks.length)) return [];
|
|
99
|
+
const pixelSize = calcPixelSize();
|
|
100
|
+
const dotSize = props.direction === "horizontal" ? rect.height : rect.width;
|
|
101
|
+
const width = props.direction === "horizontal" ? rect.width - dotSize - pixelSize * 2 : rect.height - dotSize - pixelSize * 2;
|
|
102
|
+
return props.marks.filter((mark) => {
|
|
103
|
+
if (A(mark)) return mark >= props.min && mark <= props.max;
|
|
104
|
+
else return mark.value >= props.min && mark.value <= props.max;
|
|
105
|
+
}).map((mark) => {
|
|
106
|
+
if (A(mark)) {
|
|
107
|
+
const left = valueRange > 0 ? width * (mark - props.min) / valueRange : 0;
|
|
108
|
+
return {
|
|
109
|
+
value: mark,
|
|
110
|
+
left: Math.round(left),
|
|
111
|
+
markLeft: Math.round(left + Math.round(dotSize / 2))
|
|
112
|
+
};
|
|
113
|
+
} else {
|
|
114
|
+
const left = valueRange > 0 ? width * (mark.value - props.min) / valueRange : 0;
|
|
115
|
+
return {
|
|
116
|
+
value: mark.value,
|
|
117
|
+
label: mark.label,
|
|
118
|
+
left: Math.round(left),
|
|
119
|
+
markLeft: Math.round(left + Math.round(dotSize / 2))
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
const getRangeValue = (modelValue, index, props) => {
|
|
125
|
+
return !S(modelValue) ? index === 0 ? clampValue(props.min, props) : modelValue : modelValue[index];
|
|
126
|
+
};
|
|
127
|
+
const getSingleValue = (modelValue) => {
|
|
128
|
+
return !S(modelValue) ? modelValue : modelValue[1];
|
|
129
|
+
};
|
|
130
|
+
export { getSingleValue as a, updateMarkPoints as c, getRangeValue as i, calcValueFromEvent as n, getTargetThumbEl as o, clampValue as r, transformModelValue as s, calcThumbLeft as t };
|
package/es/space/index.css
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
.px-space {
|
|
2
|
-
--px-medium-interval: var(--px-interval-2);
|
|
3
|
-
--px-large-interval: var(--px-interval-3);
|
|
4
|
-
--px-small-interval: var(--px-interval-1);
|
|
5
|
-
}
|
|
6
1
|
.px-space__inline {
|
|
7
2
|
display: inline-block;
|
|
8
3
|
}
|
|
@@ -41,40 +36,40 @@
|
|
|
41
36
|
}
|
|
42
37
|
.px-space-inner {
|
|
43
38
|
display: flex;
|
|
44
|
-
margin-top:
|
|
45
|
-
margin-bottom:
|
|
46
|
-
margin-left:
|
|
47
|
-
margin-right:
|
|
39
|
+
margin-top: -4px;
|
|
40
|
+
margin-bottom: -4px;
|
|
41
|
+
margin-left: -4px;
|
|
42
|
+
margin-right: -4px;
|
|
48
43
|
}
|
|
49
44
|
.px-space-inner .px-space-item {
|
|
50
|
-
margin-top:
|
|
51
|
-
margin-bottom:
|
|
52
|
-
margin-left:
|
|
53
|
-
margin-right:
|
|
45
|
+
margin-top: 4px;
|
|
46
|
+
margin-bottom: 4px;
|
|
47
|
+
margin-left: 4px;
|
|
48
|
+
margin-right: 4px;
|
|
54
49
|
}
|
|
55
50
|
.px-space-inner.px-space__small {
|
|
56
|
-
margin-top:
|
|
57
|
-
margin-bottom:
|
|
58
|
-
margin-left:
|
|
59
|
-
margin-right:
|
|
51
|
+
margin-top: -2px;
|
|
52
|
+
margin-bottom: -2px;
|
|
53
|
+
margin-left: -2px;
|
|
54
|
+
margin-right: -2px;
|
|
60
55
|
}
|
|
61
56
|
.px-space-inner.px-space__small .px-space-item {
|
|
62
|
-
margin-top:
|
|
63
|
-
margin-bottom:
|
|
64
|
-
margin-left:
|
|
65
|
-
margin-right:
|
|
57
|
+
margin-top: 2px;
|
|
58
|
+
margin-bottom: 2px;
|
|
59
|
+
margin-left: 2px;
|
|
60
|
+
margin-right: 2px;
|
|
66
61
|
}
|
|
67
62
|
.px-space-inner.px-space__large {
|
|
68
|
-
margin-top:
|
|
69
|
-
margin-bottom:
|
|
70
|
-
margin-left:
|
|
71
|
-
margin-right:
|
|
63
|
+
margin-top: -6px;
|
|
64
|
+
margin-bottom: -6px;
|
|
65
|
+
margin-left: -6px;
|
|
66
|
+
margin-right: -6px;
|
|
72
67
|
}
|
|
73
68
|
.px-space-inner.px-space__large .px-space-item {
|
|
74
|
-
margin-top:
|
|
75
|
-
margin-bottom:
|
|
76
|
-
margin-left:
|
|
77
|
-
margin-right:
|
|
69
|
+
margin-top: 6px;
|
|
70
|
+
margin-bottom: 6px;
|
|
71
|
+
margin-left: 6px;
|
|
72
|
+
margin-right: 6px;
|
|
78
73
|
}
|
|
79
74
|
.px-space__wrap {
|
|
80
75
|
flex-wrap: wrap;
|
package/es/space/index.js
CHANGED
|
@@ -1,99 +1,75 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
[`px-space__${props.direction}`]: true,
|
|
75
|
-
[`px-space__wrap`]: !!props.wrap
|
|
76
|
-
},
|
|
77
|
-
"style": {
|
|
78
|
-
marginTop: marginComputed.value ? -marginComputed.value.y / 2 + "px" : void 0,
|
|
79
|
-
marginBottom: marginComputed.value ? -marginComputed.value.y / 2 + "px" : void 0,
|
|
80
|
-
marginLeft: marginComputed.value ? -marginComputed.value.x / 2 + "px" : void 0,
|
|
81
|
-
marginRight: marginComputed.value ? -marginComputed.value.x / 2 + "px" : void 0
|
|
82
|
-
}
|
|
83
|
-
}, [children.map((child, index) => createVNode(Fragment, {
|
|
84
|
-
"key": child.key || `px-space-item-${index}`
|
|
85
|
-
}, [createVNode("div", {
|
|
86
|
-
"class": "px-space-item",
|
|
87
|
-
"style": {
|
|
88
|
-
marginTop: marginComputed.value ? marginComputed.value.y / 2 + "px" : void 0,
|
|
89
|
-
marginBottom: marginComputed.value ? marginComputed.value.y / 2 + "px" : void 0,
|
|
90
|
-
marginLeft: marginComputed.value ? marginComputed.value.x / 2 + "px" : void 0,
|
|
91
|
-
marginRight: marginComputed.value ? marginComputed.value.x / 2 + "px" : void 0
|
|
92
|
-
}
|
|
93
|
-
}, [child])]))])]);
|
|
94
|
-
};
|
|
95
|
-
}
|
|
2
|
+
import { g as A } from "../vendor.js";
|
|
3
|
+
import { t as flattenVNodes } from "../share/util/render.js";
|
|
4
|
+
import { Fragment, computed, createVNode, defineComponent, useSlots } from "vue";
|
|
5
|
+
var space_default = /* @__PURE__ */ defineComponent({
|
|
6
|
+
name: "Space",
|
|
7
|
+
__name: "index",
|
|
8
|
+
props: {
|
|
9
|
+
margin: { default: "medium" },
|
|
10
|
+
direction: { default: "horizontal" },
|
|
11
|
+
justify: { default: "start" },
|
|
12
|
+
align: null,
|
|
13
|
+
wrap: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: true
|
|
16
|
+
},
|
|
17
|
+
inline: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
setup(__props) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const alignComputed = computed(() => {
|
|
25
|
+
if (props.align) return props.align;
|
|
26
|
+
return props.direction === "horizontal" ? "center" : "stretch";
|
|
27
|
+
});
|
|
28
|
+
const slots = useSlots();
|
|
29
|
+
const marginComputed = computed(() => {
|
|
30
|
+
if (!props.margin || props.margin === "small" || props.margin === "medium" || props.margin === "large") return;
|
|
31
|
+
if (A(props.margin)) return {
|
|
32
|
+
x: props.margin,
|
|
33
|
+
y: props.margin
|
|
34
|
+
};
|
|
35
|
+
if ("x" in props.margin || "y" in props.margin) return {
|
|
36
|
+
x: A(props.margin.x) ? props.margin.x : 0,
|
|
37
|
+
y: A(props.margin.y) ? props.margin.y : 0
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
var _slots$default;
|
|
42
|
+
const children = flattenVNodes(((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)) || []);
|
|
43
|
+
return createVNode("div", { "class": {
|
|
44
|
+
pixelium: true,
|
|
45
|
+
"px-space": true,
|
|
46
|
+
[`px-space__inline`]: !!props.inline
|
|
47
|
+
} }, [createVNode("div", {
|
|
48
|
+
"class": {
|
|
49
|
+
"px-space-inner": true,
|
|
50
|
+
[`px-space__small`]: props.margin === "small",
|
|
51
|
+
[`px-space__large`]: props.margin === "large",
|
|
52
|
+
[`px-space__justify-${props.justify}`]: true,
|
|
53
|
+
[`px-space__align-${alignComputed.value}`]: true,
|
|
54
|
+
[`px-space__${props.direction}`]: true,
|
|
55
|
+
[`px-space__wrap`]: !!props.wrap
|
|
56
|
+
},
|
|
57
|
+
"style": {
|
|
58
|
+
marginTop: marginComputed.value ? -marginComputed.value.y / 2 + "px" : void 0,
|
|
59
|
+
marginBottom: marginComputed.value ? -marginComputed.value.y / 2 + "px" : void 0,
|
|
60
|
+
marginLeft: marginComputed.value ? -marginComputed.value.x / 2 + "px" : void 0,
|
|
61
|
+
marginRight: marginComputed.value ? -marginComputed.value.x / 2 + "px" : void 0
|
|
62
|
+
}
|
|
63
|
+
}, [children.map((child, index) => createVNode(Fragment, { "key": child.key || `px-space-item-${index}` }, [createVNode("div", {
|
|
64
|
+
"class": "px-space-item",
|
|
65
|
+
"style": {
|
|
66
|
+
marginTop: marginComputed.value ? marginComputed.value.y / 2 + "px" : void 0,
|
|
67
|
+
marginBottom: marginComputed.value ? marginComputed.value.y / 2 + "px" : void 0,
|
|
68
|
+
marginLeft: marginComputed.value ? marginComputed.value.x / 2 + "px" : void 0,
|
|
69
|
+
marginRight: marginComputed.value ? marginComputed.value.x / 2 + "px" : void 0
|
|
70
|
+
}
|
|
71
|
+
}, [child])]))])]);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
96
74
|
});
|
|
97
|
-
export {
|
|
98
|
-
_sfc_main as _
|
|
99
|
-
};
|
|
75
|
+
export { space_default as t };
|
package/es/spin/index.css
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
.px-spin {
|
|
2
2
|
position: relative;
|
|
3
3
|
display: inline-block;
|
|
4
|
-
min-height:
|
|
5
|
-
min-width:
|
|
4
|
+
min-height: 28px;
|
|
5
|
+
min-width: 28px;
|
|
6
|
+
transition: 0.25s;
|
|
6
7
|
}
|
|
7
8
|
.px-spin__small {
|
|
8
|
-
min-height:
|
|
9
|
-
min-width:
|
|
9
|
+
min-height: 20px;
|
|
10
|
+
min-width: 20px;
|
|
10
11
|
}
|
|
11
12
|
.px-spin__large {
|
|
12
|
-
min-height:
|
|
13
|
-
min-width:
|
|
13
|
+
min-height: 36px;
|
|
14
|
+
min-width: 36px;
|
|
14
15
|
}
|
|
15
16
|
.px-spin-cover {
|
|
16
17
|
position: absolute;
|
|
@@ -33,34 +34,34 @@
|
|
|
33
34
|
justify-content: center;
|
|
34
35
|
align-items: center;
|
|
35
36
|
color: var(--px-primary-6);
|
|
36
|
-
font-size:
|
|
37
|
+
font-size: 15px;
|
|
37
38
|
}
|
|
38
39
|
.px-spin-icon-wrapper {
|
|
39
40
|
display: flex;
|
|
40
41
|
justify-content: center;
|
|
41
42
|
align-items: center;
|
|
42
|
-
margin-bottom:
|
|
43
|
-
font-size:
|
|
43
|
+
margin-bottom: 8px;
|
|
44
|
+
font-size: 28px;
|
|
44
45
|
}
|
|
45
46
|
.px-spin-icon-wrapper__last {
|
|
46
47
|
margin-bottom: 0;
|
|
47
48
|
}
|
|
48
49
|
.px-spin-icon-wrapper .px-spin-icon {
|
|
49
|
-
height:
|
|
50
|
-
width:
|
|
50
|
+
height: 28px;
|
|
51
|
+
width: 28px;
|
|
51
52
|
fill: var(--px-primary-6);
|
|
52
53
|
}
|
|
53
54
|
.px-spin-icon-wrapper__small {
|
|
54
|
-
font-size:
|
|
55
|
+
font-size: 20px;
|
|
55
56
|
}
|
|
56
57
|
.px-spin-icon-wrapper__small .px-spin-icon {
|
|
57
|
-
height:
|
|
58
|
-
width:
|
|
58
|
+
height: 20px;
|
|
59
|
+
width: 20px;
|
|
59
60
|
}
|
|
60
61
|
.px-spin-icon-wrapper__large {
|
|
61
|
-
font-size:
|
|
62
|
+
font-size: 36px;
|
|
62
63
|
}
|
|
63
64
|
.px-spin-icon-wrapper__large .px-spin-icon {
|
|
64
|
-
height:
|
|
65
|
-
width:
|
|
65
|
+
height: 36px;
|
|
66
|
+
width: 36px;
|
|
66
67
|
}
|