@fangzhongya/fang-ui 0.0.62 → 0.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/components/array/src/data.cjs +32 -0
  2. package/dist/components/array/src/data.d.ts +32 -0
  3. package/dist/components/array/src/data.js +32 -0
  4. package/dist/components/common/list.cjs +4 -1
  5. package/dist/components/common/list.d.ts +5 -1
  6. package/dist/components/common/list.js +4 -1
  7. package/dist/components/dates-divide/src/data.cjs +6 -0
  8. package/dist/components/dates-divide/src/data.d.ts +8 -4
  9. package/dist/components/dates-divide/src/data.js +6 -0
  10. package/dist/components/dates-divide/src/index2.cjs +17 -9
  11. package/dist/components/dates-divide/src/index2.js +17 -9
  12. package/dist/components/dates2/index.cjs +9 -0
  13. package/dist/components/{popconfirm → dates2}/index.css +10 -0
  14. package/dist/components/dates2/index.d.ts +4 -0
  15. package/dist/components/dates2/index.js +9 -0
  16. package/dist/components/dates2/index.scss +14 -0
  17. package/dist/components/dates2/src/data.cjs +43 -0
  18. package/dist/components/dates2/src/data.d.ts +121 -0
  19. package/dist/components/dates2/src/data.js +43 -0
  20. package/dist/components/dates2/src/index.cjs +4 -0
  21. package/dist/components/dates2/src/index.js +4 -0
  22. package/dist/components/dates2/src/index2.cjs +100 -0
  23. package/dist/components/dates2/src/index2.js +100 -0
  24. package/dist/components/dates2/src/util.cjs +195 -0
  25. package/dist/components/dates2/src/util.d.ts +14 -0
  26. package/dist/components/dates2/src/util.js +195 -0
  27. package/dist/components/dates2/style/index2.scss +3 -0
  28. package/dist/components/global-config/index.css +0 -4
  29. package/dist/components/global-config/index.scss +2 -7
  30. package/dist/components/global-config/src/data.cjs +1 -1
  31. package/dist/components/global-config/src/data.d.ts +1 -1
  32. package/dist/components/global-config/src/data.js +1 -1
  33. package/dist/components/index.cjs +50 -48
  34. package/dist/components/index.d.ts +1 -0
  35. package/dist/components/index.js +2 -0
  36. package/dist/components/index.scss +2 -1
  37. package/dist/components/index2.scss +2 -1
  38. package/dist/components/list/src/data.cjs +1 -1
  39. package/dist/components/list/src/data.d.ts +1 -1
  40. package/dist/components/list/src/data.js +1 -1
  41. package/dist/components/lists/src/data.cjs +9 -1
  42. package/dist/components/lists/src/data.d.ts +9 -0
  43. package/dist/components/lists/src/data.js +9 -1
  44. package/dist/components/loading/src/index.d.ts +1 -1
  45. package/dist/components/switchs/src/data.d.ts +4 -0
  46. package/dist/components/switchs/src/index2.cjs +1 -0
  47. package/dist/components/switchs/src/index2.js +1 -0
  48. package/dist/components/tables/src/data.cjs +3 -0
  49. package/dist/components/tables/src/data.d.ts +3 -0
  50. package/dist/components/tables/src/data.js +3 -0
  51. package/dist/css/{popconfirm.css → dates2.css} +10 -0
  52. package/dist/css/global-config.css +0 -4
  53. package/dist/css/index.css +10 -26
  54. package/dist/expand/{chunk-3HYUAX6P.js → chunk-BDTC57P3.js} +2 -0
  55. package/dist/expand/{chunk-IPHLXLMM.cjs → chunk-JHLD73ZJ.cjs} +2 -0
  56. package/dist/expand/components.cjs +5 -5
  57. package/dist/expand/components.js +1 -1
  58. package/dist/expand/config.cjs +2 -2
  59. package/dist/expand/config.js +1 -1
  60. package/dist/icons/index.css +31 -31
  61. package/dist/icons/index.json +12 -12
  62. package/dist/index.cjs +68 -66
  63. package/dist/index.css +10 -26
  64. package/dist/index.js +2 -0
  65. package/package.json +13 -13
  66. /package/dist/components/{forms-items → forms-item}/index.css +0 -0
  67. /package/dist/css/{forms-items.css → forms-item.css} +0 -0
@@ -0,0 +1,121 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+ import { DateType } from './util';
3
+ import { comHandle } from '../../common/list';
4
+ export declare const dataProps: {
5
+ format: {
6
+ type: StringConstructor;
7
+ };
8
+ type: {
9
+ type: () => DateType;
10
+ };
11
+ separate: {
12
+ type: BooleanConstructor;
13
+ };
14
+ /**
15
+ * @props { Boolean } repair 是否格式化时间
16
+ */
17
+ repair: {
18
+ type: BooleanConstructor;
19
+ };
20
+ shortcuts: {
21
+ type: {
22
+ (arrayLength: number): {
23
+ text: string;
24
+ value: () => [Date, Date];
25
+ }[];
26
+ (...items: {
27
+ text: string;
28
+ value: () => [Date, Date];
29
+ }[]): {
30
+ text: string;
31
+ value: () => [Date, Date];
32
+ }[];
33
+ new (arrayLength: number): {
34
+ text: string;
35
+ value: () => [Date, Date];
36
+ }[];
37
+ new (...items: {
38
+ text: string;
39
+ value: () => [Date, Date];
40
+ }[]): {
41
+ text: string;
42
+ value: () => [Date, Date];
43
+ }[];
44
+ isArray(arg: any): arg is any[];
45
+ readonly prototype: any[];
46
+ from<T>(arrayLike: ArrayLike<T>): T[];
47
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
48
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
49
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
50
+ of<T>(...items: T[]): T[];
51
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
52
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
53
+ readonly [Symbol.species]: ArrayConstructor;
54
+ };
55
+ };
56
+ /**
57
+ * @props {String, Number, Date, Array} modelValue/v-model 时间数据
58
+ */
59
+ modelValue: {
60
+ type: (DateConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
61
+ };
62
+ options: {
63
+ type: {
64
+ (arrayLength: number): ObjAny[];
65
+ (...items: ObjAny[]): ObjAny[];
66
+ new (arrayLength: number): ObjAny[];
67
+ new (...items: ObjAny[]): ObjAny[];
68
+ isArray(arg: any): arg is any[];
69
+ readonly prototype: any[];
70
+ from<T>(arrayLike: ArrayLike<T>): T[];
71
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
72
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
73
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
74
+ of<T>(...items: T[]): T[];
75
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
76
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
77
+ readonly [Symbol.species]: ArrayConstructor;
78
+ };
79
+ default(): never[];
80
+ };
81
+ clearAbsent: {
82
+ type: BooleanConstructor;
83
+ };
84
+ label: {
85
+ type: (StringConstructor | FunctionConstructor)[];
86
+ default: string;
87
+ };
88
+ prop: {
89
+ type: (StringConstructor | FunctionConstructor)[];
90
+ default: string;
91
+ };
92
+ multiple: {
93
+ type: (BooleanConstructor | StringConstructor)[];
94
+ };
95
+ load: {
96
+ type: BooleanConstructor[];
97
+ };
98
+ optobj: {
99
+ type: BooleanConstructor[];
100
+ };
101
+ };
102
+ export type DataProps = ExtractPropTypes<typeof dataProps>;
103
+ /**
104
+ * @emits change (val:[String, Array])
105
+ * 选择的时间
106
+ */
107
+ export declare const dataEmits: string[];
108
+ export type DataEmits = typeof dataEmits;
109
+ export declare const dataHandle: typeof comHandle;
110
+ /**
111
+ * @slot default 默认插槽
112
+ */
113
+ export declare const dataSlot: {
114
+ default: string;
115
+ prefix: string;
116
+ };
117
+ /**
118
+ * @expose setValue (val:<string>设置的数据 )
119
+ * 设置值
120
+ */
121
+ export declare const dataExpose: {};
@@ -0,0 +1,43 @@
1
+ import "./util.js";
2
+ import { props, emits, comHandle } from "../../common/list.js";
3
+ const dataProps = {
4
+ ...props,
5
+ format: {
6
+ type: String
7
+ },
8
+ type: {
9
+ type: String
10
+ },
11
+ separate: {
12
+ type: Boolean
13
+ },
14
+ /**
15
+ * @props { Boolean } repair 是否格式化时间
16
+ */
17
+ repair: {
18
+ type: Boolean
19
+ },
20
+ shortcuts: {
21
+ type: Array
22
+ },
23
+ /**
24
+ * @props {String, Number, Date, Array} modelValue/v-model 时间数据
25
+ */
26
+ modelValue: {
27
+ type: [String, Number, Date, Array]
28
+ }
29
+ };
30
+ const dataEmits = [...emits];
31
+ const dataHandle = comHandle;
32
+ const dataSlot = {
33
+ default: "default",
34
+ prefix: "prefix"
35
+ };
36
+ const dataExpose = {};
37
+ export {
38
+ dataEmits,
39
+ dataExpose,
40
+ dataHandle,
41
+ dataProps,
42
+ dataSlot
43
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const index_vue_vue_type_script_setup_true_lang = require("./index2.cjs");
4
+ exports.default = index_vue_vue_type_script_setup_true_lang.default;
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./index2.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const data = require("./data.cjs");
5
+ const index$1 = require("../../../hooks/cssname/index.cjs");
6
+ const index = require("../../../hooks/inherit/index.cjs");
7
+ const util = require("./util.cjs");
8
+ const index$3 = require("../../dates-divide/index.cjs");
9
+ const index$2 = require("../../selects/index.cjs");
10
+ const index$4 = require("element-plus/es/components/date-picker/index");
11
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
12
+ __name: "index",
13
+ props: data.dataProps,
14
+ emits: data.dataEmits,
15
+ setup(__props, { expose: __expose, emit: __emit }) {
16
+ const attrs = index.useInherit(vue.useAttrs());
17
+ const slots = vue.useSlots();
18
+ const cs = index$1.useCssName("dates2");
19
+ const props = __props;
20
+ const emit = __emit;
21
+ const defaultTime = [
22
+ new Date(2e3, 0, 1, 0, 0, 0),
23
+ new Date(2e3, 11, 31, 23, 59, 59)
24
+ ];
25
+ const onChange = (v, obj) => {
26
+ value.value = getValue(obj[0].value());
27
+ };
28
+ const types = vue.computed(() => {
29
+ return util.getType(props.type || "date");
30
+ });
31
+ const listFuObj = data.dataHandle(props, emit, {
32
+ getValue
33
+ });
34
+ const value = listFuObj.value;
35
+ const multiple = listFuObj.multiple;
36
+ const type = vue.computed(() => {
37
+ var _a, _b;
38
+ if (multiple.value) {
39
+ return ((_a = types.value) == null ? void 0 : _a.double) || props.type;
40
+ } else {
41
+ return ((_b = types.value) == null ? void 0 : _b.type) || props.type;
42
+ }
43
+ });
44
+ function getValue(value2) {
45
+ var _a;
46
+ const format = attrs.assem["value-format"] || props.format || ((_a = types.value) == null ? void 0 : _a.format);
47
+ return util.formatType(value2, format, types.value, props.repair);
48
+ }
49
+ __expose({
50
+ ...data.dataExpose,
51
+ getValue
52
+ });
53
+ return (_ctx, _cache) => {
54
+ var _a, _b, _c;
55
+ return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
56
+ class: [vue.unref(cs).z()]
57
+ }, vue.unref(attrs).root), [
58
+ vue.renderSlot(_ctx.$slots, vue.unref(data.dataSlot).prefix),
59
+ props.separate && vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", {
60
+ key: 0,
61
+ class: vue.normalizeClass([vue.unref(cs).z("separate")])
62
+ }, [
63
+ props.shortcuts && props.shortcuts.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.Selects), {
64
+ key: 0,
65
+ options: props.shortcuts,
66
+ optobj: "",
67
+ placeholder: "快捷选择",
68
+ onChange,
69
+ label: "text",
70
+ prop: "text"
71
+ }, null, 8, ["options"])) : vue.createCommentVNode("", true),
72
+ vue.createVNode(vue.unref(index$3.DatesDivide), vue.mergeProps(vue.unref(attrs).assem, {
73
+ type: ((_a = types.value) == null ? void 0 : _a.type) || props.type,
74
+ format: props.format || ((_b = types.value) == null ? void 0 : _b.format),
75
+ "default-time": defaultTime,
76
+ modelValue: vue.unref(value),
77
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(value) ? value.value = $event : null)
78
+ }), null, 16, ["type", "format", "modelValue"])
79
+ ], 2)) : (vue.openBlock(), vue.createBlock(vue.unref(index$4.ElDatePicker), vue.mergeProps({ key: 1 }, vue.unref(attrs).assem, {
80
+ type: type.value,
81
+ format: props.format || ((_c = types.value) == null ? void 0 : _c.format),
82
+ "default-time": vue.unref(multiple) ? defaultTime : void 0,
83
+ shortcuts: props.shortcuts,
84
+ modelValue: vue.unref(value),
85
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(value) ? value.value = $event : null)
86
+ }), vue.createSlots({ _: 2 }, [
87
+ vue.renderList(Object.keys(vue.unref(slots)), (k, index2) => {
88
+ return {
89
+ name: k,
90
+ fn: vue.withCtx((scope) => [
91
+ vue.renderSlot(_ctx.$slots, k, vue.normalizeProps(vue.guardReactiveProps(scope)))
92
+ ])
93
+ };
94
+ })
95
+ ]), 1040, ["type", "format", "default-time", "shortcuts", "modelValue"]))
96
+ ], 16);
97
+ };
98
+ }
99
+ });
100
+ exports.default = _sfc_main;
@@ -0,0 +1,100 @@
1
+ import { defineComponent, useAttrs, useSlots, computed, createElementBlock, openBlock, mergeProps, unref, renderSlot, createBlock, normalizeClass, createCommentVNode, createVNode, isRef, createSlots, renderList, withCtx, normalizeProps, guardReactiveProps } from "vue";
2
+ import { dataHandle, dataExpose, dataSlot, dataEmits, dataProps } from "./data.js";
3
+ import { useCssName } from "../../../hooks/cssname/index.js";
4
+ import { useInherit } from "../../../hooks/inherit/index.js";
5
+ import { getType, formatType } from "./util.js";
6
+ import { DatesDivide } from "../../dates-divide/index.js";
7
+ import { Selects } from "../../selects/index.js";
8
+ import { ElDatePicker } from "element-plus/es/components/date-picker/index";
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ __name: "index",
11
+ props: dataProps,
12
+ emits: dataEmits,
13
+ setup(__props, { expose: __expose, emit: __emit }) {
14
+ const attrs = useInherit(useAttrs());
15
+ const slots = useSlots();
16
+ const cs = useCssName("dates2");
17
+ const props = __props;
18
+ const emit = __emit;
19
+ const defaultTime = [
20
+ new Date(2e3, 0, 1, 0, 0, 0),
21
+ new Date(2e3, 11, 31, 23, 59, 59)
22
+ ];
23
+ const onChange = (v, obj) => {
24
+ value.value = getValue(obj[0].value());
25
+ };
26
+ const types = computed(() => {
27
+ return getType(props.type || "date");
28
+ });
29
+ const listFuObj = dataHandle(props, emit, {
30
+ getValue
31
+ });
32
+ const value = listFuObj.value;
33
+ const multiple = listFuObj.multiple;
34
+ const type = computed(() => {
35
+ var _a, _b;
36
+ if (multiple.value) {
37
+ return ((_a = types.value) == null ? void 0 : _a.double) || props.type;
38
+ } else {
39
+ return ((_b = types.value) == null ? void 0 : _b.type) || props.type;
40
+ }
41
+ });
42
+ function getValue(value2) {
43
+ var _a;
44
+ const format = attrs.assem["value-format"] || props.format || ((_a = types.value) == null ? void 0 : _a.format);
45
+ return formatType(value2, format, types.value, props.repair);
46
+ }
47
+ __expose({
48
+ ...dataExpose,
49
+ getValue
50
+ });
51
+ return (_ctx, _cache) => {
52
+ var _a, _b, _c;
53
+ return openBlock(), createElementBlock("div", mergeProps({
54
+ class: [unref(cs).z()]
55
+ }, unref(attrs).root), [
56
+ renderSlot(_ctx.$slots, unref(dataSlot).prefix),
57
+ props.separate && unref(multiple) ? (openBlock(), createElementBlock("div", {
58
+ key: 0,
59
+ class: normalizeClass([unref(cs).z("separate")])
60
+ }, [
61
+ props.shortcuts && props.shortcuts.length > 0 ? (openBlock(), createBlock(unref(Selects), {
62
+ key: 0,
63
+ options: props.shortcuts,
64
+ optobj: "",
65
+ placeholder: "快捷选择",
66
+ onChange,
67
+ label: "text",
68
+ prop: "text"
69
+ }, null, 8, ["options"])) : createCommentVNode("", true),
70
+ createVNode(unref(DatesDivide), mergeProps(unref(attrs).assem, {
71
+ type: ((_a = types.value) == null ? void 0 : _a.type) || props.type,
72
+ format: props.format || ((_b = types.value) == null ? void 0 : _b.format),
73
+ "default-time": defaultTime,
74
+ modelValue: unref(value),
75
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(value) ? value.value = $event : null)
76
+ }), null, 16, ["type", "format", "modelValue"])
77
+ ], 2)) : (openBlock(), createBlock(unref(ElDatePicker), mergeProps({ key: 1 }, unref(attrs).assem, {
78
+ type: type.value,
79
+ format: props.format || ((_c = types.value) == null ? void 0 : _c.format),
80
+ "default-time": unref(multiple) ? defaultTime : void 0,
81
+ shortcuts: props.shortcuts,
82
+ modelValue: unref(value),
83
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(value) ? value.value = $event : null)
84
+ }), createSlots({ _: 2 }, [
85
+ renderList(Object.keys(unref(slots)), (k, index) => {
86
+ return {
87
+ name: k,
88
+ fn: withCtx((scope) => [
89
+ renderSlot(_ctx.$slots, k, normalizeProps(guardReactiveProps(scope)))
90
+ ])
91
+ };
92
+ })
93
+ ]), 1040, ["type", "format", "default-time", "shortcuts", "modelValue"]))
94
+ ], 16);
95
+ };
96
+ }
97
+ });
98
+ export {
99
+ _sfc_main as default
100
+ };
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const format = require("@fangzhongya/utils/date/format");
4
+ const typeMap = {
5
+ //年
6
+ year: {
7
+ type: "year",
8
+ format: "YYYY",
9
+ repair: 5,
10
+ double: "yearrange",
11
+ multiple: "years"
12
+ },
13
+ //月
14
+ month: {
15
+ type: "month",
16
+ format: "YYYY-MM",
17
+ repair: 4,
18
+ double: "monthrange",
19
+ multiple: "months"
20
+ },
21
+ //日
22
+ day: {
23
+ type: "date",
24
+ format: "YYYY-MM-DD",
25
+ repair: 3,
26
+ double: "daterange",
27
+ multiple: "dates"
28
+ },
29
+ date: {
30
+ type: "date",
31
+ format: "YYYY-MM-DD",
32
+ repair: 3,
33
+ double: "daterange",
34
+ multiple: "dates"
35
+ },
36
+ //秒
37
+ second: {
38
+ type: "datetime",
39
+ format: "YYYY-MM-DD HH:mm:ss",
40
+ repair: 0,
41
+ double: "datetimerange"
42
+ },
43
+ datetime: {
44
+ type: "datetime",
45
+ format: "YYYY-MM-DD HH:mm:ss",
46
+ repair: 0,
47
+ double: "datetimerange"
48
+ },
49
+ //时
50
+ hour: {
51
+ type: "datetime",
52
+ format: "YYYY-MM-DD HH",
53
+ repair: 2,
54
+ double: "datetimerange"
55
+ },
56
+ //分
57
+ minute: {
58
+ type: "datetime",
59
+ format: "YYYY-MM-DD HH:mm",
60
+ repair: 1,
61
+ double: "datetimerange"
62
+ }
63
+ };
64
+ function getType(type) {
65
+ return typeMap[type];
66
+ }
67
+ function getLastDayOfMonth(now) {
68
+ const nextMonth = new Date(now.getFullYear(), now.getMonth() + 1, 1);
69
+ const lastDayOfMonth = new Date(nextMonth.getTime() - 1);
70
+ return lastDayOfMonth;
71
+ }
72
+ function getRepairEnd(v, type) {
73
+ if (v) {
74
+ let format$1 = "YYYY-MM-DD HH:mm:ss";
75
+ let d = getDate(v);
76
+ switch (type) {
77
+ case 1: {
78
+ format$1 = "YYYY-MM-DD HH:mm:59";
79
+ break;
80
+ }
81
+ case 2: {
82
+ format$1 = "YYYY-MM-DD HH:59:59";
83
+ break;
84
+ }
85
+ case 3: {
86
+ format$1 = "YYYY-MM-DD 23:59:59";
87
+ break;
88
+ }
89
+ case 4: {
90
+ d = getLastDayOfMonth(d);
91
+ format$1 = "YYYY-MM-DD 23:59:59";
92
+ break;
93
+ }
94
+ case 5: {
95
+ format$1 = "YYYY-12-31 23:59:59";
96
+ break;
97
+ }
98
+ default: {
99
+ format$1 = "YYYY-MM-DD HH:mm:ss";
100
+ break;
101
+ }
102
+ }
103
+ return format.format(d, format$1);
104
+ } else {
105
+ return "";
106
+ }
107
+ }
108
+ function getRepairStart(v, type) {
109
+ if (v) {
110
+ let format$1 = "YYYY-MM-DD HH:mm:ss";
111
+ switch (type) {
112
+ case 1: {
113
+ format$1 = "YYYY-MM-DD HH:mm:00";
114
+ break;
115
+ }
116
+ case 2: {
117
+ format$1 = "YYYY-MM-DD HH:00:00";
118
+ break;
119
+ }
120
+ case 3: {
121
+ format$1 = "YYYY-MM-DD 00:00:00";
122
+ break;
123
+ }
124
+ case 4: {
125
+ format$1 = "YYYY-MM-01 00:00:00";
126
+ break;
127
+ }
128
+ case 5: {
129
+ format$1 = "YYYY-01-01 00:00:00";
130
+ break;
131
+ }
132
+ }
133
+ return format.format(getDate(v), format$1);
134
+ } else {
135
+ return "";
136
+ }
137
+ }
138
+ function parseDateString(dateStr) {
139
+ if (!dateStr || typeof dateStr !== "string") {
140
+ return /* @__PURE__ */ new Date(NaN);
141
+ }
142
+ const trimmed = dateStr.trim();
143
+ const [datePart, timePart = ""] = trimmed.split(" ");
144
+ const dateParts = datePart.split(/[-|\/]/).map(Number);
145
+ const year = dateParts[0];
146
+ const month = (dateParts[1] || 1) - 1;
147
+ const day = dateParts[2] || 1;
148
+ const timeParts = timePart.split(":").map(Number);
149
+ const hours = timeParts[0] || 0;
150
+ const minutes = timeParts[1] || 0;
151
+ const seconds = timeParts[2] || 0;
152
+ return new Date(year, month, day, hours, minutes, seconds);
153
+ }
154
+ function getDate(d) {
155
+ if (typeof d === "object") {
156
+ return d;
157
+ } else {
158
+ if (typeof d === "string") {
159
+ return parseDateString(d);
160
+ }
161
+ return new Date(d);
162
+ }
163
+ }
164
+ function formatType(v, format$1 = "YYYY-MM-DD", type, is) {
165
+ if (is) {
166
+ if (v instanceof Array) {
167
+ for (let index = 0; index < v.length; index++) {
168
+ const element = v[index];
169
+ if (index == 0) {
170
+ v[index] = getRepairStart(element, type.repair);
171
+ } else if (index == v.length - 1) {
172
+ v[index] = getRepairEnd(element, type.repair);
173
+ } else {
174
+ v[index] = element ? format.format(getDate(element), format$1) : "";
175
+ }
176
+ }
177
+ return v;
178
+ } else {
179
+ return getRepairStart(v, type.repair);
180
+ }
181
+ } else {
182
+ if (v instanceof Array) {
183
+ for (let index = 0; index < v.length; index++) {
184
+ const element = v[index];
185
+ v[index] = element ? format.format(getDate(element), format$1) : "";
186
+ }
187
+ return v;
188
+ } else {
189
+ return v ? format.format(getDate(v), format$1) : "";
190
+ }
191
+ }
192
+ }
193
+ exports.formatType = formatType;
194
+ exports.getDate = getDate;
195
+ exports.getType = getType;
@@ -0,0 +1,14 @@
1
+ type SingleType = 'year' | 'month' | 'date' | 'datetime';
2
+ type DoubleType = 'yearrange' | 'monthrange' | 'daterange' | 'datetimerange';
3
+ export type DateType = SingleType | DoubleType;
4
+ type TypeMap = {
5
+ type: SingleType;
6
+ format?: string;
7
+ repair: number;
8
+ double?: DoubleType;
9
+ multiple?: string;
10
+ };
11
+ export declare function getType(type: DateType): TypeMap;
12
+ export declare function getDate(d: Date | number | string): Date;
13
+ export declare function formatType(v: any, format: string | undefined, type: TypeMap, is?: boolean): string | any[];
14
+ export {};