@pixelium/web-vue 0.0.1-beta → 0.0.2-fix

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +5370 -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 +677 -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,474 @@
1
+ import './css.js'
2
+ import { defineComponent, getCurrentInstance, ref, inject, computed, shallowRef, useSlots, watch, onMounted, nextTick, createElementBlock, openBlock, normalizeClass, createCommentVNode, createElementVNode, unref, renderSlot, Fragment, renderList, createBlock, withCtx, createTextVNode, toDisplayString, createVNode, withKeys, withModifiers } from "vue";
3
+ import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
4
+ import { d as drawBorder } from "./draw.js";
5
+ import { g as getGlobalThemeColor } from "../share/util/color.js";
6
+ import { a as canvasPreprocess, c as calcPixelSize, g as getBorderRadius, b as calcBorderCornerCenter, f as floodFill } from "../share/util/plot.js";
7
+ import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
8
+ import { u as useComposition } from "../share/hook/use-composition.js";
9
+ import { T as TimesCircleSolid, S as SpinnerThirdSolid } from "../auto-complete/index.js";
10
+ import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
11
+ import { _ as _sfc_main$1 } from "../input-group/index.js";
12
+ import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
13
+ import { u as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
14
+ import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
15
+ import { _ as _sfc_main$2 } from "../tag/index.js";
16
+ import { k, $ } from "../aside/index.js";
17
+ import { _ as _sfc_main$3 } from "../popover/index.js";
18
+ import { B as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
19
+ import { u as useControlledMode } from "../share/hook/use-controlled-mode.js";
20
+ const _hoisted_1 = {
21
+ key: 0,
22
+ class: "px-input-tag-prefix-wrapper"
23
+ };
24
+ const _hoisted_2 = { class: "px-input-tag-content" };
25
+ const _hoisted_3 = { class: "px-input-tag-content" };
26
+ const _hoisted_4 = ["value", "placeholder", "disabled", "autofocus"];
27
+ const _hoisted_5 = {
28
+ key: 1,
29
+ class: "px-input-tag-close-wrapper"
30
+ };
31
+ const _hoisted_6 = {
32
+ key: 1,
33
+ class: "px-input-tag-icon-placeholder"
34
+ };
35
+ const _hoisted_7 = {
36
+ key: 2,
37
+ class: "px-input-tag-loading-wrapper"
38
+ };
39
+ const _hoisted_8 = {
40
+ key: 3,
41
+ class: "px-input-tag-suffix-wrapper"
42
+ };
43
+ const _sfc_main = /* @__PURE__ */ defineComponent({
44
+ ...{
45
+ name: "InputTag"
46
+ },
47
+ __name: "index",
48
+ props: {
49
+ modelValue: null,
50
+ defaultValue: null,
51
+ inputValue: null,
52
+ defaultInputValue: null,
53
+ placeholder: null,
54
+ disabled: { type: Boolean, default: false },
55
+ readonly: { type: Boolean, default: false },
56
+ clearable: { type: Boolean, default: false },
57
+ loading: { type: Boolean, default: false },
58
+ size: { default: "medium" },
59
+ shape: { default: "default" },
60
+ borderRadius: null,
61
+ maxLength: null,
62
+ collapseTags: { type: Boolean, default: false },
63
+ maxDisplayTags: null,
64
+ collapseTagsPopover: { type: Boolean, default: true },
65
+ tagTheme: { default: "info" },
66
+ tagVariant: { default: "plain" },
67
+ tagColor: null,
68
+ status: { default: "normal" },
69
+ autofocus: { type: Boolean }
70
+ },
71
+ emits: ["update:modelValue", "tagAdd", "tagClose", "change", "input", "update:inputValue", "inputChange", "clear", "blur", "focus"],
72
+ setup(__props, { expose: __expose, emit: __emit }) {
73
+ var _a;
74
+ const props = __props;
75
+ const emits = __emit;
76
+ const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({
77
+ afterComposition: (e) => {
78
+ nextTick(() => {
79
+ inputHandler(e);
80
+ });
81
+ }
82
+ });
83
+ const instance = getCurrentInstance();
84
+ const innerInputGroup = ref(((_a = instance == null ? void 0 : instance.parent) == null ? void 0 : _a.type) === _sfc_main$1);
85
+ const [_, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [ref(0), ref(false), ref(false)];
86
+ const inputGroupProps = inject(INPUT_GROUP_PROVIDE);
87
+ const borderRadiusComputed = computed(() => {
88
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.borderRadius : props.borderRadius;
89
+ });
90
+ const sizeComputed = computed(() => {
91
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.size : props.size;
92
+ });
93
+ const shapeComputed = computed(() => {
94
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.shape : props.shape;
95
+ });
96
+ const disabledComputed = computed(() => {
97
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.disabled || props.disabled : props.disabled;
98
+ });
99
+ const tagSize = computed(() => {
100
+ return sizeComputed.value === "small" ? "small" : "medium";
101
+ });
102
+ const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
103
+ defaultField: "defaultValue",
104
+ transform: (value) => {
105
+ if ($(value)) {
106
+ return [...value];
107
+ }
108
+ return [];
109
+ }
110
+ });
111
+ const [inputValue, updateInputValue] = useControlledMode("inputValue", props, emits, {
112
+ defaultField: "defaultInputValue",
113
+ transform: (value) => {
114
+ return value || "";
115
+ }
116
+ });
117
+ const wrapperRef = shallowRef(null);
118
+ const canvasRef = shallowRef(null);
119
+ const inputRef = shallowRef(null);
120
+ const inputHandler = async (e) => {
121
+ const target = e.target;
122
+ const newValue = target.value;
123
+ inputValue.value = newValue;
124
+ if (isComposing.value) {
125
+ return;
126
+ }
127
+ emits("input", newValue, e);
128
+ updateInputValue(newValue);
129
+ };
130
+ const clearHandler = async () => {
131
+ const newTags = [];
132
+ await updateModelValue(newTags);
133
+ await updateInputValue("");
134
+ emits("clear", newTags);
135
+ emits("change", newTags);
136
+ emits("inputChange", "");
137
+ };
138
+ const tagCloseHandler = async (index, e) => {
139
+ const currentTags = modelValue.value ? [...modelValue.value] : [];
140
+ const closed = currentTags.splice(index, 1);
141
+ await updateModelValue(currentTags);
142
+ emits("tagClose", closed[0], index, e);
143
+ emits("change", currentTags);
144
+ };
145
+ const inputChangeHandler = (e) => {
146
+ const target = e.target;
147
+ emits("inputChange", target.value, e);
148
+ };
149
+ const focusMode = ref(false);
150
+ const blurHandler = async () => {
151
+ focusMode.value = false;
152
+ await updateInputValue("");
153
+ emits("inputChange", "");
154
+ };
155
+ const focusHandler = () => {
156
+ focusMode.value = true;
157
+ };
158
+ const enterDownHandler = async (e) => {
159
+ const currentValue = (inputValue.value || "").trim();
160
+ if (!currentValue || props.maxLength && modelValue.value && modelValue.value.length >= props.maxLength) {
161
+ return;
162
+ }
163
+ const currentTags = modelValue.value ? [...modelValue.value] : [];
164
+ currentTags.push(currentValue);
165
+ await updateModelValue(currentTags);
166
+ await updateInputValue("");
167
+ emits("tagAdd", currentValue, e);
168
+ emits("change", currentTags);
169
+ emits("inputChange", "");
170
+ };
171
+ const focusInputHandler = () => {
172
+ var _a2;
173
+ (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
174
+ };
175
+ const hoverFlag = ref(false);
176
+ const mouseenterHandler = () => {
177
+ hoverFlag.value = true;
178
+ };
179
+ const mouseleaveHandler = () => {
180
+ hoverFlag.value = false;
181
+ };
182
+ const showClose = computed(() => {
183
+ return props.clearable && !disabledComputed.value && !props.readonly;
184
+ });
185
+ const tagCanClose = computed(() => {
186
+ return !disabledComputed.value && !props.readonly;
187
+ });
188
+ const slots = useSlots();
189
+ __expose({
190
+ focus: () => {
191
+ var _a2;
192
+ (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
193
+ },
194
+ blur: () => {
195
+ var _a2;
196
+ (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
197
+ },
198
+ clear: () => clearHandler()
199
+ });
200
+ const shouldCollapseTags = computed(() => {
201
+ return !!props.collapseTags && k(props.maxDisplayTags) && props.maxDisplayTags >= 0;
202
+ });
203
+ const tagsShowed = computed(() => {
204
+ return modelValue.value ? shouldCollapseTags.value ? modelValue.value.slice(0, props.maxDisplayTags) : modelValue.value : [];
205
+ });
206
+ const tagsCollapsed = computed(() => {
207
+ return modelValue.value ? shouldCollapseTags.value ? modelValue.value.slice(props.maxDisplayTags) : [] : [];
208
+ });
209
+ const darkMode = useDarkMode();
210
+ watch(
211
+ [
212
+ first,
213
+ last,
214
+ borderRadiusComputed,
215
+ shapeComputed,
216
+ sizeComputed,
217
+ disabledComputed,
218
+ () => slots,
219
+ darkMode,
220
+ focusMode,
221
+ hoverFlag
222
+ ],
223
+ () => {
224
+ setTimeout(() => {
225
+ drawPixel();
226
+ });
227
+ }
228
+ );
229
+ const drawPixel = () => {
230
+ const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
231
+ if (!preprocessData) {
232
+ return;
233
+ }
234
+ const { ctx, width, height, canvas } = preprocessData;
235
+ const pixelSize = calcPixelSize();
236
+ const borderRadius = getBorderRadius(
237
+ canvas,
238
+ pixelSize,
239
+ borderRadiusComputed.value,
240
+ shapeComputed.value,
241
+ sizeComputed.value || "medium",
242
+ innerInputGroup.value,
243
+ first.value,
244
+ last.value
245
+ );
246
+ 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);
247
+ const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
248
+ const rad = BORDER_CORNER_RAD_RANGE;
249
+ drawBorder(
250
+ ctx,
251
+ width,
252
+ height,
253
+ center,
254
+ borderRadius,
255
+ rad,
256
+ borderColor,
257
+ pixelSize,
258
+ innerInputGroup.value,
259
+ first.value,
260
+ last.value
261
+ );
262
+ const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
263
+ floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
264
+ };
265
+ onMounted(() => {
266
+ nextTick(() => {
267
+ drawPixel();
268
+ });
269
+ });
270
+ useResizeObserver(wrapperRef, drawPixel);
271
+ useWatchGlobalCssVal(drawPixel);
272
+ return (_ctx, _cache) => {
273
+ var _a2;
274
+ return openBlock(), createElementBlock(
275
+ "div",
276
+ {
277
+ class: normalizeClass(["pixelium px-input-tag", {
278
+ [`px-input-tag__${sizeComputed.value}`]: !!sizeComputed.value,
279
+ [`px-input-tag__${shapeComputed.value}`]: !!shapeComputed.value,
280
+ "px-input-tag__inner": innerInputGroup.value,
281
+ "px-input-tag__disabled": !!disabledComputed.value
282
+ }]),
283
+ ref_key: "wrapperRef",
284
+ ref: wrapperRef,
285
+ onClick: focusInputHandler,
286
+ onMouseenter: mouseenterHandler,
287
+ onMouseleave: mouseleaveHandler
288
+ },
289
+ [
290
+ unref(slots).prefix ? (openBlock(), createElementBlock("div", _hoisted_1, [
291
+ renderSlot(_ctx.$slots, "prefix")
292
+ ])) : createCommentVNode("v-if", true),
293
+ createElementVNode("div", _hoisted_2, [
294
+ (openBlock(true), createElementBlock(
295
+ Fragment,
296
+ null,
297
+ renderList(tagsShowed.value, (tag, index) => {
298
+ return openBlock(), createBlock(_sfc_main$2, {
299
+ key: index,
300
+ size: tagSize.value,
301
+ variant: props.tagVariant,
302
+ theme: props.tagTheme,
303
+ closable: tagCanClose.value,
304
+ disabled: disabledComputed.value,
305
+ color: props.tagColor,
306
+ onClose: (e) => tagCloseHandler(index, e)
307
+ }, {
308
+ default: withCtx(() => [
309
+ renderSlot(_ctx.$slots, "tag", {
310
+ tag,
311
+ index
312
+ }, () => [
313
+ createTextVNode(
314
+ toDisplayString(tag),
315
+ 1
316
+ /* TEXT */
317
+ )
318
+ ])
319
+ ]),
320
+ _: 2
321
+ /* DYNAMIC */
322
+ }, 1032, ["size", "variant", "theme", "closable", "disabled", "color", "onClose"]);
323
+ }),
324
+ 128
325
+ /* KEYED_FRAGMENT */
326
+ )),
327
+ tagsCollapsed.value.length && shouldCollapseTags.value ? (openBlock(), createElementBlock(
328
+ Fragment,
329
+ { key: 0 },
330
+ [
331
+ !props.collapseTagsPopover ? (openBlock(), createBlock(_sfc_main$2, {
332
+ key: 0,
333
+ size: tagSize.value,
334
+ variant: props.tagVariant,
335
+ theme: props.tagTheme,
336
+ disabled: disabledComputed.value,
337
+ color: props.tagColor
338
+ }, {
339
+ default: withCtx(() => [
340
+ renderSlot(_ctx.$slots, "tag", {
341
+ tag: `+${tagsCollapsed.value.length}`,
342
+ index: -1
343
+ }, () => [
344
+ createTextVNode(
345
+ "+" + toDisplayString(tagsCollapsed.value.length),
346
+ 1
347
+ /* TEXT */
348
+ )
349
+ ])
350
+ ]),
351
+ _: 3
352
+ /* FORWARDED */
353
+ }, 8, ["size", "variant", "theme", "disabled", "color"])) : (openBlock(), createBlock(_sfc_main$3, { key: 1 }, {
354
+ content: withCtx(() => [
355
+ createElementVNode("div", _hoisted_3, [
356
+ (openBlock(true), createElementBlock(
357
+ Fragment,
358
+ null,
359
+ renderList(tagsCollapsed.value, (tag, index) => {
360
+ return openBlock(), createBlock(_sfc_main$2, {
361
+ key: index,
362
+ size: tagSize.value,
363
+ variant: props.tagVariant,
364
+ theme: props.tagTheme,
365
+ closable: tagCanClose.value,
366
+ disabled: disabledComputed.value,
367
+ color: props.tagColor,
368
+ onClose: (e) => tagCloseHandler(index + Math.floor(props.maxDisplayTags), e)
369
+ }, {
370
+ default: withCtx(() => [
371
+ renderSlot(_ctx.$slots, "tag", {
372
+ tag,
373
+ index: index + Math.floor(props.maxDisplayTags)
374
+ }, () => [
375
+ createTextVNode(
376
+ toDisplayString(tag),
377
+ 1
378
+ /* TEXT */
379
+ )
380
+ ])
381
+ ]),
382
+ _: 2
383
+ /* DYNAMIC */
384
+ }, 1032, ["size", "variant", "theme", "closable", "disabled", "color", "onClose"]);
385
+ }),
386
+ 128
387
+ /* KEYED_FRAGMENT */
388
+ ))
389
+ ])
390
+ ]),
391
+ default: withCtx(() => [
392
+ createVNode(_sfc_main$2, {
393
+ size: tagSize.value,
394
+ variant: props.tagVariant,
395
+ theme: props.tagTheme,
396
+ disabled: disabledComputed.value,
397
+ color: props.tagColor
398
+ }, {
399
+ default: withCtx(() => [
400
+ renderSlot(_ctx.$slots, "tag", {
401
+ tag: `+${tagsCollapsed.value.length}`,
402
+ index: -1
403
+ }, () => [
404
+ createTextVNode(
405
+ "+" + toDisplayString(tagsCollapsed.value.length),
406
+ 1
407
+ /* TEXT */
408
+ )
409
+ ])
410
+ ]),
411
+ _: 3
412
+ /* FORWARDED */
413
+ }, 8, ["size", "variant", "theme", "disabled", "color"])
414
+ ]),
415
+ _: 3
416
+ /* FORWARDED */
417
+ }))
418
+ ],
419
+ 64
420
+ /* STABLE_FRAGMENT */
421
+ )) : createCommentVNode("v-if", true),
422
+ createElementVNode("input", {
423
+ class: "px-input-tag-inner",
424
+ value: unref(inputValue),
425
+ ref_key: "inputRef",
426
+ ref: inputRef,
427
+ placeholder: unref(modelValue) && unref(modelValue).length ? "" : props.placeholder,
428
+ disabled: disabledComputed.value || props.readonly,
429
+ autofocus: __props.autofocus,
430
+ onInput: withModifiers(inputHandler, ["stop"]),
431
+ onChange: withModifiers(inputChangeHandler, ["stop"]),
432
+ onBlur: blurHandler,
433
+ onFocus: focusHandler,
434
+ onCompositionstart: _cache[0] || (_cache[0] = //@ts-ignore
435
+ (...args) => unref(compositionStartHandler) && unref(compositionStartHandler)(...args)),
436
+ onCompositionend: _cache[1] || (_cache[1] = //@ts-ignore
437
+ (...args) => unref(compositionUpdateHandler) && unref(compositionUpdateHandler)(...args)),
438
+ onKeydown: withKeys(enterDownHandler, ["enter"])
439
+ }, null, 40, _hoisted_4)
440
+ ]),
441
+ showClose.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
442
+ hoverFlag.value && !!((_a2 = unref(modelValue)) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(unref(TimesCircleSolid), {
443
+ key: 0,
444
+ class: "px-input-tag-icon",
445
+ onClick: clearHandler
446
+ })) : (openBlock(), createElementBlock("div", _hoisted_6))
447
+ ])) : createCommentVNode("v-if", true),
448
+ props.loading ? (openBlock(), createElementBlock("div", _hoisted_7, [
449
+ createVNode(unref(SpinnerThirdSolid), { class: "px-input-tag-icon px-animation__loading" })
450
+ ])) : createCommentVNode("v-if", true),
451
+ unref(slots).suffix ? (openBlock(), createElementBlock("div", _hoisted_8, [
452
+ renderSlot(_ctx.$slots, "suffix")
453
+ ])) : createCommentVNode("v-if", true),
454
+ createElementVNode(
455
+ "canvas",
456
+ {
457
+ class: "px-input-tag-canvas",
458
+ ref_key: "canvasRef",
459
+ ref: canvasRef
460
+ },
461
+ null,
462
+ 512
463
+ /* NEED_PATCH */
464
+ )
465
+ ],
466
+ 34
467
+ /* CLASS, NEED_HYDRATION */
468
+ );
469
+ };
470
+ }
471
+ });
472
+ export {
473
+ _sfc_main as _
474
+ };
@@ -0,0 +1,212 @@
1
+ import type { NumberOrPercentage } from '../share/type';
2
+ import type { TagProps } from '../tag/type';
3
+ export type InputTagProps = {
4
+ /**
5
+ * @property {string[] | null} [modelValue]
6
+ * @version 0.0.2
7
+ */
8
+ modelValue?: string[] | null;
9
+ /**
10
+ * @property {string[] | null} [defaultValue]
11
+ * @version 0.0.2
12
+ */
13
+ defaultValue?: string[] | null;
14
+ /**
15
+ * @property {string | null} [inputValue]
16
+ * @version 0.0.2
17
+ */
18
+ inputValue?: string | null;
19
+ /**
20
+ * @property {string | null} [defaultInputValue]
21
+ * @version 0.0.2
22
+ */
23
+ defaultInputValue?: string | null;
24
+ /**
25
+ * @property {string} [placeholder]
26
+ * @version 0.0.2
27
+ */
28
+ placeholder?: string;
29
+ /**
30
+ * @property {boolean} [disabled=false]
31
+ * @version 0.0.2
32
+ */
33
+ disabled?: boolean;
34
+ /**
35
+ * @property {boolean} [readonly=false]
36
+ * @version 0.0.2
37
+ */
38
+ readonly?: boolean;
39
+ /**
40
+ * @property {boolean} [clearable=false]
41
+ * @version 0.0.2
42
+ */
43
+ clearable?: boolean;
44
+ /**
45
+ * @property {boolean} [loading=false]
46
+ * @version 0.0.2
47
+ */
48
+ loading?: boolean;
49
+ /**
50
+ * @property {'medium' | 'large' | 'small'} [size='medium']
51
+ * @version 0.0.2
52
+ */
53
+ size?: 'medium' | 'large' | 'small';
54
+ /**
55
+ * @property {'default' | 'round'} [shape='default']
56
+ * @version 0.0.2
57
+ */
58
+ shape?: 'default' | 'round';
59
+ /**
60
+ * @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
61
+ * @version 0.0.2
62
+ */
63
+ borderRadius?: NumberOrPercentage | NumberOrPercentage[];
64
+ /**
65
+ * @property {number} [maxLength]
66
+ * @version 0.0.2
67
+ */
68
+ maxLength?: number;
69
+ /**
70
+ * @property {boolean} [collapseTags=false]
71
+ * @version 0.0.2
72
+ */
73
+ collapseTags?: boolean;
74
+ /**
75
+ * @property {number} [collapseTags]
76
+ * @version 0.0.2
77
+ */
78
+ maxDisplayTags?: number;
79
+ /**
80
+ * @property {boolean} [collapseTagsPopover=true]
81
+ * @version 0.0.2
82
+ */
83
+ collapseTagsPopover?: boolean;
84
+ /**
85
+ * @property {'primary' | 'sakura' | 'success' | 'warning' | 'danger' | 'info'} [tagTheme='info']
86
+ * @version 0.0.2
87
+ */
88
+ tagTheme?: TagProps['theme'];
89
+ /**
90
+ * @property {'primary' | 'plain' | 'outline'} [tagVariant='plain']
91
+ * @version 0.0.2
92
+ */
93
+ tagVariant?: TagProps['variant'];
94
+ /**
95
+ * @property {string} [tagColor]
96
+ * @version 0.0.2
97
+ */
98
+ tagColor?: TagProps['color'];
99
+ /**
100
+ * @property {'success' | 'warning' | 'error' | 'normal'} [status='normal']
101
+ * @version 0.0.2
102
+ */
103
+ status?: 'success' | 'warning' | 'error' | 'normal';
104
+ /**
105
+ * @property {boolean} [autofocus=false]
106
+ * @version 0.0.2
107
+ */
108
+ autofocus?: boolean;
109
+ };
110
+ export type InputTagEvents = {
111
+ /**
112
+ * @event update:modelValue
113
+ * @param {string[]} value
114
+ * @version 0.0.2
115
+ */
116
+ 'update:modelValue': [value: string[]];
117
+ /**
118
+ * @event tagAdd
119
+ * @param {string} value
120
+ * @param {KeyboardEvent} e
121
+ * @version 0.0.2
122
+ */
123
+ tagAdd: [value: string, e: KeyboardEvent];
124
+ /**
125
+ * @event tagClose
126
+ * @param {string} value
127
+ * @param {number} index
128
+ * @param {MouseEvent} e
129
+ * @version 0.0.2
130
+ */
131
+ tagClose: [value: string, index: number, e: MouseEvent];
132
+ /**
133
+ * @event change
134
+ * @param {string[]} value
135
+ * @version 0.0.2
136
+ */
137
+ change: [value: string[]];
138
+ /**
139
+ * @event input
140
+ * @param {string} value
141
+ * @param {Event} e
142
+ * @version 0.0.2
143
+ */
144
+ input: [value: string, e: Event];
145
+ /**
146
+ * @event update:inputValue
147
+ * @param {string} value
148
+ * @version 0.0.2
149
+ */
150
+ 'update:inputValue': [value: string];
151
+ /**
152
+ * @event inputChange
153
+ * @param {string} value
154
+ * @param {Event | undefined} e
155
+ * @version 0.0.2
156
+ */
157
+ inputChange: [value: string, e?: Event];
158
+ /**
159
+ * @event clear
160
+ * @param {string[]} value
161
+ * @version 0.0.2
162
+ */
163
+ clear: [value: string[]];
164
+ /**
165
+ * @event blur
166
+ * @param {FocusEvent} e
167
+ * @version 0.0.2
168
+ */
169
+ blur: [e: FocusEvent];
170
+ /**
171
+ * @event focus
172
+ * @param {FocusEvent} e
173
+ * @version 0.0.2
174
+ */
175
+ focus: [e: FocusEvent];
176
+ };
177
+ export type InputTagSlots = {
178
+ /**
179
+ * @slot prefix
180
+ * @version 0.0.2
181
+ */
182
+ prefix: {};
183
+ /**
184
+ * @slot suffix
185
+ * @version 0.0.2
186
+ */
187
+ suffix: {};
188
+ /**
189
+ * @slot tag
190
+ * @param {string} tag
191
+ * @param {number} index
192
+ * @version 0.0.2
193
+ */
194
+ tag: {};
195
+ };
196
+ export type InputTagExpose = {
197
+ /**
198
+ * @property {() => void} focus
199
+ * @version 0.0.2
200
+ */
201
+ focus: () => void;
202
+ /**
203
+ * @property {() => void} blur
204
+ * @version 0.0.2
205
+ */
206
+ blur: () => void;
207
+ /**
208
+ * @property {() => void} clear
209
+ * @version 0.0.2
210
+ */
211
+ clear: () => void;
212
+ };
package/es/link/css.js CHANGED
@@ -1,2 +1,2 @@
1
- import './index.css'
2
1
  import '../index.css'
2
+ import './index.css'