@pixelium/web-vue 0.0.2 → 0.0.3-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/README.zh.md +6 -3
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1602 -248
- package/dist/normalize.css +2 -0
- package/dist/pixelium-vue-icon-hn.cjs +1 -1
- package/dist/pixelium-vue-icon-hn.css +2 -1
- package/dist/pixelium-vue-icon-hn.js +8533 -8154
- package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.css +2 -1
- package/dist/pixelium-vue-icon-pa.js +10625 -10143
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
- package/dist/pixelium-vue.cjs +2 -2
- package/dist/pixelium-vue.css +2 -1
- package/dist/pixelium-vue.js +7407 -5852
- package/dist/pixelium-vue.umd.cjs +2 -2
- package/es/aside/index.css +1 -0
- package/es/aside/index.js +46 -151
- package/es/auto-complete/draw.d.ts +1 -1
- package/es/auto-complete/draw.js +26 -51
- package/es/auto-complete/index.css +92 -32
- package/es/auto-complete/index.d.ts +12 -15
- package/es/auto-complete/index.js +338 -400
- package/es/auto-complete/type.d.ts +25 -13
- package/es/avatar/css.js +2 -0
- package/es/avatar/draw.d.ts +2 -0
- package/es/avatar/draw.js +11 -0
- package/es/avatar/index.css +49 -0
- package/es/avatar/index.d.ts +15 -0
- package/es/avatar/index.js +110 -0
- package/es/avatar/type.d.ts +34 -0
- package/es/button/draw.d.ts +4 -4
- package/es/button/draw.js +213 -297
- package/es/button/index.css +40 -30
- package/es/button/index.d.ts +0 -4
- package/es/button/index.js +230 -256
- package/es/button/type.d.ts +3 -3
- package/es/button-group/index.css +0 -3
- package/es/button-group/index.d.ts +1 -2
- package/es/button-group/index.js +59 -31
- package/es/button-group/type.d.ts +21 -4
- package/es/checkbox/css.js +2 -0
- package/es/checkbox/draw.d.ts +4 -0
- package/es/checkbox/draw.js +46 -0
- package/es/checkbox/index.css +85 -0
- package/es/checkbox/index.d.ts +31 -0
- package/es/checkbox/index.js +206 -0
- package/es/checkbox/type.d.ts +88 -0
- package/es/checkbox-group/css.js +2 -0
- package/es/checkbox-group/index.css +20 -0
- package/es/checkbox-group/index.d.ts +23 -0
- package/es/checkbox-group/index.js +84 -0
- package/es/checkbox-group/type.d.ts +78 -0
- package/es/col/index.d.ts +2 -2
- package/es/col/index.js +43 -58
- package/es/container/index.css +1 -0
- package/es/container/index.js +18 -31
- package/es/divider/index.js +39 -53
- package/es/empty/index.css +4 -4
- package/es/empty/index.js +16 -71
- package/es/entry.js +102 -0
- package/es/footer/index.css +1 -0
- package/es/footer/index.js +31 -40
- package/es/form/css.js +1 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +125 -0
- package/es/form/type.d.ts +238 -0
- package/es/form/use-form.d.ts +4 -0
- package/es/form/use-form.js +48 -0
- package/es/form-item/css.js +2 -0
- package/es/form-item/index.css +77 -0
- package/es/form-item/index.d.ts +37 -0
- package/es/form-item/index.js +318 -0
- package/es/form-item/type.d.ts +96 -0
- package/es/grid/index.js +56 -75
- package/es/grid-item/css.js +0 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +85 -121
- package/es/header/index.css +1 -0
- package/es/header/index.js +31 -40
- package/es/icon/index.js +44 -55
- package/es/icons/css-hn.js +0 -1
- package/es/icons/css-pa.js +0 -1
- package/es/icons/icon-hn.js +10337 -15986
- package/es/icons/icon-pa.js +12573 -17447
- package/es/image/css.js +2 -0
- package/es/image/index.css +69 -0
- package/es/image/index.d.ts +35 -0
- package/es/image/index.js +199 -0
- package/es/image/type.d.ts +126 -0
- package/es/index.css +1 -515
- package/es/index.d.ts +22 -2
- package/es/index.js +144 -123
- package/es/input/draw.d.ts +1 -1
- package/es/input/draw.js +26 -51
- package/es/input/index.css +85 -33
- package/es/input/index.d.ts +9 -16
- package/es/input/index.js +319 -423
- package/es/input/type.d.ts +3 -3
- package/es/input-group/index.css +0 -1
- package/es/input-group/index.d.ts +2 -2
- package/es/input-group/index.js +66 -37
- package/es/input-group/type.d.ts +16 -4
- package/es/input-group-label/draw.d.ts +1 -1
- package/es/input-group-label/draw.js +26 -51
- package/es/input-group-label/index.css +33 -22
- package/es/input-group-label/index.d.ts +1 -4
- package/es/input-group-label/index.js +104 -127
- package/es/input-group-label/type.d.ts +3 -3
- package/es/input-number/draw.d.ts +1 -1
- package/es/input-number/draw.js +26 -51
- package/es/input-number/index.css +90 -35
- package/es/input-number/index.d.ts +9 -16
- package/es/input-number/index.js +428 -536
- package/es/input-number/type.d.ts +3 -3
- package/es/input-tag/draw.d.ts +1 -1
- package/es/input-tag/draw.js +26 -48
- package/es/input-tag/index.css +100 -33
- package/es/input-tag/index.d.ts +7 -13
- package/es/input-tag/index.js +442 -467
- package/es/input-tag/type.d.ts +24 -13
- package/es/link/index.js +75 -106
- package/es/main/index.css +4 -0
- package/es/main/index.d.ts +4 -1
- package/es/main/index.js +15 -15
- package/es/main/type.d.ts +7 -0
- package/es/mask/index.js +94 -115
- package/es/message/index.css +1 -1
- package/es/message/index.js +168 -346
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +98 -114
- package/es/message-box/message-box-wrapped.js +33 -46
- package/es/message-box/message-box.js +79 -111
- package/es/option-list/index.css +13 -13
- package/es/option-list/index.d.ts +4 -31
- package/es/option-list/index.js +99 -167
- package/es/option-list/type.d.ts +5 -1
- package/es/pixelate/pixel.d.ts +5 -0
- package/es/pixelate/pixel.js +70 -0
- package/es/pixelate/pixelate.worker.d.ts +1 -0
- package/es/popover/index.d.ts +13 -99
- package/es/popover/index.js +75 -238
- package/es/popover/type.d.ts +7 -2
- package/es/popup/css.js +1 -0
- package/es/popup/index.d.ts +210 -0
- package/es/popup/index.js +203 -0
- package/es/popup/type.d.ts +105 -0
- package/es/popup-content/draw.d.ts +2 -2
- package/es/popup-content/draw.js +98 -143
- package/es/popup-content/index.css +11 -11
- package/es/popup-content/index.d.ts +1 -0
- package/es/popup-content/index.js +253 -1576
- package/es/popup-content/type.d.ts +1 -0
- package/es/popup-trigger/index.d.ts +8 -2
- package/es/popup-trigger/index.js +122 -95
- package/es/popup-trigger/type.d.ts +4 -1
- package/es/popup-wrapper/css.js +2 -0
- package/es/popup-wrapper/index.css +14 -0
- package/es/popup-wrapper/index.d.ts +18 -0
- package/es/popup-wrapper/index.js +67 -0
- package/es/popup-wrapper/type.d.ts +9 -0
- package/es/radio/css.js +1 -0
- package/es/radio/draw.d.ts +4 -0
- package/es/radio/draw.js +47 -0
- package/es/radio/index.d.ts +30 -0
- package/es/radio/index.js +190 -0
- package/es/radio/style.css +73 -0
- package/es/radio/type.d.ts +76 -0
- package/es/radio-group/css.js +2 -0
- package/es/radio-group/index.css +20 -0
- package/es/radio-group/index.d.ts +23 -0
- package/es/radio-group/index.js +77 -0
- package/es/radio-group/type.d.ts +77 -0
- package/es/row/index.js +56 -70
- package/es/select/draw.d.ts +1 -1
- package/es/select/draw.js +26 -51
- package/es/select/index.css +118 -36
- package/es/select/index.d.ts +14 -16
- package/es/select/index.js +625 -672
- package/es/select/type.d.ts +60 -25
- package/es/share/const/event-bus-key.js +1 -6
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +22 -24
- package/es/share/const/provide-key.d.ts +5 -0
- package/es/share/const/provide-key.js +6 -5
- package/es/share/const/style.d.ts +6 -0
- package/es/share/const/style.js +7 -0
- package/es/share/hook/use-cancelable-delay.d.ts +1 -0
- package/es/share/hook/use-cancelable-delay.js +42 -0
- package/es/share/hook/use-click-outside-listener.d.ts +1 -1
- package/es/share/hook/use-click-outside-listener.js +28 -41
- package/es/share/hook/use-composition.js +17 -15
- package/es/share/hook/use-controlled-mode.d.ts +3 -3
- package/es/share/hook/use-controlled-mode.js +20 -23
- package/es/share/hook/use-dark-mode.js +51 -65
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +47 -45
- package/es/share/hook/use-lazy-load.d.ts +10 -0
- package/es/share/hook/use-lazy-load.js +133 -0
- package/es/share/hook/use-props-detect.d.ts +2 -0
- package/es/share/hook/use-resize-observer.d.ts +1 -2
- package/es/share/hook/use-resize-observer.js +28 -20
- package/es/share/hook/use-screen-width.js +27 -36
- package/es/share/hook/use-smooth-transition.d.ts +2 -0
- package/es/share/hook/use-smooth-transition.js +65 -0
- package/es/share/hook/use-textarea-height.js +86 -92
- package/es/share/hook/use-theme-mode.js +41 -42
- package/es/share/hook/use-transition-end.d.ts +2 -0
- package/es/share/hook/use-transition-end.js +12 -0
- package/es/share/hook/use-watch-global-css-var.js +12 -16
- package/es/share/hook/use-window-resize-listener.d.ts +1 -0
- package/es/share/hook/use-window-resize-listener.js +15 -0
- package/es/share/hook/use-z-index.js +30 -27
- package/es/share/style/index.css +5 -0
- package/es/share/type/index.d.ts +18 -3
- package/es/share/util/color.d.ts +5 -3
- package/es/share/util/color.js +156 -149
- package/es/share/util/common.d.ts +7 -2
- package/es/share/util/common.js +127 -65
- package/es/share/util/console.d.ts +3 -3
- package/es/share/util/console.js +10 -7
- package/es/share/util/dom.d.ts +19 -0
- package/es/share/util/dom.js +88 -0
- package/es/share/util/env.d.ts +1 -0
- package/es/share/util/env.js +5 -4
- package/es/share/util/event-bus.js +3 -20
- package/es/share/util/lru-cache.js +29 -33
- package/es/share/util/pixel.d.ts +4 -0
- package/es/share/util/plot.d.ts +8 -3
- package/es/share/util/plot.js +457 -229
- package/es/share/util/reactivity.d.ts +8 -0
- package/es/share/util/reactivity.js +23 -0
- package/es/share/util/render.js +31 -41
- package/es/share/util/theme.d.ts +3 -0
- package/es/share/util/theme.js +77 -57
- package/es/slider/css.js +2 -0
- package/es/slider/draw.d.ts +25 -0
- package/es/slider/draw.js +113 -0
- package/es/slider/index.css +119 -0
- package/es/slider/index.d.ts +66 -0
- package/es/slider/index.js +503 -0
- package/es/slider/type.d.ts +162 -0
- package/es/slider/util.d.ts +37 -0
- package/es/slider/util.js +130 -0
- package/es/space/index.css +24 -29
- package/es/space/index.js +73 -97
- package/es/spin/index.css +18 -17
- package/es/spin/index.js +72 -102
- package/es/spin/type.d.ts +11 -5
- package/es/switch/css.js +2 -0
- package/es/switch/draw.d.ts +2 -0
- package/es/switch/draw.js +18 -0
- package/es/switch/index.css +121 -0
- package/es/switch/index.d.ts +42 -0
- package/es/switch/index.js +259 -0
- package/es/switch/type.d.ts +133 -0
- package/es/tag/draw.d.ts +2 -2
- package/es/tag/draw.js +80 -127
- package/es/tag/index.css +38 -22
- package/es/tag/index.d.ts +2 -2
- package/es/tag/index.js +121 -190
- package/es/tag/type.d.ts +3 -3
- package/es/text-outline/css.js +2 -0
- package/es/text-outline/index.css +4 -0
- package/es/text-outline/index.d.ts +17 -0
- package/es/text-outline/index.js +33 -0
- package/es/text-outline/type.d.ts +23 -0
- package/es/textarea/draw.js +9 -11
- package/es/textarea/index.css +37 -23
- package/es/textarea/index.d.ts +8 -14
- package/es/textarea/index.js +274 -262
- package/es/tooltip/index.d.ts +100 -4
- package/es/tooltip/index.js +70 -226
- package/es/tooltip/type.d.ts +7 -2
- package/es/vendor.js +504 -0
- package/es/virtual-list/css.js +2 -0
- package/es/virtual-list/index.css +25 -0
- package/es/virtual-list/index.d.ts +11 -0
- package/es/virtual-list/index.js +313 -0
- package/es/virtual-list/type.d.ts +26 -0
- package/package.json +10 -16
- package/es/grid-item/index.css +0 -0
- /package/es/message-box/{message-box.css → index.css} +0 -0
package/es/input/type.d.ts
CHANGED
|
@@ -46,10 +46,10 @@ export type InputProps = {
|
|
|
46
46
|
*/
|
|
47
47
|
size?: 'medium' | 'large' | 'small';
|
|
48
48
|
/**
|
|
49
|
-
* @property {'
|
|
50
|
-
* @version 0.0.
|
|
49
|
+
* @property {'rect' | 'round'} [shape='rect']
|
|
50
|
+
* @version 0.0.3
|
|
51
51
|
*/
|
|
52
|
-
shape?: '
|
|
52
|
+
shape?: 'rect' | 'round' | 'default';
|
|
53
53
|
/**
|
|
54
54
|
* @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
|
|
55
55
|
* @version 0.0.2
|
package/es/input-group/index.css
CHANGED
|
@@ -4,9 +4,9 @@ type __VLS_Slots = {} & {
|
|
|
4
4
|
default?: (props: typeof __VLS_1) => any;
|
|
5
5
|
};
|
|
6
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
7
|
disabled: boolean;
|
|
8
|
+
readonly: boolean;
|
|
9
|
+
shape: "rect" | "round" | "default";
|
|
10
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
11
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
12
12
|
export default _default;
|
package/es/input-group/index.js
CHANGED
|
@@ -1,40 +1,69 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { i as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
|
|
3
|
+
import { t as emitParentUpdate } from "../share/hook/use-index-of-children.js";
|
|
4
|
+
import { a as FORM_PROVIDE, i as FORM_ITEM_PROVIDE, s as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
|
|
5
|
+
import { t as createProvideComputed } from "../share/util/reactivity.js";
|
|
6
|
+
import { createElementBlock, defineComponent, inject, openBlock, provide, ref, renderSlot, toRefs } from "vue";
|
|
7
|
+
var _hoisted_1 = {
|
|
8
|
+
class: "pixelium px-input-group",
|
|
9
|
+
ref: "slotWrapper"
|
|
9
10
|
};
|
|
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
|
-
|
|
11
|
+
var input_group_default = /* @__PURE__ */ defineComponent({
|
|
12
|
+
name: "InputGroup",
|
|
13
|
+
__name: "index",
|
|
14
|
+
props: {
|
|
15
|
+
borderRadius: null,
|
|
16
|
+
shape: { default: "rect" },
|
|
17
|
+
size: null,
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false
|
|
21
|
+
},
|
|
22
|
+
readonly: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
setup(__props) {
|
|
28
|
+
const props = __props;
|
|
29
|
+
const formProvide = inject(FORM_PROVIDE, void 0);
|
|
30
|
+
const formItemProvide = inject(FORM_ITEM_PROVIDE, void 0);
|
|
31
|
+
const disabledComputed = createProvideComputed("disabled", [
|
|
32
|
+
formItemProvide,
|
|
33
|
+
formProvide,
|
|
34
|
+
props
|
|
35
|
+
], "or");
|
|
36
|
+
const readonlyComputed = createProvideComputed("readonly", [
|
|
37
|
+
formItemProvide,
|
|
38
|
+
formProvide,
|
|
39
|
+
props
|
|
40
|
+
], "or");
|
|
41
|
+
const sizeComputed = createProvideComputed("size", () => [
|
|
42
|
+
props.size && props,
|
|
43
|
+
formItemProvide,
|
|
44
|
+
formProvide,
|
|
45
|
+
props
|
|
46
|
+
], "nullish", (val) => val || "medium");
|
|
47
|
+
const childrenInfo = ref([]);
|
|
48
|
+
provide(INPUT_GROUP_PROVIDE, {
|
|
49
|
+
...toRefs(props),
|
|
50
|
+
disabled: disabledComputed,
|
|
51
|
+
size: sizeComputed,
|
|
52
|
+
readonly: readonlyComputed,
|
|
53
|
+
collectChildrenInfo: (info) => {
|
|
54
|
+
const idx = childrenInfo.value.findIndex((e) => e.id === info.id);
|
|
55
|
+
if (idx >= 0) childrenInfo.value[idx] = info;
|
|
56
|
+
else childrenInfo.value.push(info);
|
|
57
|
+
},
|
|
58
|
+
removeChildrenInfo: (id) => {
|
|
59
|
+
childrenInfo.value = childrenInfo.value.filter((e) => e.id != id);
|
|
60
|
+
},
|
|
61
|
+
childrenInfo
|
|
62
|
+
});
|
|
63
|
+
emitParentUpdate(INPUT_GROUP_UPDATE);
|
|
64
|
+
return (_ctx, _cache) => {
|
|
65
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "default")], 512);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
37
68
|
});
|
|
38
|
-
export {
|
|
39
|
-
_sfc_main as _
|
|
40
|
-
};
|
|
69
|
+
export { input_group_default as t };
|
package/es/input-group/type.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Ref, ToRefs } from 'vue';
|
|
2
|
+
import type { LooseRequired, NumberOrPercentage } from '../share/type';
|
|
3
|
+
import type { ChildrenInfo } from '../button-group/type';
|
|
2
4
|
export type InputGroupProps = {
|
|
3
5
|
/**
|
|
4
6
|
* @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
|
|
@@ -6,10 +8,10 @@ export type InputGroupProps = {
|
|
|
6
8
|
*/
|
|
7
9
|
borderRadius?: NumberOrPercentage | NumberOrPercentage[];
|
|
8
10
|
/**
|
|
9
|
-
* @property {'
|
|
10
|
-
* @version 0.0.
|
|
11
|
+
* @property {'rect' | 'round'} [shape='rect']
|
|
12
|
+
* @version 0.0.3
|
|
11
13
|
*/
|
|
12
|
-
shape?: '
|
|
14
|
+
shape?: 'rect' | 'round' | 'default';
|
|
13
15
|
/**
|
|
14
16
|
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
15
17
|
* @version 0.0.2
|
|
@@ -20,6 +22,11 @@ export type InputGroupProps = {
|
|
|
20
22
|
* @version 0.0.2
|
|
21
23
|
*/
|
|
22
24
|
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @property {boolean} [readonly=false]
|
|
27
|
+
* @version 0.0.3
|
|
28
|
+
*/
|
|
29
|
+
readonly?: boolean;
|
|
23
30
|
};
|
|
24
31
|
export type InputGroupSlots = {
|
|
25
32
|
/**
|
|
@@ -28,3 +35,8 @@ export type InputGroupSlots = {
|
|
|
28
35
|
*/
|
|
29
36
|
default: {};
|
|
30
37
|
};
|
|
38
|
+
export type InputGroupProvide = ToRefs<LooseRequired<InputGroupProps>> & {
|
|
39
|
+
childrenInfo: Ref<ChildrenInfo[]>;
|
|
40
|
+
collectChildrenInfo: (info: ChildrenInfo) => void;
|
|
41
|
+
removeChildrenInfo: (id: string) => void;
|
|
42
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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;
|
|
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, nextIsTextButton: boolean) => void;
|
|
@@ -1,52 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, inner, first, last) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
1
|
+
import { a as drawCircle } from "../share/util/plot.js";
|
|
2
|
+
import { a as rgbaColor2string } from "../share/util/color.js";
|
|
3
|
+
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, inner, first, last, nextIsTextButton) => {
|
|
4
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
5
|
+
for (let i = 0; i < 4; i++) if (borderRadius[i] > pixelSize) {
|
|
6
|
+
if (i === 1 || i === 2 ? inner && last || !inner : true) drawCircle(ctx, center[i][0], center[i][1], borderRadius[i], rad[i][0], rad[i][1], pixelSize);
|
|
7
|
+
}
|
|
8
|
+
if (center[1][0] + pixelSize > center[0][0]) {
|
|
9
|
+
let length = center[1][0] - center[0][0] + pixelSize;
|
|
10
|
+
if (inner && !last) length -= pixelSize;
|
|
11
|
+
ctx.fillRect(center[0][0], 0, length, pixelSize);
|
|
12
|
+
}
|
|
13
|
+
if (center[2][1] + pixelSize > center[1][1] && (inner && last || !inner)) ctx.fillRect(width - pixelSize, center[1][1], pixelSize, center[2][1] - center[1][1] + pixelSize);
|
|
14
|
+
if (center[3][0] < center[2][0] + pixelSize) {
|
|
15
|
+
let length = center[2][0] - center[3][0] + pixelSize;
|
|
16
|
+
if (inner && !last) length -= pixelSize;
|
|
17
|
+
ctx.fillRect(center[3][0], height - pixelSize, length, pixelSize);
|
|
18
|
+
}
|
|
19
|
+
if ((!inner || first) && center[3][1] + pixelSize > center[0][1]) ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
20
|
+
if (inner && !first) ctx.fillRect(pixelSize / 2, 0, pixelSize / 2, height);
|
|
21
|
+
if (inner && !last) {
|
|
22
|
+
let length = pixelSize;
|
|
23
|
+
if (nextIsTextButton) length /= 2;
|
|
24
|
+
ctx.fillRect(width - 2 * pixelSize - 1, 0, length, height);
|
|
25
|
+
}
|
|
52
26
|
};
|
|
27
|
+
export { drawBorder as t };
|
|
@@ -6,20 +6,10 @@
|
|
|
6
6
|
z-index: -1;
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
}
|
|
9
|
-
div.px-input-group-label {
|
|
10
|
-
font-size: var(--text-size);
|
|
11
|
-
}
|
|
12
9
|
.px-input-group-label {
|
|
13
10
|
--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
11
|
--text-color: var(--px-neutral-10);
|
|
19
|
-
--text-size: var(--px-medium-font-size);
|
|
20
12
|
height: var(--input-group-label-size);
|
|
21
|
-
padding-left: var(--padding-x-size);
|
|
22
|
-
padding-right: var(--padding-x-size);
|
|
23
13
|
background-color: transparent;
|
|
24
14
|
border-color: transparent;
|
|
25
15
|
border-width: var(--px-bit);
|
|
@@ -29,22 +19,43 @@ div.px-input-group-label {
|
|
|
29
19
|
color: var(--text-color);
|
|
30
20
|
transition: 0.25s;
|
|
31
21
|
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
22
|
}
|
|
41
23
|
.px-input-group-label__large {
|
|
42
|
-
--padding-x-size: var(--px-large-padding-x);
|
|
43
24
|
--input-group-label-size: var(--px-large-size);
|
|
44
|
-
--text-size: var(--px-large-font-size);
|
|
45
25
|
}
|
|
46
26
|
.px-input-group-label__small {
|
|
47
|
-
--padding-x-size: var(--px-small-padding-x);
|
|
48
27
|
--input-group-label-size: var(--px-small-size);
|
|
49
|
-
|
|
28
|
+
}
|
|
29
|
+
.px-input-group-label.px-input-group-label__small {
|
|
30
|
+
padding-right: 8px;
|
|
31
|
+
padding-left: 8px;
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
}
|
|
34
|
+
.px-input-group-label.px-input-group-label__small.px-input-group-label__inner {
|
|
35
|
+
padding-right: calc(8px + 1px + 1 * var(--px-bit));
|
|
36
|
+
}
|
|
37
|
+
.px-input-group-label.px-input-group-label__small.px-input-group-label__inner:last-child {
|
|
38
|
+
padding-right: 8px;
|
|
39
|
+
}
|
|
40
|
+
.px-input-group-label.px-input-group-label__medium {
|
|
41
|
+
padding-right: 12px;
|
|
42
|
+
padding-left: 12px;
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
}
|
|
45
|
+
.px-input-group-label.px-input-group-label__medium.px-input-group-label__inner {
|
|
46
|
+
padding-right: calc(12px + 1px + 1 * var(--px-bit));
|
|
47
|
+
}
|
|
48
|
+
.px-input-group-label.px-input-group-label__medium.px-input-group-label__inner:last-child {
|
|
49
|
+
padding-right: 12px;
|
|
50
|
+
}
|
|
51
|
+
.px-input-group-label.px-input-group-label__large {
|
|
52
|
+
padding-right: 16px;
|
|
53
|
+
padding-left: 16px;
|
|
54
|
+
font-size: 15px;
|
|
55
|
+
}
|
|
56
|
+
.px-input-group-label.px-input-group-label__large.px-input-group-label__inner {
|
|
57
|
+
padding-right: calc(16px + 1px + 1 * var(--px-bit));
|
|
58
|
+
}
|
|
59
|
+
.px-input-group-label.px-input-group-label__large.px-input-group-label__inner:last-child {
|
|
60
|
+
padding-right: 16px;
|
|
50
61
|
}
|
|
@@ -3,10 +3,7 @@ declare var __VLS_1: {};
|
|
|
3
3
|
type __VLS_Slots = {} & {
|
|
4
4
|
default?: (props: typeof __VLS_1) => any;
|
|
5
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>;
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<InputGroupLabelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<InputGroupLabelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
7
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
11
8
|
export default _default;
|
|
12
9
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,129 +1,106 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
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
|
-
}
|
|
2
|
+
import { t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
3
|
+
import { i as canvasPreprocess, l as getBorderRadius, n as calcPixelSize, s as floodFill, t as calcBorderCornerCenter } from "../share/util/plot.js";
|
|
4
|
+
import { i as parseColor, n as getGlobalThemeColor } from "../share/util/color.js";
|
|
5
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
6
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
7
|
+
import { i as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
|
|
8
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
9
|
+
import { n as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
|
|
10
|
+
import { i as FORM_ITEM_PROVIDE, s as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
|
|
11
|
+
import { t as createProvideComputed } from "../share/util/reactivity.js";
|
|
12
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
13
|
+
import { t as drawBorder } from "./draw.js";
|
|
14
|
+
import { computed, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, inject, nextTick, normalizeClass, onMounted, openBlock, ref, renderSlot, shallowRef, unref, watch } from "vue";
|
|
15
|
+
var input_group_label_default = /* @__PURE__ */ defineComponent({
|
|
16
|
+
name: "InputGroupLabel",
|
|
17
|
+
__name: "index",
|
|
18
|
+
props: {
|
|
19
|
+
backgroundColor: null,
|
|
20
|
+
borderRadius: null,
|
|
21
|
+
shape: null,
|
|
22
|
+
size: null
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
var _instance$parent;
|
|
26
|
+
const props = __props;
|
|
27
|
+
const instance = getCurrentInstance();
|
|
28
|
+
const innerInputGroup = ref((instance === null || instance === void 0 || (_instance$parent = instance.parent) === null || _instance$parent === void 0 ? void 0 : _instance$parent.type.name) === "InputGroup");
|
|
29
|
+
const [index, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [
|
|
30
|
+
ref(0),
|
|
31
|
+
ref(false),
|
|
32
|
+
ref(false)
|
|
33
|
+
];
|
|
34
|
+
const inputGroupProvide = inject(INPUT_GROUP_PROVIDE, void 0);
|
|
35
|
+
const formItemProvide = inject(FORM_ITEM_PROVIDE, void 0);
|
|
36
|
+
const borderRadiusComputed = createProvideComputed("borderRadius", [innerInputGroup.value && inputGroupProvide, props]);
|
|
37
|
+
const sizeComputed = createProvideComputed("size", () => [
|
|
38
|
+
innerInputGroup.value && inputGroupProvide,
|
|
39
|
+
props.size && props,
|
|
40
|
+
formItemProvide,
|
|
41
|
+
props
|
|
42
|
+
], "nullish", (val) => val || "medium");
|
|
43
|
+
const shapeComputed = createProvideComputed("shape", [innerInputGroup.value && inputGroupProvide, props], "nullish", (val) => val || "rect");
|
|
44
|
+
const nextIsTextButton = computed(() => {
|
|
45
|
+
if (index.value >= 0) {
|
|
46
|
+
var _inputGroupProvide$ch;
|
|
47
|
+
return innerInputGroup.value ? !!((inputGroupProvide === null || inputGroupProvide === void 0 || (_inputGroupProvide$ch = inputGroupProvide.childrenInfo.value.find((e) => e.index === index.value + 1)) === null || _inputGroupProvide$ch === void 0 ? void 0 : _inputGroupProvide$ch.variant) === "text") : false;
|
|
48
|
+
} else return false;
|
|
49
|
+
});
|
|
50
|
+
const hoverFlag = ref(false);
|
|
51
|
+
const activeFlag = ref(false);
|
|
52
|
+
const darkMode = useDarkMode();
|
|
53
|
+
const canvasRef = shallowRef(null);
|
|
54
|
+
const labelRef = shallowRef(null);
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
nextTick(() => {
|
|
57
|
+
drawPixel();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
watch([
|
|
61
|
+
borderRadiusComputed,
|
|
62
|
+
shapeComputed,
|
|
63
|
+
hoverFlag,
|
|
64
|
+
activeFlag,
|
|
65
|
+
darkMode,
|
|
66
|
+
() => props.backgroundColor,
|
|
67
|
+
nextIsTextButton
|
|
68
|
+
], () => {
|
|
69
|
+
drawPixel();
|
|
70
|
+
});
|
|
71
|
+
watch([first, last], () => {
|
|
72
|
+
drawPixel();
|
|
73
|
+
});
|
|
74
|
+
const drawPixel = () => {
|
|
75
|
+
const preprocessData = canvasPreprocess(labelRef, canvasRef);
|
|
76
|
+
if (!preprocessData) return;
|
|
77
|
+
const { ctx, width, height, canvas } = preprocessData;
|
|
78
|
+
const pixelSize = calcPixelSize();
|
|
79
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, borderRadiusComputed.value, shapeComputed.value, sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
|
|
80
|
+
const borderColor = getGlobalThemeColor("neutral", 10);
|
|
81
|
+
const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
|
|
82
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
83
|
+
if (borderColor) drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, innerInputGroup.value, first.value, last.value, nextIsTextButton.value);
|
|
84
|
+
const backgroundColor = props.backgroundColor && parseColor(props.backgroundColor) || getGlobalThemeColor("neutral", 3);
|
|
85
|
+
if (backgroundColor) floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
|
|
86
|
+
};
|
|
87
|
+
useResizeObserver(labelRef, drawPixel);
|
|
88
|
+
useWatchGlobalCssVal(drawPixel);
|
|
89
|
+
useTransitionEnd(labelRef, drawPixel);
|
|
90
|
+
return (_ctx, _cache) => {
|
|
91
|
+
return openBlock(), createElementBlock("div", {
|
|
92
|
+
class: normalizeClass(["pixelium px-input-group-label", {
|
|
93
|
+
[`px-input-group-label__${unref(sizeComputed)}`]: unref(sizeComputed),
|
|
94
|
+
"px-input-group-label__inner": innerInputGroup.value
|
|
95
|
+
}]),
|
|
96
|
+
ref_key: "labelRef",
|
|
97
|
+
ref: labelRef
|
|
98
|
+
}, [createElementVNode("canvas", {
|
|
99
|
+
ref_key: "canvasRef",
|
|
100
|
+
ref: canvasRef,
|
|
101
|
+
class: "px-input-group-label-canvas"
|
|
102
|
+
}, null, 512), renderSlot(_ctx.$slots, "default")], 2);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
126
105
|
});
|
|
127
|
-
export {
|
|
128
|
-
_sfc_main as _
|
|
129
|
-
};
|
|
106
|
+
export { input_group_label_default as t };
|
|
@@ -11,10 +11,10 @@ export type InputGroupLabelProps = {
|
|
|
11
11
|
*/
|
|
12
12
|
borderRadius?: NumberOrPercentage | NumberOrPercentage[];
|
|
13
13
|
/**
|
|
14
|
-
* @property {'
|
|
15
|
-
* @version 0.0.
|
|
14
|
+
* @property {'rect' | 'round'} [shape='rect']
|
|
15
|
+
* @version 0.0.3
|
|
16
16
|
*/
|
|
17
|
-
shape?: '
|
|
17
|
+
shape?: 'rect' | 'round' | 'default';
|
|
18
18
|
/**
|
|
19
19
|
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
20
20
|
* @version 0.0.2
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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;
|
|
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, nextIsTextButton: boolean) => void;
|