first commit
This commit is contained in:
176
node_modules/vant/es/date-picker/DatePicker.d.ts
generated
vendored
Normal file
176
node_modules/vant/es/date-picker/DatePicker.d.ts
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
import { type ComponentPublicInstance, type PropType, type ExtractPropTypes } from 'vue';
|
||||
export type DatePickerColumnType = 'year' | 'month' | 'day';
|
||||
export declare const datePickerProps: {
|
||||
loading: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
allowHtml: BooleanConstructor;
|
||||
optionHeight: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
showToolbar: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeDuration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
visibleOptionNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
} & {
|
||||
title: StringConstructor;
|
||||
cancelButtonText: StringConstructor;
|
||||
confirmButtonText: StringConstructor;
|
||||
} & {
|
||||
modelValue: {
|
||||
type: PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
||||
formatter: {
|
||||
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
||||
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
||||
};
|
||||
} & {
|
||||
columnsType: {
|
||||
type: PropType<DatePickerColumnType[]>;
|
||||
default: () => string[];
|
||||
};
|
||||
minDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
maxDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
};
|
||||
export type DatePickerExpose = {
|
||||
confirm: () => void;
|
||||
getSelectedDate: () => string[];
|
||||
};
|
||||
export type DatePickerProps = ExtractPropTypes<typeof datePickerProps>;
|
||||
export type DatePickerInstance = ComponentPublicInstance<DatePickerProps, DatePickerExpose>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
loading: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
allowHtml: BooleanConstructor;
|
||||
optionHeight: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
showToolbar: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeDuration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
visibleOptionNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
} & {
|
||||
title: StringConstructor;
|
||||
cancelButtonText: StringConstructor;
|
||||
confirmButtonText: StringConstructor;
|
||||
} & {
|
||||
modelValue: {
|
||||
type: PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
||||
formatter: {
|
||||
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
||||
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
||||
};
|
||||
} & {
|
||||
columnsType: {
|
||||
type: PropType<DatePickerColumnType[]>;
|
||||
default: () => string[];
|
||||
};
|
||||
minDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
maxDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
loading: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
allowHtml: BooleanConstructor;
|
||||
optionHeight: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
showToolbar: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeDuration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
visibleOptionNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
} & {
|
||||
title: StringConstructor;
|
||||
cancelButtonText: StringConstructor;
|
||||
confirmButtonText: StringConstructor;
|
||||
} & {
|
||||
modelValue: {
|
||||
type: PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
||||
formatter: {
|
||||
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
||||
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
||||
};
|
||||
} & {
|
||||
columnsType: {
|
||||
type: PropType<DatePickerColumnType[]>;
|
||||
default: () => string[];
|
||||
};
|
||||
minDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
maxDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
onCancel?: ((...args: any[]) => any) | undefined;
|
||||
onConfirm?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
formatter: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
||||
modelValue: string[];
|
||||
readonly: boolean;
|
||||
loading: boolean;
|
||||
allowHtml: boolean;
|
||||
optionHeight: string | number;
|
||||
showToolbar: boolean;
|
||||
swipeDuration: string | number;
|
||||
visibleOptionNum: string | number;
|
||||
minDate: Date;
|
||||
maxDate: Date;
|
||||
columnsType: DatePickerColumnType[];
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
133
node_modules/vant/es/date-picker/DatePicker.mjs
generated
vendored
Normal file
133
node_modules/vant/es/date-picker/DatePicker.mjs
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
import { ref, watch, computed, defineComponent, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
||||
import { pick, extend, isDate, isSameValue, createNamespace } from "../utils/index.mjs";
|
||||
import { genOptions, sharedProps, getMonthEndDay, pickerInheritKeys, formatValueRange } from "./utils.mjs";
|
||||
import { useExpose } from "../composables/use-expose.mjs";
|
||||
import { Picker } from "../picker/index.mjs";
|
||||
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
||||
const [name] = createNamespace("date-picker");
|
||||
const datePickerProps = extend({}, sharedProps, {
|
||||
columnsType: {
|
||||
type: Array,
|
||||
default: () => ["year", "month", "day"]
|
||||
},
|
||||
minDate: {
|
||||
type: Date,
|
||||
default: () => new Date(currentYear - 10, 0, 1),
|
||||
validator: isDate
|
||||
},
|
||||
maxDate: {
|
||||
type: Date,
|
||||
default: () => new Date(currentYear + 10, 11, 31),
|
||||
validator: isDate
|
||||
}
|
||||
});
|
||||
var stdin_default = defineComponent({
|
||||
name,
|
||||
props: datePickerProps,
|
||||
emits: ["confirm", "cancel", "change", "update:modelValue"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
const currentValues = ref(props.modelValue);
|
||||
const updatedByExternalSources = ref(false);
|
||||
const pickerRef = ref();
|
||||
const computedValues = computed(() => updatedByExternalSources.value ? props.modelValue : currentValues.value);
|
||||
const isMinYear = (year) => year === props.minDate.getFullYear();
|
||||
const isMaxYear = (year) => year === props.maxDate.getFullYear();
|
||||
const isMinMonth = (month) => month === props.minDate.getMonth() + 1;
|
||||
const isMaxMonth = (month) => month === props.maxDate.getMonth() + 1;
|
||||
const getValue = (type) => {
|
||||
const {
|
||||
minDate,
|
||||
columnsType
|
||||
} = props;
|
||||
const index = columnsType.indexOf(type);
|
||||
const value = computedValues.value[index];
|
||||
if (value) {
|
||||
return +value;
|
||||
}
|
||||
switch (type) {
|
||||
case "year":
|
||||
return minDate.getFullYear();
|
||||
case "month":
|
||||
return minDate.getMonth() + 1;
|
||||
case "day":
|
||||
return minDate.getDate();
|
||||
}
|
||||
};
|
||||
const genYearOptions = () => {
|
||||
const minYear = props.minDate.getFullYear();
|
||||
const maxYear = props.maxDate.getFullYear();
|
||||
return genOptions(minYear, maxYear, "year", props.formatter, props.filter, computedValues.value);
|
||||
};
|
||||
const genMonthOptions = () => {
|
||||
const year = getValue("year");
|
||||
const minMonth = isMinYear(year) ? props.minDate.getMonth() + 1 : 1;
|
||||
const maxMonth = isMaxYear(year) ? props.maxDate.getMonth() + 1 : 12;
|
||||
return genOptions(minMonth, maxMonth, "month", props.formatter, props.filter, computedValues.value);
|
||||
};
|
||||
const genDayOptions = () => {
|
||||
const year = getValue("year");
|
||||
const month = getValue("month");
|
||||
const minDate = isMinYear(year) && isMinMonth(month) ? props.minDate.getDate() : 1;
|
||||
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : getMonthEndDay(year, month);
|
||||
return genOptions(minDate, maxDate, "day", props.formatter, props.filter, computedValues.value);
|
||||
};
|
||||
const confirm = () => {
|
||||
var _a;
|
||||
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
||||
};
|
||||
const getSelectedDate = () => currentValues.value;
|
||||
const columns = computed(() => props.columnsType.map((type) => {
|
||||
switch (type) {
|
||||
case "year":
|
||||
return genYearOptions();
|
||||
case "month":
|
||||
return genMonthOptions();
|
||||
case "day":
|
||||
return genDayOptions();
|
||||
default:
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}));
|
||||
watch(currentValues, (newValues) => {
|
||||
if (!isSameValue(newValues, props.modelValue)) {
|
||||
emit("update:modelValue", newValues);
|
||||
}
|
||||
});
|
||||
watch(() => props.modelValue, (newValues, oldValues) => {
|
||||
updatedByExternalSources.value = isSameValue(oldValues, currentValues.value);
|
||||
newValues = formatValueRange(newValues, columns.value);
|
||||
if (!isSameValue(newValues, currentValues.value)) {
|
||||
currentValues.value = newValues;
|
||||
}
|
||||
updatedByExternalSources.value = false;
|
||||
}, {
|
||||
immediate: true
|
||||
});
|
||||
const onChange = (...args) => emit("change", ...args);
|
||||
const onCancel = (...args) => emit("cancel", ...args);
|
||||
const onConfirm = (...args) => emit("confirm", ...args);
|
||||
useExpose({
|
||||
confirm,
|
||||
getSelectedDate
|
||||
});
|
||||
return () => _createVNode(Picker, _mergeProps({
|
||||
"ref": pickerRef,
|
||||
"modelValue": currentValues.value,
|
||||
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
||||
"columns": columns.value,
|
||||
"onChange": onChange,
|
||||
"onCancel": onCancel,
|
||||
"onConfirm": onConfirm
|
||||
}, pick(props, pickerInheritKeys)), slots);
|
||||
}
|
||||
});
|
||||
export {
|
||||
datePickerProps,
|
||||
stdin_default as default
|
||||
};
|
||||
127
node_modules/vant/es/date-picker/index.d.ts
generated
vendored
Normal file
127
node_modules/vant/es/date-picker/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
import { DatePickerProps } from './DatePicker';
|
||||
export declare const DatePicker: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
loading: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
allowHtml: BooleanConstructor;
|
||||
optionHeight: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
showToolbar: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeDuration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
visibleOptionNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
} & {
|
||||
title: StringConstructor;
|
||||
cancelButtonText: StringConstructor;
|
||||
confirmButtonText: StringConstructor;
|
||||
} & {
|
||||
modelValue: {
|
||||
type: import("vue").PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
||||
formatter: {
|
||||
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
||||
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
||||
};
|
||||
} & {
|
||||
columnsType: {
|
||||
type: import("vue").PropType<import("./DatePicker").DatePickerColumnType[]>;
|
||||
default: () => string[];
|
||||
};
|
||||
minDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
maxDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
loading: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
allowHtml: BooleanConstructor;
|
||||
optionHeight: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
showToolbar: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeDuration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
visibleOptionNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
} & {
|
||||
title: StringConstructor;
|
||||
cancelButtonText: StringConstructor;
|
||||
confirmButtonText: StringConstructor;
|
||||
} & {
|
||||
modelValue: {
|
||||
type: import("vue").PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
||||
formatter: {
|
||||
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
||||
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
||||
};
|
||||
} & {
|
||||
columnsType: {
|
||||
type: import("vue").PropType<import("./DatePicker").DatePickerColumnType[]>;
|
||||
default: () => string[];
|
||||
};
|
||||
minDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
maxDate: {
|
||||
type: DateConstructor;
|
||||
default: () => Date;
|
||||
validator: (val: unknown) => val is Date;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
onCancel?: ((...args: any[]) => any) | undefined;
|
||||
onConfirm?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
formatter: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
||||
modelValue: string[];
|
||||
readonly: boolean;
|
||||
loading: boolean;
|
||||
allowHtml: boolean;
|
||||
optionHeight: string | number;
|
||||
showToolbar: boolean;
|
||||
swipeDuration: string | number;
|
||||
visibleOptionNum: string | number;
|
||||
minDate: Date;
|
||||
maxDate: Date;
|
||||
columnsType: import("./DatePicker").DatePickerColumnType[];
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default DatePicker;
|
||||
export { datePickerProps } from './DatePicker';
|
||||
export type { DatePickerProps };
|
||||
export type { DatePickerColumnType, DatePickerInstance } from './DatePicker';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanDatePicker: typeof DatePicker;
|
||||
}
|
||||
}
|
||||
10
node_modules/vant/es/date-picker/index.mjs
generated
vendored
Normal file
10
node_modules/vant/es/date-picker/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { withInstall } from "../utils/index.mjs";
|
||||
import _DatePicker from "./DatePicker.mjs";
|
||||
const DatePicker = withInstall(_DatePicker);
|
||||
var stdin_default = DatePicker;
|
||||
import { datePickerProps } from "./DatePicker.mjs";
|
||||
export {
|
||||
DatePicker,
|
||||
datePickerProps,
|
||||
stdin_default as default
|
||||
};
|
||||
1
node_modules/vant/es/date-picker/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/es/date-picker/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
10
node_modules/vant/es/date-picker/style/index.mjs
generated
vendored
Normal file
10
node_modules/vant/es/date-picker/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import "../../style/base.css";
|
||||
import "../../badge/index.css";
|
||||
import "../../loading/index.css";
|
||||
import "../../sticky/index.css";
|
||||
import "../../swipe/index.css";
|
||||
import "../../swipe-item/index.css";
|
||||
import "../../tabs/index.css";
|
||||
import "../../tab/index.css";
|
||||
import "../../picker/index.css";
|
||||
import "../../picker-group/index.css";
|
||||
46
node_modules/vant/es/date-picker/utils.d.ts
generated
vendored
Normal file
46
node_modules/vant/es/date-picker/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import { pickerSharedProps } from '../picker/Picker';
|
||||
import type { PropType } from 'vue';
|
||||
import type { PickerOption } from '../picker';
|
||||
type Filter = (columnType: string, options: PickerOption[], values: string[]) => PickerOption[];
|
||||
type Formatter = (type: string, option: PickerOption) => PickerOption;
|
||||
export declare const sharedProps: {
|
||||
loading: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
allowHtml: BooleanConstructor;
|
||||
optionHeight: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
showToolbar: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeDuration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
visibleOptionNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
} & {
|
||||
title: StringConstructor;
|
||||
cancelButtonText: StringConstructor;
|
||||
confirmButtonText: StringConstructor;
|
||||
} & {
|
||||
modelValue: {
|
||||
type: PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
filter: PropType<Filter>;
|
||||
formatter: {
|
||||
type: PropType<Formatter>;
|
||||
default: (type: string, option: PickerOption) => PickerOption;
|
||||
};
|
||||
};
|
||||
export declare const pickerInheritKeys: Array<keyof typeof pickerSharedProps>;
|
||||
export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
|
||||
export declare const getMonthEndDay: (year: number, month: number) => number;
|
||||
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter: Filter | undefined, values: string[]) => PickerOption[];
|
||||
export declare const formatValueRange: (values: string[], columns: PickerOption[][]) => string[];
|
||||
export {};
|
||||
50
node_modules/vant/es/date-picker/utils.mjs
generated
vendored
Normal file
50
node_modules/vant/es/date-picker/utils.mjs
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import { extend, padZero, makeArrayProp, clamp } from "../utils/index.mjs";
|
||||
import { pickerSharedProps } from "../picker/Picker.mjs";
|
||||
const sharedProps = extend({}, pickerSharedProps, {
|
||||
modelValue: makeArrayProp(),
|
||||
filter: Function,
|
||||
formatter: {
|
||||
type: Function,
|
||||
default: (type, option) => option
|
||||
}
|
||||
});
|
||||
const pickerInheritKeys = Object.keys(pickerSharedProps);
|
||||
function times(n, iteratee) {
|
||||
if (n < 0) {
|
||||
return [];
|
||||
}
|
||||
const result = Array(n);
|
||||
let index = -1;
|
||||
while (++index < n) {
|
||||
result[index] = iteratee(index);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
|
||||
const genOptions = (min, max, type, formatter, filter, values) => {
|
||||
const options = times(max - min + 1, (index) => {
|
||||
const value = padZero(min + index);
|
||||
return formatter(type, {
|
||||
text: value,
|
||||
value
|
||||
});
|
||||
});
|
||||
return filter ? filter(type, options, values) : options;
|
||||
};
|
||||
const formatValueRange = (values, columns) => values.map((value, index) => {
|
||||
const column = columns[index];
|
||||
if (column.length) {
|
||||
const minValue = +column[0].value;
|
||||
const maxValue = +column[column.length - 1].value;
|
||||
return padZero(clamp(+value, minValue, maxValue));
|
||||
}
|
||||
return value;
|
||||
});
|
||||
export {
|
||||
formatValueRange,
|
||||
genOptions,
|
||||
getMonthEndDay,
|
||||
pickerInheritKeys,
|
||||
sharedProps,
|
||||
times
|
||||
};
|
||||
Reference in New Issue
Block a user