kui-vue 5.3.1 → 5.4.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/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * kui-vue v5.3.1
2
+ * kui-vue v5.4.1
3
3
  * Copyright 2017-present, kui-vue.
4
4
  * All rights reserved.
5
5
  * Homepage: https://k-ui.cn
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import zh_CN_default from "./locale/zh-CN.js";
10
- import { Comment, Fragment, Text, Transition, TransitionGroup, cloneVNode, computed, createTextVNode, createVNode, defineComponent, getCurrentInstance, h, inject, isVNode, mergeProps, nextTick, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, onUpdated, provide, reactive, readonly, ref, render, resolveDirective, toRefs, vShow, watch, withDirectives } from "vue";
10
+ import { Comment, Fragment, Teleport, Text, Transition, TransitionGroup, cloneVNode, computed, createTextVNode, createVNode, defineComponent, getCurrentInstance, h, inject, isVNode, mergeProps, nextTick, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, onUpdated, provide, reactive, readonly, ref, render, resolveDirective, toRefs, vShow, watch, withDirectives } from "vue";
11
11
  import dayjs from "dayjs";
12
12
  //#region \0rolldown/runtime.js
13
13
  var __create = Object.create;
@@ -313,6 +313,10 @@ var Star = [{
313
313
  d: "M11.5 2.25A0.5 0.5 0 0 1 12.5 2.25L14.75 7A2 2 0 0 0 16.5 8.25L21.5 9A0.5 0.5 0 0 1 21.75 9.75L18 13.5A2 2 0 0 0 17.5 15.25L18.5 20.5A0.5 0.5 0 0 1 17.5 21L13 18.5A2 2 0 0 0 11 18.5L6.5 21A0.5 0.5 0 0 1 5.75 20.5L6.5 15.25A2 2 0 0 0 6 13.5L2.25 9.75A0.5 0.5 0 0 1 2.5 9L7.5 8.25A2 2 0 0 0 9.25 7z",
314
314
  s: "fill:none;stroke:currentcolor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
315
315
  }];
316
+ var Triangle = [{
317
+ d: "M13.75 4A2 2 0 0 0 10.25 4L2.25 18A2 2 0 0 0 4 21H20A2 2 0 0 0 21.75 18z",
318
+ s: "fill:none;stroke:currentcolor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
319
+ }];
316
320
  var X = [{
317
321
  d: "M18 6L6 18 M6 6L18 18",
318
322
  s: "fill:none;stroke:currentcolor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
@@ -1104,6 +1108,418 @@ var ButtonGroup = /* @__PURE__ */ defineComponent({
1104
1108
  }
1105
1109
  });
1106
1110
  //#endregion
1111
+ //#region components/empty/index.tsx
1112
+ var Empty = /* @__PURE__ */ defineComponent({
1113
+ name: "Empty",
1114
+ props: {
1115
+ description: {
1116
+ type: [String, Boolean],
1117
+ default: null
1118
+ },
1119
+ image: String,
1120
+ imageStyle: Object
1121
+ },
1122
+ setup(props, { slots, attrs }) {
1123
+ const injectedLocale = inject("locale", zh_CN_default);
1124
+ const locale = computed(() => {
1125
+ return injectedLocale instanceof Object && "value" in injectedLocale ? injectedLocale.value : injectedLocale;
1126
+ });
1127
+ return () => {
1128
+ const { image, imageStyle, description } = props;
1129
+ return createVNode("div", {
1130
+ ...attrs,
1131
+ class: "k-empty"
1132
+ }, [createVNode("div", { "class": "k-empty-content" }, [
1133
+ (() => {
1134
+ if (!image && !slots.image) return createVNode(Icon, {
1135
+ "type": Inbox,
1136
+ "class": "k-empty-icon",
1137
+ "strokeWidth": "0.01em"
1138
+ }, null);
1139
+ else if (slots.image) return slots.image();
1140
+ else return createVNode("img", {
1141
+ src: image,
1142
+ class: "k-empty-image",
1143
+ style: imageStyle,
1144
+ alt: description || locale.value?.k.empty.description || "Empty state image"
1145
+ }, null);
1146
+ })(),
1147
+ description !== false ? createVNode("p", { "class": "k-empty-description" }, [description || slots.description?.() || locale.value?.k.empty.description]) : null,
1148
+ slots.default ? createVNode("div", { "class": "k-empty-footer" }, [slots.default()]) : null
1149
+ ])]);
1150
+ };
1151
+ }
1152
+ });
1153
+ //#endregion
1154
+ //#region components/utils/placement.ts
1155
+ function setPlacement({ refSelection, refPopper, currentPlacement, position = null, transOrigin, top, left, offset = 3 }) {
1156
+ if (!refPopper.value) return;
1157
+ let rect = null;
1158
+ const isMouseMode = position && typeof position.x === "number" && typeof position.y === "number";
1159
+ if (isMouseMode) rect = {
1160
+ width: 0,
1161
+ height: 0,
1162
+ top: position.y,
1163
+ bottom: position.y,
1164
+ left: position.x,
1165
+ right: position.x
1166
+ };
1167
+ else if (refSelection?.value) {
1168
+ const instance = refSelection.value;
1169
+ rect = (instance.$el || instance).getBoundingClientRect?.();
1170
+ } else return;
1171
+ const pickerH = refPopper.value.offsetHeight;
1172
+ const pickerW = refPopper.value.offsetWidth;
1173
+ const { clientHeight, clientWidth, scrollTop, scrollLeft } = document.documentElement;
1174
+ const centerLeft = rect.left + rect.width / 2 - pickerW / 2;
1175
+ const centerTop = rect.top + rect.height / 2 - pickerH / 2;
1176
+ const check = {
1177
+ top: rect.top > pickerH + offset,
1178
+ bottom: clientHeight - rect.bottom > pickerH + offset,
1179
+ left: rect.left > pickerW + offset,
1180
+ right: clientWidth - rect.right > pickerW + offset,
1181
+ alignLeft: clientWidth - rect.left > pickerW,
1182
+ alignRight: rect.right > pickerW,
1183
+ alignTop: clientHeight - rect.top > pickerH,
1184
+ alignBottom: rect.bottom > pickerH,
1185
+ centerH: centerLeft > 0 && centerLeft + pickerW < clientWidth,
1186
+ centerV: centerTop > 0 && centerTop + pickerH < clientHeight
1187
+ };
1188
+ let [side, align] = currentPlacement.value.split("-");
1189
+ if (isMouseMode && !align) {
1190
+ if (side === "top" || side === "bottom") align = "left";
1191
+ else if (side === "left" || side === "right") align = "top";
1192
+ }
1193
+ if (side === "top" && !check.top && check.bottom) side = "bottom";
1194
+ else if (side === "bottom" && !check.bottom && check.top) side = "top";
1195
+ else if (side === "left" && !check.left && check.right) side = "right";
1196
+ else if (side === "right" && !check.right && check.left) side = "left";
1197
+ if (side === "top" || side === "bottom") {
1198
+ if (align === "left" && !check.alignLeft && check.alignRight) align = "right";
1199
+ else if (align === "right" && !check.alignRight && check.alignLeft) align = "left";
1200
+ else if (!align && !check.centerH) {
1201
+ if (check.alignLeft) align = "left";
1202
+ else if (check.alignRight) align = "right";
1203
+ }
1204
+ } else if (side === "left" || side === "right") {
1205
+ if (align === "top" && !check.alignTop && check.alignBottom) align = "bottom";
1206
+ else if (align === "bottom" && !check.alignBottom && check.alignTop) align = "top";
1207
+ else if (!align && !check.centerV) {
1208
+ if (check.alignTop) align = "top";
1209
+ else if (check.alignBottom) align = "bottom";
1210
+ }
1211
+ }
1212
+ const finalPlacement = align ? `${side}-${align}` : side;
1213
+ let calcTop = 0;
1214
+ let calcLeft = 0;
1215
+ let originX = "center";
1216
+ let originY = "center";
1217
+ if (side === "top") {
1218
+ calcTop = rect.top - pickerH - offset;
1219
+ originY = "bottom";
1220
+ } else if (side === "bottom") {
1221
+ calcTop = rect.bottom + offset;
1222
+ originY = "top";
1223
+ } else if (align === "top") {
1224
+ calcTop = rect.top;
1225
+ originY = "top";
1226
+ } else if (align === "bottom") {
1227
+ calcTop = rect.bottom - pickerH;
1228
+ originY = "bottom";
1229
+ } else {
1230
+ calcTop = rect.top + (rect.height - pickerH) / 2;
1231
+ originY = "center";
1232
+ }
1233
+ if (side === "left") {
1234
+ calcLeft = rect.left - pickerW - offset;
1235
+ originX = "right";
1236
+ } else if (side === "right") {
1237
+ calcLeft = rect.right + offset;
1238
+ originX = "left";
1239
+ } else if (align === "left") {
1240
+ calcLeft = rect.left;
1241
+ originX = "left";
1242
+ } else if (align === "right") {
1243
+ calcLeft = rect.right - pickerW;
1244
+ originX = "right";
1245
+ } else {
1246
+ calcLeft = rect.left + (rect.width - pickerW) / 2;
1247
+ originX = "center";
1248
+ }
1249
+ if (calcLeft < 0) calcLeft = 0;
1250
+ else if (calcLeft + pickerW > clientWidth) calcLeft = clientWidth - pickerW;
1251
+ if (calcTop < 0) calcTop = 0;
1252
+ else if (calcTop + pickerH > clientHeight) calcTop = clientHeight - pickerH;
1253
+ top.value = calcTop + scrollTop;
1254
+ left.value = calcLeft + scrollLeft;
1255
+ transOrigin.value = `${originX} ${originY}`;
1256
+ if (currentPlacement.value !== finalPlacement) currentPlacement.value = finalPlacement;
1257
+ }
1258
+ //#endregion
1259
+ //#region components/cascader/index.tsx
1260
+ var Cascader = /* @__PURE__ */ defineComponent({
1261
+ name: "Cascader",
1262
+ props: {
1263
+ modelValue: {
1264
+ type: Array,
1265
+ default: () => []
1266
+ },
1267
+ options: {
1268
+ type: Array,
1269
+ default: () => []
1270
+ },
1271
+ theme: {
1272
+ type: String,
1273
+ default: "fill"
1274
+ },
1275
+ bordered: {
1276
+ type: Boolean,
1277
+ default: true
1278
+ },
1279
+ shape: String,
1280
+ showArrow: {
1281
+ type: Boolean,
1282
+ default: true
1283
+ },
1284
+ placeholder: {
1285
+ type: String,
1286
+ default: ""
1287
+ },
1288
+ icon: [Array],
1289
+ arrowIcon: [Array],
1290
+ emptyText: String,
1291
+ disabled: Boolean,
1292
+ clearable: {
1293
+ type: Boolean,
1294
+ default: true
1295
+ },
1296
+ size: String,
1297
+ expandTrigger: {
1298
+ type: String,
1299
+ default: "click"
1300
+ },
1301
+ showAllLevels: {
1302
+ type: Boolean,
1303
+ default: true
1304
+ },
1305
+ separator: {
1306
+ type: String,
1307
+ default: " / "
1308
+ },
1309
+ placement: {
1310
+ type: String,
1311
+ default: "bottom-left"
1312
+ }
1313
+ },
1314
+ emits: [
1315
+ "update:modelValue",
1316
+ "change",
1317
+ "openChange"
1318
+ ],
1319
+ setup(props, { emit }) {
1320
+ const visible = ref(false);
1321
+ const rendered = ref(false);
1322
+ const refSelection = ref(null);
1323
+ const refPopper = ref(null);
1324
+ const currentPlacement = ref(props.placement);
1325
+ const transOrigin = ref("top");
1326
+ const left = ref(0);
1327
+ const top = ref(0);
1328
+ const minWidth = ref(0);
1329
+ const activePath = ref([]);
1330
+ watch(() => props.modelValue, (newVal) => {
1331
+ if (newVal && newVal.length > 0) {
1332
+ const path = [];
1333
+ let currentOptions = props.options;
1334
+ for (const val of newVal) {
1335
+ const target = currentOptions.find((o) => o.value === val);
1336
+ if (target) {
1337
+ path.push(target);
1338
+ currentOptions = target.children || [];
1339
+ } else break;
1340
+ }
1341
+ activePath.value = path;
1342
+ } else activePath.value = [];
1343
+ }, {
1344
+ immediate: true,
1345
+ deep: true
1346
+ });
1347
+ const menus = computed(() => {
1348
+ const result = [props.options];
1349
+ for (let i = 0; i < activePath.value.length; i++) {
1350
+ const option = activePath.value[i];
1351
+ if (option.children && option.children.length > 0) result.push(option.children);
1352
+ else break;
1353
+ }
1354
+ return result;
1355
+ });
1356
+ const displayLabel = computed(() => {
1357
+ if (!props.modelValue || props.modelValue.length === 0) return "";
1358
+ const labels = [];
1359
+ let currentOptions = props.options;
1360
+ for (const val of props.modelValue) {
1361
+ const match = currentOptions.find((o) => o.value === val);
1362
+ if (match) {
1363
+ labels.push(match.label);
1364
+ currentOptions = match.children || [];
1365
+ } else labels.push(String(val));
1366
+ }
1367
+ return props.showAllLevels ? labels.join(props.separator) : labels[labels.length - 1];
1368
+ });
1369
+ const updatePosition = () => {
1370
+ nextTick(() => {
1371
+ minWidth.value = refSelection.value?.offsetWidth || 0;
1372
+ setPlacement({
1373
+ refSelection,
1374
+ refPopper,
1375
+ currentPlacement,
1376
+ transOrigin,
1377
+ top,
1378
+ left
1379
+ });
1380
+ });
1381
+ };
1382
+ const toggleMenu = (show = null) => {
1383
+ if (props.disabled) return;
1384
+ const isFirstRender = !rendered.value;
1385
+ if (isFirstRender) {
1386
+ rendered.value = true;
1387
+ document.addEventListener("click", outsideClick);
1388
+ }
1389
+ if (show !== null ? show : !visible.value) if (isFirstRender) nextTick(() => {
1390
+ visible.value = true;
1391
+ emit("openChange", true);
1392
+ nextTick(() => updatePosition());
1393
+ });
1394
+ else {
1395
+ visible.value = true;
1396
+ emit("openChange", true);
1397
+ nextTick(() => updatePosition());
1398
+ }
1399
+ else {
1400
+ visible.value = false;
1401
+ emit("openChange", false);
1402
+ }
1403
+ };
1404
+ const outsideClick = (e) => {
1405
+ const selectionEl = refSelection.value;
1406
+ const popperEl = refPopper.value;
1407
+ if (selectionEl && !selectionEl.contains(e.target) && popperEl && !popperEl.contains(e.target)) {
1408
+ visible.value = false;
1409
+ emit("openChange", false);
1410
+ }
1411
+ };
1412
+ onBeforeUnmount(() => {
1413
+ document.removeEventListener("click", outsideClick);
1414
+ });
1415
+ const handleOptionClick = (option, columnIndex, isHoverTrigger = false) => {
1416
+ if (option.disabled) return;
1417
+ const nextPath = activePath.value.slice(0, columnIndex);
1418
+ nextPath[columnIndex] = option;
1419
+ activePath.value = nextPath;
1420
+ if (!(option.children && option.children.length > 0) && !isHoverTrigger) {
1421
+ const finalValue = activePath.value.map((item) => item.value);
1422
+ emit("update:modelValue", finalValue);
1423
+ emit("change", finalValue);
1424
+ visible.value = false;
1425
+ emit("openChange", false);
1426
+ } else updatePosition();
1427
+ };
1428
+ const handleClear = (e) => {
1429
+ e.stopPropagation();
1430
+ emit("update:modelValue", []);
1431
+ emit("change", []);
1432
+ activePath.value = [];
1433
+ updatePosition();
1434
+ };
1435
+ const renderDropdown = () => {
1436
+ if (!rendered.value) return null;
1437
+ const popperProps = {
1438
+ ref: refPopper,
1439
+ style: {
1440
+ left: `${left.value}px`,
1441
+ top: `${top.value}px`,
1442
+ transformOrigin: transOrigin.value
1443
+ },
1444
+ class: ["k-cascader-dropdown", { "k-cascader-dropdown-sm": props.size === "small" }]
1445
+ };
1446
+ const isEmpty = !props.options || props.options.length === 0;
1447
+ return createVNode(Teleport, { "to": "body" }, { default: () => [createVNode(Transition, {
1448
+ "name": "k-cascader",
1449
+ "appear": true
1450
+ }, { default: () => [visible.value && createVNode("div", popperProps, [isEmpty ? createVNode(Empty, null, null) : createVNode("div", { "class": "k-cascader-dropdown-menus" }, [menus.value.map((menuItems, columnIndex) => createVNode("ul", {
1451
+ "class": "k-cascader-dropdown-menu k-scroll",
1452
+ "key": columnIndex
1453
+ }, [menuItems.map((item) => {
1454
+ const isActive = activePath.value[columnIndex]?.value === item.value;
1455
+ const isSelected = props.modelValue[columnIndex] === item.value;
1456
+ const hasChildren = item.children && item.children.length > 0;
1457
+ return createVNode("li", {
1458
+ "class": ["k-cascader-dropdown-item", {
1459
+ "k-cascader-dropdown-item-active": isActive,
1460
+ "k-cascader-dropdown-item-selected": isSelected,
1461
+ "k-cascader-dropdown-item-disabled": item.disabled
1462
+ }],
1463
+ "key": item.value,
1464
+ "onClick": () => handleOptionClick(item, columnIndex, false),
1465
+ "onMouseenter": () => {
1466
+ if (props.expandTrigger === "hover" && hasChildren) handleOptionClick(item, columnIndex, true);
1467
+ }
1468
+ }, [createVNode("span", null, [item.label]), hasChildren && createVNode(Icon, {
1469
+ "class": "k-cascader-item-arrow",
1470
+ "type": ChevronRight
1471
+ }, null)]);
1472
+ })]))])])] })] });
1473
+ };
1474
+ return () => {
1475
+ const { disabled, showArrow, size, placeholder, clearable, theme, bordered, arrowIcon, shape, icon } = props;
1476
+ const hasValue = props.modelValue && props.modelValue.length > 0;
1477
+ const showClear = clearable && !disabled && hasValue;
1478
+ const rootClasses = ["k-cascader", {
1479
+ "k-cascader-disabled": disabled,
1480
+ "k-cascader-opened": visible.value,
1481
+ "k-cascader-borderless": bordered === false,
1482
+ "k-cascader-circle": shape === "circle",
1483
+ "k-cascader-square": shape === "square",
1484
+ "k-cascader-fill": theme === "fill",
1485
+ "k-cascader-lg": size === "large",
1486
+ "k-cascader-sm": size === "small",
1487
+ "k-cascader-has-clear": showClear
1488
+ }];
1489
+ const arrowNode = showArrow ? createVNode(Icon, {
1490
+ "class": "k-cascader-arrow",
1491
+ "type": arrowIcon || ChevronDown,
1492
+ "style": { transform: visible.value ? "rotate(180deg)" : "rotate(0deg)" }
1493
+ }, null) : null;
1494
+ return createVNode("div", {
1495
+ "ref": refSelection,
1496
+ "class": rootClasses,
1497
+ "tabindex": disabled ? void 0 : 0,
1498
+ "onClick": () => toggleMenu()
1499
+ }, [
1500
+ icon ? createVNode(Icon, {
1501
+ "type": icon,
1502
+ "class": "k-cascader-icon"
1503
+ }, null) : null,
1504
+ createVNode("div", { "class": "k-cascader-selection" }, [hasValue ? createVNode("div", {
1505
+ "class": "k-cascader-label",
1506
+ "key": "label"
1507
+ }, [displayLabel.value]) : createVNode("div", {
1508
+ "class": "k-cascader-placeholder",
1509
+ "key": "placeholder"
1510
+ }, [placeholder || "请选择"])]),
1511
+ arrowNode,
1512
+ showClear && createVNode(Icon, {
1513
+ "class": "k-cascader-clearable",
1514
+ "onClick": handleClear,
1515
+ "type": CircleX
1516
+ }, null),
1517
+ renderDropdown()
1518
+ ]);
1519
+ };
1520
+ }
1521
+ });
1522
+ //#endregion
1107
1523
  //#region components/card/index.tsx
1108
1524
  var Card = /* @__PURE__ */ defineComponent({
1109
1525
  name: "Card",
@@ -1593,7 +2009,7 @@ var CollapsePanel = /* @__PURE__ */ defineComponent({
1593
2009
  }
1594
2010
  });
1595
2011
  //#endregion
1596
- //#region node_modules/.pnpm/color-name@2.1.0/node_modules/color-name/index.js
2012
+ //#region node_modules/.pnpm/color-name@2.1.1/node_modules/color-name/index.js
1597
2013
  var colors = {
1598
2014
  aliceblue: [
1599
2015
  240,
@@ -3796,111 +4212,6 @@ var transfer = {
3796
4212
  }
3797
4213
  };
3798
4214
  //#endregion
3799
- //#region components/utils/placement.ts
3800
- function setPlacement({ refSelection, refPopper, currentPlacement, position = null, transOrigin, top, left, offset = 3 }) {
3801
- if (!refPopper.value) return;
3802
- let rect = null;
3803
- const isMouseMode = position && typeof position.x === "number" && typeof position.y === "number";
3804
- if (isMouseMode) rect = {
3805
- width: 0,
3806
- height: 0,
3807
- top: position.y,
3808
- bottom: position.y,
3809
- left: position.x,
3810
- right: position.x
3811
- };
3812
- else if (refSelection?.value) {
3813
- const instance = refSelection.value;
3814
- rect = (instance.$el || instance).getBoundingClientRect?.();
3815
- } else return;
3816
- const pickerH = refPopper.value.offsetHeight;
3817
- const pickerW = refPopper.value.offsetWidth;
3818
- const { clientHeight, clientWidth, scrollTop, scrollLeft } = document.documentElement;
3819
- const centerLeft = rect.left + rect.width / 2 - pickerW / 2;
3820
- const centerTop = rect.top + rect.height / 2 - pickerH / 2;
3821
- const check = {
3822
- top: rect.top > pickerH + offset,
3823
- bottom: clientHeight - rect.bottom > pickerH + offset,
3824
- left: rect.left > pickerW + offset,
3825
- right: clientWidth - rect.right > pickerW + offset,
3826
- alignLeft: clientWidth - rect.left > pickerW,
3827
- alignRight: rect.right > pickerW,
3828
- alignTop: clientHeight - rect.top > pickerH,
3829
- alignBottom: rect.bottom > pickerH,
3830
- centerH: centerLeft > 0 && centerLeft + pickerW < clientWidth,
3831
- centerV: centerTop > 0 && centerTop + pickerH < clientHeight
3832
- };
3833
- let [side, align] = currentPlacement.value.split("-");
3834
- if (isMouseMode && !align) {
3835
- if (side === "top" || side === "bottom") align = "left";
3836
- else if (side === "left" || side === "right") align = "top";
3837
- }
3838
- if (side === "top" && !check.top && check.bottom) side = "bottom";
3839
- else if (side === "bottom" && !check.bottom && check.top) side = "top";
3840
- else if (side === "left" && !check.left && check.right) side = "right";
3841
- else if (side === "right" && !check.right && check.left) side = "left";
3842
- if (side === "top" || side === "bottom") {
3843
- if (align === "left" && !check.alignLeft && check.alignRight) align = "right";
3844
- else if (align === "right" && !check.alignRight && check.alignLeft) align = "left";
3845
- else if (!align && !check.centerH) {
3846
- if (check.alignLeft) align = "left";
3847
- else if (check.alignRight) align = "right";
3848
- }
3849
- } else if (side === "left" || side === "right") {
3850
- if (align === "top" && !check.alignTop && check.alignBottom) align = "bottom";
3851
- else if (align === "bottom" && !check.alignBottom && check.alignTop) align = "top";
3852
- else if (!align && !check.centerV) {
3853
- if (check.alignTop) align = "top";
3854
- else if (check.alignBottom) align = "bottom";
3855
- }
3856
- }
3857
- const finalPlacement = align ? `${side}-${align}` : side;
3858
- let calcTop = 0;
3859
- let calcLeft = 0;
3860
- let originX = "center";
3861
- let originY = "center";
3862
- if (side === "top") {
3863
- calcTop = rect.top - pickerH - offset;
3864
- originY = "bottom";
3865
- } else if (side === "bottom") {
3866
- calcTop = rect.bottom + offset;
3867
- originY = "top";
3868
- } else if (align === "top") {
3869
- calcTop = rect.top;
3870
- originY = "top";
3871
- } else if (align === "bottom") {
3872
- calcTop = rect.bottom - pickerH;
3873
- originY = "bottom";
3874
- } else {
3875
- calcTop = rect.top + (rect.height - pickerH) / 2;
3876
- originY = "center";
3877
- }
3878
- if (side === "left") {
3879
- calcLeft = rect.left - pickerW - offset;
3880
- originX = "right";
3881
- } else if (side === "right") {
3882
- calcLeft = rect.right + offset;
3883
- originX = "left";
3884
- } else if (align === "left") {
3885
- calcLeft = rect.left;
3886
- originX = "left";
3887
- } else if (align === "right") {
3888
- calcLeft = rect.right - pickerW;
3889
- originX = "right";
3890
- } else {
3891
- calcLeft = rect.left + (rect.width - pickerW) / 2;
3892
- originX = "center";
3893
- }
3894
- if (calcLeft < 0) calcLeft = 0;
3895
- else if (calcLeft + pickerW > clientWidth) calcLeft = clientWidth - pickerW;
3896
- if (calcTop < 0) calcTop = 0;
3897
- else if (calcTop + pickerH > clientHeight) calcTop = clientHeight - pickerH;
3898
- top.value = calcTop + scrollTop;
3899
- left.value = calcLeft + scrollLeft;
3900
- transOrigin.value = `${originX} ${originY}`;
3901
- if (currentPlacement.value !== finalPlacement) currentPlacement.value = finalPlacement;
3902
- }
3903
- //#endregion
3904
4215
  //#region components/utils/share.ts
3905
4216
  var clamp = (n, min, max) => Math.min(max, Math.max(min, n));
3906
4217
  //#endregion
@@ -5082,46 +5393,6 @@ var Option = /* @__PURE__ */ defineComponent({
5082
5393
  }
5083
5394
  });
5084
5395
  //#endregion
5085
- //#region components/empty/index.tsx
5086
- var Empty = /* @__PURE__ */ defineComponent({
5087
- name: "Empty",
5088
- props: {
5089
- description: [String, Boolean],
5090
- image: String,
5091
- imageStyle: Object
5092
- },
5093
- setup(props, { slots, attrs }) {
5094
- const injectedLocale = inject("locale", zh_CN_default);
5095
- const locale = computed(() => {
5096
- return injectedLocale instanceof Object && "value" in injectedLocale ? injectedLocale.value : injectedLocale;
5097
- });
5098
- return () => {
5099
- const { image, imageStyle, description } = props;
5100
- return createVNode("div", {
5101
- ...attrs,
5102
- class: "k-empty"
5103
- }, [createVNode("div", { "class": "k-empty-content" }, [
5104
- (() => {
5105
- if (!image && !slots.image) return createVNode(Icon, {
5106
- "type": Inbox,
5107
- "class": "k-empty-icon",
5108
- "strokeWidth": "0.01em"
5109
- }, null);
5110
- else if (slots.image) return slots.image();
5111
- else return createVNode("img", {
5112
- src: image,
5113
- class: "k-empty-image",
5114
- style: imageStyle,
5115
- alt: description || locale.value?.k.empty.description || "Empty state image"
5116
- }, null);
5117
- })(),
5118
- description !== false ? createVNode("p", { "class": "k-empty-description" }, [description || slots.description?.() || locale.value?.k.empty.description]) : null,
5119
- slots.default ? createVNode("div", { "class": "k-empty-footer" }, [slots.default()]) : null
5120
- ])]);
5121
- };
5122
- }
5123
- });
5124
- //#endregion
5125
5396
  //#region components/select/select.tsx
5126
5397
  var Select = /* @__PURE__ */ defineComponent({
5127
5398
  name: "Select",
@@ -10944,6 +11215,7 @@ var Page = /* @__PURE__ */ defineComponent({
10944
11215
  theme: props.theme,
10945
11216
  disabled: props.disabled,
10946
11217
  clearable: false,
11218
+ min: 1,
10947
11219
  onChange: (page) => {
10948
11220
  if (page == void 0) return;
10949
11221
  let pCount = pageCount.value;
@@ -15877,10 +16149,12 @@ var Table = /* @__PURE__ */ defineComponent({
15877
16149
  col,
15878
16150
  index: idx
15879
16151
  }) || col.title, col.sorter && createVNode("span", { "class": "k-table-sorter" }, [createVNode(Icon, {
15880
- "type": ChevronUp,
16152
+ "type": Triangle,
16153
+ "reverseFill": true,
15881
16154
  "class": ["k-table-sorter-up", sortState.key === col.key && sortState.order === "asc" && "k-table-sorter-active"]
15882
16155
  }, null), createVNode(Icon, {
15883
- "type": ChevronDown,
16156
+ "type": Triangle,
16157
+ "reverseFill": true,
15884
16158
  "class": ["k-table-sorter-down", sortState.key === col.key && sortState.order === "desc" && "k-table-sorter-active"]
15885
16159
  }, null)])])])),
15886
16160
  isSplit.value && rowIndex === 0 && createVNode("th", {
@@ -18007,15 +18281,10 @@ var Watermark = /* @__PURE__ */ defineComponent({
18007
18281
  //#region components/utils/theme.ts
18008
18282
  var THEME_KEY = "theme-mode";
18009
18283
  var toggleTheme = () => {
18010
- const isDark = localStorage.getItem(THEME_KEY) == "dark";
18011
- const root = document.documentElement;
18012
- if (isDark) {
18013
- root.setAttribute(THEME_KEY, "light");
18014
- localStorage.setItem(THEME_KEY, "light");
18015
- } else {
18016
- root.setAttribute(THEME_KEY, "dark");
18017
- localStorage.setItem(THEME_KEY, "dark");
18018
- }
18284
+ const isDark = localStorage.getItem(THEME_KEY) === "dark";
18285
+ const nextTheme = isDark ? "light" : "dark";
18286
+ document.documentElement.setAttribute(THEME_KEY, nextTheme);
18287
+ localStorage.setItem(THEME_KEY, nextTheme);
18019
18288
  return !isDark;
18020
18289
  };
18021
18290
  var Theme = {
@@ -18024,22 +18293,24 @@ var Theme = {
18024
18293
  if (!(document.startViewTransition !== void 0 && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) || !event) {
18025
18294
  const isDark = toggleTheme();
18026
18295
  callback?.(isDark);
18296
+ return;
18027
18297
  }
18028
- const x = event.clientX;
18029
- const y = event.clientY;
18030
- const endRadius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y));
18031
- let isDark = localStorage.getItem(THEME_KEY) == "dark";
18298
+ const ratio = window.devicePixelRatio || 1;
18299
+ const x = event.clientX * ratio;
18300
+ const y = event.clientY * ratio;
18301
+ const endRadius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y)) * ratio;
18302
+ const willBeDark = localStorage.getItem(THEME_KEY) !== "dark";
18032
18303
  const transition = document.startViewTransition(async () => {
18033
- isDark = toggleTheme();
18034
- callback?.(isDark);
18304
+ toggleTheme();
18305
+ callback?.(willBeDark);
18035
18306
  await nextTick();
18036
18307
  });
18037
18308
  transition.ready.then(() => {
18038
18309
  const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`];
18039
- const animate = document.documentElement.animate({ clipPath: !isDark ? clipPath.reverse() : clipPath }, {
18040
- duration: 500,
18310
+ const animate = document.documentElement.animate({ clipPath: willBeDark ? clipPath : [...clipPath].reverse() }, {
18311
+ duration: 500 * ratio,
18041
18312
  easing: "ease-in-out",
18042
- pseudoElement: !isDark ? "::view-transition-old(root)" : "::view-transition-new(root)"
18313
+ pseudoElement: willBeDark ? "::view-transition-new(root)" : "::view-transition-old(root)"
18043
18314
  });
18044
18315
  animate.onfinish = () => {
18045
18316
  transition.skipTransition();
@@ -18065,6 +18336,7 @@ var components_exports = /* @__PURE__ */ __exportAll({
18065
18336
  Card: () => Card,
18066
18337
  Carousel: () => Carousel,
18067
18338
  CarouselItem: () => CarouselItem,
18339
+ Cascader: () => Cascader,
18068
18340
  Checkbox: () => Checkbox,
18069
18341
  CheckboxGroup: () => CheckboxGroup,
18070
18342
  Col: () => Col,
@@ -18177,4 +18449,4 @@ var UI = {
18177
18449
  var install = UI.install;
18178
18450
  var version = UI.version;
18179
18451
  //#endregion
18180
- export { Affix, Alert, Anchor, AnchorLink, Avatar, AvatarGroup, BackTop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonGroup, Card, Carousel, CarouselItem, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, ConfigProvider, Content, DatePicker, Descriptions, DescriptionsItem, Divider, Drawer, Dropdown, DropdownButton, Empty, Flex, Footer, Form, FormItem, Grid, GridItem, Header, Icon, ImageGroup, Input, InputGroup, InputNumber, KImage, Switch as KSwitch, Layout, Menu, MenuDivider, MenuGroup, MenuItem, modal_default as Modal, Option, Page, Popconfirm, Poptip, Progress, QRCode, Radio, RadioButton, RadioGroup, Rate, Row, Select, Sider, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonText, Slider, Space, Spin, Splitter, SplitterPanel, StatCard, StatNumber, SubMenu, TabPanel, Table, Tabs, Tag, TextArea, TimeLine, TimeLineItem, Tooltip, Tree, TreeSelect, Upload, Watermark, UI as default, install, loading, message, modal, notice, Theme as theme, version };
18452
+ export { Affix, Alert, Anchor, AnchorLink, Avatar, AvatarGroup, BackTop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonGroup, Card, Carousel, CarouselItem, Cascader, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, ConfigProvider, Content, DatePicker, Descriptions, DescriptionsItem, Divider, Drawer, Dropdown, DropdownButton, Empty, Flex, Footer, Form, FormItem, Grid, GridItem, Header, Icon, ImageGroup, Input, InputGroup, InputNumber, KImage, Switch as KSwitch, Layout, Menu, MenuDivider, MenuGroup, MenuItem, modal_default as Modal, Option, Page, Popconfirm, Poptip, Progress, QRCode, Radio, RadioButton, RadioGroup, Rate, Row, Select, Sider, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonText, Slider, Space, Spin, Splitter, SplitterPanel, StatCard, StatNumber, SubMenu, TabPanel, Table, Tabs, Tag, TextArea, TimeLine, TimeLineItem, Tooltip, Tree, TreeSelect, Upload, Watermark, UI as default, install, loading, message, modal, notice, Theme as theme, version };