@pixelium/web-vue 0.0.1-beta → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -10
- package/README.zh.md +21 -10
- package/dist/icon-pa.d.ts +490 -0
- package/dist/index.d.ts +1586 -10
- package/dist/pixelium-vue-icon-pa.cjs +1 -0
- package/dist/pixelium-vue-icon-pa.css +1 -0
- package/dist/pixelium-vue-icon-pa.js +10143 -0
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -0
- package/dist/pixelium-vue.cjs +12 -1
- package/dist/pixelium-vue.css +1 -1
- package/dist/pixelium-vue.js +5368 -1093
- package/dist/pixelium-vue.umd.cjs +12 -1
- package/es/aside/css.js +1 -1
- package/es/aside/index.js +60 -13
- package/es/auto-complete/css.js +2 -0
- package/es/auto-complete/draw.d.ts +2 -0
- package/es/auto-complete/draw.js +52 -0
- package/es/auto-complete/index.css +123 -0
- package/es/auto-complete/index.d.ts +35 -0
- package/es/auto-complete/index.js +402 -0
- package/es/auto-complete/type.d.ts +192 -0
- package/es/button/css.js +1 -1
- package/es/button/draw.d.ts +1 -2
- package/es/button/draw.js +105 -123
- package/es/button/index.css +24 -14
- package/es/button/index.js +70 -121
- package/es/button-group/css.js +1 -1
- package/es/button-group/index.d.ts +0 -1
- package/es/button-group/index.js +11 -37
- package/es/button-group/type.d.ts +1 -1
- package/es/col/css.js +1 -1
- package/es/col/index.d.ts +2 -2
- package/es/container/css.js +1 -1
- package/es/divider/css.js +1 -1
- package/es/empty/css.js +2 -0
- package/es/empty/index.css +19 -0
- package/es/empty/index.d.ts +17 -0
- package/es/empty/index.js +73 -0
- package/es/empty/type.d.ts +19 -0
- package/es/footer/css.js +1 -1
- package/es/grid/css.js +1 -1
- package/es/grid/index.js +5 -1
- package/es/grid-item/css.js +1 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +7 -3
- package/es/header/css.js +1 -1
- package/es/icon/css.js +1 -1
- package/es/icon/index.css +0 -3
- package/es/icon/index.js +1 -1
- package/es/icons/css-pa.js +2 -0
- package/es/icons/icon-hn.js +1 -1
- package/es/icons/icon-pa.css +9 -0
- package/es/icons/icon-pa.d.ts +490 -0
- package/es/icons/icon-pa.js +17449 -0
- package/es/index.css +22 -8
- package/es/index.d.ts +18 -1
- package/es/index.js +63 -2
- package/es/input/css.js +2 -0
- package/es/input/draw.d.ts +2 -0
- package/es/input/draw.js +52 -0
- package/es/input/index.css +138 -0
- package/es/input/index.d.ts +50 -0
- package/es/input/index.js +432 -0
- package/es/input/type.d.ts +175 -0
- package/es/input-group/css.js +2 -0
- package/es/input-group/index.css +24 -0
- package/es/input-group/index.d.ts +17 -0
- package/es/input-group/index.js +40 -0
- package/es/input-group/type.d.ts +30 -0
- package/es/input-group-label/css.js +2 -0
- package/es/input-group-label/draw.d.ts +2 -0
- package/es/input-group-label/draw.js +52 -0
- package/es/input-group-label/index.css +50 -0
- package/es/input-group-label/index.d.ts +16 -0
- package/es/input-group-label/index.js +129 -0
- package/es/input-group-label/type.d.ts +30 -0
- package/es/input-number/css.js +2 -0
- package/es/input-number/draw.d.ts +2 -0
- package/es/input-number/draw.js +52 -0
- package/es/input-number/index.css +161 -0
- package/es/input-number/index.d.ts +47 -0
- package/es/input-number/index.js +543 -0
- package/es/input-number/type.d.ts +183 -0
- package/es/input-tag/css.js +2 -0
- package/es/input-tag/draw.d.ts +2 -0
- package/es/input-tag/draw.js +49 -0
- package/es/input-tag/index.css +133 -0
- package/es/input-tag/index.d.ts +73 -0
- package/es/input-tag/index.js +474 -0
- package/es/input-tag/type.d.ts +212 -0
- package/es/link/css.js +1 -1
- package/es/link/index.css +2 -5
- package/es/link/index.js +10 -6
- package/es/main/css.js +1 -1
- package/es/mask/css.js +2 -0
- package/es/mask/index.css +17 -0
- package/es/mask/index.d.ts +8 -0
- package/es/mask/index.js +117 -0
- package/es/mask/type.d.ts +27 -0
- package/es/message/css.js +1 -1
- package/es/message/index.css +26 -26
- package/es/message/index.d.ts +1 -1
- package/es/message/index.js +22 -50
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +40 -30
- package/es/message-box/message-box-wrapped.d.ts +0 -1
- package/es/message-box/message-box-wrapped.js +2 -2
- package/es/message-box/message-box.d.ts +2 -1
- package/es/message-box/message-box.js +10 -8
- package/es/message-box/type.d.ts +14 -4
- package/es/option-list/css.js +2 -0
- package/es/option-list/index.css +57 -0
- package/es/option-list/index.d.ts +38 -0
- package/es/option-list/index.js +169 -0
- package/es/option-list/type.d.ts +16 -0
- package/es/popover/css.js +1 -0
- package/es/popover/index.d.ts +203 -0
- package/es/popover/index.js +240 -0
- package/es/popover/type.d.ts +100 -0
- package/es/popup-content/css.js +2 -0
- package/es/popup-content/draw.d.ts +6 -0
- package/es/popup-content/draw.js +151 -0
- package/es/popup-content/index.css +99 -0
- package/es/popup-content/index.d.ts +30 -0
- package/es/popup-content/index.js +1578 -0
- package/es/popup-content/type.d.ts +20 -0
- package/es/popup-trigger/css.js +1 -0
- package/es/popup-trigger/index.d.ts +22 -0
- package/es/popup-trigger/index.js +97 -0
- package/es/popup-trigger/type.d.ts +9 -0
- package/es/row/css.js +1 -1
- package/es/select/css.js +2 -0
- package/es/select/draw.d.ts +2 -0
- package/es/select/draw.js +52 -0
- package/es/select/index.css +152 -0
- package/es/select/index.d.ts +44 -0
- package/es/select/index.js +674 -0
- package/es/select/type.d.ts +252 -0
- package/es/share/const/event-bus-key.d.ts +4 -0
- package/es/share/const/event-bus-key.js +10 -0
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +11 -2
- package/es/share/const/provide-key.d.ts +3 -0
- package/es/share/const/provide-key.js +8 -0
- package/es/share/hook/use-click-outside-listener.d.ts +4 -0
- package/es/share/hook/use-click-outside-listener.js +44 -0
- package/es/share/hook/use-composition.d.ts +5 -0
- package/es/share/hook/use-composition.js +17 -0
- package/es/share/hook/use-controlled-mode.d.ts +6 -0
- package/es/share/hook/use-controlled-mode.js +25 -0
- package/es/share/hook/use-dark-mode.js +11 -3
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +25 -35
- package/es/share/hook/use-resize-observer.js +1 -1
- package/es/share/hook/use-textarea-height.d.ts +5 -0
- package/es/share/hook/use-textarea-height.js +116 -0
- package/es/share/hook/use-watch-global-css-var.d.ts +1 -0
- package/es/share/hook/use-watch-global-css-var.js +19 -0
- package/es/share/hook/use-z-index.d.ts +6 -0
- package/es/share/hook/use-z-index.js +32 -0
- package/es/share/type/index.d.ts +9 -1
- package/es/share/util/color.js +4 -2
- package/es/share/util/common.d.ts +5 -0
- package/es/share/util/common.js +71 -0
- package/es/share/util/event-bus.d.ts +1 -0
- package/es/share/util/event-bus.js +20 -0
- package/es/share/util/plot.d.ts +15 -2
- package/es/share/util/plot.js +200 -30
- package/es/share/util/render.d.ts +1 -0
- package/es/share/util/render.js +10 -2
- package/es/share/util/theme.js +23 -4
- package/es/space/css.js +1 -1
- package/es/space/index.css +5 -0
- package/es/space/index.js +2 -2
- package/es/spin/css.js +2 -0
- package/es/spin/index.css +66 -0
- package/es/spin/index.d.ts +24 -0
- package/es/spin/index.js +104 -0
- package/es/spin/type.d.ts +54 -0
- package/es/tag/css.js +2 -0
- package/es/tag/draw.d.ts +6 -0
- package/es/tag/draw.js +135 -0
- package/es/tag/index.css +372 -0
- package/es/tag/index.d.ts +23 -0
- package/es/tag/index.js +193 -0
- package/es/tag/type.d.ts +58 -0
- package/es/textarea/css.js +2 -0
- package/es/textarea/draw.d.ts +2 -0
- package/es/textarea/draw.js +13 -0
- package/es/textarea/index.css +108 -0
- package/es/textarea/index.d.ts +49 -0
- package/es/textarea/index.js +267 -0
- package/es/textarea/type.d.ts +169 -0
- package/es/tooltip/css.js +1 -0
- package/es/tooltip/index.d.ts +20 -0
- package/es/tooltip/index.js +228 -0
- package/es/tooltip/type.d.ts +77 -0
- package/package.json +17 -3
- package/es/icons/{css.js → css-hn.js} +1 -1
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import type { NumberOrPercentage } from '../share/type';
|
|
2
|
+
import type { GroupOption, Option } from '../share/type';
|
|
3
|
+
import type { TagProps } from '../tag/type';
|
|
4
|
+
export interface SelectOption extends Option<string> {
|
|
5
|
+
value: any;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectGroupOption extends GroupOption {
|
|
9
|
+
label: string;
|
|
10
|
+
key: string | number | symbol;
|
|
11
|
+
children: (SelectOption | string)[];
|
|
12
|
+
}
|
|
13
|
+
export type SelectProps = {
|
|
14
|
+
/**
|
|
15
|
+
* @property {any} [modelValue]
|
|
16
|
+
* @version 0.0.2
|
|
17
|
+
*/
|
|
18
|
+
modelValue?: any;
|
|
19
|
+
/**
|
|
20
|
+
* @property {any} [defaultValue]
|
|
21
|
+
* @version 0.0.2
|
|
22
|
+
*/
|
|
23
|
+
defaultValue?: any;
|
|
24
|
+
/**
|
|
25
|
+
* @property {string} [options]
|
|
26
|
+
* @version 0.0.2
|
|
27
|
+
*/
|
|
28
|
+
options?: (string | SelectOption | SelectGroupOption)[];
|
|
29
|
+
/**
|
|
30
|
+
* @property {string} [placeholder]
|
|
31
|
+
* @version 0.0.2
|
|
32
|
+
*/
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @property {boolean} [disabled=false]
|
|
36
|
+
* @version 0.0.2
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @property {boolean} [readonly=false]
|
|
41
|
+
* @version 0.0.2
|
|
42
|
+
*/
|
|
43
|
+
readonly?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @property {boolean} [clearable=false]
|
|
46
|
+
* @version 0.0.2
|
|
47
|
+
*/
|
|
48
|
+
clearable?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* @property {boolean} [multiple=false]
|
|
51
|
+
* @version 0.0.2
|
|
52
|
+
*/
|
|
53
|
+
multiple?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* @property {boolean} [loading=false]
|
|
56
|
+
* @version 0.0.2
|
|
57
|
+
*/
|
|
58
|
+
loading?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @property {string | null} [inputValue]
|
|
61
|
+
* @version 0.0.2
|
|
62
|
+
*/
|
|
63
|
+
inputValue?: string | null;
|
|
64
|
+
/**
|
|
65
|
+
* @property {string | null} [defaultInputValue]
|
|
66
|
+
* @version 0.0.2
|
|
67
|
+
*/
|
|
68
|
+
defaultInputValue?: string | null;
|
|
69
|
+
/**
|
|
70
|
+
* @property {boolean} [filterable=false]
|
|
71
|
+
* @version 0.0.2
|
|
72
|
+
*/
|
|
73
|
+
filterable?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @property {(value: string, optionsFiltered: (string | SelectOption | SelectGroupOption)[]) => boolean} [shouldShowPopover]
|
|
76
|
+
* @version 0.0.2
|
|
77
|
+
*/
|
|
78
|
+
shouldShowPopover?: (value: string, optionsFiltered: (string | SelectOption | SelectGroupOption)[]) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* @property {(keyword: string, options: (string | SelectOption | SelectGroupOption)[]) => (string | SelectOption | SelectGroupOption)[]} [filter]
|
|
81
|
+
* @version 0.0.2
|
|
82
|
+
*/
|
|
83
|
+
filter?: (keyword: string, options: (string | SelectOption | SelectGroupOption)[]) => (string | SelectOption | SelectGroupOption)[];
|
|
84
|
+
/**
|
|
85
|
+
* @property {boolean} [creatable=false]
|
|
86
|
+
* @version 0.0.2
|
|
87
|
+
*/
|
|
88
|
+
creatable?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @property {boolean} [collapseTags=false]
|
|
91
|
+
* @version 0.0.2
|
|
92
|
+
*/
|
|
93
|
+
collapseTags?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* @property {number} [collapseTags]
|
|
96
|
+
* @version 0.0.2
|
|
97
|
+
*/
|
|
98
|
+
maxDisplayTags?: number;
|
|
99
|
+
/**
|
|
100
|
+
* @property {boolean} [collapseTagsPopover=true]
|
|
101
|
+
* @version 0.0.2
|
|
102
|
+
*/
|
|
103
|
+
collapseTagsPopover?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* @property {'primary' | 'sakura' | 'success' | 'warning' | 'danger' | 'info'} [tagTheme='info']
|
|
106
|
+
* @version 0.0.2
|
|
107
|
+
*/
|
|
108
|
+
tagTheme?: TagProps['theme'];
|
|
109
|
+
/**
|
|
110
|
+
* @property {'primary' | 'plain' | 'outline'} [tagVariant='plain']
|
|
111
|
+
* @version 0.0.2
|
|
112
|
+
*/
|
|
113
|
+
tagVariant?: TagProps['variant'];
|
|
114
|
+
/**
|
|
115
|
+
* @property {string} [tagColor]
|
|
116
|
+
* @version 0.0.2
|
|
117
|
+
*/
|
|
118
|
+
tagColor?: TagProps['color'];
|
|
119
|
+
/**
|
|
120
|
+
* @property {'medium' | 'large' | 'small'} [size='medium']
|
|
121
|
+
* @version 0.0.2
|
|
122
|
+
*/
|
|
123
|
+
size?: 'medium' | 'large' | 'small';
|
|
124
|
+
/**
|
|
125
|
+
* @property {'default' | 'round'} [shape='default']
|
|
126
|
+
* @version 0.0.2
|
|
127
|
+
*/
|
|
128
|
+
shape?: 'default' | 'round';
|
|
129
|
+
/**
|
|
130
|
+
* @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
|
|
131
|
+
* @version 0.0.2
|
|
132
|
+
*/
|
|
133
|
+
borderRadius?: NumberOrPercentage | NumberOrPercentage[];
|
|
134
|
+
/**
|
|
135
|
+
* @property {'success' | 'warning' | 'error' | 'normal'} [status='normal']
|
|
136
|
+
* @version 0.0.2
|
|
137
|
+
*/
|
|
138
|
+
status?: 'success' | 'warning' | 'error' | 'normal';
|
|
139
|
+
};
|
|
140
|
+
export type SelectEvents = {
|
|
141
|
+
/**
|
|
142
|
+
* @event input
|
|
143
|
+
* @param {string} value
|
|
144
|
+
* @param {Event} e
|
|
145
|
+
* @version 0.0.2
|
|
146
|
+
*/
|
|
147
|
+
input: [value: string, e: Event];
|
|
148
|
+
/**
|
|
149
|
+
* @event update:modelValue
|
|
150
|
+
* @param {any} value
|
|
151
|
+
* @version 0.0.2
|
|
152
|
+
*/
|
|
153
|
+
'update:modelValue': [value: any];
|
|
154
|
+
/**
|
|
155
|
+
* @event update:inputValue
|
|
156
|
+
* @param {string} value
|
|
157
|
+
* @version 0.0.2
|
|
158
|
+
*/
|
|
159
|
+
'update:inputValue': [value: string];
|
|
160
|
+
/**
|
|
161
|
+
* @event change
|
|
162
|
+
* @param {any} value
|
|
163
|
+
* @version 0.0.2
|
|
164
|
+
*/
|
|
165
|
+
change: [value: any];
|
|
166
|
+
/**
|
|
167
|
+
* @event change
|
|
168
|
+
* @param {string} value
|
|
169
|
+
* @param {Event | undefined} e
|
|
170
|
+
* @version 0.0.2
|
|
171
|
+
*/
|
|
172
|
+
inputChange: [value: string, e?: Event];
|
|
173
|
+
/**
|
|
174
|
+
* @event clear
|
|
175
|
+
* @param {any} value
|
|
176
|
+
* @version 0.0.2
|
|
177
|
+
*/
|
|
178
|
+
clear: [value: any];
|
|
179
|
+
/**
|
|
180
|
+
* @event blur
|
|
181
|
+
* @version 0.0.2
|
|
182
|
+
*/
|
|
183
|
+
blur: [];
|
|
184
|
+
/**
|
|
185
|
+
* @event focus
|
|
186
|
+
* @version 0.0.2
|
|
187
|
+
*/
|
|
188
|
+
focus: [];
|
|
189
|
+
/**
|
|
190
|
+
* @event select
|
|
191
|
+
* @param {any} value
|
|
192
|
+
* @param {MouseEvent} e
|
|
193
|
+
* @version 0.0.2
|
|
194
|
+
*/
|
|
195
|
+
select: [value: any, option: string | SelectOption, e: MouseEvent];
|
|
196
|
+
/**
|
|
197
|
+
* @event tagClose
|
|
198
|
+
* @param {any} value
|
|
199
|
+
* @param {MouseEvent} e
|
|
200
|
+
* @version 0.0.2
|
|
201
|
+
*/
|
|
202
|
+
tagClose: [value: any, e: MouseEvent];
|
|
203
|
+
};
|
|
204
|
+
export type SelectSlots = {
|
|
205
|
+
/**
|
|
206
|
+
* @slot prefix
|
|
207
|
+
* @version 0.0.2
|
|
208
|
+
*/
|
|
209
|
+
prefix: {};
|
|
210
|
+
/**
|
|
211
|
+
* @slot suffix
|
|
212
|
+
* @version 0.0.2
|
|
213
|
+
*/
|
|
214
|
+
suffix: {};
|
|
215
|
+
/**
|
|
216
|
+
* @slot option
|
|
217
|
+
* @param {string | SelectOption} option
|
|
218
|
+
* @version 0.0.2
|
|
219
|
+
*/
|
|
220
|
+
option: {};
|
|
221
|
+
/**
|
|
222
|
+
* @slot group-label
|
|
223
|
+
* @param {SelectGroupOption} option
|
|
224
|
+
* @version 0.0.2
|
|
225
|
+
*/
|
|
226
|
+
'group-label': {};
|
|
227
|
+
/**
|
|
228
|
+
* @slot tag
|
|
229
|
+
* @param {any} value
|
|
230
|
+
* @param {string} label
|
|
231
|
+
* @param {number} index
|
|
232
|
+
* @version 0.0.2
|
|
233
|
+
*/
|
|
234
|
+
tag: {};
|
|
235
|
+
};
|
|
236
|
+
export type SelectExpose = {
|
|
237
|
+
/**
|
|
238
|
+
* @property {() => void} focus
|
|
239
|
+
* @version 0.0.2
|
|
240
|
+
*/
|
|
241
|
+
focus: () => void;
|
|
242
|
+
/**
|
|
243
|
+
* @property {() => void} blur
|
|
244
|
+
* @version 0.0.2
|
|
245
|
+
*/
|
|
246
|
+
blur: () => void;
|
|
247
|
+
/**
|
|
248
|
+
* @property {() => void} clear
|
|
249
|
+
* @version 0.0.2
|
|
250
|
+
*/
|
|
251
|
+
clear: () => void;
|
|
252
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const BUTTON_GROUP_UPDATE = "px-button-group-update";
|
|
2
|
+
const GRID_UPDATE = "px-grid-update";
|
|
3
|
+
const GLOBAL_CSS_VAR_CHANGE = "px-global-css-var-change";
|
|
4
|
+
const INPUT_GROUP_UPDATE = "px-input-group-update";
|
|
5
|
+
export {
|
|
6
|
+
BUTTON_GROUP_UPDATE as B,
|
|
7
|
+
GRID_UPDATE as G,
|
|
8
|
+
INPUT_GROUP_UPDATE as I,
|
|
9
|
+
GLOBAL_CSS_VAR_CHANGE as a
|
|
10
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { RgbaColor } from '../type';
|
|
2
2
|
export declare const TRANSPARENT_RGBA_COLOR_OBJECT: RgbaColor;
|
|
3
3
|
export declare const MESSAGE_Z_INDEX = 3000;
|
|
4
|
+
export declare const Z_INDEX = 1000;
|
|
5
|
+
export declare const COVER_Z_INDEX = 20;
|
|
4
6
|
export declare enum SCREEN_SIZE_TYPE {
|
|
5
7
|
XS = "xs",
|
|
6
8
|
SM = "sm",
|
|
@@ -9,3 +11,5 @@ export declare enum SCREEN_SIZE_TYPE {
|
|
|
9
11
|
XL = "xl",
|
|
10
12
|
XXL = "xxl"
|
|
11
13
|
}
|
|
14
|
+
export declare const GROUP_OPTION_TYPE = "group";
|
|
15
|
+
export declare const BORDER_CORNER_RAD_RANGE: [number, number][];
|
package/es/share/const/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const TRANSPARENT_RGBA_COLOR_OBJECT = {
|
|
|
4
4
|
b: 0,
|
|
5
5
|
a: 0
|
|
6
6
|
};
|
|
7
|
-
const
|
|
7
|
+
const COVER_Z_INDEX = 20;
|
|
8
8
|
var SCREEN_SIZE_TYPE = /* @__PURE__ */ ((SCREEN_SIZE_TYPE2) => {
|
|
9
9
|
SCREEN_SIZE_TYPE2["XS"] = "xs";
|
|
10
10
|
SCREEN_SIZE_TYPE2["SM"] = "sm";
|
|
@@ -14,8 +14,17 @@ var SCREEN_SIZE_TYPE = /* @__PURE__ */ ((SCREEN_SIZE_TYPE2) => {
|
|
|
14
14
|
SCREEN_SIZE_TYPE2["XXL"] = "xxl";
|
|
15
15
|
return SCREEN_SIZE_TYPE2;
|
|
16
16
|
})(SCREEN_SIZE_TYPE || {});
|
|
17
|
+
const GROUP_OPTION_TYPE = "group";
|
|
18
|
+
const BORDER_CORNER_RAD_RANGE = [
|
|
19
|
+
[Math.PI, Math.PI * 3 / 2],
|
|
20
|
+
[Math.PI * 3 / 2, Math.PI * 2],
|
|
21
|
+
[0, Math.PI / 2],
|
|
22
|
+
[Math.PI / 2, Math.PI]
|
|
23
|
+
];
|
|
17
24
|
export {
|
|
18
|
-
|
|
25
|
+
BORDER_CORNER_RAD_RANGE as B,
|
|
26
|
+
COVER_Z_INDEX as C,
|
|
27
|
+
GROUP_OPTION_TYPE as G,
|
|
19
28
|
SCREEN_SIZE_TYPE as S,
|
|
20
29
|
TRANSPARENT_RGBA_COLOR_OBJECT as T
|
|
21
30
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { $, m } from "../../aside/index.js";
|
|
2
|
+
import { onMounted, onBeforeUnmount } from "vue";
|
|
3
|
+
const check = (target, range) => {
|
|
4
|
+
if (!range) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
return range.contains(target);
|
|
8
|
+
};
|
|
9
|
+
const getEl = (ref) => {
|
|
10
|
+
if (m(ref)) {
|
|
11
|
+
const res = ref();
|
|
12
|
+
return res instanceof HTMLElement ? res : null;
|
|
13
|
+
}
|
|
14
|
+
if (!ref.value) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return ref.value instanceof HTMLElement ? ref.value : ref.value.el && ref.value.el instanceof HTMLElement ? ref.value.el : null;
|
|
18
|
+
};
|
|
19
|
+
const useClickOutsideListener = (ref, callback) => {
|
|
20
|
+
const clickOutsideHandler = (event) => {
|
|
21
|
+
const target = event.target;
|
|
22
|
+
if (!(target instanceof HTMLElement)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if ($(ref) ? ref.length === 0 : m(ref) ? false : !ref.value) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const clickInside = $(ref) ? ref.reduce((pre, cur) => {
|
|
29
|
+
return pre || check(target, getEl(cur));
|
|
30
|
+
}, false) : check(target, getEl(ref));
|
|
31
|
+
if (!clickInside) {
|
|
32
|
+
callback(event);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
document.addEventListener("click", clickOutsideHandler);
|
|
37
|
+
});
|
|
38
|
+
onBeforeUnmount(() => {
|
|
39
|
+
document.removeEventListener("click", clickOutsideHandler);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
useClickOutsideListener as u
|
|
44
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
interface UseCompositionOptions {
|
|
2
|
+
afterComposition: (event: CompositionEvent) => void;
|
|
3
|
+
}
|
|
4
|
+
export declare function useComposition({ afterComposition }: UseCompositionOptions): readonly [import("vue").Ref<boolean, boolean>, (_: CompositionEvent) => void, (event: CompositionEvent) => void];
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ref, nextTick } from "vue";
|
|
2
|
+
function useComposition({ afterComposition }) {
|
|
3
|
+
const isComposing = ref(false);
|
|
4
|
+
const compositionStartHandler = (_) => {
|
|
5
|
+
isComposing.value = true;
|
|
6
|
+
};
|
|
7
|
+
const compositionEndHandler = (event) => {
|
|
8
|
+
if (isComposing.value) {
|
|
9
|
+
isComposing.value = false;
|
|
10
|
+
nextTick(() => afterComposition(event));
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return [isComposing, compositionStartHandler, compositionEndHandler];
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
useComposition as u
|
|
17
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Nullish } from 'parsnip-kit';
|
|
2
|
+
import { type Ref } from 'vue';
|
|
3
|
+
export declare const useControlledMode: <T>(field: string, props: Record<string, any>, emits: Function, options?: {
|
|
4
|
+
transform?: (nextValue: T | Nullish) => T | Nullish;
|
|
5
|
+
defaultField?: string;
|
|
6
|
+
}) => readonly [Ref<Nullish | T, Nullish | T>, (nextValue: T) => Promise<void>, import("vue").ComputedRef<boolean>];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { computed, ref, watch, nextTick } from "vue";
|
|
2
|
+
const useControlledMode = (field, props, emits, options) => {
|
|
3
|
+
const controlledMode = computed(() => props[field] !== void 0);
|
|
4
|
+
const preValue = controlledMode.value ? props[field] : (options == null ? void 0 : options.defaultField) ? props[options.defaultField] : null;
|
|
5
|
+
const innerState = ref((options == null ? void 0 : options.transform) ? options == null ? void 0 : options.transform(preValue) : preValue);
|
|
6
|
+
const updateState = async (nextValue) => {
|
|
7
|
+
if (controlledMode.value) {
|
|
8
|
+
emits(`update:${field}`, nextValue);
|
|
9
|
+
await nextTick();
|
|
10
|
+
innerState.value = (options == null ? void 0 : options.transform) ? options == null ? void 0 : options.transform(props[field]) : props[field];
|
|
11
|
+
} else {
|
|
12
|
+
innerState.value = (options == null ? void 0 : options.transform) ? options == null ? void 0 : options.transform(nextValue) : nextValue;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
watch(
|
|
16
|
+
() => props[field],
|
|
17
|
+
(val) => {
|
|
18
|
+
innerState.value = (options == null ? void 0 : options.transform) ? options == null ? void 0 : options.transform(val) : val;
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
return [innerState, updateState, controlledMode];
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
useControlledMode as u
|
|
25
|
+
};
|
|
@@ -40,14 +40,22 @@ const useDarkMode = () => {
|
|
|
40
40
|
onMounted(() => {
|
|
41
41
|
const observer = observerMap.get(document.documentElement) || new MutationObserver(runCallbacks(document.documentElement));
|
|
42
42
|
observerMap.set(document.documentElement, observer);
|
|
43
|
-
observer.observe(document.documentElement, {
|
|
44
|
-
|
|
43
|
+
observer.observe(document.documentElement, {
|
|
44
|
+
attributes: true,
|
|
45
|
+
attributeFilter: ["class"]
|
|
46
|
+
});
|
|
47
|
+
observerCallbacksMap.set(document.documentElement, [
|
|
48
|
+
...observerCallbacksMap.get(document.documentElement) || [],
|
|
49
|
+
callback
|
|
50
|
+
]);
|
|
45
51
|
callback();
|
|
46
52
|
});
|
|
47
53
|
onBeforeUnmount(() => {
|
|
48
54
|
observerCallbacksMap.set(
|
|
49
55
|
document.documentElement,
|
|
50
|
-
(observerCallbacksMap.get(document.documentElement) || []).filter(
|
|
56
|
+
(observerCallbacksMap.get(document.documentElement) || []).filter(
|
|
57
|
+
(func) => func !== callback
|
|
58
|
+
)
|
|
51
59
|
);
|
|
52
60
|
});
|
|
53
61
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const useIndexOfChildren: () => import("vue").Ref<number, number
|
|
1
|
+
export declare const useIndexOfChildren: (eventBusKey: string) => readonly [import("vue").Ref<number, number>, import("vue").Ref<boolean, boolean>, import("vue").Ref<boolean, boolean>];
|
|
2
|
+
export declare const emitParentUpdate: (eventBusKey: string) => void;
|
|
@@ -1,58 +1,48 @@
|
|
|
1
|
-
import { ref, getCurrentInstance, onMounted,
|
|
1
|
+
import { onUpdated, ref, getCurrentInstance, onMounted, nextTick, onBeforeUnmount } from "vue";
|
|
2
2
|
import { i as inBrowser } from "../util/env.js";
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const runCallbacks = (observed) => {
|
|
6
|
-
return () => {
|
|
7
|
-
const list = observerCallbacksMap.get(observed);
|
|
8
|
-
list == null ? void 0 : list.forEach((func) => func());
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
const useIndexOfChildren = () => {
|
|
3
|
+
import { E as EventBus } from "../util/event-bus.js";
|
|
4
|
+
const useIndexOfChildren = (eventBusKey) => {
|
|
12
5
|
const index = ref(-1);
|
|
6
|
+
const last = ref(false);
|
|
7
|
+
const first = ref(false);
|
|
13
8
|
const instance = getCurrentInstance();
|
|
14
9
|
const callback = () => {
|
|
15
10
|
if (instance && instance.vnode.el instanceof HTMLElement) {
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const arr = [...
|
|
11
|
+
const parent = instance.vnode.el.parentElement;
|
|
12
|
+
if (parent && parent.children.length) {
|
|
13
|
+
const arr = [...parent.children];
|
|
19
14
|
index.value = arr.indexOf(instance.vnode.el);
|
|
15
|
+
last.value = index.value === parent.children.length - 1;
|
|
16
|
+
first.value = index.value === 0;
|
|
17
|
+
} else {
|
|
18
|
+
index.value = -1;
|
|
19
|
+
last.value = false;
|
|
20
|
+
first.value = false;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
|
-
let parent = null;
|
|
24
24
|
if (inBrowser()) {
|
|
25
|
+
EventBus.on(eventBusKey, callback);
|
|
25
26
|
onMounted(() => {
|
|
26
|
-
|
|
27
|
-
var _a;
|
|
28
|
-
parent = ((_a = instance == null ? void 0 : instance.vnode) == null ? void 0 : _a.el) instanceof HTMLElement ? instance.vnode.el.parentElement : null;
|
|
29
|
-
if (parent) {
|
|
30
|
-
const observer = observerMap.get(parent) || new MutationObserver(runCallbacks(parent));
|
|
31
|
-
observerMap.set(parent, observer);
|
|
32
|
-
observerCallbacksMap.set(parent, [...observerCallbacksMap.get(parent) || [], callback]);
|
|
33
|
-
observer.observe(parent, { childList: true });
|
|
34
|
-
}
|
|
27
|
+
nextTick(() => {
|
|
35
28
|
callback();
|
|
36
29
|
});
|
|
37
30
|
});
|
|
38
31
|
onUpdated(() => {
|
|
39
|
-
|
|
40
|
-
callback();
|
|
41
|
-
});
|
|
32
|
+
callback();
|
|
42
33
|
});
|
|
43
34
|
onBeforeUnmount(() => {
|
|
44
|
-
|
|
45
|
-
if (parent) {
|
|
46
|
-
(_a = observerMap.get(parent)) == null ? void 0 : _a.disconnect();
|
|
47
|
-
observerCallbacksMap.set(
|
|
48
|
-
parent,
|
|
49
|
-
(observerCallbacksMap.get(parent) || []).filter((func) => func !== callback)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
35
|
+
EventBus.off(eventBusKey, callback);
|
|
52
36
|
});
|
|
53
37
|
}
|
|
54
|
-
return index;
|
|
38
|
+
return [index, first, last];
|
|
39
|
+
};
|
|
40
|
+
const emitParentUpdate = (eventBusKey) => {
|
|
41
|
+
onUpdated(() => {
|
|
42
|
+
EventBus.emit(eventBusKey);
|
|
43
|
+
});
|
|
55
44
|
};
|
|
56
45
|
export {
|
|
46
|
+
emitParentUpdate as e,
|
|
57
47
|
useIndexOfChildren as u
|
|
58
48
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
export declare const useTextareaHeight: (textareaRef: Ref<null | HTMLTextAreaElement>, props: {
|
|
3
|
+
minRows?: number;
|
|
4
|
+
maxRows?: number;
|
|
5
|
+
}) => readonly [Ref<number | undefined, number | undefined>, Ref<number | undefined, number | undefined>, Ref<number | undefined, number | undefined>, () => void];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { C as Cn } from "../../aside/index.js";
|
|
2
|
+
import { c as clamp } from "../util/common.js";
|
|
3
|
+
import { ref, onBeforeUnmount } from "vue";
|
|
4
|
+
import { u as useResizeObserver } from "./use-resize-observer.js";
|
|
5
|
+
import { i as inBrowser } from "../util/env.js";
|
|
6
|
+
let hiddenTextarea = null;
|
|
7
|
+
const HIDDEN_STYLE = `
|
|
8
|
+
position:absolute!important;
|
|
9
|
+
top:-9999px!important;
|
|
10
|
+
left:-9999px!important;
|
|
11
|
+
overflow:hidden!important;
|
|
12
|
+
opacity:0!important;
|
|
13
|
+
pointer-events:none!important;
|
|
14
|
+
width:{width}px!important;
|
|
15
|
+
min-height:0!important;
|
|
16
|
+
height:0!important;
|
|
17
|
+
z-index:-9999!important;
|
|
18
|
+
`;
|
|
19
|
+
const SIZING_STYLE = [
|
|
20
|
+
"letter-spacing",
|
|
21
|
+
"line-height",
|
|
22
|
+
"padding-top",
|
|
23
|
+
"padding-bottom",
|
|
24
|
+
"font-family",
|
|
25
|
+
"font-weight",
|
|
26
|
+
"font-size",
|
|
27
|
+
"font-variant",
|
|
28
|
+
"text-rendering",
|
|
29
|
+
"text-transform",
|
|
30
|
+
"width",
|
|
31
|
+
"padding-left",
|
|
32
|
+
"padding-right",
|
|
33
|
+
"border-width",
|
|
34
|
+
"box-sizing"
|
|
35
|
+
];
|
|
36
|
+
function calculateNodeStyling(target) {
|
|
37
|
+
const style = window.getComputedStyle(target);
|
|
38
|
+
const boxSizing = style.getPropertyValue("box-sizing");
|
|
39
|
+
const paddingSize = parseFloat(style.getPropertyValue("padding-top")) + parseFloat(style.getPropertyValue("padding-bottom"));
|
|
40
|
+
const borderSize = parseFloat(style.getPropertyValue("border-top-width")) + parseFloat(style.getPropertyValue("border-bottom-width"));
|
|
41
|
+
const sizingStyle = SIZING_STYLE.map(
|
|
42
|
+
(name) => `${name}:${style.getPropertyValue(name)}`
|
|
43
|
+
).join(";");
|
|
44
|
+
return { sizingStyle, paddingSize, borderSize, boxSizing };
|
|
45
|
+
}
|
|
46
|
+
function getHeight(node, minRows = 1, maxRows = Infinity) {
|
|
47
|
+
if (!hiddenTextarea) {
|
|
48
|
+
hiddenTextarea = document.createElement("textarea");
|
|
49
|
+
document.body.appendChild(hiddenTextarea);
|
|
50
|
+
}
|
|
51
|
+
const { sizingStyle, paddingSize, borderSize, boxSizing } = calculateNodeStyling(node);
|
|
52
|
+
const nodeWidth = node.getBoundingClientRect().width;
|
|
53
|
+
hiddenTextarea.setAttribute(
|
|
54
|
+
"style",
|
|
55
|
+
`${sizingStyle};${Cn(HIDDEN_STYLE, (pattern) => pattern === "width" ? String(nodeWidth) : "")}`
|
|
56
|
+
);
|
|
57
|
+
hiddenTextarea.value = "";
|
|
58
|
+
let singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
|
59
|
+
const minHeight = singleRowHeight * minRows + (boxSizing === "border-box" ? paddingSize + borderSize : 0);
|
|
60
|
+
const maxHeight = singleRowHeight * maxRows + (boxSizing === "border-box" ? paddingSize + borderSize : 0);
|
|
61
|
+
hiddenTextarea.value = node.value || node.placeholder || "";
|
|
62
|
+
let height = hiddenTextarea.scrollHeight;
|
|
63
|
+
height += +(boxSizing === "border-box") * borderSize;
|
|
64
|
+
height = clamp(height, minHeight, maxHeight);
|
|
65
|
+
return {
|
|
66
|
+
height,
|
|
67
|
+
minHeight,
|
|
68
|
+
maxHeight
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
let textareaMounted = 0;
|
|
72
|
+
function calcTextareaHeight(textarea, minRows, maxRows) {
|
|
73
|
+
const height = getHeight(textarea, minRows, maxRows);
|
|
74
|
+
return height;
|
|
75
|
+
}
|
|
76
|
+
function destroyHiddenTextarea() {
|
|
77
|
+
textareaMounted--;
|
|
78
|
+
if (hiddenTextarea && textareaMounted <= 0) {
|
|
79
|
+
hiddenTextarea.remove();
|
|
80
|
+
hiddenTextarea = null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function recordTextareaMounted() {
|
|
84
|
+
textareaMounted++;
|
|
85
|
+
}
|
|
86
|
+
const useTextareaHeight = (textareaRef, props) => {
|
|
87
|
+
const height = ref(void 0);
|
|
88
|
+
const minHeight = ref(void 0);
|
|
89
|
+
const maxHeight = ref(void 0);
|
|
90
|
+
const callback = () => {
|
|
91
|
+
if (!inBrowser()) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (textareaRef.value) {
|
|
95
|
+
const data = calcTextareaHeight(
|
|
96
|
+
textareaRef.value,
|
|
97
|
+
props.minRows || 1,
|
|
98
|
+
props.maxRows || Infinity
|
|
99
|
+
);
|
|
100
|
+
height.value = data.height;
|
|
101
|
+
maxHeight.value = data.maxHeight;
|
|
102
|
+
minHeight.value = data.minHeight;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
if (inBrowser()) {
|
|
106
|
+
recordTextareaMounted();
|
|
107
|
+
useResizeObserver(textareaRef, callback, true);
|
|
108
|
+
onBeforeUnmount(() => {
|
|
109
|
+
destroyHiddenTextarea();
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return [height, minHeight, maxHeight, callback];
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
useTextareaHeight as u
|
|
116
|
+
};
|