@ljweb/layout-antdv-v4 0.1.0-beta.0 → 0.1.0-beta.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 +7 -11
- package/dist/style.css +169 -83
- package/esm/assets/style.css +169 -83
- package/esm/components/color-input/ColorInput.js +110 -41
- package/esm/components/color-input/ColorInput.js.map +1 -1
- package/esm/components/color-input/helpers.js +2 -3
- package/esm/components/color-input/helpers.js.map +1 -1
- package/esm/components/ext-table/ExtTable.vue.js +1 -1
- package/esm/components/ext-table/ExtTable2.vue.js +55 -31
- package/esm/components/ext-table/ExtTable2.vue.js.map +1 -1
- package/esm/components/index.js +36 -38
- package/esm/components/index.js.map +1 -1
- package/esm/index.js +36 -38
- package/esm/index.js.map +1 -1
- package/lib/assets/style.css +169 -83
- package/lib/components/color-input/ColorInput.js +110 -39
- package/lib/components/color-input/ColorInput.js.map +1 -1
- package/lib/components/color-input/helpers.js +2 -3
- package/lib/components/color-input/helpers.js.map +1 -1
- package/lib/components/ext-table/ExtTable.vue.js +1 -1
- package/lib/components/ext-table/ExtTable2.vue.js +55 -31
- package/lib/components/ext-table/ExtTable2.vue.js.map +1 -1
- package/lib/components/index.js +0 -2
- package/lib/components/index.js.map +1 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +1 -1
- package/package.json +1 -6
- package/src/components/color-input/style.less +48 -0
- package/types/components/color-input/ColorInput.d.ts +10 -0
- package/types/components/color-input/helpers.d.ts +8 -2
- package/types/components/config-provider/ConfigProvider.d.ts +1 -1
- package/types/components/ext-table/ExtTable.vue.d.ts +6 -6
- package/types/components/ext-table/types.d.ts +5 -1
- package/types/components/index.d.ts +0 -1
- package/types/components/locale-dropdown/LocaleDropdown.d.ts +1 -1
- package/esm/components/async-table/AsyncTable.js +0 -290
- package/esm/components/async-table/AsyncTable.js.map +0 -1
- package/esm/components/async-table/helpers.js +0 -71
- package/esm/components/async-table/helpers.js.map +0 -1
- package/esm/components/async-table/index.js +0 -6
- package/esm/components/async-table/index.js.map +0 -1
- package/esm/components/async-table/style.js +0 -2
- package/esm/components/async-table/style.js.map +0 -1
- package/esm/components/async-table/types.js +0 -2
- package/esm/components/async-table/types.js.map +0 -1
- package/lib/components/async-table/AsyncTable.js +0 -290
- package/lib/components/async-table/AsyncTable.js.map +0 -1
- package/lib/components/async-table/helpers.js +0 -71
- package/lib/components/async-table/helpers.js.map +0 -1
- package/lib/components/async-table/index.js +0 -6
- package/lib/components/async-table/index.js.map +0 -1
- package/lib/components/async-table/style.js +0 -3
- package/lib/components/async-table/style.js.map +0 -1
- package/lib/components/async-table/types.js +0 -2
- package/lib/components/async-table/types.js.map +0 -1
- package/types/components/async-table/AsyncTable.d.ts +0 -413
- package/types/components/async-table/helpers.d.ts +0 -18
- package/types/components/async-table/index.d.ts +0 -2
- package/types/components/async-table/style.d.ts +0 -1
- package/types/components/async-table/types.d.ts +0 -50
package/esm/index.js
CHANGED
|
@@ -9,26 +9,25 @@ import { default as default5 } from "./components/ext-table/Operations.vue.js";
|
|
|
9
9
|
import { default as default6 } from "./components/ext-table/ColumnSetting.vue.js";
|
|
10
10
|
import { defineExtTableColumn, defineExtTableQuery, withDefaultPagination } from "./components/ext-table/helpers.js";
|
|
11
11
|
import { useColumnSetting } from "./components/ext-table/useColumnSetting.js";
|
|
12
|
-
import { default as default7 } from "./components/
|
|
13
|
-
import { default as default8 } from "./components/
|
|
14
|
-
import { default as default9 } from "./components/
|
|
15
|
-
import { default as default10 } from "./components/
|
|
16
|
-
import { default as default11 } from "./components/ext-upload/ExtUpload.vue.js";
|
|
12
|
+
import { default as default7 } from "./components/color-input/ColorInput.js";
|
|
13
|
+
import { default as default8 } from "./components/config-provider/ConfigProvider.js";
|
|
14
|
+
import { default as default9 } from "./components/scrollbar-table/ScrollbarTable.vue.js";
|
|
15
|
+
import { default as default10 } from "./components/ext-upload/ExtUpload.vue.js";
|
|
17
16
|
import { detectFileTypeByExtension, generateFileList, getThumbnailByFileType } from "./components/ext-upload/helpers.js";
|
|
18
17
|
import { FILE_TYPE } from "./components/ext-upload/types.js";
|
|
19
|
-
import { default as
|
|
20
|
-
import { default as
|
|
21
|
-
import { default as
|
|
22
|
-
import { default as
|
|
23
|
-
import { default as
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
18
|
+
import { default as default11 } from "./components/format-value/CustomerLevel.vue.js";
|
|
19
|
+
import { default as default12 } from "./components/format-value/Date.vue.js";
|
|
20
|
+
import { default as default13 } from "./components/format-value/Gender.vue.js";
|
|
21
|
+
import { default as default14 } from "./components/format-value/LongString.vue.js";
|
|
22
|
+
import { default as default15 } from "./components/format-value/Period.vue.js";
|
|
23
|
+
import { default as default16 } from "./components/json-editor/JsonEditor.js";
|
|
24
|
+
import { default as default17 } from "./components/ext-button/ExtButton.vue.js";
|
|
26
25
|
import { EXT_COLORS, EXT_COLOR_ALIASES, isExtColorInput, resolveColorKey, resolveColorValue } from "./components/ext-button/color-map.js";
|
|
27
|
-
import { default as
|
|
28
|
-
import { default as
|
|
29
|
-
import { default as
|
|
26
|
+
import { default as default18 } from "./components/variable-input/VariableInput.vue.js";
|
|
27
|
+
import { default as default19 } from "./components/apple-window/AppleWindow.js";
|
|
28
|
+
import { default as default20 } from "./components/apple-window/AppleWindowHolder.js";
|
|
30
29
|
import { appleWindow } from "./components/apple-window/command.js";
|
|
31
|
-
import { default as
|
|
30
|
+
import { default as default21 } from "./components/splitter-pane/SplitterPane.vue.js";
|
|
32
31
|
import { ContentWidth, DeviceType, LayoutType, Theme } from "./types.js";
|
|
33
32
|
import { LayoutI18nKey, provideLayoutI18n, useI18n } from "./context/i18n.js";
|
|
34
33
|
import { useEffect } from "./context/useEffect.js";
|
|
@@ -43,23 +42,22 @@ import { createBreadcrumbList, createFlatMenus, createMenuKeyMap, createMenuPath
|
|
|
43
42
|
import { useLayoutMixin } from "./components/mixins/layout.js";
|
|
44
43
|
import { useConfigProvider } from "./shared/useConfigProvider.js";
|
|
45
44
|
import { expose } from "./shared/expose.js";
|
|
46
|
-
import { default as
|
|
47
|
-
import { default as
|
|
45
|
+
import { default as default22, AvatarDropdownAction } from "./components/avatar-dropdown/AvatarDropdown.js";
|
|
46
|
+
import { default as default23 } from "./components/breadcrumb/Breadcrumb.js";
|
|
48
47
|
import { BreadcrumbContainer, BreadcrumbProvider } from "./components/layout-admin/BreadcrumbContainer.js";
|
|
49
|
-
import { default as
|
|
48
|
+
import { default as default24 } from "./components/locale-dropdown/LocaleDropdown.js";
|
|
50
49
|
import { closeAll, closeOthers, closeRight, closeTab, createMultiTabSource, getMultiTabRouteKey, multiTabRoutes, refreshTab, seedTabs, setActiveTab, syncActiveTab, unseedTab } from "./components/layout-admin/multi-tab.js";
|
|
51
50
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
default23 as AvatarDropdown,
|
|
51
|
+
default19 as AppleWindow,
|
|
52
|
+
default20 as AppleWindowHolder,
|
|
53
|
+
default22 as AvatarDropdown,
|
|
56
54
|
AvatarDropdownAction,
|
|
57
|
-
|
|
55
|
+
default23 as Breadcrumb,
|
|
58
56
|
BreadcrumbContainer,
|
|
59
57
|
BreadcrumbProvider,
|
|
60
|
-
|
|
58
|
+
default7 as ColorInput,
|
|
61
59
|
default6 as ColumnSetting,
|
|
62
|
-
|
|
60
|
+
default8 as ConfigProvider,
|
|
63
61
|
ContentWidth,
|
|
64
62
|
DEFAULT_CUSTOMER_LEVEL_MAPPING,
|
|
65
63
|
DEFAULT_FILE_TYPE_MAPPING,
|
|
@@ -67,30 +65,30 @@ export {
|
|
|
67
65
|
DeviceType,
|
|
68
66
|
EXT_COLORS,
|
|
69
67
|
EXT_COLOR_ALIASES,
|
|
70
|
-
|
|
68
|
+
default17 as ExtButton,
|
|
71
69
|
default4 as ExtTable,
|
|
72
|
-
|
|
70
|
+
default10 as ExtUpload,
|
|
73
71
|
FILE_TYPE,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
default11 as FormatValueCustomerLevel,
|
|
73
|
+
default12 as FormatValueDate,
|
|
74
|
+
default13 as FormatValueGender,
|
|
75
|
+
default14 as FormatValueLongString,
|
|
76
|
+
default15 as FormatValuePeriod,
|
|
77
|
+
default16 as JsonEditor,
|
|
80
78
|
LayoutAdmin,
|
|
81
79
|
LayoutI18nKey,
|
|
82
80
|
LayoutType,
|
|
83
|
-
|
|
81
|
+
default24 as LocaleDropdown,
|
|
84
82
|
MULTI_TAB_BRANCH_CACHE_NAME_PREFIX,
|
|
85
83
|
MULTI_TAB_CACHE_NAME_PREFIX,
|
|
86
84
|
MultiTabCacheKey,
|
|
87
85
|
default5 as Operations,
|
|
88
|
-
|
|
86
|
+
default9 as ScrollbarTable,
|
|
89
87
|
default3 as SearchForm,
|
|
90
88
|
default2 as SettingDrawer,
|
|
91
|
-
|
|
89
|
+
default21 as SplitterPane,
|
|
92
90
|
Theme,
|
|
93
|
-
|
|
91
|
+
default18 as VariableInput,
|
|
94
92
|
appleWindow,
|
|
95
93
|
closeAll,
|
|
96
94
|
closeOthers,
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/assets/style.css
CHANGED
|
@@ -136,6 +136,125 @@
|
|
|
136
136
|
inset: 0;
|
|
137
137
|
pointer-events: auto;
|
|
138
138
|
}
|
|
139
|
+
.ant-avatar-dropdown__wrapper, .ops-avatar-dropdown__wrapper, .kbr-avatar-dropdown__wrapper {
|
|
140
|
+
max-width: 100%;
|
|
141
|
+
display: flex;
|
|
142
|
+
}
|
|
143
|
+
.ant-avatar-dropdown-avatar__wrapper, .ops-avatar-dropdown-avatar__wrapper, .kbr-avatar-dropdown-avatar__wrapper {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex: none;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
}
|
|
148
|
+
.ant-avatar-dropdown__avatar, .ops-avatar-dropdown__avatar, .kbr-avatar-dropdown__avatar {
|
|
149
|
+
top: 50%;
|
|
150
|
+
transform: translateY(-50%);
|
|
151
|
+
}
|
|
152
|
+
.ant-avatar-dropdown-name__wrapper, .ops-avatar-dropdown-name__wrapper, .kbr-avatar-dropdown-name__wrapper {
|
|
153
|
+
flex: 1 1 auto;
|
|
154
|
+
min-width: 0;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
padding-left: 8px;
|
|
157
|
+
}
|
|
158
|
+
.ant-avatar-dropdown__name, .ops-avatar-dropdown__name, .kbr-avatar-dropdown__name {
|
|
159
|
+
margin-bottom: 0;
|
|
160
|
+
font-weight: bold;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
text-overflow: ellipsis;
|
|
163
|
+
white-space: nowrap;
|
|
164
|
+
}
|
|
165
|
+
.ant-avatar-dropdown__description, .ops-avatar-dropdown__description, .kbr-avatar-dropdown__description {
|
|
166
|
+
margin-top: 4px;
|
|
167
|
+
overflow: hidden;
|
|
168
|
+
text-overflow: ellipsis;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
}
|
|
171
|
+
.ant-avatar-dropdown-overlay .ant-popover-inner, .ops-avatar-dropdown-overlay .ops-popover-inner, .kbr-avatar-dropdown-overlay .kbr-popover-inner {
|
|
172
|
+
padding: 0 !important;
|
|
173
|
+
}
|
|
174
|
+
.ant-avatar-dropdown-overlay__menu, .ops-avatar-dropdown-overlay__menu, .kbr-avatar-dropdown-overlay__menu {
|
|
175
|
+
border-right: none !important;
|
|
176
|
+
}
|
|
177
|
+
.ant-avatar-dropdown-overlay__menu .ant-menu-item, .ops-avatar-dropdown-overlay__menu .ops-menu-item, .kbr-avatar-dropdown-overlay__menu .kbr-menu-item {
|
|
178
|
+
min-width: 120px;
|
|
179
|
+
}
|
|
180
|
+
.ant-avatar-dropdown-overlay__menu .ant-menu-item .anticon, .ops-avatar-dropdown-overlay__menu .ops-menu-item .anticon, .kbr-avatar-dropdown-overlay__menu .kbr-menu-item .anticon {
|
|
181
|
+
margin-right: 5px;
|
|
182
|
+
}
|
|
183
|
+
.ant-color-input-color-tips, .ops-color-input-color-tips, .kbr-color-input-color-tips {
|
|
184
|
+
width: 20px;
|
|
185
|
+
height: 20px;
|
|
186
|
+
padding: 0;
|
|
187
|
+
border: 1px solid #d9d9d9;
|
|
188
|
+
border-radius: 4px;
|
|
189
|
+
cursor: pointer;
|
|
190
|
+
}
|
|
191
|
+
.ant-color-input-picker, .ops-color-input-picker, .kbr-color-input-picker {
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
gap: 8px;
|
|
195
|
+
width: 220px;
|
|
196
|
+
}
|
|
197
|
+
.ant-color-input-palette, .ops-color-input-palette, .kbr-color-input-palette {
|
|
198
|
+
position: relative;
|
|
199
|
+
width: 100%;
|
|
200
|
+
aspect-ratio: 4 / 3;
|
|
201
|
+
border-radius: 4px;
|
|
202
|
+
background-image: linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, transparent);
|
|
203
|
+
cursor: crosshair;
|
|
204
|
+
touch-action: none;
|
|
205
|
+
}
|
|
206
|
+
.ant-color-input-palette-marker, .ops-color-input-palette-marker, .kbr-color-input-palette-marker {
|
|
207
|
+
position: absolute;
|
|
208
|
+
width: 12px;
|
|
209
|
+
height: 12px;
|
|
210
|
+
transform: translate(-50%, -50%);
|
|
211
|
+
border: 2px solid #fff;
|
|
212
|
+
border-radius: 50%;
|
|
213
|
+
box-shadow: 0 0 2px #000;
|
|
214
|
+
pointer-events: none;
|
|
215
|
+
}
|
|
216
|
+
.ant-color-input-hue, .ops-color-input-hue, .kbr-color-input-hue {
|
|
217
|
+
width: 100%;
|
|
218
|
+
height: 12px;
|
|
219
|
+
margin: 0;
|
|
220
|
+
appearance: none;
|
|
221
|
+
border-radius: 4px;
|
|
222
|
+
background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
}
|
|
225
|
+
.ant-color-input-hue::-webkit-slider-thumb, .ops-color-input-hue::-webkit-slider-thumb, .kbr-color-input-hue::-webkit-slider-thumb {
|
|
226
|
+
appearance: none;
|
|
227
|
+
width: 10px;
|
|
228
|
+
height: 14px;
|
|
229
|
+
border: 1px solid #595959;
|
|
230
|
+
border-radius: 3px;
|
|
231
|
+
background: #fff;
|
|
232
|
+
}
|
|
233
|
+
.ant-color-input-hue::-moz-range-thumb, .ops-color-input-hue::-moz-range-thumb, .kbr-color-input-hue::-moz-range-thumb {
|
|
234
|
+
width: 10px;
|
|
235
|
+
height: 14px;
|
|
236
|
+
border: 1px solid #595959;
|
|
237
|
+
border-radius: 3px;
|
|
238
|
+
background: #fff;
|
|
239
|
+
}
|
|
240
|
+
.ant-color-input-alpha, .ops-color-input-alpha, .kbr-color-input-alpha {
|
|
241
|
+
display: flex;
|
|
242
|
+
align-items: center;
|
|
243
|
+
gap: 8px;
|
|
244
|
+
}
|
|
245
|
+
.ant-color-input-presets, .ops-color-input-presets, .kbr-color-input-presets {
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-wrap: wrap;
|
|
248
|
+
gap: 4px;
|
|
249
|
+
}
|
|
250
|
+
.ant-color-input-presets button, .ops-color-input-presets button, .kbr-color-input-presets button {
|
|
251
|
+
width: 20px;
|
|
252
|
+
height: 20px;
|
|
253
|
+
padding: 0;
|
|
254
|
+
border: 1px solid #d9d9d9;
|
|
255
|
+
border-radius: 4px;
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
}
|
|
139
258
|
|
|
140
259
|
.format-value-long-string[data-v-42997ce3] {
|
|
141
260
|
width: var(--width, 220px);
|
|
@@ -298,29 +417,29 @@
|
|
|
298
417
|
flex: 1;
|
|
299
418
|
}
|
|
300
419
|
|
|
301
|
-
.ext-table-toolbar[data-v-
|
|
420
|
+
.ext-table-toolbar[data-v-8476b82b] {
|
|
302
421
|
margin-bottom: 8px;
|
|
303
422
|
}
|
|
304
|
-
.ext-table-toolbar-actions[data-v-
|
|
423
|
+
.ext-table-toolbar-actions[data-v-8476b82b] {
|
|
305
424
|
padding-right: 8px;
|
|
306
425
|
}
|
|
307
|
-
.ext-table-fixed-footer[data-v-
|
|
426
|
+
.ext-table-fixed-footer[data-v-8476b82b] {
|
|
308
427
|
padding: 8px;
|
|
309
428
|
}
|
|
310
|
-
.ext-table-batch-operations[data-v-
|
|
429
|
+
.ext-table-batch-operations[data-v-8476b82b] {
|
|
311
430
|
flex: 1;
|
|
312
431
|
min-width: 0;
|
|
313
432
|
}
|
|
314
|
-
.ext-table-selection-summary[data-v-
|
|
433
|
+
.ext-table-selection-summary[data-v-8476b82b] {
|
|
315
434
|
margin-left: 8px;
|
|
316
435
|
color: var(--lj-layout-text-secondary, #8c8c8c);
|
|
317
436
|
font-size: 14px;
|
|
318
437
|
white-space: nowrap;
|
|
319
438
|
}
|
|
320
|
-
.ext-table-pagination[data-v-
|
|
439
|
+
.ext-table-pagination[data-v-8476b82b] {
|
|
321
440
|
flex-shrink: 0;
|
|
322
441
|
}
|
|
323
|
-
.ext-table-footer[data-v-
|
|
442
|
+
.ext-table-footer[data-v-8476b82b] {
|
|
324
443
|
margin-top: 8px;
|
|
325
444
|
}
|
|
326
445
|
.ant-ext-table, .ops-ext-table, .kbr-ext-table {
|
|
@@ -359,82 +478,6 @@
|
|
|
359
478
|
.ant-dropdown .ant-dropdown-menu .ant-ext-table-operations__menu-item--color:not(.ant-dropdown-menu-item-disabled), .ops-dropdown .ops-dropdown-menu .ops-ext-table-operations__menu-item--color:not(.ops-dropdown-menu-item-disabled), .kbr-dropdown .kbr-dropdown-menu .kbr-ext-table-operations__menu-item--color:not(.kbr-dropdown-menu-item-disabled) {
|
|
360
479
|
color: var(--kbr-ext-table-operation-menu-item-color);
|
|
361
480
|
}
|
|
362
|
-
.ant-avatar-dropdown__wrapper, .ops-avatar-dropdown__wrapper, .kbr-avatar-dropdown__wrapper {
|
|
363
|
-
max-width: 100%;
|
|
364
|
-
display: flex;
|
|
365
|
-
}
|
|
366
|
-
.ant-avatar-dropdown-avatar__wrapper, .ops-avatar-dropdown-avatar__wrapper, .kbr-avatar-dropdown-avatar__wrapper {
|
|
367
|
-
display: flex;
|
|
368
|
-
flex: none;
|
|
369
|
-
cursor: pointer;
|
|
370
|
-
}
|
|
371
|
-
.ant-avatar-dropdown__avatar, .ops-avatar-dropdown__avatar, .kbr-avatar-dropdown__avatar {
|
|
372
|
-
top: 50%;
|
|
373
|
-
transform: translateY(-50%);
|
|
374
|
-
}
|
|
375
|
-
.ant-avatar-dropdown-name__wrapper, .ops-avatar-dropdown-name__wrapper, .kbr-avatar-dropdown-name__wrapper {
|
|
376
|
-
flex: 1 1 auto;
|
|
377
|
-
min-width: 0;
|
|
378
|
-
cursor: pointer;
|
|
379
|
-
padding-left: 8px;
|
|
380
|
-
}
|
|
381
|
-
.ant-avatar-dropdown__name, .ops-avatar-dropdown__name, .kbr-avatar-dropdown__name {
|
|
382
|
-
margin-bottom: 0;
|
|
383
|
-
font-weight: bold;
|
|
384
|
-
overflow: hidden;
|
|
385
|
-
text-overflow: ellipsis;
|
|
386
|
-
white-space: nowrap;
|
|
387
|
-
}
|
|
388
|
-
.ant-avatar-dropdown__description, .ops-avatar-dropdown__description, .kbr-avatar-dropdown__description {
|
|
389
|
-
margin-top: 4px;
|
|
390
|
-
overflow: hidden;
|
|
391
|
-
text-overflow: ellipsis;
|
|
392
|
-
white-space: nowrap;
|
|
393
|
-
}
|
|
394
|
-
.ant-avatar-dropdown-overlay .ant-popover-inner, .ops-avatar-dropdown-overlay .ops-popover-inner, .kbr-avatar-dropdown-overlay .kbr-popover-inner {
|
|
395
|
-
padding: 0 !important;
|
|
396
|
-
}
|
|
397
|
-
.ant-avatar-dropdown-overlay__menu, .ops-avatar-dropdown-overlay__menu, .kbr-avatar-dropdown-overlay__menu {
|
|
398
|
-
border-right: none !important;
|
|
399
|
-
}
|
|
400
|
-
.ant-avatar-dropdown-overlay__menu .ant-menu-item, .ops-avatar-dropdown-overlay__menu .ops-menu-item, .kbr-avatar-dropdown-overlay__menu .kbr-menu-item {
|
|
401
|
-
min-width: 120px;
|
|
402
|
-
}
|
|
403
|
-
.ant-avatar-dropdown-overlay__menu .ant-menu-item .anticon, .ops-avatar-dropdown-overlay__menu .ops-menu-item .anticon, .kbr-avatar-dropdown-overlay__menu .kbr-menu-item .anticon {
|
|
404
|
-
margin-right: 5px;
|
|
405
|
-
}
|
|
406
|
-
.ant-color-input-color-tips, .ops-color-input-color-tips, .kbr-color-input-color-tips {
|
|
407
|
-
width: 20px;
|
|
408
|
-
height: 20px;
|
|
409
|
-
padding: 0;
|
|
410
|
-
border: 1px solid #d9d9d9;
|
|
411
|
-
border-radius: 4px;
|
|
412
|
-
cursor: pointer;
|
|
413
|
-
}
|
|
414
|
-
.ant-color-input-picker, .ops-color-input-picker, .kbr-color-input-picker {
|
|
415
|
-
display: flex;
|
|
416
|
-
flex-direction: column;
|
|
417
|
-
gap: 8px;
|
|
418
|
-
width: 220px;
|
|
419
|
-
}
|
|
420
|
-
.ant-color-input-alpha, .ops-color-input-alpha, .kbr-color-input-alpha {
|
|
421
|
-
display: flex;
|
|
422
|
-
align-items: center;
|
|
423
|
-
gap: 8px;
|
|
424
|
-
}
|
|
425
|
-
.ant-color-input-presets, .ops-color-input-presets, .kbr-color-input-presets {
|
|
426
|
-
display: flex;
|
|
427
|
-
flex-wrap: wrap;
|
|
428
|
-
gap: 4px;
|
|
429
|
-
}
|
|
430
|
-
.ant-color-input-presets button, .ops-color-input-presets button, .kbr-color-input-presets button {
|
|
431
|
-
width: 20px;
|
|
432
|
-
height: 20px;
|
|
433
|
-
padding: 0;
|
|
434
|
-
border: 1px solid #d9d9d9;
|
|
435
|
-
border-radius: 4px;
|
|
436
|
-
cursor: pointer;
|
|
437
|
-
}
|
|
438
481
|
|
|
439
482
|
.ext-upload-tip[data-v-70e8851b] {
|
|
440
483
|
margin-top: 12px;
|
|
@@ -8688,6 +8731,49 @@ a.info--text:focus,
|
|
|
8688
8731
|
gap: 8px;
|
|
8689
8732
|
width: 220px;
|
|
8690
8733
|
}
|
|
8734
|
+
.ant-color-input-palette, .ops-color-input-palette, .kbr-color-input-palette {
|
|
8735
|
+
position: relative;
|
|
8736
|
+
width: 100%;
|
|
8737
|
+
aspect-ratio: 4 / 3;
|
|
8738
|
+
border-radius: 4px;
|
|
8739
|
+
background-image: linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, transparent);
|
|
8740
|
+
cursor: crosshair;
|
|
8741
|
+
touch-action: none;
|
|
8742
|
+
}
|
|
8743
|
+
.ant-color-input-palette-marker, .ops-color-input-palette-marker, .kbr-color-input-palette-marker {
|
|
8744
|
+
position: absolute;
|
|
8745
|
+
width: 12px;
|
|
8746
|
+
height: 12px;
|
|
8747
|
+
transform: translate(-50%, -50%);
|
|
8748
|
+
border: 2px solid #fff;
|
|
8749
|
+
border-radius: 50%;
|
|
8750
|
+
box-shadow: 0 0 2px #000;
|
|
8751
|
+
pointer-events: none;
|
|
8752
|
+
}
|
|
8753
|
+
.ant-color-input-hue, .ops-color-input-hue, .kbr-color-input-hue {
|
|
8754
|
+
width: 100%;
|
|
8755
|
+
height: 12px;
|
|
8756
|
+
margin: 0;
|
|
8757
|
+
appearance: none;
|
|
8758
|
+
border-radius: 4px;
|
|
8759
|
+
background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
|
|
8760
|
+
cursor: pointer;
|
|
8761
|
+
}
|
|
8762
|
+
.ant-color-input-hue::-webkit-slider-thumb, .ops-color-input-hue::-webkit-slider-thumb, .kbr-color-input-hue::-webkit-slider-thumb {
|
|
8763
|
+
appearance: none;
|
|
8764
|
+
width: 10px;
|
|
8765
|
+
height: 14px;
|
|
8766
|
+
border: 1px solid #595959;
|
|
8767
|
+
border-radius: 3px;
|
|
8768
|
+
background: #fff;
|
|
8769
|
+
}
|
|
8770
|
+
.ant-color-input-hue::-moz-range-thumb, .ops-color-input-hue::-moz-range-thumb, .kbr-color-input-hue::-moz-range-thumb {
|
|
8771
|
+
width: 10px;
|
|
8772
|
+
height: 14px;
|
|
8773
|
+
border: 1px solid #595959;
|
|
8774
|
+
border-radius: 3px;
|
|
8775
|
+
background: #fff;
|
|
8776
|
+
}
|
|
8691
8777
|
.ant-color-input-alpha, .ops-color-input-alpha, .kbr-color-input-alpha {
|
|
8692
8778
|
display: flex;
|
|
8693
8779
|
align-items: center;
|
|
@@ -3,12 +3,24 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const antDesignVue = require("ant-design-vue");
|
|
5
5
|
const context = require("ant-design-vue/lib/config-provider/context");
|
|
6
|
+
const DisabledContext = require("ant-design-vue/lib/config-provider/DisabledContext");
|
|
7
|
+
const tinycolor = require("tinycolor2");
|
|
6
8
|
const components_colorInput_helpers = require("./helpers.js");
|
|
9
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
|
+
const tinycolor__default = /* @__PURE__ */ _interopDefault(tinycolor);
|
|
11
|
+
const paletteKeys = {
|
|
12
|
+
ArrowLeft: [-0.01, 0],
|
|
13
|
+
ArrowRight: [0.01, 0],
|
|
14
|
+
ArrowDown: [0, -0.01],
|
|
15
|
+
ArrowUp: [0, 0.01]
|
|
16
|
+
};
|
|
17
|
+
const clampUnit = (value) => Math.max(0, Math.min(1, value));
|
|
7
18
|
const ColorInput = vue.defineComponent({
|
|
8
19
|
name: "ColorInput",
|
|
9
20
|
inheritAttrs: false,
|
|
10
21
|
props: {
|
|
11
22
|
value: String,
|
|
23
|
+
disabled: { type: Boolean, default: void 0 },
|
|
12
24
|
disableAlpha: Boolean,
|
|
13
25
|
disableFields: Boolean,
|
|
14
26
|
presetColors: { type: Array, default: () => [] },
|
|
@@ -21,57 +33,115 @@ const ColorInput = vue.defineComponent({
|
|
|
21
33
|
const container = vue.ref();
|
|
22
34
|
const input = vue.ref();
|
|
23
35
|
const { getPrefixCls } = context.useConfigContextInject();
|
|
36
|
+
const contextDisabled = DisabledContext.useInjectDisabled();
|
|
37
|
+
const disabled = vue.computed(() => props.disabled ?? contextDisabled.value);
|
|
24
38
|
const prefixCls = vue.computed(() => getPrefixCls("color-input", props.prefixCls));
|
|
39
|
+
const hsv = vue.computed(() => tinycolor__default.default(props.value || "#000000").toHsv());
|
|
40
|
+
const hue = vue.shallowRef(hsv.value.h);
|
|
41
|
+
vue.watch(hsv, ({ h: nextHue, s, v }) => {
|
|
42
|
+
if (s && v) hue.value = nextHue;
|
|
43
|
+
});
|
|
25
44
|
const change = (value) => {
|
|
26
45
|
emit("update:value", value);
|
|
27
46
|
emit("change", value);
|
|
28
47
|
};
|
|
29
|
-
const selectColor = (
|
|
30
|
-
|
|
48
|
+
const selectColor = (s, v) => {
|
|
49
|
+
change(components_colorInput_helpers.colorWithAlpha({ h: hue.value, s: clampUnit(s), v: clampUnit(v) }, hsv.value.a, props.disableAlpha));
|
|
50
|
+
};
|
|
51
|
+
const selectFromPointer = (event) => {
|
|
52
|
+
const { left, top, width, height } = event.currentTarget.getBoundingClientRect();
|
|
53
|
+
if (width && height) selectColor((event.clientX - left) / width, 1 - (event.clientY - top) / height);
|
|
54
|
+
};
|
|
31
55
|
expose({ focus: () => input.value?.focus(), blur: () => input.value?.blur() });
|
|
32
|
-
const renderPicker = () =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
const renderPicker = () => {
|
|
57
|
+
const { s, v, a } = hsv.value;
|
|
58
|
+
const pickerPrefix = prefixCls.value;
|
|
59
|
+
return vue.h("div", { class: `${pickerPrefix}-picker` }, [
|
|
60
|
+
vue.h(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
class: `${pickerPrefix}-palette`,
|
|
64
|
+
role: "slider",
|
|
65
|
+
tabindex: disabled.value ? -1 : 0,
|
|
66
|
+
"aria-label": "饱和度和明度",
|
|
67
|
+
"aria-valuemin": 0,
|
|
68
|
+
"aria-valuemax": 100,
|
|
69
|
+
"aria-valuenow": Math.round(s * 100),
|
|
70
|
+
"aria-valuetext": `饱和度 ${Math.round(s * 100)}%,明度 ${Math.round(v * 100)}%`,
|
|
71
|
+
"aria-disabled": disabled.value,
|
|
72
|
+
style: { backgroundColor: `hsl(${hue.value}, 100%, 50%)` },
|
|
73
|
+
onPointerdown: (event) => {
|
|
74
|
+
if (disabled.value || event.button !== 0) return;
|
|
75
|
+
const palette = event.currentTarget;
|
|
76
|
+
palette.setPointerCapture?.(event.pointerId);
|
|
77
|
+
selectFromPointer(event);
|
|
78
|
+
},
|
|
79
|
+
onPointermove: (event) => {
|
|
80
|
+
if (!disabled.value && event.currentTarget.hasPointerCapture?.(event.pointerId)) {
|
|
81
|
+
selectFromPointer(event);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
onKeydown: (event) => {
|
|
85
|
+
const delta = paletteKeys[event.key];
|
|
86
|
+
if (disabled.value || !delta) return;
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
selectColor(s + delta[0], v + delta[1]);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
vue.h("span", {
|
|
92
|
+
class: `${pickerPrefix}-palette-marker`,
|
|
93
|
+
style: { left: `${s * 100}%`, top: `${(1 - v) * 100}%` }
|
|
94
|
+
})
|
|
95
|
+
),
|
|
42
96
|
vue.h("input", {
|
|
97
|
+
class: `${pickerPrefix}-hue`,
|
|
43
98
|
type: "range",
|
|
44
99
|
min: 0,
|
|
45
|
-
max:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
value: components_colorInput_helpers.colorAlpha(props.value),
|
|
100
|
+
max: 359,
|
|
101
|
+
"aria-label": "色相",
|
|
102
|
+
value: Math.round(hue.value) % 360,
|
|
49
103
|
disabled: disabled.value,
|
|
50
|
-
onInput: (event) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
key: color,
|
|
65
|
-
type: "button",
|
|
66
|
-
"aria-label": `选择 ${color}`,
|
|
67
|
-
title: color,
|
|
104
|
+
onInput: (event) => {
|
|
105
|
+
hue.value = event.target.valueAsNumber;
|
|
106
|
+
selectColor(s, v);
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
!props.disableAlpha ? vue.h("label", { class: `${pickerPrefix}-alpha` }, [
|
|
110
|
+
"透明度",
|
|
111
|
+
vue.h("input", {
|
|
112
|
+
type: "range",
|
|
113
|
+
min: 0,
|
|
114
|
+
max: 1,
|
|
115
|
+
step: 0.01,
|
|
116
|
+
"aria-label": "透明度",
|
|
117
|
+
value: a,
|
|
68
118
|
disabled: disabled.value,
|
|
69
|
-
|
|
70
|
-
onClick: () => change(props.disableAlpha ? components_colorInput_helpers.colorWithAlpha(color, 1, true) : color)
|
|
119
|
+
onInput: (event) => change(components_colorInput_helpers.colorWithAlpha(props.value || "#000000", event.target.valueAsNumber))
|
|
71
120
|
})
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
121
|
+
]) : null,
|
|
122
|
+
!props.disableFields ? vue.h("input", {
|
|
123
|
+
"aria-label": "颜色值",
|
|
124
|
+
value: props.value,
|
|
125
|
+
disabled: disabled.value,
|
|
126
|
+
onInput: (event) => change(event.target.value)
|
|
127
|
+
}) : null,
|
|
128
|
+
props.presetColors.length ? vue.h(
|
|
129
|
+
"div",
|
|
130
|
+
{ class: `${pickerPrefix}-presets` },
|
|
131
|
+
props.presetColors.map(
|
|
132
|
+
(color) => vue.h("button", {
|
|
133
|
+
key: color,
|
|
134
|
+
type: "button",
|
|
135
|
+
"aria-label": `选择 ${color}`,
|
|
136
|
+
title: color,
|
|
137
|
+
disabled: disabled.value,
|
|
138
|
+
style: { backgroundColor: color },
|
|
139
|
+
onClick: () => change(props.disableAlpha ? components_colorInput_helpers.colorWithAlpha(color, 1, true) : color)
|
|
140
|
+
})
|
|
141
|
+
)
|
|
142
|
+
) : null
|
|
143
|
+
]);
|
|
144
|
+
};
|
|
75
145
|
return () => vue.h("div", { ref: container, class: prefixCls.value }, [
|
|
76
146
|
vue.h(
|
|
77
147
|
antDesignVue.Input,
|
|
@@ -79,6 +149,7 @@ const ColorInput = vue.defineComponent({
|
|
|
79
149
|
...attrs,
|
|
80
150
|
ref: input,
|
|
81
151
|
value: props.value,
|
|
152
|
+
disabled: disabled.value,
|
|
82
153
|
onChange: (event) => change(event.target.value)
|
|
83
154
|
},
|
|
84
155
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorInput.js","sources":["../../../src/components/color-input/ColorInput.ts"],"sourcesContent":["import { computed, defineComponent, h, ref } from 'vue';\nimport { Input, Popover } from 'ant-design-vue';\nimport { useConfigContextInject } from 'ant-design-vue/es/config-provider/context';\nimport { colorAlpha, colorPickerValue, colorWithAlpha } from './helpers';\nimport type { PropType } from 'vue';\nimport type { PopoverProps } from 'ant-design-vue';\n\nexport interface ColorInputProps {\n value?: string;\n disableAlpha?: boolean;\n disableFields?: boolean;\n presetColors?: string[];\n popupProps?: Partial<PopoverProps>;\n prefixCls?: string;\n /** @deprecated 使用 disableAlpha、disableFields、presetColors 配置色盘。 */\n colorPickerProps?: Record<string, unknown>;\n}\n\nexport default defineComponent({\n name: 'ColorInput',\n inheritAttrs: false,\n props: {\n value: String,\n disableAlpha: Boolean,\n disableFields: Boolean,\n presetColors: { type: Array as PropType<string[]>, default: () => [] },\n popupProps: Object as PropType<Partial<PopoverProps>>,\n colorPickerProps: Object as PropType<Record<string, unknown>>,\n prefixCls: String,\n },\n emits: ['change', 'update:value'],\n setup(props, { attrs, emit, slots, expose }) {\n const container = ref<HTMLElement>();\n const input = ref<any>();\n const { getPrefixCls } = useConfigContextInject();\n const prefixCls = computed(() => getPrefixCls('color-input', props.prefixCls));\n const change = (value: string) => {\n emit('update:value', value);\n emit('change', value);\n };\n const selectColor = (value: string) => change(colorWithAlpha(value, colorAlpha(props.value), props.disableAlpha));\n const disabled = computed(() => !!attrs.disabled);\n expose({ focus: () => input.value?.focus(), blur: () => input.value?.blur() });\n\n const renderPicker = () =>\n h('div', { class: `${prefixCls.value}-picker` }, [\n h('input', {\n type: 'color',\n 'aria-label': '选择颜色',\n value: colorPickerValue(props.value),\n disabled: disabled.value,\n onInput: (event: Event) => selectColor((event.target as HTMLInputElement).value),\n }),\n !props.disableAlpha\n ? h('label', { class: `${prefixCls.value}-alpha` }, [\n '透明度',\n h('input', {\n type: 'range',\n min: 0,\n max: 1,\n step: 0.01,\n 'aria-label': '透明度',\n value: colorAlpha(props.value),\n disabled: disabled.value,\n onInput: (event: Event) =>\n change(colorWithAlpha(props.value || '#000000', Number((event.target as HTMLInputElement).value))),\n }),\n ])\n : null,\n !props.disableFields\n ? h('input', {\n 'aria-label': '颜色值',\n value: props.value,\n disabled: disabled.value,\n onInput: (event: Event) => change((event.target as HTMLInputElement).value),\n })\n : null,\n props.presetColors.length\n ? h(\n 'div',\n { class: `${prefixCls.value}-presets` },\n props.presetColors.map((color) =>\n h('button', {\n key: color,\n type: 'button',\n 'aria-label': `选择 ${color}`,\n title: color,\n disabled: disabled.value,\n style: { backgroundColor: color },\n onClick: () => change(props.disableAlpha ? colorWithAlpha(color, 1, true) : color),\n }),\n ),\n )\n : null,\n ]);\n\n return () =>\n h('div', { ref: container, class: prefixCls.value }, [\n h(\n Input,\n {\n ...attrs,\n ref: input,\n value: props.value,\n onChange: (event: Event) => change((event.target as HTMLInputElement).value),\n },\n {\n ...slots,\n prefix: () =>\n h(\n Popover,\n {\n ...props.popupProps,\n trigger: 'click',\n ...(disabled.value ? { open: false } : {}),\n getPopupContainer: () => container.value || document.body,\n },\n {\n content: renderPicker,\n default: () =>\n h('button', {\n type: 'button',\n class: `${prefixCls.value}-color-tips`,\n 'aria-label': '打开颜色选择器',\n disabled: disabled.value,\n style: { backgroundColor: props.value },\n }),\n },\n ),\n },\n ),\n ]);\n },\n});\n"],"names":["defineComponent","ref","useConfigContextInject","computed","colorWithAlpha","colorAlpha","h","colorPickerValue","Input","Popover"],"mappings":";;;;;;AAkBA,MAAA,aAAeA,oBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,OAAO;AAAA,IACL,OAAO;AAAA,IACP,cAAc;AAAA,IACd,eAAe;AAAA,IACf,cAAc,EAAE,MAAM,OAA6B,SAAS,MAAM,CAAA,EAAC;AAAA,IACnE,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,WAAW;AAAA,EAAA;AAAA,EAEb,OAAO,CAAC,UAAU,cAAc;AAAA,EAChC,MAAM,OAAO,EAAE,OAAO,MAAM,OAAO,UAAU;AAC3C,UAAM,YAAYC,IAAAA,IAAA;AAClB,UAAM,QAAQA,IAAAA,IAAA;AACd,UAAM,EAAE,aAAA,IAAiBC,+BAAA;AACzB,UAAM,YAAYC,IAAAA,SAAS,MAAM,aAAa,eAAe,MAAM,SAAS,CAAC;AAC7E,UAAM,SAAS,CAAC,UAAkB;AAChC,WAAK,gBAAgB,KAAK;AAC1B,WAAK,UAAU,KAAK;AAAA,IACtB;AACA,UAAM,cAAc,CAAC,UAAkB,OAAOC,8BAAAA,eAAe,OAAOC,8BAAAA,WAAW,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC;AAChH,UAAM,WAAWF,IAAAA,SAAS,MAAM,CAAC,CAAC,MAAM,QAAQ;AAChD,WAAO,EAAE,OAAO,MAAM,MAAM,OAAO,SAAS,MAAM,MAAM,MAAM,OAAO,KAAA,GAAQ;AAE7E,UAAM,eAAe,MACnBG,MAAE,OAAO,EAAE,OAAO,GAAG,UAAU,KA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AAI,IAAI,KAAK;AAAA,UAAA,CAClF;AAAA,QAAA;AAAA,MACH,IAEF;AAAA,IAAA,CACL;AAEH,WAAO,MACLE,IAAAA,EAAE,OAAO,EAAE,KAAK,WAAW,OAAO,UAAU,SAAS;AAAA,MACnDA,IAAAA;AAAAA,QACEE,aAAAA;AAAAA,QACA;AAAA,UACE,GAAG;AAAA,UACH,KAAK;AAAA,UACL,OAAO,MAAM;AAAA,UACb,UAAU,CAAC,UAAiB,OAAQ,MAAM,OAA4B,KAAK;AAAA,QAAA;AAAA,QAE7E;AAAA,UACE,GAAG;AAAA,UACH,QAAQ,MACNF,IAAAA;AAAAA,YACEG,aAAAA;AAAAA,YACA;AAAA,cACE,GAAG,MAAM;AAAA,cACT,SAAS;AAAA,cACT,GAAI,SAAS,QAAQ,EAAE,MAAM,MAAA,IAAU,CAAA;AAAA,cACvC,mBAAmB,MAAM,UAAU,SAAS,SAAS;AAAA,YAAA;AAAA,YAEvD;AAAA,cACE,SAAS;AAAA,cACT,SAAS,MACPH,IAAAA,EAAE,UAAU;AAAA,gBACV,MAAM;AAAA,gBACN,OAAO,GAAG,UAAU,KAAK;AAAA,gBACzB,cAAc;AAAA,gBACd,UAAU,SAAS;AAAA,gBACnB,OAAO,EAAE,iBAAiB,MAAM,MAAA;AAAA,cAAM,CACvC;AAAA,YAAA;AAAA,UACL;AAAA,QACF;AAAA,MACJ;AAAA,IACF,CACD;AAAA,EACL;AACF,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"ColorInput.js","sources":["../../../src/components/color-input/ColorInput.ts"],"sourcesContent":["import { computed, defineComponent, h, ref, shallowRef, watch } from 'vue';\nimport { Input, Popover } from 'ant-design-vue';\nimport { useConfigContextInject } from 'ant-design-vue/es/config-provider/context';\nimport { useInjectDisabled } from 'ant-design-vue/es/config-provider/DisabledContext';\nimport tinycolor from 'tinycolor2';\nimport { colorWithAlpha } from './helpers';\nimport type { PropType } from 'vue';\nimport type { PopoverProps } from 'ant-design-vue';\n\nconst paletteKeys: Partial<Record<string, [number, number]>> = {\n ArrowLeft: [-0.01, 0],\n ArrowRight: [0.01, 0],\n ArrowDown: [0, -0.01],\n ArrowUp: [0, 0.01],\n};\n\nconst clampUnit = (value: number) => Math.max(0, Math.min(1, value));\n\nexport interface ColorInputProps {\n value?: string;\n disabled?: boolean;\n disableAlpha?: boolean;\n disableFields?: boolean;\n presetColors?: string[];\n popupProps?: Partial<PopoverProps>;\n prefixCls?: string;\n /** @deprecated 使用 disableAlpha、disableFields、presetColors 配置色盘。 */\n colorPickerProps?: Record<string, unknown>;\n}\n\nexport default defineComponent({\n name: 'ColorInput',\n inheritAttrs: false,\n props: {\n value: String,\n disabled: { type: Boolean, default: undefined },\n disableAlpha: Boolean,\n disableFields: Boolean,\n presetColors: { type: Array as PropType<string[]>, default: () => [] },\n popupProps: Object as PropType<Partial<PopoverProps>>,\n colorPickerProps: Object as PropType<Record<string, unknown>>,\n prefixCls: String,\n },\n emits: ['change', 'update:value'],\n setup(props, { attrs, emit, slots, expose }) {\n const container = ref<HTMLElement>();\n const input = ref<any>();\n const { getPrefixCls } = useConfigContextInject();\n const contextDisabled = useInjectDisabled();\n const disabled = computed(() => props.disabled ?? contextDisabled.value);\n const prefixCls = computed(() => getPrefixCls('color-input', props.prefixCls));\n const hsv = computed(() => tinycolor(props.value || '#000000').toHsv());\n const hue = shallowRef(hsv.value.h);\n watch(hsv, ({ h: nextHue, s, v }) => {\n // 黑色和灰色没有可还原的色相,保留用户在滑条上选中的色相。\n if (s && v) hue.value = nextHue;\n });\n\n const change = (value: string) => {\n emit('update:value', value);\n emit('change', value);\n };\n const selectColor = (s: number, v: number) => {\n change(colorWithAlpha({ h: hue.value, s: clampUnit(s), v: clampUnit(v) }, hsv.value.a, props.disableAlpha));\n };\n const selectFromPointer = (event: PointerEvent) => {\n const { left, top, width, height } = (event.currentTarget as HTMLElement).getBoundingClientRect();\n if (width && height) selectColor((event.clientX - left) / width, 1 - (event.clientY - top) / height);\n };\n expose({ focus: () => input.value?.focus(), blur: () => input.value?.blur() });\n\n const renderPicker = () => {\n const { s, v, a } = hsv.value;\n const pickerPrefix = prefixCls.value;\n return h('div', { class: `${pickerPrefix}-picker` }, [\n h(\n 'div',\n {\n class: `${pickerPrefix}-palette`,\n role: 'slider',\n tabindex: disabled.value ? -1 : 0,\n 'aria-label': '饱和度和明度',\n 'aria-valuemin': 0,\n 'aria-valuemax': 100,\n 'aria-valuenow': Math.round(s * 100),\n 'aria-valuetext': `饱和度 ${Math.round(s * 100)}%,明度 ${Math.round(v * 100)}%`,\n 'aria-disabled': disabled.value,\n style: { backgroundColor: `hsl(${hue.value}, 100%, 50%)` },\n onPointerdown: (event: PointerEvent) => {\n if (disabled.value || event.button !== 0) return;\n const palette = event.currentTarget as HTMLElement;\n palette.setPointerCapture?.(event.pointerId);\n selectFromPointer(event);\n },\n onPointermove: (event: PointerEvent) => {\n if (!disabled.value && (event.currentTarget as HTMLElement).hasPointerCapture?.(event.pointerId)) {\n selectFromPointer(event);\n }\n },\n onKeydown: (event: KeyboardEvent) => {\n const delta = paletteKeys[event.key];\n if (disabled.value || !delta) return;\n event.preventDefault();\n selectColor(s + delta[0], v + delta[1]);\n },\n },\n h('span', {\n class: `${pickerPrefix}-palette-marker`,\n style: { left: `${s * 100}%`, top: `${(1 - v) * 100}%` },\n }),\n ),\n h('input', {\n class: `${pickerPrefix}-hue`,\n type: 'range',\n min: 0,\n max: 359,\n 'aria-label': '色相',\n value: Math.round(hue.value) % 360,\n disabled: disabled.value,\n onInput: (event: Event) => {\n hue.value = (event.target as HTMLInputElement).valueAsNumber;\n selectColor(s, v);\n },\n }),\n !props.disableAlpha\n ? h('label', { class: `${pickerPrefix}-alpha` }, [\n '透明度',\n h('input', {\n type: 'range',\n min: 0,\n max: 1,\n step: 0.01,\n 'aria-label': '透明度',\n value: a,\n disabled: disabled.value,\n onInput: (event: Event) =>\n change(colorWithAlpha(props.value || '#000000', (event.target as HTMLInputElement).valueAsNumber)),\n }),\n ])\n : null,\n !props.disableFields\n ? h('input', {\n 'aria-label': '颜色值',\n value: props.value,\n disabled: disabled.value,\n onInput: (event: Event) => change((event.target as HTMLInputElement).value),\n })\n : null,\n props.presetColors.length\n ? h(\n 'div',\n { class: `${pickerPrefix}-presets` },\n props.presetColors.map((color) =>\n h('button', {\n key: color,\n type: 'button',\n 'aria-label': `选择 ${color}`,\n title: color,\n disabled: disabled.value,\n style: { backgroundColor: color },\n onClick: () => change(props.disableAlpha ? colorWithAlpha(color, 1, true) : color),\n }),\n ),\n )\n : null,\n ]);\n };\n\n return () =>\n h('div', { ref: container, class: prefixCls.value }, [\n h(\n Input,\n {\n ...attrs,\n ref: input,\n value: props.value,\n disabled: disabled.value,\n onChange: (event: Event) => change((event.target as HTMLInputElement).value),\n },\n {\n ...slots,\n prefix: () =>\n h(\n Popover,\n {\n ...props.popupProps,\n trigger: 'click',\n ...(disabled.value ? { open: false } : {}),\n getPopupContainer: () => container.value || document.body,\n },\n {\n content: renderPicker,\n default: () =>\n h('button', {\n type: 'button',\n class: `${prefixCls.value}-color-tips`,\n 'aria-label': '打开颜色选择器',\n disabled: disabled.value,\n style: { backgroundColor: props.value },\n }),\n },\n ),\n },\n ),\n ]);\n },\n});\n"],"names":["defineComponent","ref","useConfigContextInject","useInjectDisabled","computed","tinycolor","shallowRef","watch","colorWithAlpha","h","Input","Popover"],"mappings":";;;;;;;;;;AASA,MAAM,cAAyD;AAAA,EAC7D,WAAW,CAAC,OAAO,CAAC;AAAA,EACpB,YAAY,CAAC,MAAM,CAAC;AAAA,EACpB,WAAW,CAAC,GAAG,KAAK;AAAA,EACpB,SAAS,CAAC,GAAG,IAAI;AACnB;AAEA,MAAM,YAAY,CAAC,UAAkB,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC;AAcnE,MAAA,aAAeA,oBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,OAAO;AAAA,IACL,OAAO;AAAA,IACP,UAAU,EAAE,MA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