kui-vue 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI.en-US.md +72 -4
- package/AI.md +70 -4
- package/ai/behaviors.json +23 -1
- package/ai/cli.mjs +180 -17
- package/ai/descriptions.json +28 -0
- package/ai/kui-components.json +1460 -1426
- package/ai/mcp.mjs +2 -188
- package/ai/query.mjs +192 -0
- package/ai/skills/kui-vue/SKILL.md +39 -18
- package/ai/skills/kui-vue/references/mcp.md +11 -1
- package/ai/skills/kui-vue/references/react-to-vue.md +110 -0
- package/ai/skills/kui-vue/references/vue-to-react.md +86 -0
- package/dist/index.js +2 -2
- package/es/index.js +542 -101
- 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.cjs +2 -2
- package/lib/locale/de.cjs +1 -1
- package/lib/locale/el.cjs +1 -1
- package/lib/locale/en.cjs +1 -1
- package/lib/locale/fr.cjs +1 -1
- package/lib/locale/it.cjs +1 -1
- package/lib/locale/ja.cjs +1 -1
- package/lib/locale/ko.cjs +1 -1
- package/lib/locale/ru.cjs +1 -1
- package/lib/locale/th.cjs +1 -1
- package/lib/locale/uk.cjs +1 -1
- package/lib/locale/vi.cjs +1 -1
- package/lib/locale/zh-CN.cjs +1 -1
- package/lib/locale/zh-TW.cjs +1 -1
- package/package.json +6 -3
- package/style/base.css +1 -1
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/motion.css +1 -1
- package/style/theme.css +1 -1
- package/types/carousel/carousel.d.ts +13 -0
- package/types/carousel/drag.d.ts +19 -0
- package/types/input/input-base.d.ts +186 -0
- package/types/input/input.d.ts +36 -107
- package/types/page/index.d.ts +13 -0
- package/types/page/responsive.d.ts +1 -0
- package/vetur/attributes.json +746 -722
- package/vetur/tags.json +96 -94
- package/vetur/web-types.json +687 -671
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* kui-vue v6.2.
|
|
2
|
+
* kui-vue v6.2.1
|
|
3
3
|
* Copyright 2017-present, kui-vue.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://k-ui.cn
|
|
@@ -1928,70 +1928,75 @@ var InputGroup = /* @__PURE__ */ defineComponent({
|
|
|
1928
1928
|
}
|
|
1929
1929
|
});
|
|
1930
1930
|
//#endregion
|
|
1931
|
-
//#region components/input/input.tsx
|
|
1932
|
-
var
|
|
1931
|
+
//#region components/input/input-base.tsx
|
|
1932
|
+
var inputProps = {
|
|
1933
|
+
clearable: {
|
|
1934
|
+
type: Boolean,
|
|
1935
|
+
default: true
|
|
1936
|
+
},
|
|
1937
|
+
visiblePasswordIcon: {
|
|
1938
|
+
type: Boolean,
|
|
1939
|
+
default: true
|
|
1940
|
+
},
|
|
1941
|
+
size: { type: String },
|
|
1942
|
+
value: { type: [
|
|
1943
|
+
String,
|
|
1944
|
+
Number,
|
|
1945
|
+
Array,
|
|
1946
|
+
Object
|
|
1947
|
+
] },
|
|
1948
|
+
modelValue: { type: [
|
|
1949
|
+
String,
|
|
1950
|
+
Number,
|
|
1951
|
+
Array,
|
|
1952
|
+
Object
|
|
1953
|
+
] },
|
|
1954
|
+
disabled: Boolean,
|
|
1955
|
+
readonly: Boolean,
|
|
1956
|
+
type: {
|
|
1957
|
+
type: String,
|
|
1958
|
+
default: "text"
|
|
1959
|
+
},
|
|
1960
|
+
icon: [Array],
|
|
1961
|
+
suffix: { type: [String, Object] },
|
|
1962
|
+
prefix: { type: [String, Object] },
|
|
1963
|
+
addonBefore: { type: [
|
|
1964
|
+
String,
|
|
1965
|
+
Number,
|
|
1966
|
+
Object
|
|
1967
|
+
] },
|
|
1968
|
+
addonAfter: { type: [
|
|
1969
|
+
String,
|
|
1970
|
+
Number,
|
|
1971
|
+
Object
|
|
1972
|
+
] },
|
|
1973
|
+
theme: {
|
|
1974
|
+
type: String,
|
|
1975
|
+
default: "fill"
|
|
1976
|
+
},
|
|
1977
|
+
shape: String
|
|
1978
|
+
};
|
|
1979
|
+
var inputEmits = {
|
|
1980
|
+
"update:modelValue": (value) => typeof value === "string",
|
|
1981
|
+
search: (value) => typeof value === "string",
|
|
1982
|
+
iconClick: (event) => typeof event?.type === "string",
|
|
1983
|
+
clear: () => true,
|
|
1984
|
+
change: (value) => typeof value === "string",
|
|
1985
|
+
focus: (event) => typeof event?.type === "string",
|
|
1986
|
+
blur: (event) => typeof event?.type === "string"
|
|
1987
|
+
};
|
|
1988
|
+
/** Shared implementation. Deliberately absent from the public component barrel. */
|
|
1989
|
+
var InputBase = /* @__PURE__ */ defineComponent({
|
|
1933
1990
|
inheritAttrs: false,
|
|
1934
|
-
name: "
|
|
1991
|
+
name: "InputBase",
|
|
1935
1992
|
props: {
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
default: true
|
|
1939
|
-
},
|
|
1940
|
-
visiblePasswordIcon: {
|
|
1941
|
-
type: Boolean,
|
|
1942
|
-
default: true
|
|
1943
|
-
},
|
|
1944
|
-
size: { type: String },
|
|
1945
|
-
value: { type: [
|
|
1946
|
-
String,
|
|
1947
|
-
Number,
|
|
1948
|
-
Array,
|
|
1949
|
-
Object
|
|
1950
|
-
] },
|
|
1951
|
-
modelValue: { type: [
|
|
1952
|
-
String,
|
|
1953
|
-
Number,
|
|
1954
|
-
Array,
|
|
1955
|
-
Object
|
|
1956
|
-
] },
|
|
1957
|
-
disabled: Boolean,
|
|
1958
|
-
readonly: Boolean,
|
|
1959
|
-
type: {
|
|
1960
|
-
type: String,
|
|
1961
|
-
default: "text"
|
|
1962
|
-
},
|
|
1963
|
-
icon: [Array],
|
|
1964
|
-
suffix: { type: [String, Object] },
|
|
1965
|
-
prefix: { type: [String, Object] },
|
|
1966
|
-
addonBefore: { type: [
|
|
1967
|
-
String,
|
|
1968
|
-
Number,
|
|
1969
|
-
Object
|
|
1970
|
-
] },
|
|
1971
|
-
addonAfter: { type: [
|
|
1972
|
-
String,
|
|
1973
|
-
Number,
|
|
1974
|
-
Object
|
|
1975
|
-
] },
|
|
1976
|
-
theme: {
|
|
1977
|
-
type: String,
|
|
1978
|
-
default: "fill"
|
|
1979
|
-
},
|
|
1980
|
-
shape: String,
|
|
1981
|
-
inputType: {
|
|
1993
|
+
...inputProps,
|
|
1994
|
+
stylePrefix: {
|
|
1982
1995
|
type: String,
|
|
1983
1996
|
default: "input"
|
|
1984
1997
|
}
|
|
1985
1998
|
},
|
|
1986
|
-
emits:
|
|
1987
|
-
"update:modelValue": (value) => typeof value === "string",
|
|
1988
|
-
search: (value) => typeof value === "string",
|
|
1989
|
-
iconClick: (event) => typeof event?.type === "string",
|
|
1990
|
-
clear: () => true,
|
|
1991
|
-
change: (value) => typeof value === "string",
|
|
1992
|
-
focus: (event) => typeof event?.type === "string",
|
|
1993
|
-
blur: (event) => typeof event?.type === "string"
|
|
1994
|
-
},
|
|
1999
|
+
emits: inputEmits,
|
|
1995
2000
|
setup(props, { slots, emit, attrs, expose }) {
|
|
1996
2001
|
const field = useFormField(true);
|
|
1997
2002
|
const appearance = useFormAppearance(props, field);
|
|
@@ -2057,7 +2062,7 @@ var FormInput = markFormFieldComponent(/* @__PURE__ */ defineComponent({
|
|
|
2057
2062
|
return suffixContent ? createVNode("div", { "class": "k-input-suffix" }, [suffixContent]) : null;
|
|
2058
2063
|
};
|
|
2059
2064
|
return () => {
|
|
2060
|
-
const { icon, size = appearance.size.value || parentSize || void 0, type, clearable, suffix, addonBefore, addonAfter, theme, prefix, shape
|
|
2065
|
+
const { icon, size = appearance.size.value || parentSize || void 0, type, clearable, suffix, addonBefore, addonAfter, theme, prefix, shape } = props;
|
|
2061
2066
|
const disabled = props.disabled || field?.disabled.value;
|
|
2062
2067
|
const readonly = props.readonly || field?.readonly.value;
|
|
2063
2068
|
const effectiveTheme = appearance.theme.value ?? theme;
|
|
@@ -2066,6 +2071,7 @@ var FormInput = markFormFieldComponent(/* @__PURE__ */ defineComponent({
|
|
|
2066
2071
|
const slotPrefix = getChildren(slots.prefix?.());
|
|
2067
2072
|
const slotAddonBefore = getChildren(slots.addonBefore?.());
|
|
2068
2073
|
const slotAddonAfter = getChildren(slots.addonAfter?.());
|
|
2074
|
+
const inputType = props.stylePrefix;
|
|
2069
2075
|
const slotControls = getChildren(slots.controls?.());
|
|
2070
2076
|
const grouped = slotAddonBefore.length > 0 || slotAddonAfter.length > 0 || addonBefore !== void 0 || addonAfter !== void 0;
|
|
2071
2077
|
const multiple = (icon || hasListener("Search") || slotSuffix.length > 0 || suffix || slotPrefix.length > 0 || prefix || type === "password" || clearable || grouped || slotControls.length > 0) && type !== "hidden";
|
|
@@ -2211,6 +2217,44 @@ var FormInput = markFormFieldComponent(/* @__PURE__ */ defineComponent({
|
|
|
2211
2217
|
}
|
|
2212
2218
|
};
|
|
2213
2219
|
}
|
|
2220
|
+
});
|
|
2221
|
+
//#endregion
|
|
2222
|
+
//#region components/input/input.tsx
|
|
2223
|
+
var FormInput = markFormFieldComponent(/* @__PURE__ */ defineComponent({
|
|
2224
|
+
name: "Input",
|
|
2225
|
+
inheritAttrs: false,
|
|
2226
|
+
props: inputProps,
|
|
2227
|
+
emits: inputEmits,
|
|
2228
|
+
setup(props, { attrs, slots, emit, expose }) {
|
|
2229
|
+
const inner = ref();
|
|
2230
|
+
const instance = getCurrentInstance();
|
|
2231
|
+
expose({
|
|
2232
|
+
focus: () => inner.value?.focus(),
|
|
2233
|
+
blur: () => inner.value?.blur()
|
|
2234
|
+
});
|
|
2235
|
+
return () => {
|
|
2236
|
+
const forwardedProps = { ...props };
|
|
2237
|
+
for (const name of [
|
|
2238
|
+
"size",
|
|
2239
|
+
"theme",
|
|
2240
|
+
"shape"
|
|
2241
|
+
]) if (!Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, name)) delete forwardedProps[name];
|
|
2242
|
+
return createVNode(InputBase, mergeProps(attrs, forwardedProps, {
|
|
2243
|
+
"ref": inner,
|
|
2244
|
+
"stylePrefix": "input",
|
|
2245
|
+
"onUpdate:modelValue": (value) => emit("update:modelValue", value),
|
|
2246
|
+
"onChange": (value) => emit("change", value),
|
|
2247
|
+
"onClear": () => emit("clear"),
|
|
2248
|
+
"onFocus": (event) => emit("focus", event),
|
|
2249
|
+
"onBlur": (event) => emit("blur", event),
|
|
2250
|
+
"onSearch": instance?.vnode.props?.onSearch ? (value) => emit("search", value) : void 0,
|
|
2251
|
+
"onIconClick": instance?.vnode.props?.onIconClick ? (event) => emit("iconClick", event) : void 0
|
|
2252
|
+
}), {
|
|
2253
|
+
...slots,
|
|
2254
|
+
controls: void 0
|
|
2255
|
+
});
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2214
2258
|
}));
|
|
2215
2259
|
//#endregion
|
|
2216
2260
|
//#region components/input/textarea.tsx
|
|
@@ -5253,17 +5297,180 @@ var ListPanel = /* @__PURE__ */ defineComponent({
|
|
|
5253
5297
|
}
|
|
5254
5298
|
});
|
|
5255
5299
|
//#endregion
|
|
5300
|
+
//#region components/directives/resize.ts
|
|
5301
|
+
var resize = {
|
|
5302
|
+
mounted(_, { value }) {
|
|
5303
|
+
window.addEventListener("resize", value);
|
|
5304
|
+
},
|
|
5305
|
+
unmounted(_, { value }) {
|
|
5306
|
+
window.removeEventListener("resize", value);
|
|
5307
|
+
}
|
|
5308
|
+
};
|
|
5309
|
+
//#endregion
|
|
5310
|
+
//#region components/carousel/drag.ts
|
|
5311
|
+
var swipeThreshold = 5;
|
|
5312
|
+
var shortSwipeMs = 300;
|
|
5313
|
+
var longSwipeRatio = .5;
|
|
5314
|
+
var flickVelocity = .5;
|
|
5315
|
+
function bindCarouselDrag(root, callbacks) {
|
|
5316
|
+
let gesture;
|
|
5317
|
+
let suppressClickUntil = 0;
|
|
5318
|
+
const view = root.ownerDocument.defaultView;
|
|
5319
|
+
const changed = (active, options) => active.options.vertical !== options.vertical || active.options.size !== options.size || active.options.count !== options.count || active.options.index !== options.index || active.options.loop !== options.loop || !options.swipeable;
|
|
5320
|
+
const finish = (cancel = false) => {
|
|
5321
|
+
const active = gesture;
|
|
5322
|
+
if (!active) return;
|
|
5323
|
+
gesture = void 0;
|
|
5324
|
+
const options = callbacks.options();
|
|
5325
|
+
const distance = Math.abs(active.delta);
|
|
5326
|
+
const now = performance.now();
|
|
5327
|
+
const velocity = active.velocity * Math.max(0, 1 - (now - active.time) / 140);
|
|
5328
|
+
const shortSwipe = now - active.started <= shortSwipeMs;
|
|
5329
|
+
const progress = distance / options.size;
|
|
5330
|
+
const flick = Math.sign(velocity) === Math.sign(active.delta) && Math.abs(velocity) >= flickVelocity;
|
|
5331
|
+
const step = !cancel && !changed(active, options) && active.axis && distance >= swipeThreshold && (shortSwipe || flick || progress >= longSwipeRatio) ? active.delta < 0 ? 1 : -1 : 0;
|
|
5332
|
+
if (active.axis) suppressClickUntil = Date.now() + 400;
|
|
5333
|
+
const atEdge = !options.loop && (options.index + step < 0 || options.index + step >= options.count);
|
|
5334
|
+
const target = atEdge ? 0 : -step * options.size;
|
|
5335
|
+
const remaining = Math.abs(target - Math.max(-options.size, Math.min(options.size, active.base + active.delta)));
|
|
5336
|
+
const duration = !cancel && step && !atEdge ? Math.max(140, Math.min(280, remaining * 1.5 / Math.max(.5, Math.abs(velocity)))) : 200;
|
|
5337
|
+
if (active.axis) callbacks.settle?.(duration);
|
|
5338
|
+
callbacks.offset(0);
|
|
5339
|
+
callbacks.finish(step);
|
|
5340
|
+
if (root.hasPointerCapture?.(active.id)) root.releasePointerCapture(active.id);
|
|
5341
|
+
};
|
|
5342
|
+
const down = (event) => {
|
|
5343
|
+
if (gesture) {
|
|
5344
|
+
if (event.pointerId !== gesture.id) finish(true);
|
|
5345
|
+
return;
|
|
5346
|
+
}
|
|
5347
|
+
const options = callbacks.options();
|
|
5348
|
+
const target = event.target;
|
|
5349
|
+
if (target !== root && !target.closest?.(".k-carousel-wrapper") || target.closest(".k-carousel") !== root || target.closest("input, textarea, select, button, [contenteditable]:not([contenteditable=false])") || options.count < 2 || options.size <= 0 || event.isPrimary === false || event.button !== 0 || !options.swipeable) return;
|
|
5350
|
+
suppressClickUntil = 0;
|
|
5351
|
+
const now = performance.now();
|
|
5352
|
+
gesture = {
|
|
5353
|
+
id: event.pointerId,
|
|
5354
|
+
x: event.clientX,
|
|
5355
|
+
y: event.clientY,
|
|
5356
|
+
axis: false,
|
|
5357
|
+
delta: 0,
|
|
5358
|
+
base: 0,
|
|
5359
|
+
last: 0,
|
|
5360
|
+
time: now,
|
|
5361
|
+
velocity: 0,
|
|
5362
|
+
started: now,
|
|
5363
|
+
samples: [{
|
|
5364
|
+
time: now,
|
|
5365
|
+
delta: 0
|
|
5366
|
+
}],
|
|
5367
|
+
options: { ...options }
|
|
5368
|
+
};
|
|
5369
|
+
gesture.base = callbacks.start() ?? 0;
|
|
5370
|
+
callbacks.offset(gesture.base);
|
|
5371
|
+
};
|
|
5372
|
+
const move = (event) => {
|
|
5373
|
+
if (!gesture || event.pointerId !== gesture.id) return;
|
|
5374
|
+
const options = callbacks.options();
|
|
5375
|
+
if (changed(gesture, options)) {
|
|
5376
|
+
finish(true);
|
|
5377
|
+
return;
|
|
5378
|
+
}
|
|
5379
|
+
const dx = event.clientX - gesture.x;
|
|
5380
|
+
const dy = event.clientY - gesture.y;
|
|
5381
|
+
const delta = options.vertical ? dy : dx;
|
|
5382
|
+
const cross = options.vertical ? dx : dy;
|
|
5383
|
+
if (!gesture.axis) {
|
|
5384
|
+
if (Math.max(Math.abs(delta), Math.abs(cross)) < swipeThreshold) return;
|
|
5385
|
+
if (Math.abs(cross) > Math.abs(delta)) {
|
|
5386
|
+
finish(true);
|
|
5387
|
+
return;
|
|
5388
|
+
}
|
|
5389
|
+
gesture.axis = true;
|
|
5390
|
+
if (event.type === "pointermove") root.setPointerCapture?.(event.pointerId);
|
|
5391
|
+
}
|
|
5392
|
+
if (event.cancelable) event.preventDefault();
|
|
5393
|
+
const now = performance.now();
|
|
5394
|
+
if (delta !== gesture.last) {
|
|
5395
|
+
gesture.samples.push({
|
|
5396
|
+
time: now,
|
|
5397
|
+
delta
|
|
5398
|
+
});
|
|
5399
|
+
while (gesture.samples.length > 2 && gesture.samples[0].time < now - 80) gesture.samples.shift();
|
|
5400
|
+
const sample = gesture.samples[0];
|
|
5401
|
+
gesture.velocity = (delta - sample.delta) / Math.max(1, now - sample.time);
|
|
5402
|
+
gesture.time = now;
|
|
5403
|
+
}
|
|
5404
|
+
gesture.last = delta;
|
|
5405
|
+
gesture.delta = delta;
|
|
5406
|
+
const atEdge = !options.loop && (options.index === 0 && delta > 0 || options.index === options.count - 1 && delta < 0);
|
|
5407
|
+
callbacks.offset(gesture.base + Math.max(-options.size, Math.min(options.size, delta * (atEdge ? .3 : 1))));
|
|
5408
|
+
};
|
|
5409
|
+
const up = (event) => {
|
|
5410
|
+
if (event.type === "lostpointercapture" && event.target !== root) return;
|
|
5411
|
+
if (event.type === "pointerup" && gesture?.id === event.pointerId && (event.clientX !== gesture.x + (gesture.options.vertical ? 0 : gesture.last) || event.clientY !== gesture.y + (gesture.options.vertical ? gesture.last : 0))) move(event);
|
|
5412
|
+
if (gesture?.id === event.pointerId) finish(event.type !== "pointerup");
|
|
5413
|
+
};
|
|
5414
|
+
const blur = () => finish(true);
|
|
5415
|
+
const click = (event) => {
|
|
5416
|
+
if (Date.now() < suppressClickUntil && event.detail !== 0) {
|
|
5417
|
+
event.preventDefault();
|
|
5418
|
+
event.stopPropagation();
|
|
5419
|
+
}
|
|
5420
|
+
};
|
|
5421
|
+
const nativeDrag = (event) => {
|
|
5422
|
+
if (gesture) event.preventDefault();
|
|
5423
|
+
};
|
|
5424
|
+
root.addEventListener("pointerdown", down);
|
|
5425
|
+
root.addEventListener("click", click, true);
|
|
5426
|
+
root.addEventListener("dragstart", nativeDrag);
|
|
5427
|
+
root.addEventListener("lostpointercapture", up);
|
|
5428
|
+
view.addEventListener("pointermove", move, { passive: false });
|
|
5429
|
+
view.addEventListener("pointerup", up);
|
|
5430
|
+
view.addEventListener("pointercancel", up);
|
|
5431
|
+
view.addEventListener("blur", blur);
|
|
5432
|
+
return () => {
|
|
5433
|
+
const active = gesture;
|
|
5434
|
+
gesture = void 0;
|
|
5435
|
+
if (active && root.hasPointerCapture?.(active.id)) root.releasePointerCapture(active.id);
|
|
5436
|
+
root.removeEventListener("pointerdown", down);
|
|
5437
|
+
root.removeEventListener("click", click, true);
|
|
5438
|
+
root.removeEventListener("dragstart", nativeDrag);
|
|
5439
|
+
root.removeEventListener("lostpointercapture", up);
|
|
5440
|
+
view.removeEventListener("pointermove", move);
|
|
5441
|
+
view.removeEventListener("pointerup", up);
|
|
5442
|
+
view.removeEventListener("pointercancel", up);
|
|
5443
|
+
view.removeEventListener("blur", blur);
|
|
5444
|
+
};
|
|
5445
|
+
}
|
|
5446
|
+
function retargetCarousel(root, vertical, size, count, next, step) {
|
|
5447
|
+
const track = root.querySelector(".k-carousel-wrapper");
|
|
5448
|
+
if (!track || !size) return next + 1;
|
|
5449
|
+
const visible = ((-readCarouselOffset(root, vertical, 0, size) / size - 1) % count + count) % count + 1;
|
|
5450
|
+
let target = next + 1;
|
|
5451
|
+
if (step > 0 && target < visible) target += count;
|
|
5452
|
+
if (step < 0 && target > visible) target -= count;
|
|
5453
|
+
const duration = track.style.transitionDuration;
|
|
5454
|
+
track.style.transitionDuration = "0s";
|
|
5455
|
+
track.style.transform = vertical ? `translate3d(0, ${-visible * size}px, 0)` : `translate3d(${-visible * size}px, 0, 0)`;
|
|
5456
|
+
track.getBoundingClientRect();
|
|
5457
|
+
track.style.transitionDuration = duration;
|
|
5458
|
+
track.style.transform = vertical ? `translate3d(0, ${-target * size}px, 0)` : `translate3d(${-target * size}px, 0, 0)`;
|
|
5459
|
+
return target;
|
|
5460
|
+
}
|
|
5461
|
+
function readCarouselOffset(root, vertical, position, size) {
|
|
5462
|
+
const track = root.querySelector(".k-carousel-wrapper");
|
|
5463
|
+
if (!track) return 0;
|
|
5464
|
+
const transform = root.ownerDocument.defaultView.getComputedStyle(track).transform;
|
|
5465
|
+
const values = transform.slice(transform.indexOf("(") + 1, -1).split(",").map(parseFloat);
|
|
5466
|
+
const offset = transform.startsWith("matrix3d") ? values[vertical ? 13 : 12] : transform.startsWith("matrix") ? values[vertical ? 5 : 4] : transform.startsWith("translate3d") ? values[vertical ? 1 : 0] : void 0;
|
|
5467
|
+
return Number.isFinite(offset) ? offset + position * size : 0;
|
|
5468
|
+
}
|
|
5469
|
+
//#endregion
|
|
5256
5470
|
//#region components/carousel/carousel.tsx
|
|
5257
5471
|
var Carousel = /* @__PURE__ */ defineComponent({
|
|
5258
5472
|
name: "Carousel",
|
|
5259
|
-
directives: { resize
|
|
5260
|
-
mounted(_, { value }) {
|
|
5261
|
-
window.addEventListener("resize", value);
|
|
5262
|
-
},
|
|
5263
|
-
unmounted(_, { value }) {
|
|
5264
|
-
window.removeEventListener("resize", value);
|
|
5265
|
-
}
|
|
5266
|
-
} },
|
|
5473
|
+
directives: { resize },
|
|
5267
5474
|
props: {
|
|
5268
5475
|
modelValue: {
|
|
5269
5476
|
type: Number,
|
|
@@ -5290,6 +5497,10 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5290
5497
|
dots: {
|
|
5291
5498
|
type: Boolean,
|
|
5292
5499
|
default: true
|
|
5500
|
+
},
|
|
5501
|
+
swipeable: {
|
|
5502
|
+
type: Boolean,
|
|
5503
|
+
default: true
|
|
5293
5504
|
}
|
|
5294
5505
|
},
|
|
5295
5506
|
emits: {
|
|
@@ -5306,13 +5517,17 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5306
5517
|
const animate = ref(false);
|
|
5307
5518
|
const playing = ref(false);
|
|
5308
5519
|
const carouselRef = ref(null);
|
|
5520
|
+
const dragOffset = ref(0);
|
|
5521
|
+
const dragging = ref(false);
|
|
5522
|
+
const settleDuration = ref(null);
|
|
5523
|
+
let hovered = false;
|
|
5309
5524
|
provide("width", width);
|
|
5310
5525
|
provide("height", computed(() => props.height));
|
|
5311
5526
|
const flatten = (nodes) => {
|
|
5312
5527
|
const result = [];
|
|
5313
5528
|
nodes.forEach((vnode) => {
|
|
5314
5529
|
if (vnode.type === Fragment && Array.isArray(vnode.children)) result.push(...flatten(vnode.children));
|
|
5315
|
-
else result.push(vnode);
|
|
5530
|
+
else if (vnode.type !== Comment && !(vnode.type === Text && !String(vnode.children ?? "").trim())) result.push(vnode);
|
|
5316
5531
|
});
|
|
5317
5532
|
return result;
|
|
5318
5533
|
};
|
|
@@ -5321,6 +5536,7 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5321
5536
|
const len = itemCount.value;
|
|
5322
5537
|
if (!len) return;
|
|
5323
5538
|
const next = props.loop ? (val % len + len) % len : Math.max(0, Math.min(len - 1, val));
|
|
5539
|
+
if (next === currentIndex.value) return;
|
|
5324
5540
|
currentIndex.value = next;
|
|
5325
5541
|
posIndex.value = props.loop ? next + 1 : next;
|
|
5326
5542
|
animate.value = false;
|
|
@@ -5329,11 +5545,21 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5329
5545
|
const autoToPlay = () => {
|
|
5330
5546
|
if (autoTimer.value) clearInterval(autoTimer.value);
|
|
5331
5547
|
autoTimer.value = null;
|
|
5332
|
-
if (!props.autoplay || itemCount.value < 2) return;
|
|
5548
|
+
if (!props.autoplay || itemCount.value < 2 || dragging.value || hovered) return;
|
|
5333
5549
|
autoTimer.value = setInterval(() => {
|
|
5334
5550
|
toSwitch("right");
|
|
5335
5551
|
}, props.delay);
|
|
5336
5552
|
};
|
|
5553
|
+
const finishTransition = () => {
|
|
5554
|
+
if (transitionTimer.value) clearTimeout(transitionTimer.value);
|
|
5555
|
+
transitionTimer.value = null;
|
|
5556
|
+
playing.value = false;
|
|
5557
|
+
settleDuration.value = null;
|
|
5558
|
+
if (props.loop && posIndex.value !== currentIndex.value + 1) {
|
|
5559
|
+
animate.value = false;
|
|
5560
|
+
posIndex.value = currentIndex.value + 1;
|
|
5561
|
+
}
|
|
5562
|
+
};
|
|
5337
5563
|
const change = (type) => {
|
|
5338
5564
|
animate.value = true;
|
|
5339
5565
|
const len = itemCount.value;
|
|
@@ -5352,20 +5578,17 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5352
5578
|
emit("update:modelValue", next);
|
|
5353
5579
|
emit("change", next);
|
|
5354
5580
|
if (transitionTimer.value) clearTimeout(transitionTimer.value);
|
|
5355
|
-
transitionTimer.value = setTimeout(
|
|
5356
|
-
playing.value = false;
|
|
5357
|
-
}, 501);
|
|
5581
|
+
transitionTimer.value = setTimeout(finishTransition, 501);
|
|
5358
5582
|
autoToPlay();
|
|
5359
5583
|
return;
|
|
5360
5584
|
}
|
|
5361
|
-
const total = len + 2;
|
|
5362
5585
|
let index = posIndex.value;
|
|
5363
5586
|
let nextCurrent = currentIndex.value;
|
|
5364
5587
|
if (type === "right") {
|
|
5365
|
-
index
|
|
5588
|
+
index += 1;
|
|
5366
5589
|
nextCurrent = (nextCurrent + 1) % len;
|
|
5367
5590
|
} else {
|
|
5368
|
-
index
|
|
5591
|
+
index -= 1;
|
|
5369
5592
|
nextCurrent = (nextCurrent - 1 + len) % len;
|
|
5370
5593
|
}
|
|
5371
5594
|
posIndex.value = index;
|
|
@@ -5373,26 +5596,24 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5373
5596
|
emit("update:modelValue", currentIndex.value);
|
|
5374
5597
|
emit("change", currentIndex.value);
|
|
5375
5598
|
if (transitionTimer.value) clearTimeout(transitionTimer.value);
|
|
5376
|
-
transitionTimer.value = setTimeout(
|
|
5377
|
-
playing.value = false;
|
|
5378
|
-
if (posIndex.value === total - 1) {
|
|
5379
|
-
animate.value = false;
|
|
5380
|
-
posIndex.value = 1;
|
|
5381
|
-
}
|
|
5382
|
-
if (posIndex.value === 0) {
|
|
5383
|
-
animate.value = false;
|
|
5384
|
-
posIndex.value = total - 2;
|
|
5385
|
-
}
|
|
5386
|
-
}, 501);
|
|
5599
|
+
transitionTimer.value = setTimeout(finishTransition, 501);
|
|
5387
5600
|
autoToPlay();
|
|
5388
5601
|
};
|
|
5389
5602
|
const toSwitch = (type) => {
|
|
5390
5603
|
if (autoTimer.value) clearInterval(autoTimer.value);
|
|
5391
|
-
if (
|
|
5604
|
+
if (dragging.value) return;
|
|
5605
|
+
const step = type === "right" ? 1 : -1;
|
|
5606
|
+
const len = itemCount.value;
|
|
5607
|
+
if (playing.value && props.loop && len > 1 && carouselRef.value) {
|
|
5608
|
+
const next = (currentIndex.value + step + len) % len;
|
|
5609
|
+
posIndex.value = retargetCarousel(carouselRef.value, props.vertical, props.vertical ? props.height : width.value, len, next, step) - step;
|
|
5610
|
+
}
|
|
5611
|
+
if (playing.value) settleDuration.value = 280;
|
|
5392
5612
|
playing.value = true;
|
|
5393
5613
|
change(type);
|
|
5394
5614
|
};
|
|
5395
5615
|
const goTo = (index) => {
|
|
5616
|
+
settleDuration.value = null;
|
|
5396
5617
|
const len = itemCount.value;
|
|
5397
5618
|
if (!len) return;
|
|
5398
5619
|
if (autoTimer.value) clearInterval(autoTimer.value);
|
|
@@ -5410,13 +5631,70 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5410
5631
|
if (!carouselRef.value) return;
|
|
5411
5632
|
animate.value = false;
|
|
5412
5633
|
width.value = carouselRef.value.offsetWidth;
|
|
5413
|
-
nextTick(() =>
|
|
5634
|
+
nextTick(() => {
|
|
5635
|
+
if (!carouselRef.value) return;
|
|
5636
|
+
carouselRef.value.querySelector(".k-carousel-wrapper")?.getBoundingClientRect();
|
|
5637
|
+
animate.value = true;
|
|
5638
|
+
});
|
|
5414
5639
|
};
|
|
5415
5640
|
watch([
|
|
5416
5641
|
() => props.autoplay,
|
|
5417
5642
|
() => props.delay,
|
|
5418
5643
|
itemCount
|
|
5419
5644
|
], autoToPlay);
|
|
5645
|
+
watch(() => props.loop, () => {
|
|
5646
|
+
if (transitionTimer.value) clearTimeout(transitionTimer.value);
|
|
5647
|
+
transitionTimer.value = null;
|
|
5648
|
+
playing.value = false;
|
|
5649
|
+
settleDuration.value = null;
|
|
5650
|
+
animate.value = false;
|
|
5651
|
+
posIndex.value = props.loop ? currentIndex.value + 1 : currentIndex.value;
|
|
5652
|
+
nextTick(() => {
|
|
5653
|
+
carouselRef.value?.querySelector(".k-carousel-wrapper")?.getBoundingClientRect();
|
|
5654
|
+
animate.value = true;
|
|
5655
|
+
});
|
|
5656
|
+
});
|
|
5657
|
+
watch(carouselRef, (root, _, onCleanup) => {
|
|
5658
|
+
if (!root) return;
|
|
5659
|
+
resize();
|
|
5660
|
+
const dispose = bindCarouselDrag(root, {
|
|
5661
|
+
options: () => ({
|
|
5662
|
+
swipeable: props.swipeable,
|
|
5663
|
+
vertical: props.vertical,
|
|
5664
|
+
size: props.vertical ? props.height : width.value,
|
|
5665
|
+
count: itemCount.value,
|
|
5666
|
+
index: currentIndex.value,
|
|
5667
|
+
loop: props.loop
|
|
5668
|
+
}),
|
|
5669
|
+
start: () => {
|
|
5670
|
+
const offset = readCarouselOffset(root, props.vertical, posIndex.value, props.vertical ? props.height : width.value);
|
|
5671
|
+
if (transitionTimer.value) clearTimeout(transitionTimer.value);
|
|
5672
|
+
transitionTimer.value = null;
|
|
5673
|
+
playing.value = false;
|
|
5674
|
+
posIndex.value = props.loop ? currentIndex.value + 1 : currentIndex.value;
|
|
5675
|
+
settleDuration.value = null;
|
|
5676
|
+
dragging.value = true;
|
|
5677
|
+
if (autoTimer.value) clearInterval(autoTimer.value);
|
|
5678
|
+
return offset;
|
|
5679
|
+
},
|
|
5680
|
+
offset: (offset) => {
|
|
5681
|
+
dragOffset.value = offset;
|
|
5682
|
+
},
|
|
5683
|
+
finish: (step) => {
|
|
5684
|
+
dragging.value = false;
|
|
5685
|
+
animate.value = true;
|
|
5686
|
+
if (step) toSwitch(step === 1 ? "right" : "left");
|
|
5687
|
+
autoToPlay();
|
|
5688
|
+
},
|
|
5689
|
+
settle: (duration) => {
|
|
5690
|
+
settleDuration.value = duration;
|
|
5691
|
+
}
|
|
5692
|
+
});
|
|
5693
|
+
onCleanup(() => {
|
|
5694
|
+
dispose();
|
|
5695
|
+
dragging.value = false;
|
|
5696
|
+
});
|
|
5697
|
+
}, { flush: "post" });
|
|
5420
5698
|
expose({
|
|
5421
5699
|
next: () => toSwitch("right"),
|
|
5422
5700
|
prev: () => toSwitch("left"),
|
|
@@ -5424,7 +5702,6 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5424
5702
|
});
|
|
5425
5703
|
onMounted(() => {
|
|
5426
5704
|
nextTick(() => {
|
|
5427
|
-
resize();
|
|
5428
5705
|
autoToPlay();
|
|
5429
5706
|
});
|
|
5430
5707
|
});
|
|
@@ -5451,24 +5728,57 @@ var Carousel = /* @__PURE__ */ defineComponent({
|
|
|
5451
5728
|
cloneVNode(items[0])
|
|
5452
5729
|
] : items;
|
|
5453
5730
|
const activeIndex = Math.max(0, Math.min(len - 1, currentIndex.value));
|
|
5731
|
+
const offsetX = !vertical ? posIndex.value * width.value : 0;
|
|
5732
|
+
const offsetY = vertical ? posIndex.value * props.height : 0;
|
|
5454
5733
|
const wrapperProps = {
|
|
5455
5734
|
class: "k-carousel-wrapper",
|
|
5735
|
+
onTransitionend: (event) => {
|
|
5736
|
+
if (dragging.value) return;
|
|
5737
|
+
if (event.target === event.currentTarget && event.propertyName === "transform") finishTransition();
|
|
5738
|
+
},
|
|
5456
5739
|
style: {
|
|
5457
|
-
|
|
5740
|
+
position: "relative",
|
|
5741
|
+
transform: `translate3d(${-offsetX + (!vertical ? dragOffset.value : 0)}px, ${-offsetY + (vertical ? dragOffset.value : 0)}px, 0)`,
|
|
5458
5742
|
width: !vertical ? `${newChildren.length * width.value}px` : void 0,
|
|
5459
5743
|
height: vertical ? `${newChildren.length * props.height}px` : void 0,
|
|
5460
|
-
transitionDuration: !animate.value ? "0s" : void 0
|
|
5744
|
+
transitionDuration: !animate.value || dragging.value ? "0s" : settleDuration.value === null ? void 0 : `${settleDuration.value}ms`,
|
|
5745
|
+
transitionTimingFunction: settleDuration.value === null ? void 0 : "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
5746
|
+
touchAction: props.swipeable && len > 1 ? vertical ? "pan-x" : "pan-y" : void 0,
|
|
5747
|
+
userSelect: dragging.value ? "none" : void 0
|
|
5461
5748
|
}
|
|
5462
5749
|
};
|
|
5463
5750
|
const rootProps = mergeProps(attrs, {
|
|
5464
5751
|
style: { height: props.height + "px" },
|
|
5465
5752
|
ref: carouselRef,
|
|
5466
5753
|
class: ["k-carousel", { "k-carousel-vertical": vertical }],
|
|
5467
|
-
|
|
5468
|
-
|
|
5754
|
+
onPointerenter: (event) => {
|
|
5755
|
+
if (event.pointerType === "mouse") {
|
|
5756
|
+
hovered = true;
|
|
5757
|
+
if (autoTimer.value) clearInterval(autoTimer.value);
|
|
5758
|
+
}
|
|
5759
|
+
},
|
|
5760
|
+
onPointerleave: (event) => {
|
|
5761
|
+
if (event.pointerType === "mouse") {
|
|
5762
|
+
hovered = false;
|
|
5763
|
+
if (autoplay) autoToPlay();
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5469
5766
|
});
|
|
5470
5767
|
return withDirectives(createVNode("div", rootProps, [
|
|
5471
|
-
createVNode("div", wrapperProps, [newChildren]),
|
|
5768
|
+
createVNode("div", wrapperProps, [newChildren, props.loop && len > 1 && [-1, 1].map((side) => createVNode("div", {
|
|
5769
|
+
"key": side,
|
|
5770
|
+
"aria-hidden": "true",
|
|
5771
|
+
"inert": true,
|
|
5772
|
+
"style": {
|
|
5773
|
+
position: "absolute",
|
|
5774
|
+
display: "flex",
|
|
5775
|
+
flexDirection: vertical ? "column" : "row",
|
|
5776
|
+
left: vertical ? 0 : `${(side < 0 ? -len : len + 2) * width.value}px`,
|
|
5777
|
+
top: vertical ? `${(side < 0 ? -len : len + 2) * props.height}px` : 0,
|
|
5778
|
+
width: vertical ? "100%" : `${len * width.value}px`,
|
|
5779
|
+
pointerEvents: "none"
|
|
5780
|
+
}
|
|
5781
|
+
}, [items.map((_, i) => cloneVNode(items[(i + (side < 0 ? len - 1 : 1)) % len]))]))]),
|
|
5472
5782
|
!vertical && len > 1 && createVNode(Fragment, null, [createVNode("button", {
|
|
5473
5783
|
"type": "button",
|
|
5474
5784
|
"class": "k-carousel-arrow-left",
|
|
@@ -8647,7 +8957,6 @@ var input_number_default = markFormFieldComponent(/* @__PURE__ */ defineComponen
|
|
|
8647
8957
|
icon: props.icon,
|
|
8648
8958
|
shape: appearance.shape.value,
|
|
8649
8959
|
theme: appearance.theme.value,
|
|
8650
|
-
inputType: "input-number",
|
|
8651
8960
|
role: "spinbutton",
|
|
8652
8961
|
inputmode: "decimal",
|
|
8653
8962
|
"aria-valuemin": props.min === -Infinity ? void 0 : props.min,
|
|
@@ -8683,7 +8992,7 @@ var input_number_default = markFormFieldComponent(/* @__PURE__ */ defineComponen
|
|
|
8683
8992
|
"aria-label": "Decrease value",
|
|
8684
8993
|
"onClick": () => stepAction("down")
|
|
8685
8994
|
}, [createVNode(Icon, { "type": ChevronDown }, null)])]) : null;
|
|
8686
|
-
return createVNode(
|
|
8995
|
+
return createVNode(InputBase, mergeProps(inputProps, { "stylePrefix": "input-number" }), {
|
|
8687
8996
|
suffix: () => slots.suffix?.(),
|
|
8688
8997
|
prefix: () => slots.prefix?.(),
|
|
8689
8998
|
controls: () => controls
|
|
@@ -16412,6 +16721,93 @@ var notice = {
|
|
|
16412
16721
|
}
|
|
16413
16722
|
};
|
|
16414
16723
|
//#endregion
|
|
16724
|
+
//#region components/page/responsive.ts
|
|
16725
|
+
function showLayout(root, layout) {
|
|
16726
|
+
root.dataset.pageLayout = layout;
|
|
16727
|
+
root.querySelectorAll("[data-page-pager]").forEach((pager) => {
|
|
16728
|
+
pager.hidden = pager.dataset.pagePager !== layout;
|
|
16729
|
+
});
|
|
16730
|
+
}
|
|
16731
|
+
function bindResponsivePage(root) {
|
|
16732
|
+
const view = root.ownerDocument.defaultView;
|
|
16733
|
+
let layout = "full";
|
|
16734
|
+
let frame = 0;
|
|
16735
|
+
let disposed = false;
|
|
16736
|
+
const measure = () => {
|
|
16737
|
+
if (disposed) return;
|
|
16738
|
+
const available = root.clientWidth;
|
|
16739
|
+
if (!available) return;
|
|
16740
|
+
const host = root.ownerDocument.createElement("div");
|
|
16741
|
+
host.style.cssText = "position:fixed;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none";
|
|
16742
|
+
host.setAttribute("aria-hidden", "true");
|
|
16743
|
+
host.inert = true;
|
|
16744
|
+
const copy = root.cloneNode(true);
|
|
16745
|
+
copy.removeAttribute("id");
|
|
16746
|
+
copy.querySelectorAll("[id]").forEach((node) => node.removeAttribute("id"));
|
|
16747
|
+
copy.style.setProperty("width", "max-content", "important");
|
|
16748
|
+
copy.style.setProperty("max-width", "none", "important");
|
|
16749
|
+
copy.style.setProperty("min-width", "0", "important");
|
|
16750
|
+
copy.style.setProperty("flex", "none", "important");
|
|
16751
|
+
host.append(copy);
|
|
16752
|
+
root.parentElement?.append(host);
|
|
16753
|
+
const widths = {
|
|
16754
|
+
full: 0,
|
|
16755
|
+
compact: 0
|
|
16756
|
+
};
|
|
16757
|
+
try {
|
|
16758
|
+
for (const candidate of ["full", "compact"]) {
|
|
16759
|
+
showLayout(copy, candidate);
|
|
16760
|
+
widths[candidate] = copy.clientWidth;
|
|
16761
|
+
}
|
|
16762
|
+
} finally {
|
|
16763
|
+
host.remove();
|
|
16764
|
+
}
|
|
16765
|
+
if (!widths.full || !widths.compact) return;
|
|
16766
|
+
const fullMargin = layout === "full" ? 0 : 16;
|
|
16767
|
+
const compactMargin = layout === "simple" ? 16 : 0;
|
|
16768
|
+
const next = widths.full + fullMargin <= available ? "full" : widths.compact + compactMargin <= available ? "compact" : "simple";
|
|
16769
|
+
if (next !== layout) {
|
|
16770
|
+
const focused = root.ownerDocument.activeElement;
|
|
16771
|
+
const label = focused?.closest("[data-page-pager]") ? focused.getAttribute("aria-label") : null;
|
|
16772
|
+
showLayout(root, next);
|
|
16773
|
+
if (focused && root.contains(focused) && focused.closest("[hidden]")) {
|
|
16774
|
+
const buttons = [...root.querySelector(`[data-page-pager="${next}"]`)?.querySelectorAll("[role=\"button\"]") || []];
|
|
16775
|
+
(buttons.find((button) => button.getAttribute("aria-label") === label) || buttons.find((button) => button.tabIndex >= 0))?.focus();
|
|
16776
|
+
}
|
|
16777
|
+
layout = next;
|
|
16778
|
+
} else showLayout(root, layout);
|
|
16779
|
+
};
|
|
16780
|
+
const schedule = () => {
|
|
16781
|
+
if (!frame) frame = view.requestAnimationFrame(() => {
|
|
16782
|
+
frame = 0;
|
|
16783
|
+
measure();
|
|
16784
|
+
});
|
|
16785
|
+
};
|
|
16786
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedule);
|
|
16787
|
+
observer?.observe(root);
|
|
16788
|
+
const mutations = new MutationObserver(schedule);
|
|
16789
|
+
mutations.observe(root, {
|
|
16790
|
+
subtree: true,
|
|
16791
|
+
childList: true,
|
|
16792
|
+
characterData: true,
|
|
16793
|
+
attributes: true,
|
|
16794
|
+
attributeFilter: ["class", "style"]
|
|
16795
|
+
});
|
|
16796
|
+
view.addEventListener("resize", schedule);
|
|
16797
|
+
root.ownerDocument.fonts?.addEventListener("loadingdone", schedule);
|
|
16798
|
+
measure();
|
|
16799
|
+
return () => {
|
|
16800
|
+
disposed = true;
|
|
16801
|
+
observer?.disconnect();
|
|
16802
|
+
mutations.disconnect();
|
|
16803
|
+
view.removeEventListener("resize", schedule);
|
|
16804
|
+
root.ownerDocument.fonts?.removeEventListener("loadingdone", schedule);
|
|
16805
|
+
if (frame) view.cancelAnimationFrame(frame);
|
|
16806
|
+
showLayout(root, "full");
|
|
16807
|
+
delete root.dataset.pageLayout;
|
|
16808
|
+
};
|
|
16809
|
+
}
|
|
16810
|
+
//#endregion
|
|
16415
16811
|
//#region components/page/index.tsx
|
|
16416
16812
|
var Page = /* @__PURE__ */ defineComponent({
|
|
16417
16813
|
name: "Page",
|
|
@@ -16425,6 +16821,10 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
16425
16821
|
},
|
|
16426
16822
|
showElevator: Boolean,
|
|
16427
16823
|
simple: Boolean,
|
|
16824
|
+
responsive: {
|
|
16825
|
+
type: Boolean,
|
|
16826
|
+
default: true
|
|
16827
|
+
},
|
|
16428
16828
|
theme: {
|
|
16429
16829
|
type: String,
|
|
16430
16830
|
default: "fill"
|
|
@@ -16464,6 +16864,16 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
16464
16864
|
},
|
|
16465
16865
|
setup(props, { emit, attrs }) {
|
|
16466
16866
|
const appearance = useConfigAppearance(props);
|
|
16867
|
+
const rootRef = ref();
|
|
16868
|
+
let disposeResponsive;
|
|
16869
|
+
const setupResponsive = () => {
|
|
16870
|
+
disposeResponsive?.();
|
|
16871
|
+
disposeResponsive = void 0;
|
|
16872
|
+
if (rootRef.value && props.responsive && !props.simple) disposeResponsive = bindResponsivePage(rootRef.value);
|
|
16873
|
+
};
|
|
16874
|
+
onMounted(setupResponsive);
|
|
16875
|
+
watch([() => props.responsive, () => props.simple], setupResponsive, { flush: "post" });
|
|
16876
|
+
onBeforeUnmount(() => disposeResponsive?.());
|
|
16467
16877
|
const nextPageGroup = ref(false);
|
|
16468
16878
|
const prevPageGroup = ref(false);
|
|
16469
16879
|
const normalizePageSize = (value) => Number.isFinite(value) && value > 0 ? value : 10;
|
|
@@ -16504,7 +16914,7 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
16504
16914
|
emit("update:page", normalizedPage);
|
|
16505
16915
|
}
|
|
16506
16916
|
};
|
|
16507
|
-
const renderPage = () => {
|
|
16917
|
+
const renderPage = (compact = false) => {
|
|
16508
16918
|
const groupCount = 7, page = Number(defaultPage.value), pCount = Number(pageCount.value);
|
|
16509
16919
|
let showPrevMore = false;
|
|
16510
16920
|
let showNextMore = false;
|
|
@@ -16521,6 +16931,13 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
16521
16931
|
const offset = Math.floor(groupCount / 2) - 1;
|
|
16522
16932
|
for (let i = page - offset; i <= page + offset; i++) array.push(i);
|
|
16523
16933
|
} else for (let i = 2; i < pCount; i++) array.push(i);
|
|
16934
|
+
if (compact && pCount > 5) {
|
|
16935
|
+
array.length = 0;
|
|
16936
|
+
const middle = Math.min(pCount - 1, Math.max(2, page));
|
|
16937
|
+
array.push(middle);
|
|
16938
|
+
showPrevMore = middle > 2;
|
|
16939
|
+
showNextMore = middle < pCount - 1;
|
|
16940
|
+
}
|
|
16524
16941
|
const child = array.map((p, i) => {
|
|
16525
16942
|
const prop = {
|
|
16526
16943
|
class: ["k-pager-item", { "k-pager-item-active": page == p }],
|
|
@@ -16692,7 +17109,8 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
16692
17109
|
"k-page-outline": appearance.theme.value == "outline",
|
|
16693
17110
|
"k-page-plain": appearance.theme.value == "plain",
|
|
16694
17111
|
"k-page-disabled": props.disabled,
|
|
16695
|
-
"k-page-simple": props.simple
|
|
17112
|
+
"k-page-simple": props.simple,
|
|
17113
|
+
"k-page-responsive": props.responsive && !props.simple
|
|
16696
17114
|
}
|
|
16697
17115
|
], preNode = createVNode("li", {
|
|
16698
17116
|
"class": ["k-pager-item k-pager-prev", { "k-pager-item-disabled": defaultPage.value == 1 }],
|
|
@@ -16736,10 +17154,14 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
16736
17154
|
]);
|
|
16737
17155
|
return createVNode("nav", mergeProps(attrs, {
|
|
16738
17156
|
"class": [classes, attrs.class],
|
|
16739
|
-
"aria-label": "Pagination"
|
|
17157
|
+
"aria-label": "Pagination",
|
|
17158
|
+
"ref": rootRef
|
|
16740
17159
|
}), [
|
|
16741
17160
|
totalNode,
|
|
16742
|
-
createVNode("ul", {
|
|
17161
|
+
createVNode("ul", {
|
|
17162
|
+
"class": "k-pager",
|
|
17163
|
+
"data-page-pager": "full"
|
|
17164
|
+
}, [props.simple ? [
|
|
16743
17165
|
preNode,
|
|
16744
17166
|
simpleNode,
|
|
16745
17167
|
nextNode
|
|
@@ -16750,6 +17172,25 @@ var Page = /* @__PURE__ */ defineComponent({
|
|
|
16750
17172
|
lastNode,
|
|
16751
17173
|
nextNode
|
|
16752
17174
|
]]),
|
|
17175
|
+
props.responsive && !props.simple && createVNode(Fragment, null, [createVNode("ul", {
|
|
17176
|
+
"class": "k-pager",
|
|
17177
|
+
"data-page-pager": "compact",
|
|
17178
|
+
"hidden": true
|
|
17179
|
+
}, [[
|
|
17180
|
+
preNode,
|
|
17181
|
+
renderFirst(),
|
|
17182
|
+
renderPage(true),
|
|
17183
|
+
renderLast(),
|
|
17184
|
+
nextNode
|
|
17185
|
+
]]), createVNode("ul", {
|
|
17186
|
+
"class": "k-pager",
|
|
17187
|
+
"data-page-pager": "simple",
|
|
17188
|
+
"hidden": true
|
|
17189
|
+
}, [[
|
|
17190
|
+
preNode,
|
|
17191
|
+
simpleNode,
|
|
17192
|
+
nextNode
|
|
17193
|
+
]])]),
|
|
16753
17194
|
!props.simple && [sizeNode, elevatorNode]
|
|
16754
17195
|
]);
|
|
16755
17196
|
};
|