kui-vue 5.0.1 → 5.2.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 +22 -12
- package/README.zh-CN.md +117 -0
- package/dist/index.js +2 -2
- package/es/index.js +465 -281
- package/es/locale/de.js +1 -1
- package/es/locale/el.js +1 -1
- package/es/locale/en.js +1 -1
- package/es/locale/fr.js +1 -1
- package/es/locale/it.js +1 -1
- package/es/locale/ja.js +1 -1
- package/es/locale/ko.js +1 -1
- package/es/locale/ru.js +1 -1
- package/es/locale/th.js +1 -1
- package/es/locale/uk.js +1 -1
- package/es/locale/vi.js +1 -1
- package/es/locale/zh-CN.js +1 -1
- package/es/locale/zh-TW.js +1 -1
- package/lib/index.js +2 -2
- package/lib/locale/de.js +1 -1
- package/lib/locale/el.js +1 -1
- package/lib/locale/en.js +1 -1
- package/lib/locale/fr.js +1 -1
- package/lib/locale/it.js +1 -1
- package/lib/locale/ja.js +1 -1
- package/lib/locale/ko.js +1 -1
- package/lib/locale/ru.js +1 -1
- package/lib/locale/th.js +1 -1
- package/lib/locale/uk.js +1 -1
- package/lib/locale/vi.js +1 -1
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/package.json +6 -6
- package/style/index.css +2 -2
- package/types/anchor/{Anchor.d.ts → anchor.d.ts} +9 -0
- package/types/button/{Button.d.ts → button.d.ts} +3 -2
- package/types/carousel/{Carousel.d.ts → carousel.d.ts} +0 -13
- package/types/checkbox/checkbox-group.d.ts +9 -7
- package/types/checkbox/{Checkbox.d.ts → checkbox.d.ts} +14 -5
- package/types/checkbox/index.d.ts +1 -1
- package/types/collapse/{Collapse.d.ts → collapse.d.ts} +3 -0
- package/types/color-picker/index.d.ts +9 -7
- package/types/components.d.ts +4 -2
- package/types/const/types.d.ts +7 -5
- package/types/const/var.d.ts +1 -6
- package/types/date-picker/index.d.ts +37 -9
- package/types/descriptions/{Descriptions.d.ts → descriptions.d.ts} +0 -4
- package/types/drawer/index.d.ts +4 -1
- package/types/dropdown/{Dropdown.d.ts → dropdown.d.ts} +9 -0
- package/types/form/{Form.d.ts → form.d.ts} +9 -4
- package/types/form/types.d.ts +0 -1
- package/types/global.d.ts +4 -0
- package/types/input/input-group.d.ts +5 -5
- package/types/input/{Input.d.ts → input.d.ts} +7 -4
- package/types/input/{TextArea.d.ts → textarea.d.ts} +4 -2
- package/types/input-number/index.d.ts +0 -3
- package/types/menu/{Menu.d.ts → menu.d.ts} +3 -3
- package/types/message/index.d.ts +2 -1
- package/types/modal/{Modal.d.ts → modal.d.ts} +22 -0
- package/types/notice/instance.d.ts +7 -1
- package/types/page/index.d.ts +0 -4
- package/types/progress/index.d.ts +0 -4
- package/types/radio/radio-button.d.ts +4 -4
- package/types/radio/radio-group.d.ts +5 -4
- package/types/radio/{Radio.d.ts → radio.d.ts} +0 -4
- package/types/select/{Select.d.ts → select.d.ts} +3 -7
- package/types/spin/index.d.ts +0 -4
- package/types/splitter/index.d.ts +4 -0
- package/types/splitter/splitter-panel.d.ts +35 -0
- package/types/splitter/splitter.d.ts +32 -0
- package/types/switch/index.d.ts +39 -14
- package/types/table/index.d.ts +0 -4
- package/types/tag/index.d.ts +4 -4
- package/types/tree-select/index.d.ts +9 -7
- package/types/upload/index.d.ts +3 -0
- package/types/utils/checked.d.ts +2 -0
- package/vetur/attributes.json +1497 -1381
- package/vetur/tags.json +212 -182
- package/vetur/web-types.json +1643 -1461
- package/types/affix/Affix.d.ts +0 -15
- package/types/alert/Alert.d.ts +0 -19
- package/types/anchor/AnchorLink.d.ts +0 -12
- package/types/avatar/AvatarGroup.d.ts +0 -13
- package/types/backtop/BackTop.d.ts +0 -16
- package/types/badge/Badge.d.ts +0 -18
- package/types/breadcrumb/BreadcrumbItem.d.ts +0 -12
- package/types/button/ButtonGroup.d.ts +0 -12
- package/types/card/Card.d.ts +0 -14
- package/types/carousel/CarouselItem.d.ts +0 -9
- package/types/checkbox/CheckboxGroup.d.ts +0 -19
- package/types/collapse/CollapsePanel.d.ts +0 -12
- package/types/color-picker/ColorPicker.d.ts +0 -28
- package/types/date-picker/DatePicker.d.ts +0 -46
- package/types/descriptions/DescriptionsItem.d.ts +0 -16
- package/types/divider/Divider.d.ts +0 -16
- package/types/drawer/Drawer.d.ts +0 -35
- package/types/dropdown/DropdownButton.d.ts +0 -19
- package/types/empty/Empty.d.ts +0 -13
- package/types/flex/Flex.d.ts +0 -15
- package/types/form/FormItem.d.ts +0 -15
- package/types/grid/GridItem.d.ts +0 -18
- package/types/icon/Icon.d.ts +0 -15
- package/types/image/ImageGroup.d.ts +0 -11
- package/types/image/KImage.d.ts +0 -20
- package/types/input/InputGroup.d.ts +0 -16
- package/types/input-number/InputNumber.d.ts +0 -32
- package/types/layout/sider.d.ts +0 -11
- package/types/loading/loading.d.ts +0 -9
- package/types/menu/MenuDivider.d.ts +0 -9
- package/types/menu/MenuGroup.d.ts +0 -11
- package/types/menu/MenuItem.d.ts +0 -15
- package/types/menu/SubMenu.d.ts +0 -14
- package/types/page/Page.d.ts +0 -27
- package/types/popconfirm/Popconfirm.d.ts +0 -19
- package/types/poptip/Poptip.d.ts +0 -19
- package/types/progress/Progress.d.ts +0 -31
- package/types/radio/RadioButton.d.ts +0 -19
- package/types/radio/RadioGroup.d.ts +0 -20
- package/types/rate/Rate.d.ts +0 -24
- package/types/skeleton/SkeletonAvatar.d.ts +0 -17
- package/types/skeleton/SkeletonButton.d.ts +0 -18
- package/types/skeleton/SkeletonImage.d.ts +0 -16
- package/types/skeleton/SkeletonText.d.ts +0 -16
- package/types/slider/Slider.d.ts +0 -29
- package/types/space/Space.d.ts +0 -17
- package/types/spin/Spin.d.ts +0 -18
- package/types/stat-card/StatCard.d.ts +0 -20
- package/types/stat-card/StatNumber.d.ts +0 -20
- package/types/switch/Switch.d.ts +0 -19
- package/types/table/Table.d.ts +0 -29
- package/types/tabs/TabPanel.d.ts +0 -15
- package/types/tag/Tag.d.ts +0 -18
- package/types/timeline/TimeLine.d.ts +0 -12
- package/types/timeline/TimeLineItem.d.ts +0 -14
- package/types/tooltip/Tooltip.d.ts +0 -20
- package/types/tree/Tree.d.ts +0 -28
- package/types/tree-select/TreeSelect.d.ts +0 -46
- package/types/upload/Upload.d.ts +0 -37
- /package/types/avatar/{Avatar.d.ts → avatar.d.ts} +0 -0
- /package/types/breadcrumb/{Breadcrumb.d.ts → breadcrumb.d.ts} +0 -0
- /package/types/grid/{Grid.d.ts → grid.d.ts} +0 -0
- /package/types/row-col/{Col.d.ts → col.d.ts} +0 -0
- /package/types/row-col/{Row.d.ts → row.d.ts} +0 -0
- /package/types/select/{Option.d.ts → option.d.ts} +0 -0
- /package/types/skeleton/{Skeleton.d.ts → skeleton.d.ts} +0 -0
- /package/types/tabs/{Tabs.d.ts → tabs.d.ts} +0 -0
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* kui-vue v5.0
|
|
2
|
+
* kui-vue v5.2.0
|
|
3
3
|
* Copyright 2017-present, kui-vue.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://k-ui.cn
|
|
@@ -495,7 +495,8 @@ var Anchor = /* @__PURE__ */ defineComponent({
|
|
|
495
495
|
type: Number,
|
|
496
496
|
default: 5
|
|
497
497
|
},
|
|
498
|
-
container: [String, Object]
|
|
498
|
+
container: [String, Object],
|
|
499
|
+
onChange: { type: Function }
|
|
499
500
|
},
|
|
500
501
|
setup(props, { slots, emit, attrs }) {
|
|
501
502
|
const activeLink = ref("");
|
|
@@ -1131,10 +1132,6 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
1131
1132
|
name: "Carousel",
|
|
1132
1133
|
directives: { resize },
|
|
1133
1134
|
props: {
|
|
1134
|
-
value: {
|
|
1135
|
-
type: Number,
|
|
1136
|
-
default: 0
|
|
1137
|
-
},
|
|
1138
1135
|
modelValue: {
|
|
1139
1136
|
type: Number,
|
|
1140
1137
|
default: 0
|
|
@@ -1159,7 +1156,7 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
1159
1156
|
}
|
|
1160
1157
|
},
|
|
1161
1158
|
setup(props, { slots, emit, expose, attrs }) {
|
|
1162
|
-
const currentIndex = ref(props.
|
|
1159
|
+
const currentIndex = ref(props.modelValue);
|
|
1163
1160
|
const posIndex = ref(props.loop ? props.modelValue + 1 : props.modelValue);
|
|
1164
1161
|
const autoTimer = ref(null);
|
|
1165
1162
|
const width = ref(0);
|
|
@@ -1324,6 +1321,23 @@ var CarouselItem = /* @__PURE__ */ defineComponent({
|
|
|
1324
1321
|
}
|
|
1325
1322
|
});
|
|
1326
1323
|
//#endregion
|
|
1324
|
+
//#region components/utils/checked.ts
|
|
1325
|
+
var getValueWithType = (checked, vType) => {
|
|
1326
|
+
let value = checked;
|
|
1327
|
+
switch (vType) {
|
|
1328
|
+
case "string":
|
|
1329
|
+
value = checked ? "1" : "0";
|
|
1330
|
+
break;
|
|
1331
|
+
case "number":
|
|
1332
|
+
value = checked ? 1 : 0;
|
|
1333
|
+
break;
|
|
1334
|
+
case "boolean":
|
|
1335
|
+
value = checked ? true : false;
|
|
1336
|
+
break;
|
|
1337
|
+
}
|
|
1338
|
+
return value;
|
|
1339
|
+
};
|
|
1340
|
+
//#endregion
|
|
1327
1341
|
//#region components/checkbox/checkbox.tsx
|
|
1328
1342
|
var Checkbox = /* @__PURE__ */ defineComponent({
|
|
1329
1343
|
name: "Checkbox",
|
|
@@ -1332,6 +1346,10 @@ var Checkbox = /* @__PURE__ */ defineComponent({
|
|
|
1332
1346
|
type: Boolean,
|
|
1333
1347
|
default: false
|
|
1334
1348
|
},
|
|
1349
|
+
valueType: {
|
|
1350
|
+
type: String,
|
|
1351
|
+
default: "boolean"
|
|
1352
|
+
},
|
|
1335
1353
|
modelValue: { type: [
|
|
1336
1354
|
String,
|
|
1337
1355
|
Number,
|
|
@@ -1345,14 +1363,11 @@ var Checkbox = /* @__PURE__ */ defineComponent({
|
|
|
1345
1363
|
label: { type: [String, Number] },
|
|
1346
1364
|
theme: {
|
|
1347
1365
|
type: String,
|
|
1348
|
-
default: "
|
|
1366
|
+
default: "fill"
|
|
1349
1367
|
},
|
|
1350
1368
|
disabled: Boolean,
|
|
1351
1369
|
indeterminate: Boolean,
|
|
1352
|
-
size: {
|
|
1353
|
-
type: String,
|
|
1354
|
-
default: "default"
|
|
1355
|
-
},
|
|
1370
|
+
size: { type: String },
|
|
1356
1371
|
onChange: { type: Function }
|
|
1357
1372
|
},
|
|
1358
1373
|
setup(props, { slots, emit }) {
|
|
@@ -1361,16 +1376,17 @@ var Checkbox = /* @__PURE__ */ defineComponent({
|
|
|
1361
1376
|
isChecked.value = v;
|
|
1362
1377
|
});
|
|
1363
1378
|
watch(() => props.modelValue, (v) => {
|
|
1364
|
-
isChecked.value = v
|
|
1379
|
+
isChecked.value = v == 1;
|
|
1365
1380
|
});
|
|
1366
1381
|
const emitValue = (checked) => {
|
|
1367
1382
|
isChecked.value = checked;
|
|
1383
|
+
const value = getValueWithType(checked, props.valueType);
|
|
1368
1384
|
emit("change", {
|
|
1369
1385
|
checked,
|
|
1370
1386
|
value: props.value,
|
|
1371
1387
|
label: props.label || slots.default?.()
|
|
1372
1388
|
});
|
|
1373
|
-
emit("update:modelValue",
|
|
1389
|
+
emit("update:modelValue", value);
|
|
1374
1390
|
emit("update:checked", checked);
|
|
1375
1391
|
};
|
|
1376
1392
|
const onChange = (e) => {
|
|
@@ -1391,7 +1407,7 @@ var Checkbox = /* @__PURE__ */ defineComponent({
|
|
|
1391
1407
|
const { theme, disabled, indeterminate, size, label } = props;
|
|
1392
1408
|
const rootProps = {
|
|
1393
1409
|
class: ["k-checkbox", {
|
|
1394
|
-
"k-checkbox-
|
|
1410
|
+
"k-checkbox-fill": theme === "fill",
|
|
1395
1411
|
"k-checkbox-disabled": disabled,
|
|
1396
1412
|
"k-checkbox-checked": isChecked.value && !indeterminate,
|
|
1397
1413
|
"k-checkbox-indeterminate": indeterminate && !isChecked.value,
|
|
@@ -1426,7 +1442,7 @@ var CheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
|
1426
1442
|
},
|
|
1427
1443
|
theme: {
|
|
1428
1444
|
type: String,
|
|
1429
|
-
default: "
|
|
1445
|
+
default: "fill"
|
|
1430
1446
|
},
|
|
1431
1447
|
disabled: Boolean,
|
|
1432
1448
|
options: Array,
|
|
@@ -1434,10 +1450,7 @@ var CheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
|
1434
1450
|
type: String,
|
|
1435
1451
|
default: "horizontal"
|
|
1436
1452
|
},
|
|
1437
|
-
size: {
|
|
1438
|
-
type: String,
|
|
1439
|
-
default: "default"
|
|
1440
|
-
},
|
|
1453
|
+
size: { type: String },
|
|
1441
1454
|
onChange: { type: Function }
|
|
1442
1455
|
},
|
|
1443
1456
|
setup(props, { slots, emit }) {
|
|
@@ -1498,7 +1511,8 @@ var Collapse = /* @__PURE__ */ defineComponent({
|
|
|
1498
1511
|
default: () => []
|
|
1499
1512
|
},
|
|
1500
1513
|
accordion: Boolean,
|
|
1501
|
-
sample: Boolean
|
|
1514
|
+
sample: Boolean,
|
|
1515
|
+
onChange: Function
|
|
1502
1516
|
},
|
|
1503
1517
|
setup(props, { slots, emit }) {
|
|
1504
1518
|
const defaultOpenKeys = ref(props.openKeys || []);
|
|
@@ -1512,7 +1526,7 @@ var Collapse = /* @__PURE__ */ defineComponent({
|
|
|
1512
1526
|
else value = props.accordion ? [key] : [...value, key];
|
|
1513
1527
|
defaultOpenKeys.value = value;
|
|
1514
1528
|
emit("change", key);
|
|
1515
|
-
emit("update", value);
|
|
1529
|
+
emit("update:openKeys", value);
|
|
1516
1530
|
};
|
|
1517
1531
|
return () => {
|
|
1518
1532
|
return createVNode("div", { class: ["k-collapse", { "k-collapse-sample": props.sample }] }, [getChildren(slots.default?.())?.map((child) => {
|
|
@@ -3871,18 +3885,6 @@ function setPlacement({ refSelection, refPopper, currentPlacement, position = nu
|
|
|
3871
3885
|
}
|
|
3872
3886
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
3873
3887
|
var clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
3874
|
-
function cacheStringFunction(fn) {
|
|
3875
|
-
const cache = Object.create(null);
|
|
3876
|
-
return ((str) => {
|
|
3877
|
-
return cache[str] || (cache[str] = fn(str));
|
|
3878
|
-
});
|
|
3879
|
-
}
|
|
3880
|
-
var hyphenateRE = /\B([A-Z])/g;
|
|
3881
|
-
cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
3882
|
-
var camelizeRE = /-(\w)/g;
|
|
3883
|
-
cacheStringFunction((str) => {
|
|
3884
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
3885
|
-
});
|
|
3886
3888
|
//#endregion
|
|
3887
3889
|
//#region components/color-picker/alpha.tsx
|
|
3888
3890
|
var alpha_default = /* @__PURE__ */ defineComponent({
|
|
@@ -4557,7 +4559,7 @@ var InputGroup = /* @__PURE__ */ defineComponent({
|
|
|
4557
4559
|
},
|
|
4558
4560
|
theme: {
|
|
4559
4561
|
type: String,
|
|
4560
|
-
default: "
|
|
4562
|
+
default: "fill"
|
|
4561
4563
|
},
|
|
4562
4564
|
size: { type: [
|
|
4563
4565
|
String,
|
|
@@ -4576,7 +4578,7 @@ var InputGroup = /* @__PURE__ */ defineComponent({
|
|
|
4576
4578
|
class: ["k-input-group", {
|
|
4577
4579
|
"k-input-group-compact": compact,
|
|
4578
4580
|
"k-input-group-block": block,
|
|
4579
|
-
"k-input-group-
|
|
4581
|
+
"k-input-group-fill": theme === "fill",
|
|
4580
4582
|
"k-input-group-lg": size === "large",
|
|
4581
4583
|
"k-input-group-sm": size === "small"
|
|
4582
4584
|
}]
|
|
@@ -4617,12 +4619,6 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4617
4619
|
Array,
|
|
4618
4620
|
Object
|
|
4619
4621
|
] },
|
|
4620
|
-
value: { type: [
|
|
4621
|
-
String,
|
|
4622
|
-
Number,
|
|
4623
|
-
Array,
|
|
4624
|
-
Object
|
|
4625
|
-
] },
|
|
4626
4622
|
disabled: Boolean,
|
|
4627
4623
|
type: {
|
|
4628
4624
|
type: String,
|
|
@@ -4642,7 +4638,7 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4642
4638
|
] },
|
|
4643
4639
|
theme: {
|
|
4644
4640
|
type: String,
|
|
4645
|
-
default: "
|
|
4641
|
+
default: "fill"
|
|
4646
4642
|
},
|
|
4647
4643
|
shape: String,
|
|
4648
4644
|
inputType: {
|
|
@@ -4652,10 +4648,12 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4652
4648
|
onSearch: { type: Function },
|
|
4653
4649
|
maxlength: Number,
|
|
4654
4650
|
"onUpdate:modelValue": Function,
|
|
4655
|
-
onIconClick: { type: Function }
|
|
4651
|
+
onIconClick: { type: Function },
|
|
4652
|
+
onClear: { type: Function },
|
|
4653
|
+
onChange: { type: Function }
|
|
4656
4654
|
},
|
|
4657
4655
|
setup(props, { slots, emit, attrs, expose }) {
|
|
4658
|
-
const currentValue = ref(props.modelValue
|
|
4656
|
+
const currentValue = ref(props.modelValue);
|
|
4659
4657
|
const focused = ref(false);
|
|
4660
4658
|
const showPassword = ref(false);
|
|
4661
4659
|
const inputRef = ref();
|
|
@@ -4673,6 +4671,8 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4673
4671
|
const clear = () => {
|
|
4674
4672
|
currentValue.value = "";
|
|
4675
4673
|
emit("update:modelValue", "");
|
|
4674
|
+
emit("clear");
|
|
4675
|
+
emit("change", "");
|
|
4676
4676
|
nextTick(() => focus());
|
|
4677
4677
|
};
|
|
4678
4678
|
const togglePassword = () => {
|
|
@@ -4714,7 +4714,7 @@ var Input = /* @__PURE__ */ defineComponent({
|
|
|
4714
4714
|
const v = e.target.value;
|
|
4715
4715
|
currentValue.value = v;
|
|
4716
4716
|
emit("update:modelValue", v);
|
|
4717
|
-
emit("change",
|
|
4717
|
+
emit("change", v);
|
|
4718
4718
|
},
|
|
4719
4719
|
onFocus: (e) => {
|
|
4720
4720
|
focused.value = true;
|
|
@@ -4800,15 +4800,9 @@ var TextArea = /* @__PURE__ */ defineComponent({
|
|
|
4800
4800
|
Object,
|
|
4801
4801
|
Array
|
|
4802
4802
|
],
|
|
4803
|
-
value: [
|
|
4804
|
-
String,
|
|
4805
|
-
Number,
|
|
4806
|
-
Object,
|
|
4807
|
-
Array
|
|
4808
|
-
],
|
|
4809
4803
|
theme: {
|
|
4810
4804
|
type: String,
|
|
4811
|
-
default: "
|
|
4805
|
+
default: "fill"
|
|
4812
4806
|
},
|
|
4813
4807
|
shape: { type: String },
|
|
4814
4808
|
size: String,
|
|
@@ -4818,13 +4812,19 @@ var TextArea = /* @__PURE__ */ defineComponent({
|
|
|
4818
4812
|
default: 2
|
|
4819
4813
|
},
|
|
4820
4814
|
disabled: Boolean,
|
|
4821
|
-
readonly: Boolean
|
|
4815
|
+
readonly: Boolean,
|
|
4816
|
+
onChange: { type: Function }
|
|
4822
4817
|
},
|
|
4823
4818
|
setup(props, { attrs, emit }) {
|
|
4824
|
-
const currentValue = ref(props.modelValue
|
|
4819
|
+
const currentValue = ref(props.modelValue);
|
|
4825
4820
|
watch(() => props.modelValue, (v) => {
|
|
4826
4821
|
currentValue.value = v;
|
|
4827
4822
|
});
|
|
4823
|
+
const handleChange = (e) => {
|
|
4824
|
+
const { value } = e.target;
|
|
4825
|
+
emit("update:modelValue", value);
|
|
4826
|
+
emit("change", value);
|
|
4827
|
+
};
|
|
4828
4828
|
return () => {
|
|
4829
4829
|
const { theme, disabled, size, shape, placeholder, rows } = props;
|
|
4830
4830
|
return createVNode("textarea", {
|
|
@@ -4832,14 +4832,15 @@ var TextArea = /* @__PURE__ */ defineComponent({
|
|
|
4832
4832
|
placeholder,
|
|
4833
4833
|
rows,
|
|
4834
4834
|
class: ["k-textarea", {
|
|
4835
|
-
[`k-textarea
|
|
4835
|
+
[`k-textarea-fill`]: theme === "fill",
|
|
4836
|
+
[`k-textarea-outline`]: theme === "outline",
|
|
4836
4837
|
"k-textarea-sm": size === "small",
|
|
4837
4838
|
"k-textarea-square": shape === "square",
|
|
4838
4839
|
"k-textarea-lg": size === "large"
|
|
4839
4840
|
}],
|
|
4840
4841
|
disabled,
|
|
4841
4842
|
value: currentValue.value,
|
|
4842
|
-
onInput:
|
|
4843
|
+
onInput: handleChange
|
|
4843
4844
|
}, null);
|
|
4844
4845
|
};
|
|
4845
4846
|
}
|
|
@@ -4849,7 +4850,6 @@ var InputNumber = /* @__PURE__ */ defineComponent({
|
|
|
4849
4850
|
name: "InputNumber",
|
|
4850
4851
|
props: {
|
|
4851
4852
|
modelValue: [Number, String],
|
|
4852
|
-
value: [Number, String],
|
|
4853
4853
|
min: {
|
|
4854
4854
|
type: Number,
|
|
4855
4855
|
default: -Infinity
|
|
@@ -4875,7 +4875,7 @@ var InputNumber = /* @__PURE__ */ defineComponent({
|
|
|
4875
4875
|
prefix: String,
|
|
4876
4876
|
theme: {
|
|
4877
4877
|
type: String,
|
|
4878
|
-
default: "
|
|
4878
|
+
default: "fill"
|
|
4879
4879
|
},
|
|
4880
4880
|
shape: { type: String },
|
|
4881
4881
|
icon: [Array],
|
|
@@ -5076,10 +5076,7 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5076
5076
|
},
|
|
5077
5077
|
props: {
|
|
5078
5078
|
placeholder: String,
|
|
5079
|
-
size: {
|
|
5080
|
-
type: String,
|
|
5081
|
-
default: "default"
|
|
5082
|
-
},
|
|
5079
|
+
size: { type: String },
|
|
5083
5080
|
placement: {
|
|
5084
5081
|
type: String,
|
|
5085
5082
|
default: "bottom-left"
|
|
@@ -5091,11 +5088,6 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5091
5088
|
Number,
|
|
5092
5089
|
Array
|
|
5093
5090
|
],
|
|
5094
|
-
value: [
|
|
5095
|
-
String,
|
|
5096
|
-
Number,
|
|
5097
|
-
Array
|
|
5098
|
-
],
|
|
5099
5091
|
clearable: {
|
|
5100
5092
|
type: Boolean,
|
|
5101
5093
|
default: true
|
|
@@ -5116,7 +5108,7 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5116
5108
|
options: Array,
|
|
5117
5109
|
theme: {
|
|
5118
5110
|
type: String,
|
|
5119
|
-
default: "
|
|
5111
|
+
default: "fill"
|
|
5120
5112
|
},
|
|
5121
5113
|
emptyText: String,
|
|
5122
5114
|
loadingText: String,
|
|
@@ -5125,7 +5117,8 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5125
5117
|
arrowIcon: [Array],
|
|
5126
5118
|
onSearch: Function,
|
|
5127
5119
|
onChange: Function,
|
|
5128
|
-
onSelect: Function
|
|
5120
|
+
onSelect: Function,
|
|
5121
|
+
onOpenChange: Function
|
|
5129
5122
|
},
|
|
5130
5123
|
setup(props, { slots, emit }) {
|
|
5131
5124
|
const injectedLocale = inject("locale", zh_CN_default);
|
|
@@ -5134,7 +5127,7 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5134
5127
|
});
|
|
5135
5128
|
const visible = ref(false);
|
|
5136
5129
|
const rendered = ref(false);
|
|
5137
|
-
const currentValue = ref(props.multiple ? props.modelValue ||
|
|
5130
|
+
const currentValue = ref(props.multiple ? props.modelValue || [] : isEmpty(props.modelValue) ? [] : [props.modelValue]);
|
|
5138
5131
|
const queryInputVisible = ref(false);
|
|
5139
5132
|
const queryKey = ref("");
|
|
5140
5133
|
const queryInputMirrorRef = ref(null);
|
|
@@ -5341,6 +5334,7 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5341
5334
|
emitValue();
|
|
5342
5335
|
};
|
|
5343
5336
|
const onClear = (e) => {
|
|
5337
|
+
emit("clear");
|
|
5344
5338
|
currentValue.value = [];
|
|
5345
5339
|
emitValue();
|
|
5346
5340
|
clearQuery();
|
|
@@ -5524,7 +5518,7 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
5524
5518
|
"k-select-borderless": bordered === false,
|
|
5525
5519
|
"k-select-lg": size === "large",
|
|
5526
5520
|
"k-select-sm": size === "small",
|
|
5527
|
-
"k-select-
|
|
5521
|
+
"k-select-fill": theme === "fill",
|
|
5528
5522
|
"k-select-has-icon": !!icon,
|
|
5529
5523
|
"k-select-circle": shape === "circle" && !multiple,
|
|
5530
5524
|
"k-select-square": shape === "square",
|
|
@@ -5597,8 +5591,7 @@ var mode_default = /* @__PURE__ */ defineComponent({
|
|
|
5597
5591
|
watch(() => props.mode, (val) => {
|
|
5598
5592
|
currentMode.value = val;
|
|
5599
5593
|
});
|
|
5600
|
-
const updateHex = (
|
|
5601
|
-
const hex = e.target.value;
|
|
5594
|
+
const updateHex = (hex) => {
|
|
5602
5595
|
if (!isColor(hex)) return;
|
|
5603
5596
|
emit("updateColorValue", Color(hex).rgb());
|
|
5604
5597
|
};
|
|
@@ -5853,7 +5846,6 @@ var ColorPicker = /* @__PURE__ */ defineComponent({
|
|
|
5853
5846
|
},
|
|
5854
5847
|
props: {
|
|
5855
5848
|
modelValue: String,
|
|
5856
|
-
value: String,
|
|
5857
5849
|
disabled: Boolean,
|
|
5858
5850
|
disabledAlpha: Boolean,
|
|
5859
5851
|
showText: Boolean,
|
|
@@ -5865,21 +5857,19 @@ var ColorPicker = /* @__PURE__ */ defineComponent({
|
|
|
5865
5857
|
type: String,
|
|
5866
5858
|
default: "click"
|
|
5867
5859
|
},
|
|
5868
|
-
size: {
|
|
5869
|
-
type: String,
|
|
5870
|
-
default: "default"
|
|
5871
|
-
},
|
|
5860
|
+
size: { type: String },
|
|
5872
5861
|
mode: {
|
|
5873
5862
|
type: String,
|
|
5874
5863
|
default: "hex"
|
|
5875
5864
|
},
|
|
5876
5865
|
presets: { type: Array },
|
|
5877
5866
|
onChange: { type: Function },
|
|
5878
|
-
onUpdateMode: { type: Function }
|
|
5867
|
+
onUpdateMode: { type: Function },
|
|
5868
|
+
onOpenChange: { type: Function }
|
|
5879
5869
|
},
|
|
5880
5870
|
setup(props, { emit, slots }) {
|
|
5881
5871
|
const currentMode = ref(props.mode);
|
|
5882
|
-
const currentColor = ref(props.modelValue ||
|
|
5872
|
+
const currentColor = ref(props.modelValue || "#000000ff");
|
|
5883
5873
|
const visible = ref(false);
|
|
5884
5874
|
const refPopper = ref();
|
|
5885
5875
|
const refSelection = ref();
|
|
@@ -5919,23 +5909,27 @@ var ColorPicker = /* @__PURE__ */ defineComponent({
|
|
|
5919
5909
|
const ctx = refSelection.value?.$el || refSelection.value;
|
|
5920
5910
|
if (refPopper.value && !refPopper.value.contains(e.target) && ctx && !ctx.contains(e.target)) {
|
|
5921
5911
|
clearTimeout(hideTimer.value);
|
|
5922
|
-
hideTimer.value = setTimeout(() =>
|
|
5912
|
+
hideTimer.value = setTimeout(() => openChange(false), 200);
|
|
5923
5913
|
}
|
|
5924
5914
|
};
|
|
5915
|
+
const openChange = (opened) => {
|
|
5916
|
+
visible.value = opened;
|
|
5917
|
+
emit("openChange", opened);
|
|
5918
|
+
};
|
|
5925
5919
|
const toggle = (open) => {
|
|
5926
5920
|
if (props.disabled) return false;
|
|
5927
5921
|
if (open) if (!rendered.value) {
|
|
5928
5922
|
rendered.value = true;
|
|
5929
5923
|
document.addEventListener("click", outsideClick);
|
|
5930
5924
|
nextTick(() => {
|
|
5931
|
-
|
|
5925
|
+
openChange(true);
|
|
5932
5926
|
updatePopPosition();
|
|
5933
5927
|
});
|
|
5934
5928
|
} else {
|
|
5935
|
-
|
|
5929
|
+
openChange(true);
|
|
5936
5930
|
updatePopPosition();
|
|
5937
5931
|
}
|
|
5938
|
-
else
|
|
5932
|
+
else openChange(false);
|
|
5939
5933
|
};
|
|
5940
5934
|
const getColor = () => {
|
|
5941
5935
|
let text = "";
|
|
@@ -6409,6 +6403,7 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6409
6403
|
},
|
|
6410
6404
|
presets: Array,
|
|
6411
6405
|
disabled: { type: Boolean },
|
|
6406
|
+
opened: { type: Boolean },
|
|
6412
6407
|
clearable: {
|
|
6413
6408
|
type: Boolean,
|
|
6414
6409
|
default: true
|
|
@@ -6433,19 +6428,13 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6433
6428
|
type: Function,
|
|
6434
6429
|
default: () => false
|
|
6435
6430
|
},
|
|
6436
|
-
size: {
|
|
6437
|
-
type: String,
|
|
6438
|
-
default: "default"
|
|
6439
|
-
},
|
|
6431
|
+
size: { type: String },
|
|
6440
6432
|
dateIcon: { type: Array },
|
|
6441
6433
|
theme: {
|
|
6442
6434
|
type: String,
|
|
6443
|
-
default: "
|
|
6444
|
-
},
|
|
6445
|
-
shape: {
|
|
6446
|
-
type: String,
|
|
6447
|
-
default: "default"
|
|
6435
|
+
default: "fill"
|
|
6448
6436
|
},
|
|
6437
|
+
shape: { type: String },
|
|
6449
6438
|
bordered: {
|
|
6450
6439
|
type: Boolean,
|
|
6451
6440
|
default: true
|
|
@@ -6453,7 +6442,10 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6453
6442
|
placement: {
|
|
6454
6443
|
type: String,
|
|
6455
6444
|
default: "bottom-left"
|
|
6456
|
-
}
|
|
6445
|
+
},
|
|
6446
|
+
onChange: { type: Function },
|
|
6447
|
+
onOpenChange: { type: Function },
|
|
6448
|
+
onClear: { type: Function }
|
|
6457
6449
|
},
|
|
6458
6450
|
setup(props, { emit, slots }) {
|
|
6459
6451
|
const injectedLocale = inject("locale", zh_CN_default);
|
|
@@ -6466,9 +6458,9 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6466
6458
|
const localeName = computed(() => {
|
|
6467
6459
|
return locale.value.name || "zh-cn";
|
|
6468
6460
|
});
|
|
6469
|
-
const isVisible = ref(
|
|
6461
|
+
const isVisible = ref(props.opened);
|
|
6470
6462
|
const isFocus = ref(false);
|
|
6471
|
-
const rendered = ref(
|
|
6463
|
+
const rendered = ref(props.opened);
|
|
6472
6464
|
const currentPlacement = ref(props.placement);
|
|
6473
6465
|
const left = ref(0);
|
|
6474
6466
|
const top = ref(0);
|
|
@@ -6518,6 +6510,10 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6518
6510
|
year: "YYYY"
|
|
6519
6511
|
}[props.mode] || "YYYY-MM-DD";
|
|
6520
6512
|
};
|
|
6513
|
+
const openChange = (opened) => {
|
|
6514
|
+
isVisible.value = opened;
|
|
6515
|
+
emit("openChange", opened);
|
|
6516
|
+
};
|
|
6521
6517
|
const scrollToCurrentTime = () => {
|
|
6522
6518
|
nextTick(() => {
|
|
6523
6519
|
let activeDate = dayjs();
|
|
@@ -6610,13 +6606,13 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6610
6606
|
emit("change", dates, dates.map((d) => getStr(d)));
|
|
6611
6607
|
innerValue.value = dates;
|
|
6612
6608
|
syncTextFromValue();
|
|
6613
|
-
if (closePanel)
|
|
6609
|
+
if (closePanel) openChange(false);
|
|
6614
6610
|
}
|
|
6615
6611
|
} else {
|
|
6616
6612
|
emit("update:modelValue", formatOutputValue(innerValue.value));
|
|
6617
6613
|
emit("change", innerValue.value, getStr(innerValue.value));
|
|
6618
6614
|
syncTextFromValue();
|
|
6619
|
-
if (closePanel)
|
|
6615
|
+
if (closePanel) openChange(false);
|
|
6620
6616
|
}
|
|
6621
6617
|
};
|
|
6622
6618
|
const handleInput = (e, index = 0) => {
|
|
@@ -6648,7 +6644,7 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6648
6644
|
};
|
|
6649
6645
|
const updatePanelState = () => {
|
|
6650
6646
|
if (isVisible.value) return;
|
|
6651
|
-
|
|
6647
|
+
openChange(true);
|
|
6652
6648
|
isFocus.value = true;
|
|
6653
6649
|
if (props.mode === "year") currentView.value = "year";
|
|
6654
6650
|
else if (props.mode === "month") currentView.value = "month";
|
|
@@ -6687,7 +6683,7 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6687
6683
|
else innerValue.value = null;
|
|
6688
6684
|
}
|
|
6689
6685
|
}
|
|
6690
|
-
|
|
6686
|
+
openChange(false);
|
|
6691
6687
|
isFocus.value = false;
|
|
6692
6688
|
}
|
|
6693
6689
|
};
|
|
@@ -6969,7 +6965,20 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6969
6965
|
});
|
|
6970
6966
|
});
|
|
6971
6967
|
};
|
|
6968
|
+
onMounted(() => {
|
|
6969
|
+
if (props.opened) updatePosition();
|
|
6970
|
+
});
|
|
6972
6971
|
onUnmounted(() => document.removeEventListener("click", handleClickOutside));
|
|
6972
|
+
const onClear = (e) => {
|
|
6973
|
+
e.stopPropagation();
|
|
6974
|
+
innerValue.value = null;
|
|
6975
|
+
syncTextFromValue();
|
|
6976
|
+
emit("update:startDate", null);
|
|
6977
|
+
emit("update:endDate", null);
|
|
6978
|
+
emit("update:modelValue", null);
|
|
6979
|
+
emit("change", null, "");
|
|
6980
|
+
emit("clear");
|
|
6981
|
+
};
|
|
6973
6982
|
return () => {
|
|
6974
6983
|
const localPlaceholders = {
|
|
6975
6984
|
year: locale?.value.k.datePicker.selectYear,
|
|
@@ -6987,7 +6996,7 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
6987
6996
|
{ "k-datepicker-sm": props.size == "small" },
|
|
6988
6997
|
{ "k-datepicker-lg": props.size == "large" },
|
|
6989
6998
|
{ "k-datepicker-disabled": props.disabled },
|
|
6990
|
-
{ "k-datepicker-
|
|
6999
|
+
{ "k-datepicker-fill": props.theme == "fill" },
|
|
6991
7000
|
{ "k-datepicker-circle": props.shape == "circle" },
|
|
6992
7001
|
{ "k-datepicker-square": props.shape == "square" }
|
|
6993
7002
|
];
|
|
@@ -7115,15 +7124,7 @@ var DatePicker = /* @__PURE__ */ defineComponent({
|
|
|
7115
7124
|
showClear && createVNode(Icon, {
|
|
7116
7125
|
"type": CircleX,
|
|
7117
7126
|
"class": "k-icon-clean",
|
|
7118
|
-
"onClick":
|
|
7119
|
-
e.stopPropagation();
|
|
7120
|
-
innerValue.value = null;
|
|
7121
|
-
syncTextFromValue();
|
|
7122
|
-
emit("update:startDate", null);
|
|
7123
|
-
emit("update:endDate", null);
|
|
7124
|
-
emit("update:modelValue", null);
|
|
7125
|
-
emit("change", null, "");
|
|
7126
|
-
}
|
|
7127
|
+
"onClick": onClear
|
|
7127
7128
|
}, null)
|
|
7128
7129
|
]), overlay]);
|
|
7129
7130
|
};
|
|
@@ -7201,10 +7202,7 @@ var Descriptions = /* @__PURE__ */ defineComponent({
|
|
|
7201
7202
|
},
|
|
7202
7203
|
title: String,
|
|
7203
7204
|
extra: String,
|
|
7204
|
-
size: {
|
|
7205
|
-
type: String,
|
|
7206
|
-
default: "default"
|
|
7207
|
-
}
|
|
7205
|
+
size: { type: String }
|
|
7208
7206
|
},
|
|
7209
7207
|
setup(props, { slots }) {
|
|
7210
7208
|
return () => {
|
|
@@ -7278,7 +7276,7 @@ var Descriptions = /* @__PURE__ */ defineComponent({
|
|
|
7278
7276
|
const wrapperProps = { class: ["k-descriptions", {
|
|
7279
7277
|
"k-descriptions-vertical": isVertical,
|
|
7280
7278
|
"k-descriptions-bordered": bordered,
|
|
7281
|
-
"k-descriptions-
|
|
7279
|
+
"k-descriptions-medium": size === "medium",
|
|
7282
7280
|
"k-descriptions-sm": size === "small"
|
|
7283
7281
|
}] };
|
|
7284
7282
|
const extraNode = extra || slots.extra?.();
|
|
@@ -7339,7 +7337,8 @@ var Drawer = /* @__PURE__ */ defineComponent({
|
|
|
7339
7337
|
},
|
|
7340
7338
|
onOk: Function,
|
|
7341
7339
|
onCancel: Function,
|
|
7342
|
-
onClose: Function
|
|
7340
|
+
onClose: Function,
|
|
7341
|
+
onOpenChange: Function
|
|
7343
7342
|
},
|
|
7344
7343
|
setup(props, { slots, emit }) {
|
|
7345
7344
|
const injectedLocale = inject("locale", zh_CN_default);
|
|
@@ -7367,6 +7366,7 @@ var Drawer = /* @__PURE__ */ defineComponent({
|
|
|
7367
7366
|
visible.value = value;
|
|
7368
7367
|
opened.value = value;
|
|
7369
7368
|
emit("update:modelValue", true);
|
|
7369
|
+
emit("openChange", true);
|
|
7370
7370
|
});
|
|
7371
7371
|
else {
|
|
7372
7372
|
visible.value = false;
|
|
@@ -7374,6 +7374,7 @@ var Drawer = /* @__PURE__ */ defineComponent({
|
|
|
7374
7374
|
opened.value = false;
|
|
7375
7375
|
}, 300);
|
|
7376
7376
|
emit("update:modelValue", false);
|
|
7377
|
+
emit("openChange", false);
|
|
7377
7378
|
}
|
|
7378
7379
|
};
|
|
7379
7380
|
const escToClose = (event) => {
|
|
@@ -7463,7 +7464,8 @@ var Dropdown = /* @__PURE__ */ defineComponent({
|
|
|
7463
7464
|
type: String,
|
|
7464
7465
|
default: "bottom-left"
|
|
7465
7466
|
},
|
|
7466
|
-
target: Object
|
|
7467
|
+
target: Object,
|
|
7468
|
+
onOpenChange: { type: Function }
|
|
7467
7469
|
},
|
|
7468
7470
|
setup(props, { slots, emit, attrs }) {
|
|
7469
7471
|
const visible = ref(props.show);
|
|
@@ -7495,7 +7497,7 @@ var Dropdown = /* @__PURE__ */ defineComponent({
|
|
|
7495
7497
|
const ctx = refSelection.value?.$el || refSelection.value;
|
|
7496
7498
|
if (!refPopper.value) return;
|
|
7497
7499
|
const target = e.target;
|
|
7498
|
-
if (!refPopper.value.contains(target) && ctx && !ctx.contains(target) || props.trigger == "contextmenu" && !refPopper.value.contains(target))
|
|
7500
|
+
if (!refPopper.value.contains(target) && ctx && !ctx.contains(target) || props.trigger == "contextmenu" && !refPopper.value.contains(target)) openChange(false);
|
|
7499
7501
|
};
|
|
7500
7502
|
const updatePosition = (e) => {
|
|
7501
7503
|
const position = e ? {
|
|
@@ -7514,27 +7516,31 @@ var Dropdown = /* @__PURE__ */ defineComponent({
|
|
|
7514
7516
|
});
|
|
7515
7517
|
});
|
|
7516
7518
|
};
|
|
7519
|
+
const openChange = (opened) => {
|
|
7520
|
+
visible.value = opened;
|
|
7521
|
+
emit("openChange", opened);
|
|
7522
|
+
};
|
|
7517
7523
|
const toggle = (open, e) => {
|
|
7518
7524
|
if (open) if (!rendered.value) {
|
|
7519
7525
|
rendered.value = true;
|
|
7520
7526
|
document.addEventListener("click", outsideClick);
|
|
7521
7527
|
nextTick(() => {
|
|
7522
|
-
|
|
7523
|
-
emit("update:
|
|
7528
|
+
openChange(true);
|
|
7529
|
+
emit("update:show", true);
|
|
7524
7530
|
updatePosition(e);
|
|
7525
7531
|
});
|
|
7526
7532
|
} else {
|
|
7527
|
-
|
|
7528
|
-
emit("update:visible", true);
|
|
7533
|
+
emit("update:show", true);
|
|
7529
7534
|
updatePosition(e);
|
|
7535
|
+
openChange(true);
|
|
7530
7536
|
}
|
|
7531
7537
|
else {
|
|
7532
|
-
|
|
7533
|
-
emit("update:
|
|
7538
|
+
openChange(false);
|
|
7539
|
+
emit("update:show", false);
|
|
7534
7540
|
}
|
|
7535
7541
|
};
|
|
7536
7542
|
const hidePopper = () => {
|
|
7537
|
-
|
|
7543
|
+
openChange(false);
|
|
7538
7544
|
};
|
|
7539
7545
|
provide("dropdown-menu-selected", hidePopper);
|
|
7540
7546
|
const clickEvent = () => {
|
|
@@ -7724,35 +7730,39 @@ var Form = /* @__PURE__ */ defineComponent({
|
|
|
7724
7730
|
labelCol: Object,
|
|
7725
7731
|
wrapperCol: Object,
|
|
7726
7732
|
rules: { type: Object },
|
|
7727
|
-
size: {
|
|
7728
|
-
type: String,
|
|
7729
|
-
default: "default"
|
|
7730
|
-
},
|
|
7733
|
+
size: { type: String },
|
|
7731
7734
|
theme: String,
|
|
7732
7735
|
shape: String,
|
|
7733
7736
|
disabled: Boolean,
|
|
7734
|
-
onSubmit: { type: Function }
|
|
7737
|
+
onSubmit: { type: Function },
|
|
7738
|
+
onReset: { type: Function }
|
|
7735
7739
|
},
|
|
7736
7740
|
setup(props, { emit, slots, expose }) {
|
|
7737
7741
|
const formRef = ref(null);
|
|
7742
|
+
const model = props.model;
|
|
7738
7743
|
const formItems = ref({});
|
|
7739
|
-
const {
|
|
7744
|
+
const { rules, size, shape, theme, disabled, layout, name, labelCol, wrapperCol } = toRefs(props);
|
|
7740
7745
|
const updateMode = (prop, value = null) => {
|
|
7741
|
-
const { o, k } = getPropByPath(model
|
|
7746
|
+
const { o, k } = getPropByPath(model, prop);
|
|
7742
7747
|
if (o) {
|
|
7743
7748
|
o[k] = value;
|
|
7744
|
-
emit("change", model
|
|
7749
|
+
emit("change", model);
|
|
7745
7750
|
}
|
|
7746
7751
|
};
|
|
7747
7752
|
const getValueFromProp = (path) => {
|
|
7748
|
-
const { v } = getPropByPath(model
|
|
7753
|
+
const { v } = getPropByPath(model, path);
|
|
7749
7754
|
return v;
|
|
7750
7755
|
};
|
|
7751
7756
|
const reset = () => {
|
|
7757
|
+
form.cleaned = false;
|
|
7752
7758
|
Object.keys(formItems.value).forEach((prop) => {
|
|
7753
7759
|
updateMode(prop);
|
|
7754
7760
|
formItems.value[prop].valid = true;
|
|
7755
7761
|
});
|
|
7762
|
+
nextTick(() => {
|
|
7763
|
+
form.cleaned = true;
|
|
7764
|
+
});
|
|
7765
|
+
emit("reset");
|
|
7756
7766
|
};
|
|
7757
7767
|
const test = (key) => {
|
|
7758
7768
|
const item = formItems.value[key];
|
|
@@ -7799,9 +7809,6 @@ var Form = /* @__PURE__ */ defineComponent({
|
|
|
7799
7809
|
});
|
|
7800
7810
|
if (typeof callback === "function") callback({ valid: result });
|
|
7801
7811
|
};
|
|
7802
|
-
watch(model, () => {
|
|
7803
|
-
validate();
|
|
7804
|
-
});
|
|
7805
7812
|
const register = (item) => {
|
|
7806
7813
|
formItems.value[item.prop] = item;
|
|
7807
7814
|
};
|
|
@@ -7814,7 +7821,7 @@ var Form = /* @__PURE__ */ defineComponent({
|
|
|
7814
7821
|
test,
|
|
7815
7822
|
submit
|
|
7816
7823
|
});
|
|
7817
|
-
|
|
7824
|
+
const form = reactive({
|
|
7818
7825
|
model,
|
|
7819
7826
|
layout,
|
|
7820
7827
|
name,
|
|
@@ -7826,29 +7833,26 @@ var Form = /* @__PURE__ */ defineComponent({
|
|
|
7826
7833
|
getValueFromProp,
|
|
7827
7834
|
updateMode,
|
|
7828
7835
|
register,
|
|
7829
|
-
unregister
|
|
7830
|
-
|
|
7836
|
+
unregister,
|
|
7837
|
+
labelCol,
|
|
7838
|
+
wrapperCol,
|
|
7839
|
+
cleaned: ref(true)
|
|
7840
|
+
});
|
|
7841
|
+
provide("Form", form);
|
|
7831
7842
|
return () => {
|
|
7832
|
-
const { layout, size,
|
|
7833
|
-
const classes = ["k-form", {
|
|
7834
|
-
[`k-form-${layout}`]: layout,
|
|
7835
|
-
"k-form-lg": size === "large",
|
|
7836
|
-
"k-form-sm": size === "small"
|
|
7837
|
-
}];
|
|
7838
|
-
const children = getChildren(slots.default?.());
|
|
7843
|
+
const { layout, size, name } = props;
|
|
7839
7844
|
return createVNode("form", {
|
|
7840
7845
|
"ref": formRef,
|
|
7841
|
-
"class":
|
|
7846
|
+
"class": ["k-form", {
|
|
7847
|
+
[`k-form-${layout}`]: layout,
|
|
7848
|
+
"k-form-lg": size === "large",
|
|
7849
|
+
"k-form-sm": size === "small"
|
|
7850
|
+
}],
|
|
7842
7851
|
"id": name,
|
|
7843
7852
|
"onSubmit": onSubmit,
|
|
7844
7853
|
"onReset": reset,
|
|
7845
7854
|
"autocomplete": "off"
|
|
7846
|
-
}, [
|
|
7847
|
-
return cloneVNode(child, {
|
|
7848
|
-
labelCol: child.props?.labelCol || labelCol,
|
|
7849
|
-
wrapperCol: child.props?.wrapperCol || wrapperCol
|
|
7850
|
-
}, true);
|
|
7851
|
-
})]);
|
|
7855
|
+
}, [slots.default?.()]);
|
|
7852
7856
|
};
|
|
7853
7857
|
}
|
|
7854
7858
|
});
|
|
@@ -8018,17 +8022,17 @@ var FormItem = /* @__PURE__ */ defineComponent({
|
|
|
8018
8022
|
valid.value = isValid;
|
|
8019
8023
|
return isValid;
|
|
8020
8024
|
};
|
|
8021
|
-
const validate = (rules
|
|
8025
|
+
const validate = (rules) => {
|
|
8022
8026
|
if (!rules) return true;
|
|
8023
8027
|
if (rules.constructor === Object) return test(rules);
|
|
8024
8028
|
const sortedRules = [...rules].sort((a) => a.required ? -1 : 0);
|
|
8025
8029
|
for (let i = 0; i < sortedRules.length; i++) if (!test(sortedRules[i])) break;
|
|
8026
8030
|
return valid.value;
|
|
8027
8031
|
};
|
|
8028
|
-
const testValue = (
|
|
8032
|
+
const testValue = () => {
|
|
8029
8033
|
if (props.prop) {
|
|
8030
8034
|
const rules = props.rules || (Form.rules || {})[props.prop];
|
|
8031
|
-
rules && validate(rules
|
|
8035
|
+
rules && validate(rules);
|
|
8032
8036
|
}
|
|
8033
8037
|
};
|
|
8034
8038
|
const { prop, rules } = toRefs(props);
|
|
@@ -8044,19 +8048,25 @@ var FormItem = /* @__PURE__ */ defineComponent({
|
|
|
8044
8048
|
onBeforeUnmount(() => {
|
|
8045
8049
|
if (props.prop) Form.unregister?.(formItem);
|
|
8046
8050
|
});
|
|
8051
|
+
watch(computed(() => {
|
|
8052
|
+
const prop = props.prop;
|
|
8053
|
+
return prop ? Form.getValueFromProp?.(prop) ?? void 0 : void 0;
|
|
8054
|
+
}), () => {
|
|
8055
|
+
if (props.prop && Form.cleaned) testValue();
|
|
8056
|
+
});
|
|
8047
8057
|
return () => {
|
|
8048
8058
|
const { label, prop } = props;
|
|
8049
|
-
const rules = props.rules || (prop ? Form.rules[prop] :
|
|
8059
|
+
const rules = props.rules || (prop ? Form.rules?.[prop] : void 0) || [];
|
|
8050
8060
|
const classes = ["k-form-item", {
|
|
8051
8061
|
"k-form-item-required": rules.constructor === Object ? rules.required : rules.filter((r) => r.required).length > 0,
|
|
8052
8062
|
"k-form-item-error": !valid.value
|
|
8053
8063
|
}];
|
|
8054
|
-
let labelProp, wrapperProp;
|
|
8055
|
-
if (Form.layout == "vertical") delete props.wrapperCol?.offset;
|
|
8064
|
+
let labelProp = {}, wrapperProp = {};
|
|
8056
8065
|
if (Form.layout != "inline") {
|
|
8057
|
-
labelProp =
|
|
8058
|
-
wrapperProp =
|
|
8066
|
+
labelProp = props.labelCol || Form.labelCol || {};
|
|
8067
|
+
wrapperProp = props.wrapperCol || Form.wrapperCol || {};
|
|
8059
8068
|
}
|
|
8069
|
+
if (Form.layout == "vertical") delete wrapperProp?.offset;
|
|
8060
8070
|
const children = getChildren(slots.default?.());
|
|
8061
8071
|
let id = void 0;
|
|
8062
8072
|
if (Form.name && prop) id = `${Form.name || `form_`}_${prop}`;
|
|
@@ -8065,8 +8075,7 @@ var FormItem = /* @__PURE__ */ defineComponent({
|
|
|
8065
8075
|
"type": "flex"
|
|
8066
8076
|
}, { default: () => [label ? createVNode(Col, mergeProps({ "class": "k-form-item-label" }, labelProp), { default: () => [createVNode("label", { "for": id }, [label])] }) : null, createVNode(Col, wrapperProp, { default: () => [createVNode("div", { "class": "k-form-item-content" }, [children.map((child) => {
|
|
8067
8077
|
if (isVNode(child)) {
|
|
8068
|
-
const
|
|
8069
|
-
const value = prop ? Form.getValueFromProp?.(prop) || void 0 : void 0;
|
|
8078
|
+
const value = prop ? Form.getValueFromProp?.(prop) ?? void 0 : void 0;
|
|
8070
8079
|
const propsData = child?.props || {};
|
|
8071
8080
|
const size = propsData.size || Form.size;
|
|
8072
8081
|
const theme = propsData.theme || Form.theme;
|
|
@@ -8079,24 +8088,13 @@ var FormItem = /* @__PURE__ */ defineComponent({
|
|
|
8079
8088
|
theme,
|
|
8080
8089
|
shape
|
|
8081
8090
|
};
|
|
8082
|
-
const childEvents = {};
|
|
8083
8091
|
if (prop) {
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
if (tag) {
|
|
8088
|
-
Form.updateMode?.(prop, value);
|
|
8089
|
-
testValue();
|
|
8090
|
-
}
|
|
8092
|
+
childProps.modelValue = value;
|
|
8093
|
+
childProps["onUpdate:modelValue"] = (value) => {
|
|
8094
|
+
Form.updateMode?.(prop, value);
|
|
8091
8095
|
};
|
|
8092
8096
|
}
|
|
8093
|
-
|
|
8094
|
-
testValue();
|
|
8095
|
-
};
|
|
8096
|
-
return cloneVNode(child, {
|
|
8097
|
-
...childProps,
|
|
8098
|
-
...childEvents
|
|
8099
|
-
});
|
|
8097
|
+
return cloneVNode(child, { ...childProps });
|
|
8100
8098
|
} else return child;
|
|
8101
8099
|
}), prop ? createVNode(Transition, { "name": "k-form-item-fade" }, { default: () => [!valid.value ? createVNode("div", { "class": "k-form-item-error-tip" }, [message.value]) : null] }) : null])] })] });
|
|
8102
8100
|
};
|
|
@@ -8130,10 +8128,10 @@ var Flex = /* @__PURE__ */ defineComponent({
|
|
|
8130
8128
|
}]
|
|
8131
8129
|
};
|
|
8132
8130
|
if (Array.isArray(size)) _props.style = { gap: `${size[1]}px ${size[0]}px` };
|
|
8133
|
-
else if (/small|
|
|
8131
|
+
else if (/small|medium|large/.test(size)) {
|
|
8134
8132
|
const sizes = {
|
|
8135
8133
|
small: 8,
|
|
8136
|
-
|
|
8134
|
+
medium: 16,
|
|
8137
8135
|
large: 24,
|
|
8138
8136
|
default: 16
|
|
8139
8137
|
};
|
|
@@ -8480,9 +8478,9 @@ var Tooltip = /* @__PURE__ */ defineComponent({
|
|
|
8480
8478
|
};
|
|
8481
8479
|
const contentProps = {
|
|
8482
8480
|
class: [`k-${preCls}-content`],
|
|
8483
|
-
style: { backgroundColor: isColor(color) ? colors$1.includes(color
|
|
8481
|
+
style: { backgroundColor: isColor(color) ? colors$1.includes(color) ? `var(--kui-color-${color})` : color : void 0 }
|
|
8484
8482
|
};
|
|
8485
|
-
const arrowProps = { style: { fill: isColor(color) ? colors$1.includes(color
|
|
8483
|
+
const arrowProps = { style: { fill: isColor(color) ? colors$1.includes(color) ? `var(--kui-color-${color})` : color : "currentcolor" } };
|
|
8486
8484
|
return [nodeWrapper, rendered.value ? createVNode(Transition, { "name": `k-${preCls}` }, { default: () => [withDirectives(createVNode("div", overlayProps, [createVNode("div", contentProps, [createVNode("div", { "class": `k-${preCls}-title` }, [title]), createVNode("div", { "class": `k-${preCls}-arrow` }, [createVNode("svg", mergeProps(arrowProps, { "viewBox": "0 0 24 7" }), [createVNode("path", { "d": "M24 0V1C20 1 18.5 2 16.5 4C14.5 6 14 7 12 7C10 7 9.5 6 7.5 4C5.5 2 4 1 0 1V0H24Z" }, null)])])])]), [[resolveDirective("transfer"), true], [vShow, visible.value]])] }) : null];
|
|
8487
8485
|
};
|
|
8488
8486
|
}
|
|
@@ -10021,7 +10019,8 @@ var content_default = /* @__PURE__ */ defineComponent({
|
|
|
10021
10019
|
info: Info,
|
|
10022
10020
|
error: CircleX,
|
|
10023
10021
|
success: CircleCheck,
|
|
10024
|
-
warning: CircleAlert
|
|
10022
|
+
warning: CircleAlert,
|
|
10023
|
+
loading: Loading
|
|
10025
10024
|
}[type] : null;
|
|
10026
10025
|
const classes = [`k-${noticeType}-box`, {
|
|
10027
10026
|
[`k-${noticeType}-${type}`]: type,
|
|
@@ -10031,7 +10030,8 @@ var content_default = /* @__PURE__ */ defineComponent({
|
|
|
10031
10030
|
if (AlertIcon) children.push(createVNode(Icon, {
|
|
10032
10031
|
"type": AlertIcon,
|
|
10033
10032
|
"color": color,
|
|
10034
|
-
"class": `k-${noticeType}-icon
|
|
10033
|
+
"class": `k-${noticeType}-icon`,
|
|
10034
|
+
"spin": type == "loading"
|
|
10035
10035
|
}, null));
|
|
10036
10036
|
if (noticeType == "message") {
|
|
10037
10037
|
children.push(createVNode("span", null, [content]));
|
|
@@ -10069,19 +10069,20 @@ var container_default = /* @__PURE__ */ defineComponent({
|
|
|
10069
10069
|
const options = ref([]);
|
|
10070
10070
|
const show = (option) => {
|
|
10071
10071
|
let { duration = 3.5, onClose, closable, noticeType } = option;
|
|
10072
|
-
|
|
10073
|
-
let timer;
|
|
10074
|
-
let callback = (
|
|
10072
|
+
const key = getUuid();
|
|
10073
|
+
let timer = void 0;
|
|
10074
|
+
let callback = () => {
|
|
10075
10075
|
typeof onClose === "function" && onClose();
|
|
10076
10076
|
options.value = options.value.filter((item) => item.key !== key);
|
|
10077
10077
|
clearTimeout(timer);
|
|
10078
10078
|
};
|
|
10079
|
-
duration > 0 && (timer = setTimeout(callback, duration * 1e3
|
|
10080
|
-
if (closable === true && noticeType == "message" || noticeType == "notice") option.onClose = () => callback(
|
|
10079
|
+
duration > 0 && (timer = setTimeout(callback, duration * 1e3));
|
|
10080
|
+
if (closable === true && noticeType == "message" || noticeType == "notice") option.onClose = () => callback();
|
|
10081
10081
|
options.value.push({
|
|
10082
10082
|
...option,
|
|
10083
10083
|
key
|
|
10084
10084
|
});
|
|
10085
|
+
return callback;
|
|
10085
10086
|
};
|
|
10086
10087
|
const clean = () => {
|
|
10087
10088
|
options.value = [];
|
|
@@ -10140,7 +10141,7 @@ var message = {
|
|
|
10140
10141
|
show(options = {}) {
|
|
10141
10142
|
if (!messageInstance) messageInstance = createInstance("message");
|
|
10142
10143
|
const props = Object.assign(options, { noticeType: "message" });
|
|
10143
|
-
messageInstance?.show(props);
|
|
10144
|
+
return messageInstance?.show(props);
|
|
10144
10145
|
},
|
|
10145
10146
|
destroy() {
|
|
10146
10147
|
if (messageInstance) {
|
|
@@ -10180,6 +10181,13 @@ var message = {
|
|
|
10180
10181
|
duration,
|
|
10181
10182
|
onClose
|
|
10182
10183
|
});
|
|
10184
|
+
},
|
|
10185
|
+
loading(content, duration) {
|
|
10186
|
+
return this.show({
|
|
10187
|
+
type: "loading",
|
|
10188
|
+
content,
|
|
10189
|
+
duration
|
|
10190
|
+
});
|
|
10183
10191
|
}
|
|
10184
10192
|
};
|
|
10185
10193
|
//#endregion
|
|
@@ -10197,6 +10205,10 @@ var Modal = /* @__PURE__ */ defineComponent({
|
|
|
10197
10205
|
cancelText: String,
|
|
10198
10206
|
top: Number,
|
|
10199
10207
|
width: Number,
|
|
10208
|
+
transfer: {
|
|
10209
|
+
type: Boolean,
|
|
10210
|
+
default: true
|
|
10211
|
+
},
|
|
10200
10212
|
mask: {
|
|
10201
10213
|
type: Boolean,
|
|
10202
10214
|
default: true
|
|
@@ -10223,7 +10235,8 @@ var Modal = /* @__PURE__ */ defineComponent({
|
|
|
10223
10235
|
},
|
|
10224
10236
|
onClose: { type: Function },
|
|
10225
10237
|
onOk: { type: Function },
|
|
10226
|
-
onCancel: { type: Function }
|
|
10238
|
+
onCancel: { type: Function },
|
|
10239
|
+
onOpenChange: { type: Function }
|
|
10227
10240
|
},
|
|
10228
10241
|
setup(props, { slots, emit }) {
|
|
10229
10242
|
const visible = ref(props.modelValue);
|
|
@@ -10276,6 +10289,7 @@ var Modal = /* @__PURE__ */ defineComponent({
|
|
|
10276
10289
|
visible.value = value;
|
|
10277
10290
|
showInner.value = value;
|
|
10278
10291
|
emit("update:modelValue", true);
|
|
10292
|
+
emit("openChange", true);
|
|
10279
10293
|
nextTick(() => {
|
|
10280
10294
|
updateOrigin();
|
|
10281
10295
|
});
|
|
@@ -10286,6 +10300,7 @@ var Modal = /* @__PURE__ */ defineComponent({
|
|
|
10286
10300
|
showInner.value = false;
|
|
10287
10301
|
}, 300);
|
|
10288
10302
|
emit("update:modelValue", false);
|
|
10303
|
+
emit("openChange", false);
|
|
10289
10304
|
}
|
|
10290
10305
|
};
|
|
10291
10306
|
const updateOrigin = () => {
|
|
@@ -10397,7 +10412,7 @@ var Modal = /* @__PURE__ */ defineComponent({
|
|
|
10397
10412
|
"class": "k-modal-inner",
|
|
10398
10413
|
"ref": refModal,
|
|
10399
10414
|
"style": style
|
|
10400
|
-
}, [contentNode, createVNode("div", { "tabindex": "0" }, null)]), [[vShow, visible.value]])] })]), [[vShow, showInner.value]])]), [[resolveDirective("transfer"),
|
|
10415
|
+
}, [contentNode, createVNode("div", { "tabindex": "0" }, null)]), [[vShow, visible.value]])] })]), [[vShow, showInner.value]])]), [[resolveDirective("transfer"), props.transfer]]) : null;
|
|
10401
10416
|
};
|
|
10402
10417
|
}
|
|
10403
10418
|
});
|
|
@@ -10611,7 +10626,7 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
10611
10626
|
showElevator: Boolean,
|
|
10612
10627
|
theme: {
|
|
10613
10628
|
type: String,
|
|
10614
|
-
default: "
|
|
10629
|
+
default: "fill"
|
|
10615
10630
|
},
|
|
10616
10631
|
sizeData: {
|
|
10617
10632
|
type: Array,
|
|
@@ -10623,10 +10638,7 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
10623
10638
|
40
|
|
10624
10639
|
]
|
|
10625
10640
|
},
|
|
10626
|
-
size: {
|
|
10627
|
-
default: "default",
|
|
10628
|
-
type: String
|
|
10629
|
-
},
|
|
10641
|
+
size: { type: String },
|
|
10630
10642
|
total: {
|
|
10631
10643
|
default: 0,
|
|
10632
10644
|
type: Number
|
|
@@ -10812,7 +10824,7 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
10812
10824
|
return () => {
|
|
10813
10825
|
const classes = ["k-page", {
|
|
10814
10826
|
["k-page-sm"]: props.size == "small",
|
|
10815
|
-
"k-page-
|
|
10827
|
+
"k-page-fill": props.theme == "fill",
|
|
10816
10828
|
"k-page-disabled": props.disabled
|
|
10817
10829
|
}], preNode = createVNode("li", {
|
|
10818
10830
|
"class": ["k-pager-item k-pager-prev", { "k-pager-item-disabled": defaultPage.value == 1 }],
|
|
@@ -11024,8 +11036,8 @@ var Popconfirm = /* @__PURE__ */ defineComponent({
|
|
|
11024
11036
|
const locale = computed(() => {
|
|
11025
11037
|
return injectedLocale instanceof Object && "value" in injectedLocale ? injectedLocale.value : injectedLocale;
|
|
11026
11038
|
});
|
|
11027
|
-
const rendered = ref(
|
|
11028
|
-
const visible = ref(
|
|
11039
|
+
const rendered = ref(props.show);
|
|
11040
|
+
const visible = ref(props.show);
|
|
11029
11041
|
const refPopper = ref();
|
|
11030
11042
|
const refSelection = ref();
|
|
11031
11043
|
const left = ref(0);
|
|
@@ -11180,10 +11192,7 @@ var Progress = /* @__PURE__ */ defineComponent({
|
|
|
11180
11192
|
type: String,
|
|
11181
11193
|
default: "round"
|
|
11182
11194
|
},
|
|
11183
|
-
size: {
|
|
11184
|
-
type: String,
|
|
11185
|
-
default: "default"
|
|
11186
|
-
},
|
|
11195
|
+
size: { type: String },
|
|
11187
11196
|
status: {
|
|
11188
11197
|
type: String,
|
|
11189
11198
|
default: "normal"
|
|
@@ -11318,12 +11327,9 @@ var Radio = /* @__PURE__ */ defineComponent({
|
|
|
11318
11327
|
disabled: Boolean,
|
|
11319
11328
|
theme: {
|
|
11320
11329
|
type: String,
|
|
11321
|
-
default: "
|
|
11322
|
-
},
|
|
11323
|
-
size: {
|
|
11324
|
-
type: String,
|
|
11325
|
-
default: "default"
|
|
11330
|
+
default: "fill"
|
|
11326
11331
|
},
|
|
11332
|
+
size: { type: String },
|
|
11327
11333
|
onChange: Function
|
|
11328
11334
|
},
|
|
11329
11335
|
setup(props, { slots, emit }) {
|
|
@@ -11361,7 +11367,7 @@ var Radio = /* @__PURE__ */ defineComponent({
|
|
|
11361
11367
|
};
|
|
11362
11368
|
return () => {
|
|
11363
11369
|
const classes = ["k-radio", {
|
|
11364
|
-
["k-radio-
|
|
11370
|
+
["k-radio-fill"]: props.theme == "fill",
|
|
11365
11371
|
["k-radio-disabled"]: props.disabled,
|
|
11366
11372
|
["k-radio-checked"]: isChecked.value,
|
|
11367
11373
|
["k-radio-lg"]: props.size === "large",
|
|
@@ -11401,11 +11407,9 @@ var RadioButton = /* @__PURE__ */ defineComponent({
|
|
|
11401
11407
|
disabled: Boolean,
|
|
11402
11408
|
checked: Boolean,
|
|
11403
11409
|
icon: Array,
|
|
11404
|
-
size: {
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
},
|
|
11408
|
-
shape: { type: String }
|
|
11410
|
+
size: { type: String },
|
|
11411
|
+
shape: { type: String },
|
|
11412
|
+
onChange: Function
|
|
11409
11413
|
},
|
|
11410
11414
|
setup(props, { slots, emit, attrs }) {
|
|
11411
11415
|
const isChecked = ref(props.modelValue || props.checked);
|
|
@@ -11430,9 +11434,9 @@ var RadioButton = /* @__PURE__ */ defineComponent({
|
|
|
11430
11434
|
};
|
|
11431
11435
|
return () => {
|
|
11432
11436
|
return createVNode(Button, {
|
|
11433
|
-
...props,
|
|
11434
11437
|
disabled: props.disabled,
|
|
11435
11438
|
size: props.size,
|
|
11439
|
+
icon: props.icon,
|
|
11436
11440
|
theme: props.theme,
|
|
11437
11441
|
shape: props.shape,
|
|
11438
11442
|
type: isChecked.value ? "primary" : "default",
|
|
@@ -11462,7 +11466,48 @@ var RadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
11462
11466
|
onChange: Function
|
|
11463
11467
|
},
|
|
11464
11468
|
setup(props, { slots, emit }) {
|
|
11469
|
+
const rootRef = ref();
|
|
11470
|
+
const observerRef = ref();
|
|
11465
11471
|
const currentValue = ref(props.modelValue);
|
|
11472
|
+
const itemRefs = /* @__PURE__ */ new Map();
|
|
11473
|
+
const isVertical = computed(() => props.direction === "vertical");
|
|
11474
|
+
const segStyle = ref(isVertical.value ? {
|
|
11475
|
+
height: "0px",
|
|
11476
|
+
top: "0px"
|
|
11477
|
+
} : {
|
|
11478
|
+
width: "0px",
|
|
11479
|
+
left: "0px"
|
|
11480
|
+
});
|
|
11481
|
+
const changed = ref(false);
|
|
11482
|
+
const setItemRef = (el, value) => {
|
|
11483
|
+
if (el) itemRefs.set(value, el.$el || el);
|
|
11484
|
+
};
|
|
11485
|
+
const updateSeg = () => {
|
|
11486
|
+
if (props.theme !== "card" || props.type !== "button") return;
|
|
11487
|
+
changed.value = true;
|
|
11488
|
+
nextTick(updateSize);
|
|
11489
|
+
};
|
|
11490
|
+
const updateSize = () => {
|
|
11491
|
+
const activeEl = itemRefs.get(currentValue.value);
|
|
11492
|
+
if (activeEl) setTimeout(() => {
|
|
11493
|
+
segStyle.value = isVertical.value ? {
|
|
11494
|
+
height: `${activeEl.offsetHeight - 4}px`,
|
|
11495
|
+
top: `${activeEl.offsetTop + 2}px`
|
|
11496
|
+
} : {
|
|
11497
|
+
width: `${activeEl.offsetWidth - 4}px`,
|
|
11498
|
+
left: `${activeEl.offsetLeft + 2}px`
|
|
11499
|
+
};
|
|
11500
|
+
});
|
|
11501
|
+
};
|
|
11502
|
+
onMounted(() => {
|
|
11503
|
+
observerRef.value = new ResizeObserver(() => {
|
|
11504
|
+
updateSize();
|
|
11505
|
+
});
|
|
11506
|
+
observerRef.value.observe(rootRef.value);
|
|
11507
|
+
});
|
|
11508
|
+
onUnmounted(() => {
|
|
11509
|
+
if (observerRef.value) observerRef.value.disconnect();
|
|
11510
|
+
});
|
|
11466
11511
|
const onChange = ({ value }) => {
|
|
11467
11512
|
currentValue.value = value;
|
|
11468
11513
|
emit("update:modelValue", value);
|
|
@@ -11470,7 +11515,11 @@ var RadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
11470
11515
|
};
|
|
11471
11516
|
watch(() => props.modelValue, (val) => {
|
|
11472
11517
|
currentValue.value = val;
|
|
11518
|
+
updateSeg();
|
|
11473
11519
|
});
|
|
11520
|
+
const onTransitionEnd = (e) => {
|
|
11521
|
+
if (e.propertyName === "left" || e.propertyName === "top") changed.value = false;
|
|
11522
|
+
};
|
|
11474
11523
|
const optionsData = computed(() => {
|
|
11475
11524
|
let { options } = props;
|
|
11476
11525
|
if (!options) {
|
|
@@ -11488,10 +11537,13 @@ var RadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
11488
11537
|
return options;
|
|
11489
11538
|
});
|
|
11490
11539
|
return () => {
|
|
11540
|
+
const isButton = props.type === "button";
|
|
11541
|
+
const isCard = props.theme === "card";
|
|
11491
11542
|
let options = optionsData.value;
|
|
11492
11543
|
let nodes = [];
|
|
11493
|
-
const Component =
|
|
11544
|
+
const Component = isButton ? RadioButton : Radio;
|
|
11494
11545
|
options.forEach((option) => nodes.push(createVNode(Component, {
|
|
11546
|
+
"ref": (el) => setItemRef(el, option.value),
|
|
11495
11547
|
"key": option.label,
|
|
11496
11548
|
"label": option.label,
|
|
11497
11549
|
"value": option.value,
|
|
@@ -11503,13 +11555,21 @@ var RadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
11503
11555
|
"theme": props.theme,
|
|
11504
11556
|
"shape": props.shape
|
|
11505
11557
|
}, null)));
|
|
11506
|
-
return createVNode("div", {
|
|
11507
|
-
"k-radio-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11558
|
+
return createVNode("div", {
|
|
11559
|
+
"class": ["k-radio-group", {
|
|
11560
|
+
"k-radio-button-group": isButton,
|
|
11561
|
+
"k-radio-button-changed": changed.value,
|
|
11562
|
+
"k-radio-group-circle": props.shape === "circle",
|
|
11563
|
+
"k-radio-group-fill": props.theme === "fill" && isButton,
|
|
11564
|
+
"k-radio-group-card": isCard && isButton,
|
|
11565
|
+
"k-radio-group-vertical": props.direction === "vertical"
|
|
11566
|
+
}],
|
|
11567
|
+
"ref": rootRef
|
|
11568
|
+
}, [nodes, changed.value && isCard && isButton && createVNode("div", {
|
|
11569
|
+
"class": "k-radio-group-card-seg",
|
|
11570
|
+
"style": segStyle.value,
|
|
11571
|
+
"onTransitionend": onTransitionEnd
|
|
11572
|
+
}, null)]);
|
|
11513
11573
|
};
|
|
11514
11574
|
}
|
|
11515
11575
|
});
|
|
@@ -11646,7 +11706,7 @@ var Rate = /* @__PURE__ */ defineComponent({
|
|
|
11646
11706
|
let { count, allowHalf, character, disabled, tooltips = [], icon, showScore, color, size } = props;
|
|
11647
11707
|
if (typeof size === "string") size = {
|
|
11648
11708
|
small: 20,
|
|
11649
|
-
|
|
11709
|
+
medium: 24,
|
|
11650
11710
|
large: 32,
|
|
11651
11711
|
default: 24
|
|
11652
11712
|
}[size];
|
|
@@ -11810,7 +11870,7 @@ var SkeletonAvatar = /* @__PURE__ */ defineComponent({
|
|
|
11810
11870
|
class: ["k-skeleton-avatar", {
|
|
11811
11871
|
"k-skeleton-avatar-lg": size == "large",
|
|
11812
11872
|
"k-skeleton-avatar-sm": size == "small",
|
|
11813
|
-
[`k-skeleton-avatar-${shape}`]: shape != "
|
|
11873
|
+
[`k-skeleton-avatar-${shape}`]: shape != "round"
|
|
11814
11874
|
}],
|
|
11815
11875
|
style: {}
|
|
11816
11876
|
};
|
|
@@ -11851,7 +11911,7 @@ var SkeletonButton = /* @__PURE__ */ defineComponent({
|
|
|
11851
11911
|
class: ["k-skeleton-btn", {
|
|
11852
11912
|
"k-skeleton-btn-lg": size == "large",
|
|
11853
11913
|
"k-skeleton-btn-sm": size == "small",
|
|
11854
|
-
[`k-skeleton-btn-${shape}`]: shape != "
|
|
11914
|
+
[`k-skeleton-btn-${shape}`]: shape != "round"
|
|
11855
11915
|
}],
|
|
11856
11916
|
style: {}
|
|
11857
11917
|
};
|
|
@@ -12505,7 +12565,7 @@ var Space = /* @__PURE__ */ defineComponent({
|
|
|
12505
12565
|
if (Array.isArray(size)) style.gap = `${size[1]}px ${size[0]}px`;
|
|
12506
12566
|
else if (typeof size === "string") style.gap = `${{
|
|
12507
12567
|
small: 8,
|
|
12508
|
-
|
|
12568
|
+
medium: 16,
|
|
12509
12569
|
large: 24,
|
|
12510
12570
|
default: 16
|
|
12511
12571
|
}[size]}px`;
|
|
@@ -12545,10 +12605,7 @@ var Spin = /* @__PURE__ */ defineComponent({
|
|
|
12545
12605
|
type: Number,
|
|
12546
12606
|
default: 500
|
|
12547
12607
|
},
|
|
12548
|
-
size: {
|
|
12549
|
-
type: String,
|
|
12550
|
-
default: "default"
|
|
12551
|
-
},
|
|
12608
|
+
size: { type: String },
|
|
12552
12609
|
mode: {
|
|
12553
12610
|
type: String,
|
|
12554
12611
|
default: "rotate"
|
|
@@ -12586,41 +12643,51 @@ var Spin = /* @__PURE__ */ defineComponent({
|
|
|
12586
12643
|
var Switch = /* @__PURE__ */ defineComponent({
|
|
12587
12644
|
name: "KSwitch",
|
|
12588
12645
|
props: {
|
|
12589
|
-
checked:
|
|
12590
|
-
|
|
12646
|
+
checked: {
|
|
12647
|
+
type: Boolean,
|
|
12648
|
+
default: false
|
|
12649
|
+
},
|
|
12650
|
+
valueType: {
|
|
12651
|
+
type: String,
|
|
12652
|
+
default: "boolean"
|
|
12653
|
+
},
|
|
12654
|
+
modelValue: { type: [
|
|
12655
|
+
String,
|
|
12656
|
+
Number,
|
|
12657
|
+
Boolean
|
|
12658
|
+
] },
|
|
12591
12659
|
type: String,
|
|
12592
12660
|
disabled: Boolean,
|
|
12593
12661
|
loading: Boolean,
|
|
12594
|
-
size: {
|
|
12595
|
-
default: "default",
|
|
12596
|
-
type: String
|
|
12597
|
-
},
|
|
12662
|
+
size: { type: String },
|
|
12598
12663
|
trueText: String,
|
|
12599
12664
|
falseText: String,
|
|
12600
12665
|
onChange: Function
|
|
12601
12666
|
},
|
|
12602
|
-
setup(
|
|
12603
|
-
const isChecked = ref(
|
|
12604
|
-
watch(() =>
|
|
12605
|
-
isChecked.value = nv;
|
|
12667
|
+
setup(props, { slots, emit }) {
|
|
12668
|
+
const isChecked = ref(props.modelValue || props.checked);
|
|
12669
|
+
watch(() => props.modelValue, (nv) => {
|
|
12670
|
+
isChecked.value = nv == 1;
|
|
12606
12671
|
});
|
|
12607
|
-
watch(() =>
|
|
12672
|
+
watch(() => props.checked, (nv) => {
|
|
12608
12673
|
isChecked.value = nv;
|
|
12609
12674
|
});
|
|
12610
12675
|
const change = () => {
|
|
12611
|
-
if (
|
|
12676
|
+
if (props.disabled) return false;
|
|
12612
12677
|
const checked = !isChecked.value;
|
|
12613
12678
|
isChecked.value = checked;
|
|
12614
|
-
|
|
12615
|
-
emit("
|
|
12679
|
+
const value = getValueWithType(checked, props.valueType);
|
|
12680
|
+
emit("update:modelValue", value);
|
|
12681
|
+
emit("update:checked", checked);
|
|
12682
|
+
emit("change", value);
|
|
12616
12683
|
};
|
|
12617
12684
|
return () => {
|
|
12618
|
-
const { type, trueText, falseText, disabled, loading, size } =
|
|
12685
|
+
const { type, trueText, falseText, disabled, loading, size } = props;
|
|
12619
12686
|
const classes = ["k-switch", {
|
|
12620
12687
|
["k-switch-checked"]: isChecked.value,
|
|
12621
12688
|
["k-switch-disabled"]: disabled || loading,
|
|
12622
12689
|
[`k-switch-${type}`]: !!type,
|
|
12623
|
-
["k-switch-sm"]:
|
|
12690
|
+
["k-switch-sm"]: props.size == "small"
|
|
12624
12691
|
}];
|
|
12625
12692
|
const children = slots.checked?.() || trueText || slots.unchecked?.() || falseText;
|
|
12626
12693
|
const loadNode = loading ? createVNode(Icon, {
|
|
@@ -12665,10 +12732,7 @@ var Table = /* @__PURE__ */ defineComponent({
|
|
|
12665
12732
|
type: Object,
|
|
12666
12733
|
default: () => ({})
|
|
12667
12734
|
},
|
|
12668
|
-
size: {
|
|
12669
|
-
type: String,
|
|
12670
|
-
default: "default"
|
|
12671
|
-
},
|
|
12735
|
+
size: { type: String },
|
|
12672
12736
|
striped: Boolean,
|
|
12673
12737
|
bordered: {
|
|
12674
12738
|
type: Boolean,
|
|
@@ -13856,10 +13920,7 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
13856
13920
|
},
|
|
13857
13921
|
props: {
|
|
13858
13922
|
placeholder: String,
|
|
13859
|
-
size: {
|
|
13860
|
-
type: String,
|
|
13861
|
-
default: "default"
|
|
13862
|
-
},
|
|
13923
|
+
size: { type: String },
|
|
13863
13924
|
placement: {
|
|
13864
13925
|
type: String,
|
|
13865
13926
|
default: "bottom-left"
|
|
@@ -13871,11 +13932,6 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
13871
13932
|
Number,
|
|
13872
13933
|
Array
|
|
13873
13934
|
],
|
|
13874
|
-
value: [
|
|
13875
|
-
String,
|
|
13876
|
-
Number,
|
|
13877
|
-
Array
|
|
13878
|
-
],
|
|
13879
13935
|
clearable: {
|
|
13880
13936
|
type: Boolean,
|
|
13881
13937
|
default: true
|
|
@@ -13896,7 +13952,7 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
13896
13952
|
options: Array,
|
|
13897
13953
|
theme: {
|
|
13898
13954
|
type: String,
|
|
13899
|
-
default: "
|
|
13955
|
+
default: "fill"
|
|
13900
13956
|
},
|
|
13901
13957
|
emptyText: String,
|
|
13902
13958
|
icon: [Array],
|
|
@@ -13918,7 +13974,8 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
13918
13974
|
onChange: { type: Function },
|
|
13919
13975
|
onTreeSelect: { type: Function },
|
|
13920
13976
|
onSearch: { type: Function },
|
|
13921
|
-
onTreeExpand: { type: Function }
|
|
13977
|
+
onTreeExpand: { type: Function },
|
|
13978
|
+
onOpenChange: { type: Function }
|
|
13922
13979
|
},
|
|
13923
13980
|
setup(props, { emit, attrs }) {
|
|
13924
13981
|
const injectedLocale = inject("locale", zh_CN_default);
|
|
@@ -13927,7 +13984,7 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
13927
13984
|
});
|
|
13928
13985
|
const visible = ref(false);
|
|
13929
13986
|
const rendered = ref(false);
|
|
13930
|
-
const currentValue = ref(props.multiple ? props.modelValue ||
|
|
13987
|
+
const currentValue = ref(props.multiple ? props.modelValue || [] : isEmpty(props.modelValue) ? [] : [props.modelValue]);
|
|
13931
13988
|
const queryInputVisible = ref(false);
|
|
13932
13989
|
const queryKey = ref("");
|
|
13933
13990
|
const queryInputMirrorRef = ref(null);
|
|
@@ -13975,11 +14032,15 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
13975
14032
|
minWidth.value = refSelection.value ? refSelection.value.offsetWidth : "";
|
|
13976
14033
|
});
|
|
13977
14034
|
});
|
|
14035
|
+
const openChange = (opened) => {
|
|
14036
|
+
visible.value = opened;
|
|
14037
|
+
emit("openChange", opened);
|
|
14038
|
+
};
|
|
13978
14039
|
const outsideClick = (e) => {
|
|
13979
14040
|
const target = e.target;
|
|
13980
14041
|
const ctx = refSelection.value;
|
|
13981
14042
|
if (refPopper.value && target && !refPopper.value.contains(target) && ctx && !ctx.contains(target)) {
|
|
13982
|
-
|
|
14043
|
+
openChange(false);
|
|
13983
14044
|
clearQuery();
|
|
13984
14045
|
}
|
|
13985
14046
|
};
|
|
@@ -14007,11 +14068,11 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
14007
14068
|
rendered.value = true;
|
|
14008
14069
|
document.addEventListener("click", outsideClick);
|
|
14009
14070
|
nextTick(() => {
|
|
14010
|
-
|
|
14071
|
+
openChange(true);
|
|
14011
14072
|
updatePosition();
|
|
14012
14073
|
});
|
|
14013
14074
|
} else {
|
|
14014
|
-
|
|
14075
|
+
openChange(true);
|
|
14015
14076
|
updatePosition();
|
|
14016
14077
|
}
|
|
14017
14078
|
emit("search", e);
|
|
@@ -14041,6 +14102,7 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
14041
14102
|
emitValue();
|
|
14042
14103
|
clearQuery();
|
|
14043
14104
|
e.stopPropagation();
|
|
14105
|
+
emit("clear");
|
|
14044
14106
|
};
|
|
14045
14107
|
const showQuery = () => {
|
|
14046
14108
|
if (props.filterable || hasSearchEvent) {
|
|
@@ -14061,12 +14123,12 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
14061
14123
|
rendered.value = true;
|
|
14062
14124
|
document.addEventListener("click", outsideClick);
|
|
14063
14125
|
nextTick(() => {
|
|
14064
|
-
|
|
14126
|
+
openChange(true);
|
|
14065
14127
|
updatePosition();
|
|
14066
14128
|
showQuery();
|
|
14067
14129
|
});
|
|
14068
14130
|
} else {
|
|
14069
|
-
|
|
14131
|
+
openChange(show || !visible.value);
|
|
14070
14132
|
if (visible.value) {
|
|
14071
14133
|
updatePosition();
|
|
14072
14134
|
showQuery();
|
|
@@ -14132,7 +14194,7 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
14132
14194
|
}
|
|
14133
14195
|
} else {
|
|
14134
14196
|
currentValue.value = [value];
|
|
14135
|
-
|
|
14197
|
+
openChange(false);
|
|
14136
14198
|
clearQuery();
|
|
14137
14199
|
}
|
|
14138
14200
|
emitValue();
|
|
@@ -14256,7 +14318,7 @@ var TreeSelect = /* @__PURE__ */ defineComponent({
|
|
|
14256
14318
|
"k-tree-select-borderless": props.bordered === false,
|
|
14257
14319
|
"k-tree-select-lg": props.size === "large",
|
|
14258
14320
|
"k-tree-select-sm": props.size === "small",
|
|
14259
|
-
"k-tree-select-
|
|
14321
|
+
"k-tree-select-fill": props.theme === "fill",
|
|
14260
14322
|
"k-tree-select-has-icon": !!props.icon,
|
|
14261
14323
|
"k-tree-select-circle": props.shape === "circle" && !props.multiple,
|
|
14262
14324
|
"k-tree-select-square": props.shape == "square",
|
|
@@ -14303,7 +14365,7 @@ var Tag = /* @__PURE__ */ defineComponent({
|
|
|
14303
14365
|
},
|
|
14304
14366
|
theme: {
|
|
14305
14367
|
type: String,
|
|
14306
|
-
default: "
|
|
14368
|
+
default: "fill"
|
|
14307
14369
|
},
|
|
14308
14370
|
onClose: { type: Function }
|
|
14309
14371
|
},
|
|
@@ -14331,7 +14393,7 @@ var Tag = /* @__PURE__ */ defineComponent({
|
|
|
14331
14393
|
"k-tag-has-color": isCustomColor,
|
|
14332
14394
|
"k-tag-closeable": closeable,
|
|
14333
14395
|
"k-tag-hidden": hidden.value,
|
|
14334
|
-
"k-tag-
|
|
14396
|
+
"k-tag-fill": props.theme === "fill"
|
|
14335
14397
|
}];
|
|
14336
14398
|
const tagStyle = { backgroundColor: isCustomColor ? color : void 0 };
|
|
14337
14399
|
const content = [];
|
|
@@ -14605,7 +14667,8 @@ var Upload = /* @__PURE__ */ defineComponent({
|
|
|
14605
14667
|
onRemove: Function,
|
|
14606
14668
|
onSelectFiles: Function,
|
|
14607
14669
|
onExceed: Function,
|
|
14608
|
-
onSizeError: Function
|
|
14670
|
+
onSizeError: Function,
|
|
14671
|
+
onBeforeUpload: Function
|
|
14609
14672
|
},
|
|
14610
14673
|
setup(props, { emit, slots, expose }) {
|
|
14611
14674
|
const injectedLocale = inject("locale", zh_CN_default);
|
|
@@ -14700,10 +14763,7 @@ var Upload = /* @__PURE__ */ defineComponent({
|
|
|
14700
14763
|
});
|
|
14701
14764
|
};
|
|
14702
14765
|
const uploadFile = (item, file) => {
|
|
14703
|
-
emit("beforeUpload",
|
|
14704
|
-
file: item,
|
|
14705
|
-
fileList: innerFileList.value
|
|
14706
|
-
});
|
|
14766
|
+
emit("beforeUpload", item, file);
|
|
14707
14767
|
if (props.transformFile) props.transformFile(file).then((res) => {
|
|
14708
14768
|
toUpload(item, res);
|
|
14709
14769
|
});
|
|
@@ -14782,6 +14842,128 @@ var Upload = /* @__PURE__ */ defineComponent({
|
|
|
14782
14842
|
};
|
|
14783
14843
|
}
|
|
14784
14844
|
});
|
|
14845
|
+
var Splitter = /* @__PURE__ */ defineComponent({
|
|
14846
|
+
name: "Splitter",
|
|
14847
|
+
props: {
|
|
14848
|
+
direction: {
|
|
14849
|
+
type: String,
|
|
14850
|
+
default: "horizontal"
|
|
14851
|
+
},
|
|
14852
|
+
onResize: Function,
|
|
14853
|
+
onResizeEnd: Function,
|
|
14854
|
+
onResizeStart: Function
|
|
14855
|
+
},
|
|
14856
|
+
setup(props, { slots, emit }) {
|
|
14857
|
+
const containerRef = ref(null);
|
|
14858
|
+
const isDragging = ref(false);
|
|
14859
|
+
const activeResizerIndex = ref(null);
|
|
14860
|
+
const panelSizes = ref([]);
|
|
14861
|
+
const minSizes = ref([]);
|
|
14862
|
+
const maxSizes = ref([]);
|
|
14863
|
+
const parseToPx = (val, total) => {
|
|
14864
|
+
if (val === void 0 || val === null || val === "") return null;
|
|
14865
|
+
const s = String(val).trim();
|
|
14866
|
+
if (s.endsWith("%")) return parseFloat(s) / 100 * total;
|
|
14867
|
+
if (s.endsWith("px")) return parseFloat(s);
|
|
14868
|
+
if (!isNaN(Number(s))) return parseFloat(s) / 100 * total;
|
|
14869
|
+
return null;
|
|
14870
|
+
};
|
|
14871
|
+
const initSizes = () => {
|
|
14872
|
+
if (!containerRef.value) return;
|
|
14873
|
+
const rect = containerRef.value.getBoundingClientRect();
|
|
14874
|
+
const children = slots.default?.() || [];
|
|
14875
|
+
const totalSize = (props.direction === "horizontal" ? rect.width : rect.height) - (children.length - 1) * 4;
|
|
14876
|
+
minSizes.value = children.map((c) => parseToPx(c.props?.min, totalSize) ?? 0);
|
|
14877
|
+
maxSizes.value = children.map((c) => parseToPx(c.props?.max, totalSize) ?? totalSize);
|
|
14878
|
+
const rawSizes = children.map((c) => parseToPx(c.props?.size, totalSize));
|
|
14879
|
+
const definedSum = rawSizes.reduce((acc, s) => (acc ?? 0) + (s ?? 0), 0) || 0;
|
|
14880
|
+
const undefinedCount = rawSizes.filter((s) => s === null).length;
|
|
14881
|
+
const spare = Math.max(0, totalSize - definedSum);
|
|
14882
|
+
const autoSize = undefinedCount > 0 ? spare / undefinedCount : 0;
|
|
14883
|
+
panelSizes.value = rawSizes.map((s) => s ?? autoSize);
|
|
14884
|
+
};
|
|
14885
|
+
const onMouseDown = (index) => {
|
|
14886
|
+
isDragging.value = true;
|
|
14887
|
+
activeResizerIndex.value = index;
|
|
14888
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
14889
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
14890
|
+
document.body.style.cursor = props.direction === "horizontal" ? "col-resize" : "row-resize";
|
|
14891
|
+
document.body.classList.add("k-splitter-dragging");
|
|
14892
|
+
emitSize("resizeStart");
|
|
14893
|
+
};
|
|
14894
|
+
const emitSize = (type) => {
|
|
14895
|
+
emit(type, panelSizes.value.map((x) => parseFloat(x.toFixed(3))));
|
|
14896
|
+
};
|
|
14897
|
+
const onMouseMove = (e) => {
|
|
14898
|
+
if (!isDragging.value || activeResizerIndex.value === null || !containerRef.value) return;
|
|
14899
|
+
const rect = containerRef.value.getBoundingClientRect();
|
|
14900
|
+
const idx = activeResizerIndex.value;
|
|
14901
|
+
const children = slots.default?.() || [];
|
|
14902
|
+
const resizerWidth = 4;
|
|
14903
|
+
const totalResizersWidth = (children.length - 1) * resizerWidth;
|
|
14904
|
+
const totalAvailableSize = (props.direction === "horizontal" ? rect.width : rect.height) - totalResizersWidth;
|
|
14905
|
+
const resizersBefore = idx * resizerWidth;
|
|
14906
|
+
let currentPos = (props.direction === "horizontal" ? e.clientX - rect.left : e.clientY - rect.top) - resizersBefore;
|
|
14907
|
+
currentPos = Math.max(0, Math.min(totalAvailableSize, currentPos));
|
|
14908
|
+
const pairTotal = panelSizes.value[idx] + panelSizes.value[idx + 1];
|
|
14909
|
+
const offset = panelSizes.value.slice(0, idx).reduce((a, b) => a + b, 0);
|
|
14910
|
+
let newSizeIdx = currentPos - offset;
|
|
14911
|
+
newSizeIdx = Math.max(minSizes.value[idx], Math.min(maxSizes.value[idx], newSizeIdx));
|
|
14912
|
+
const maxAllowed = pairTotal - minSizes.value[idx + 1];
|
|
14913
|
+
newSizeIdx = Math.min(newSizeIdx, maxAllowed);
|
|
14914
|
+
panelSizes.value[idx] = newSizeIdx;
|
|
14915
|
+
panelSizes.value[idx + 1] = pairTotal - newSizeIdx;
|
|
14916
|
+
emitSize("resize");
|
|
14917
|
+
};
|
|
14918
|
+
const onMouseUp = () => {
|
|
14919
|
+
isDragging.value = false;
|
|
14920
|
+
activeResizerIndex.value = null;
|
|
14921
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
14922
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
14923
|
+
document.body.style.cursor = "";
|
|
14924
|
+
document.body.classList.remove("k-splitter-dragging");
|
|
14925
|
+
emitSize("resizeEnd");
|
|
14926
|
+
};
|
|
14927
|
+
let ob = null;
|
|
14928
|
+
onMounted(() => {
|
|
14929
|
+
initSizes();
|
|
14930
|
+
ob = new ResizeObserver(() => initSizes());
|
|
14931
|
+
if (containerRef.value) ob.observe(containerRef.value);
|
|
14932
|
+
});
|
|
14933
|
+
onUnmounted(() => ob?.disconnect());
|
|
14934
|
+
return () => {
|
|
14935
|
+
const children = slots.default?.() || [];
|
|
14936
|
+
return createVNode("div", {
|
|
14937
|
+
"ref": containerRef,
|
|
14938
|
+
"class": ["k-splitter", `is-${props.direction}`]
|
|
14939
|
+
}, [children.map((child, index) => {
|
|
14940
|
+
const isLast = index === children.length - 1;
|
|
14941
|
+
return createVNode(Fragment, null, [createVNode("div", {
|
|
14942
|
+
"class": "k-splitter-item",
|
|
14943
|
+
"style": {
|
|
14944
|
+
flexBasis: `${panelSizes.value[index]}px`,
|
|
14945
|
+
flexGrow: 0,
|
|
14946
|
+
flexShrink: 0
|
|
14947
|
+
}
|
|
14948
|
+
}, [child]), !isLast && createVNode("div", {
|
|
14949
|
+
"class": "k-splitter-resizer",
|
|
14950
|
+
"onMousedown": () => onMouseDown(index)
|
|
14951
|
+
}, null)]);
|
|
14952
|
+
})]);
|
|
14953
|
+
};
|
|
14954
|
+
}
|
|
14955
|
+
});
|
|
14956
|
+
var SplitterPanel = /* @__PURE__ */ defineComponent({
|
|
14957
|
+
name: "SplitterPanel",
|
|
14958
|
+
props: {
|
|
14959
|
+
size: { type: [Number, String] },
|
|
14960
|
+
min: { type: [Number, String] },
|
|
14961
|
+
max: { type: [Number, String] }
|
|
14962
|
+
},
|
|
14963
|
+
setup(_, { slots }) {
|
|
14964
|
+
return () => createVNode("div", { "class": "k-splitter-panel" }, [slots.default?.()]);
|
|
14965
|
+
}
|
|
14966
|
+
});
|
|
14785
14967
|
//#endregion
|
|
14786
14968
|
//#region components/utils/theme.ts
|
|
14787
14969
|
var THEME_KEY = "theme-mode";
|
|
@@ -14900,6 +15082,8 @@ var components_exports = /* @__PURE__ */ __exportAll({
|
|
|
14900
15082
|
Slider: () => Slider,
|
|
14901
15083
|
Space: () => Space,
|
|
14902
15084
|
Spin: () => Spin,
|
|
15085
|
+
Splitter: () => Splitter,
|
|
15086
|
+
SplitterPanel: () => SplitterPanel,
|
|
14903
15087
|
StatCard: () => StatCard,
|
|
14904
15088
|
StatNumber: () => StatNumber,
|
|
14905
15089
|
SubMenu: () => SubMenu,
|
|
@@ -14952,4 +15136,4 @@ var UI = {
|
|
|
14952
15136
|
var install = UI.install;
|
|
14953
15137
|
var version = UI.version;
|
|
14954
15138
|
//#endregion
|
|
14955
|
-
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, Radio, RadioButton, RadioGroup, Rate, Row, Select, Sider, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonText, Slider, Space, Spin, StatCard, StatNumber, SubMenu, TabPanel, Table, Tabs, Tag, TextArea, TimeLine, TimeLineItem, Tooltip, Tree, TreeSelect, Upload, UI as default, install, loading, message, modal, notice, Theme as theme, version };
|
|
15139
|
+
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, 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, UI as default, install, loading, message, modal, notice, Theme as theme, version };
|