@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.
Files changed (199) hide show
  1. package/README.md +21 -10
  2. package/README.zh.md +21 -10
  3. package/dist/icon-pa.d.ts +490 -0
  4. package/dist/index.d.ts +1586 -10
  5. package/dist/pixelium-vue-icon-pa.cjs +1 -0
  6. package/dist/pixelium-vue-icon-pa.css +1 -0
  7. package/dist/pixelium-vue-icon-pa.js +10143 -0
  8. package/dist/pixelium-vue-icon-pa.umd.cjs +1 -0
  9. package/dist/pixelium-vue.cjs +12 -1
  10. package/dist/pixelium-vue.css +1 -1
  11. package/dist/pixelium-vue.js +5368 -1093
  12. package/dist/pixelium-vue.umd.cjs +12 -1
  13. package/es/aside/css.js +1 -1
  14. package/es/aside/index.js +60 -13
  15. package/es/auto-complete/css.js +2 -0
  16. package/es/auto-complete/draw.d.ts +2 -0
  17. package/es/auto-complete/draw.js +52 -0
  18. package/es/auto-complete/index.css +123 -0
  19. package/es/auto-complete/index.d.ts +35 -0
  20. package/es/auto-complete/index.js +402 -0
  21. package/es/auto-complete/type.d.ts +192 -0
  22. package/es/button/css.js +1 -1
  23. package/es/button/draw.d.ts +1 -2
  24. package/es/button/draw.js +105 -123
  25. package/es/button/index.css +24 -14
  26. package/es/button/index.js +70 -121
  27. package/es/button-group/css.js +1 -1
  28. package/es/button-group/index.d.ts +0 -1
  29. package/es/button-group/index.js +11 -37
  30. package/es/button-group/type.d.ts +1 -1
  31. package/es/col/css.js +1 -1
  32. package/es/col/index.d.ts +2 -2
  33. package/es/container/css.js +1 -1
  34. package/es/divider/css.js +1 -1
  35. package/es/empty/css.js +2 -0
  36. package/es/empty/index.css +19 -0
  37. package/es/empty/index.d.ts +17 -0
  38. package/es/empty/index.js +73 -0
  39. package/es/empty/type.d.ts +19 -0
  40. package/es/footer/css.js +1 -1
  41. package/es/grid/css.js +1 -1
  42. package/es/grid/index.js +5 -1
  43. package/es/grid-item/css.js +1 -1
  44. package/es/grid-item/index.d.ts +1 -1
  45. package/es/grid-item/index.js +7 -3
  46. package/es/header/css.js +1 -1
  47. package/es/icon/css.js +1 -1
  48. package/es/icon/index.css +0 -3
  49. package/es/icon/index.js +1 -1
  50. package/es/icons/css-pa.js +2 -0
  51. package/es/icons/icon-hn.js +1 -1
  52. package/es/icons/icon-pa.css +9 -0
  53. package/es/icons/icon-pa.d.ts +490 -0
  54. package/es/icons/icon-pa.js +17449 -0
  55. package/es/index.css +22 -8
  56. package/es/index.d.ts +18 -1
  57. package/es/index.js +63 -2
  58. package/es/input/css.js +2 -0
  59. package/es/input/draw.d.ts +2 -0
  60. package/es/input/draw.js +52 -0
  61. package/es/input/index.css +138 -0
  62. package/es/input/index.d.ts +50 -0
  63. package/es/input/index.js +432 -0
  64. package/es/input/type.d.ts +175 -0
  65. package/es/input-group/css.js +2 -0
  66. package/es/input-group/index.css +24 -0
  67. package/es/input-group/index.d.ts +17 -0
  68. package/es/input-group/index.js +40 -0
  69. package/es/input-group/type.d.ts +30 -0
  70. package/es/input-group-label/css.js +2 -0
  71. package/es/input-group-label/draw.d.ts +2 -0
  72. package/es/input-group-label/draw.js +52 -0
  73. package/es/input-group-label/index.css +50 -0
  74. package/es/input-group-label/index.d.ts +16 -0
  75. package/es/input-group-label/index.js +129 -0
  76. package/es/input-group-label/type.d.ts +30 -0
  77. package/es/input-number/css.js +2 -0
  78. package/es/input-number/draw.d.ts +2 -0
  79. package/es/input-number/draw.js +52 -0
  80. package/es/input-number/index.css +161 -0
  81. package/es/input-number/index.d.ts +47 -0
  82. package/es/input-number/index.js +543 -0
  83. package/es/input-number/type.d.ts +183 -0
  84. package/es/input-tag/css.js +2 -0
  85. package/es/input-tag/draw.d.ts +2 -0
  86. package/es/input-tag/draw.js +49 -0
  87. package/es/input-tag/index.css +133 -0
  88. package/es/input-tag/index.d.ts +73 -0
  89. package/es/input-tag/index.js +474 -0
  90. package/es/input-tag/type.d.ts +212 -0
  91. package/es/link/css.js +1 -1
  92. package/es/link/index.css +2 -5
  93. package/es/link/index.js +10 -6
  94. package/es/main/css.js +1 -1
  95. package/es/mask/css.js +2 -0
  96. package/es/mask/index.css +17 -0
  97. package/es/mask/index.d.ts +8 -0
  98. package/es/mask/index.js +117 -0
  99. package/es/mask/type.d.ts +27 -0
  100. package/es/message/css.js +1 -1
  101. package/es/message/index.css +26 -26
  102. package/es/message/index.d.ts +1 -1
  103. package/es/message/index.js +22 -50
  104. package/es/message-box/css.js +1 -1
  105. package/es/message-box/index.js +40 -30
  106. package/es/message-box/message-box-wrapped.d.ts +0 -1
  107. package/es/message-box/message-box-wrapped.js +2 -2
  108. package/es/message-box/message-box.d.ts +2 -1
  109. package/es/message-box/message-box.js +10 -8
  110. package/es/message-box/type.d.ts +14 -4
  111. package/es/option-list/css.js +2 -0
  112. package/es/option-list/index.css +57 -0
  113. package/es/option-list/index.d.ts +38 -0
  114. package/es/option-list/index.js +169 -0
  115. package/es/option-list/type.d.ts +16 -0
  116. package/es/popover/css.js +1 -0
  117. package/es/popover/index.d.ts +203 -0
  118. package/es/popover/index.js +240 -0
  119. package/es/popover/type.d.ts +100 -0
  120. package/es/popup-content/css.js +2 -0
  121. package/es/popup-content/draw.d.ts +6 -0
  122. package/es/popup-content/draw.js +151 -0
  123. package/es/popup-content/index.css +99 -0
  124. package/es/popup-content/index.d.ts +30 -0
  125. package/es/popup-content/index.js +1578 -0
  126. package/es/popup-content/type.d.ts +20 -0
  127. package/es/popup-trigger/css.js +1 -0
  128. package/es/popup-trigger/index.d.ts +22 -0
  129. package/es/popup-trigger/index.js +97 -0
  130. package/es/popup-trigger/type.d.ts +9 -0
  131. package/es/row/css.js +1 -1
  132. package/es/select/css.js +2 -0
  133. package/es/select/draw.d.ts +2 -0
  134. package/es/select/draw.js +52 -0
  135. package/es/select/index.css +152 -0
  136. package/es/select/index.d.ts +44 -0
  137. package/es/select/index.js +674 -0
  138. package/es/select/type.d.ts +252 -0
  139. package/es/share/const/event-bus-key.d.ts +4 -0
  140. package/es/share/const/event-bus-key.js +10 -0
  141. package/es/share/const/index.d.ts +4 -0
  142. package/es/share/const/index.js +11 -2
  143. package/es/share/const/provide-key.d.ts +3 -0
  144. package/es/share/const/provide-key.js +8 -0
  145. package/es/share/hook/use-click-outside-listener.d.ts +4 -0
  146. package/es/share/hook/use-click-outside-listener.js +44 -0
  147. package/es/share/hook/use-composition.d.ts +5 -0
  148. package/es/share/hook/use-composition.js +17 -0
  149. package/es/share/hook/use-controlled-mode.d.ts +6 -0
  150. package/es/share/hook/use-controlled-mode.js +25 -0
  151. package/es/share/hook/use-dark-mode.js +11 -3
  152. package/es/share/hook/use-index-of-children.d.ts +2 -1
  153. package/es/share/hook/use-index-of-children.js +25 -35
  154. package/es/share/hook/use-resize-observer.js +1 -1
  155. package/es/share/hook/use-textarea-height.d.ts +5 -0
  156. package/es/share/hook/use-textarea-height.js +116 -0
  157. package/es/share/hook/use-watch-global-css-var.d.ts +1 -0
  158. package/es/share/hook/use-watch-global-css-var.js +19 -0
  159. package/es/share/hook/use-z-index.d.ts +6 -0
  160. package/es/share/hook/use-z-index.js +32 -0
  161. package/es/share/type/index.d.ts +9 -1
  162. package/es/share/util/color.js +4 -2
  163. package/es/share/util/common.d.ts +5 -0
  164. package/es/share/util/common.js +71 -0
  165. package/es/share/util/event-bus.d.ts +1 -0
  166. package/es/share/util/event-bus.js +20 -0
  167. package/es/share/util/plot.d.ts +15 -2
  168. package/es/share/util/plot.js +200 -30
  169. package/es/share/util/render.d.ts +1 -0
  170. package/es/share/util/render.js +10 -2
  171. package/es/share/util/theme.js +23 -4
  172. package/es/space/css.js +1 -1
  173. package/es/space/index.css +5 -0
  174. package/es/space/index.js +2 -2
  175. package/es/spin/css.js +2 -0
  176. package/es/spin/index.css +66 -0
  177. package/es/spin/index.d.ts +24 -0
  178. package/es/spin/index.js +104 -0
  179. package/es/spin/type.d.ts +54 -0
  180. package/es/tag/css.js +2 -0
  181. package/es/tag/draw.d.ts +6 -0
  182. package/es/tag/draw.js +135 -0
  183. package/es/tag/index.css +372 -0
  184. package/es/tag/index.d.ts +23 -0
  185. package/es/tag/index.js +193 -0
  186. package/es/tag/type.d.ts +58 -0
  187. package/es/textarea/css.js +2 -0
  188. package/es/textarea/draw.d.ts +2 -0
  189. package/es/textarea/draw.js +13 -0
  190. package/es/textarea/index.css +108 -0
  191. package/es/textarea/index.d.ts +49 -0
  192. package/es/textarea/index.js +267 -0
  193. package/es/textarea/type.d.ts +169 -0
  194. package/es/tooltip/css.js +1 -0
  195. package/es/tooltip/index.d.ts +20 -0
  196. package/es/tooltip/index.js +228 -0
  197. package/es/tooltip/type.d.ts +77 -0
  198. package/package.json +17 -3
  199. package/es/icons/{css.js → css-hn.js} +1 -1
@@ -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,123 @@
1
+ div.px-auto-complete {
2
+ font-size: var(--text-size);
3
+ }
4
+ .px-auto-complete {
5
+ --auto-complete-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(--auto-complete-size);
22
+ cursor: text;
23
+ }
24
+ .px-auto-complete__inner {
25
+ padding-right: calc(var(--padding-x-size) + 1px + 1 * var(--px-bit));
26
+ }
27
+ .px-auto-complete__inner:last-child {
28
+ padding-right: var(--padding-x-size);
29
+ }
30
+ .px-auto-complete-inner {
31
+ height: 100%;
32
+ border: 0;
33
+ background-color: transparent;
34
+ box-sizing: border-box;
35
+ width: 100%;
36
+ font-size: var(--text-size);
37
+ line-height: var(--px-line-height);
38
+ font-family: var(--px-font);
39
+ padding: 0;
40
+ }
41
+ .px-auto-complete-inner:focus-visible {
42
+ outline-color: var(--px-neutral-10);
43
+ outline-offset: var(--px-bit);
44
+ }
45
+ .px-auto-complete-inner:disabled {
46
+ color: var(--px-neutral-10);
47
+ }
48
+ .px-auto-complete-inner::placeholder {
49
+ color: var(--px-neutral-8);
50
+ opacity: 1;
51
+ }
52
+ .px-auto-complete__large {
53
+ --padding-x-size: var(--px-large-padding-x);
54
+ --text-size: var(--px-large-font-size);
55
+ --auto-complete-size: var(--px-large-size);
56
+ }
57
+ .px-auto-complete__small {
58
+ --padding-x-size: var(--px-small-padding-x);
59
+ --auto-complete-size: var(--px-small-size);
60
+ --text-size: var(--px-small-font-size);
61
+ }
62
+ .px-auto-complete__disabled {
63
+ cursor: not-allowed;
64
+ }
65
+ .px-auto-complete__disabled .px-auto-complete-inner:disabled {
66
+ cursor: not-allowed;
67
+ color: var(--px-neutral-8);
68
+ }
69
+ .px-auto-complete-prefix-wrapper,
70
+ .px-auto-complete-suffix-wrapper,
71
+ .px-auto-complete-loading-wrapper,
72
+ .px-auto-complete-close-wrapper {
73
+ flex-shrink: 0;
74
+ display: flex;
75
+ align-items: center;
76
+ }
77
+ .px-auto-complete-prefix-wrapper {
78
+ margin-right: var(--px-interval-2);
79
+ }
80
+ .px-auto-complete-suffix-wrapper,
81
+ .px-auto-complete-loading-wrapper,
82
+ .px-auto-complete-close-wrapper {
83
+ margin-left: var(--px-interval-2);
84
+ }
85
+ .px-auto-complete-close-wrapper .px-auto-complete-icon-placeholder {
86
+ width: var(--text-size);
87
+ height: var(--text-size);
88
+ }
89
+ .px-auto-complete-close-wrapper .px-auto-complete-icon {
90
+ width: var(--text-size);
91
+ height: var(--text-size);
92
+ cursor: pointer;
93
+ fill: var(--px-neutral-8);
94
+ transition: 0.25s;
95
+ }
96
+ .px-auto-complete-close-wrapper .px-auto-complete-icon:hover {
97
+ fill: var(--px-neutral-7);
98
+ }
99
+ .px-auto-complete-close-wrapper .px-auto-complete-icon:active {
100
+ fill: var(--px-neutral-9);
101
+ }
102
+ .px-auto-complete-loading-wrapper .px-auto-complete-icon {
103
+ width: var(--text-size);
104
+ height: var(--text-size);
105
+ fill: var(--px-primary-6);
106
+ }
107
+ .px-auto-complete-prefix-wrapper,
108
+ .px-auto-complete-suffix-wrapper {
109
+ color: var(--px-neutral-10);
110
+ }
111
+ .px-auto-complete-canvas {
112
+ position: absolute;
113
+ top: 50%;
114
+ left: 50%;
115
+ transform: translate(-50%, -50%);
116
+ z-index: -1;
117
+ pointer-events: none;
118
+ }
119
+ .px-auto-complete-empty {
120
+ width: 100%;
121
+ display: flex;
122
+ justify-content: center;
123
+ }
@@ -0,0 +1,35 @@
1
+ import type { AutoCompleteGroupOption, AutoCompleteOption, AutoCompleteProps } from './type';
2
+ declare const _default: import("vue").DefineComponent<AutoCompleteProps, {
3
+ focus: () => void;
4
+ blur: () => void;
5
+ clear: () => Promise<void>;
6
+ select: () => void;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ input: (value: string, e: Event) => any;
9
+ select: (value: string, option: string | AutoCompleteOption, e: MouseEvent) => any;
10
+ change: (value: string, e?: Event | undefined) => any;
11
+ clear: (value: string) => any;
12
+ blur: (e: FocusEvent) => any;
13
+ focus: (e: FocusEvent) => any;
14
+ "update:modelValue": (value: string) => any;
15
+ }, string, import("vue").PublicProps, Readonly<AutoCompleteProps> & Readonly<{
16
+ onInput?: ((value: string, e: Event) => any) | undefined;
17
+ onSelect?: ((value: string, option: string | AutoCompleteOption, e: MouseEvent) => any) | undefined;
18
+ onChange?: ((value: string, e?: Event | undefined) => any) | undefined;
19
+ onClear?: ((value: string) => any) | undefined;
20
+ onBlur?: ((e: FocusEvent) => any) | undefined;
21
+ onFocus?: ((e: FocusEvent) => any) | undefined;
22
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
23
+ }>, {
24
+ shape: "default" | "round";
25
+ size: "medium" | "large" | "small";
26
+ disabled: boolean;
27
+ loading: boolean;
28
+ readonly: boolean;
29
+ clearable: boolean;
30
+ status: "success" | "warning" | "error" | "normal";
31
+ options: (string | AutoCompleteOption | AutoCompleteGroupOption)[];
32
+ showPopoverEmpty: boolean;
33
+ append: boolean;
34
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
+ export default _default;
@@ -0,0 +1,402 @@
1
+ import './css.js'
2
+ import { defineComponent, createElementBlock, openBlock, normalizeStyle, createElementVNode, useAttrs, getCurrentInstance, ref, inject, computed, shallowRef, useSlots, watch, onMounted, nextTick, createVNode, Fragment, h } from "vue";
3
+ import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
4
+ import { d as drawBorder } from "./draw.js";
5
+ import { g as getGlobalThemeColor } from "../share/util/color.js";
6
+ import { c as calcPixelSize, a as canvasPreprocess, g as getBorderRadius, b as calcBorderCornerCenter, f as floodFill } from "../share/util/plot.js";
7
+ import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
8
+ import { u as useComposition } from "../share/hook/use-composition.js";
9
+ import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
10
+ import { _ as _sfc_main$1 } from "../input-group/index.js";
11
+ import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
12
+ import { u as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
13
+ import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
14
+ import { _ as _sfc_main$2 } from "../popover/index.js";
15
+ import { _ as _sfc_main$4 } from "../empty/index.js";
16
+ import { _ as _sfc_main$3 } from "../option-list/index.js";
17
+ import { d as defaultFilter } from "../share/util/common.js";
18
+ import { p } from "../aside/index.js";
19
+ import { B as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
20
+ import { u as useControlledMode } from "../share/hook/use-controlled-mode.js";
21
+ const SpinnerThirdSolid = /* @__PURE__ */ defineComponent({
22
+ props: {
23
+ size: {},
24
+ color: {}
25
+ },
26
+ setup(__props) {
27
+ const props = __props;
28
+ return (_ctx, _cache) => {
29
+ return openBlock(), createElementBlock(
30
+ "svg",
31
+ {
32
+ class: "px-icon-hn",
33
+ style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
34
+ xmlns: "http://www.w3.org/2000/svg",
35
+ viewBox: "0 0 24 24"
36
+ },
37
+ [..._cache[0] || (_cache[0] = [
38
+ createElementVNode(
39
+ "path",
40
+ { d: "M23 9v6h-1v2h-3v-2h1V9h-1V7h-1V6h-1V5h-2V4h-2V3h-1V1h3v1h2v1h2v1h1v1h1v2h1v2z" },
41
+ null,
42
+ -1
43
+ /* CACHED */
44
+ )
45
+ ])],
46
+ 4
47
+ /* STYLE */
48
+ );
49
+ };
50
+ }
51
+ });
52
+ const TimesCircleSolid = /* @__PURE__ */ defineComponent({
53
+ props: {
54
+ size: {},
55
+ color: {}
56
+ },
57
+ setup(__props) {
58
+ const props = __props;
59
+ return (_ctx, _cache) => {
60
+ return openBlock(), createElementBlock(
61
+ "svg",
62
+ {
63
+ class: "px-icon-hn",
64
+ style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ viewBox: "0 0 24 24"
67
+ },
68
+ [..._cache[0] || (_cache[0] = [
69
+ createElementVNode(
70
+ "path",
71
+ { d: "M22 9V7h-1V5h-1V4h-1V3h-2V2h-2V1H9v1H7v1H5v1H4v1H3v2H2v2H1v6h1v2h1v2h1v1h1v1h2v1h2v1h6v-1h2v-1h2v-1h1v-1h1v-2h1v-2h1V9zm-8 7v-1h-1v-1h-2v1h-1v1H9v1H8v-1H7v-1h1v-1h1v-1h1v-2H9v-1H8V9H7V8h1V7h1v1h1v1h1v1h2V9h1V8h1V7h1v1h1v1h-1v1h-1v1h-1v2h1v1h1v1h1v1h-1v1h-1v-1z" },
72
+ null,
73
+ -1
74
+ /* CACHED */
75
+ )
76
+ ])],
77
+ 4
78
+ /* STYLE */
79
+ );
80
+ };
81
+ }
82
+ });
83
+ const _sfc_main = /* @__PURE__ */ defineComponent({
84
+ ...{
85
+ name: "AutoComplete"
86
+ },
87
+ __name: "index",
88
+ props: {
89
+ modelValue: null,
90
+ defaultValue: null,
91
+ options: {
92
+ default: () => []
93
+ },
94
+ placeholder: null,
95
+ disabled: {
96
+ type: Boolean,
97
+ default: false
98
+ },
99
+ readonly: {
100
+ type: Boolean,
101
+ default: false
102
+ },
103
+ clearable: {
104
+ type: Boolean,
105
+ default: false
106
+ },
107
+ loading: {
108
+ type: Boolean,
109
+ default: false
110
+ },
111
+ showPopoverEmpty: {
112
+ type: Boolean,
113
+ default: false
114
+ },
115
+ shouldShowPopover: {
116
+ type: Function
117
+ },
118
+ filter: {
119
+ type: Function
120
+ },
121
+ append: {
122
+ type: Boolean,
123
+ default: false
124
+ },
125
+ size: {
126
+ default: "medium"
127
+ },
128
+ shape: {
129
+ default: "default"
130
+ },
131
+ borderRadius: null,
132
+ status: {
133
+ default: "normal"
134
+ },
135
+ autofocus: {
136
+ type: Boolean
137
+ }
138
+ },
139
+ emits: ["input", "update:modelValue", "change", "clear", "blur", "focus", "select"],
140
+ setup(__props, {
141
+ expose: __expose,
142
+ emit: __emit
143
+ }) {
144
+ var _a;
145
+ const attrs = useAttrs();
146
+ const pixelSize = calcPixelSize();
147
+ const props = __props;
148
+ const emits = __emit;
149
+ const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({
150
+ afterComposition: (e) => {
151
+ nextTick(() => {
152
+ inputHandler(e);
153
+ });
154
+ }
155
+ });
156
+ const instance = getCurrentInstance();
157
+ const innerInputGroup = ref(((_a = instance == null ? void 0 : instance.parent) == null ? void 0 : _a.type) === _sfc_main$1);
158
+ const [_, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [ref(0), ref(false), ref(false)];
159
+ const inputGroupProps = inject(INPUT_GROUP_PROVIDE);
160
+ const borderRadiusComputed = computed(() => {
161
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.borderRadius : props.borderRadius;
162
+ });
163
+ const sizeComputed = computed(() => {
164
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.size : props.size;
165
+ });
166
+ const shapeComputed = computed(() => {
167
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.shape : props.shape;
168
+ });
169
+ const disabledComputed = computed(() => {
170
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.disabled || props.disabled : props.disabled;
171
+ });
172
+ const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
173
+ defaultField: "defaultValue",
174
+ transform: (e) => {
175
+ return e || "";
176
+ }
177
+ });
178
+ const wrapperRef = shallowRef(null);
179
+ const canvasRef = shallowRef(null);
180
+ const inputRef = shallowRef(null);
181
+ const triggerPopover = async () => {
182
+ await nextTick();
183
+ if (props.shouldShowPopover) {
184
+ popoverVisible.value = !!props.shouldShowPopover(modelValue.value || "", optionsFiltered.value);
185
+ return;
186
+ }
187
+ if (modelValue.value && (!props.showPopoverEmpty && optionsFiltered.value.length || props.showPopoverEmpty)) {
188
+ popoverVisible.value = true;
189
+ } else {
190
+ popoverVisible.value = false;
191
+ }
192
+ };
193
+ const closePopover = async () => {
194
+ popoverVisible.value = false;
195
+ };
196
+ const inputHandler = async (e) => {
197
+ e.stopPropagation();
198
+ const target = e.target;
199
+ const newValue = target.value;
200
+ modelValue.value = newValue;
201
+ if (isComposing.value) {
202
+ return;
203
+ }
204
+ emits("input", newValue, e);
205
+ await updateModelValue(newValue);
206
+ triggerPopover();
207
+ };
208
+ const clearHandler = async () => {
209
+ await updateModelValue("");
210
+ emits("change", "");
211
+ emits("clear", "");
212
+ };
213
+ const changeHandler = (e) => {
214
+ e.stopPropagation();
215
+ const target = e.target;
216
+ emits("change", target.value, e);
217
+ };
218
+ const focusMode = ref(false);
219
+ const blurHandler = () => {
220
+ focusMode.value = false;
221
+ };
222
+ const focusHandler = () => {
223
+ focusMode.value = true;
224
+ };
225
+ const focusInputHandler = () => {
226
+ var _a2;
227
+ (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
228
+ };
229
+ const hoverFlag = ref(false);
230
+ const mouseenterHandler = () => {
231
+ hoverFlag.value = true;
232
+ };
233
+ const mouseleaveHandler = () => {
234
+ hoverFlag.value = false;
235
+ };
236
+ const showClose = computed(() => {
237
+ return props.clearable && !disabledComputed.value && !props.readonly;
238
+ });
239
+ const selectHandler = async (value, option, e) => {
240
+ const nextValue = props.append ? modelValue.value + value : value;
241
+ await updateModelValue(nextValue);
242
+ closePopover();
243
+ emits("select", nextValue, option, e);
244
+ };
245
+ const slots = useSlots();
246
+ const optionsFiltered = computed(() => {
247
+ if (props.filter) {
248
+ return props.filter(modelValue.value || "", props.options || []);
249
+ }
250
+ if (!modelValue.value || !modelValue.value.trim()) {
251
+ return [];
252
+ }
253
+ return defaultFilter(modelValue.value, props.options || []);
254
+ });
255
+ __expose({
256
+ focus: () => {
257
+ var _a2;
258
+ (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
259
+ },
260
+ blur: () => {
261
+ var _a2;
262
+ (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
263
+ },
264
+ clear: () => clearHandler(),
265
+ select: () => {
266
+ var _a2;
267
+ (_a2 = inputRef.value) == null ? void 0 : _a2.select();
268
+ }
269
+ });
270
+ const popoverVisible = ref(false);
271
+ const popoverVisibleUpdateHandler = (value) => {
272
+ if (!value) {
273
+ popoverVisible.value = value;
274
+ }
275
+ };
276
+ const darkMode = useDarkMode();
277
+ watch([first, last, borderRadiusComputed, shapeComputed, sizeComputed, disabledComputed, () => slots, darkMode, focusMode, hoverFlag], () => {
278
+ setTimeout(() => {
279
+ drawPixel();
280
+ });
281
+ });
282
+ const drawPixel = () => {
283
+ const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
284
+ if (!preprocessData) {
285
+ return;
286
+ }
287
+ const {
288
+ ctx,
289
+ width,
290
+ height,
291
+ canvas
292
+ } = preprocessData;
293
+ const pixelSize2 = calcPixelSize();
294
+ const borderRadius = getBorderRadius(canvas, pixelSize2, borderRadiusComputed.value, shapeComputed.value, sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
295
+ const borderColor = props.status !== "normal" ? getGlobalThemeColor(props.status === "error" ? "danger" : props.status, 6) : (hoverFlag.value || focusMode.value) && !disabledComputed.value && !props.readonly ? getGlobalThemeColor("primary", 6) : getGlobalThemeColor("neutral", 10);
296
+ const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize2);
297
+ const rad = BORDER_CORNER_RAD_RANGE;
298
+ drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize2, innerInputGroup.value, first.value, last.value);
299
+ const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
300
+ floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
301
+ };
302
+ onMounted(() => {
303
+ nextTick(() => {
304
+ drawPixel();
305
+ });
306
+ });
307
+ useResizeObserver(wrapperRef, drawPixel);
308
+ useWatchGlobalCssVal(drawPixel);
309
+ return () => {
310
+ const Inner = createVNode(Fragment, null, [slots.prefix && createVNode("div", {
311
+ "class": "px-auto-complete-prefix-wrapper"
312
+ }, [slots.prefix()]), createVNode("input", {
313
+ "ref": inputRef,
314
+ "class": "px-auto-complete-inner",
315
+ "value": modelValue.value,
316
+ "placeholder": props.placeholder,
317
+ "disabled": disabledComputed.value || props.readonly,
318
+ "autofocus": props.autofocus,
319
+ "onInput": inputHandler,
320
+ "onChange": changeHandler,
321
+ "onBlur": blurHandler,
322
+ "onFocus": focusHandler,
323
+ "onCompositionstart": compositionStartHandler,
324
+ "onCompositionend": compositionUpdateHandler
325
+ }, null), showClose.value && createVNode("div", {
326
+ "class": "px-auto-complete-close-wrapper"
327
+ }, [hoverFlag.value && modelValue.value ? createVNode(TimesCircleSolid, {
328
+ "class": "px-auto-complete-icon",
329
+ "onClick": clearHandler
330
+ }, null) : createVNode("div", {
331
+ "class": "px-auto-complete-icon-placeholder"
332
+ }, null)]), props.loading && createVNode("div", {
333
+ "class": "px-auto-complete-loading-wrapper"
334
+ }, [createVNode(SpinnerThirdSolid, {
335
+ "class": "px-auto-complete-icon px-animation__loading"
336
+ }, null)]), slots.suffix && createVNode("div", {
337
+ "class": "px-auto-complete-suffix-wrapper"
338
+ }, [slots.suffix()]), createVNode("canvas", {
339
+ "ref": canvasRef,
340
+ "class": "px-auto-complete-canvas"
341
+ }, null)]);
342
+ const scopeObj = {};
343
+ const scopeId = instance == null ? void 0 : instance.vnode.scopeId;
344
+ const parentScopeId = instance == null ? void 0 : instance.vnode.scopeId;
345
+ if (scopeId) {
346
+ scopeObj[scopeId] = "";
347
+ }
348
+ if (parentScopeId) {
349
+ scopeObj[parentScopeId] = "";
350
+ }
351
+ const Render = createVNode(_sfc_main$2, {
352
+ "placement": "bottom",
353
+ "offset": 0,
354
+ "width-equal": true,
355
+ "arrow": false,
356
+ "visible": popoverVisible.value,
357
+ "onUpdate:visible": popoverVisibleUpdateHandler,
358
+ "trigger": "click",
359
+ "contentStyle": {
360
+ padding: `${pixelSize}px`
361
+ }
362
+ }, {
363
+ default: () => h("div", {
364
+ ref: wrapperRef,
365
+ class: ["pixelium px-auto-complete", sizeComputed.value && `px-auto-complete__${sizeComputed.value}`, shapeComputed.value && `px-auto-complete__${shapeComputed.value}`, {
366
+ "px-auto-complete__inner": innerInputGroup.value
367
+ }, {
368
+ "px-auto-complete__disabled": disabledComputed.value
369
+ }],
370
+ onClick: focusInputHandler,
371
+ onMouseenter: mouseenterHandler,
372
+ onMouseleave: mouseleaveHandler,
373
+ ...scopeObj,
374
+ ...attrs
375
+ }, [Inner]),
376
+ content: () => optionsFiltered.value.length ? createVNode(_sfc_main$3, {
377
+ "options": optionsFiltered.value,
378
+ "onSelect": selectHandler
379
+ }, {
380
+ "group-label": ({
381
+ option
382
+ }) => slots["group-label"] ? slots["group-label"]({
383
+ option
384
+ }) : option.label,
385
+ option: ({
386
+ option
387
+ }) => slots.option ? slots.option({
388
+ option
389
+ }) : p(option) ? option : option.label
390
+ }) : createVNode("div", {
391
+ "class": "px-auto-complete-empty"
392
+ }, [createVNode(_sfc_main$4, null, null)])
393
+ });
394
+ return Render;
395
+ };
396
+ }
397
+ });
398
+ export {
399
+ SpinnerThirdSolid as S,
400
+ TimesCircleSolid as T,
401
+ _sfc_main as _
402
+ };