first commit
This commit is contained in:
134
node_modules/vant/lib/area/Area.d.ts
generated
vendored
Normal file
134
node_modules/vant/lib/area/Area.d.ts
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
import { type PropType, type ExtractPropTypes } from 'vue';
|
||||
import type { AreaList } from './types';
|
||||
export declare const areaProps: import("../utils").Writeable<Pick<{
|
||||
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;
|
||||
}, "title" | "readonly" | "loading" | "optionHeight" | "swipeDuration" | "visibleOptionNum" | "cancelButtonText" | "confirmButtonText">> & {
|
||||
modelValue: StringConstructor;
|
||||
columnsNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
columnsPlaceholder: {
|
||||
type: PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
areaList: {
|
||||
type: PropType<AreaList>;
|
||||
default: () => {};
|
||||
};
|
||||
};
|
||||
export type AreaProps = ExtractPropTypes<typeof areaProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<import("../utils").Writeable<Pick<{
|
||||
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;
|
||||
}, "title" | "readonly" | "loading" | "optionHeight" | "swipeDuration" | "visibleOptionNum" | "cancelButtonText" | "confirmButtonText">> & {
|
||||
modelValue: StringConstructor;
|
||||
columnsNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
columnsPlaceholder: {
|
||||
type: PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
areaList: {
|
||||
type: PropType<AreaList>;
|
||||
default: () => {};
|
||||
};
|
||||
}>, () => 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<import("../utils").Writeable<Pick<{
|
||||
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;
|
||||
}, "title" | "readonly" | "loading" | "optionHeight" | "swipeDuration" | "visibleOptionNum" | "cancelButtonText" | "confirmButtonText">> & {
|
||||
modelValue: StringConstructor;
|
||||
columnsNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
columnsPlaceholder: {
|
||||
type: PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
areaList: {
|
||||
type: PropType<AreaList>;
|
||||
default: () => {};
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
onCancel?: ((...args: any[]) => any) | undefined;
|
||||
onConfirm?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
readonly: boolean;
|
||||
loading: boolean;
|
||||
optionHeight: string | number;
|
||||
swipeDuration: string | number;
|
||||
visibleOptionNum: string | number;
|
||||
columnsNum: string | number;
|
||||
columnsPlaceholder: string[];
|
||||
areaList: AreaList;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
95
node_modules/vant/lib/area/Area.js
generated
vendored
Normal file
95
node_modules/vant/lib/area/Area.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name2 in all)
|
||||
__defProp(target, name2, { get: all[name2], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
areaProps: () => areaProps,
|
||||
default: () => stdin_default
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_vue = require("vue");
|
||||
var import_utils = require("../utils");
|
||||
var import_Picker = require("../picker/Picker");
|
||||
var import_utils2 = require("./utils");
|
||||
var import_use_expose = require("../composables/use-expose");
|
||||
var import_picker = require("../picker");
|
||||
const [name, bem] = (0, import_utils.createNamespace)("area");
|
||||
const areaProps = (0, import_utils.extend)({}, (0, import_utils.pick)(import_Picker.pickerSharedProps, import_utils2.INHERIT_PROPS), {
|
||||
modelValue: String,
|
||||
columnsNum: (0, import_utils.makeNumericProp)(3),
|
||||
columnsPlaceholder: (0, import_utils.makeArrayProp)(),
|
||||
areaList: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
});
|
||||
var stdin_default = (0, import_vue.defineComponent)({
|
||||
name,
|
||||
props: areaProps,
|
||||
emits: ["change", "confirm", "cancel", "update:modelValue"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
const codes = (0, import_vue.ref)([]);
|
||||
const picker = (0, import_vue.ref)();
|
||||
const columns = (0, import_vue.computed)(() => (0, import_utils2.formatDataForCascade)(props));
|
||||
const onChange = (...args) => emit("change", ...args);
|
||||
const onCancel = (...args) => emit("cancel", ...args);
|
||||
const onConfirm = (...args) => emit("confirm", ...args);
|
||||
(0, import_vue.watch)(codes, (newCodes) => {
|
||||
const lastCode = newCodes.length ? newCodes[newCodes.length - 1] : "";
|
||||
if (lastCode && lastCode !== props.modelValue) {
|
||||
emit("update:modelValue", lastCode);
|
||||
}
|
||||
}, {
|
||||
deep: true
|
||||
});
|
||||
(0, import_vue.watch)(() => props.modelValue, (newCode) => {
|
||||
if (newCode) {
|
||||
const lastCode = codes.value.length ? codes.value[codes.value.length - 1] : "";
|
||||
if (newCode !== lastCode) {
|
||||
codes.value = [`${newCode.slice(0, 2)}0000`, `${newCode.slice(0, 4)}00`, newCode].slice(0, +props.columnsNum);
|
||||
}
|
||||
} else {
|
||||
codes.value = [];
|
||||
}
|
||||
}, {
|
||||
immediate: true
|
||||
});
|
||||
(0, import_use_expose.useExpose)({
|
||||
confirm: () => {
|
||||
var _a;
|
||||
return (_a = picker.value) == null ? void 0 : _a.confirm();
|
||||
},
|
||||
getSelectedOptions: () => {
|
||||
var _a;
|
||||
return ((_a = picker.value) == null ? void 0 : _a.getSelectedOptions()) || [];
|
||||
}
|
||||
});
|
||||
return () => (0, import_vue.createVNode)(import_picker.Picker, (0, import_vue.mergeProps)({
|
||||
"ref": picker,
|
||||
"modelValue": codes.value,
|
||||
"onUpdate:modelValue": ($event) => codes.value = $event,
|
||||
"class": bem(),
|
||||
"columns": columns.value,
|
||||
"onChange": onChange,
|
||||
"onCancel": onCancel,
|
||||
"onConfirm": onConfirm
|
||||
}, (0, import_utils.pick)(props, import_utils2.INHERIT_PROPS)), (0, import_utils.pick)(slots, import_utils2.INHERIT_SLOTS));
|
||||
}
|
||||
});
|
||||
100
node_modules/vant/lib/area/index.d.ts
generated
vendored
Normal file
100
node_modules/vant/lib/area/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
export declare const Area: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<import("../utils").Writeable<Pick<{
|
||||
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;
|
||||
}, "title" | "readonly" | "loading" | "optionHeight" | "swipeDuration" | "visibleOptionNum" | "cancelButtonText" | "confirmButtonText">> & {
|
||||
modelValue: StringConstructor;
|
||||
columnsNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
columnsPlaceholder: {
|
||||
type: import("vue").PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
areaList: {
|
||||
type: import("vue").PropType<import("./types").AreaList>;
|
||||
default: () => {};
|
||||
};
|
||||
}>, () => 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<import("../utils").Writeable<Pick<{
|
||||
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;
|
||||
}, "title" | "readonly" | "loading" | "optionHeight" | "swipeDuration" | "visibleOptionNum" | "cancelButtonText" | "confirmButtonText">> & {
|
||||
modelValue: StringConstructor;
|
||||
columnsNum: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
columnsPlaceholder: {
|
||||
type: import("vue").PropType<string[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
areaList: {
|
||||
type: import("vue").PropType<import("./types").AreaList>;
|
||||
default: () => {};
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
onCancel?: ((...args: any[]) => any) | undefined;
|
||||
onConfirm?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
readonly: boolean;
|
||||
loading: boolean;
|
||||
optionHeight: string | number;
|
||||
swipeDuration: string | number;
|
||||
visibleOptionNum: string | number;
|
||||
columnsNum: string | number;
|
||||
columnsPlaceholder: string[];
|
||||
areaList: import("./types").AreaList;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default Area;
|
||||
export { areaProps } from './Area';
|
||||
export type { AreaProps } from './Area';
|
||||
export type { AreaList, AreaInstance } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanArea: typeof Area;
|
||||
}
|
||||
}
|
||||
39
node_modules/vant/lib/area/index.js
generated
vendored
Normal file
39
node_modules/vant/lib/area/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
Area: () => Area,
|
||||
areaProps: () => import_Area2.areaProps,
|
||||
default: () => stdin_default
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_utils = require("../utils");
|
||||
var import_Area = __toESM(require("./Area"));
|
||||
var import_Area2 = require("./Area");
|
||||
const Area = (0, import_utils.withInstall)(import_Area.default);
|
||||
var stdin_default = Area;
|
||||
1
node_modules/vant/lib/area/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/lib/area/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
10
node_modules/vant/lib/area/style/index.js
generated
vendored
Normal file
10
node_modules/vant/lib/area/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
require("../../style/base.css");
|
||||
require("../../badge/index.css");
|
||||
require("../../loading/index.css");
|
||||
require("../../sticky/index.css");
|
||||
require("../../swipe/index.css");
|
||||
require("../../swipe-item/index.css");
|
||||
require("../../tabs/index.css");
|
||||
require("../../tab/index.css");
|
||||
require("../../picker/index.css");
|
||||
require("../../picker-group/index.css");
|
||||
9
node_modules/vant/lib/area/types.d.ts
generated
vendored
Normal file
9
node_modules/vant/lib/area/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import { PickerExpose } from '../picker/types';
|
||||
import type { AreaProps } from './Area';
|
||||
export type AreaList = {
|
||||
city_list: Record<string, string>;
|
||||
county_list: Record<string, string>;
|
||||
province_list: Record<string, string>;
|
||||
};
|
||||
export type AreaInstance = ComponentPublicInstance<AreaProps, PickerExpose>;
|
||||
15
node_modules/vant/lib/area/types.js
generated
vendored
Normal file
15
node_modules/vant/lib/area/types.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
6
node_modules/vant/lib/area/utils.d.ts
generated
vendored
Normal file
6
node_modules/vant/lib/area/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { AreaProps } from '.';
|
||||
import type { PickerOption } from '../picker';
|
||||
export declare const AREA_EMPTY_CODE = "000000";
|
||||
export declare const INHERIT_SLOTS: readonly ["title", "cancel", "confirm", "toolbar", "columns-top", "columns-bottom"];
|
||||
export declare const INHERIT_PROPS: readonly ["title", "loading", "readonly", "optionHeight", "swipeDuration", "visibleOptionNum", "cancelButtonText", "confirmButtonText"];
|
||||
export declare function formatDataForCascade({ areaList, columnsNum, columnsPlaceholder: placeholder, }: AreaProps): PickerOption[];
|
||||
111
node_modules/vant/lib/area/utils.js
generated
vendored
Normal file
111
node_modules/vant/lib/area/utils.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
AREA_EMPTY_CODE: () => AREA_EMPTY_CODE,
|
||||
INHERIT_PROPS: () => INHERIT_PROPS,
|
||||
INHERIT_SLOTS: () => INHERIT_SLOTS,
|
||||
formatDataForCascade: () => formatDataForCascade
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
const AREA_EMPTY_CODE = "000000";
|
||||
const INHERIT_SLOTS = [
|
||||
"title",
|
||||
"cancel",
|
||||
"confirm",
|
||||
"toolbar",
|
||||
"columns-top",
|
||||
"columns-bottom"
|
||||
];
|
||||
const INHERIT_PROPS = [
|
||||
"title",
|
||||
"loading",
|
||||
"readonly",
|
||||
"optionHeight",
|
||||
"swipeDuration",
|
||||
"visibleOptionNum",
|
||||
"cancelButtonText",
|
||||
"confirmButtonText"
|
||||
];
|
||||
const makeOption = (text = "", value = AREA_EMPTY_CODE, children = void 0) => ({
|
||||
text,
|
||||
value,
|
||||
children
|
||||
});
|
||||
function formatDataForCascade({
|
||||
areaList,
|
||||
columnsNum,
|
||||
columnsPlaceholder: placeholder
|
||||
}) {
|
||||
const {
|
||||
city_list: city = {},
|
||||
county_list: county = {},
|
||||
province_list: province = {}
|
||||
} = areaList;
|
||||
const showCity = +columnsNum > 1;
|
||||
const showCounty = +columnsNum > 2;
|
||||
const getProvinceChildren = () => {
|
||||
if (showCity) {
|
||||
return placeholder.length > 1 ? [
|
||||
makeOption(
|
||||
placeholder[1],
|
||||
AREA_EMPTY_CODE,
|
||||
showCounty ? [] : void 0
|
||||
)
|
||||
] : [];
|
||||
}
|
||||
};
|
||||
const provinceMap = /* @__PURE__ */ new Map();
|
||||
Object.keys(province).forEach((code) => {
|
||||
provinceMap.set(
|
||||
code.slice(0, 2),
|
||||
makeOption(province[code], code, getProvinceChildren())
|
||||
);
|
||||
});
|
||||
const cityMap = /* @__PURE__ */ new Map();
|
||||
if (showCity) {
|
||||
const getCityChildren = () => {
|
||||
if (showCounty) {
|
||||
return placeholder.length > 2 ? [makeOption(placeholder[2])] : [];
|
||||
}
|
||||
};
|
||||
Object.keys(city).forEach((code) => {
|
||||
const option = makeOption(city[code], code, getCityChildren());
|
||||
cityMap.set(code.slice(0, 4), option);
|
||||
const province2 = provinceMap.get(code.slice(0, 2));
|
||||
if (province2) {
|
||||
province2.children.push(option);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (showCounty) {
|
||||
Object.keys(county).forEach((code) => {
|
||||
const city2 = cityMap.get(code.slice(0, 4));
|
||||
if (city2) {
|
||||
city2.children.push(makeOption(county[code], code));
|
||||
}
|
||||
});
|
||||
}
|
||||
const options = Array.from(provinceMap.values());
|
||||
if (placeholder.length) {
|
||||
const county2 = showCounty ? [makeOption(placeholder[2])] : void 0;
|
||||
const city2 = showCity ? [makeOption(placeholder[1], AREA_EMPTY_CODE, county2)] : void 0;
|
||||
options.unshift(makeOption(placeholder[0], AREA_EMPTY_CODE, city2));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
Reference in New Issue
Block a user