@iris-ui-kit/vue 0.1.0 → 0.2.1
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/dist/admin.cjs +385 -25
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +108 -5
- package/dist/admin.d.ts +108 -5
- package/dist/admin.js +2 -1
- package/dist/behaviors.cjs +5 -1
- package/dist/behaviors.cjs.map +1 -1
- package/dist/behaviors.d.cts +10 -1
- package/dist/behaviors.d.ts +10 -1
- package/dist/behaviors.js +2 -1
- package/dist/{chunk-FJBYAIL4.js → chunk-4V4CT3Z4.js} +213 -31
- package/dist/chunk-4V4CT3Z4.js.map +1 -0
- package/dist/{chunk-CIZGSGXN.js → chunk-CWXH44OF.js} +4 -162
- package/dist/chunk-CWXH44OF.js.map +1 -0
- package/dist/chunk-W3B6E5GN.js +170 -0
- package/dist/chunk-W3B6E5GN.js.map +1 -0
- package/dist/index.cjs +702 -437
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +174 -77
- package/dist/index.d.ts +174 -77
- package/dist/index.js +205 -143
- package/dist/index.js.map +1 -1
- package/package.json +96 -11
- package/dist/chunk-CIZGSGXN.js.map +0 -1
- package/dist/chunk-FJBYAIL4.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { IrisCheckbox } from './chunk-QLUIKEMJ.js';
|
|
|
12
12
|
export { IrisAlert, IrisButton, IrisCheckbox, IrisDashboardTemplate, IrisDivider, IrisFormField, IrisInput, IrisLoginTemplate, IrisPasswordInput } from './chunk-QLUIKEMJ.js';
|
|
13
13
|
export { IrisContainer, IrisDashboardCard, IrisDashboardGrid, IrisStack } from './chunk-3R3QDLJC.js';
|
|
14
14
|
export { IrisSkinKey, SkinProvider, SkinResolutionError, applySkin, builtinSkins, createSkinCatalog, createSkinEngine, createSkinRegistry, darkSkin, lightSkin, loadSkin, localStorageSkinStorage, memorySkinStorage, renderSkinStyle, resolveSkin, skinBootScript, skinError, skinToCssEntries, useSkin, useSkinContext, validateSkin } from './chunk-H7HVVPYR.js';
|
|
15
|
-
export { DropdownContextKey, IrisAdminBreadcrumb, IrisAdminLayout, IrisAdminTabs, IrisBreadcrumb, IrisBreadcrumbItem, IrisDropdown, IrisDropdownItem, IrisDropdownMenu, IrisDropdownSeparator, IrisDropdownTrigger, IrisIcon, IrisNavMenu, createTabsNav, findNavNode, findNavPath, firstLeaf, flattenNav, isBranch, isClosable, useAdminShell, useTabsNav, visibleNav } from './chunk-
|
|
15
|
+
export { DropdownContextKey, IrisAdminBreadcrumb, IrisAdminLayout, IrisAdminTabs, IrisBreadcrumb, IrisBreadcrumbItem, IrisDropdown, IrisDropdownItem, IrisDropdownMenu, IrisDropdownSeparator, IrisDropdownTrigger, IrisIcon, IrisNavMenu, createAdminPreferences, createTabsNav, filterNavByAccess, findNavNode, findNavPath, firstLeaf, flattenNav, isBranch, isClosable, localStorageAdminPreferencesStorage, nodeAllowsRoles, useAdminPreferences, useAdminShell, useTabsNav, visibleNav } from './chunk-4V4CT3Z4.js';
|
|
16
16
|
import { useFloating, useDismiss } from './chunk-3FJUCHCC.js';
|
|
17
17
|
export { useDismiss, useFloating } from './chunk-3FJUCHCC.js';
|
|
18
18
|
import { useMachine } from './chunk-TQB5LVOH.js';
|
|
@@ -22,8 +22,9 @@ export { IrisSlot, composeRefs, findFirstElement, mergeSlotProps } from './chunk
|
|
|
22
22
|
export { IrisHeaderLayout, IrisSidebarLayout } from './chunk-I6D5VXQK.js';
|
|
23
23
|
export { IrisThemeKey, ThemeProvider, useColorScheme, useDirection, useTheme, useThemeContext } from './chunk-72PZMU6R.js';
|
|
24
24
|
export { useAsyncResource, usePaginatedResource } from './chunk-ZY4NLITM.js';
|
|
25
|
-
import { useDrag } from './chunk-
|
|
26
|
-
export { IrisClickOutside, IrisHotkey, IrisLongPress, IrisMovable, IrisResizable,
|
|
25
|
+
import { useDrag } from './chunk-CWXH44OF.js';
|
|
26
|
+
export { IrisClickOutside, IrisHotkey, IrisLongPress, IrisMovable, IrisResizable, useDrag } from './chunk-CWXH44OF.js';
|
|
27
|
+
export { IrisSortable, SORTABLE_ITEM_ATTR } from './chunk-W3B6E5GN.js';
|
|
27
28
|
export { createClientDataSource, createDataSource, createGroupedView, useDataSource, useGroupedView } from './chunk-7IOJADZC.js';
|
|
28
29
|
import { useStore } from './chunk-75GSYEJS.js';
|
|
29
30
|
export { useStore, useStoreSelector } from './chunk-75GSYEJS.js';
|
|
@@ -31,14 +32,50 @@ export { IrisErrorBoundary } from './chunk-PPYNXNGZ.js';
|
|
|
31
32
|
export { FormInjectionKey, IrisForm, useField, useFieldArray, useForm, useFormContext } from './chunk-4FLIW67H.js';
|
|
32
33
|
import { useI18n } from './chunk-TCAXRWT6.js';
|
|
33
34
|
export { I18nInjectionKey, IrisI18nProvider, useI18n } from './chunk-TCAXRWT6.js';
|
|
34
|
-
import { defineComponent, computed, watch, ref, useId, provide, inject, h, nextTick, Teleport, onScopeDispose, Fragment, onMounted, onBeforeUnmount, onBeforeMount, shallowRef, Comment } from 'vue';
|
|
35
|
-
import { createFloatingMachine, createHoverIntent, createKeyboardNav, getPageRange, createSelectionModel, flattenLeafColumns, buildHeaderMatrix,
|
|
35
|
+
import { defineComponent, computed, watch, ref, useId, provide, inject, h, nextTick, Teleport, onScopeDispose, Fragment, onMounted, onBeforeUnmount, onBeforeMount, shallowRef, toValue, Comment, onUnmounted } from 'vue';
|
|
36
|
+
import { createFloatingMachine, createHoverIntent, createKeyboardNav, getPageRange, createSelectionModel, flattenLeafColumns, buildHeaderMatrix, createExpansion, flattenTree, withSortedChildren, createCellRange, computeVirtualRange, aggregate, createStore, createTreeSelection, firstEnabledIndex, startOfMonth, clampDate, isSameMonth, buildMonthMatrix, getWeekdayNames, formatMonthYear, startOfDay, endOfMonth, isSameDay, isOutOfRange, formatLocalISO, hexToRgba, rgbaToHsva, hsvaToRgba, rgbToHex, addMonths, createVirtualizer, compareValues, nextGridCell, nextEnabledIndex, copyText, addDays, clamp01, createAutoDismiss, createReconnectingSource, createResilientFetcher, createDisposableScope, toCsv, downloadFile, toSpreadsheetXml, generateId } from '@iris-ui-kit/core';
|
|
36
37
|
export { addDays, addMonths, buildMonthMatrix, clamp01, clampDate, composeEventHandlers, createFloatingMachine, createMachine, createStore, endOfMonth, formatLocalISO, formatMonthYear, generateId, getPageRange, getWeekdayNames, hexToRgba, hsvToRgb, hsvaToRgba, isOutOfRange, isSameDay, isSameMonth, mergeProps, rgbToHex, rgbToHsv, rgbaToHsva, startOfDay, startOfMonth } from '@iris-ui-kit/core';
|
|
37
38
|
import { getDirection } from '@iris-ui-kit/theme';
|
|
38
39
|
export { applyTheme, createThemeStore, getCssVar, toCssVarName } from '@iris-ui-kit/theme';
|
|
39
40
|
export { ALL_TOKEN_NAMES, COLOR_TOKENS, RADII_TOKENS, SPACING_TOKENS, darkTheme, lightTheme } from '@iris-ui-kit/tokens';
|
|
40
41
|
export { createIconRegistry, defaultIconRegistry, defaultIcons, renderIconSvg, resolveIcon, resolveThemedIcon } from '@iris-ui-kit/icons';
|
|
41
42
|
|
|
43
|
+
function useReconnectingSource(connect, handlers, options) {
|
|
44
|
+
const status = ref("idle");
|
|
45
|
+
const handlersRef = { current: handlers };
|
|
46
|
+
handlersRef.current = handlers;
|
|
47
|
+
const source = createReconnectingSource(
|
|
48
|
+
connect,
|
|
49
|
+
{
|
|
50
|
+
onMessage: (data) => handlersRef.current.onMessage?.(data),
|
|
51
|
+
onOpen: () => handlersRef.current.onOpen?.(),
|
|
52
|
+
onError: (err) => handlersRef.current.onError?.(err),
|
|
53
|
+
onClose: () => handlersRef.current.onClose?.(),
|
|
54
|
+
onStatus: (s) => {
|
|
55
|
+
status.value = s;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
options
|
|
59
|
+
);
|
|
60
|
+
source.open();
|
|
61
|
+
onUnmounted(() => source.close());
|
|
62
|
+
return status;
|
|
63
|
+
}
|
|
64
|
+
function useResilientFetcher(options) {
|
|
65
|
+
const rf = createResilientFetcher(options);
|
|
66
|
+
onUnmounted(() => {
|
|
67
|
+
rf.cache.clear();
|
|
68
|
+
});
|
|
69
|
+
return rf;
|
|
70
|
+
}
|
|
71
|
+
function useDisposableScope() {
|
|
72
|
+
const scope = ref(createDisposableScope());
|
|
73
|
+
onUnmounted(() => {
|
|
74
|
+
scope.value.destroy();
|
|
75
|
+
});
|
|
76
|
+
return scope;
|
|
77
|
+
}
|
|
78
|
+
|
|
42
79
|
// src/primitives/popover/context.ts
|
|
43
80
|
var PopoverContextKey = /* @__PURE__ */ Symbol("IrisPopover");
|
|
44
81
|
|
|
@@ -191,39 +228,37 @@ var IrisPopoverContent = defineComponent({
|
|
|
191
228
|
target?.focus();
|
|
192
229
|
}
|
|
193
230
|
});
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
innerRef.value = el ?? null;
|
|
201
|
-
},
|
|
202
|
-
id: ctx.contentId,
|
|
203
|
-
role: "dialog",
|
|
204
|
-
tabindex: -1,
|
|
205
|
-
"data-state": ctx.open.value ? "open" : "closed",
|
|
206
|
-
"data-placement": ctx.placement,
|
|
207
|
-
style: {
|
|
208
|
-
...floatingStyles.value,
|
|
209
|
-
background: "var(--iris-surface)",
|
|
210
|
-
color: "var(--iris-foreground)",
|
|
211
|
-
border: "1px solid var(--iris-border)",
|
|
212
|
-
borderRadius: "var(--iris-radius-md)",
|
|
213
|
-
padding: "var(--iris-padding-md)",
|
|
214
|
-
boxShadow: "0 8px 24px -8px rgba(0, 0, 0, 0.16), 0 4px 8px -2px rgba(0, 0, 0, 0.08)",
|
|
215
|
-
fontSize: "14px",
|
|
216
|
-
zIndex: "1000",
|
|
217
|
-
outline: "none",
|
|
218
|
-
...attrs.style ?? {}
|
|
219
|
-
}
|
|
231
|
+
const renderContent = () => h(
|
|
232
|
+
"div",
|
|
233
|
+
{
|
|
234
|
+
...attrs,
|
|
235
|
+
ref: (el) => {
|
|
236
|
+
innerRef.value = el ?? null;
|
|
220
237
|
},
|
|
221
|
-
|
|
222
|
-
|
|
238
|
+
id: ctx.contentId,
|
|
239
|
+
role: "dialog",
|
|
240
|
+
tabindex: -1,
|
|
241
|
+
"data-state": ctx.open.value ? "open" : "closed",
|
|
242
|
+
"data-placement": ctx.placement,
|
|
243
|
+
style: {
|
|
244
|
+
...floatingStyles.value,
|
|
245
|
+
background: "var(--iris-surface)",
|
|
246
|
+
color: "var(--iris-foreground)",
|
|
247
|
+
border: "1px solid var(--iris-border)",
|
|
248
|
+
borderRadius: "var(--iris-radius-md)",
|
|
249
|
+
padding: "var(--iris-padding-md)",
|
|
250
|
+
boxShadow: "0 8px 24px -8px rgba(0, 0, 0, 0.16), 0 4px 8px -2px rgba(0, 0, 0, 0.08)",
|
|
251
|
+
fontSize: "14px",
|
|
252
|
+
zIndex: "1000",
|
|
253
|
+
outline: "none",
|
|
254
|
+
...attrs.style ?? {}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
slots.default?.()
|
|
223
258
|
);
|
|
224
259
|
return () => {
|
|
225
260
|
if (!ctx.open.value) return null;
|
|
226
|
-
const node =
|
|
261
|
+
const node = renderContent();
|
|
227
262
|
if (props.teleport === false) return node;
|
|
228
263
|
return h(Teleport, { to: props.teleport }, [node]);
|
|
229
264
|
};
|
|
@@ -2404,6 +2439,7 @@ var IrisSelect = defineComponent({
|
|
|
2404
2439
|
props: {
|
|
2405
2440
|
items: { type: Array, required: true },
|
|
2406
2441
|
modelValue: { type: null },
|
|
2442
|
+
defaultValue: { type: null, default: void 0 },
|
|
2407
2443
|
placeholder: { type: String, default: void 0 },
|
|
2408
2444
|
size: { type: String, default: "md" },
|
|
2409
2445
|
disabled: { type: Boolean, default: false },
|
|
@@ -2420,13 +2456,17 @@ var IrisSelect = defineComponent({
|
|
|
2420
2456
|
}
|
|
2421
2457
|
},
|
|
2422
2458
|
emits: {
|
|
2423
|
-
"update:modelValue": (_value) => true
|
|
2459
|
+
"update:modelValue": (_value) => true,
|
|
2460
|
+
valueChange: (_value) => true
|
|
2424
2461
|
},
|
|
2425
2462
|
setup(props, { slots, attrs, emit }) {
|
|
2426
2463
|
const { t } = useI18n();
|
|
2427
2464
|
const open = ref(false);
|
|
2465
|
+
const internalValue = ref(props.defaultValue);
|
|
2466
|
+
const controlled = computed(() => props.modelValue !== void 0);
|
|
2467
|
+
const currentValue = computed(() => controlled.value ? props.modelValue : internalValue.value);
|
|
2428
2468
|
const selectedItem = computed(
|
|
2429
|
-
() => props.items.find((item) => item.value ===
|
|
2469
|
+
() => props.items.find((item) => item.value === currentValue.value) ?? null
|
|
2430
2470
|
);
|
|
2431
2471
|
const triggerLabel = computed(() => {
|
|
2432
2472
|
const item = selectedItem.value;
|
|
@@ -2434,7 +2474,9 @@ var IrisSelect = defineComponent({
|
|
|
2434
2474
|
return item.label ?? String(item.value);
|
|
2435
2475
|
});
|
|
2436
2476
|
const onSelect = (item) => {
|
|
2477
|
+
if (!controlled.value) internalValue.value = item.value;
|
|
2437
2478
|
emit("update:modelValue", item.value);
|
|
2479
|
+
emit("valueChange", item.value);
|
|
2438
2480
|
open.value = false;
|
|
2439
2481
|
};
|
|
2440
2482
|
const sizeStyles = computed(() => {
|
|
@@ -2500,7 +2542,7 @@ var IrisSelect = defineComponent({
|
|
|
2500
2542
|
default: () => [
|
|
2501
2543
|
h(IrisPopoverTrigger, { asChild: true }, () => [
|
|
2502
2544
|
slots.trigger ? slots.trigger({
|
|
2503
|
-
value:
|
|
2545
|
+
value: currentValue.value,
|
|
2504
2546
|
label: triggerLabel.value,
|
|
2505
2547
|
open: open.value
|
|
2506
2548
|
}) : h(
|
|
@@ -2537,8 +2579,7 @@ var IrisSelect = defineComponent({
|
|
|
2537
2579
|
},
|
|
2538
2580
|
() => h(IrisList, {
|
|
2539
2581
|
items: props.items,
|
|
2540
|
-
modelValue:
|
|
2541
|
-
"onUpdate:modelValue": (v) => emit("update:modelValue", v),
|
|
2582
|
+
modelValue: currentValue.value,
|
|
2542
2583
|
onSelect,
|
|
2543
2584
|
ariaLabel: t("select.options")
|
|
2544
2585
|
})
|
|
@@ -2923,8 +2964,8 @@ var IrisSkeleton = defineComponent({
|
|
|
2923
2964
|
onMounted(installSkeletonStyles);
|
|
2924
2965
|
const style = computed(() => {
|
|
2925
2966
|
const w = props.width !== void 0 ? toCss(props.width) : defaultWidth(props.shape);
|
|
2926
|
-
const
|
|
2927
|
-
return { width: w, height:
|
|
2967
|
+
const h89 = props.height !== void 0 ? toCss(props.height) : defaultHeight(props.shape, props.width);
|
|
2968
|
+
return { width: w, height: h89 };
|
|
2928
2969
|
});
|
|
2929
2970
|
return () => h("div", {
|
|
2930
2971
|
...attrs,
|
|
@@ -5197,10 +5238,91 @@ var IrisVirtualScroll = defineComponent({
|
|
|
5197
5238
|
};
|
|
5198
5239
|
}
|
|
5199
5240
|
});
|
|
5241
|
+
|
|
5242
|
+
// src/primitives/table/controlProps.ts
|
|
5243
|
+
var tableControlProps = {
|
|
5244
|
+
selectable: {
|
|
5245
|
+
type: String,
|
|
5246
|
+
default: "none"
|
|
5247
|
+
},
|
|
5248
|
+
selection: {
|
|
5249
|
+
type: Array,
|
|
5250
|
+
default: void 0
|
|
5251
|
+
},
|
|
5252
|
+
defaultSelection: {
|
|
5253
|
+
type: Array,
|
|
5254
|
+
default: void 0
|
|
5255
|
+
},
|
|
5256
|
+
sort: {
|
|
5257
|
+
type: Object,
|
|
5258
|
+
default: void 0
|
|
5259
|
+
},
|
|
5260
|
+
defaultSort: {
|
|
5261
|
+
type: Object,
|
|
5262
|
+
default: void 0
|
|
5263
|
+
}
|
|
5264
|
+
};
|
|
5200
5265
|
function getCellValue(row, column) {
|
|
5201
5266
|
const key = column.dataIndex ?? column.key;
|
|
5202
5267
|
return row[key];
|
|
5203
5268
|
}
|
|
5269
|
+
|
|
5270
|
+
// src/primitives/table/useTableSort.ts
|
|
5271
|
+
function useTableSort(data, options) {
|
|
5272
|
+
const sortProp = computed(() => options.sort === void 0 ? void 0 : toValue(options.sort));
|
|
5273
|
+
const internalSortValue = ref(options.defaultSort ?? null);
|
|
5274
|
+
const sortState = computed({
|
|
5275
|
+
get: () => sortProp.value === void 0 ? internalSortValue.value : sortProp.value ?? null,
|
|
5276
|
+
set: (val) => {
|
|
5277
|
+
if (sortProp.value === void 0) internalSortValue.value = val;
|
|
5278
|
+
options.onSortChange?.(val);
|
|
5279
|
+
}
|
|
5280
|
+
});
|
|
5281
|
+
const sortComparator = computed(() => {
|
|
5282
|
+
const s = sortState.value;
|
|
5283
|
+
if (!s) return null;
|
|
5284
|
+
const col = toValue(options.leafColumns).find((c) => c.key === s.key);
|
|
5285
|
+
if (!col) return null;
|
|
5286
|
+
const dir = s.direction === "asc" ? 1 : -1;
|
|
5287
|
+
const sorter = col.sorter ?? ((a, b) => compareValues(getCellValue(a, col), getCellValue(b, col)));
|
|
5288
|
+
return (a, b) => sorter(a, b) * dir;
|
|
5289
|
+
});
|
|
5290
|
+
const sortedData = computed(() => {
|
|
5291
|
+
const compare = sortComparator.value;
|
|
5292
|
+
if (!compare) return data.value;
|
|
5293
|
+
return [...data.value].sort(compare);
|
|
5294
|
+
});
|
|
5295
|
+
function setSort(next) {
|
|
5296
|
+
if (sortProp.value === void 0) internalSortValue.value = next;
|
|
5297
|
+
options.onSortChange?.(next);
|
|
5298
|
+
}
|
|
5299
|
+
function cycleSort(col) {
|
|
5300
|
+
if (!col.sortable) return;
|
|
5301
|
+
const s = sortState.value;
|
|
5302
|
+
if (!s || s.key !== col.key) {
|
|
5303
|
+
setSort({ key: col.key, direction: "asc" });
|
|
5304
|
+
return;
|
|
5305
|
+
}
|
|
5306
|
+
if (s.direction === "asc") {
|
|
5307
|
+
setSort({ key: col.key, direction: "desc" });
|
|
5308
|
+
return;
|
|
5309
|
+
}
|
|
5310
|
+
setSort(null);
|
|
5311
|
+
}
|
|
5312
|
+
return {
|
|
5313
|
+
sortState,
|
|
5314
|
+
cycleSort,
|
|
5315
|
+
setSort,
|
|
5316
|
+
sortComparator,
|
|
5317
|
+
sortedData
|
|
5318
|
+
};
|
|
5319
|
+
}
|
|
5320
|
+
|
|
5321
|
+
// src/primitives/table/Table.ts
|
|
5322
|
+
function getCellValue2(row, column) {
|
|
5323
|
+
const key = column.dataIndex ?? column.key;
|
|
5324
|
+
return row[key];
|
|
5325
|
+
}
|
|
5204
5326
|
var SELECTION_COL_WIDTH = 40;
|
|
5205
5327
|
var EXPAND_COL_WIDTH = 40;
|
|
5206
5328
|
var DEFAULT_COL_WIDTH = 140;
|
|
@@ -5227,18 +5349,7 @@ var IrisTable = defineComponent({
|
|
|
5227
5349
|
required: true
|
|
5228
5350
|
},
|
|
5229
5351
|
rowKey: { type: String, default: "id" },
|
|
5230
|
-
|
|
5231
|
-
type: String,
|
|
5232
|
-
default: "none"
|
|
5233
|
-
},
|
|
5234
|
-
selection: {
|
|
5235
|
-
type: Array,
|
|
5236
|
-
default: void 0
|
|
5237
|
-
},
|
|
5238
|
-
sort: {
|
|
5239
|
-
type: Object,
|
|
5240
|
-
default: void 0
|
|
5241
|
-
},
|
|
5352
|
+
...tableControlProps,
|
|
5242
5353
|
striped: { type: Boolean, default: false },
|
|
5243
5354
|
bordered: { type: Boolean, default: true },
|
|
5244
5355
|
/** Enable per-column resize handles. Combine with `v-model:columnWidths` for persistence. */
|
|
@@ -5322,31 +5433,23 @@ var IrisTable = defineComponent({
|
|
|
5322
5433
|
() => grouped.value ? flattenLeafColumns(props.columns) : props.columns
|
|
5323
5434
|
);
|
|
5324
5435
|
const headerMatrix = computed(() => grouped.value ? buildHeaderMatrix(props.columns) : null);
|
|
5325
|
-
const
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5436
|
+
const {
|
|
5437
|
+
sortState: internalSort,
|
|
5438
|
+
cycleSort,
|
|
5439
|
+
sortComparator,
|
|
5440
|
+
sortedData: sortedRows
|
|
5441
|
+
} = useTableSort(
|
|
5442
|
+
computed(() => props.data ?? []),
|
|
5443
|
+
{
|
|
5444
|
+
leafColumns,
|
|
5445
|
+
sort: computed(() => props.sort),
|
|
5446
|
+
defaultSort: props.defaultSort,
|
|
5447
|
+
onSortChange: (next) => emit("update:sort", next)
|
|
5331
5448
|
}
|
|
5332
|
-
|
|
5333
|
-
const sortComparator = computed(() => {
|
|
5334
|
-
const state = internalSort.value;
|
|
5335
|
-
if (!state) return null;
|
|
5336
|
-
const column = leafColumns.value.find((c) => c.key === state.key);
|
|
5337
|
-
if (!column) return null;
|
|
5338
|
-
const dir = state.direction === "asc" ? 1 : -1;
|
|
5339
|
-
const sorter = column.sorter ?? ((a, b) => compareValues(getCellValue(a, column), getCellValue(b, column)));
|
|
5340
|
-
return (a, b) => sorter(a, b) * dir;
|
|
5341
|
-
});
|
|
5342
|
-
const sortedRows = computed(() => {
|
|
5343
|
-
const compare = sortComparator.value;
|
|
5344
|
-
if (!compare) return props.data ?? [];
|
|
5345
|
-
return [...props.data ?? []].sort(compare);
|
|
5346
|
-
});
|
|
5449
|
+
);
|
|
5347
5450
|
const selControlled = computed(() => props.selection !== void 0);
|
|
5348
5451
|
const selectionModel = createSelectionModel({
|
|
5349
|
-
defaultSelected: props.selection ?? [],
|
|
5452
|
+
defaultSelected: props.selection ?? props.defaultSelection ?? [],
|
|
5350
5453
|
onChange: (keys) => emit("update:selection", keys)
|
|
5351
5454
|
});
|
|
5352
5455
|
const selectedKeys = shallowRef(selectionModel.get());
|
|
@@ -5428,14 +5531,14 @@ var IrisTable = defineComponent({
|
|
|
5428
5531
|
const beginEdit = (row, column, rowIdent) => {
|
|
5429
5532
|
if (!column.editable) return;
|
|
5430
5533
|
editingCellId.value = cellId(rowIdent, column.key);
|
|
5431
|
-
const current =
|
|
5534
|
+
const current = getCellValue2(row, column);
|
|
5432
5535
|
editingDraft.value = current == null ? "" : String(current);
|
|
5433
5536
|
editError.value = null;
|
|
5434
5537
|
void nextTick(() => editorInputRef.value?.focus());
|
|
5435
5538
|
};
|
|
5436
5539
|
const commitEdit = (row, column, rowIndex) => {
|
|
5437
5540
|
if (editingCellId.value === null) return;
|
|
5438
|
-
const oldValue =
|
|
5541
|
+
const oldValue = getCellValue2(row, column);
|
|
5439
5542
|
const draft = editingDraft.value;
|
|
5440
5543
|
const newValue = column.editor === "number" ? draft === "" || Number.isNaN(Number(draft)) ? oldValue : Number(draft) : draft;
|
|
5441
5544
|
if (column.validate) {
|
|
@@ -5476,17 +5579,7 @@ var IrisTable = defineComponent({
|
|
|
5476
5579
|
emit("update:columnWidths", next);
|
|
5477
5580
|
};
|
|
5478
5581
|
const onHeaderClick = (column) => {
|
|
5479
|
-
|
|
5480
|
-
const current = internalSort.value;
|
|
5481
|
-
let next;
|
|
5482
|
-
if (!current || current.key !== column.key) {
|
|
5483
|
-
next = { key: column.key, direction: "asc" };
|
|
5484
|
-
} else if (current.direction === "asc") {
|
|
5485
|
-
next = { key: column.key, direction: "desc" };
|
|
5486
|
-
} else {
|
|
5487
|
-
next = null;
|
|
5488
|
-
}
|
|
5489
|
-
internalSort.value = next;
|
|
5582
|
+
cycleSort(column);
|
|
5490
5583
|
};
|
|
5491
5584
|
const sortIndicator = (col) => {
|
|
5492
5585
|
if (!col.sortable) return null;
|
|
@@ -6060,7 +6153,7 @@ var IrisTable = defineComponent({
|
|
|
6060
6153
|
)
|
|
6061
6154
|
] : input;
|
|
6062
6155
|
} else {
|
|
6063
|
-
content = cellSlot?.({ row, index, value:
|
|
6156
|
+
content = cellSlot?.({ row, index, value: getCellValue2(row, col) }) ?? String(getCellValue2(row, col) ?? "");
|
|
6064
6157
|
}
|
|
6065
6158
|
const treeIndent = treeMeta && ci === 0 ? h(
|
|
6066
6159
|
"span",
|
|
@@ -6306,7 +6399,7 @@ var IrisTable = defineComponent({
|
|
|
6306
6399
|
if (visibleColSet.value && !visibleColSet.value.has(ci)) continue;
|
|
6307
6400
|
const align = col.align ?? "left";
|
|
6308
6401
|
const op = col.summary;
|
|
6309
|
-
const value = op ? aggregate(bodyData.value, (r) =>
|
|
6402
|
+
const value = op ? aggregate(bodyData.value, (r) => getCellValue2(r, col), op) : null;
|
|
6310
6403
|
const summaryContent = op != null && value != null ? col.renderSummary ? col.renderSummary(value, bodyData.value) : String(value) : "";
|
|
6311
6404
|
summaryCells.push(
|
|
6312
6405
|
h(
|
|
@@ -6385,45 +6478,23 @@ var IrisTable = defineComponent({
|
|
|
6385
6478
|
};
|
|
6386
6479
|
}
|
|
6387
6480
|
});
|
|
6388
|
-
var FORMULA_LEAD = /^[=+\-@\t\r]/;
|
|
6389
|
-
function neutralizeFormula(text) {
|
|
6390
|
-
return FORMULA_LEAD.test(text) ? `'${text}` : text;
|
|
6391
|
-
}
|
|
6392
|
-
function csvCell(value) {
|
|
6393
|
-
if (value == null) return "";
|
|
6394
|
-
const isNumber = typeof value === "number" && Number.isFinite(value);
|
|
6395
|
-
const s = isNumber ? String(value) : neutralizeFormula(String(value));
|
|
6396
|
-
if (/[",\r\n]/.test(s)) {
|
|
6397
|
-
return `"${s.replace(/"/g, '""')}"`;
|
|
6398
|
-
}
|
|
6399
|
-
return s;
|
|
6400
|
-
}
|
|
6401
6481
|
function exportCsv(rows, columns) {
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
${body}` : header;
|
|
6482
|
+
return toCsv(
|
|
6483
|
+
rows,
|
|
6484
|
+
columns.map((column) => ({
|
|
6485
|
+
key: column.key,
|
|
6486
|
+
title: column.title,
|
|
6487
|
+
dataIndex: typeof column.dataIndex === "string" ? column.dataIndex : void 0
|
|
6488
|
+
}))
|
|
6489
|
+
);
|
|
6411
6490
|
}
|
|
6412
6491
|
async function downloadCsv(filename, csv) {
|
|
6413
6492
|
const BOM = String.fromCharCode(65279);
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
const anchor = document.createElement("a");
|
|
6420
|
-
anchor.href = url;
|
|
6421
|
-
anchor.download = filename;
|
|
6422
|
-
anchor.style.display = "none";
|
|
6423
|
-
document.body.appendChild(anchor);
|
|
6424
|
-
anchor.click();
|
|
6425
|
-
document.body.removeChild(anchor);
|
|
6426
|
-
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
6493
|
+
await downloadFile({
|
|
6494
|
+
filename,
|
|
6495
|
+
content: BOM + csv,
|
|
6496
|
+
mimeType: "text/csv;charset=utf-8;"
|
|
6497
|
+
});
|
|
6427
6498
|
}
|
|
6428
6499
|
function exportExcel(rows, columns, options) {
|
|
6429
6500
|
return toSpreadsheetXml(
|
|
@@ -6437,20 +6508,11 @@ function exportExcel(rows, columns, options) {
|
|
|
6437
6508
|
);
|
|
6438
6509
|
}
|
|
6439
6510
|
async function downloadExcel(filename, xml) {
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
const url = URL.createObjectURL(blob);
|
|
6446
|
-
const anchor = document.createElement("a");
|
|
6447
|
-
anchor.href = url;
|
|
6448
|
-
anchor.download = filename;
|
|
6449
|
-
anchor.style.display = "none";
|
|
6450
|
-
document.body.appendChild(anchor);
|
|
6451
|
-
anchor.click();
|
|
6452
|
-
document.body.removeChild(anchor);
|
|
6453
|
-
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
6511
|
+
await downloadFile({
|
|
6512
|
+
filename,
|
|
6513
|
+
content: xml,
|
|
6514
|
+
mimeType: "application/vnd.ms-excel;charset=utf-8"
|
|
6515
|
+
});
|
|
6454
6516
|
}
|
|
6455
6517
|
|
|
6456
6518
|
// src/primitives/tabs/context.ts
|
|
@@ -12842,12 +12904,12 @@ function defaultFilter(query, item) {
|
|
|
12842
12904
|
if (!q) return 0;
|
|
12843
12905
|
const haystacks = [item.label, ...item.keywords ?? []].map((s) => s.toLowerCase());
|
|
12844
12906
|
let best = null;
|
|
12845
|
-
for (const
|
|
12907
|
+
for (const h89 of haystacks) {
|
|
12846
12908
|
let qi = 0;
|
|
12847
12909
|
let lastIdx = -1;
|
|
12848
12910
|
let score = 0;
|
|
12849
|
-
for (let i = 0; i <
|
|
12850
|
-
if (
|
|
12911
|
+
for (let i = 0; i < h89.length && qi < q.length; i += 1) {
|
|
12912
|
+
if (h89[i] === q[qi]) {
|
|
12851
12913
|
score += lastIdx === -1 ? i : i - lastIdx - 1;
|
|
12852
12914
|
lastIdx = i;
|
|
12853
12915
|
qi += 1;
|
|
@@ -13520,6 +13582,6 @@ var IrisDateRangePicker = defineComponent({
|
|
|
13520
13582
|
}
|
|
13521
13583
|
});
|
|
13522
13584
|
|
|
13523
|
-
export { AccordionContextKey, DialogContextKey, DrawerContextKey, IrisAccordion, IrisAccordionItem, IrisAffix, IrisAnchor, IrisAspectRatio, IrisAvatar, IrisBackTop, IrisBadge, IrisBanner, IrisCalendar, IrisCard, IrisCarousel, IrisCascader, IrisChip, IrisColorPicker, IrisCombobox, IrisCommandPalette, IrisCopyButton, IrisCountdown, IrisDatePicker, IrisDateRangePicker, IrisDescriptions, IrisDialog, IrisDialogClose, IrisDialogContent, IrisDialogDescription, IrisDialogTitle, IrisDialogTrigger, IrisDragger, IrisDrawer, IrisDrawerClose, IrisDrawerContent, IrisDrawerTitle, IrisDrawerTrigger, IrisEmptyState, IrisFieldset, IrisFileUpload, IrisFloatButton, IrisGauge, IrisImage, IrisKbd, IrisList, IrisMarquee, IrisMasonry, IrisMentions, IrisMenu, IrisMenuContent, IrisMenuItem, IrisMenuSeparator, IrisMenuSub, IrisMenuTrigger, IrisNumberInput, IrisOtpInput, IrisPagination, IrisPopover, IrisPopoverContent, IrisPopoverTrigger, IrisProgress, IrisProgressCircle, IrisRadio, IrisRadioGroup, IrisRangeSlider, IrisRating, IrisResizer, IrisResult, IrisRibbon, IrisScrollArea, IrisSegmented, IrisSelect, IrisSkeleton, IrisSlider, IrisSpinner, IrisSplitButton, IrisSplitter, IrisStatistic, IrisStepper, IrisStepperStep, IrisSwitch, IrisTable, IrisTabs, IrisTabsContent, IrisTabsList, IrisTabsTrigger, IrisTagInput, IrisTextarea, IrisTimePicker, IrisTimeline, IrisToastViewport, IrisToggleGroup, IrisToggleGroupItem, IrisToolbar, IrisTooltip, IrisTour, IrisTransfer, IrisTree, IrisTreeSelect, IrisVirtualScroll, IrisVisuallyHidden, IrisWatermark, MenuContextKey, PopoverContextKey, StepperContextKey, TabsContextKey, ToggleGroupContextKey, __PROGRESS_STYLE_ID, __SKELETON_STYLE_ID, __SPINNER_STYLE_ID, __resetProgressStyles, __resetSkeletonStyles, __resetSpinnerStyles, clearToasts, defaultFilter, dismissToast, downloadCsv, downloadExcel, exportCsv, exportExcel, formatBytes, formatRemaining, getToasts, pushToast, subscribeToasts, useToast };
|
|
13585
|
+
export { AccordionContextKey, DialogContextKey, DrawerContextKey, IrisAccordion, IrisAccordionItem, IrisAffix, IrisAnchor, IrisAspectRatio, IrisAvatar, IrisBackTop, IrisBadge, IrisBanner, IrisCalendar, IrisCard, IrisCarousel, IrisCascader, IrisChip, IrisColorPicker, IrisCombobox, IrisCommandPalette, IrisCopyButton, IrisCountdown, IrisDatePicker, IrisDateRangePicker, IrisDescriptions, IrisDialog, IrisDialogClose, IrisDialogContent, IrisDialogDescription, IrisDialogTitle, IrisDialogTrigger, IrisDragger, IrisDrawer, IrisDrawerClose, IrisDrawerContent, IrisDrawerTitle, IrisDrawerTrigger, IrisEmptyState, IrisFieldset, IrisFileUpload, IrisFloatButton, IrisGauge, IrisImage, IrisKbd, IrisList, IrisMarquee, IrisMasonry, IrisMentions, IrisMenu, IrisMenuContent, IrisMenuItem, IrisMenuSeparator, IrisMenuSub, IrisMenuTrigger, IrisNumberInput, IrisOtpInput, IrisPagination, IrisPopover, IrisPopoverContent, IrisPopoverTrigger, IrisProgress, IrisProgressCircle, IrisRadio, IrisRadioGroup, IrisRangeSlider, IrisRating, IrisResizer, IrisResult, IrisRibbon, IrisScrollArea, IrisSegmented, IrisSelect, IrisSkeleton, IrisSlider, IrisSpinner, IrisSplitButton, IrisSplitter, IrisStatistic, IrisStepper, IrisStepperStep, IrisSwitch, IrisTable, IrisTabs, IrisTabsContent, IrisTabsList, IrisTabsTrigger, IrisTagInput, IrisTextarea, IrisTimePicker, IrisTimeline, IrisToastViewport, IrisToggleGroup, IrisToggleGroupItem, IrisToolbar, IrisTooltip, IrisTour, IrisTransfer, IrisTree, IrisTreeSelect, IrisVirtualScroll, IrisVisuallyHidden, IrisWatermark, MenuContextKey, PopoverContextKey, StepperContextKey, TabsContextKey, ToggleGroupContextKey, __PROGRESS_STYLE_ID, __SKELETON_STYLE_ID, __SPINNER_STYLE_ID, __resetProgressStyles, __resetSkeletonStyles, __resetSpinnerStyles, clearToasts, defaultFilter, dismissToast, downloadCsv, downloadExcel, exportCsv, exportExcel, formatBytes, formatRemaining, getToasts, pushToast, subscribeToasts, useDisposableScope, useReconnectingSource, useResilientFetcher, useToast };
|
|
13524
13586
|
//# sourceMappingURL=index.js.map
|
|
13525
13587
|
//# sourceMappingURL=index.js.map
|