6603 lines
245 KiB
JavaScript
6603 lines
245 KiB
JavaScript
import { a as buildAssetsURL } from '../routes/renderer.mjs';
|
|
import { H as Head, T as Title, M as Meta, f as _imports_1, c as withInstall, I as publishSchoolSearchHttp, J as publishProfessionSearchHttp, K as ConfigProvider, b as buildProps, _ as _export_sfc$1, d as definePropType, L as useEmptyValuesProps, N as useSizeProp, O as circle_close_default, A as useLocale, P as useEmptyValues, Q as clock_default, R as calendar_default, B as ElIcon, S as d_arrow_left_default, V as arrow_left_default, W as arrow_right_default, X as d_arrow_right_default, E as EVENT_CODE, Y as isObjectLike, Z as baseGetTag, $ as root, a0 as hasClass, a1 as isArray, a2 as ListCache, a3 as Symbol$1, a4 as eq, a5 as arrow_up_default, a6 as arrow_down_default, a7 as MapCache, a8 as freeGlobal, a9 as isSymbol, aa as isObject, ab as getStyle, a as addUnit, ac as getNative, ad as toSource, ae as Map$1, af as loading_default, ag as CHANGE_EVENT, ah as INPUT_EVENT, U as UPDATE_MODEL_EVENT, ai as isFunction } from './config-provider-CA7emI64.mjs';
|
|
import { ref, withCtx, createTextVNode, createVNode, unref, defineComponent, provide, reactive, toRef, mergeProps, useAttrs, inject, computed, watch, nextTick, createBlock, openBlock, renderSlot, withModifiers, normalizeStyle, normalizeClass, createCommentVNode, resolveDynamicComponent, createElementVNode, toDisplayString, useSlots, createElementBlock, withDirectives, Fragment, renderList, vShow, withKeys, getCurrentInstance, Transition, createSlots, useSSRContext } from 'vue';
|
|
import { b as ElInput, d as useAriaProps, e as useFormItem, f as useFocusController, g as useFormSize, o as onClickOutside, E as ElTooltip, T as TOOLTIP_INJECTION_KEY, c as ElButton, h as useAttrs$1, i as flatten, j as isLength, k as arrayPush, l as useResizeObserver, m as useEventListener, u as useTooltipContentProps, n as useFormDisabled, p as unrefElement, q as isArguments, r as isIndex } from './el-button-BScT5ZwZ.mjs';
|
|
import { u as useRouter, e as useNamespace, q as debugWarn, s as shared_cjs_prodExports, x as isEmpty, y as isUndefined, o as isElement, v as isNumber, t as throwError, k as useId } from './server.mjs';
|
|
import dayjs from 'dayjs';
|
|
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
import advancedFormat from 'dayjs/plugin/advancedFormat.js';
|
|
import localeData from 'dayjs/plugin/localeData.js';
|
|
import weekOfYear from 'dayjs/plugin/weekOfYear.js';
|
|
import weekYear from 'dayjs/plugin/weekYear.js';
|
|
import dayOfYear from 'dayjs/plugin/dayOfYear.js';
|
|
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter.js';
|
|
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js';
|
|
import { placements } from '@popperjs/core';
|
|
import { ssrRenderComponent, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
|
|
import { u as useHead } from './vue.-sixQ7xP-CqaSk6XG.mjs';
|
|
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import 'vue-bundle-renderer/runtime';
|
|
import '../_/nitro.mjs';
|
|
import 'node:http';
|
|
import 'node:https';
|
|
import 'node:fs';
|
|
import 'node:url';
|
|
import 'node:path';
|
|
import 'devalue';
|
|
import '@unhead/ssr';
|
|
import 'unhead';
|
|
import '@unhead/shared';
|
|
import 'axios';
|
|
import 'qs';
|
|
import 'node:zlib';
|
|
import 'node:stream';
|
|
import 'node:buffer';
|
|
import 'node:util';
|
|
import 'node:net';
|
|
import 'vue-router';
|
|
|
|
var reWhitespace = /\s/;
|
|
function trimmedEndIndex(string) {
|
|
var index2 = string.length;
|
|
while (index2-- && reWhitespace.test(string.charAt(index2))) {
|
|
}
|
|
return index2;
|
|
}
|
|
var reTrimStart = /^\s+/;
|
|
function baseTrim(string) {
|
|
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
}
|
|
var NAN = 0 / 0;
|
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
var reIsBinary = /^0b[01]+$/i;
|
|
var reIsOctal = /^0o[0-7]+$/i;
|
|
var freeParseInt = parseInt;
|
|
function toNumber(value) {
|
|
if (typeof value == "number") {
|
|
return value;
|
|
}
|
|
if (isSymbol(value)) {
|
|
return NAN;
|
|
}
|
|
if (isObject(value)) {
|
|
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
value = isObject(other) ? other + "" : other;
|
|
}
|
|
if (typeof value != "string") {
|
|
return value === 0 ? value : +value;
|
|
}
|
|
value = baseTrim(value);
|
|
var isBinary = reIsBinary.test(value);
|
|
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
}
|
|
var WeakMap = getNative(root, "WeakMap");
|
|
function isArrayLike(value) {
|
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
}
|
|
var objectProto$5 = Object.prototype;
|
|
function isPrototype(value) {
|
|
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$5;
|
|
return value === proto;
|
|
}
|
|
function baseTimes(n, iteratee) {
|
|
var index2 = -1, result = Array(n);
|
|
while (++index2 < n) {
|
|
result[index2] = iteratee(index2);
|
|
}
|
|
return result;
|
|
}
|
|
function stubFalse() {
|
|
return false;
|
|
}
|
|
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
|
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
var Buffer = moduleExports$1 ? root.Buffer : void 0;
|
|
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
|
|
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
var typedArrayTags = {};
|
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
function baseIsTypedArray(value) {
|
|
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
}
|
|
function baseUnary(func) {
|
|
return function(value) {
|
|
return func(value);
|
|
};
|
|
}
|
|
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
var freeProcess = moduleExports && freeGlobal.process;
|
|
var nodeUtil = function() {
|
|
try {
|
|
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
if (types) {
|
|
return types;
|
|
}
|
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
} catch (e) {
|
|
}
|
|
}();
|
|
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
var objectProto$4 = Object.prototype;
|
|
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
function arrayLikeKeys(value, inherited) {
|
|
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
for (var key in value) {
|
|
if (hasOwnProperty$3.call(value, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
isIndex(key, length)))) {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function overArg(func, transform) {
|
|
return function(arg) {
|
|
return func(transform(arg));
|
|
};
|
|
}
|
|
var nativeKeys = overArg(Object.keys, Object);
|
|
var objectProto$3 = Object.prototype;
|
|
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
function baseKeys(object) {
|
|
if (!isPrototype(object)) {
|
|
return nativeKeys(object);
|
|
}
|
|
var result = [];
|
|
for (var key in Object(object)) {
|
|
if (hasOwnProperty$2.call(object, key) && key != "constructor") {
|
|
result.push(key);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function keys(object) {
|
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
}
|
|
function stackClear() {
|
|
this.__data__ = new ListCache();
|
|
this.size = 0;
|
|
}
|
|
function stackDelete(key) {
|
|
var data = this.__data__, result = data["delete"](key);
|
|
this.size = data.size;
|
|
return result;
|
|
}
|
|
function stackGet(key) {
|
|
return this.__data__.get(key);
|
|
}
|
|
function stackHas(key) {
|
|
return this.__data__.has(key);
|
|
}
|
|
var LARGE_ARRAY_SIZE = 200;
|
|
function stackSet(key, value) {
|
|
var data = this.__data__;
|
|
if (data instanceof ListCache) {
|
|
var pairs = data.__data__;
|
|
if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
pairs.push([key, value]);
|
|
this.size = ++data.size;
|
|
return this;
|
|
}
|
|
data = this.__data__ = new MapCache(pairs);
|
|
}
|
|
data.set(key, value);
|
|
this.size = data.size;
|
|
return this;
|
|
}
|
|
function Stack(entries) {
|
|
var data = this.__data__ = new ListCache(entries);
|
|
this.size = data.size;
|
|
}
|
|
Stack.prototype.clear = stackClear;
|
|
Stack.prototype["delete"] = stackDelete;
|
|
Stack.prototype.get = stackGet;
|
|
Stack.prototype.has = stackHas;
|
|
Stack.prototype.set = stackSet;
|
|
function arrayFilter(array, predicate) {
|
|
var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
while (++index2 < length) {
|
|
var value = array[index2];
|
|
if (predicate(value, index2, array)) {
|
|
result[resIndex++] = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function stubArray() {
|
|
return [];
|
|
}
|
|
var objectProto$2 = Object.prototype;
|
|
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
if (object == null) {
|
|
return [];
|
|
}
|
|
object = Object(object);
|
|
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
return propertyIsEnumerable.call(object, symbol);
|
|
});
|
|
};
|
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
var result = keysFunc(object);
|
|
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
}
|
|
function getAllKeys(object) {
|
|
return baseGetAllKeys(object, keys, getSymbols);
|
|
}
|
|
var DataView = getNative(root, "DataView");
|
|
var Promise$1 = getNative(root, "Promise");
|
|
var Set$1 = getNative(root, "Set");
|
|
var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
|
|
var dataViewTag$1 = "[object DataView]";
|
|
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
|
|
var getTag = baseGetTag;
|
|
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1 || Map$1 && getTag(new Map$1()) != mapTag$1 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$1 || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
getTag = function(value) {
|
|
var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
if (ctorString) {
|
|
switch (ctorString) {
|
|
case dataViewCtorString:
|
|
return dataViewTag$1;
|
|
case mapCtorString:
|
|
return mapTag$1;
|
|
case promiseCtorString:
|
|
return promiseTag;
|
|
case setCtorString:
|
|
return setTag$1;
|
|
case weakMapCtorString:
|
|
return weakMapTag;
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
var Uint8Array = root.Uint8Array;
|
|
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
function setCacheAdd(value) {
|
|
this.__data__.set(value, HASH_UNDEFINED);
|
|
return this;
|
|
}
|
|
function setCacheHas(value) {
|
|
return this.__data__.has(value);
|
|
}
|
|
function SetCache(values) {
|
|
var index2 = -1, length = values == null ? 0 : values.length;
|
|
this.__data__ = new MapCache();
|
|
while (++index2 < length) {
|
|
this.add(values[index2]);
|
|
}
|
|
}
|
|
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
SetCache.prototype.has = setCacheHas;
|
|
function arraySome(array, predicate) {
|
|
var index2 = -1, length = array == null ? 0 : array.length;
|
|
while (++index2 < length) {
|
|
if (predicate(array[index2], index2, array)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function cacheHas(cache, key) {
|
|
return cache.has(key);
|
|
}
|
|
var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
|
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
|
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
return false;
|
|
}
|
|
var arrStacked = stack.get(array);
|
|
var othStacked = stack.get(other);
|
|
if (arrStacked && othStacked) {
|
|
return arrStacked == other && othStacked == array;
|
|
}
|
|
var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
|
|
stack.set(array, other);
|
|
stack.set(other, array);
|
|
while (++index2 < arrLength) {
|
|
var arrValue = array[index2], othValue = other[index2];
|
|
if (customizer) {
|
|
var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
|
|
}
|
|
if (compared !== void 0) {
|
|
if (compared) {
|
|
continue;
|
|
}
|
|
result = false;
|
|
break;
|
|
}
|
|
if (seen) {
|
|
if (!arraySome(other, function(othValue2, othIndex) {
|
|
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
return seen.push(othIndex);
|
|
}
|
|
})) {
|
|
result = false;
|
|
break;
|
|
}
|
|
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
result = false;
|
|
break;
|
|
}
|
|
}
|
|
stack["delete"](array);
|
|
stack["delete"](other);
|
|
return result;
|
|
}
|
|
function mapToArray(map) {
|
|
var index2 = -1, result = Array(map.size);
|
|
map.forEach(function(value, key) {
|
|
result[++index2] = [key, value];
|
|
});
|
|
return result;
|
|
}
|
|
function setToArray(set) {
|
|
var index2 = -1, result = Array(set.size);
|
|
set.forEach(function(value) {
|
|
result[++index2] = value;
|
|
});
|
|
return result;
|
|
}
|
|
var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
|
|
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
switch (tag) {
|
|
case dataViewTag:
|
|
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
return false;
|
|
}
|
|
object = object.buffer;
|
|
other = other.buffer;
|
|
case arrayBufferTag:
|
|
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
case boolTag:
|
|
case dateTag:
|
|
case numberTag:
|
|
return eq(+object, +other);
|
|
case errorTag:
|
|
return object.name == other.name && object.message == other.message;
|
|
case regexpTag:
|
|
case stringTag:
|
|
return object == other + "";
|
|
case mapTag:
|
|
var convert = mapToArray;
|
|
case setTag:
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
convert || (convert = setToArray);
|
|
if (object.size != other.size && !isPartial) {
|
|
return false;
|
|
}
|
|
var stacked = stack.get(object);
|
|
if (stacked) {
|
|
return stacked == other;
|
|
}
|
|
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
stack.set(object, other);
|
|
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
stack["delete"](object);
|
|
return result;
|
|
case symbolTag:
|
|
if (symbolValueOf) {
|
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
var objectProto$1 = Object.prototype;
|
|
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
if (objLength != othLength && !isPartial) {
|
|
return false;
|
|
}
|
|
var index2 = objLength;
|
|
while (index2--) {
|
|
var key = objProps[index2];
|
|
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
return false;
|
|
}
|
|
}
|
|
var objStacked = stack.get(object);
|
|
var othStacked = stack.get(other);
|
|
if (objStacked && othStacked) {
|
|
return objStacked == other && othStacked == object;
|
|
}
|
|
var result = true;
|
|
stack.set(object, other);
|
|
stack.set(other, object);
|
|
var skipCtor = isPartial;
|
|
while (++index2 < objLength) {
|
|
key = objProps[index2];
|
|
var objValue = object[key], othValue = other[key];
|
|
if (customizer) {
|
|
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
}
|
|
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
result = false;
|
|
break;
|
|
}
|
|
skipCtor || (skipCtor = key == "constructor");
|
|
}
|
|
if (result && !skipCtor) {
|
|
var objCtor = object.constructor, othCtor = other.constructor;
|
|
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
result = false;
|
|
}
|
|
}
|
|
stack["delete"](object);
|
|
stack["delete"](other);
|
|
return result;
|
|
}
|
|
var COMPARE_PARTIAL_FLAG = 1;
|
|
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
var objectProto = Object.prototype;
|
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
if (isSameTag && isBuffer(object)) {
|
|
if (!isBuffer(other)) {
|
|
return false;
|
|
}
|
|
objIsArr = true;
|
|
objIsObj = false;
|
|
}
|
|
if (isSameTag && !objIsObj) {
|
|
stack || (stack = new Stack());
|
|
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
}
|
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
if (objIsWrapped || othIsWrapped) {
|
|
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
stack || (stack = new Stack());
|
|
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
}
|
|
}
|
|
if (!isSameTag) {
|
|
return false;
|
|
}
|
|
stack || (stack = new Stack());
|
|
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
}
|
|
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
if (value === other) {
|
|
return true;
|
|
}
|
|
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
return value !== value && other !== other;
|
|
}
|
|
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
}
|
|
var now = function() {
|
|
return root.Date.now();
|
|
};
|
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
var nativeMax = Math.max, nativeMin = Math.min;
|
|
function debounce(func, wait, options) {
|
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
if (typeof func != "function") {
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
}
|
|
wait = toNumber(wait) || 0;
|
|
if (isObject(options)) {
|
|
leading = !!options.leading;
|
|
maxing = "maxWait" in options;
|
|
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
}
|
|
function invokeFunc(time) {
|
|
var args = lastArgs, thisArg = lastThis;
|
|
lastArgs = lastThis = void 0;
|
|
lastInvokeTime = time;
|
|
result = func.apply(thisArg, args);
|
|
return result;
|
|
}
|
|
function leadingEdge(time) {
|
|
lastInvokeTime = time;
|
|
timerId = setTimeout(timerExpired, wait);
|
|
return leading ? invokeFunc(time) : result;
|
|
}
|
|
function remainingWait(time) {
|
|
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
}
|
|
function shouldInvoke(time) {
|
|
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
|
|
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
}
|
|
function timerExpired() {
|
|
var time = now();
|
|
if (shouldInvoke(time)) {
|
|
return trailingEdge(time);
|
|
}
|
|
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
}
|
|
function trailingEdge(time) {
|
|
timerId = void 0;
|
|
if (trailing && lastArgs) {
|
|
return invokeFunc(time);
|
|
}
|
|
lastArgs = lastThis = void 0;
|
|
return result;
|
|
}
|
|
function cancel() {
|
|
if (timerId !== void 0) {
|
|
clearTimeout(timerId);
|
|
}
|
|
lastInvokeTime = 0;
|
|
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
}
|
|
function flush() {
|
|
return timerId === void 0 ? result : trailingEdge(now());
|
|
}
|
|
function debounced() {
|
|
var time = now(), isInvoking = shouldInvoke(time);
|
|
lastArgs = arguments;
|
|
lastThis = this;
|
|
lastCallTime = time;
|
|
if (isInvoking) {
|
|
if (timerId === void 0) {
|
|
return leadingEdge(lastCallTime);
|
|
}
|
|
if (maxing) {
|
|
clearTimeout(timerId);
|
|
timerId = setTimeout(timerExpired, wait);
|
|
return invokeFunc(lastCallTime);
|
|
}
|
|
}
|
|
if (timerId === void 0) {
|
|
timerId = setTimeout(timerExpired, wait);
|
|
}
|
|
return result;
|
|
}
|
|
debounced.cancel = cancel;
|
|
debounced.flush = flush;
|
|
return debounced;
|
|
}
|
|
function isEqual(value, other) {
|
|
return baseIsEqual(value, other);
|
|
}
|
|
const GAP = 4;
|
|
const BAR_MAP = {
|
|
vertical: {
|
|
offset: "offsetHeight",
|
|
scroll: "scrollTop",
|
|
scrollSize: "scrollHeight",
|
|
size: "height",
|
|
key: "vertical",
|
|
axis: "Y",
|
|
client: "clientY",
|
|
direction: "top"
|
|
},
|
|
horizontal: {
|
|
offset: "offsetWidth",
|
|
scroll: "scrollLeft",
|
|
scrollSize: "scrollWidth",
|
|
size: "width",
|
|
key: "horizontal",
|
|
axis: "X",
|
|
client: "clientX",
|
|
direction: "left"
|
|
}
|
|
};
|
|
const renderThumbStyle = ({
|
|
move,
|
|
size,
|
|
bar
|
|
}) => ({
|
|
[bar.size]: size,
|
|
transform: `translate${bar.axis}(${move}%)`
|
|
});
|
|
const scrollbarContextKey = Symbol("scrollbarContextKey");
|
|
const thumbProps = buildProps({
|
|
vertical: Boolean,
|
|
size: String,
|
|
move: Number,
|
|
ratio: {
|
|
type: Number,
|
|
required: true
|
|
},
|
|
always: Boolean
|
|
});
|
|
const COMPONENT_NAME$2 = "Thumb";
|
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
__name: "thumb",
|
|
props: thumbProps,
|
|
setup(__props) {
|
|
const props = __props;
|
|
const scrollbar = inject(scrollbarContextKey);
|
|
const ns = useNamespace("scrollbar");
|
|
if (!scrollbar)
|
|
throwError(COMPONENT_NAME$2, "can not inject scrollbar context");
|
|
const instance = ref();
|
|
const thumb = ref();
|
|
const thumbState = ref({});
|
|
const visible = ref(false);
|
|
let cursorDown = false;
|
|
let cursorLeave = false;
|
|
let originalOnSelectStart = null;
|
|
const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
|
|
const thumbStyle = computed(() => renderThumbStyle({
|
|
size: props.size,
|
|
move: props.move,
|
|
bar: bar.value
|
|
}));
|
|
const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
|
|
const clickThumbHandler = (e) => {
|
|
var _a;
|
|
e.stopPropagation();
|
|
if (e.ctrlKey || [1, 2].includes(e.button))
|
|
return;
|
|
(_a = (void 0).getSelection()) == null ? void 0 : _a.removeAllRanges();
|
|
startDrag(e);
|
|
const el = e.currentTarget;
|
|
if (!el)
|
|
return;
|
|
thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
|
|
};
|
|
const clickTrackHandler = (e) => {
|
|
if (!thumb.value || !instance.value || !scrollbar.wrapElement)
|
|
return;
|
|
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
|
|
const thumbHalf = thumb.value[bar.value.offset] / 2;
|
|
const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
|
|
};
|
|
const startDrag = (e) => {
|
|
e.stopImmediatePropagation();
|
|
cursorDown = true;
|
|
(void 0).addEventListener("mousemove", mouseMoveDocumentHandler);
|
|
(void 0).addEventListener("mouseup", mouseUpDocumentHandler);
|
|
originalOnSelectStart = (void 0).onselectstart;
|
|
(void 0).onselectstart = () => false;
|
|
};
|
|
const mouseMoveDocumentHandler = (e) => {
|
|
if (!instance.value || !thumb.value)
|
|
return;
|
|
if (cursorDown === false)
|
|
return;
|
|
const prevPage = thumbState.value[bar.value.axis];
|
|
if (!prevPage)
|
|
return;
|
|
const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
|
|
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
|
|
};
|
|
const mouseUpDocumentHandler = () => {
|
|
cursorDown = false;
|
|
thumbState.value[bar.value.axis] = 0;
|
|
(void 0).removeEventListener("mousemove", mouseMoveDocumentHandler);
|
|
(void 0).removeEventListener("mouseup", mouseUpDocumentHandler);
|
|
restoreOnselectstart();
|
|
if (cursorLeave)
|
|
visible.value = false;
|
|
};
|
|
const mouseMoveScrollbarHandler = () => {
|
|
cursorLeave = false;
|
|
visible.value = !!props.size;
|
|
};
|
|
const mouseLeaveScrollbarHandler = () => {
|
|
cursorLeave = true;
|
|
visible.value = cursorDown;
|
|
};
|
|
const restoreOnselectstart = () => {
|
|
if ((void 0).onselectstart !== originalOnSelectStart)
|
|
(void 0).onselectstart = originalOnSelectStart;
|
|
};
|
|
useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
|
|
useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createBlock(Transition, {
|
|
name: unref(ns).b("fade"),
|
|
persisted: ""
|
|
}, {
|
|
default: withCtx(() => [
|
|
withDirectives(createElementVNode("div", {
|
|
ref_key: "instance",
|
|
ref: instance,
|
|
class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
|
|
onMousedown: clickTrackHandler
|
|
}, [
|
|
createElementVNode("div", {
|
|
ref_key: "thumb",
|
|
ref: thumb,
|
|
class: normalizeClass(unref(ns).e("thumb")),
|
|
style: normalizeStyle(unref(thumbStyle)),
|
|
onMousedown: clickThumbHandler
|
|
}, null, 38)
|
|
], 34), [
|
|
[vShow, _ctx.always || visible.value]
|
|
])
|
|
]),
|
|
_: 1
|
|
}, 8, ["name"]);
|
|
};
|
|
}
|
|
});
|
|
var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__file", "thumb.vue"]]);
|
|
const barProps = buildProps({
|
|
always: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
minSize: {
|
|
type: Number,
|
|
required: true
|
|
}
|
|
});
|
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
__name: "bar",
|
|
props: barProps,
|
|
setup(__props, { expose }) {
|
|
const props = __props;
|
|
const scrollbar = inject(scrollbarContextKey);
|
|
const moveX = ref(0);
|
|
const moveY = ref(0);
|
|
const sizeWidth = ref("");
|
|
const sizeHeight = ref("");
|
|
const ratioY = ref(1);
|
|
const ratioX = ref(1);
|
|
const handleScroll = (wrap) => {
|
|
if (wrap) {
|
|
const offsetHeight = wrap.offsetHeight - GAP;
|
|
const offsetWidth = wrap.offsetWidth - GAP;
|
|
moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
|
|
moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
|
|
}
|
|
};
|
|
const update = () => {
|
|
const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
|
|
if (!wrap)
|
|
return;
|
|
const offsetHeight = wrap.offsetHeight - GAP;
|
|
const offsetWidth = wrap.offsetWidth - GAP;
|
|
const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
|
|
const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
|
|
const height = Math.max(originalHeight, props.minSize);
|
|
const width = Math.max(originalWidth, props.minSize);
|
|
ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
|
|
ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
|
|
sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
|
|
sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
|
|
};
|
|
expose({
|
|
handleScroll,
|
|
update
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
createVNode(Thumb, {
|
|
move: moveX.value,
|
|
ratio: ratioX.value,
|
|
size: sizeWidth.value,
|
|
always: _ctx.always
|
|
}, null, 8, ["move", "ratio", "size", "always"]),
|
|
createVNode(Thumb, {
|
|
move: moveY.value,
|
|
ratio: ratioY.value,
|
|
size: sizeHeight.value,
|
|
vertical: "",
|
|
always: _ctx.always
|
|
}, null, 8, ["move", "ratio", "size", "always"])
|
|
], 64);
|
|
};
|
|
}
|
|
});
|
|
var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["__file", "bar.vue"]]);
|
|
const scrollbarProps = buildProps({
|
|
height: {
|
|
type: [String, Number],
|
|
default: ""
|
|
},
|
|
maxHeight: {
|
|
type: [String, Number],
|
|
default: ""
|
|
},
|
|
native: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
wrapStyle: {
|
|
type: definePropType([String, Object, Array]),
|
|
default: ""
|
|
},
|
|
wrapClass: {
|
|
type: [String, Array],
|
|
default: ""
|
|
},
|
|
viewClass: {
|
|
type: [String, Array],
|
|
default: ""
|
|
},
|
|
viewStyle: {
|
|
type: [String, Array, Object],
|
|
default: ""
|
|
},
|
|
noresize: Boolean,
|
|
tag: {
|
|
type: String,
|
|
default: "div"
|
|
},
|
|
always: Boolean,
|
|
minSize: {
|
|
type: Number,
|
|
default: 20
|
|
},
|
|
tabindex: {
|
|
type: [String, Number],
|
|
default: void 0
|
|
},
|
|
id: String,
|
|
role: String,
|
|
...useAriaProps(["ariaLabel", "ariaOrientation"])
|
|
});
|
|
const scrollbarEmits = {
|
|
scroll: ({
|
|
scrollTop,
|
|
scrollLeft
|
|
}) => [scrollTop, scrollLeft].every(isNumber)
|
|
};
|
|
const COMPONENT_NAME$1 = "ElScrollbar";
|
|
const __default__$5 = defineComponent({
|
|
name: COMPONENT_NAME$1
|
|
});
|
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
...__default__$5,
|
|
props: scrollbarProps,
|
|
emits: scrollbarEmits,
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const ns = useNamespace("scrollbar");
|
|
let stopResizeObserver = void 0;
|
|
let stopResizeListener = void 0;
|
|
const scrollbarRef = ref();
|
|
const wrapRef = ref();
|
|
const resizeRef = ref();
|
|
const barRef = ref();
|
|
const wrapStyle = computed(() => {
|
|
const style = {};
|
|
if (props.height)
|
|
style.height = addUnit(props.height);
|
|
if (props.maxHeight)
|
|
style.maxHeight = addUnit(props.maxHeight);
|
|
return [props.wrapStyle, style];
|
|
});
|
|
const wrapKls = computed(() => {
|
|
return [
|
|
props.wrapClass,
|
|
ns.e("wrap"),
|
|
{ [ns.em("wrap", "hidden-default")]: !props.native }
|
|
];
|
|
});
|
|
const resizeKls = computed(() => {
|
|
return [ns.e("view"), props.viewClass];
|
|
});
|
|
const handleScroll = () => {
|
|
var _a;
|
|
if (wrapRef.value) {
|
|
(_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
|
|
wrapRef.value.scrollTop;
|
|
wrapRef.value.scrollLeft;
|
|
emit("scroll", {
|
|
scrollTop: wrapRef.value.scrollTop,
|
|
scrollLeft: wrapRef.value.scrollLeft
|
|
});
|
|
}
|
|
};
|
|
function scrollTo(arg1, arg2) {
|
|
if (shared_cjs_prodExports.isObject(arg1)) {
|
|
wrapRef.value.scrollTo(arg1);
|
|
} else if (isNumber(arg1) && isNumber(arg2)) {
|
|
wrapRef.value.scrollTo(arg1, arg2);
|
|
}
|
|
}
|
|
const setScrollTop = (value) => {
|
|
if (!isNumber(value)) {
|
|
return;
|
|
}
|
|
wrapRef.value.scrollTop = value;
|
|
};
|
|
const setScrollLeft = (value) => {
|
|
if (!isNumber(value)) {
|
|
return;
|
|
}
|
|
wrapRef.value.scrollLeft = value;
|
|
};
|
|
const update = () => {
|
|
var _a;
|
|
(_a = barRef.value) == null ? void 0 : _a.update();
|
|
};
|
|
watch(() => props.noresize, (noresize) => {
|
|
if (noresize) {
|
|
stopResizeObserver == null ? void 0 : stopResizeObserver();
|
|
stopResizeListener == null ? void 0 : stopResizeListener();
|
|
} else {
|
|
({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
|
|
stopResizeListener = useEventListener("resize", update);
|
|
}
|
|
}, { immediate: true });
|
|
watch(() => [props.maxHeight, props.height], () => {
|
|
if (!props.native)
|
|
nextTick(() => {
|
|
var _a;
|
|
update();
|
|
if (wrapRef.value) {
|
|
(_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
|
|
}
|
|
});
|
|
});
|
|
provide(scrollbarContextKey, reactive({
|
|
scrollbarElement: scrollbarRef,
|
|
wrapElement: wrapRef
|
|
}));
|
|
expose({
|
|
wrapRef,
|
|
update,
|
|
scrollTo,
|
|
setScrollTop,
|
|
setScrollLeft,
|
|
handleScroll
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
ref_key: "scrollbarRef",
|
|
ref: scrollbarRef,
|
|
class: normalizeClass(unref(ns).b())
|
|
}, [
|
|
createElementVNode("div", {
|
|
ref_key: "wrapRef",
|
|
ref: wrapRef,
|
|
class: normalizeClass(unref(wrapKls)),
|
|
style: normalizeStyle(unref(wrapStyle)),
|
|
tabindex: _ctx.tabindex,
|
|
onScroll: handleScroll
|
|
}, [
|
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
id: _ctx.id,
|
|
ref_key: "resizeRef",
|
|
ref: resizeRef,
|
|
class: normalizeClass(unref(resizeKls)),
|
|
style: normalizeStyle(_ctx.viewStyle),
|
|
role: _ctx.role,
|
|
"aria-label": _ctx.ariaLabel,
|
|
"aria-orientation": _ctx.ariaOrientation
|
|
}, {
|
|
default: withCtx(() => [
|
|
renderSlot(_ctx.$slots, "default")
|
|
]),
|
|
_: 3
|
|
}, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
|
|
], 46, ["tabindex"]),
|
|
!_ctx.native ? (openBlock(), createBlock(Bar, {
|
|
key: 0,
|
|
ref_key: "barRef",
|
|
ref: barRef,
|
|
always: _ctx.always,
|
|
"min-size": _ctx.minSize
|
|
}, null, 8, ["always", "min-size"])) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__file", "scrollbar.vue"]]);
|
|
const ElScrollbar = withInstall(Scrollbar);
|
|
const autocompleteProps = buildProps({
|
|
valueKey: {
|
|
type: String,
|
|
default: "value"
|
|
},
|
|
modelValue: {
|
|
type: [String, Number],
|
|
default: ""
|
|
},
|
|
debounce: {
|
|
type: Number,
|
|
default: 300
|
|
},
|
|
placement: {
|
|
type: definePropType(String),
|
|
values: [
|
|
"top",
|
|
"top-start",
|
|
"top-end",
|
|
"bottom",
|
|
"bottom-start",
|
|
"bottom-end"
|
|
],
|
|
default: "bottom-start"
|
|
},
|
|
fetchSuggestions: {
|
|
type: definePropType([Function, Array]),
|
|
default: shared_cjs_prodExports.NOOP
|
|
},
|
|
popperClass: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
triggerOnFocus: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
selectWhenUnmatched: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
hideLoading: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
teleported: useTooltipContentProps.teleported,
|
|
highlightFirstItem: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
fitInputWidth: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
clearable: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
name: String,
|
|
...useAriaProps(["ariaLabel"])
|
|
});
|
|
const autocompleteEmits = {
|
|
[UPDATE_MODEL_EVENT]: (value) => shared_cjs_prodExports.isString(value),
|
|
[INPUT_EVENT]: (value) => shared_cjs_prodExports.isString(value),
|
|
[CHANGE_EVENT]: (value) => shared_cjs_prodExports.isString(value),
|
|
focus: (evt) => evt instanceof FocusEvent,
|
|
blur: (evt) => evt instanceof FocusEvent,
|
|
clear: () => true,
|
|
select: (item) => shared_cjs_prodExports.isObject(item)
|
|
};
|
|
const COMPONENT_NAME = "ElAutocomplete";
|
|
const __default__$4 = defineComponent({
|
|
name: COMPONENT_NAME,
|
|
inheritAttrs: false
|
|
});
|
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
...__default__$4,
|
|
props: autocompleteProps,
|
|
emits: autocompleteEmits,
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const attrs = useAttrs$1();
|
|
const rawAttrs = useAttrs();
|
|
const disabled = useFormDisabled();
|
|
const ns = useNamespace("autocomplete");
|
|
const inputRef = ref();
|
|
const regionRef = ref();
|
|
const popperRef = ref();
|
|
const listboxRef = ref();
|
|
let ignoreFocusEvent = false;
|
|
const suggestions = ref([]);
|
|
const highlightedIndex = ref(-1);
|
|
const dropdownWidth = ref("");
|
|
const activated = ref(false);
|
|
const suggestionDisabled = ref(false);
|
|
const loading = ref(false);
|
|
const listboxId = useId();
|
|
const styles = computed(() => rawAttrs.style);
|
|
const suggestionVisible = computed(() => {
|
|
const isValidData = suggestions.value.length > 0;
|
|
return (isValidData || loading.value) && activated.value;
|
|
});
|
|
const suggestionLoading = computed(() => !props.hideLoading && loading.value);
|
|
const refInput = computed(() => {
|
|
if (inputRef.value) {
|
|
return Array.from(inputRef.value.$el.querySelectorAll("input"));
|
|
}
|
|
return [];
|
|
});
|
|
const onSuggestionShow = () => {
|
|
if (suggestionVisible.value) {
|
|
dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
|
|
}
|
|
};
|
|
const onHide = () => {
|
|
highlightedIndex.value = -1;
|
|
};
|
|
const getData = async (queryString) => {
|
|
if (suggestionDisabled.value)
|
|
return;
|
|
const cb = (suggestionList) => {
|
|
loading.value = false;
|
|
if (suggestionDisabled.value)
|
|
return;
|
|
if (shared_cjs_prodExports.isArray(suggestionList)) {
|
|
suggestions.value = suggestionList;
|
|
highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
|
|
} else {
|
|
throwError(COMPONENT_NAME, "autocomplete suggestions must be an array");
|
|
}
|
|
};
|
|
loading.value = true;
|
|
if (shared_cjs_prodExports.isArray(props.fetchSuggestions)) {
|
|
cb(props.fetchSuggestions);
|
|
} else {
|
|
const result = await props.fetchSuggestions(queryString, cb);
|
|
if (shared_cjs_prodExports.isArray(result))
|
|
cb(result);
|
|
}
|
|
};
|
|
const debouncedGetData = debounce(getData, props.debounce);
|
|
const handleInput = (value) => {
|
|
const valuePresented = !!value;
|
|
emit(INPUT_EVENT, value);
|
|
emit(UPDATE_MODEL_EVENT, value);
|
|
suggestionDisabled.value = false;
|
|
activated.value || (activated.value = valuePresented);
|
|
if (!props.triggerOnFocus && !value) {
|
|
suggestionDisabled.value = true;
|
|
suggestions.value = [];
|
|
return;
|
|
}
|
|
debouncedGetData(value);
|
|
};
|
|
const handleMouseDown = (event) => {
|
|
var _a;
|
|
if (disabled.value)
|
|
return;
|
|
if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes((void 0).activeElement)) {
|
|
activated.value = true;
|
|
}
|
|
};
|
|
const handleChange = (value) => {
|
|
emit(CHANGE_EVENT, value);
|
|
};
|
|
const handleFocus = (evt) => {
|
|
if (!ignoreFocusEvent) {
|
|
activated.value = true;
|
|
emit("focus", evt);
|
|
if (props.triggerOnFocus && true) {
|
|
debouncedGetData(String(props.modelValue));
|
|
}
|
|
} else {
|
|
ignoreFocusEvent = false;
|
|
}
|
|
};
|
|
const handleBlur = (evt) => {
|
|
setTimeout(() => {
|
|
var _a;
|
|
if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
|
|
ignoreFocusEvent = true;
|
|
return;
|
|
}
|
|
activated.value && close();
|
|
emit("blur", evt);
|
|
});
|
|
};
|
|
const handleClear = () => {
|
|
activated.value = false;
|
|
emit(UPDATE_MODEL_EVENT, "");
|
|
emit("clear");
|
|
};
|
|
const handleKeyEnter = async () => {
|
|
if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
|
|
handleSelect(suggestions.value[highlightedIndex.value]);
|
|
} else if (props.selectWhenUnmatched) {
|
|
emit("select", { value: props.modelValue });
|
|
suggestions.value = [];
|
|
highlightedIndex.value = -1;
|
|
}
|
|
};
|
|
const handleKeyEscape = (evt) => {
|
|
if (suggestionVisible.value) {
|
|
evt.preventDefault();
|
|
evt.stopPropagation();
|
|
close();
|
|
}
|
|
};
|
|
const close = () => {
|
|
activated.value = false;
|
|
};
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const blur = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
};
|
|
const handleSelect = async (item) => {
|
|
emit(INPUT_EVENT, item[props.valueKey]);
|
|
emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
|
|
emit("select", item);
|
|
suggestions.value = [];
|
|
highlightedIndex.value = -1;
|
|
};
|
|
const highlight = (index2) => {
|
|
if (!suggestionVisible.value || loading.value)
|
|
return;
|
|
if (index2 < 0) {
|
|
highlightedIndex.value = -1;
|
|
return;
|
|
}
|
|
if (index2 >= suggestions.value.length) {
|
|
index2 = suggestions.value.length - 1;
|
|
}
|
|
const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
|
|
const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
|
|
const highlightItem = suggestionList[index2];
|
|
const scrollTop = suggestion.scrollTop;
|
|
const { offsetTop, scrollHeight } = highlightItem;
|
|
if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
|
|
suggestion.scrollTop += scrollHeight;
|
|
}
|
|
if (offsetTop < scrollTop) {
|
|
suggestion.scrollTop -= scrollHeight;
|
|
}
|
|
highlightedIndex.value = index2;
|
|
inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
|
|
};
|
|
onClickOutside(listboxRef, () => {
|
|
var _a;
|
|
if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent())
|
|
return;
|
|
suggestionVisible.value && close();
|
|
});
|
|
expose({
|
|
highlightedIndex,
|
|
activated,
|
|
loading,
|
|
inputRef,
|
|
popperRef,
|
|
suggestions,
|
|
handleSelect,
|
|
handleKeyEnter,
|
|
focus,
|
|
blur,
|
|
close,
|
|
highlight,
|
|
getData
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createBlock(unref(ElTooltip), {
|
|
ref_key: "popperRef",
|
|
ref: popperRef,
|
|
visible: unref(suggestionVisible),
|
|
placement: _ctx.placement,
|
|
"fallback-placements": ["bottom-start", "top-start"],
|
|
"popper-class": [unref(ns).e("popper"), _ctx.popperClass],
|
|
teleported: _ctx.teleported,
|
|
"gpu-acceleration": false,
|
|
pure: "",
|
|
"manual-mode": "",
|
|
effect: "light",
|
|
trigger: "click",
|
|
transition: `${unref(ns).namespace.value}-zoom-in-top`,
|
|
persistent: "",
|
|
role: "listbox",
|
|
onBeforeShow: onSuggestionShow,
|
|
onHide
|
|
}, {
|
|
content: withCtx(() => [
|
|
createElementVNode("div", {
|
|
ref_key: "regionRef",
|
|
ref: regionRef,
|
|
class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", unref(suggestionLoading))]),
|
|
style: normalizeStyle({
|
|
[_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
|
|
outline: "none"
|
|
}),
|
|
role: "region"
|
|
}, [
|
|
createVNode(unref(ElScrollbar), {
|
|
id: unref(listboxId),
|
|
tag: "ul",
|
|
"wrap-class": unref(ns).be("suggestion", "wrap"),
|
|
"view-class": unref(ns).be("suggestion", "list"),
|
|
role: "listbox"
|
|
}, {
|
|
default: withCtx(() => [
|
|
unref(suggestionLoading) ? (openBlock(), createElementBlock("li", { key: 0 }, [
|
|
renderSlot(_ctx.$slots, "loading", {}, () => [
|
|
createVNode(unref(ElIcon), {
|
|
class: normalizeClass(unref(ns).is("loading"))
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(loading_default))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])
|
|
])
|
|
])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index2) => {
|
|
return openBlock(), createElementBlock("li", {
|
|
id: `${unref(listboxId)}-item-${index2}`,
|
|
key: index2,
|
|
class: normalizeClass({ highlighted: highlightedIndex.value === index2 }),
|
|
role: "option",
|
|
"aria-selected": highlightedIndex.value === index2,
|
|
onClick: ($event) => handleSelect(item)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "default", { item }, () => [
|
|
createTextVNode(toDisplayString(item[_ctx.valueKey]), 1)
|
|
])
|
|
], 10, ["id", "aria-selected", "onClick"]);
|
|
}), 128))
|
|
]),
|
|
_: 3
|
|
}, 8, ["id", "wrap-class", "view-class"])
|
|
], 6)
|
|
]),
|
|
default: withCtx(() => [
|
|
createElementVNode("div", {
|
|
ref_key: "listboxRef",
|
|
ref: listboxRef,
|
|
class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
|
|
style: normalizeStyle(unref(styles)),
|
|
role: "combobox",
|
|
"aria-haspopup": "listbox",
|
|
"aria-expanded": unref(suggestionVisible),
|
|
"aria-owns": unref(listboxId)
|
|
}, [
|
|
createVNode(unref(ElInput), mergeProps({
|
|
ref_key: "inputRef",
|
|
ref: inputRef
|
|
}, unref(attrs), {
|
|
clearable: _ctx.clearable,
|
|
disabled: unref(disabled),
|
|
name: _ctx.name,
|
|
"model-value": _ctx.modelValue,
|
|
"aria-label": _ctx.ariaLabel,
|
|
onInput: handleInput,
|
|
onChange: handleChange,
|
|
onFocus: handleFocus,
|
|
onBlur: handleBlur,
|
|
onClear: handleClear,
|
|
onKeydown: [
|
|
withKeys(withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"]),
|
|
withKeys(withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"]),
|
|
withKeys(handleKeyEnter, ["enter"]),
|
|
withKeys(close, ["tab"]),
|
|
withKeys(handleKeyEscape, ["esc"])
|
|
],
|
|
onMousedown: handleMouseDown
|
|
}), createSlots({
|
|
_: 2
|
|
}, [
|
|
_ctx.$slots.prepend ? {
|
|
name: "prepend",
|
|
fn: withCtx(() => [
|
|
renderSlot(_ctx.$slots, "prepend")
|
|
])
|
|
} : void 0,
|
|
_ctx.$slots.append ? {
|
|
name: "append",
|
|
fn: withCtx(() => [
|
|
renderSlot(_ctx.$slots, "append")
|
|
])
|
|
} : void 0,
|
|
_ctx.$slots.prefix ? {
|
|
name: "prefix",
|
|
fn: withCtx(() => [
|
|
renderSlot(_ctx.$slots, "prefix")
|
|
])
|
|
} : void 0,
|
|
_ctx.$slots.suffix ? {
|
|
name: "suffix",
|
|
fn: withCtx(() => [
|
|
renderSlot(_ctx.$slots, "suffix")
|
|
])
|
|
} : void 0
|
|
]), 1040, ["clearable", "disabled", "name", "model-value", "aria-label", "onKeydown"])
|
|
], 14, ["aria-expanded", "aria-owns"])
|
|
]),
|
|
_: 3
|
|
}, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
|
|
};
|
|
}
|
|
});
|
|
var Autocomplete = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "autocomplete.vue"]]);
|
|
const ElAutocomplete = withInstall(Autocomplete);
|
|
const buildTimeList = (value, bound) => {
|
|
return [
|
|
value > 0 ? value - 1 : void 0,
|
|
value,
|
|
value < bound ? value + 1 : void 0
|
|
];
|
|
};
|
|
const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
|
|
const extractDateFormat = (format) => {
|
|
return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
|
|
};
|
|
const extractTimeFormat = (format) => {
|
|
return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
|
|
};
|
|
const dateEquals = function(a, b) {
|
|
const aIsDate = shared_cjs_prodExports.isDate(a);
|
|
const bIsDate = shared_cjs_prodExports.isDate(b);
|
|
if (aIsDate && bIsDate) {
|
|
return a.getTime() === b.getTime();
|
|
}
|
|
if (!aIsDate && !bIsDate) {
|
|
return a === b;
|
|
}
|
|
return false;
|
|
};
|
|
const valueEquals = function(a, b) {
|
|
const aIsArray = shared_cjs_prodExports.isArray(a);
|
|
const bIsArray = shared_cjs_prodExports.isArray(b);
|
|
if (aIsArray && bIsArray) {
|
|
if (a.length !== b.length) {
|
|
return false;
|
|
}
|
|
return a.every((item, index2) => dateEquals(item, b[index2]));
|
|
}
|
|
if (!aIsArray && !bIsArray) {
|
|
return dateEquals(a, b);
|
|
}
|
|
return false;
|
|
};
|
|
const parseDate = function(date, format, lang) {
|
|
const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
|
|
return day.isValid() ? day : void 0;
|
|
};
|
|
const formatter = function(date, format, lang) {
|
|
if (isEmpty(format))
|
|
return date;
|
|
if (format === "x")
|
|
return +date;
|
|
return dayjs(date).locale(lang).format(format);
|
|
};
|
|
const makeList = (total, method) => {
|
|
var _a;
|
|
const arr = [];
|
|
const disabledArr = method == null ? void 0 : method();
|
|
for (let i = 0; i < total; i++) {
|
|
arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
|
|
}
|
|
return arr;
|
|
};
|
|
const dayOrDaysToDate = (dayOrDays) => {
|
|
return shared_cjs_prodExports.isArray(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
|
|
};
|
|
const datePickTypes = [
|
|
"year",
|
|
"years",
|
|
"month",
|
|
"months",
|
|
"date",
|
|
"dates",
|
|
"week",
|
|
"datetime",
|
|
"datetimerange",
|
|
"daterange",
|
|
"monthrange",
|
|
"yearrange"
|
|
];
|
|
const castArray = (arr) => {
|
|
if (!arr && arr !== 0)
|
|
return [];
|
|
return shared_cjs_prodExports.isArray(arr) ? arr : [arr];
|
|
};
|
|
const nodeList = /* @__PURE__ */ new Map();
|
|
function createDocumentHandler(el, binding) {
|
|
let excludes = [];
|
|
if (shared_cjs_prodExports.isArray(binding.arg)) {
|
|
excludes = binding.arg;
|
|
} else if (isElement(binding.arg)) {
|
|
excludes.push(binding.arg);
|
|
}
|
|
return function(mouseup, mousedown) {
|
|
const popperRef = binding.instance.popperRef;
|
|
const mouseUpTarget = mouseup.target;
|
|
const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
|
|
const isBound = !binding || !binding.instance;
|
|
const isTargetExists = !mouseUpTarget || !mouseDownTarget;
|
|
const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
|
|
const isSelf = el === mouseUpTarget;
|
|
const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
|
|
const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
|
|
if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
|
|
return;
|
|
}
|
|
binding.value(mouseup, mousedown);
|
|
};
|
|
}
|
|
const ClickOutside = {
|
|
beforeMount(el, binding) {
|
|
if (!nodeList.has(el)) {
|
|
nodeList.set(el, []);
|
|
}
|
|
nodeList.get(el).push({
|
|
documentHandler: createDocumentHandler(el, binding),
|
|
bindingFn: binding.value
|
|
});
|
|
},
|
|
updated(el, binding) {
|
|
if (!nodeList.has(el)) {
|
|
nodeList.set(el, []);
|
|
}
|
|
const handlers = nodeList.get(el);
|
|
const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
|
|
const newHandler = {
|
|
documentHandler: createDocumentHandler(el, binding),
|
|
bindingFn: binding.value
|
|
};
|
|
if (oldHandlerIndex >= 0) {
|
|
handlers.splice(oldHandlerIndex, 1, newHandler);
|
|
} else {
|
|
handlers.push(newHandler);
|
|
}
|
|
},
|
|
unmounted(el) {
|
|
nodeList.delete(el);
|
|
}
|
|
};
|
|
const ElConfigProvider = withInstall(ConfigProvider);
|
|
const timeUnits = ["hours", "minutes", "seconds"];
|
|
const DEFAULT_FORMATS_TIME = "HH:mm:ss";
|
|
const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
|
|
const DEFAULT_FORMATS_DATEPICKER = {
|
|
date: DEFAULT_FORMATS_DATE,
|
|
dates: DEFAULT_FORMATS_DATE,
|
|
week: "gggg[w]ww",
|
|
year: "YYYY",
|
|
years: "YYYY",
|
|
month: "YYYY-MM",
|
|
months: "YYYY-MM",
|
|
datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
|
|
monthrange: "YYYY-MM",
|
|
yearrange: "YYYY",
|
|
daterange: DEFAULT_FORMATS_DATE,
|
|
datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
|
|
};
|
|
const disabledTimeListsProps = buildProps({
|
|
disabledHours: {
|
|
type: definePropType(Function)
|
|
},
|
|
disabledMinutes: {
|
|
type: definePropType(Function)
|
|
},
|
|
disabledSeconds: {
|
|
type: definePropType(Function)
|
|
}
|
|
});
|
|
const timePanelSharedProps = buildProps({
|
|
visible: Boolean,
|
|
actualVisible: {
|
|
type: Boolean,
|
|
default: void 0
|
|
},
|
|
format: {
|
|
type: String,
|
|
default: ""
|
|
}
|
|
});
|
|
const timePickerDefaultProps = buildProps({
|
|
id: {
|
|
type: definePropType([Array, String])
|
|
},
|
|
name: {
|
|
type: definePropType([Array, String])
|
|
},
|
|
popperClass: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
format: String,
|
|
valueFormat: String,
|
|
dateFormat: String,
|
|
timeFormat: String,
|
|
type: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
clearable: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
clearIcon: {
|
|
type: definePropType([String, Object]),
|
|
default: circle_close_default
|
|
},
|
|
editable: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
prefixIcon: {
|
|
type: definePropType([String, Object]),
|
|
default: ""
|
|
},
|
|
size: useSizeProp,
|
|
readonly: Boolean,
|
|
disabled: Boolean,
|
|
placeholder: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
popperOptions: {
|
|
type: definePropType(Object),
|
|
default: () => ({})
|
|
},
|
|
modelValue: {
|
|
type: definePropType([Date, Array, String, Number]),
|
|
default: ""
|
|
},
|
|
rangeSeparator: {
|
|
type: String,
|
|
default: "-"
|
|
},
|
|
startPlaceholder: String,
|
|
endPlaceholder: String,
|
|
defaultValue: {
|
|
type: definePropType([Date, Array])
|
|
},
|
|
defaultTime: {
|
|
type: definePropType([Date, Array])
|
|
},
|
|
isRange: Boolean,
|
|
...disabledTimeListsProps,
|
|
disabledDate: {
|
|
type: Function
|
|
},
|
|
cellClassName: {
|
|
type: Function
|
|
},
|
|
shortcuts: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
arrowControl: Boolean,
|
|
tabindex: {
|
|
type: definePropType([String, Number]),
|
|
default: 0
|
|
},
|
|
validateEvent: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
unlinkPanels: Boolean,
|
|
placement: {
|
|
type: definePropType(String),
|
|
values: placements,
|
|
default: "bottom"
|
|
},
|
|
fallbackPlacements: {
|
|
type: definePropType(Array),
|
|
default: ["bottom", "top", "right", "left"]
|
|
},
|
|
...useEmptyValuesProps,
|
|
...useAriaProps(["ariaLabel"]),
|
|
showNow: {
|
|
type: Boolean,
|
|
default: true
|
|
}
|
|
});
|
|
const timePickerRangeTriggerProps = buildProps({
|
|
id: {
|
|
type: definePropType(Array)
|
|
},
|
|
name: {
|
|
type: definePropType(Array)
|
|
},
|
|
modelValue: {
|
|
type: definePropType([Array, String])
|
|
},
|
|
startPlaceholder: String,
|
|
endPlaceholder: String
|
|
});
|
|
const __default__$3 = defineComponent({
|
|
name: "PickerRangeTrigger",
|
|
inheritAttrs: false
|
|
});
|
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
...__default__$3,
|
|
props: timePickerRangeTriggerProps,
|
|
emits: [
|
|
"mouseenter",
|
|
"mouseleave",
|
|
"click",
|
|
"touchstart",
|
|
"focus",
|
|
"blur",
|
|
"startInput",
|
|
"endInput",
|
|
"startChange",
|
|
"endChange"
|
|
],
|
|
setup(__props, { expose, emit }) {
|
|
const attrs = useAttrs$1();
|
|
const nsDate = useNamespace("date");
|
|
const nsRange = useNamespace("range");
|
|
const inputRef = ref();
|
|
const endInputRef = ref();
|
|
const { wrapperRef, isFocused } = useFocusController(inputRef);
|
|
const handleClick = (evt) => {
|
|
emit("click", evt);
|
|
};
|
|
const handleMouseEnter = (evt) => {
|
|
emit("mouseenter", evt);
|
|
};
|
|
const handleMouseLeave = (evt) => {
|
|
emit("mouseleave", evt);
|
|
};
|
|
const handleTouchStart = (evt) => {
|
|
emit("mouseenter", evt);
|
|
};
|
|
const handleStartInput = (evt) => {
|
|
emit("startInput", evt);
|
|
};
|
|
const handleEndInput = (evt) => {
|
|
emit("endInput", evt);
|
|
};
|
|
const handleStartChange = (evt) => {
|
|
emit("startChange", evt);
|
|
};
|
|
const handleEndChange = (evt) => {
|
|
emit("endChange", evt);
|
|
};
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const blur = () => {
|
|
var _a, _b;
|
|
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
(_b = endInputRef.value) == null ? void 0 : _b.blur();
|
|
};
|
|
expose({
|
|
focus,
|
|
blur
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
ref_key: "wrapperRef",
|
|
ref: wrapperRef,
|
|
class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
|
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
onClick: handleClick,
|
|
onMouseenter: handleMouseEnter,
|
|
onMouseleave: handleMouseLeave,
|
|
onTouchstartPassive: handleTouchStart
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prefix"),
|
|
createElementVNode("input", mergeProps(unref(attrs), {
|
|
id: _ctx.id && _ctx.id[0],
|
|
ref_key: "inputRef",
|
|
ref: inputRef,
|
|
name: _ctx.name && _ctx.name[0],
|
|
placeholder: _ctx.startPlaceholder,
|
|
value: _ctx.modelValue && _ctx.modelValue[0],
|
|
class: unref(nsRange).b("input"),
|
|
onInput: handleStartInput,
|
|
onChange: handleStartChange
|
|
}), null, 16, ["id", "name", "placeholder", "value"]),
|
|
renderSlot(_ctx.$slots, "range-separator"),
|
|
createElementVNode("input", mergeProps(unref(attrs), {
|
|
id: _ctx.id && _ctx.id[1],
|
|
ref_key: "endInputRef",
|
|
ref: endInputRef,
|
|
name: _ctx.name && _ctx.name[1],
|
|
placeholder: _ctx.endPlaceholder,
|
|
value: _ctx.modelValue && _ctx.modelValue[1],
|
|
class: unref(nsRange).b("input"),
|
|
onInput: handleEndInput,
|
|
onChange: handleEndChange
|
|
}), null, 16, ["id", "name", "placeholder", "value"]),
|
|
renderSlot(_ctx.$slots, "suffix")
|
|
], 38);
|
|
};
|
|
}
|
|
});
|
|
var PickerRangeTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "picker-range-trigger.vue"]]);
|
|
const __default__$2 = defineComponent({
|
|
name: "Picker"
|
|
});
|
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
...__default__$2,
|
|
props: timePickerDefaultProps,
|
|
emits: [
|
|
"update:modelValue",
|
|
"change",
|
|
"focus",
|
|
"blur",
|
|
"clear",
|
|
"calendar-change",
|
|
"panel-change",
|
|
"visible-change",
|
|
"keydown"
|
|
],
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const attrs = useAttrs();
|
|
const { lang } = useLocale();
|
|
const nsDate = useNamespace("date");
|
|
const nsInput = useNamespace("input");
|
|
const nsRange = useNamespace("range");
|
|
const { form, formItem } = useFormItem();
|
|
const elPopperOptions = inject("ElPopperOptions", {});
|
|
const { valueOnClear } = useEmptyValues(props, null);
|
|
const refPopper = ref();
|
|
const inputRef = ref();
|
|
const pickerVisible = ref(false);
|
|
const pickerActualVisible = ref(false);
|
|
const valueOnOpen = ref(null);
|
|
let hasJustTabExitedInput = false;
|
|
const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
|
|
beforeFocus() {
|
|
return props.readonly || pickerDisabled.value;
|
|
},
|
|
afterFocus() {
|
|
pickerVisible.value = true;
|
|
},
|
|
beforeBlur(event) {
|
|
var _a;
|
|
return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
|
|
},
|
|
afterBlur() {
|
|
handleChange();
|
|
pickerVisible.value = false;
|
|
hasJustTabExitedInput = false;
|
|
props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
|
|
}
|
|
});
|
|
const rangeInputKls = computed(() => [
|
|
nsDate.b("editor"),
|
|
nsDate.bm("editor", props.type),
|
|
nsInput.e("wrapper"),
|
|
nsDate.is("disabled", pickerDisabled.value),
|
|
nsDate.is("active", pickerVisible.value),
|
|
nsRange.b("editor"),
|
|
pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
|
|
attrs.class
|
|
]);
|
|
const clearIconKls = computed(() => [
|
|
nsInput.e("icon"),
|
|
nsRange.e("close-icon"),
|
|
!showClose.value ? nsRange.e("close-icon--hidden") : ""
|
|
]);
|
|
watch(pickerVisible, (val) => {
|
|
if (!val) {
|
|
userInput.value = null;
|
|
nextTick(() => {
|
|
emitChange(props.modelValue);
|
|
});
|
|
} else {
|
|
nextTick(() => {
|
|
if (val) {
|
|
valueOnOpen.value = props.modelValue;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
const emitChange = (val, isClear) => {
|
|
if (isClear || !valueEquals(val, valueOnOpen.value)) {
|
|
emit("change", val);
|
|
props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
|
|
}
|
|
};
|
|
const emitInput = (input) => {
|
|
if (!valueEquals(props.modelValue, input)) {
|
|
let formatted;
|
|
if (shared_cjs_prodExports.isArray(input)) {
|
|
formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
|
|
} else if (input) {
|
|
formatted = formatter(input, props.valueFormat, lang.value);
|
|
}
|
|
emit("update:modelValue", input ? formatted : input, lang.value);
|
|
}
|
|
};
|
|
const emitKeydown = (e) => {
|
|
emit("keydown", e);
|
|
};
|
|
const refInput = computed(() => {
|
|
if (inputRef.value) {
|
|
return Array.from(inputRef.value.$el.querySelectorAll("input"));
|
|
}
|
|
return [];
|
|
});
|
|
const setSelectionRange = (start, end, pos) => {
|
|
const _inputs = refInput.value;
|
|
if (!_inputs.length)
|
|
return;
|
|
if (!pos || pos === "min") {
|
|
_inputs[0].setSelectionRange(start, end);
|
|
_inputs[0].focus();
|
|
} else if (pos === "max") {
|
|
_inputs[1].setSelectionRange(start, end);
|
|
_inputs[1].focus();
|
|
}
|
|
};
|
|
const onPick = (date = "", visible = false) => {
|
|
pickerVisible.value = visible;
|
|
let result;
|
|
if (shared_cjs_prodExports.isArray(date)) {
|
|
result = date.map((_) => _.toDate());
|
|
} else {
|
|
result = date ? date.toDate() : date;
|
|
}
|
|
userInput.value = null;
|
|
emitInput(result);
|
|
};
|
|
const onBeforeShow = () => {
|
|
pickerActualVisible.value = true;
|
|
};
|
|
const onShow = () => {
|
|
emit("visible-change", true);
|
|
};
|
|
const onHide = () => {
|
|
pickerActualVisible.value = false;
|
|
pickerVisible.value = false;
|
|
emit("visible-change", false);
|
|
};
|
|
const handleOpen = () => {
|
|
pickerVisible.value = true;
|
|
};
|
|
const handleClose = () => {
|
|
pickerVisible.value = false;
|
|
};
|
|
const pickerDisabled = computed(() => {
|
|
return props.disabled || (form == null ? void 0 : form.disabled);
|
|
});
|
|
const parsedValue = computed(() => {
|
|
let dayOrDays;
|
|
if (valueIsEmpty.value) {
|
|
if (pickerOptions.value.getDefaultValue) {
|
|
dayOrDays = pickerOptions.value.getDefaultValue();
|
|
}
|
|
} else {
|
|
if (shared_cjs_prodExports.isArray(props.modelValue)) {
|
|
dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
|
|
} else {
|
|
dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
|
|
}
|
|
}
|
|
if (pickerOptions.value.getRangeAvailableTime) {
|
|
const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
|
|
if (!isEqual(availableResult, dayOrDays)) {
|
|
dayOrDays = availableResult;
|
|
if (!valueIsEmpty.value) {
|
|
emitInput(dayOrDaysToDate(dayOrDays));
|
|
}
|
|
}
|
|
}
|
|
if (shared_cjs_prodExports.isArray(dayOrDays) && dayOrDays.some((day) => !day)) {
|
|
dayOrDays = [];
|
|
}
|
|
return dayOrDays;
|
|
});
|
|
const displayValue = computed(() => {
|
|
if (!pickerOptions.value.panelReady)
|
|
return "";
|
|
const formattedValue = formatDayjsToString(parsedValue.value);
|
|
if (shared_cjs_prodExports.isArray(userInput.value)) {
|
|
return [
|
|
userInput.value[0] || formattedValue && formattedValue[0] || "",
|
|
userInput.value[1] || formattedValue && formattedValue[1] || ""
|
|
];
|
|
} else if (userInput.value !== null) {
|
|
return userInput.value;
|
|
}
|
|
if (!isTimePicker.value && valueIsEmpty.value)
|
|
return "";
|
|
if (!pickerVisible.value && valueIsEmpty.value)
|
|
return "";
|
|
if (formattedValue) {
|
|
return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
|
|
}
|
|
return "";
|
|
});
|
|
const isTimeLikePicker = computed(() => props.type.includes("time"));
|
|
const isTimePicker = computed(() => props.type.startsWith("time"));
|
|
const isDatesPicker = computed(() => props.type === "dates");
|
|
const isMonthsPicker = computed(() => props.type === "months");
|
|
const isYearsPicker = computed(() => props.type === "years");
|
|
const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
|
|
const showClose = ref(false);
|
|
const onClearIconClick = (event) => {
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (showClose.value) {
|
|
event.stopPropagation();
|
|
if (pickerOptions.value.handleClear) {
|
|
pickerOptions.value.handleClear();
|
|
} else {
|
|
emitInput(valueOnClear.value);
|
|
}
|
|
emitChange(valueOnClear.value, true);
|
|
showClose.value = false;
|
|
onHide();
|
|
}
|
|
emit("clear");
|
|
};
|
|
const valueIsEmpty = computed(() => {
|
|
const { modelValue } = props;
|
|
return !modelValue || shared_cjs_prodExports.isArray(modelValue) && !modelValue.filter(Boolean).length;
|
|
});
|
|
const onMouseDownInput = async (event) => {
|
|
var _a;
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
|
|
pickerVisible.value = true;
|
|
}
|
|
};
|
|
const onMouseEnter = () => {
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (!valueIsEmpty.value && props.clearable) {
|
|
showClose.value = true;
|
|
}
|
|
};
|
|
const onMouseLeave = () => {
|
|
showClose.value = false;
|
|
};
|
|
const onTouchStartInput = (event) => {
|
|
var _a;
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
|
|
pickerVisible.value = true;
|
|
}
|
|
};
|
|
const isRangeInput = computed(() => {
|
|
return props.type.includes("range");
|
|
});
|
|
const pickerSize = useFormSize();
|
|
const popperEl = computed(() => {
|
|
var _a, _b;
|
|
return (_b = (_a = unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
|
|
});
|
|
onClickOutside(inputRef, (e) => {
|
|
const unrefedPopperEl = unref(popperEl);
|
|
const inputEl = unrefElement(inputRef);
|
|
if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
|
|
return;
|
|
pickerVisible.value = false;
|
|
});
|
|
const userInput = ref(null);
|
|
const handleChange = () => {
|
|
if (userInput.value) {
|
|
const value = parseUserInputToDayjs(displayValue.value);
|
|
if (value) {
|
|
if (isValidValue(value)) {
|
|
emitInput(dayOrDaysToDate(value));
|
|
userInput.value = null;
|
|
}
|
|
}
|
|
}
|
|
if (userInput.value === "") {
|
|
emitInput(valueOnClear.value);
|
|
emitChange(valueOnClear.value);
|
|
userInput.value = null;
|
|
}
|
|
};
|
|
const parseUserInputToDayjs = (value) => {
|
|
if (!value)
|
|
return null;
|
|
return pickerOptions.value.parseUserInput(value);
|
|
};
|
|
const formatDayjsToString = (value) => {
|
|
if (!value)
|
|
return null;
|
|
return pickerOptions.value.formatToString(value);
|
|
};
|
|
const isValidValue = (value) => {
|
|
return pickerOptions.value.isValidValue(value);
|
|
};
|
|
const handleKeydownInput = async (event) => {
|
|
if (props.readonly || pickerDisabled.value)
|
|
return;
|
|
const { code } = event;
|
|
emitKeydown(event);
|
|
if (code === EVENT_CODE.esc) {
|
|
if (pickerVisible.value === true) {
|
|
pickerVisible.value = false;
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
return;
|
|
}
|
|
if (code === EVENT_CODE.down) {
|
|
if (pickerOptions.value.handleFocusPicker) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
if (pickerVisible.value === false) {
|
|
pickerVisible.value = true;
|
|
await nextTick();
|
|
}
|
|
if (pickerOptions.value.handleFocusPicker) {
|
|
pickerOptions.value.handleFocusPicker();
|
|
return;
|
|
}
|
|
}
|
|
if (code === EVENT_CODE.tab) {
|
|
hasJustTabExitedInput = true;
|
|
return;
|
|
}
|
|
if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
|
|
if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
|
|
handleChange();
|
|
pickerVisible.value = false;
|
|
}
|
|
event.stopPropagation();
|
|
return;
|
|
}
|
|
if (userInput.value) {
|
|
event.stopPropagation();
|
|
return;
|
|
}
|
|
if (pickerOptions.value.handleKeydownInput) {
|
|
pickerOptions.value.handleKeydownInput(event);
|
|
}
|
|
};
|
|
const onUserInput = (e) => {
|
|
userInput.value = e;
|
|
if (!pickerVisible.value) {
|
|
pickerVisible.value = true;
|
|
}
|
|
};
|
|
const handleStartInput = (event) => {
|
|
const target = event.target;
|
|
if (userInput.value) {
|
|
userInput.value = [target.value, userInput.value[1]];
|
|
} else {
|
|
userInput.value = [target.value, null];
|
|
}
|
|
};
|
|
const handleEndInput = (event) => {
|
|
const target = event.target;
|
|
if (userInput.value) {
|
|
userInput.value = [userInput.value[0], target.value];
|
|
} else {
|
|
userInput.value = [null, target.value];
|
|
}
|
|
};
|
|
const handleStartChange = () => {
|
|
var _a;
|
|
const values = userInput.value;
|
|
const value = parseUserInputToDayjs(values && values[0]);
|
|
const parsedVal = unref(parsedValue);
|
|
if (value && value.isValid()) {
|
|
userInput.value = [
|
|
formatDayjsToString(value),
|
|
((_a = displayValue.value) == null ? void 0 : _a[1]) || null
|
|
];
|
|
const newValue = [value, parsedVal && (parsedVal[1] || null)];
|
|
if (isValidValue(newValue)) {
|
|
emitInput(dayOrDaysToDate(newValue));
|
|
userInput.value = null;
|
|
}
|
|
}
|
|
};
|
|
const handleEndChange = () => {
|
|
var _a;
|
|
const values = unref(userInput);
|
|
const value = parseUserInputToDayjs(values && values[1]);
|
|
const parsedVal = unref(parsedValue);
|
|
if (value && value.isValid()) {
|
|
userInput.value = [
|
|
((_a = unref(displayValue)) == null ? void 0 : _a[0]) || null,
|
|
formatDayjsToString(value)
|
|
];
|
|
const newValue = [parsedVal && parsedVal[0], value];
|
|
if (isValidValue(newValue)) {
|
|
emitInput(dayOrDaysToDate(newValue));
|
|
userInput.value = null;
|
|
}
|
|
}
|
|
};
|
|
const pickerOptions = ref({});
|
|
const onSetPickerOption = (e) => {
|
|
pickerOptions.value[e[0]] = e[1];
|
|
pickerOptions.value.panelReady = true;
|
|
};
|
|
const onCalendarChange = (e) => {
|
|
emit("calendar-change", e);
|
|
};
|
|
const onPanelChange = (value, mode, view) => {
|
|
emit("panel-change", value, mode, view);
|
|
};
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const blur = () => {
|
|
var _a;
|
|
(_a = inputRef.value) == null ? void 0 : _a.blur();
|
|
};
|
|
provide("EP_PICKER_BASE", {
|
|
props
|
|
});
|
|
expose({
|
|
focus,
|
|
blur,
|
|
handleOpen,
|
|
handleClose,
|
|
onPick
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createBlock(unref(ElTooltip), mergeProps({
|
|
ref_key: "refPopper",
|
|
ref: refPopper,
|
|
visible: pickerVisible.value,
|
|
effect: "light",
|
|
pure: "",
|
|
trigger: "click"
|
|
}, _ctx.$attrs, {
|
|
role: "dialog",
|
|
teleported: "",
|
|
transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
|
|
"popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
|
|
"popper-options": unref(elPopperOptions),
|
|
"fallback-placements": _ctx.fallbackPlacements,
|
|
"gpu-acceleration": false,
|
|
placement: _ctx.placement,
|
|
"stop-popper-mouse-event": false,
|
|
"hide-after": 0,
|
|
persistent: "",
|
|
onBeforeShow,
|
|
onShow,
|
|
onHide
|
|
}), {
|
|
default: withCtx(() => [
|
|
!unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
|
|
key: 0,
|
|
id: _ctx.id,
|
|
ref_key: "inputRef",
|
|
ref: inputRef,
|
|
"container-role": "combobox",
|
|
"model-value": unref(displayValue),
|
|
name: _ctx.name,
|
|
size: unref(pickerSize),
|
|
disabled: unref(pickerDisabled),
|
|
placeholder: _ctx.placeholder,
|
|
class: normalizeClass([unref(nsDate).b("editor"), unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
|
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || unref(isMonthsPicker) || unref(isYearsPicker) || _ctx.type === "week",
|
|
"aria-label": _ctx.ariaLabel,
|
|
tabindex: _ctx.tabindex,
|
|
"validate-event": false,
|
|
onInput: onUserInput,
|
|
onFocus: unref(handleFocus),
|
|
onBlur: unref(handleBlur),
|
|
onKeydown: handleKeydownInput,
|
|
onChange: handleChange,
|
|
onMousedown: onMouseDownInput,
|
|
onMouseenter: onMouseEnter,
|
|
onMouseleave: onMouseLeave,
|
|
onTouchstartPassive: onTouchStartInput,
|
|
onClick: withModifiers(() => {
|
|
}, ["stop"])
|
|
}, {
|
|
prefix: withCtx(() => [
|
|
unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass(unref(nsInput).e("icon")),
|
|
onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
|
|
onTouchstartPassive: onTouchStartInput
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
suffix: withCtx(() => [
|
|
showClose.value && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
|
|
onMousedown: withModifiers(unref(shared_cjs_prodExports.NOOP), ["prevent"]),
|
|
onClick: onClearIconClick
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
_: 1
|
|
}, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (openBlock(), createBlock(PickerRangeTrigger, {
|
|
key: 1,
|
|
id: _ctx.id,
|
|
ref_key: "inputRef",
|
|
ref: inputRef,
|
|
"model-value": unref(displayValue),
|
|
name: _ctx.name,
|
|
disabled: unref(pickerDisabled),
|
|
readonly: !_ctx.editable || _ctx.readonly,
|
|
"start-placeholder": _ctx.startPlaceholder,
|
|
"end-placeholder": _ctx.endPlaceholder,
|
|
class: normalizeClass(unref(rangeInputKls)),
|
|
style: normalizeStyle(_ctx.$attrs.style),
|
|
"aria-label": _ctx.ariaLabel,
|
|
tabindex: _ctx.tabindex,
|
|
autocomplete: "off",
|
|
role: "combobox",
|
|
onClick: onMouseDownInput,
|
|
onFocus: unref(handleFocus),
|
|
onBlur: unref(handleBlur),
|
|
onStartInput: handleStartInput,
|
|
onStartChange: handleStartChange,
|
|
onEndInput: handleEndInput,
|
|
onEndChange: handleEndChange,
|
|
onMousedown: onMouseDownInput,
|
|
onMouseenter: onMouseEnter,
|
|
onMouseleave: onMouseLeave,
|
|
onTouchstartPassive: onTouchStartInput,
|
|
onKeydown: handleKeydownInput
|
|
}, {
|
|
prefix: withCtx(() => [
|
|
unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
"range-separator": withCtx(() => [
|
|
renderSlot(_ctx.$slots, "range-separator", {}, () => [
|
|
createElementVNode("span", {
|
|
class: normalizeClass(unref(nsRange).b("separator"))
|
|
}, toDisplayString(_ctx.rangeSeparator), 3)
|
|
])
|
|
]),
|
|
suffix: withCtx(() => [
|
|
_ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
key: 0,
|
|
class: normalizeClass(unref(clearIconKls)),
|
|
onMousedown: withModifiers(unref(shared_cjs_prodExports.NOOP), ["prevent"]),
|
|
onClick: onClearIconClick
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
|
|
]),
|
|
_: 3
|
|
}, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
|
|
]),
|
|
content: withCtx(() => [
|
|
renderSlot(_ctx.$slots, "default", {
|
|
visible: pickerVisible.value,
|
|
actualVisible: pickerActualVisible.value,
|
|
parsedValue: unref(parsedValue),
|
|
format: _ctx.format,
|
|
dateFormat: _ctx.dateFormat,
|
|
timeFormat: _ctx.timeFormat,
|
|
unlinkPanels: _ctx.unlinkPanels,
|
|
type: _ctx.type,
|
|
defaultValue: _ctx.defaultValue,
|
|
showNow: _ctx.showNow,
|
|
onPick,
|
|
onSelectRange: setSelectionRange,
|
|
onSetPickerOption,
|
|
onCalendarChange,
|
|
onPanelChange,
|
|
onMousedown: withModifiers(() => {
|
|
}, ["stop"])
|
|
})
|
|
]),
|
|
_: 3
|
|
}, 16, ["visible", "transition", "popper-class", "popper-options", "fallback-placements", "placement"]);
|
|
};
|
|
}
|
|
});
|
|
var CommonPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "picker.vue"]]);
|
|
const panelTimePickerProps = buildProps({
|
|
...timePanelSharedProps,
|
|
datetimeRole: String,
|
|
parsedValue: {
|
|
type: definePropType(Object)
|
|
}
|
|
});
|
|
const useTimePanel = ({
|
|
getAvailableHours,
|
|
getAvailableMinutes,
|
|
getAvailableSeconds
|
|
}) => {
|
|
const getAvailableTime = (date, role, first, compareDate) => {
|
|
const availableTimeGetters = {
|
|
hour: getAvailableHours,
|
|
minute: getAvailableMinutes,
|
|
second: getAvailableSeconds
|
|
};
|
|
let result = date;
|
|
["hour", "minute", "second"].forEach((type) => {
|
|
if (availableTimeGetters[type]) {
|
|
let availableTimeSlots;
|
|
const method = availableTimeGetters[type];
|
|
switch (type) {
|
|
case "minute": {
|
|
availableTimeSlots = method(result.hour(), role, compareDate);
|
|
break;
|
|
}
|
|
case "second": {
|
|
availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
|
|
break;
|
|
}
|
|
default: {
|
|
availableTimeSlots = method(role, compareDate);
|
|
break;
|
|
}
|
|
}
|
|
if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
|
|
const pos = first ? 0 : availableTimeSlots.length - 1;
|
|
result = result[type](availableTimeSlots[pos]);
|
|
}
|
|
}
|
|
});
|
|
return result;
|
|
};
|
|
const timePickerOptions = {};
|
|
const onSetOption = ([key, val]) => {
|
|
timePickerOptions[key] = val;
|
|
};
|
|
return {
|
|
timePickerOptions,
|
|
getAvailableTime,
|
|
onSetOption
|
|
};
|
|
};
|
|
const makeAvailableArr = (disabledList) => {
|
|
const trueOrNumber = (isDisabled, index2) => isDisabled || index2;
|
|
const getNumber = (predicate) => predicate !== true;
|
|
return disabledList.map(trueOrNumber).filter(getNumber);
|
|
};
|
|
const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
|
|
const getHoursList = (role, compare) => {
|
|
return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
|
|
};
|
|
const getMinutesList = (hour, role, compare) => {
|
|
return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
|
|
};
|
|
const getSecondsList = (hour, minute, role, compare) => {
|
|
return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
|
|
};
|
|
return {
|
|
getHoursList,
|
|
getMinutesList,
|
|
getSecondsList
|
|
};
|
|
};
|
|
const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
|
|
const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
|
|
const getAvailableHours = (role, compare) => {
|
|
return makeAvailableArr(getHoursList(role, compare));
|
|
};
|
|
const getAvailableMinutes = (hour, role, compare) => {
|
|
return makeAvailableArr(getMinutesList(hour, role, compare));
|
|
};
|
|
const getAvailableSeconds = (hour, minute, role, compare) => {
|
|
return makeAvailableArr(getSecondsList(hour, minute, role, compare));
|
|
};
|
|
return {
|
|
getAvailableHours,
|
|
getAvailableMinutes,
|
|
getAvailableSeconds
|
|
};
|
|
};
|
|
const useOldValue = (props) => {
|
|
const oldValue = ref(props.parsedValue);
|
|
watch(() => props.visible, (val) => {
|
|
if (!val) {
|
|
oldValue.value = props.parsedValue;
|
|
}
|
|
});
|
|
return oldValue;
|
|
};
|
|
const basicTimeSpinnerProps = buildProps({
|
|
role: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
spinnerDate: {
|
|
type: definePropType(Object),
|
|
required: true
|
|
},
|
|
showSeconds: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
arrowControl: Boolean,
|
|
amPmMode: {
|
|
type: definePropType(String),
|
|
default: ""
|
|
},
|
|
...disabledTimeListsProps
|
|
});
|
|
const REPEAT_INTERVAL = 100;
|
|
const REPEAT_DELAY = 600;
|
|
const vRepeatClick = {
|
|
beforeMount(el, binding) {
|
|
const value = binding.value;
|
|
const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = shared_cjs_prodExports.isFunction(value) ? {} : value;
|
|
let intervalId;
|
|
let delayId;
|
|
const handler = () => shared_cjs_prodExports.isFunction(value) ? value() : value.handler();
|
|
const clear = () => {
|
|
if (delayId) {
|
|
clearTimeout(delayId);
|
|
delayId = void 0;
|
|
}
|
|
if (intervalId) {
|
|
clearInterval(intervalId);
|
|
intervalId = void 0;
|
|
}
|
|
};
|
|
el.addEventListener("mousedown", (evt) => {
|
|
if (evt.button !== 0)
|
|
return;
|
|
clear();
|
|
handler();
|
|
(void 0).addEventListener("mouseup", () => clear(), {
|
|
once: true
|
|
});
|
|
delayId = setTimeout(() => {
|
|
intervalId = setInterval(() => {
|
|
handler();
|
|
}, interval);
|
|
}, delay);
|
|
});
|
|
}
|
|
};
|
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
__name: "basic-time-spinner",
|
|
props: basicTimeSpinnerProps,
|
|
emits: ["change", "select-range", "set-option"],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const pickerBase = inject("EP_PICKER_BASE");
|
|
const { isRange } = pickerBase.props;
|
|
const ns = useNamespace("time");
|
|
const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
|
|
let isScrolling = false;
|
|
const currentScrollbar = ref();
|
|
const listHoursRef = ref();
|
|
const listMinutesRef = ref();
|
|
const listSecondsRef = ref();
|
|
const listRefsMap = {
|
|
hours: listHoursRef,
|
|
minutes: listMinutesRef,
|
|
seconds: listSecondsRef
|
|
};
|
|
const spinnerItems = computed(() => {
|
|
return props.showSeconds ? timeUnits : timeUnits.slice(0, 2);
|
|
});
|
|
const timePartials = computed(() => {
|
|
const { spinnerDate } = props;
|
|
const hours = spinnerDate.hour();
|
|
const minutes = spinnerDate.minute();
|
|
const seconds = spinnerDate.second();
|
|
return { hours, minutes, seconds };
|
|
});
|
|
const timeList = computed(() => {
|
|
const { hours, minutes } = unref(timePartials);
|
|
const { role, spinnerDate } = props;
|
|
const compare = !isRange ? spinnerDate : void 0;
|
|
return {
|
|
hours: getHoursList(role, compare),
|
|
minutes: getMinutesList(hours, role, compare),
|
|
seconds: getSecondsList(hours, minutes, role, compare)
|
|
};
|
|
});
|
|
const arrowControlTimeList = computed(() => {
|
|
const { hours, minutes, seconds } = unref(timePartials);
|
|
return {
|
|
hours: buildTimeList(hours, 23),
|
|
minutes: buildTimeList(minutes, 59),
|
|
seconds: buildTimeList(seconds, 59)
|
|
};
|
|
});
|
|
debounce((type) => {
|
|
isScrolling = false;
|
|
adjustCurrentSpinner(type);
|
|
}, 200);
|
|
const getAmPmFlag = (hour) => {
|
|
const shouldShowAmPm = !!props.amPmMode;
|
|
if (!shouldShowAmPm)
|
|
return "";
|
|
const isCapital = props.amPmMode === "A";
|
|
let content = hour < 12 ? " am" : " pm";
|
|
if (isCapital)
|
|
content = content.toUpperCase();
|
|
return content;
|
|
};
|
|
const emitSelectRange = (type) => {
|
|
let range;
|
|
switch (type) {
|
|
case "hours":
|
|
range = [0, 2];
|
|
break;
|
|
case "minutes":
|
|
range = [3, 5];
|
|
break;
|
|
case "seconds":
|
|
range = [6, 8];
|
|
break;
|
|
}
|
|
const [left, right] = range;
|
|
emit("select-range", left, right);
|
|
currentScrollbar.value = type;
|
|
};
|
|
const adjustCurrentSpinner = (type) => {
|
|
adjustSpinner(type, unref(timePartials)[type]);
|
|
};
|
|
const adjustSpinners = () => {
|
|
adjustCurrentSpinner("hours");
|
|
adjustCurrentSpinner("minutes");
|
|
adjustCurrentSpinner("seconds");
|
|
};
|
|
const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
|
|
const adjustSpinner = (type, value) => {
|
|
if (props.arrowControl)
|
|
return;
|
|
const scrollbar = unref(listRefsMap[type]);
|
|
if (scrollbar && scrollbar.$el) {
|
|
getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
|
|
}
|
|
};
|
|
const typeItemHeight = (type) => {
|
|
const scrollbar = unref(listRefsMap[type]);
|
|
const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
|
|
if (listItem) {
|
|
return Number.parseFloat(getStyle()) || 0;
|
|
}
|
|
return 0;
|
|
};
|
|
const onIncrement = () => {
|
|
scrollDown(1);
|
|
};
|
|
const onDecrement = () => {
|
|
scrollDown(-1);
|
|
};
|
|
const scrollDown = (step) => {
|
|
if (!currentScrollbar.value) {
|
|
emitSelectRange("hours");
|
|
}
|
|
const label = currentScrollbar.value;
|
|
const now2 = unref(timePartials)[label];
|
|
const total = currentScrollbar.value === "hours" ? 24 : 60;
|
|
const next = findNextUnDisabled(label, now2, step, total);
|
|
modifyDateField(label, next);
|
|
adjustSpinner(label, next);
|
|
nextTick(() => emitSelectRange(label));
|
|
};
|
|
const findNextUnDisabled = (type, now2, step, total) => {
|
|
let next = (now2 + step + total) % total;
|
|
const list = unref(timeList)[type];
|
|
while (list[next] && next !== now2) {
|
|
next = (next + step + total) % total;
|
|
}
|
|
return next;
|
|
};
|
|
const modifyDateField = (type, value) => {
|
|
const list = unref(timeList)[type];
|
|
const isDisabled = list[value];
|
|
if (isDisabled)
|
|
return;
|
|
const { hours, minutes, seconds } = unref(timePartials);
|
|
let changeTo;
|
|
switch (type) {
|
|
case "hours":
|
|
changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
|
|
break;
|
|
case "minutes":
|
|
changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
|
|
break;
|
|
case "seconds":
|
|
changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
|
|
break;
|
|
}
|
|
emit("change", changeTo);
|
|
};
|
|
const handleClick = (type, { value, disabled }) => {
|
|
if (!disabled) {
|
|
modifyDateField(type, value);
|
|
emitSelectRange(type);
|
|
adjustSpinner(type, value);
|
|
}
|
|
};
|
|
const setRef = (scrollbar, type) => {
|
|
listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
|
|
};
|
|
emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
|
|
emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
|
|
watch(() => props.spinnerDate, () => {
|
|
if (isScrolling)
|
|
return;
|
|
adjustSpinners();
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
|
|
}, [
|
|
!_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(spinnerItems), (item) => {
|
|
return openBlock(), createBlock(unref(ElScrollbar), {
|
|
key: item,
|
|
ref_for: true,
|
|
ref: (scrollbar) => setRef(scrollbar, item),
|
|
class: normalizeClass(unref(ns).be("spinner", "wrapper")),
|
|
"wrap-style": "max-height: inherit;",
|
|
"view-class": unref(ns).be("spinner", "list"),
|
|
noresize: "",
|
|
tag: "ul",
|
|
onMouseenter: ($event) => emitSelectRange(item),
|
|
onMousemove: ($event) => adjustCurrentSpinner(item)
|
|
}, {
|
|
default: withCtx(() => [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeList)[item], (disabled, key) => {
|
|
return openBlock(), createElementBlock("li", {
|
|
key,
|
|
class: normalizeClass([
|
|
unref(ns).be("spinner", "item"),
|
|
unref(ns).is("active", key === unref(timePartials)[item]),
|
|
unref(ns).is("disabled", disabled)
|
|
]),
|
|
onClick: ($event) => handleClick(item, { value: key, disabled })
|
|
}, [
|
|
item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)
|
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
|
|
], 64))
|
|
], 10, ["onClick"]);
|
|
}), 128))
|
|
]),
|
|
_: 2
|
|
}, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
|
|
}), 128)) : createCommentVNode("v-if", true),
|
|
_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(spinnerItems), (item) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
key: item,
|
|
class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
|
|
onMouseenter: ($event) => emitSelectRange(item)
|
|
}, [
|
|
withDirectives((openBlock(), createBlock(unref(ElIcon), {
|
|
class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")])
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_up_default))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])), [
|
|
[unref(vRepeatClick), onDecrement]
|
|
]),
|
|
withDirectives((openBlock(), createBlock(unref(ElIcon), {
|
|
class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")])
|
|
}, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_down_default))
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])), [
|
|
[unref(vRepeatClick), onIncrement]
|
|
]),
|
|
createElementVNode("ul", {
|
|
class: normalizeClass(unref(ns).be("spinner", "list"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(arrowControlTimeList)[item], (time, key) => {
|
|
return openBlock(), createElementBlock("li", {
|
|
key,
|
|
class: normalizeClass([
|
|
unref(ns).be("spinner", "item"),
|
|
unref(ns).is("active", time === unref(timePartials)[item]),
|
|
unref(ns).is("disabled", unref(timeList)[item][time])
|
|
])
|
|
}, [
|
|
unref(isNumber)(time) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)
|
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
|
|
], 64))
|
|
], 64)) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
}), 128))
|
|
], 2)
|
|
], 42, ["onMouseenter"]);
|
|
}), 128)) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var TimeSpinner = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "basic-time-spinner.vue"]]);
|
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
__name: "panel-time-pick",
|
|
props: panelTimePickerProps,
|
|
emits: ["pick", "select-range", "set-picker-option"],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const pickerBase = inject("EP_PICKER_BASE");
|
|
const {
|
|
arrowControl,
|
|
disabledHours,
|
|
disabledMinutes,
|
|
disabledSeconds,
|
|
defaultValue
|
|
} = pickerBase.props;
|
|
const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
|
|
const ns = useNamespace("time");
|
|
const { t, lang } = useLocale();
|
|
const selectionRange = ref([0, 2]);
|
|
const oldValue = useOldValue(props);
|
|
const transitionName = computed(() => {
|
|
return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
|
|
});
|
|
const showSeconds = computed(() => {
|
|
return props.format.includes("ss");
|
|
});
|
|
const amPmMode = computed(() => {
|
|
if (props.format.includes("A"))
|
|
return "A";
|
|
if (props.format.includes("a"))
|
|
return "a";
|
|
return "";
|
|
});
|
|
const isValidValue = (_date) => {
|
|
const parsedDate = dayjs(_date).locale(lang.value);
|
|
const result = getRangeAvailableTime(parsedDate);
|
|
return parsedDate.isSame(result);
|
|
};
|
|
const handleCancel = () => {
|
|
emit("pick", oldValue.value, false);
|
|
};
|
|
const handleConfirm = (visible = false, first = false) => {
|
|
if (first)
|
|
return;
|
|
emit("pick", props.parsedValue, visible);
|
|
};
|
|
const handleChange = (_date) => {
|
|
if (!props.visible) {
|
|
return;
|
|
}
|
|
const result = getRangeAvailableTime(_date).millisecond(0);
|
|
emit("pick", result, true);
|
|
};
|
|
const setSelectionRange = (start, end) => {
|
|
emit("select-range", start, end);
|
|
selectionRange.value = [start, end];
|
|
};
|
|
const changeSelectionRange = (step) => {
|
|
const list = [0, 3].concat(showSeconds.value ? [6] : []);
|
|
const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
|
|
const index2 = list.indexOf(selectionRange.value[0]);
|
|
const next = (index2 + step + list.length) % list.length;
|
|
timePickerOptions["start_emitSelectRange"](mapping[next]);
|
|
};
|
|
const handleKeydown = (event) => {
|
|
const code = event.code;
|
|
const { left, right, up, down } = EVENT_CODE;
|
|
if ([left, right].includes(code)) {
|
|
const step = code === left ? -1 : 1;
|
|
changeSelectionRange(step);
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
if ([up, down].includes(code)) {
|
|
const step = code === up ? -1 : 1;
|
|
timePickerOptions["start_scrollDown"](step);
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
};
|
|
const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
|
|
getAvailableHours,
|
|
getAvailableMinutes,
|
|
getAvailableSeconds
|
|
});
|
|
const getRangeAvailableTime = (date) => {
|
|
return getAvailableTime(date, props.datetimeRole || "", true);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
if (!value)
|
|
return null;
|
|
return dayjs(value, props.format).locale(lang.value);
|
|
};
|
|
const formatToString = (value) => {
|
|
if (!value)
|
|
return null;
|
|
return value.format(props.format);
|
|
};
|
|
const getDefaultValue2 = () => {
|
|
return dayjs(defaultValue).locale(lang.value);
|
|
};
|
|
emit("set-picker-option", ["isValidValue", isValidValue]);
|
|
emit("set-picker-option", ["formatToString", formatToString]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
|
|
emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
|
|
emit("set-picker-option", ["getDefaultValue", getDefaultValue2]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
|
|
default: withCtx(() => [
|
|
_ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ns).b("panel"))
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": unref(showSeconds) }])
|
|
}, [
|
|
createVNode(TimeSpinner, {
|
|
ref: "spinner",
|
|
role: _ctx.datetimeRole || "start",
|
|
"arrow-control": unref(arrowControl),
|
|
"show-seconds": unref(showSeconds),
|
|
"am-pm-mode": unref(amPmMode),
|
|
"spinner-date": _ctx.parsedValue,
|
|
"disabled-hours": unref(disabledHours),
|
|
"disabled-minutes": unref(disabledMinutes),
|
|
"disabled-seconds": unref(disabledSeconds),
|
|
onChange: handleChange,
|
|
onSetOption: unref(onSetOption),
|
|
onSelectRange: setSelectionRange
|
|
}, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
|
|
], 2),
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ns).be("panel", "footer"))
|
|
}, [
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
|
|
onClick: handleCancel
|
|
}, toDisplayString(unref(t)("el.datepicker.cancel")), 3),
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
|
|
onClick: ($event) => handleConfirm()
|
|
}, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["onClick"])
|
|
], 2)
|
|
], 2)) : createCommentVNode("v-if", true)
|
|
]),
|
|
_: 1
|
|
}, 8, ["name"]);
|
|
};
|
|
}
|
|
});
|
|
var TimePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__file", "panel-time-pick.vue"]]);
|
|
const ROOT_PICKER_INJECTION_KEY = Symbol();
|
|
const datePickerProps = buildProps({
|
|
...timePickerDefaultProps,
|
|
type: {
|
|
type: definePropType(String),
|
|
default: "date"
|
|
}
|
|
});
|
|
const selectionModes = [
|
|
"date",
|
|
"dates",
|
|
"year",
|
|
"years",
|
|
"month",
|
|
"months",
|
|
"week",
|
|
"range"
|
|
];
|
|
const datePickerSharedProps = buildProps({
|
|
disabledDate: {
|
|
type: definePropType(Function)
|
|
},
|
|
date: {
|
|
type: definePropType(Object),
|
|
required: true
|
|
},
|
|
minDate: {
|
|
type: definePropType(Object)
|
|
},
|
|
maxDate: {
|
|
type: definePropType(Object)
|
|
},
|
|
parsedValue: {
|
|
type: definePropType([Object, Array])
|
|
},
|
|
rangeState: {
|
|
type: definePropType(Object),
|
|
default: () => ({
|
|
endDate: null,
|
|
selecting: false
|
|
})
|
|
}
|
|
});
|
|
const panelSharedProps = buildProps({
|
|
type: {
|
|
type: definePropType(String),
|
|
required: true,
|
|
values: datePickTypes
|
|
},
|
|
dateFormat: String,
|
|
timeFormat: String,
|
|
showNow: {
|
|
type: Boolean,
|
|
default: true
|
|
}
|
|
});
|
|
const panelRangeSharedProps = buildProps({
|
|
unlinkPanels: Boolean,
|
|
parsedValue: {
|
|
type: definePropType(Array)
|
|
}
|
|
});
|
|
const selectionModeWithDefault = (mode) => {
|
|
return {
|
|
type: String,
|
|
values: selectionModes,
|
|
default: mode
|
|
};
|
|
};
|
|
const panelDatePickProps = buildProps({
|
|
...panelSharedProps,
|
|
parsedValue: {
|
|
type: definePropType([Object, Array])
|
|
},
|
|
visible: {
|
|
type: Boolean
|
|
},
|
|
format: {
|
|
type: String,
|
|
default: ""
|
|
}
|
|
});
|
|
const isValidRange = (range) => {
|
|
if (!shared_cjs_prodExports.isArray(range))
|
|
return false;
|
|
const [left, right] = range;
|
|
return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
|
|
};
|
|
const getDefaultValue = (defaultValue, { lang, unit: unit2, unlinkPanels }) => {
|
|
let start;
|
|
if (shared_cjs_prodExports.isArray(defaultValue)) {
|
|
let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
|
|
if (!unlinkPanels) {
|
|
right = left.add(1, unit2);
|
|
}
|
|
return [left, right];
|
|
} else if (defaultValue) {
|
|
start = dayjs(defaultValue);
|
|
} else {
|
|
start = dayjs();
|
|
}
|
|
start = start.locale(lang);
|
|
return [start, start.add(1, unit2)];
|
|
};
|
|
const buildPickerTable = (dimension, rows, {
|
|
columnIndexOffset,
|
|
startDate,
|
|
nextEndDate,
|
|
now: now2,
|
|
unit: unit2,
|
|
relativeDateGetter,
|
|
setCellMetadata,
|
|
setRowMetadata
|
|
}) => {
|
|
for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
|
|
const row = rows[rowIndex];
|
|
for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
|
|
let cell = row[columnIndex + columnIndexOffset];
|
|
if (!cell) {
|
|
cell = {
|
|
row: rowIndex,
|
|
column: columnIndex,
|
|
type: "normal",
|
|
inRange: false,
|
|
start: false,
|
|
end: false
|
|
};
|
|
}
|
|
const index2 = rowIndex * dimension.column + columnIndex;
|
|
const nextStartDate = relativeDateGetter(index2);
|
|
cell.dayjs = nextStartDate;
|
|
cell.date = nextStartDate.toDate();
|
|
cell.timestamp = nextStartDate.valueOf();
|
|
cell.type = "normal";
|
|
cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit2) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit2)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit2) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit2));
|
|
if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
|
|
cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit2);
|
|
cell.end = startDate && nextStartDate.isSame(startDate, unit2);
|
|
} else {
|
|
cell.start = !!startDate && nextStartDate.isSame(startDate, unit2);
|
|
cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit2);
|
|
}
|
|
const isToday = nextStartDate.isSame(now2, unit2);
|
|
if (isToday) {
|
|
cell.type = "today";
|
|
}
|
|
setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
|
|
row[columnIndex + columnIndexOffset] = cell;
|
|
}
|
|
setRowMetadata == null ? void 0 : setRowMetadata(row);
|
|
}
|
|
};
|
|
const datesInMonth = (year, month, lang) => {
|
|
const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
|
|
const numOfDays = firstDay.daysInMonth();
|
|
return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
|
|
};
|
|
const getValidDateOfMonth = (year, month, lang, disabledDate) => {
|
|
const _value = dayjs().year(year).month(month).startOf("month");
|
|
const _date = datesInMonth(year, month, lang).find((date) => {
|
|
return !(disabledDate == null ? void 0 : disabledDate(date));
|
|
});
|
|
if (_date) {
|
|
return dayjs(_date).locale(lang);
|
|
}
|
|
return _value.locale(lang);
|
|
};
|
|
const getValidDateOfYear = (value, lang, disabledDate) => {
|
|
const year = value.year();
|
|
if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
|
|
return value.locale(lang);
|
|
}
|
|
const month = value.month();
|
|
if (!datesInMonth(year, month, lang).every(disabledDate)) {
|
|
return getValidDateOfMonth(year, month, lang, disabledDate);
|
|
}
|
|
for (let i = 0; i < 12; i++) {
|
|
if (!datesInMonth(year, i, lang).every(disabledDate)) {
|
|
return getValidDateOfMonth(year, i, lang, disabledDate);
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const basicDateTableProps = buildProps({
|
|
...datePickerSharedProps,
|
|
cellClassName: {
|
|
type: definePropType(Function)
|
|
},
|
|
showWeekNumber: Boolean,
|
|
selectionMode: selectionModeWithDefault("date")
|
|
});
|
|
const basicDateTableEmits = ["changerange", "pick", "select"];
|
|
const isNormalDay = (type = "") => {
|
|
return ["normal", "today"].includes(type);
|
|
};
|
|
const useBasicDateTable = (props, emit) => {
|
|
const { lang } = useLocale();
|
|
const tbodyRef = ref();
|
|
const currentCellRef = ref();
|
|
const lastRow = ref();
|
|
const lastColumn = ref();
|
|
const tableRows = ref([[], [], [], [], [], []]);
|
|
let focusWithClick = false;
|
|
const firstDayOfWeek = props.date.$locale().weekStart || 7;
|
|
const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
|
|
const offsetDay = computed(() => {
|
|
return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
|
|
});
|
|
const startDate = computed(() => {
|
|
const startDayOfMonth = props.date.startOf("month");
|
|
return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
|
|
});
|
|
const WEEKS = computed(() => {
|
|
return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
|
|
});
|
|
const hasCurrent = computed(() => {
|
|
return flatten(unref(rows)).some((row) => {
|
|
return row.isCurrent;
|
|
});
|
|
});
|
|
const days = computed(() => {
|
|
const startOfMonth = props.date.startOf("month");
|
|
const startOfMonthDay = startOfMonth.day() || 7;
|
|
const dateCountOfMonth = startOfMonth.daysInMonth();
|
|
const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
|
|
return {
|
|
startOfMonthDay,
|
|
dateCountOfMonth,
|
|
dateCountOfLastMonth
|
|
};
|
|
});
|
|
const selectedDate = computed(() => {
|
|
return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
|
|
});
|
|
const setDateText = (cell, { count, rowIndex, columnIndex }) => {
|
|
const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
|
|
const offset = unref(offsetDay);
|
|
if (rowIndex >= 0 && rowIndex <= 1) {
|
|
const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
|
|
if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
|
|
cell.text = count;
|
|
return true;
|
|
} else {
|
|
cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
|
|
cell.type = "prev-month";
|
|
}
|
|
} else {
|
|
if (count <= dateCountOfMonth) {
|
|
cell.text = count;
|
|
} else {
|
|
cell.text = count - dateCountOfMonth;
|
|
cell.type = "next-month";
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
|
|
const { disabledDate, cellClassName } = props;
|
|
const _selectedDate = unref(selectedDate);
|
|
const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
|
|
const cellDate = cell.dayjs.toDate();
|
|
cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
|
|
cell.isSelected = !!cell.selected;
|
|
cell.isCurrent = isCurrent(cell);
|
|
cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
|
|
cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
|
|
return shouldIncrement;
|
|
};
|
|
const setRowMetadata = (row) => {
|
|
if (props.selectionMode === "week") {
|
|
const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
|
|
const isActive = isWeekActive(row[start + 1]);
|
|
row[start].inRange = isActive;
|
|
row[start].start = isActive;
|
|
row[end].inRange = isActive;
|
|
row[end].end = isActive;
|
|
}
|
|
};
|
|
const rows = computed(() => {
|
|
const { minDate, maxDate, rangeState, showWeekNumber } = props;
|
|
const offset = unref(offsetDay);
|
|
const rows_ = unref(tableRows);
|
|
const dateUnit = "day";
|
|
let count = 1;
|
|
if (showWeekNumber) {
|
|
for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
|
|
if (!rows_[rowIndex][0]) {
|
|
rows_[rowIndex][0] = {
|
|
type: "week",
|
|
text: unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
|
|
};
|
|
}
|
|
}
|
|
}
|
|
buildPickerTable({ row: 6, column: 7 }, rows_, {
|
|
startDate: minDate,
|
|
columnIndexOffset: showWeekNumber ? 1 : 0,
|
|
nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
|
|
now: dayjs().locale(unref(lang)).startOf(dateUnit),
|
|
unit: dateUnit,
|
|
relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
|
|
setCellMetadata: (...args) => {
|
|
if (setCellMetadata(...args, count)) {
|
|
count += 1;
|
|
}
|
|
},
|
|
setRowMetadata
|
|
});
|
|
return rows_;
|
|
});
|
|
watch(() => props.date, async () => {
|
|
var _a;
|
|
if ((_a = unref(tbodyRef)) == null ? void 0 : _a.contains((void 0).activeElement)) {
|
|
await nextTick();
|
|
await focus();
|
|
}
|
|
});
|
|
const focus = async () => {
|
|
var _a;
|
|
return (_a = unref(currentCellRef)) == null ? void 0 : _a.focus();
|
|
};
|
|
const isCurrent = (cell) => {
|
|
return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
|
|
};
|
|
const cellMatchesDate = (cell, date) => {
|
|
if (!date)
|
|
return false;
|
|
return dayjs(date).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
|
|
};
|
|
const getDateOfCell = (row, column) => {
|
|
const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay);
|
|
return unref(startDate).add(offsetFromStart, "day");
|
|
};
|
|
const handleMouseMove = (event) => {
|
|
var _a;
|
|
if (!props.rangeState.selecting)
|
|
return;
|
|
let target = event.target;
|
|
if (target.tagName === "SPAN") {
|
|
target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
|
|
}
|
|
if (target.tagName === "DIV") {
|
|
target = target.parentNode;
|
|
}
|
|
if (target.tagName !== "TD")
|
|
return;
|
|
const row = target.parentNode.rowIndex - 1;
|
|
const column = target.cellIndex;
|
|
if (unref(rows)[row][column].disabled)
|
|
return;
|
|
if (row !== unref(lastRow) || column !== unref(lastColumn)) {
|
|
lastRow.value = row;
|
|
lastColumn.value = column;
|
|
emit("changerange", {
|
|
selecting: true,
|
|
endDate: getDateOfCell(row, column)
|
|
});
|
|
}
|
|
};
|
|
const isSelectedCell = (cell) => {
|
|
return !unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
|
|
};
|
|
const handleFocus = (event) => {
|
|
if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date")
|
|
return;
|
|
handlePickDate(event, true);
|
|
};
|
|
const handleMouseDown = (event) => {
|
|
const target = event.target.closest("td");
|
|
if (!target)
|
|
return;
|
|
focusWithClick = true;
|
|
};
|
|
const handleMouseUp = (event) => {
|
|
const target = event.target.closest("td");
|
|
if (!target)
|
|
return;
|
|
focusWithClick = false;
|
|
};
|
|
const handleRangePick = (newDate) => {
|
|
if (!props.rangeState.selecting || !props.minDate) {
|
|
emit("pick", { minDate: newDate, maxDate: null });
|
|
emit("select", true);
|
|
} else {
|
|
if (newDate >= props.minDate) {
|
|
emit("pick", { minDate: props.minDate, maxDate: newDate });
|
|
} else {
|
|
emit("pick", { minDate: newDate, maxDate: props.minDate });
|
|
}
|
|
emit("select", false);
|
|
}
|
|
};
|
|
const handleWeekPick = (newDate) => {
|
|
const weekNumber = newDate.week();
|
|
const value = `${newDate.year()}w${weekNumber}`;
|
|
emit("pick", {
|
|
year: newDate.year(),
|
|
week: weekNumber,
|
|
value,
|
|
date: newDate.startOf("week")
|
|
});
|
|
};
|
|
const handleDatesPick = (newDate, selected) => {
|
|
const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
|
|
emit("pick", newValue);
|
|
};
|
|
const handlePickDate = (event, isKeyboardMovement = false) => {
|
|
const target = event.target.closest("td");
|
|
if (!target)
|
|
return;
|
|
const row = target.parentNode.rowIndex - 1;
|
|
const column = target.cellIndex;
|
|
const cell = unref(rows)[row][column];
|
|
if (cell.disabled || cell.type === "week")
|
|
return;
|
|
const newDate = getDateOfCell(row, column);
|
|
switch (props.selectionMode) {
|
|
case "range": {
|
|
handleRangePick(newDate);
|
|
break;
|
|
}
|
|
case "date": {
|
|
emit("pick", newDate, isKeyboardMovement);
|
|
break;
|
|
}
|
|
case "week": {
|
|
handleWeekPick(newDate);
|
|
break;
|
|
}
|
|
case "dates": {
|
|
handleDatesPick(newDate, !!cell.selected);
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
const isWeekActive = (cell) => {
|
|
if (props.selectionMode !== "week")
|
|
return false;
|
|
let newDate = props.date.startOf("day");
|
|
if (cell.type === "prev-month") {
|
|
newDate = newDate.subtract(1, "month");
|
|
}
|
|
if (cell.type === "next-month") {
|
|
newDate = newDate.add(1, "month");
|
|
}
|
|
newDate = newDate.date(Number.parseInt(cell.text, 10));
|
|
if (props.parsedValue && !shared_cjs_prodExports.isArray(props.parsedValue)) {
|
|
const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
|
|
const weekDate = props.parsedValue.subtract(dayOffset, "day");
|
|
return weekDate.isSame(newDate, "day");
|
|
}
|
|
return false;
|
|
};
|
|
return {
|
|
WEEKS,
|
|
rows,
|
|
tbodyRef,
|
|
currentCellRef,
|
|
focus,
|
|
isCurrent,
|
|
isWeekActive,
|
|
isSelectedCell,
|
|
handlePickDate,
|
|
handleMouseUp,
|
|
handleMouseDown,
|
|
handleMouseMove,
|
|
handleFocus
|
|
};
|
|
};
|
|
const useBasicDateTableDOM = (props, {
|
|
isCurrent,
|
|
isWeekActive
|
|
}) => {
|
|
const ns = useNamespace("date-table");
|
|
const { t } = useLocale();
|
|
const tableKls = computed(() => [
|
|
ns.b(),
|
|
{ "is-week-mode": props.selectionMode === "week" }
|
|
]);
|
|
const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
|
|
const weekLabel = computed(() => t("el.datepicker.week"));
|
|
const getCellClasses = (cell) => {
|
|
const classes = [];
|
|
if (isNormalDay(cell.type) && !cell.disabled) {
|
|
classes.push("available");
|
|
if (cell.type === "today") {
|
|
classes.push("today");
|
|
}
|
|
} else {
|
|
classes.push(cell.type);
|
|
}
|
|
if (isCurrent(cell)) {
|
|
classes.push("current");
|
|
}
|
|
if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
|
|
classes.push("in-range");
|
|
if (cell.start) {
|
|
classes.push("start-date");
|
|
}
|
|
if (cell.end) {
|
|
classes.push("end-date");
|
|
}
|
|
}
|
|
if (cell.disabled) {
|
|
classes.push("disabled");
|
|
}
|
|
if (cell.selected) {
|
|
classes.push("selected");
|
|
}
|
|
if (cell.customClass) {
|
|
classes.push(cell.customClass);
|
|
}
|
|
return classes.join(" ");
|
|
};
|
|
const getRowKls = (cell) => [
|
|
ns.e("row"),
|
|
{ current: isWeekActive(cell) }
|
|
];
|
|
return {
|
|
tableKls,
|
|
tableLabel,
|
|
weekLabel,
|
|
getCellClasses,
|
|
getRowKls,
|
|
t
|
|
};
|
|
};
|
|
const basicCellProps = buildProps({
|
|
cell: {
|
|
type: definePropType(Object)
|
|
}
|
|
});
|
|
var ElDatePickerCell = defineComponent({
|
|
name: "ElDatePickerCell",
|
|
props: basicCellProps,
|
|
setup(props) {
|
|
const ns = useNamespace("date-table-cell");
|
|
const {
|
|
slots
|
|
} = inject(ROOT_PICKER_INJECTION_KEY);
|
|
return () => {
|
|
const {
|
|
cell
|
|
} = props;
|
|
return renderSlot(slots, "default", {
|
|
...cell
|
|
}, () => {
|
|
var _a;
|
|
return [createVNode("div", {
|
|
"class": ns.b()
|
|
}, [createVNode("span", {
|
|
"class": ns.e("text")
|
|
}, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
|
|
});
|
|
};
|
|
}
|
|
});
|
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
__name: "basic-date-table",
|
|
props: basicDateTableProps,
|
|
emits: basicDateTableEmits,
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const {
|
|
WEEKS,
|
|
rows,
|
|
tbodyRef,
|
|
currentCellRef,
|
|
focus,
|
|
isCurrent,
|
|
isWeekActive,
|
|
isSelectedCell,
|
|
handlePickDate,
|
|
handleMouseUp,
|
|
handleMouseDown,
|
|
handleMouseMove,
|
|
handleFocus
|
|
} = useBasicDateTable(props, emit);
|
|
const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
|
|
isCurrent,
|
|
isWeekActive
|
|
});
|
|
expose({
|
|
focus
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("table", {
|
|
"aria-label": unref(tableLabel),
|
|
class: normalizeClass(unref(tableKls)),
|
|
cellspacing: "0",
|
|
cellpadding: "0",
|
|
role: "grid",
|
|
onClick: unref(handlePickDate),
|
|
onMousemove: unref(handleMouseMove),
|
|
onMousedown: withModifiers(unref(handleMouseDown), ["prevent"]),
|
|
onMouseup: unref(handleMouseUp)
|
|
}, [
|
|
createElementVNode("tbody", {
|
|
ref_key: "tbodyRef",
|
|
ref: tbodyRef
|
|
}, [
|
|
createElementVNode("tr", null, [
|
|
_ctx.showWeekNumber ? (openBlock(), createElementBlock("th", {
|
|
key: 0,
|
|
scope: "col"
|
|
}, toDisplayString(unref(weekLabel)), 1)) : createCommentVNode("v-if", true),
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
|
|
return openBlock(), createElementBlock("th", {
|
|
key,
|
|
"aria-label": unref(t)("el.datepicker.weeksFull." + week),
|
|
scope: "col"
|
|
}, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
|
|
}), 128))
|
|
]),
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
|
|
return openBlock(), createElementBlock("tr", {
|
|
key: rowKey,
|
|
class: normalizeClass(unref(getRowKls)(row[1]))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
|
|
return openBlock(), createElementBlock("td", {
|
|
key: `${rowKey}.${columnKey}`,
|
|
ref_for: true,
|
|
ref: (el) => unref(isSelectedCell)(cell) && (currentCellRef.value = el),
|
|
class: normalizeClass(unref(getCellClasses)(cell)),
|
|
"aria-current": cell.isCurrent ? "date" : void 0,
|
|
"aria-selected": cell.isCurrent,
|
|
tabindex: unref(isSelectedCell)(cell) ? 0 : -1,
|
|
onFocus: unref(handleFocus)
|
|
}, [
|
|
createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
|
|
], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
|
|
}), 128))
|
|
], 2);
|
|
}), 128))
|
|
], 512)
|
|
], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
|
|
};
|
|
}
|
|
});
|
|
var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__file", "basic-date-table.vue"]]);
|
|
const basicMonthTableProps = buildProps({
|
|
...datePickerSharedProps,
|
|
selectionMode: selectionModeWithDefault("month")
|
|
});
|
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
__name: "basic-month-table",
|
|
props: basicMonthTableProps,
|
|
emits: ["changerange", "pick", "select"],
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const ns = useNamespace("month-table");
|
|
const { t, lang } = useLocale();
|
|
const tbodyRef = ref();
|
|
const currentCellRef = ref();
|
|
const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
|
|
const tableRows = ref([
|
|
[],
|
|
[],
|
|
[]
|
|
]);
|
|
const lastRow = ref();
|
|
const lastColumn = ref();
|
|
const rows = computed(() => {
|
|
var _a, _b;
|
|
const rows2 = tableRows.value;
|
|
const now2 = dayjs().locale(lang.value).startOf("month");
|
|
for (let i = 0; i < 3; i++) {
|
|
const row = rows2[i];
|
|
for (let j = 0; j < 4; j++) {
|
|
const cell = row[j] || (row[j] = {
|
|
row: i,
|
|
column: j,
|
|
type: "normal",
|
|
inRange: false,
|
|
start: false,
|
|
end: false,
|
|
text: -1,
|
|
disabled: false
|
|
});
|
|
cell.type = "normal";
|
|
const index2 = i * 4 + j;
|
|
const calTime = props.date.startOf("year").month(index2);
|
|
const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
|
|
cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month"));
|
|
if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
|
|
cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
|
|
cell.end = props.minDate && calTime.isSame(props.minDate, "month");
|
|
} else {
|
|
cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
|
|
cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
|
|
}
|
|
const isToday = now2.isSame(calTime);
|
|
if (isToday) {
|
|
cell.type = "today";
|
|
}
|
|
cell.text = index2;
|
|
cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
|
|
}
|
|
}
|
|
return rows2;
|
|
});
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = currentCellRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const getCellStyle = (cell) => {
|
|
const style = {};
|
|
const year = props.date.year();
|
|
const today = /* @__PURE__ */ new Date();
|
|
const month = cell.text;
|
|
style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
|
|
style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
|
|
style.today = today.getFullYear() === year && today.getMonth() === month;
|
|
if (cell.inRange) {
|
|
style["in-range"] = true;
|
|
if (cell.start) {
|
|
style["start-date"] = true;
|
|
}
|
|
if (cell.end) {
|
|
style["end-date"] = true;
|
|
}
|
|
}
|
|
return style;
|
|
};
|
|
const isSelectedCell = (cell) => {
|
|
const year = props.date.year();
|
|
const month = cell.text;
|
|
return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
|
|
};
|
|
const handleMouseMove = (event) => {
|
|
var _a;
|
|
if (!props.rangeState.selecting)
|
|
return;
|
|
let target = event.target;
|
|
if (target.tagName === "SPAN") {
|
|
target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
|
|
}
|
|
if (target.tagName === "DIV") {
|
|
target = target.parentNode;
|
|
}
|
|
if (target.tagName !== "TD")
|
|
return;
|
|
const row = target.parentNode.rowIndex;
|
|
const column = target.cellIndex;
|
|
if (rows.value[row][column].disabled)
|
|
return;
|
|
if (row !== lastRow.value || column !== lastColumn.value) {
|
|
lastRow.value = row;
|
|
lastColumn.value = column;
|
|
emit("changerange", {
|
|
selecting: true,
|
|
endDate: props.date.startOf("year").month(row * 4 + column)
|
|
});
|
|
}
|
|
};
|
|
const handleMonthTableClick = (event) => {
|
|
var _a;
|
|
const target = (_a = event.target) == null ? void 0 : _a.closest("td");
|
|
if ((target == null ? void 0 : target.tagName) !== "TD")
|
|
return;
|
|
if (hasClass(target, "disabled"))
|
|
return;
|
|
const column = target.cellIndex;
|
|
const row = target.parentNode.rowIndex;
|
|
const month = row * 4 + column;
|
|
const newDate = props.date.startOf("year").month(month);
|
|
if (props.selectionMode === "months") {
|
|
if (event.type === "keydown") {
|
|
emit("pick", castArray(props.parsedValue), false);
|
|
return;
|
|
}
|
|
const newMonth = getValidDateOfMonth(props.date.year(), month, lang.value, props.disabledDate);
|
|
const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([dayjs(newMonth)]);
|
|
emit("pick", newValue);
|
|
} else if (props.selectionMode === "range") {
|
|
if (!props.rangeState.selecting) {
|
|
emit("pick", { minDate: newDate, maxDate: null });
|
|
emit("select", true);
|
|
} else {
|
|
if (props.minDate && newDate >= props.minDate) {
|
|
emit("pick", { minDate: props.minDate, maxDate: newDate });
|
|
} else {
|
|
emit("pick", { minDate: newDate, maxDate: props.minDate });
|
|
}
|
|
emit("select", false);
|
|
}
|
|
} else {
|
|
emit("pick", month);
|
|
}
|
|
};
|
|
watch(() => props.date, async () => {
|
|
var _a, _b;
|
|
if ((_a = tbodyRef.value) == null ? void 0 : _a.contains((void 0).activeElement)) {
|
|
await nextTick();
|
|
(_b = currentCellRef.value) == null ? void 0 : _b.focus();
|
|
}
|
|
});
|
|
expose({
|
|
focus
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("table", {
|
|
role: "grid",
|
|
"aria-label": unref(t)("el.datepicker.monthTablePrompt"),
|
|
class: normalizeClass(unref(ns).b()),
|
|
onClick: handleMonthTableClick,
|
|
onMousemove: handleMouseMove
|
|
}, [
|
|
createElementVNode("tbody", {
|
|
ref_key: "tbodyRef",
|
|
ref: tbodyRef
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, key) => {
|
|
return openBlock(), createElementBlock("tr", { key }, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
|
|
return openBlock(), createElementBlock("td", {
|
|
key: key_,
|
|
ref_for: true,
|
|
ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
|
|
class: normalizeClass(getCellStyle(cell)),
|
|
"aria-selected": `${isSelectedCell(cell)}`,
|
|
"aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
|
|
tabindex: isSelectedCell(cell) ? 0 : -1,
|
|
onKeydown: [
|
|
withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
|
|
withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
|
|
]
|
|
}, [
|
|
createVNode(unref(ElDatePickerCell), {
|
|
cell: {
|
|
...cell,
|
|
renderText: unref(t)("el.datepicker.months." + months.value[cell.text])
|
|
}
|
|
}, null, 8, ["cell"])
|
|
], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
|
|
}), 128))
|
|
]);
|
|
}), 128))
|
|
], 512)
|
|
], 42, ["aria-label"]);
|
|
};
|
|
}
|
|
});
|
|
var MonthTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__file", "basic-month-table.vue"]]);
|
|
const basicYearTableProps = buildProps({
|
|
...datePickerSharedProps,
|
|
selectionMode: selectionModeWithDefault("year")
|
|
});
|
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
__name: "basic-year-table",
|
|
props: basicYearTableProps,
|
|
emits: ["changerange", "pick", "select"],
|
|
setup(__props, { expose, emit }) {
|
|
const props = __props;
|
|
const datesInYear = (year, lang2) => {
|
|
const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
|
|
const lastDay = firstDay.endOf("year");
|
|
const numOfDays = lastDay.dayOfYear();
|
|
return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
|
|
};
|
|
const ns = useNamespace("year-table");
|
|
const { t, lang } = useLocale();
|
|
const tbodyRef = ref();
|
|
const currentCellRef = ref();
|
|
const startYear = computed(() => {
|
|
return Math.floor(props.date.year() / 10) * 10;
|
|
});
|
|
const tableRows = ref([[], [], []]);
|
|
const lastRow = ref();
|
|
const lastColumn = ref();
|
|
const rows = computed(() => {
|
|
var _a;
|
|
const rows2 = tableRows.value;
|
|
const now2 = dayjs().locale(lang.value).startOf("year");
|
|
for (let i = 0; i < 3; i++) {
|
|
const row = rows2[i];
|
|
for (let j = 0; j < 4; j++) {
|
|
if (i * 4 + j >= 10) {
|
|
break;
|
|
}
|
|
let cell = row[j];
|
|
if (!cell) {
|
|
cell = {
|
|
row: i,
|
|
column: j,
|
|
type: "normal",
|
|
inRange: false,
|
|
start: false,
|
|
end: false,
|
|
text: -1,
|
|
disabled: false
|
|
};
|
|
}
|
|
cell.type = "normal";
|
|
const index2 = i * 4 + j + startYear.value;
|
|
const calTime = dayjs().year(index2);
|
|
const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
|
|
cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "year") && calEndDate && calTime.isSameOrBefore(calEndDate, "year")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "year") && calEndDate && calTime.isSameOrAfter(calEndDate, "year"));
|
|
if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
|
|
cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
|
|
cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
|
|
} else {
|
|
cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
|
|
cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
|
|
}
|
|
const isToday = now2.isSame(calTime);
|
|
if (isToday) {
|
|
cell.type = "today";
|
|
}
|
|
cell.text = index2;
|
|
const cellDate = calTime.toDate();
|
|
cell.disabled = props.disabledDate && props.disabledDate(cellDate) || false;
|
|
row[j] = cell;
|
|
}
|
|
}
|
|
return rows2;
|
|
});
|
|
const focus = () => {
|
|
var _a;
|
|
(_a = currentCellRef.value) == null ? void 0 : _a.focus();
|
|
};
|
|
const getCellKls = (cell) => {
|
|
const kls = {};
|
|
const today = dayjs().locale(lang.value);
|
|
const year = cell.text;
|
|
kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
|
|
kls.today = today.year() === year;
|
|
kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
|
|
if (cell.inRange) {
|
|
kls["in-range"] = true;
|
|
if (cell.start) {
|
|
kls["start-date"] = true;
|
|
}
|
|
if (cell.end) {
|
|
kls["end-date"] = true;
|
|
}
|
|
}
|
|
return kls;
|
|
};
|
|
const isSelectedCell = (cell) => {
|
|
const year = cell.text;
|
|
return castArray(props.date).findIndex((date) => date.year() === year) >= 0;
|
|
};
|
|
const handleYearTableClick = (event) => {
|
|
var _a;
|
|
const target = (_a = event.target) == null ? void 0 : _a.closest("td");
|
|
if (!target || !target.textContent || hasClass(target, "disabled"))
|
|
return;
|
|
const column = target.cellIndex;
|
|
const row = target.parentNode.rowIndex;
|
|
const selectedYear = row * 4 + column + startYear.value;
|
|
const newDate = dayjs().year(selectedYear);
|
|
if (props.selectionMode === "range") {
|
|
if (!props.rangeState.selecting) {
|
|
emit("pick", { minDate: newDate, maxDate: null });
|
|
emit("select", true);
|
|
} else {
|
|
if (props.minDate && newDate >= props.minDate) {
|
|
emit("pick", { minDate: props.minDate, maxDate: newDate });
|
|
} else {
|
|
emit("pick", { minDate: newDate, maxDate: props.minDate });
|
|
}
|
|
emit("select", false);
|
|
}
|
|
} else if (props.selectionMode === "years") {
|
|
if (event.type === "keydown") {
|
|
emit("pick", castArray(props.parsedValue), false);
|
|
return;
|
|
}
|
|
const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
|
|
const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
|
|
emit("pick", newValue);
|
|
} else {
|
|
emit("pick", selectedYear);
|
|
}
|
|
};
|
|
const handleMouseMove = (event) => {
|
|
var _a;
|
|
if (!props.rangeState.selecting)
|
|
return;
|
|
const target = (_a = event.target) == null ? void 0 : _a.closest("td");
|
|
if (!target)
|
|
return;
|
|
const row = target.parentNode.rowIndex;
|
|
const column = target.cellIndex;
|
|
if (rows.value[row][column].disabled)
|
|
return;
|
|
if (row !== lastRow.value || column !== lastColumn.value) {
|
|
lastRow.value = row;
|
|
lastColumn.value = column;
|
|
emit("changerange", {
|
|
selecting: true,
|
|
endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
|
|
});
|
|
}
|
|
};
|
|
watch(() => props.date, async () => {
|
|
var _a, _b;
|
|
if ((_a = tbodyRef.value) == null ? void 0 : _a.contains((void 0).activeElement)) {
|
|
await nextTick();
|
|
(_b = currentCellRef.value) == null ? void 0 : _b.focus();
|
|
}
|
|
});
|
|
expose({
|
|
focus
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("table", {
|
|
role: "grid",
|
|
"aria-label": unref(t)("el.datepicker.yearTablePrompt"),
|
|
class: normalizeClass(unref(ns).b()),
|
|
onClick: handleYearTableClick,
|
|
onMousemove: handleMouseMove
|
|
}, [
|
|
createElementVNode("tbody", {
|
|
ref_key: "tbodyRef",
|
|
ref: tbodyRef
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
|
|
return openBlock(), createElementBlock("tr", { key: rowKey }, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellKey) => {
|
|
return openBlock(), createElementBlock("td", {
|
|
key: `${rowKey}_${cellKey}`,
|
|
ref_for: true,
|
|
ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
|
|
class: normalizeClass(["available", getCellKls(cell)]),
|
|
"aria-selected": isSelectedCell(cell),
|
|
"aria-label": String(cell.text),
|
|
tabindex: isSelectedCell(cell) ? 0 : -1,
|
|
onKeydown: [
|
|
withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
|
|
withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
|
|
]
|
|
}, [
|
|
createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
|
|
], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
|
|
}), 128))
|
|
]);
|
|
}), 128))
|
|
], 512)
|
|
], 42, ["aria-label"]);
|
|
};
|
|
}
|
|
});
|
|
var YearTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__file", "basic-year-table.vue"]]);
|
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
__name: "panel-date-pick",
|
|
props: panelDatePickProps,
|
|
emits: ["pick", "set-picker-option", "panel-change"],
|
|
setup(__props, { emit: contextEmit }) {
|
|
const props = __props;
|
|
const timeWithinRange = (_, __, ___) => true;
|
|
const ppNs = useNamespace("picker-panel");
|
|
const dpNs = useNamespace("date-picker");
|
|
const attrs = useAttrs();
|
|
const slots = useSlots();
|
|
const { t, lang } = useLocale();
|
|
const pickerBase = inject("EP_PICKER_BASE");
|
|
const popper = inject(TOOLTIP_INJECTION_KEY);
|
|
const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const currentViewRef = ref();
|
|
const innerDate = ref(dayjs().locale(lang.value));
|
|
const isChangeToNow = ref(false);
|
|
let isShortcut = false;
|
|
const defaultTimeD = computed(() => {
|
|
return dayjs(defaultTime).locale(lang.value);
|
|
});
|
|
const month = computed(() => {
|
|
return innerDate.value.month();
|
|
});
|
|
const year = computed(() => {
|
|
return innerDate.value.year();
|
|
});
|
|
const selectableRange = ref([]);
|
|
const userInputDate = ref(null);
|
|
const userInputTime = ref(null);
|
|
const checkDateWithinRange = (date) => {
|
|
return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
|
|
};
|
|
const formatEmit = (emitDayjs) => {
|
|
if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
|
|
return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
|
|
}
|
|
if (showTime.value)
|
|
return emitDayjs.millisecond(0);
|
|
return emitDayjs.startOf("day");
|
|
};
|
|
const emit = (value, ...args) => {
|
|
if (!value) {
|
|
contextEmit("pick", value, ...args);
|
|
} else if (shared_cjs_prodExports.isArray(value)) {
|
|
const dates = value.map(formatEmit);
|
|
contextEmit("pick", dates, ...args);
|
|
} else {
|
|
contextEmit("pick", formatEmit(value), ...args);
|
|
}
|
|
userInputDate.value = null;
|
|
userInputTime.value = null;
|
|
isChangeToNow.value = false;
|
|
isShortcut = false;
|
|
};
|
|
const handleDatePick = async (value, keepOpen) => {
|
|
if (selectionMode.value === "date") {
|
|
value = value;
|
|
let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
|
|
if (!checkDateWithinRange(newDate)) {
|
|
newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
|
|
}
|
|
innerDate.value = newDate;
|
|
emit(newDate, showTime.value || keepOpen);
|
|
if (props.type === "datetime") {
|
|
await nextTick();
|
|
handleFocusPicker();
|
|
}
|
|
} else if (selectionMode.value === "week") {
|
|
emit(value.date);
|
|
} else if (selectionMode.value === "dates") {
|
|
emit(value, true);
|
|
}
|
|
};
|
|
const moveByMonth = (forward) => {
|
|
const action = forward ? "add" : "subtract";
|
|
innerDate.value = innerDate.value[action](1, "month");
|
|
handlePanelChange("month");
|
|
};
|
|
const moveByYear = (forward) => {
|
|
const currentDate = innerDate.value;
|
|
const action = forward ? "add" : "subtract";
|
|
innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
|
|
handlePanelChange("year");
|
|
};
|
|
const currentView = ref("date");
|
|
const yearLabel = computed(() => {
|
|
const yearTranslation = t("el.datepicker.year");
|
|
if (currentView.value === "year") {
|
|
const startYear = Math.floor(year.value / 10) * 10;
|
|
if (yearTranslation) {
|
|
return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
|
|
}
|
|
return `${startYear} - ${startYear + 9}`;
|
|
}
|
|
return `${year.value} ${yearTranslation}`;
|
|
});
|
|
const handleShortcutClick = (shortcut) => {
|
|
const shortcutValue = shared_cjs_prodExports.isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
|
|
if (shortcutValue) {
|
|
isShortcut = true;
|
|
emit(dayjs(shortcutValue).locale(lang.value));
|
|
return;
|
|
}
|
|
if (shortcut.onClick) {
|
|
shortcut.onClick({
|
|
attrs,
|
|
slots,
|
|
emit: contextEmit
|
|
});
|
|
}
|
|
};
|
|
const selectionMode = computed(() => {
|
|
const { type } = props;
|
|
if (["week", "month", "months", "year", "years", "dates"].includes(type))
|
|
return type;
|
|
return "date";
|
|
});
|
|
const isMultipleType = computed(() => {
|
|
return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
|
|
});
|
|
const keyboardMode = computed(() => {
|
|
return selectionMode.value === "date" ? currentView.value : selectionMode.value;
|
|
});
|
|
const hasShortcuts = computed(() => !!shortcuts.length);
|
|
const handleMonthPick = async (month2, keepOpen) => {
|
|
if (selectionMode.value === "month") {
|
|
innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
|
|
emit(innerDate.value, false);
|
|
} else if (selectionMode.value === "months") {
|
|
emit(month2, keepOpen != null ? keepOpen : true);
|
|
} else {
|
|
innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
|
|
currentView.value = "date";
|
|
if (["month", "year", "date", "week"].includes(selectionMode.value)) {
|
|
emit(innerDate.value, true);
|
|
await nextTick();
|
|
handleFocusPicker();
|
|
}
|
|
}
|
|
handlePanelChange("month");
|
|
};
|
|
const handleYearPick = async (year2, keepOpen) => {
|
|
if (selectionMode.value === "year") {
|
|
const data = innerDate.value.startOf("year").year(year2);
|
|
innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
|
|
emit(innerDate.value, false);
|
|
} else if (selectionMode.value === "years") {
|
|
emit(year2, keepOpen != null ? keepOpen : true);
|
|
} else {
|
|
const data = innerDate.value.year(year2);
|
|
innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
|
|
currentView.value = "month";
|
|
if (["month", "year", "date", "week"].includes(selectionMode.value)) {
|
|
emit(innerDate.value, true);
|
|
await nextTick();
|
|
handleFocusPicker();
|
|
}
|
|
}
|
|
handlePanelChange("year");
|
|
};
|
|
const showPicker = async (view) => {
|
|
currentView.value = view;
|
|
await nextTick();
|
|
handleFocusPicker();
|
|
};
|
|
const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
|
|
const footerVisible = computed(() => {
|
|
const showDateFooter = showTime.value || selectionMode.value === "dates";
|
|
const showYearFooter = selectionMode.value === "years";
|
|
const showMonthFooter = selectionMode.value === "months";
|
|
const isDateView = currentView.value === "date";
|
|
const isYearView = currentView.value === "year";
|
|
const isMonthView = currentView.value === "month";
|
|
return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
|
|
});
|
|
const disabledConfirm = computed(() => {
|
|
if (!disabledDate)
|
|
return false;
|
|
if (!props.parsedValue)
|
|
return true;
|
|
if (shared_cjs_prodExports.isArray(props.parsedValue)) {
|
|
return disabledDate(props.parsedValue[0].toDate());
|
|
}
|
|
return disabledDate(props.parsedValue.toDate());
|
|
});
|
|
const onConfirm = () => {
|
|
if (isMultipleType.value) {
|
|
emit(props.parsedValue);
|
|
} else {
|
|
let result = props.parsedValue;
|
|
if (!result) {
|
|
const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
|
|
const defaultValueD = getDefaultValue2();
|
|
result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
|
|
}
|
|
innerDate.value = result;
|
|
emit(result);
|
|
}
|
|
};
|
|
const disabledNow = computed(() => {
|
|
if (!disabledDate)
|
|
return false;
|
|
return disabledDate(dayjs().locale(lang.value).toDate());
|
|
});
|
|
const changeToNow = () => {
|
|
const now2 = dayjs().locale(lang.value);
|
|
const nowDate = now2.toDate();
|
|
isChangeToNow.value = true;
|
|
if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
|
|
innerDate.value = dayjs().locale(lang.value);
|
|
emit(innerDate.value);
|
|
}
|
|
};
|
|
const timeFormat = computed(() => {
|
|
return props.timeFormat || extractTimeFormat(props.format);
|
|
});
|
|
const dateFormat = computed(() => {
|
|
return props.dateFormat || extractDateFormat(props.format);
|
|
});
|
|
const visibleTime = computed(() => {
|
|
if (userInputTime.value)
|
|
return userInputTime.value;
|
|
if (!props.parsedValue && !defaultValue.value)
|
|
return;
|
|
return (props.parsedValue || innerDate.value).format(timeFormat.value);
|
|
});
|
|
const visibleDate = computed(() => {
|
|
if (userInputDate.value)
|
|
return userInputDate.value;
|
|
if (!props.parsedValue && !defaultValue.value)
|
|
return;
|
|
return (props.parsedValue || innerDate.value).format(dateFormat.value);
|
|
});
|
|
const timePickerVisible = ref(false);
|
|
const onTimePickerInputFocus = () => {
|
|
timePickerVisible.value = true;
|
|
};
|
|
const handleTimePickClose = () => {
|
|
timePickerVisible.value = false;
|
|
};
|
|
const getUnits = (date) => {
|
|
return {
|
|
hour: date.hour(),
|
|
minute: date.minute(),
|
|
second: date.second(),
|
|
year: date.year(),
|
|
month: date.month(),
|
|
date: date.date()
|
|
};
|
|
};
|
|
const handleTimePick = (value, visible, first) => {
|
|
const { hour, minute, second } = getUnits(value);
|
|
const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
|
|
innerDate.value = newDate;
|
|
emit(innerDate.value, true);
|
|
if (!first) {
|
|
timePickerVisible.value = visible;
|
|
}
|
|
};
|
|
const handleVisibleTimeChange = (value) => {
|
|
const newDate = dayjs(value, timeFormat.value).locale(lang.value);
|
|
if (newDate.isValid() && checkDateWithinRange(newDate)) {
|
|
const { year: year2, month: month2, date } = getUnits(innerDate.value);
|
|
innerDate.value = newDate.year(year2).month(month2).date(date);
|
|
userInputTime.value = null;
|
|
timePickerVisible.value = false;
|
|
emit(innerDate.value, true);
|
|
}
|
|
};
|
|
const handleVisibleDateChange = (value) => {
|
|
const newDate = dayjs(value, dateFormat.value).locale(lang.value);
|
|
if (newDate.isValid()) {
|
|
if (disabledDate && disabledDate(newDate.toDate())) {
|
|
return;
|
|
}
|
|
const { hour, minute, second } = getUnits(innerDate.value);
|
|
innerDate.value = newDate.hour(hour).minute(minute).second(second);
|
|
userInputDate.value = null;
|
|
emit(innerDate.value, true);
|
|
}
|
|
};
|
|
const isValidValue = (date) => {
|
|
return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
|
|
};
|
|
const formatToString = (value) => {
|
|
return shared_cjs_prodExports.isArray(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
return dayjs(value, props.format).locale(lang.value);
|
|
};
|
|
const getDefaultValue2 = () => {
|
|
const parseDate2 = dayjs(defaultValue.value).locale(lang.value);
|
|
if (!defaultValue.value) {
|
|
const defaultTimeDValue = defaultTimeD.value;
|
|
return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
|
|
}
|
|
return parseDate2;
|
|
};
|
|
const handleFocusPicker = () => {
|
|
var _a;
|
|
if (["week", "month", "year", "date"].includes(selectionMode.value)) {
|
|
(_a = currentViewRef.value) == null ? void 0 : _a.focus();
|
|
}
|
|
};
|
|
const _handleFocusPicker = () => {
|
|
handleFocusPicker();
|
|
if (selectionMode.value === "week") {
|
|
handleKeyControl(EVENT_CODE.down);
|
|
}
|
|
};
|
|
const handleKeydownTable = (event) => {
|
|
const { code } = event;
|
|
const validCode = [
|
|
EVENT_CODE.up,
|
|
EVENT_CODE.down,
|
|
EVENT_CODE.left,
|
|
EVENT_CODE.right,
|
|
EVENT_CODE.home,
|
|
EVENT_CODE.end,
|
|
EVENT_CODE.pageUp,
|
|
EVENT_CODE.pageDown
|
|
];
|
|
if (validCode.includes(code)) {
|
|
handleKeyControl(code);
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
}
|
|
if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
|
|
event.preventDefault();
|
|
emit(innerDate.value, false);
|
|
}
|
|
};
|
|
const handleKeyControl = (code) => {
|
|
var _a;
|
|
const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
|
|
const mapping = {
|
|
year: {
|
|
[up]: -4,
|
|
[down]: 4,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
offset: (date, step) => date.setFullYear(date.getFullYear() + step)
|
|
},
|
|
month: {
|
|
[up]: -4,
|
|
[down]: 4,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
offset: (date, step) => date.setMonth(date.getMonth() + step)
|
|
},
|
|
week: {
|
|
[up]: -1,
|
|
[down]: 1,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
offset: (date, step) => date.setDate(date.getDate() + step * 7)
|
|
},
|
|
date: {
|
|
[up]: -7,
|
|
[down]: 7,
|
|
[left]: -1,
|
|
[right]: 1,
|
|
[home]: (date) => -date.getDay(),
|
|
[end]: (date) => -date.getDay() + 6,
|
|
[pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
|
|
[pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
|
|
offset: (date, step) => date.setDate(date.getDate() + step)
|
|
}
|
|
};
|
|
const newDate = innerDate.value.toDate();
|
|
while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
|
|
const map = mapping[keyboardMode.value];
|
|
if (!map)
|
|
return;
|
|
map.offset(newDate, shared_cjs_prodExports.isFunction(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
|
|
if (disabledDate && disabledDate(newDate)) {
|
|
break;
|
|
}
|
|
const result = dayjs(newDate).locale(lang.value);
|
|
innerDate.value = result;
|
|
contextEmit("pick", result, true);
|
|
break;
|
|
}
|
|
};
|
|
const handlePanelChange = (mode) => {
|
|
contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
|
|
};
|
|
watch(() => selectionMode.value, (val) => {
|
|
if (["month", "year"].includes(val)) {
|
|
currentView.value = val;
|
|
return;
|
|
} else if (val === "years") {
|
|
currentView.value = "year";
|
|
return;
|
|
} else if (val === "months") {
|
|
currentView.value = "month";
|
|
return;
|
|
}
|
|
currentView.value = "date";
|
|
}, { immediate: true });
|
|
watch(() => currentView.value, () => {
|
|
popper == null ? void 0 : popper.updatePopper();
|
|
});
|
|
watch(() => defaultValue.value, (val) => {
|
|
if (val) {
|
|
innerDate.value = getDefaultValue2();
|
|
}
|
|
}, { immediate: true });
|
|
watch(() => props.parsedValue, (val) => {
|
|
if (val) {
|
|
if (isMultipleType.value)
|
|
return;
|
|
if (shared_cjs_prodExports.isArray(val))
|
|
return;
|
|
innerDate.value = val;
|
|
} else {
|
|
innerDate.value = getDefaultValue2();
|
|
}
|
|
}, { immediate: true });
|
|
contextEmit("set-picker-option", ["isValidValue", isValidValue]);
|
|
contextEmit("set-picker-option", ["formatToString", formatToString]);
|
|
contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([
|
|
unref(ppNs).b(),
|
|
unref(dpNs).b(),
|
|
{
|
|
"has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
|
|
"has-time": unref(showTime)
|
|
}
|
|
])
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
onClick: ($event) => handleShortcutClick(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
unref(showTime) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(dpNs).e("time-header"))
|
|
}, [
|
|
createElementVNode("span", {
|
|
class: normalizeClass(unref(dpNs).e("editor-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
placeholder: unref(t)("el.datepicker.selectDate"),
|
|
"model-value": unref(visibleDate),
|
|
size: "small",
|
|
"validate-event": false,
|
|
onInput: (val) => userInputDate.value = val,
|
|
onChange: handleVisibleDateChange
|
|
}, null, 8, ["placeholder", "model-value", "onInput"])
|
|
], 2),
|
|
withDirectives((openBlock(), createElementBlock("span", {
|
|
class: normalizeClass(unref(dpNs).e("editor-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
placeholder: unref(t)("el.datepicker.selectTime"),
|
|
"model-value": unref(visibleTime),
|
|
size: "small",
|
|
"validate-event": false,
|
|
onFocus: onTimePickerInputFocus,
|
|
onInput: (val) => userInputTime.value = val,
|
|
onChange: handleVisibleTimeChange
|
|
}, null, 8, ["placeholder", "model-value", "onInput"]),
|
|
createVNode(unref(TimePickPanel), {
|
|
visible: timePickerVisible.value,
|
|
format: unref(timeFormat),
|
|
"parsed-value": innerDate.value,
|
|
onPick: handleTimePick
|
|
}, null, 8, ["visible", "format", "parsed-value"])
|
|
], 2)), [
|
|
[unref(ClickOutside), handleTimePickClose]
|
|
])
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
withDirectives(createElementVNode("div", {
|
|
class: normalizeClass([
|
|
unref(dpNs).e("header"),
|
|
(currentView.value === "year" || currentView.value === "month") && unref(dpNs).e("header--bordered")
|
|
])
|
|
}, [
|
|
createElementVNode("span", {
|
|
class: normalizeClass(unref(dpNs).e("prev-btn"))
|
|
}, [
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.prevYear`),
|
|
class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
|
|
onClick: ($event) => moveByYear(false)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "onClick"]),
|
|
withDirectives(createElementVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.prevMonth`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
|
|
onClick: ($event) => moveByMonth(false)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "onClick"]), [
|
|
[vShow, currentView.value === "date"]
|
|
])
|
|
], 2),
|
|
createElementVNode("span", {
|
|
role: "button",
|
|
class: normalizeClass(unref(dpNs).e("header-label")),
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
onKeydown: withKeys(($event) => showPicker("year"), ["enter"]),
|
|
onClick: ($event) => showPicker("year")
|
|
}, toDisplayString(unref(yearLabel)), 43, ["onKeydown", "onClick"]),
|
|
withDirectives(createElementVNode("span", {
|
|
role: "button",
|
|
"aria-live": "polite",
|
|
tabindex: "0",
|
|
class: normalizeClass([
|
|
unref(dpNs).e("header-label"),
|
|
{ active: currentView.value === "month" }
|
|
]),
|
|
onKeydown: withKeys(($event) => showPicker("month"), ["enter"]),
|
|
onClick: ($event) => showPicker("month")
|
|
}, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
|
|
[vShow, currentView.value === "date"]
|
|
]),
|
|
createElementVNode("span", {
|
|
class: normalizeClass(unref(dpNs).e("next-btn"))
|
|
}, [
|
|
withDirectives(createElementVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.nextMonth`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
|
|
onClick: ($event) => moveByMonth(true)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "onClick"]), [
|
|
[vShow, currentView.value === "date"]
|
|
]),
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.nextYear`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
|
|
onClick: ($event) => moveByYear(true)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label", "onClick"])
|
|
], 2)
|
|
], 2), [
|
|
[vShow, currentView.value !== "time"]
|
|
]),
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("content")),
|
|
onKeydown: handleKeydownTable
|
|
}, [
|
|
currentView.value === "date" ? (openBlock(), createBlock(DateTable, {
|
|
key: 0,
|
|
ref_key: "currentViewRef",
|
|
ref: currentViewRef,
|
|
"selection-mode": unref(selectionMode),
|
|
date: innerDate.value,
|
|
"parsed-value": _ctx.parsedValue,
|
|
"disabled-date": unref(disabledDate),
|
|
"cell-class-name": unref(cellClassName),
|
|
onPick: handleDatePick
|
|
}, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : createCommentVNode("v-if", true),
|
|
currentView.value === "year" ? (openBlock(), createBlock(YearTable, {
|
|
key: 1,
|
|
ref_key: "currentViewRef",
|
|
ref: currentViewRef,
|
|
"selection-mode": unref(selectionMode),
|
|
date: innerDate.value,
|
|
"disabled-date": unref(disabledDate),
|
|
"parsed-value": _ctx.parsedValue,
|
|
onPick: handleYearPick
|
|
}, null, 8, ["selection-mode", "date", "disabled-date", "parsed-value"])) : createCommentVNode("v-if", true),
|
|
currentView.value === "month" ? (openBlock(), createBlock(MonthTable, {
|
|
key: 2,
|
|
ref_key: "currentViewRef",
|
|
ref: currentViewRef,
|
|
"selection-mode": unref(selectionMode),
|
|
date: innerDate.value,
|
|
"parsed-value": _ctx.parsedValue,
|
|
"disabled-date": unref(disabledDate),
|
|
onPick: handleMonthPick
|
|
}, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date"])) : createCommentVNode("v-if", true)
|
|
], 34)
|
|
], 2)
|
|
], 2),
|
|
withDirectives(createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("footer"))
|
|
}, [
|
|
withDirectives(createVNode(unref(ElButton), {
|
|
text: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
disabled: unref(disabledNow),
|
|
onClick: changeToNow
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "disabled"]), [
|
|
[vShow, !unref(isMultipleType) && _ctx.showNow]
|
|
]),
|
|
createVNode(unref(ElButton), {
|
|
plain: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
disabled: unref(disabledConfirm),
|
|
onClick: onConfirm
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "disabled"])
|
|
], 2), [
|
|
[vShow, unref(footerVisible)]
|
|
])
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var DatePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__file", "panel-date-pick.vue"]]);
|
|
const panelDateRangeProps = buildProps({
|
|
...panelSharedProps,
|
|
...panelRangeSharedProps,
|
|
visible: Boolean
|
|
});
|
|
const useShortcut = (lang) => {
|
|
const { emit } = getCurrentInstance();
|
|
const attrs = useAttrs();
|
|
const slots = useSlots();
|
|
const handleShortcutClick = (shortcut) => {
|
|
const shortcutValues = shared_cjs_prodExports.isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
|
|
if (shortcutValues) {
|
|
emit("pick", [
|
|
dayjs(shortcutValues[0]).locale(lang.value),
|
|
dayjs(shortcutValues[1]).locale(lang.value)
|
|
]);
|
|
return;
|
|
}
|
|
if (shortcut.onClick) {
|
|
shortcut.onClick({
|
|
attrs,
|
|
slots,
|
|
emit
|
|
});
|
|
}
|
|
};
|
|
return handleShortcutClick;
|
|
};
|
|
const useRangePicker = (props, {
|
|
defaultValue,
|
|
leftDate,
|
|
rightDate,
|
|
unit: unit2,
|
|
onParsedValueChanged
|
|
}) => {
|
|
const { emit } = getCurrentInstance();
|
|
const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
|
|
const drpNs = useNamespace("date-range-picker");
|
|
const { t, lang } = useLocale();
|
|
const handleShortcutClick = useShortcut(lang);
|
|
const minDate = ref();
|
|
const maxDate = ref();
|
|
const rangeState = ref({
|
|
endDate: null,
|
|
selecting: false
|
|
});
|
|
const handleChangeRange = (val) => {
|
|
rangeState.value = val;
|
|
};
|
|
const handleRangeConfirm = (visible = false) => {
|
|
const _minDate = unref(minDate);
|
|
const _maxDate = unref(maxDate);
|
|
if (isValidRange([_minDate, _maxDate])) {
|
|
emit("pick", [_minDate, _maxDate], visible);
|
|
}
|
|
};
|
|
const onSelect = (selecting) => {
|
|
rangeState.value.selecting = selecting;
|
|
if (!selecting) {
|
|
rangeState.value.endDate = null;
|
|
}
|
|
};
|
|
const onReset = (parsedValue) => {
|
|
if (shared_cjs_prodExports.isArray(parsedValue) && parsedValue.length === 2) {
|
|
const [start, end] = parsedValue;
|
|
minDate.value = start;
|
|
leftDate.value = start;
|
|
maxDate.value = end;
|
|
onParsedValueChanged(unref(minDate), unref(maxDate));
|
|
} else {
|
|
restoreDefault();
|
|
}
|
|
};
|
|
const restoreDefault = () => {
|
|
const [start, end] = getDefaultValue(unref(defaultValue), {
|
|
lang: unref(lang),
|
|
unit: unit2,
|
|
unlinkPanels: props.unlinkPanels
|
|
});
|
|
minDate.value = void 0;
|
|
maxDate.value = void 0;
|
|
leftDate.value = start;
|
|
rightDate.value = end;
|
|
};
|
|
watch(defaultValue, (val) => {
|
|
if (val) {
|
|
restoreDefault();
|
|
}
|
|
}, { immediate: true });
|
|
watch(() => props.parsedValue, onReset, { immediate: true });
|
|
return {
|
|
minDate,
|
|
maxDate,
|
|
rangeState,
|
|
lang,
|
|
ppNs: pickerNs,
|
|
drpNs,
|
|
handleChangeRange,
|
|
handleRangeConfirm,
|
|
handleShortcutClick,
|
|
onSelect,
|
|
onReset,
|
|
t
|
|
};
|
|
};
|
|
const unit$2 = "month";
|
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
__name: "panel-date-range",
|
|
props: panelDateRangeProps,
|
|
emits: [
|
|
"pick",
|
|
"set-picker-option",
|
|
"calendar-change",
|
|
"panel-change"
|
|
],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const pickerBase = inject("EP_PICKER_BASE");
|
|
const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
|
|
const format = toRef(pickerBase.props, "format");
|
|
const shortcuts = toRef(pickerBase.props, "shortcuts");
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const { lang } = useLocale();
|
|
const leftDate = ref(dayjs().locale(lang.value));
|
|
const rightDate = ref(dayjs().locale(lang.value).add(1, unit$2));
|
|
const {
|
|
minDate,
|
|
maxDate,
|
|
rangeState,
|
|
ppNs,
|
|
drpNs,
|
|
handleChangeRange,
|
|
handleRangeConfirm,
|
|
handleShortcutClick,
|
|
onSelect,
|
|
onReset,
|
|
t
|
|
} = useRangePicker(props, {
|
|
defaultValue,
|
|
leftDate,
|
|
rightDate,
|
|
unit: unit$2,
|
|
onParsedValueChanged
|
|
});
|
|
watch(() => props.visible, (visible) => {
|
|
if (!visible && rangeState.value.selecting) {
|
|
onReset(props.parsedValue);
|
|
onSelect(false);
|
|
}
|
|
});
|
|
const dateUserInput = ref({
|
|
min: null,
|
|
max: null
|
|
});
|
|
const timeUserInput = ref({
|
|
min: null,
|
|
max: null
|
|
});
|
|
const leftLabel = computed(() => {
|
|
return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
|
|
});
|
|
const rightLabel = computed(() => {
|
|
return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
|
|
});
|
|
const leftYear = computed(() => {
|
|
return leftDate.value.year();
|
|
});
|
|
const leftMonth = computed(() => {
|
|
return leftDate.value.month();
|
|
});
|
|
const rightYear = computed(() => {
|
|
return rightDate.value.year();
|
|
});
|
|
const rightMonth = computed(() => {
|
|
return rightDate.value.month();
|
|
});
|
|
const hasShortcuts = computed(() => !!shortcuts.value.length);
|
|
const minVisibleDate = computed(() => {
|
|
if (dateUserInput.value.min !== null)
|
|
return dateUserInput.value.min;
|
|
if (minDate.value)
|
|
return minDate.value.format(dateFormat.value);
|
|
return "";
|
|
});
|
|
const maxVisibleDate = computed(() => {
|
|
if (dateUserInput.value.max !== null)
|
|
return dateUserInput.value.max;
|
|
if (maxDate.value || minDate.value)
|
|
return (maxDate.value || minDate.value).format(dateFormat.value);
|
|
return "";
|
|
});
|
|
const minVisibleTime = computed(() => {
|
|
if (timeUserInput.value.min !== null)
|
|
return timeUserInput.value.min;
|
|
if (minDate.value)
|
|
return minDate.value.format(timeFormat.value);
|
|
return "";
|
|
});
|
|
const maxVisibleTime = computed(() => {
|
|
if (timeUserInput.value.max !== null)
|
|
return timeUserInput.value.max;
|
|
if (maxDate.value || minDate.value)
|
|
return (maxDate.value || minDate.value).format(timeFormat.value);
|
|
return "";
|
|
});
|
|
const timeFormat = computed(() => {
|
|
return props.timeFormat || extractTimeFormat(format.value);
|
|
});
|
|
const dateFormat = computed(() => {
|
|
return props.dateFormat || extractDateFormat(format.value);
|
|
});
|
|
const isValidValue = (date) => {
|
|
return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
|
|
};
|
|
const leftPrevYear = () => {
|
|
leftDate.value = leftDate.value.subtract(1, "year");
|
|
if (!props.unlinkPanels) {
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
}
|
|
handlePanelChange("year");
|
|
};
|
|
const leftPrevMonth = () => {
|
|
leftDate.value = leftDate.value.subtract(1, "month");
|
|
if (!props.unlinkPanels) {
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
}
|
|
handlePanelChange("month");
|
|
};
|
|
const rightNextYear = () => {
|
|
if (!props.unlinkPanels) {
|
|
leftDate.value = leftDate.value.add(1, "year");
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
} else {
|
|
rightDate.value = rightDate.value.add(1, "year");
|
|
}
|
|
handlePanelChange("year");
|
|
};
|
|
const rightNextMonth = () => {
|
|
if (!props.unlinkPanels) {
|
|
leftDate.value = leftDate.value.add(1, "month");
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
} else {
|
|
rightDate.value = rightDate.value.add(1, "month");
|
|
}
|
|
handlePanelChange("month");
|
|
};
|
|
const leftNextYear = () => {
|
|
leftDate.value = leftDate.value.add(1, "year");
|
|
handlePanelChange("year");
|
|
};
|
|
const leftNextMonth = () => {
|
|
leftDate.value = leftDate.value.add(1, "month");
|
|
handlePanelChange("month");
|
|
};
|
|
const rightPrevYear = () => {
|
|
rightDate.value = rightDate.value.subtract(1, "year");
|
|
handlePanelChange("year");
|
|
};
|
|
const rightPrevMonth = () => {
|
|
rightDate.value = rightDate.value.subtract(1, "month");
|
|
handlePanelChange("month");
|
|
};
|
|
const handlePanelChange = (mode) => {
|
|
emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
|
|
};
|
|
const enableMonthArrow = computed(() => {
|
|
const nextMonth = (leftMonth.value + 1) % 12;
|
|
const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
|
|
return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
|
|
});
|
|
const enableYearArrow = computed(() => {
|
|
return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
|
|
});
|
|
const btnDisabled = computed(() => {
|
|
return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
|
|
});
|
|
const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
|
|
const formatEmit = (emitDayjs, index2) => {
|
|
if (!emitDayjs)
|
|
return;
|
|
if (defaultTime) {
|
|
const defaultTimeD = dayjs(defaultTime[index2] || defaultTime).locale(lang.value);
|
|
return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
|
|
}
|
|
return emitDayjs;
|
|
};
|
|
const handleRangePick = (val, close = true) => {
|
|
const min_ = val.minDate;
|
|
const max_ = val.maxDate;
|
|
const minDate_ = formatEmit(min_, 0);
|
|
const maxDate_ = formatEmit(max_, 1);
|
|
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
|
|
return;
|
|
}
|
|
emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
|
|
maxDate.value = maxDate_;
|
|
minDate.value = minDate_;
|
|
if (!close || showTime.value)
|
|
return;
|
|
handleRangeConfirm();
|
|
};
|
|
const minTimePickerVisible = ref(false);
|
|
const maxTimePickerVisible = ref(false);
|
|
const handleMinTimeClose = () => {
|
|
minTimePickerVisible.value = false;
|
|
};
|
|
const handleMaxTimeClose = () => {
|
|
maxTimePickerVisible.value = false;
|
|
};
|
|
const handleDateInput = (value, type) => {
|
|
dateUserInput.value[type] = value;
|
|
const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
|
|
if (parsedValueD.isValid()) {
|
|
if (disabledDate && disabledDate(parsedValueD.toDate())) {
|
|
return;
|
|
}
|
|
if (type === "min") {
|
|
leftDate.value = parsedValueD;
|
|
minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
|
|
if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
|
|
rightDate.value = parsedValueD.add(1, "month");
|
|
maxDate.value = minDate.value.add(1, "month");
|
|
}
|
|
} else {
|
|
rightDate.value = parsedValueD;
|
|
maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
|
|
if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
|
|
leftDate.value = parsedValueD.subtract(1, "month");
|
|
minDate.value = maxDate.value.subtract(1, "month");
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const handleDateChange = (_, type) => {
|
|
dateUserInput.value[type] = null;
|
|
};
|
|
const handleTimeInput = (value, type) => {
|
|
timeUserInput.value[type] = value;
|
|
const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
|
|
if (parsedValueD.isValid()) {
|
|
if (type === "min") {
|
|
minTimePickerVisible.value = true;
|
|
minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
|
|
} else {
|
|
maxTimePickerVisible.value = true;
|
|
maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
|
|
rightDate.value = maxDate.value;
|
|
}
|
|
}
|
|
};
|
|
const handleTimeChange = (value, type) => {
|
|
timeUserInput.value[type] = null;
|
|
if (type === "min") {
|
|
leftDate.value = minDate.value;
|
|
minTimePickerVisible.value = false;
|
|
if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
|
|
maxDate.value = minDate.value;
|
|
}
|
|
} else {
|
|
rightDate.value = maxDate.value;
|
|
maxTimePickerVisible.value = false;
|
|
if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
|
|
minDate.value = maxDate.value;
|
|
}
|
|
}
|
|
};
|
|
const handleMinTimePick = (value, visible, first) => {
|
|
if (timeUserInput.value.min)
|
|
return;
|
|
if (value) {
|
|
leftDate.value = value;
|
|
minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
|
|
}
|
|
if (!first) {
|
|
minTimePickerVisible.value = visible;
|
|
}
|
|
if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
|
|
maxDate.value = minDate.value;
|
|
rightDate.value = value;
|
|
}
|
|
};
|
|
const handleMaxTimePick = (value, visible, first) => {
|
|
if (timeUserInput.value.max)
|
|
return;
|
|
if (value) {
|
|
rightDate.value = value;
|
|
maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
|
|
}
|
|
if (!first) {
|
|
maxTimePickerVisible.value = visible;
|
|
}
|
|
if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
|
|
minDate.value = maxDate.value;
|
|
}
|
|
};
|
|
const handleClear = () => {
|
|
leftDate.value = getDefaultValue(unref(defaultValue), {
|
|
lang: unref(lang),
|
|
unit: "month",
|
|
unlinkPanels: props.unlinkPanels
|
|
})[0];
|
|
rightDate.value = leftDate.value.add(1, "month");
|
|
maxDate.value = void 0;
|
|
minDate.value = void 0;
|
|
emit("pick", null);
|
|
};
|
|
const formatToString = (value) => {
|
|
return shared_cjs_prodExports.isArray(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
return shared_cjs_prodExports.isArray(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
|
|
};
|
|
function onParsedValueChanged(minDate2, maxDate2) {
|
|
if (props.unlinkPanels && maxDate2) {
|
|
const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
|
|
const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
|
|
const maxDateYear = maxDate2.year();
|
|
const maxDateMonth = maxDate2.month();
|
|
rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
|
|
} else {
|
|
rightDate.value = leftDate.value.add(1, unit$2);
|
|
if (maxDate2) {
|
|
rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
|
|
}
|
|
}
|
|
}
|
|
emit("set-picker-option", ["isValidValue", isValidValue]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["formatToString", formatToString]);
|
|
emit("set-picker-option", ["handleClear", handleClear]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([
|
|
unref(ppNs).b(),
|
|
unref(drpNs).b(),
|
|
{
|
|
"has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
|
|
"has-time": unref(showTime)
|
|
}
|
|
])
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
onClick: ($event) => unref(handleShortcutClick)(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
unref(showTime) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(drpNs).e("time-header"))
|
|
}, [
|
|
createElementVNode("span", {
|
|
class: normalizeClass(unref(drpNs).e("editors-wrap"))
|
|
}, [
|
|
createElementVNode("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
disabled: unref(rangeState).selecting,
|
|
placeholder: unref(t)("el.datepicker.startDate"),
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
"model-value": unref(minVisibleDate),
|
|
"validate-event": false,
|
|
onInput: (val) => handleDateInput(val, "min"),
|
|
onChange: (val) => handleDateChange(val, "min")
|
|
}, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
|
|
], 2),
|
|
withDirectives((openBlock(), createElementBlock("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
disabled: unref(rangeState).selecting,
|
|
placeholder: unref(t)("el.datepicker.startTime"),
|
|
"model-value": unref(minVisibleTime),
|
|
"validate-event": false,
|
|
onFocus: ($event) => minTimePickerVisible.value = true,
|
|
onInput: (val) => handleTimeInput(val, "min"),
|
|
onChange: (val) => handleTimeChange(val, "min")
|
|
}, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
|
|
createVNode(unref(TimePickPanel), {
|
|
visible: minTimePickerVisible.value,
|
|
format: unref(timeFormat),
|
|
"datetime-role": "start",
|
|
"parsed-value": leftDate.value,
|
|
onPick: handleMinTimePick
|
|
}, null, 8, ["visible", "format", "parsed-value"])
|
|
], 2)), [
|
|
[unref(ClickOutside), handleMinTimeClose]
|
|
])
|
|
], 2),
|
|
createElementVNode("span", null, [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
]),
|
|
createElementVNode("span", {
|
|
class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"])
|
|
}, [
|
|
createElementVNode("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
disabled: unref(rangeState).selecting,
|
|
placeholder: unref(t)("el.datepicker.endDate"),
|
|
"model-value": unref(maxVisibleDate),
|
|
readonly: !unref(minDate),
|
|
"validate-event": false,
|
|
onInput: (val) => handleDateInput(val, "max"),
|
|
onChange: (val) => handleDateChange(val, "max")
|
|
}, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
|
|
], 2),
|
|
withDirectives((openBlock(), createElementBlock("span", {
|
|
class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
|
|
}, [
|
|
createVNode(unref(ElInput), {
|
|
size: "small",
|
|
class: normalizeClass(unref(drpNs).e("editor")),
|
|
disabled: unref(rangeState).selecting,
|
|
placeholder: unref(t)("el.datepicker.endTime"),
|
|
"model-value": unref(maxVisibleTime),
|
|
readonly: !unref(minDate),
|
|
"validate-event": false,
|
|
onFocus: ($event) => unref(minDate) && (maxTimePickerVisible.value = true),
|
|
onInput: (val) => handleTimeInput(val, "max"),
|
|
onChange: (val) => handleTimeChange(val, "max")
|
|
}, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
|
|
createVNode(unref(TimePickPanel), {
|
|
"datetime-role": "end",
|
|
visible: maxTimePickerVisible.value,
|
|
format: unref(timeFormat),
|
|
"parsed-value": rightDate.value,
|
|
onPick: handleMaxTimePick
|
|
}, null, 8, ["visible", "format", "parsed-value"])
|
|
], 2)), [
|
|
[unref(ClickOutside), handleMaxTimeClose]
|
|
])
|
|
], 2)
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevYear`),
|
|
onClick: leftPrevYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label"]),
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevMonth`),
|
|
onClick: leftPrevMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label"]),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow),
|
|
class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-right"]),
|
|
"aria-label": unref(t)(`el.datepicker.nextYear`),
|
|
onClick: leftNextYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 1,
|
|
type: "button",
|
|
disabled: !unref(enableMonthArrow),
|
|
class: normalizeClass([[
|
|
unref(ppNs).e("icon-btn"),
|
|
{ "is-disabled": !unref(enableMonthArrow) }
|
|
], "arrow-right"]),
|
|
"aria-label": unref(t)(`el.datepicker.nextMonth`),
|
|
onClick: leftNextMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
|
|
], 2),
|
|
createVNode(DateTable, {
|
|
"selection-mode": "range",
|
|
date: leftDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
"cell-class-name": unref(cellClassName),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
|
|
], 2),
|
|
createElementVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow),
|
|
class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevYear`),
|
|
onClick: rightPrevYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 1,
|
|
type: "button",
|
|
disabled: !unref(enableMonthArrow),
|
|
class: normalizeClass([[
|
|
unref(ppNs).e("icon-btn"),
|
|
{ "is-disabled": !unref(enableMonthArrow) }
|
|
], "arrow-left"]),
|
|
"aria-label": unref(t)(`el.datepicker.prevMonth`),
|
|
onClick: rightPrevMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
"aria-label": unref(t)(`el.datepicker.nextYear`),
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
|
|
onClick: rightNextYear
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label"]),
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
|
|
"aria-label": unref(t)(`el.datepicker.nextMonth`),
|
|
onClick: rightNextMonth
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-month", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["aria-label"]),
|
|
createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
|
|
], 2),
|
|
createVNode(DateTable, {
|
|
"selection-mode": "range",
|
|
date: rightDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
"cell-class-name": unref(cellClassName),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
|
|
], 2)
|
|
], 2)
|
|
], 2),
|
|
unref(showTime) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("footer"))
|
|
}, [
|
|
unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
|
|
key: 0,
|
|
text: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
onClick: handleClear
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
createVNode(unref(ElButton), {
|
|
plain: "",
|
|
size: "small",
|
|
class: normalizeClass(unref(ppNs).e("link-btn")),
|
|
disabled: unref(btnDisabled),
|
|
onClick: ($event) => unref(handleRangeConfirm)(false)
|
|
}, {
|
|
default: withCtx(() => [
|
|
createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
|
|
]),
|
|
_: 1
|
|
}, 8, ["class", "disabled", "onClick"])
|
|
], 2)) : createCommentVNode("v-if", true)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var DateRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__file", "panel-date-range.vue"]]);
|
|
const panelMonthRangeProps = buildProps({
|
|
...panelRangeSharedProps
|
|
});
|
|
const panelMonthRangeEmits = [
|
|
"pick",
|
|
"set-picker-option",
|
|
"calendar-change"
|
|
];
|
|
const useMonthRangeHeader = ({
|
|
unlinkPanels,
|
|
leftDate,
|
|
rightDate
|
|
}) => {
|
|
const { t } = useLocale();
|
|
const leftPrevYear = () => {
|
|
leftDate.value = leftDate.value.subtract(1, "year");
|
|
if (!unlinkPanels.value) {
|
|
rightDate.value = rightDate.value.subtract(1, "year");
|
|
}
|
|
};
|
|
const rightNextYear = () => {
|
|
if (!unlinkPanels.value) {
|
|
leftDate.value = leftDate.value.add(1, "year");
|
|
}
|
|
rightDate.value = rightDate.value.add(1, "year");
|
|
};
|
|
const leftNextYear = () => {
|
|
leftDate.value = leftDate.value.add(1, "year");
|
|
};
|
|
const rightPrevYear = () => {
|
|
rightDate.value = rightDate.value.subtract(1, "year");
|
|
};
|
|
const leftLabel = computed(() => {
|
|
return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
|
|
});
|
|
const rightLabel = computed(() => {
|
|
return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
|
|
});
|
|
const leftYear = computed(() => {
|
|
return leftDate.value.year();
|
|
});
|
|
const rightYear = computed(() => {
|
|
return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
|
|
});
|
|
return {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
};
|
|
};
|
|
const unit$1 = "year";
|
|
const __default__$1 = defineComponent({
|
|
name: "DatePickerMonthRange"
|
|
});
|
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
...__default__$1,
|
|
props: panelMonthRangeProps,
|
|
emits: panelMonthRangeEmits,
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const { lang } = useLocale();
|
|
const pickerBase = inject("EP_PICKER_BASE");
|
|
const { shortcuts, disabledDate } = pickerBase.props;
|
|
const format = toRef(pickerBase.props, "format");
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const leftDate = ref(dayjs().locale(lang.value));
|
|
const rightDate = ref(dayjs().locale(lang.value).add(1, unit$1));
|
|
const {
|
|
minDate,
|
|
maxDate,
|
|
rangeState,
|
|
ppNs,
|
|
drpNs,
|
|
handleChangeRange,
|
|
handleRangeConfirm,
|
|
handleShortcutClick,
|
|
onSelect
|
|
} = useRangePicker(props, {
|
|
defaultValue,
|
|
leftDate,
|
|
rightDate,
|
|
unit: unit$1,
|
|
onParsedValueChanged
|
|
});
|
|
const hasShortcuts = computed(() => !!shortcuts.length);
|
|
const {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
} = useMonthRangeHeader({
|
|
unlinkPanels: toRef(props, "unlinkPanels"),
|
|
leftDate,
|
|
rightDate
|
|
});
|
|
const enableYearArrow = computed(() => {
|
|
return props.unlinkPanels && rightYear.value > leftYear.value + 1;
|
|
});
|
|
const handleRangePick = (val, close = true) => {
|
|
const minDate_ = val.minDate;
|
|
const maxDate_ = val.maxDate;
|
|
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
|
|
return;
|
|
}
|
|
emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
|
|
maxDate.value = maxDate_;
|
|
minDate.value = minDate_;
|
|
if (!close)
|
|
return;
|
|
handleRangeConfirm();
|
|
};
|
|
const handleClear = () => {
|
|
leftDate.value = getDefaultValue(unref(defaultValue), {
|
|
lang: unref(lang),
|
|
unit: "year",
|
|
unlinkPanels: props.unlinkPanels
|
|
})[0];
|
|
rightDate.value = leftDate.value.add(1, "year");
|
|
emit("pick", null);
|
|
};
|
|
const formatToString = (value) => {
|
|
return shared_cjs_prodExports.isArray(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
|
|
};
|
|
const parseUserInput = (value) => {
|
|
return shared_cjs_prodExports.isArray(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
|
|
};
|
|
function onParsedValueChanged(minDate2, maxDate2) {
|
|
if (props.unlinkPanels && maxDate2) {
|
|
const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
|
|
const maxDateYear = maxDate2.year();
|
|
rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
|
|
} else {
|
|
rightDate.value = leftDate.value.add(1, unit$1);
|
|
}
|
|
}
|
|
emit("set-picker-option", ["isValidValue", isValidRange]);
|
|
emit("set-picker-option", ["formatToString", formatToString]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["handleClear", handleClear]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass([
|
|
unref(ppNs).b(),
|
|
unref(drpNs).b(),
|
|
{
|
|
"has-sidebar": Boolean(_ctx.$slots.sidebar) || unref(hasShortcuts)
|
|
}
|
|
])
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
onClick: ($event) => unref(handleShortcutClick)(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
|
|
onClick: unref(leftPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["onClick"]),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow),
|
|
class: normalizeClass([[
|
|
unref(ppNs).e("icon-btn"),
|
|
{ [unref(ppNs).is("disabled")]: !unref(enableYearArrow) }
|
|
], "d-arrow-right"]),
|
|
onClick: unref(leftNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
|
|
], 2),
|
|
createVNode(MonthTable, {
|
|
"selection-mode": "range",
|
|
date: leftDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
|
|
], 2),
|
|
createElementVNode("div", {
|
|
class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow),
|
|
class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
|
|
onClick: unref(rightPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
|
|
onClick: unref(rightNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["onClick"]),
|
|
createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
|
|
], 2),
|
|
createVNode(MonthTable, {
|
|
"selection-mode": "range",
|
|
date: rightDate.value,
|
|
"min-date": unref(minDate),
|
|
"max-date": unref(maxDate),
|
|
"range-state": unref(rangeState),
|
|
"disabled-date": unref(disabledDate),
|
|
onChangerange: unref(handleChangeRange),
|
|
onPick: handleRangePick,
|
|
onSelect: unref(onSelect)
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
|
|
], 2)
|
|
], 2)
|
|
], 2)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var MonthRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__file", "panel-month-range.vue"]]);
|
|
const panelYearRangeProps = buildProps({
|
|
...panelRangeSharedProps
|
|
});
|
|
const panelYearRangeEmits = [
|
|
"pick",
|
|
"set-picker-option",
|
|
"calendar-change"
|
|
];
|
|
const useYearRangeHeader = ({
|
|
unlinkPanels,
|
|
leftDate,
|
|
rightDate
|
|
}) => {
|
|
const leftPrevYear = () => {
|
|
leftDate.value = leftDate.value.subtract(10, "year");
|
|
if (!unlinkPanels.value) {
|
|
rightDate.value = rightDate.value.subtract(10, "year");
|
|
}
|
|
};
|
|
const rightNextYear = () => {
|
|
if (!unlinkPanels.value) {
|
|
leftDate.value = leftDate.value.add(10, "year");
|
|
}
|
|
rightDate.value = rightDate.value.add(10, "year");
|
|
};
|
|
const leftNextYear = () => {
|
|
leftDate.value = leftDate.value.add(10, "year");
|
|
};
|
|
const rightPrevYear = () => {
|
|
rightDate.value = rightDate.value.subtract(10, "year");
|
|
};
|
|
const leftLabel = computed(() => {
|
|
const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
|
|
return `${leftStartDate}-${leftStartDate + 9}`;
|
|
});
|
|
const rightLabel = computed(() => {
|
|
const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
|
|
return `${rightStartDate}-${rightStartDate + 9}`;
|
|
});
|
|
const leftYear = computed(() => {
|
|
const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
|
|
return leftEndDate;
|
|
});
|
|
const rightYear = computed(() => {
|
|
const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
|
|
return rightStartDate;
|
|
});
|
|
return {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
};
|
|
};
|
|
const unit = "year";
|
|
const __default__ = defineComponent({
|
|
name: "DatePickerYearRange"
|
|
});
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
...__default__,
|
|
props: panelYearRangeProps,
|
|
emits: panelYearRangeEmits,
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const { lang } = useLocale();
|
|
const leftDate = ref(dayjs().locale(lang.value));
|
|
const rightDate = ref(leftDate.value.add(10, "year"));
|
|
const { pickerNs: ppNs } = inject(ROOT_PICKER_INJECTION_KEY);
|
|
const drpNs = useNamespace("date-range-picker");
|
|
const hasShortcuts = computed(() => !!shortcuts.length);
|
|
const panelKls = computed(() => [
|
|
ppNs.b(),
|
|
drpNs.b(),
|
|
{
|
|
"has-sidebar": Boolean(useSlots().sidebar) || hasShortcuts.value
|
|
}
|
|
]);
|
|
const leftPanelKls = computed(() => {
|
|
return {
|
|
content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
|
|
arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
|
|
arrowRightBtn: [
|
|
ppNs.e("icon-btn"),
|
|
{ [ppNs.is("disabled")]: !enableYearArrow.value },
|
|
"d-arrow-right"
|
|
]
|
|
};
|
|
});
|
|
const rightPanelKls = computed(() => {
|
|
return {
|
|
content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
|
|
arrowLeftBtn: [
|
|
ppNs.e("icon-btn"),
|
|
{ "is-disabled": !enableYearArrow.value },
|
|
"d-arrow-left"
|
|
],
|
|
arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
|
|
};
|
|
});
|
|
const handleShortcutClick = useShortcut(lang);
|
|
const {
|
|
leftPrevYear,
|
|
rightNextYear,
|
|
leftNextYear,
|
|
rightPrevYear,
|
|
leftLabel,
|
|
rightLabel,
|
|
leftYear,
|
|
rightYear
|
|
} = useYearRangeHeader({
|
|
unlinkPanels: toRef(props, "unlinkPanels"),
|
|
leftDate,
|
|
rightDate
|
|
});
|
|
const enableYearArrow = computed(() => {
|
|
return props.unlinkPanels && rightYear.value > leftYear.value + 1;
|
|
});
|
|
const minDate = ref();
|
|
const maxDate = ref();
|
|
const rangeState = ref({
|
|
endDate: null,
|
|
selecting: false
|
|
});
|
|
const handleChangeRange = (val) => {
|
|
rangeState.value = val;
|
|
};
|
|
const handleRangePick = (val, close = true) => {
|
|
const minDate_ = val.minDate;
|
|
const maxDate_ = val.maxDate;
|
|
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
|
|
return;
|
|
}
|
|
emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
|
|
maxDate.value = maxDate_;
|
|
minDate.value = minDate_;
|
|
if (!close)
|
|
return;
|
|
handleConfirm();
|
|
};
|
|
const handleConfirm = (visible = false) => {
|
|
if (isValidRange([minDate.value, maxDate.value])) {
|
|
emit("pick", [minDate.value, maxDate.value], visible);
|
|
}
|
|
};
|
|
const onSelect = (selecting) => {
|
|
rangeState.value.selecting = selecting;
|
|
if (!selecting) {
|
|
rangeState.value.endDate = null;
|
|
}
|
|
};
|
|
const pickerBase = inject("EP_PICKER_BASE");
|
|
const { shortcuts, disabledDate } = pickerBase.props;
|
|
const format = toRef(pickerBase.props, "format");
|
|
const defaultValue = toRef(pickerBase.props, "defaultValue");
|
|
const getDefaultValue2 = () => {
|
|
let start;
|
|
if (shared_cjs_prodExports.isArray(defaultValue.value)) {
|
|
const left = dayjs(defaultValue.value[0]);
|
|
let right = dayjs(defaultValue.value[1]);
|
|
if (!props.unlinkPanels) {
|
|
right = left.add(10, unit);
|
|
}
|
|
return [left, right];
|
|
} else if (defaultValue.value) {
|
|
start = dayjs(defaultValue.value);
|
|
} else {
|
|
start = dayjs();
|
|
}
|
|
start = start.locale(lang.value);
|
|
return [start, start.add(10, unit)];
|
|
};
|
|
watch(() => defaultValue.value, (val) => {
|
|
if (val) {
|
|
const defaultArr = getDefaultValue2();
|
|
leftDate.value = defaultArr[0];
|
|
rightDate.value = defaultArr[1];
|
|
}
|
|
}, { immediate: true });
|
|
watch(() => props.parsedValue, (newVal) => {
|
|
if (newVal && newVal.length === 2) {
|
|
minDate.value = newVal[0];
|
|
maxDate.value = newVal[1];
|
|
leftDate.value = minDate.value;
|
|
if (props.unlinkPanels && maxDate.value) {
|
|
const minDateYear = minDate.value.year();
|
|
const maxDateYear = maxDate.value.year();
|
|
rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(10, "year") : maxDate.value;
|
|
} else {
|
|
rightDate.value = leftDate.value.add(10, "year");
|
|
}
|
|
} else {
|
|
const defaultArr = getDefaultValue2();
|
|
minDate.value = void 0;
|
|
maxDate.value = void 0;
|
|
leftDate.value = defaultArr[0];
|
|
rightDate.value = defaultArr[1];
|
|
}
|
|
}, { immediate: true });
|
|
const parseUserInput = (value) => {
|
|
return shared_cjs_prodExports.isArray(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
|
|
};
|
|
const formatToString = (value) => {
|
|
return shared_cjs_prodExports.isArray(value) ? value.map((day) => day.format(format.value)) : value.format(format.value);
|
|
};
|
|
const isValidValue = (date) => {
|
|
return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
|
|
};
|
|
const handleClear = () => {
|
|
const defaultArr = getDefaultValue2();
|
|
leftDate.value = defaultArr[0];
|
|
rightDate.value = defaultArr[1];
|
|
maxDate.value = void 0;
|
|
minDate.value = void 0;
|
|
emit("pick", null);
|
|
};
|
|
emit("set-picker-option", ["isValidValue", isValidValue]);
|
|
emit("set-picker-option", ["parseUserInput", parseUserInput]);
|
|
emit("set-picker-option", ["formatToString", formatToString]);
|
|
emit("set-picker-option", ["handleClear", handleClear]);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", {
|
|
class: normalizeClass(unref(panelKls))
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body-wrapper"))
|
|
}, [
|
|
renderSlot(_ctx.$slots, "sidebar", {
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}),
|
|
unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
|
|
key: 0,
|
|
class: normalizeClass(unref(ppNs).e("sidebar"))
|
|
}, [
|
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
|
|
return openBlock(), createElementBlock("button", {
|
|
key,
|
|
type: "button",
|
|
class: normalizeClass(unref(ppNs).e("shortcut")),
|
|
onClick: ($event) => unref(handleShortcutClick)(shortcut)
|
|
}, toDisplayString(shortcut.text), 11, ["onClick"]);
|
|
}), 128))
|
|
], 2)) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(ppNs).e("body"))
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(leftPanelKls).content)
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass(unref(leftPanelKls).arrowLeftBtn),
|
|
onClick: unref(leftPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["onClick"]),
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow),
|
|
class: normalizeClass(unref(leftPanelKls).arrowRightBtn),
|
|
onClick: unref(leftNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
|
|
], 2),
|
|
createVNode(YearTable, {
|
|
"selection-mode": "range",
|
|
date: leftDate.value,
|
|
"min-date": minDate.value,
|
|
"max-date": maxDate.value,
|
|
"range-state": rangeState.value,
|
|
"disabled-date": unref(disabledDate),
|
|
onChangerange: handleChangeRange,
|
|
onPick: handleRangePick,
|
|
onSelect
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
|
|
], 2),
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(rightPanelKls).content)
|
|
}, [
|
|
createElementVNode("div", {
|
|
class: normalizeClass(unref(drpNs).e("header"))
|
|
}, [
|
|
_ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
|
|
key: 0,
|
|
type: "button",
|
|
disabled: !unref(enableYearArrow),
|
|
class: normalizeClass(unref(rightPanelKls).arrowLeftBtn),
|
|
onClick: unref(rightPrevYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "prev-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_left_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
|
|
createElementVNode("button", {
|
|
type: "button",
|
|
class: normalizeClass(unref(rightPanelKls).arrowRightBtn),
|
|
onClick: unref(rightNextYear)
|
|
}, [
|
|
renderSlot(_ctx.$slots, "next-year", {}, () => [
|
|
createVNode(unref(ElIcon), null, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(d_arrow_right_default))
|
|
]),
|
|
_: 1
|
|
})
|
|
])
|
|
], 10, ["onClick"]),
|
|
createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
|
|
], 2),
|
|
createVNode(YearTable, {
|
|
"selection-mode": "range",
|
|
date: rightDate.value,
|
|
"min-date": minDate.value,
|
|
"max-date": maxDate.value,
|
|
"range-state": rangeState.value,
|
|
"disabled-date": unref(disabledDate),
|
|
onChangerange: handleChangeRange,
|
|
onPick: handleRangePick,
|
|
onSelect
|
|
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
|
|
], 2)
|
|
], 2)
|
|
], 2)
|
|
], 2);
|
|
};
|
|
}
|
|
});
|
|
var YearRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__file", "panel-year-range.vue"]]);
|
|
const getPanel = function(type) {
|
|
switch (type) {
|
|
case "daterange":
|
|
case "datetimerange": {
|
|
return DateRangePickPanel;
|
|
}
|
|
case "monthrange": {
|
|
return MonthRangePickPanel;
|
|
}
|
|
case "yearrange": {
|
|
return YearRangePickPanel;
|
|
}
|
|
default: {
|
|
return DatePickPanel;
|
|
}
|
|
}
|
|
};
|
|
dayjs.extend(localeData);
|
|
dayjs.extend(advancedFormat);
|
|
dayjs.extend(customParseFormat);
|
|
dayjs.extend(weekOfYear);
|
|
dayjs.extend(weekYear);
|
|
dayjs.extend(dayOfYear);
|
|
dayjs.extend(isSameOrAfter);
|
|
dayjs.extend(isSameOrBefore);
|
|
var DatePicker = defineComponent({
|
|
name: "ElDatePicker",
|
|
install: null,
|
|
props: datePickerProps,
|
|
emits: ["update:modelValue"],
|
|
setup(props, {
|
|
expose,
|
|
emit,
|
|
slots
|
|
}) {
|
|
const ns = useNamespace("picker-panel");
|
|
provide("ElPopperOptions", reactive(toRef(props, "popperOptions")));
|
|
provide(ROOT_PICKER_INJECTION_KEY, {
|
|
slots,
|
|
pickerNs: ns
|
|
});
|
|
const commonPicker = ref();
|
|
const refProps = {
|
|
focus: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.focus();
|
|
},
|
|
blur: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.blur();
|
|
},
|
|
handleOpen: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
|
|
},
|
|
handleClose: () => {
|
|
var _a;
|
|
(_a = commonPicker.value) == null ? void 0 : _a.handleClose();
|
|
}
|
|
};
|
|
expose(refProps);
|
|
const onModelValueUpdated = (val) => {
|
|
emit("update:modelValue", val);
|
|
};
|
|
return () => {
|
|
var _a;
|
|
const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
|
|
const Component = getPanel(props.type);
|
|
return createVNode(CommonPicker, mergeProps(props, {
|
|
"format": format,
|
|
"type": props.type,
|
|
"ref": commonPicker,
|
|
"onUpdate:modelValue": onModelValueUpdated
|
|
}), {
|
|
default: (scopedProps) => createVNode(Component, scopedProps, {
|
|
"prev-month": slots["prev-month"],
|
|
"next-month": slots["next-month"],
|
|
"prev-year": slots["prev-year"],
|
|
"next-year": slots["next-year"]
|
|
}),
|
|
"range-separator": slots["range-separator"]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
const ElDatePicker = withInstall(DatePicker);
|
|
const _imports_0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAyKADAAQAAAABAAAAyAAAAACbWz2VAAAKXElEQVR4Ae2dTWhUVxSAO84ws6mGWCmFFkWoaRepraUu3HRZGtraVeif3YsQGGqxxkgCkYRQSAmEanDRlRRLdm6yctFScGFx09BFpIhCIQU1hOBiJjOZnleVTCaTO+/de99k5p5PGJx595777vnO+WYy5o2TqdVq2Rf4AwEINCWwp+lRDkIAAv8TQBAaAQIGAghigMMQBBCEHoCAgQCCGOAwBAEEoQcgYCCAIAY4DEEAQegBCBgIIIgBDkMQQBB6AAIGAghigMMQBBCEHoCAgQCCGOAwBAEEoQcgYCCAIAY4DEEAQegBCBgIIIgBDkMQQBB6AAIGAghigMMQBBCEHoCAgQCCGOAwBAEEoQcgYCCAIAY4DEEAQegBCBgIIIgBDkMQQBB6AAIGAghigMMQBBCEHoCAgQCCGOAwBAEEoQcgYCCAIAY4DEEAQegBCBgIIIgBDkMQQBB6AAIGAghigMMQBBCEHoCAgQCCGOAwBAEEoQcgYCCAIAY4DEEAQegBCBgI5AxjDAVEYGFhIbe4uHiwVCodjtIqFAr3+vv7HwwMDFQCStN7KplarZb1vioLdgyB2dnZ/SsrK2elzmfktrd+Y5lMZk1ul3t7e6eHhoYe149x/ykBBAm4EyYnJ98vl8s/S4qvtEhzOZ/Pf3nhwoXfWsxTN4wggZZ8YmLixPr6+k1JLx8zxfKePXs+Hx0dvRFzvoppvEkPsMwzMzN7K5XKNUktrhwRhfzGxsb18fHxkwEisU4JQazRdW7g6upq9J7jkMUOkaQBGoI0AOn2h/Pz83mR47RDHkhSBw9B6mCEcHdpaem45HHAMRckeQYQQRw7qdPCq9XqEU97QhIBiSCeuinQZdRLgiCBdXY2m73rOSXVkiCI527a7eX6+vpuyx4eet6HWkkQxHMn7fZyg4ODZbl8ZC6FfaiUBEFS6KTdXrKnp2daJLmfwj7USYIgKXTRbi9ZLBbXcrncKdlHOYW9qJIEQVLooE5YcmRk5FZ0bRWSuFUDQdz4dXR0dOEhkriVCEHc+HV8NJK4lQhB3Ph1RTSS2JcJQezZdVUkktiVC0HsuHVlFJIkLxuCJGfW1RFIkqx8CJKMVxCzkSR+GREkPqugZiJJvHIiSDxOQc5CktZlRZDWjIKegSTm8iKImY+KUSTZucwIsjMbVSNI0rzcCNKci8qjSLK97AiynYnqI0iytfwIspUHj4QAkmy2AYJssuBeHQEkeQoDQeqagrtbCSAJ/y/W1o7g0TYC2iXhFWRbS3CgkYBmSRCksRt43JSAVkkQpGk7cLAZAY2SIEizTuDYjgS0SYIgO7YCAzsR0CQJguzUBRw3EtAiCYIY24BBEwENkiCIqQMYa0kgdEkQpGULMKEVgZAlQZBW1Wc8FoFQJUGQWOVnUhwCIUqCIHEqz5zYBEKTBEFil56JcQmEJAmCxK068xIRCEUSBElUdiYnIRCCJAiSpOLMTUyg2yXJ1Gq1bOKsYwRcvXr1xeXl5Xdl6n655WKEMCVgAtJn78mtmFIvlKNv0opk9I3QuyBTU1NHS6XSVwLjU9ns6743zHoQaEZAvtW3KrfvRJKZZuO2x7wKMj4+fmpjY+Nb2Uy/7YaIg4AtAXlSrskryezY2Ng3tms0xnkT5Jkc38sJXm48CY8h0C4C8ipSk9ukvJKM+TinF0EuXbr0TrVa/Uk2dNTHplgDAo4EyoVC4YPh4eHfHdd5wcu/Yskr2xeyEeRwrQbxvgjk5X3wlI/FnAWZm5t7Sd53fORjM6wBAV8E5En7+PT09Guu6zkL8ujRoz7ZxJuuGyEeAj4JyPuQ7JMnTz52XdNZEHnv8arrJoiHQBoE5FXkLdd1nQURUzOumyAeAp1KwFmQXC73T6cmx750E5Dn7j9dCTgLks1m/5ZN/OW6EeIh4JlAZd++fQuuazoLcu7cuX/FVOeNuCZCPAQaCPxRLBbvNxxL/NBZkOiM8kuZX0SSO4nPTgAE0iFQlh/9R3ws7UWQ8+fP34mugRFJeD/ioyqsYU1AejC6Hmv64sWLv1ovUhfo5VKT5+vJJSdfyy8Ni/LPa28/P8bfEGgXAem7SI4f5WLF6LJ6L3+8ChLtaGJi4lilUvlM7n4i+33Dyy5ZBAItCMgrR3S5+7BcpPhDi6mJhr0L8vzsV65c2Se/ZT8mryi9cowPTD0Ho/RvebLkA1NKa0/aLQjIRyFOyhPldZmWbzHVZji1TxNGm/HyJt0mK2J0EOhmOaIKIYiOPt2VLLtdDgTZlbbRcdIQ5EAQHb3a9ixDkQNB2t464Z8wJDkQJPx+bWuGocmBIG1tn7BPFqIcCBJ2z7Ytu1DlQJC2tVC4JwpZDgQJt2/bklnociBIW9oozJNokANBwuzd1LPSIgeCpN5K4Z1AkxwIEl7/ppqRNjkQJNV2CmtxjXIgSFg9nFo2WuVAkNRaKpyFNcuBIOH0cSqZaJcDQVJpqzAWRY6ndeQThWH0s9cskGMTJ4JssuCeEECOrW2AIFt5qH6EHNvLjyDbmag8ghzNy44gzbmoOoocO5cbQXZmo2IEOcxlRhAzn6BHkaN1eRGkNaMgZyBHvLIiSDxOQc1CjvjlRJD4rIKYiRzJyoggyXh19WzkSF4+BEnOrCsjkMOubAhix62ropDDvlwIYs+uKyKRw61MCOLGr6OjkcO9PKl9R6H71ljBhYB8meqJ9fX1m7JG133tmUvevmN5BfFNtAPWm5mZ2SvfNHxNtoIcjvVAEEeAnRi+urp6Vr5V9lAKe0v1CzNT2K/zkgjijLCzFpifn8+LHKdT2JU6OSKGCJJCJ+3mkktLS8fl/Ac870GlHBFDBPHcSbu9XLVaPeJ5D2rliDgiiOduCmw51XIgSGDdHKWTzWbvekpLvRwRR15BPHVTpyzT19d3W/by0HE/yPEMIII4dlKnhQ8ODpYzmcycw76Qow4egtTBCOVuT0/PtEhy3yIf5GiAhiANQEJ4WCwW13K53CnJpZwgH+RoAgtBmkAJ4dDIyMitfD7/oeSyHCOf5Wju6OjojRhzVU3hYsXAyz07O7t/ZWUluvTkjNz21qcrP4atye1yb2/v9NDQ0OP6Me4/JYAgSjphYWEht7i4eLBUKh2OUi4UCvf6+/sfDAwMVJQgsEoTQaywEaSFAO9BtFSaPK0IIIgVNoK0EEAQLZUmTysCCGKFjSAtBBBES6XJ04oAglhhI0gLAQTRUmnytCKAIFbYCNJCAEG0VJo8rQggiBU2grQQQBAtlSZPKwIIYoWNIC0EEERLpcnTigCCWGEjSAsBBNFSafK0IoAgVtgI0kIAQbRUmjytCCCIFTaCtBBAEC2VJk8rAghihY0gLQQQREulydOKAIJYYSNICwEE0VJp8rQigCBW2AjSQgBBtFSaPK0IIIgVNoK0EEAQLZUmTysCCGKFjSAtBBBES6XJ04oAglhhI0gLAQTRUmnytCKAIFbYCNJCAEG0VJo8rQggiBU2grQQQBAtlSZPKwIIYoWNIC0EEERLpcnTigCCWGEjSAsBBNFSafK0IoAgVtgI0kLgP02yRT2ww5JTAAAAAElFTkSuQmCC";
|
|
const _imports_2 = "" + buildAssetsURL("calendar-icon.BGBc-vDw.svg");
|
|
const _imports_3 = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='18px'%20height='18px'%20viewBox='387%20609%2018%2018'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3cfilter%20x='387px'%20y='609px'%20width='18px'%20height='18px'%20filterUnits='userSpaceOnUse'%20id='filter1260'%3e%3cfeOffset%20dx='0'%20dy='0'%20in='SourceAlpha'%20result='shadowOffsetInner'%20/%3e%3cfeGaussianBlur%20stdDeviation='1.5'%20in='shadowOffsetInner'%20result='shadowGaussian'%20/%3e%3cfeComposite%20in2='shadowGaussian'%20operator='atop'%20in='SourceAlpha'%20result='shadowComposite'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.117647058823529%200%20'%20in='shadowComposite'%20/%3e%3c/filter%3e%3cg%20id='widget1261'%3e%3cpath%20d='M%20390.5%20612.5%20L%20401.5%20612.5%20L%20401.5%20623.5%20L%20390.5%20623.5%20L%20390.5%20612.5%20Z%20'%20fill-rule='nonzero'%20fill='%23ffffff'%20stroke='none'%20/%3e%3cpath%20d='M%20390.5%20612.5%20L%20401.5%20612.5%20L%20401.5%20623.5%20L%20390.5%20623.5%20L%20390.5%20612.5%20Z%20'%20stroke-width='1'%20stroke='%23797979'%20fill='none'%20/%3e%3c/g%3e%3c/defs%3e%3cuse%20xlink:href='%23widget1261'%20filter='url(%23filter1260)'%20/%3e%3cuse%20xlink:href='%23widget1261'%20/%3e%3c/svg%3e";
|
|
const _imports_4 = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='18px'%20height='18px'%20viewBox='387%20609%2018%2018'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3cfilter%20x='387px'%20y='609px'%20width='18px'%20height='18px'%20filterUnits='userSpaceOnUse'%20id='filter1262'%3e%3cfeOffset%20dx='0'%20dy='0'%20in='SourceAlpha'%20result='shadowOffsetInner'%20/%3e%3cfeGaussianBlur%20stdDeviation='1.5'%20in='shadowOffsetInner'%20result='shadowGaussian'%20/%3e%3cfeComposite%20in2='shadowGaussian'%20operator='atop'%20in='SourceAlpha'%20result='shadowComposite'%20/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.117647058823529%200%20'%20in='shadowComposite'%20/%3e%3c/filter%3e%3cg%20id='widget1263'%3e%3cpath%20d='M%20390.5%20612.5%20L%20401.5%20612.5%20L%20401.5%20623.5%20L%20390.5%20623.5%20L%20390.5%20612.5%20Z%20'%20fill-rule='nonzero'%20fill='%23ffffff'%20stroke='none'%20/%3e%3cpath%20d='M%20390.5%20612.5%20L%20401.5%20612.5%20L%20401.5%20623.5%20L%20390.5%20623.5%20L%20390.5%20612.5%20Z%20'%20stroke-width='1'%20stroke='%23797979'%20fill='none'%20/%3e%3c/g%3e%3c/defs%3e%3cuse%20xlink:href='%23widget1263'%20filter='url(%23filter1262)'%20/%3e%3cuse%20xlink:href='%23widget1263'%20/%3e%3cpath%20d='M%20392.571428571429%20618%20L%20395.142857142857%20620.571428571429%20L%20399.428571428571%20614.571428571429%20'%20stroke-width='2.57142857142857'%20stroke='%23797979'%20fill='none'%20/%3e%3c/svg%3e";
|
|
/*! Element Plus v2.9.4 */
|
|
var zhCn = {
|
|
name: "zh-cn",
|
|
el: {
|
|
breadcrumb: {
|
|
label: "\u9762\u5305\u5C51"
|
|
},
|
|
colorpicker: {
|
|
confirm: "\u786E\u5B9A",
|
|
clear: "\u6E05\u7A7A",
|
|
defaultLabel: "\u989C\u8272\u9009\u62E9\u5668",
|
|
description: "\u5F53\u524D\u989C\u8272 {color}\uFF0C\u6309 Enter \u952E\u9009\u62E9\u65B0\u989C\u8272",
|
|
alphaLabel: "\u9009\u62E9\u900F\u660E\u5EA6\u7684\u503C"
|
|
},
|
|
datepicker: {
|
|
now: "\u6B64\u523B",
|
|
today: "\u4ECA\u5929",
|
|
cancel: "\u53D6\u6D88",
|
|
clear: "\u6E05\u7A7A",
|
|
confirm: "\u786E\u5B9A",
|
|
dateTablePrompt: "\u4F7F\u7528\u65B9\u5411\u952E\u4E0E Enter \u952E\u53EF\u9009\u62E9\u65E5\u671F",
|
|
monthTablePrompt: "\u4F7F\u7528\u65B9\u5411\u952E\u4E0E Enter \u952E\u53EF\u9009\u62E9\u6708\u4EFD",
|
|
yearTablePrompt: "\u4F7F\u7528\u65B9\u5411\u952E\u4E0E Enter \u952E\u53EF\u9009\u62E9\u5E74\u4EFD",
|
|
selectedDate: "\u5DF2\u9009\u65E5\u671F",
|
|
selectDate: "\u9009\u62E9\u65E5\u671F",
|
|
selectTime: "\u9009\u62E9\u65F6\u95F4",
|
|
startDate: "\u5F00\u59CB\u65E5\u671F",
|
|
startTime: "\u5F00\u59CB\u65F6\u95F4",
|
|
endDate: "\u7ED3\u675F\u65E5\u671F",
|
|
endTime: "\u7ED3\u675F\u65F6\u95F4",
|
|
prevYear: "\u524D\u4E00\u5E74",
|
|
nextYear: "\u540E\u4E00\u5E74",
|
|
prevMonth: "\u4E0A\u4E2A\u6708",
|
|
nextMonth: "\u4E0B\u4E2A\u6708",
|
|
year: "\u5E74",
|
|
month1: "1 \u6708",
|
|
month2: "2 \u6708",
|
|
month3: "3 \u6708",
|
|
month4: "4 \u6708",
|
|
month5: "5 \u6708",
|
|
month6: "6 \u6708",
|
|
month7: "7 \u6708",
|
|
month8: "8 \u6708",
|
|
month9: "9 \u6708",
|
|
month10: "10 \u6708",
|
|
month11: "11 \u6708",
|
|
month12: "12 \u6708",
|
|
weeks: {
|
|
sun: "\u65E5",
|
|
mon: "\u4E00",
|
|
tue: "\u4E8C",
|
|
wed: "\u4E09",
|
|
thu: "\u56DB",
|
|
fri: "\u4E94",
|
|
sat: "\u516D"
|
|
},
|
|
weeksFull: {
|
|
sun: "\u661F\u671F\u65E5",
|
|
mon: "\u661F\u671F\u4E00",
|
|
tue: "\u661F\u671F\u4E8C",
|
|
wed: "\u661F\u671F\u4E09",
|
|
thu: "\u661F\u671F\u56DB",
|
|
fri: "\u661F\u671F\u4E94",
|
|
sat: "\u661F\u671F\u516D"
|
|
},
|
|
months: {
|
|
jan: "\u4E00\u6708",
|
|
feb: "\u4E8C\u6708",
|
|
mar: "\u4E09\u6708",
|
|
apr: "\u56DB\u6708",
|
|
may: "\u4E94\u6708",
|
|
jun: "\u516D\u6708",
|
|
jul: "\u4E03\u6708",
|
|
aug: "\u516B\u6708",
|
|
sep: "\u4E5D\u6708",
|
|
oct: "\u5341\u6708",
|
|
nov: "\u5341\u4E00\u6708",
|
|
dec: "\u5341\u4E8C\u6708"
|
|
}
|
|
},
|
|
inputNumber: {
|
|
decrease: "\u51CF\u5C11\u6570\u503C",
|
|
increase: "\u589E\u52A0\u6570\u503C"
|
|
},
|
|
select: {
|
|
loading: "\u52A0\u8F7D\u4E2D",
|
|
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
|
|
noData: "\u65E0\u6570\u636E",
|
|
placeholder: "\u8BF7\u9009\u62E9"
|
|
},
|
|
dropdown: {
|
|
toggleDropdown: "\u5207\u6362\u4E0B\u62C9\u9009\u9879"
|
|
},
|
|
mention: {
|
|
loading: "\u52A0\u8F7D\u4E2D"
|
|
},
|
|
cascader: {
|
|
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
|
|
loading: "\u52A0\u8F7D\u4E2D",
|
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
noData: "\u6682\u65E0\u6570\u636E"
|
|
},
|
|
pagination: {
|
|
goto: "\u524D\u5F80",
|
|
pagesize: "\u6761/\u9875",
|
|
total: "\u5171 {total} \u6761",
|
|
pageClassifier: "\u9875",
|
|
page: "\u9875",
|
|
prev: "\u4E0A\u4E00\u9875",
|
|
next: "\u4E0B\u4E00\u9875",
|
|
currentPage: "\u7B2C {pager} \u9875",
|
|
prevPages: "\u5411\u524D {pager} \u9875",
|
|
nextPages: "\u5411\u540E {pager} \u9875",
|
|
deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
|
|
},
|
|
dialog: {
|
|
close: "\u5173\u95ED\u6B64\u5BF9\u8BDD\u6846"
|
|
},
|
|
drawer: {
|
|
close: "\u5173\u95ED\u6B64\u5BF9\u8BDD\u6846"
|
|
},
|
|
messagebox: {
|
|
title: "\u63D0\u793A",
|
|
confirm: "\u786E\u5B9A",
|
|
cancel: "\u53D6\u6D88",
|
|
error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!",
|
|
close: "\u5173\u95ED\u6B64\u5BF9\u8BDD\u6846"
|
|
},
|
|
upload: {
|
|
deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
|
|
delete: "\u5220\u9664",
|
|
preview: "\u67E5\u770B\u56FE\u7247",
|
|
continue: "\u7EE7\u7EED\u4E0A\u4F20"
|
|
},
|
|
slider: {
|
|
defaultLabel: "\u6ED1\u5757\u4ECB\u4E8E {min} \u81F3 {max}",
|
|
defaultRangeStartLabel: "\u9009\u62E9\u8D77\u59CB\u503C",
|
|
defaultRangeEndLabel: "\u9009\u62E9\u7ED3\u675F\u503C"
|
|
},
|
|
table: {
|
|
emptyText: "\u6682\u65E0\u6570\u636E",
|
|
confirmFilter: "\u7B5B\u9009",
|
|
resetFilter: "\u91CD\u7F6E",
|
|
clearFilter: "\u5168\u90E8",
|
|
sumText: "\u5408\u8BA1"
|
|
},
|
|
tour: {
|
|
next: "\u4E0B\u4E00\u6B65",
|
|
previous: "\u4E0A\u4E00\u6B65",
|
|
finish: "\u7ED3\u675F\u5BFC\u89C8"
|
|
},
|
|
tree: {
|
|
emptyText: "\u6682\u65E0\u6570\u636E"
|
|
},
|
|
transfer: {
|
|
noMatch: "\u65E0\u5339\u914D\u6570\u636E",
|
|
noData: "\u65E0\u6570\u636E",
|
|
titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
|
|
filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
|
|
noCheckedFormat: "\u5171 {total} \u9879",
|
|
hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
|
|
},
|
|
image: {
|
|
error: "\u52A0\u8F7D\u5931\u8D25"
|
|
},
|
|
pageHeader: {
|
|
title: "\u8FD4\u56DE"
|
|
},
|
|
popconfirm: {
|
|
confirmButtonText: "\u786E\u5B9A",
|
|
cancelButtonText: "\u53D6\u6D88"
|
|
},
|
|
carousel: {
|
|
leftArrow: "\u4E0A\u4E00\u5F20\u5E7B\u706F\u7247",
|
|
rightArrow: "\u4E0B\u4E00\u5F20\u5E7B\u706F\u7247",
|
|
indicator: "\u5E7B\u706F\u7247\u5207\u6362\u81F3\u7D22\u5F15 {index}"
|
|
}
|
|
}
|
|
};
|
|
const _sfc_main = {
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
useRouter();
|
|
useHead({ script: [{ src: "https://app.gter.net/bottom?tpl=footer,popupnotification", body: true }] });
|
|
const setDisabled = (time) => {
|
|
return time.getTime() > Date.now();
|
|
};
|
|
ref("");
|
|
let info = ref({
|
|
school: "",
|
|
// 学校
|
|
profession: "",
|
|
// 专业
|
|
project: "",
|
|
// 项目时间
|
|
interviewtime: "",
|
|
// 面试时间
|
|
subject: "",
|
|
//标题
|
|
isvisiblereply: 0,
|
|
// 回复点赞可见
|
|
message: "",
|
|
// 过程
|
|
anonymous: 0
|
|
// 匿名状态
|
|
});
|
|
const querySchoolSearch = (queryString, cb) => {
|
|
publishSchoolSearchHttp({ keyword: queryString }).then((res) => {
|
|
if (res.code != 200) return;
|
|
let data = res.data || [];
|
|
let isRepetition = false;
|
|
data.forEach((element) => {
|
|
element["value"] = element["checkname"];
|
|
if (element["checkname"] == queryString) isRepetition = true;
|
|
});
|
|
if (!isRepetition) data.push({ value: queryString });
|
|
cb(data);
|
|
});
|
|
};
|
|
const handleSchoolSelect = (item) => {
|
|
info.value["schoolid"] = item["id"] || 0;
|
|
};
|
|
const queryMajorSearch = (queryString, cb) => {
|
|
publishProfessionSearchHttp({ keyword: queryString }).then((res) => {
|
|
if (res.code != 200) return;
|
|
let data = res.data || [];
|
|
let isRepetition = false;
|
|
data.forEach((element) => {
|
|
element["value"] = element["name"];
|
|
if (element["name"] == queryString) isRepetition = true;
|
|
});
|
|
if (!isRepetition) data.push({ value: queryString });
|
|
cb(data);
|
|
});
|
|
};
|
|
const handleMajorSelect = (item) => {
|
|
info.value["profession_id"] = item["id"] || 0;
|
|
};
|
|
let loading = ref(false);
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_Head = Head;
|
|
const _component_Title = Title;
|
|
const _component_Meta = Meta;
|
|
const _component_el_autocomplete = ElAutocomplete;
|
|
const _component_el_input = ElInput;
|
|
const _component_el_config_provider = ElConfigProvider;
|
|
const _component_el_date_picker = ElDatePicker;
|
|
_push(`<!--[-->`);
|
|
_push(ssrRenderComponent(_component_Head, null, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_component_Title, null, {
|
|
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
if (_push3) {
|
|
_push3(`\u5BC4\u6258\u5929\u4E0B - \u9762\u7ECF\u53D1\u5E03`);
|
|
} else {
|
|
return [
|
|
createTextVNode("\u5BC4\u6258\u5929\u4E0B - \u9762\u7ECF\u53D1\u5E03")
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent2, _scopeId));
|
|
_push2(ssrRenderComponent(_component_Meta, {
|
|
name: "keyword",
|
|
content: "\u7559\u5B66\u8D44\u8BAF\uFF0C\u7559\u5B66\u4EA4\u6D41\u8BBA\u575B\uFF0C\u7559\u5B66\u9762\u7ECF\uFF0C\u9762\u8BD5\u7ECF\u9A8C\uFF0C\u5BC4\u6258\u5929\u4E0B"
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [
|
|
createVNode(_component_Title, null, {
|
|
default: withCtx(() => [
|
|
createTextVNode("\u5BC4\u6258\u5929\u4E0B - \u9762\u7ECF\u53D1\u5E03")
|
|
]),
|
|
_: 1
|
|
}),
|
|
createVNode(_component_Meta, {
|
|
name: "keyword",
|
|
content: "\u7559\u5B66\u8D44\u8BAF\uFF0C\u7559\u5B66\u4EA4\u6D41\u8BBA\u575B\uFF0C\u7559\u5B66\u9762\u7ECF\uFF0C\u9762\u8BD5\u7ECF\u9A8C\uFF0C\u5BC4\u6258\u5929\u4E0B"
|
|
})
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`<div class="content-box" data-v-0813115a><div class="flexacenter save-box save-left" data-v-0813115a><img class="save-icon"${ssrRenderAttr("src", _imports_0)} data-v-0813115a> \u4FDD\u5B58\u5E76\u9000\u51FA </div><div class="flexacenter save-box save-right" data-v-0813115a> \u653E\u5F03\u4FDD\u5B58 <img class="save-icon"${ssrRenderAttr("src", _imports_1)} data-v-0813115a></div><div class="contentcontent flex1" data-v-0813115a><div class="header flexacenter" data-v-0813115a>\u53D1\u5E03\u9762\u7ECF</div><div class="box flex1 flexflex" data-v-0813115a><div class="box-left" data-v-0813115a><div class="area-box" data-v-0813115a><div class="item" data-v-0813115a><div class="titletitle flexacenter" data-v-0813115a> \u7533\u8BF7\u4FE1\u606F <div class="asterisk" data-v-0813115a>*</div></div><div class="info-box" data-v-0813115a><div class="info-item flexacenter" data-v-0813115a><div class="info-name" data-v-0813115a>\u9662\u6821</div><div class="flex1" data-v-0813115a>`);
|
|
_push(ssrRenderComponent(_component_el_autocomplete, {
|
|
modelValue: unref(info).school,
|
|
"onUpdate:modelValue": ($event) => unref(info).school = $event,
|
|
"fetch-suggestions": querySchoolSearch,
|
|
clearable: "",
|
|
class: "inline-input w-50",
|
|
placeholder: "\u8F93\u5165\u5173\u952E\u8BCD\uFF0C\u9009\u62E9\u9662\u6821",
|
|
onSelect: handleSchoolSelect,
|
|
"trigger-on-focus": false
|
|
}, null, _parent));
|
|
_push(`</div></div><div class="info-item flexacenter" data-v-0813115a><div class="info-name" data-v-0813115a>\u4E13\u4E1A</div><div class="flex1" data-v-0813115a>`);
|
|
_push(ssrRenderComponent(_component_el_autocomplete, {
|
|
modelValue: unref(info).profession,
|
|
"onUpdate:modelValue": ($event) => unref(info).profession = $event,
|
|
"fetch-suggestions": queryMajorSearch,
|
|
clearable: "",
|
|
class: "inline-input w-50",
|
|
placeholder: "\u8F93\u5165\u5173\u952E\u8BCD\uFF0C\u9009\u62E9\u4E13\u4E1A",
|
|
onSelect: handleMajorSelect,
|
|
"trigger-on-focus": false
|
|
}, null, _parent));
|
|
_push(`</div></div><div class="info-item flexacenter" data-v-0813115a><div class="info-name" data-v-0813115a>\u9879\u76EE</div>`);
|
|
_push(ssrRenderComponent(_component_el_input, {
|
|
class: "flex1 input",
|
|
placeholder: "\u8BF7\u8F93\u5165",
|
|
modelValue: unref(info).project,
|
|
"onUpdate:modelValue": ($event) => unref(info).project = $event
|
|
}, null, _parent));
|
|
_push(`</div></div></div><div class="item" data-v-0813115a><div class="titletitle flexacenter" data-v-0813115a> \u9762\u8BD5\u65F6\u95F4 <div class="asterisk" data-v-0813115a>*</div></div><div class="time-box item-input-box flexacenter" data-v-0813115a>`);
|
|
_push(ssrRenderComponent(_component_el_config_provider, { locale: unref(zhCn) }, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_component_el_date_picker, {
|
|
modelValue: unref(info).interviewtime,
|
|
"onUpdate:modelValue": ($event) => unref(info).interviewtime = $event,
|
|
type: "date",
|
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
size: "large",
|
|
class: "flex1 flexacenter",
|
|
"clear-icon": {},
|
|
"value-format": "YYYY-MM-DD",
|
|
"disabled-date": setDisabled
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [
|
|
createVNode(_component_el_date_picker, {
|
|
modelValue: unref(info).interviewtime,
|
|
"onUpdate:modelValue": ($event) => unref(info).interviewtime = $event,
|
|
type: "date",
|
|
placeholder: "\u8BF7\u9009\u62E9",
|
|
size: "large",
|
|
class: "flex1 flexacenter",
|
|
"clear-icon": {},
|
|
"value-format": "YYYY-MM-DD",
|
|
"disabled-date": setDisabled
|
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`<img class="calendar-icon"${ssrRenderAttr("src", _imports_2)} data-v-0813115a></div></div><div class="item" data-v-0813115a><div class="titletitle flexacenter" data-v-0813115a> \u9762\u7ECF\u5E16\u6807\u9898 <div class="asterisk" data-v-0813115a>*</div></div><div class="title-box item-input-box flexacenter" data-v-0813115a>`);
|
|
_push(ssrRenderComponent(_component_el_input, {
|
|
modelValue: unref(info).subject,
|
|
"onUpdate:modelValue": ($event) => unref(info).subject = $event,
|
|
placeholder: "\u7ED9\u4F60\u7684\u9762\u7ECF\u5E16\u8D77\u4E00\u4E2A\u5438\u5F15\u7684\u6807\u9898\u5427",
|
|
"show-word-limit": "",
|
|
maxlength: "80"
|
|
}, null, _parent));
|
|
_push(`</div></div></div><div class="visible-box flexacenter" data-v-0813115a>`);
|
|
if (unref(info).isvisiblereply == 0) {
|
|
_push(`<img class="visible-icon"${ssrRenderAttr("src", _imports_3)} data-v-0813115a>`);
|
|
} else {
|
|
_push(`<img class="visible-icon"${ssrRenderAttr("src", _imports_4)} data-v-0813115a>`);
|
|
}
|
|
_push(` \u56DE\u590D/\u70B9\u8D5E\u53EF\u89C1 </div></div><div class="box-right" data-v-0813115a><div class="area-box" data-v-0813115a><div class="item" data-v-0813115a><div class="titletitle flexacenter" data-v-0813115a> \u9762\u8BD5\u6784\u6210\u53CA\u8FC7\u7A0B <div class="asterisk" data-v-0813115a>*</div></div><div class="course-box" data-v-0813115a>`);
|
|
_push(ssrRenderComponent(_component_el_input, {
|
|
modelValue: unref(info).message,
|
|
"onUpdate:modelValue": ($event) => unref(info).message = $event,
|
|
type: "textarea",
|
|
autosize: "",
|
|
"show-word-limit": "",
|
|
maxlength: "2000",
|
|
placeholder: "\u4F8B\u5982\uFF1A\u9879\u76EE\u4ECB\u7ECD\u3001\u9762\u8BD5\u65F6\u957F\u3001\u9762\u8BD5\u5B98\u3001\u95EE\u9898QA\u3001\u9700\u8981\u6CE8\u610F\u7684\u5730\u65B9"
|
|
}, null, _parent));
|
|
_push(`</div></div></div></div></div><div class="hint-box flexcenter" data-v-0813115a>\u6CE8\uFF1A\u8BF7\u786E\u4FDD\u4EE5\u4E0A\u5185\u5BB9\u5DF2\u6B63\u786E\u586B\u5199\uFF0C\u53D1\u5E03\u540E\u5C06\u4E0D\u80FD\u4FEE\u6539</div></div></div><div class="floor-box" data-v-0813115a><div class="box flexacenter" data-v-0813115a><div class="anonymous-box flexacenter" data-v-0813115a>`);
|
|
if (unref(info).anonymous == 0) {
|
|
_push(`<img class="anonymous-icon"${ssrRenderAttr("src", _imports_3)} data-v-0813115a>`);
|
|
} else {
|
|
_push(`<img class="anonymous-icon"${ssrRenderAttr("src", _imports_4)} data-v-0813115a>`);
|
|
}
|
|
_push(` \u533F\u540D\u53D1\u8868 <div class="text" data-v-0813115a>\uFF08\u53D1\u5E03\u540E\u53EF\u4FEE\u6539\uFF09</div></div><div class="issue-btn flexcenter" data-v-0813115a>\u53D1\u5E03${ssrInterpolate(unref(loading) ? "\u4E2D..." : "")}</div></div></div><!--]-->`);
|
|
};
|
|
}
|
|
};
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/publish/index.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0813115a"]]);
|
|
|
|
export { index as default };
|
|
//# sourceMappingURL=index-DABfsv71.mjs.map
|