@expcat/tigercat-vue 2.0.4 → 2.1.0
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 +20 -10
- package/dist/chunk-26QCTL2E.mjs +180 -0
- package/dist/{chunk-GS4SV2HK.mjs → chunk-32X54QKW.mjs} +1 -1
- package/dist/chunk-3ONCXHE5.mjs +184 -0
- package/dist/{chunk-KOG3HKOF.mjs → chunk-6AMWX5K4.mjs} +1 -4
- package/dist/chunk-6GR3XC5V.mjs +281 -0
- package/dist/chunk-6GR5U4UB.mjs +225 -0
- package/dist/chunk-7DWWNFRP.mjs +302 -0
- package/dist/chunk-AECXFT7D.mjs +121 -0
- package/dist/chunk-AOLRZG4E.mjs +347 -0
- package/dist/chunk-AY7CGLMO.mjs +368 -0
- package/dist/chunk-BBNCP55O.mjs +156 -0
- package/dist/chunk-F3ZVVVYD.mjs +257 -0
- package/dist/{chunk-OTGGPXDT.mjs → chunk-IEAEB4TX.mjs} +255 -44
- package/dist/chunk-P6FMU4AT.mjs +54 -0
- package/dist/chunk-PFIV5MXD.mjs +48 -0
- package/dist/chunk-TBOXTAIA.mjs +94 -0
- package/dist/{chunk-H6FZBFRT.mjs → chunk-TPESRDUG.mjs} +6 -1
- package/dist/{chunk-2XCXK3NQ.mjs → chunk-U4B5QT72.mjs} +1 -1
- package/dist/chunk-UUWPSRNV.mjs +337 -0
- package/dist/chunk-UXJRH72H.mjs +834 -0
- package/dist/chunk-VFS5XAZ3.mjs +602 -0
- package/dist/{chunk-WC5MKASU.mjs → chunk-VN2TWPRC.mjs} +169 -55
- package/dist/components/ActivityFeed.d.mts +1 -1
- package/dist/components/ActivityFeed.mjs +1 -1
- package/dist/components/Alert.d.mts +2 -2
- package/dist/components/AreaChart.mjs +2 -2
- package/dist/components/AspectRatio.d.mts +44 -0
- package/dist/components/AspectRatio.mjs +8 -0
- package/dist/components/BarChart.mjs +2 -2
- package/dist/components/Carousel.d.mts +1 -1
- package/dist/components/Cascader.d.mts +34 -0
- package/dist/components/Cascader.mjs +1 -1
- package/dist/components/ChartLegend.d.mts +1 -1
- package/dist/components/ChatWindow.mjs +1 -1
- package/dist/components/CodeEditor.mjs +1 -1
- package/dist/components/ColorSwatch.d.mts +1 -1
- package/dist/components/ContextMenu.d.mts +234 -0
- package/dist/components/ContextMenu.mjs +17 -0
- package/dist/components/DataTableWithToolbar.d.mts +1 -1
- package/dist/components/DataTableWithToolbar.mjs +2 -2
- package/dist/components/DonutChart.mjs +3 -3
- package/dist/components/Dropdown.d.mts +1 -1
- package/dist/components/FloatButton.d.mts +2 -2
- package/dist/components/FunnelChart.d.mts +1 -1
- package/dist/components/FunnelChart.mjs +2 -2
- package/dist/components/Highlight.d.mts +146 -0
- package/dist/components/Highlight.mjs +8 -0
- package/dist/components/ImageCompare.d.mts +284 -0
- package/dist/components/ImageCompare.mjs +8 -0
- package/dist/components/Input.d.mts +1 -1
- package/dist/components/InputOTP.d.mts +261 -0
- package/dist/components/InputOTP.mjs +11 -0
- package/dist/components/Kbd.d.mts +118 -0
- package/dist/components/Kbd.mjs +8 -0
- package/dist/components/LineChart.mjs +2 -2
- package/dist/components/List.d.mts +1 -1
- package/dist/components/List.mjs +1 -1
- package/dist/components/LoadingBar.d.mts +8 -0
- package/dist/components/LoadingBar.mjs +114 -0
- package/dist/components/LoadingBarContainer.d.mts +78 -0
- package/dist/components/LoadingBarContainer.mjs +8 -0
- package/dist/components/LoadingBarRoot.d.mts +6 -0
- package/dist/components/LoadingBarRoot.mjs +6 -0
- package/dist/components/Marquee.d.mts +158 -0
- package/dist/components/Marquee.mjs +8 -0
- package/dist/components/MaskInput.d.mts +201 -0
- package/dist/components/MaskInput.mjs +11 -0
- package/dist/components/Masonry.d.mts +66 -0
- package/dist/components/Masonry.mjs +8 -0
- package/dist/components/Menu.d.mts +2 -2
- package/dist/components/Modal.d.mts +1 -1
- package/dist/components/NavigationMenu.d.mts +411 -0
- package/dist/components/NavigationMenu.mjs +25 -0
- package/dist/components/NotificationCenter.d.mts +1 -1
- package/dist/components/NotificationCenter.mjs +2 -2
- package/dist/components/PageHeader.d.mts +140 -0
- package/dist/components/PageHeader.mjs +11 -0
- package/dist/components/PieChart.mjs +2 -2
- package/dist/components/Popconfirm.d.mts +3 -3
- package/dist/components/Popover.d.mts +2 -2
- package/dist/components/RadarChart.mjs +2 -2
- package/dist/components/ScatterChart.mjs +2 -2
- package/dist/components/ScrollArea.d.mts +136 -0
- package/dist/components/ScrollArea.mjs +8 -0
- package/dist/components/SplitButton.d.mts +286 -0
- package/dist/components/SplitButton.mjs +12 -0
- package/dist/components/Spotlight.d.mts +1 -1
- package/dist/components/SunburstChart.mjs +2 -2
- package/dist/components/TagsInput.d.mts +214 -0
- package/dist/components/TagsInput.mjs +12 -0
- package/dist/components/Timeline.d.mts +1 -1
- package/dist/components/Tooltip.d.mts +2 -2
- package/dist/components/Tour.d.mts +3 -3
- package/dist/components/Tree.d.mts +1 -1
- package/dist/components/TreeMapChart.d.mts +1 -1
- package/dist/components/TreeMapChart.mjs +2 -2
- package/dist/components/TreeSelect.d.mts +51 -0
- package/dist/components/TreeSelect.mjs +2 -1
- package/dist/components/Upload.d.mts +1 -1
- package/dist/components/VirtualTable.d.mts +1 -1
- package/dist/components/Watermark.d.mts +1 -1
- package/dist/index.d.mts +17 -1
- package/dist/index.mjs +356 -0
- package/package.json +117 -2
- package/dist/{chunk-MAKOSWR6.mjs → chunk-37W7XTA6.mjs} +3 -3
- package/dist/{chunk-WUQMFKQ6.mjs → chunk-66OS5A4D.mjs} +3 -3
- package/dist/{chunk-NNC75I7F.mjs → chunk-CHEXI7MO.mjs} +3 -3
- package/dist/{chunk-KFJIZED5.mjs → chunk-EHGFW5GX.mjs} +3 -3
- package/dist/{chunk-ZGA66PSG.mjs → chunk-EZYOCPMM.mjs} +3 -3
- package/dist/{chunk-XGXZF27U.mjs → chunk-JHMT5Q6P.mjs} +3 -3
- package/dist/{chunk-NGAA73CV.mjs → chunk-VLW3UBIR.mjs} +3 -3
- package/dist/{chunk-OTHJIFDV.mjs → chunk-W5XFWVNV.mjs} +3 -3
- package/dist/{chunk-3KITFMBJ.mjs → chunk-ZOYHZF4N.mjs} +3 -3
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-UOJOJBEU.mjs";
|
|
8
8
|
|
|
9
9
|
// src/components/Cascader.ts
|
|
10
|
-
import { defineComponent, computed, ref, h, watch } from "vue";
|
|
10
|
+
import { defineComponent, computed, ref, h, watch, nextTick } from "vue";
|
|
11
11
|
import {
|
|
12
12
|
classNames,
|
|
13
13
|
cascaderBaseClasses,
|
|
@@ -23,10 +23,15 @@ import {
|
|
|
23
23
|
flattenCascaderOptions,
|
|
24
24
|
filterCascaderOptions,
|
|
25
25
|
isCascaderOptionExpandable,
|
|
26
|
+
getCascaderVirtualItemHeight,
|
|
27
|
+
getCascaderVirtualRange,
|
|
28
|
+
getCascaderVirtualAlignScrollTop,
|
|
29
|
+
CASCADER_DEFAULT_LIST_HEIGHT,
|
|
26
30
|
getPickerComboboxAria,
|
|
27
31
|
getPickerListboxAria,
|
|
28
32
|
getPickerOptionAria,
|
|
29
33
|
getPickerTriggerKeyAction,
|
|
34
|
+
getPickerNavigationIndex,
|
|
30
35
|
icon20ViewBox,
|
|
31
36
|
chevronDownSolidIcon20PathD,
|
|
32
37
|
closeSolidIcon20PathD,
|
|
@@ -106,6 +111,21 @@ var Cascader = defineComponent({
|
|
|
106
111
|
type: String,
|
|
107
112
|
default: void 0
|
|
108
113
|
},
|
|
114
|
+
/**
|
|
115
|
+
* Whether to use virtual scrolling for column and search lists
|
|
116
|
+
*/
|
|
117
|
+
virtual: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* Height of each column panel (and searchable list) in pixels
|
|
123
|
+
* @default 256
|
|
124
|
+
*/
|
|
125
|
+
listHeight: {
|
|
126
|
+
type: Number,
|
|
127
|
+
default: CASCADER_DEFAULT_LIST_HEIGHT
|
|
128
|
+
},
|
|
109
129
|
/**
|
|
110
130
|
* Locale overrides merged on top of ConfigProvider locale
|
|
111
131
|
*/
|
|
@@ -139,6 +159,12 @@ var Cascader = defineComponent({
|
|
|
139
159
|
restoreFocusOnDismiss: true,
|
|
140
160
|
onDismiss: closeDropdown
|
|
141
161
|
});
|
|
162
|
+
const columnScrollTops = ref([]);
|
|
163
|
+
const columnScrollEls = ref([]);
|
|
164
|
+
const columnActiveIndices = ref([]);
|
|
165
|
+
const searchScrollTop = ref(0);
|
|
166
|
+
const searchScrollEl = ref(null);
|
|
167
|
+
const searchActiveIndex = ref(-1);
|
|
142
168
|
const displayLabel = computed(() => {
|
|
143
169
|
if (!props.modelValue || props.modelValue.length === 0) return "";
|
|
144
170
|
return getCascaderDisplayLabel(props.options, props.modelValue, props.separator);
|
|
@@ -163,12 +189,77 @@ var Cascader = defineComponent({
|
|
|
163
189
|
coerceClassValue(attrs.class)
|
|
164
190
|
)
|
|
165
191
|
);
|
|
192
|
+
function selectedIndexInColumn(options, selectedValue) {
|
|
193
|
+
if (selectedValue === void 0) return -1;
|
|
194
|
+
return options.findIndex((option) => option.value === selectedValue);
|
|
195
|
+
}
|
|
196
|
+
function alignVirtualScroll(el, index, setScrollTop) {
|
|
197
|
+
if (!props.virtual || !el || index < 0) return;
|
|
198
|
+
const itemH = getCascaderVirtualItemHeight(props.size);
|
|
199
|
+
const next = getCascaderVirtualAlignScrollTop(el.scrollTop, index, itemH, props.listHeight);
|
|
200
|
+
if (el.scrollTop !== next) el.scrollTop = next;
|
|
201
|
+
setScrollTop(next);
|
|
202
|
+
}
|
|
166
203
|
watch(isOpen, (open) => {
|
|
167
204
|
if (open) {
|
|
205
|
+
columnScrollTops.value = [];
|
|
206
|
+
columnScrollEls.value = [];
|
|
207
|
+
columnActiveIndices.value = [];
|
|
208
|
+
searchScrollTop.value = 0;
|
|
209
|
+
searchActiveIndex.value = -1;
|
|
168
210
|
activePath.value = props.modelValue ? [...props.modelValue] : [];
|
|
169
211
|
updateSearchValue("");
|
|
170
212
|
}
|
|
171
213
|
});
|
|
214
|
+
watch(
|
|
215
|
+
columns,
|
|
216
|
+
(cols) => {
|
|
217
|
+
if (!props.virtual || !isOpen.value) return;
|
|
218
|
+
const itemH = getCascaderVirtualItemHeight(props.size);
|
|
219
|
+
columnActiveIndices.value = cols.map((col, i) => {
|
|
220
|
+
const prev = columnActiveIndices.value[i];
|
|
221
|
+
if (prev !== void 0 && prev >= 0 && prev < col.options.length) return prev;
|
|
222
|
+
return selectedIndexInColumn(col.options, col.selectedValue);
|
|
223
|
+
});
|
|
224
|
+
columnScrollTops.value = cols.map((col, i) => {
|
|
225
|
+
const stored = columnScrollTops.value[i];
|
|
226
|
+
if (stored !== void 0) return stored;
|
|
227
|
+
return getCascaderVirtualAlignScrollTop(
|
|
228
|
+
0,
|
|
229
|
+
columnActiveIndices.value[i] ?? -1,
|
|
230
|
+
itemH,
|
|
231
|
+
props.listHeight
|
|
232
|
+
);
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
{ immediate: true }
|
|
236
|
+
);
|
|
237
|
+
watch(
|
|
238
|
+
columnActiveIndices,
|
|
239
|
+
(indices) => {
|
|
240
|
+
if (!props.virtual) return;
|
|
241
|
+
nextTick(() => {
|
|
242
|
+
indices.forEach((idx, colIndex) => {
|
|
243
|
+
alignVirtualScroll(columnScrollEls.value[colIndex] ?? null, idx, (top) => {
|
|
244
|
+
columnScrollTops.value[colIndex] = top;
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
{ deep: true }
|
|
250
|
+
);
|
|
251
|
+
watch(searchActiveIndex, (idx) => {
|
|
252
|
+
if (!props.virtual) return;
|
|
253
|
+
nextTick(() => {
|
|
254
|
+
alignVirtualScroll(searchScrollEl.value, idx, (top) => {
|
|
255
|
+
searchScrollTop.value = top;
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
watch(searchQuery, () => {
|
|
260
|
+
searchScrollTop.value = 0;
|
|
261
|
+
searchActiveIndex.value = -1;
|
|
262
|
+
});
|
|
172
263
|
function updateSearchValue(value) {
|
|
173
264
|
if (props.searchValue === void 0) {
|
|
174
265
|
uncontrolledSearchValue.value = value;
|
|
@@ -183,11 +274,22 @@ var Cascader = defineComponent({
|
|
|
183
274
|
function closeDropdown() {
|
|
184
275
|
isOpen.value = false;
|
|
185
276
|
}
|
|
277
|
+
function setColumnActiveIndex(colIndex, index) {
|
|
278
|
+
const next = columnActiveIndices.value.slice();
|
|
279
|
+
next[colIndex] = index;
|
|
280
|
+
columnActiveIndices.value = next;
|
|
281
|
+
}
|
|
186
282
|
function handleOptionClick(option, level) {
|
|
187
283
|
if (option.disabled) return;
|
|
284
|
+
const optionIndex = columns.value[level]?.options.findIndex(
|
|
285
|
+
(item) => item.value === option.value
|
|
286
|
+
);
|
|
188
287
|
const newPath = activePath.value.slice(0, level);
|
|
189
288
|
newPath.push(option.value);
|
|
190
289
|
activePath.value = newPath;
|
|
290
|
+
if (optionIndex !== void 0 && optionIndex >= 0) {
|
|
291
|
+
setColumnActiveIndex(level, optionIndex);
|
|
292
|
+
}
|
|
191
293
|
const hasChildren = isCascaderOptionExpandable(option);
|
|
192
294
|
if (!hasChildren) {
|
|
193
295
|
emit("update:modelValue", newPath);
|
|
@@ -199,6 +301,12 @@ var Cascader = defineComponent({
|
|
|
199
301
|
}
|
|
200
302
|
}
|
|
201
303
|
function handleOptionHover(option, level) {
|
|
304
|
+
const optionIndex = columns.value[level]?.options.findIndex(
|
|
305
|
+
(item) => item.value === option.value
|
|
306
|
+
);
|
|
307
|
+
if (optionIndex !== void 0 && optionIndex >= 0 && !option.disabled) {
|
|
308
|
+
setColumnActiveIndex(level, optionIndex);
|
|
309
|
+
}
|
|
202
310
|
if (props.expandTrigger !== "hover" || option.disabled) return;
|
|
203
311
|
const newPath = activePath.value.slice(0, level);
|
|
204
312
|
newPath.push(option.value);
|
|
@@ -218,6 +326,53 @@ var Cascader = defineComponent({
|
|
|
218
326
|
function handleSearchInput(e) {
|
|
219
327
|
updateSearchValue(e.target.value);
|
|
220
328
|
}
|
|
329
|
+
function handleVirtualListKeyDown(e, items, current, setIndex) {
|
|
330
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp" && e.key !== "Home" && e.key !== "End") {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
e.preventDefault();
|
|
334
|
+
e.stopPropagation();
|
|
335
|
+
setIndex(getPickerNavigationIndex(items, current, e.key));
|
|
336
|
+
}
|
|
337
|
+
function renderVirtualWindow(itemCount, scrollTop, onScrollTop, setScrollEl, renderItem, extraAttrs, onKeyDown) {
|
|
338
|
+
const itemH = getCascaderVirtualItemHeight(props.size);
|
|
339
|
+
const { startIndex, endIndex, totalHeight } = getCascaderVirtualRange(
|
|
340
|
+
scrollTop,
|
|
341
|
+
props.listHeight,
|
|
342
|
+
itemCount,
|
|
343
|
+
itemH
|
|
344
|
+
);
|
|
345
|
+
const fromIndex = itemCount <= 0 ? 0 : Math.min(startIndex, endIndex, itemCount - 1);
|
|
346
|
+
const toIndex = itemCount <= 0 ? -1 : Math.min(endIndex, itemCount - 1);
|
|
347
|
+
const visible = [];
|
|
348
|
+
if (fromIndex <= toIndex) {
|
|
349
|
+
for (let i = fromIndex; i <= toIndex; i++) {
|
|
350
|
+
const node = renderItem(i);
|
|
351
|
+
if (node) visible.push(node);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return h(
|
|
355
|
+
"div",
|
|
356
|
+
{
|
|
357
|
+
...extraAttrs,
|
|
358
|
+
ref: ((el) => {
|
|
359
|
+
setScrollEl(el);
|
|
360
|
+
}),
|
|
361
|
+
"data-tiger-cascader-virtual": "",
|
|
362
|
+
tabindex: 0,
|
|
363
|
+
style: { maxHeight: `${props.listHeight}px`, overflowY: "auto" },
|
|
364
|
+
onScroll: (e) => {
|
|
365
|
+
onScrollTop(e.target.scrollTop);
|
|
366
|
+
},
|
|
367
|
+
onKeydown: onKeyDown
|
|
368
|
+
},
|
|
369
|
+
[
|
|
370
|
+
h("div", { style: { height: `${totalHeight}px`, position: "relative" } }, [
|
|
371
|
+
h("div", { style: { transform: `translateY(${fromIndex * itemH}px)` } }, visible)
|
|
372
|
+
])
|
|
373
|
+
]
|
|
374
|
+
);
|
|
375
|
+
}
|
|
221
376
|
function handleTriggerKeyDown(e) {
|
|
222
377
|
const action = getPickerTriggerKeyAction(e.key, isOpen.value);
|
|
223
378
|
if (action === "none") return;
|
|
@@ -344,59 +499,115 @@ var Cascader = defineComponent({
|
|
|
344
499
|
)
|
|
345
500
|
);
|
|
346
501
|
} else {
|
|
347
|
-
const
|
|
502
|
+
const renderSearchItem = (item, index) => h(
|
|
348
503
|
"div",
|
|
349
|
-
{
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
504
|
+
{
|
|
505
|
+
key: item.valuePath.join(","),
|
|
506
|
+
"data-option-index": index,
|
|
507
|
+
class: classNames(
|
|
508
|
+
cascaderSearchResultClasses,
|
|
509
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
510
|
+
),
|
|
511
|
+
...getPickerOptionAria({
|
|
512
|
+
selected: props.modelValue?.join(",") === item.valuePath.join(","),
|
|
513
|
+
disabled: item.disabled
|
|
514
|
+
}),
|
|
515
|
+
onMouseenter: () => {
|
|
516
|
+
if (!item.disabled) searchActiveIndex.value = index;
|
|
517
|
+
},
|
|
518
|
+
onClick: () => handleSearchResultClick(item.valuePath, item.disabled)
|
|
519
|
+
},
|
|
520
|
+
typeof props.searchable === "object" && props.searchable.render ? props.searchable.render(searchQuery.value, item.path) : item.label
|
|
521
|
+
);
|
|
522
|
+
const searchList = props.virtual ? renderVirtualWindow(
|
|
523
|
+
searchResults.value.length,
|
|
524
|
+
searchScrollTop.value,
|
|
525
|
+
(top) => {
|
|
526
|
+
searchScrollTop.value = top;
|
|
527
|
+
},
|
|
528
|
+
(el) => {
|
|
529
|
+
searchScrollEl.value = el;
|
|
530
|
+
},
|
|
531
|
+
(index) => renderSearchItem(searchResults.value[index], index),
|
|
532
|
+
{
|
|
533
|
+
...getPickerListboxAria({ id: listboxId })
|
|
534
|
+
},
|
|
535
|
+
(e) => handleVirtualListKeyDown(
|
|
536
|
+
e,
|
|
537
|
+
searchResults.value,
|
|
538
|
+
searchActiveIndex.value,
|
|
539
|
+
(index) => {
|
|
540
|
+
searchActiveIndex.value = index;
|
|
541
|
+
}
|
|
366
542
|
)
|
|
543
|
+
) : h(
|
|
544
|
+
"div",
|
|
545
|
+
{ class: "max-h-64 overflow-auto", ...getPickerListboxAria({ id: listboxId }) },
|
|
546
|
+
searchResults.value.map((item, index) => renderSearchItem(item, index))
|
|
367
547
|
);
|
|
368
548
|
children.push(searchList);
|
|
369
549
|
}
|
|
370
550
|
} else {
|
|
371
|
-
const
|
|
372
|
-
|
|
551
|
+
const renderColumnOption = (option, col, colIndex, optionIndex) => {
|
|
552
|
+
const isSelected = col.selectedValue === option.value;
|
|
553
|
+
const hasChildren = isCascaderOptionExpandable(option);
|
|
554
|
+
return h(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
key: option.value,
|
|
558
|
+
"data-option-index": optionIndex,
|
|
559
|
+
class: getCascaderOptionClasses(isSelected, !!option.disabled, props.size),
|
|
560
|
+
...getPickerOptionAria({ selected: isSelected, disabled: !!option.disabled }),
|
|
561
|
+
onClick: () => handleOptionClick(option, colIndex),
|
|
562
|
+
onMouseenter: () => handleOptionHover(option, colIndex)
|
|
563
|
+
},
|
|
564
|
+
[
|
|
565
|
+
h("span", { class: "flex-1 truncate" }, option.label),
|
|
566
|
+
hasChildren ? ChevronRightIcon : null
|
|
567
|
+
]
|
|
568
|
+
);
|
|
569
|
+
};
|
|
570
|
+
const columnElements = columns.value.map((col, colIndex) => {
|
|
571
|
+
const listboxAttrs = getPickerListboxAria({
|
|
572
|
+
id: colIndex === 0 ? listboxId : void 0,
|
|
573
|
+
label: `Level ${colIndex + 1}`
|
|
574
|
+
});
|
|
575
|
+
if (props.virtual) {
|
|
576
|
+
return renderVirtualWindow(
|
|
577
|
+
col.options.length,
|
|
578
|
+
columnScrollTops.value[colIndex] ?? 0,
|
|
579
|
+
(top) => {
|
|
580
|
+
columnScrollTops.value[colIndex] = top;
|
|
581
|
+
},
|
|
582
|
+
(el) => {
|
|
583
|
+
const next = columnScrollEls.value.slice();
|
|
584
|
+
next[colIndex] = el;
|
|
585
|
+
columnScrollEls.value = next;
|
|
586
|
+
},
|
|
587
|
+
(index) => renderColumnOption(col.options[index], col, colIndex, index),
|
|
588
|
+
{
|
|
589
|
+
class: cascaderColumnClasses,
|
|
590
|
+
...listboxAttrs
|
|
591
|
+
},
|
|
592
|
+
(e) => handleVirtualListKeyDown(
|
|
593
|
+
e,
|
|
594
|
+
col.options,
|
|
595
|
+
columnActiveIndices.value[colIndex] ?? -1,
|
|
596
|
+
(index) => setColumnActiveIndex(colIndex, index)
|
|
597
|
+
)
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
return h(
|
|
373
601
|
"div",
|
|
374
602
|
{
|
|
375
603
|
class: cascaderColumnClasses,
|
|
376
|
-
...
|
|
377
|
-
id: colIndex === 0 ? listboxId : void 0,
|
|
378
|
-
label: `Level ${colIndex + 1}`
|
|
379
|
-
})
|
|
604
|
+
...listboxAttrs
|
|
380
605
|
},
|
|
381
|
-
col.options.map(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
{
|
|
387
|
-
class: getCascaderOptionClasses(isSelected, !!option.disabled, props.size),
|
|
388
|
-
...getPickerOptionAria({ selected: isSelected, disabled: !!option.disabled }),
|
|
389
|
-
onClick: () => handleOptionClick(option, colIndex),
|
|
390
|
-
onMouseenter: () => handleOptionHover(option, colIndex)
|
|
391
|
-
},
|
|
392
|
-
[
|
|
393
|
-
h("span", { class: "flex-1 truncate" }, option.label),
|
|
394
|
-
hasChildren ? ChevronRightIcon : null
|
|
395
|
-
]
|
|
396
|
-
);
|
|
397
|
-
})
|
|
398
|
-
)
|
|
399
|
-
);
|
|
606
|
+
col.options.map(
|
|
607
|
+
(option, optionIndex) => renderColumnOption(option, col, colIndex, optionIndex)
|
|
608
|
+
)
|
|
609
|
+
);
|
|
610
|
+
});
|
|
400
611
|
children.push(h("div", { class: "flex" }, columnElements));
|
|
401
612
|
}
|
|
402
613
|
dropdownContent = h(
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/components/AspectRatio.ts
|
|
2
|
+
import { defineComponent, h } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
classNames,
|
|
5
|
+
coerceClassValue,
|
|
6
|
+
mergeStyleValues,
|
|
7
|
+
getAspectRatioContentClasses,
|
|
8
|
+
getAspectRatioRootClasses,
|
|
9
|
+
getAspectRatioStyle,
|
|
10
|
+
ASPECT_RATIO_DEFAULT
|
|
11
|
+
} from "@expcat/tigercat-core";
|
|
12
|
+
var AspectRatio = defineComponent({
|
|
13
|
+
name: "TigerAspectRatio",
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
props: {
|
|
16
|
+
ratio: {
|
|
17
|
+
type: [Number, String],
|
|
18
|
+
default: ASPECT_RATIO_DEFAULT
|
|
19
|
+
},
|
|
20
|
+
className: { type: String, default: void 0 },
|
|
21
|
+
contentClassName: { type: String, default: void 0 }
|
|
22
|
+
},
|
|
23
|
+
setup(props, { slots, attrs }) {
|
|
24
|
+
return () => h(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
...attrs,
|
|
28
|
+
class: classNames(
|
|
29
|
+
getAspectRatioRootClasses(),
|
|
30
|
+
props.className,
|
|
31
|
+
coerceClassValue(attrs.class)
|
|
32
|
+
),
|
|
33
|
+
style: mergeStyleValues(getAspectRatioStyle(props.ratio), attrs.style),
|
|
34
|
+
"data-aspect-ratio": ""
|
|
35
|
+
},
|
|
36
|
+
[
|
|
37
|
+
h(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
class: classNames(getAspectRatioContentClasses(), props.contentClassName),
|
|
41
|
+
"data-aspect-ratio-content": ""
|
|
42
|
+
},
|
|
43
|
+
slots.default?.()
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var AspectRatio_default = AspectRatio;
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
AspectRatio,
|
|
53
|
+
AspectRatio_default
|
|
54
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/components/LoadingBarRoot.ts
|
|
2
|
+
var loadingBarModulePromise = null;
|
|
3
|
+
var pendingCommands = [];
|
|
4
|
+
var resolvedApi = null;
|
|
5
|
+
function loadLoadingBarModule() {
|
|
6
|
+
loadingBarModulePromise ??= import("./components/LoadingBar.mjs");
|
|
7
|
+
return loadingBarModulePromise;
|
|
8
|
+
}
|
|
9
|
+
function applyCommand(api, command) {
|
|
10
|
+
if (command.type === "start") {
|
|
11
|
+
api.start(command.options);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
api[command.type]();
|
|
15
|
+
}
|
|
16
|
+
function enqueue(command) {
|
|
17
|
+
if (resolvedApi) {
|
|
18
|
+
applyCommand(resolvedApi, command);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
pendingCommands.push(command);
|
|
22
|
+
void loadLoadingBarModule().then(({ LoadingBar: LoadingBar2 }) => {
|
|
23
|
+
resolvedApi = LoadingBar2;
|
|
24
|
+
const queue = pendingCommands;
|
|
25
|
+
pendingCommands = [];
|
|
26
|
+
for (const item of queue) {
|
|
27
|
+
applyCommand(LoadingBar2, item);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
var LoadingBar = {
|
|
32
|
+
start(options) {
|
|
33
|
+
enqueue({ type: "start", options });
|
|
34
|
+
},
|
|
35
|
+
finish() {
|
|
36
|
+
enqueue({ type: "finish" });
|
|
37
|
+
},
|
|
38
|
+
error() {
|
|
39
|
+
enqueue({ type: "error" });
|
|
40
|
+
},
|
|
41
|
+
clear() {
|
|
42
|
+
enqueue({ type: "clear" });
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
LoadingBar
|
|
48
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/components/LoadingBarContainer.ts
|
|
2
|
+
import { computed, defineComponent, h } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
classNames,
|
|
5
|
+
coerceClassValue,
|
|
6
|
+
DEFAULT_LOADING_BAR_ARIA_LABEL,
|
|
7
|
+
DEFAULT_LOADING_BAR_COLOR,
|
|
8
|
+
DEFAULT_LOADING_BAR_HEIGHT,
|
|
9
|
+
getLoadingBarContainerClasses,
|
|
10
|
+
getLoadingBarFillClasses,
|
|
11
|
+
getLoadingBarFillStyle,
|
|
12
|
+
LOADING_BAR_CONTAINER_ID,
|
|
13
|
+
mergeStyleValues
|
|
14
|
+
} from "@expcat/tigercat-core";
|
|
15
|
+
var LoadingBarContainer = /* @__PURE__ */ defineComponent({
|
|
16
|
+
name: "TigerLoadingBarContainer",
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
props: {
|
|
19
|
+
percentage: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 0
|
|
22
|
+
},
|
|
23
|
+
status: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "idle"
|
|
26
|
+
},
|
|
27
|
+
color: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: DEFAULT_LOADING_BAR_COLOR
|
|
30
|
+
},
|
|
31
|
+
height: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: DEFAULT_LOADING_BAR_HEIGHT
|
|
34
|
+
},
|
|
35
|
+
className: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: void 0
|
|
38
|
+
},
|
|
39
|
+
style: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
ariaLabel: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: void 0
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
setup(props, { attrs }) {
|
|
49
|
+
const containerClasses = computed(
|
|
50
|
+
() => getLoadingBarContainerClasses(classNames(props.className, coerceClassValue(attrs.class)))
|
|
51
|
+
);
|
|
52
|
+
const fillClasses = computed(() => getLoadingBarFillClasses(props.status, props.color));
|
|
53
|
+
const fillStyle = computed(() => getLoadingBarFillStyle(props.percentage, props.height));
|
|
54
|
+
const resolvedAriaLabel = computed(
|
|
55
|
+
() => props.ariaLabel?.trim() || DEFAULT_LOADING_BAR_ARIA_LABEL
|
|
56
|
+
);
|
|
57
|
+
return () => {
|
|
58
|
+
const isBusy = props.status === "loading";
|
|
59
|
+
return h(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
...attrs,
|
|
63
|
+
class: containerClasses.value,
|
|
64
|
+
style: mergeStyleValues(attrs.style, props.style, { height: `${props.height}px` }),
|
|
65
|
+
id: LOADING_BAR_CONTAINER_ID,
|
|
66
|
+
"data-tiger-loading-bar-container": "",
|
|
67
|
+
"data-tiger-loading-bar-status": props.status
|
|
68
|
+
},
|
|
69
|
+
[
|
|
70
|
+
h("div", {
|
|
71
|
+
class: fillClasses.value,
|
|
72
|
+
style: fillStyle.value,
|
|
73
|
+
role: "progressbar",
|
|
74
|
+
"aria-label": resolvedAriaLabel.value,
|
|
75
|
+
"aria-valuemin": 0,
|
|
76
|
+
"aria-valuemax": 100,
|
|
77
|
+
"aria-valuenow": Math.round(props.percentage),
|
|
78
|
+
"aria-busy": isBusy ? "true" : void 0,
|
|
79
|
+
"aria-live": "polite",
|
|
80
|
+
"aria-atomic": "true",
|
|
81
|
+
"data-tiger-loading-bar": "",
|
|
82
|
+
"data-tiger-loading-bar-status": props.status
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
var LoadingBarContainer_default = LoadingBarContainer;
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
LoadingBarContainer,
|
|
93
|
+
LoadingBarContainer_default
|
|
94
|
+
};
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
handleTabKey,
|
|
13
13
|
getActiveLineIndex,
|
|
14
14
|
getCodeEditorActiveLineClasses,
|
|
15
|
+
getCodeEditorCaretClasses,
|
|
15
16
|
codeEditorTextareaClasses,
|
|
16
17
|
codeEditorHighlightClasses
|
|
17
18
|
} from "@expcat/tigercat-core";
|
|
@@ -157,7 +158,11 @@ var CodeEditor = defineComponent({
|
|
|
157
158
|
);
|
|
158
159
|
const textareaNode = h("textarea", {
|
|
159
160
|
ref: textareaRef,
|
|
160
|
-
class: classNames(
|
|
161
|
+
class: classNames(
|
|
162
|
+
codeEditorTextareaClasses,
|
|
163
|
+
getCodeEditorCaretClasses(props.theme),
|
|
164
|
+
wrapClass
|
|
165
|
+
),
|
|
161
166
|
value: code.value,
|
|
162
167
|
onInput,
|
|
163
168
|
onKeydown: onKeyDown,
|