react-antd-xform 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/form/extend/form-reset.d.ts +1 -1
- package/dist/form/extend/form-reset.js +5 -1
- package/dist/form/extend/form-submit.d.ts +1 -1
- package/dist/form/extend/form-submit.js +5 -1
- package/dist/form/type.d.ts +12 -0
- package/dist/form-ui/common-utils.js +18 -2
- package/dist/form-ui/default-component.js +5 -5
- package/dist/form-ui/render-preview.d.ts +62 -19
- package/dist/form-ui/render-preview.js +93 -27
- package/package.json +8 -4
- package/dist/_virtual/isoWeek.js +0 -4
- package/dist/node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/plugin/isoWeek.js +0 -33
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## 📦 安装
|
|
2
|
+
|
|
3
|
+
选择你喜欢的包管理器进行安装:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# npm
|
|
7
|
+
npm install react-antd-xform --save
|
|
8
|
+
|
|
9
|
+
# yarn
|
|
10
|
+
yarn add react-antd-xform
|
|
11
|
+
|
|
12
|
+
# pnpm
|
|
13
|
+
pnpm add react-antd-xform
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
文档地址:https://jhuazhang.github.io/react-antd-xform 或者访问http://handn.xyz/react-antd-xform
|
|
@@ -10,7 +10,11 @@ function FormReset({
|
|
|
10
10
|
}) {
|
|
11
11
|
const model = useModel();
|
|
12
12
|
const formEnv = useFormEnv();
|
|
13
|
-
|
|
13
|
+
if (ButtonComponent) {
|
|
14
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonComponent, { ...props, onClick: action(() => modelUtils.reset(model, formEnv)), children, ...props });
|
|
15
|
+
} else {
|
|
16
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...props, onClick: action(() => modelUtils.reset(model, formEnv)), children, ...props });
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
export {
|
|
16
20
|
FormReset
|
|
@@ -16,7 +16,11 @@ function FormSubmit({
|
|
|
16
16
|
onSubmit,
|
|
17
17
|
onError
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
if (ButtonComponent) {
|
|
20
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonComponent, { ...props, onClick: () => modelUtils.submit(model, submitOptions), children, ...props });
|
|
21
|
+
} else {
|
|
22
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...props, onClick: () => modelUtils.submit(model, submitOptions), children, ...props });
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
export {
|
|
22
26
|
FormSubmit
|
package/dist/form/type.d.ts
CHANGED
|
@@ -214,6 +214,17 @@ export interface FormItemCreationOptions {
|
|
|
214
214
|
/** 组件是否具有固有宽度,默认为 true。该选项为 true 时,controlWidth 将不对组件产生效果 */
|
|
215
215
|
hasIntrinsicWidth?: boolean;
|
|
216
216
|
}
|
|
217
|
+
export interface BaseOptionType {
|
|
218
|
+
disabled?: boolean;
|
|
219
|
+
className?: string;
|
|
220
|
+
title?: string;
|
|
221
|
+
[name: string]: any;
|
|
222
|
+
}
|
|
223
|
+
export interface DefaultOptionType extends BaseOptionType {
|
|
224
|
+
label?: React.ReactNode;
|
|
225
|
+
value?: string | number | null;
|
|
226
|
+
children?: Omit<DefaultOptionType, 'children'>[];
|
|
227
|
+
}
|
|
217
228
|
export interface FormItemProps extends Omit<FieldConfig<any>, 'defaultValueProp' | 'valueProp' | 'htmlId'> {
|
|
218
229
|
use?: boolean;
|
|
219
230
|
component: string | React.ComponentType<FormItemComponentProps>;
|
|
@@ -236,6 +247,7 @@ export interface FormItemProps extends Omit<FieldConfig<any>, 'defaultValueProp'
|
|
|
236
247
|
rightNode?: React.ReactNode;
|
|
237
248
|
isPreview?: boolean;
|
|
238
249
|
variant?: Variant;
|
|
250
|
+
options?: DefaultOptionType[];
|
|
239
251
|
}
|
|
240
252
|
export interface FormItemViewProps {
|
|
241
253
|
/** `<label />` 的 id 属性 */
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js";
|
|
2
2
|
import React, { useMemo, useCallback } from "react";
|
|
3
3
|
import dayjs from "../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/dayjs.min.js";
|
|
4
|
-
import isoweek from "../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/plugin/isoWeek.js";
|
|
5
4
|
import weekYear from "../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/plugin/weekYear.js";
|
|
6
5
|
import weekOfYear from "../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/plugin/weekOfYear.js";
|
|
7
6
|
dayjs.extend(weekOfYear);
|
|
8
7
|
dayjs.extend(weekYear);
|
|
9
|
-
dayjs.
|
|
8
|
+
if (!dayjs.__patchedForAntd__) {
|
|
9
|
+
dayjs.__patchedForAntd__ = true;
|
|
10
|
+
if (!dayjs.prototype.weekday) {
|
|
11
|
+
dayjs.prototype.weekday = function() {
|
|
12
|
+
return this.day();
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (!dayjs.prototype.localeData) {
|
|
16
|
+
dayjs.prototype.localeData = function() {
|
|
17
|
+
return {
|
|
18
|
+
firstDayOfWeek: () => 1,
|
|
19
|
+
// 默认中文环境周一开头
|
|
20
|
+
weekdaysShort: () => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
21
|
+
monthsShort: () => "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_")
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
10
26
|
function isEmptyValue(value) {
|
|
11
27
|
return !value && value !== 0 || Array.isArray(value) && value.length === 0;
|
|
12
28
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ColorPicker, Rate, TimePicker, DatePicker, Switch, Slider, InputNumber, Checkbox, Radio, Select, Input } from "antd";
|
|
2
2
|
import { withInjectedProps, withDayjsTransformAntdTimeRange, withDayjsTransformAntdTime, withDayjsTransformAntdDateRangePicker, withDayjsTransformAntdDate, withValueChangeHandler, isEmptyValue, withColorPickerHandler } from "./common-utils.js";
|
|
3
|
-
import { useColorPreview, useRatePreview, useTimeRangePreview, useTimePreview, useDateRangePreview, useDatePreview, useBooleanPreview, useValueToPreview, useMultiplePreview } from "./render-preview.js";
|
|
3
|
+
import { useColorPreview, useRatePreview, useTimeRangePreview, useTimePreview, useDateRangePreview, useDatePreview, useBooleanPreview, useValueToPreview, useMultiplePreview, useSelectToPreview } from "./render-preview.js";
|
|
4
4
|
const COMPONENT_MAP = {
|
|
5
5
|
input: Input,
|
|
6
6
|
textArea: Input.TextArea,
|
|
@@ -50,17 +50,17 @@ const COMPONENT_RULES = {
|
|
|
50
50
|
},
|
|
51
51
|
select: {
|
|
52
52
|
hocs: [],
|
|
53
|
-
renderPreview:
|
|
53
|
+
renderPreview: useSelectToPreview,
|
|
54
54
|
hasIntrinsicWidth: true
|
|
55
55
|
},
|
|
56
56
|
singleSelect: {
|
|
57
57
|
hocs: [],
|
|
58
|
-
renderPreview:
|
|
58
|
+
renderPreview: useSelectToPreview,
|
|
59
59
|
hasIntrinsicWidth: true
|
|
60
60
|
},
|
|
61
61
|
multiSelect: {
|
|
62
62
|
hocs: ["multiSelect"],
|
|
63
|
-
renderPreview:
|
|
63
|
+
renderPreview: useSelectToPreview,
|
|
64
64
|
hasIntrinsicWidth: true
|
|
65
65
|
},
|
|
66
66
|
radio: {
|
|
@@ -155,7 +155,7 @@ const ALL_COMPONENTS = Object.keys(COMPONENT_MAP).map((name) => {
|
|
|
155
155
|
defaultValue: DEFAULT_VALUES[name],
|
|
156
156
|
isEmpty: isEmptyValue,
|
|
157
157
|
hasIntrinsicWidth: rule.hasIntrinsicWidth,
|
|
158
|
-
renderPreview: (props) => rule.renderPreview(props
|
|
158
|
+
renderPreview: (props) => rule.renderPreview(props)
|
|
159
159
|
};
|
|
160
160
|
});
|
|
161
161
|
export {
|
|
@@ -1,29 +1,72 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export declare const useValueToPreview: (
|
|
1
|
+
/** 通用默认预览,直接使用value进行设置 */
|
|
2
|
+
export declare const useValueToPreview: (props: {
|
|
3
|
+
value: string;
|
|
4
|
+
}) => React.ReactNode;
|
|
5
|
+
export declare const useSelectToPreview: (props: {
|
|
6
|
+
value: string | number | (string | number)[] | null | undefined;
|
|
7
|
+
options: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string | number;
|
|
10
|
+
}[];
|
|
11
|
+
}) => React.ReactNode;
|
|
3
12
|
/** 日期预览 */
|
|
4
|
-
export declare const useDatePreview: (
|
|
13
|
+
export declare const useDatePreview: (props: {
|
|
14
|
+
value: any;
|
|
15
|
+
}) => React.ReactNode;
|
|
5
16
|
/** 日期范围预览 */
|
|
6
|
-
export declare const useDateRangePreview: (
|
|
17
|
+
export declare const useDateRangePreview: (props: {
|
|
18
|
+
value: [any, any] | null | undefined;
|
|
19
|
+
}) => React.ReactNode;
|
|
7
20
|
/** 时间预览 */
|
|
8
|
-
export declare const useTimePreview: (
|
|
21
|
+
export declare const useTimePreview: (props: {
|
|
22
|
+
value: any;
|
|
23
|
+
}) => React.ReactNode;
|
|
9
24
|
/** 时间范围预览 */
|
|
10
|
-
export declare const useTimeRangePreview: (
|
|
25
|
+
export declare const useTimeRangePreview: (props: {
|
|
26
|
+
value: [any, any] | null | undefined;
|
|
27
|
+
}) => React.ReactNode;
|
|
11
28
|
/** 多选/标签类预览 */
|
|
12
|
-
export declare const useMultiplePreview: (
|
|
29
|
+
export declare const useMultiplePreview: (props: {
|
|
30
|
+
value: any[];
|
|
31
|
+
}) => React.ReactNode;
|
|
13
32
|
/** 开关类预览 */
|
|
14
|
-
export declare const useBooleanPreview: (
|
|
33
|
+
export declare const useBooleanPreview: (props: {
|
|
34
|
+
value: boolean;
|
|
35
|
+
}) => React.ReactNode;
|
|
15
36
|
/** 评分预览 */
|
|
16
|
-
export declare const useRatePreview: (
|
|
37
|
+
export declare const useRatePreview: (props: {
|
|
38
|
+
value: number;
|
|
39
|
+
}) => React.ReactNode;
|
|
17
40
|
/** 颜色预览(返回色块) */
|
|
18
|
-
export declare const useColorPreview: (
|
|
41
|
+
export declare const useColorPreview: (props: {
|
|
42
|
+
value: string;
|
|
43
|
+
}) => React.ReactNode;
|
|
19
44
|
export declare const PREVIEW_RENDERERS: {
|
|
20
|
-
readonly useValueToPreview: (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
readonly useValueToPreview: (props: {
|
|
46
|
+
value: string;
|
|
47
|
+
}) => React.ReactNode;
|
|
48
|
+
readonly useDatePreview: (props: {
|
|
49
|
+
value: any;
|
|
50
|
+
}) => React.ReactNode;
|
|
51
|
+
readonly useDateRangePreview: (props: {
|
|
52
|
+
value: [any, any] | null | undefined;
|
|
53
|
+
}) => React.ReactNode;
|
|
54
|
+
readonly useTimePreview: (props: {
|
|
55
|
+
value: any;
|
|
56
|
+
}) => React.ReactNode;
|
|
57
|
+
readonly useTimeRangePreview: (props: {
|
|
58
|
+
value: [any, any] | null | undefined;
|
|
59
|
+
}) => React.ReactNode;
|
|
60
|
+
readonly useMultiplePreview: (props: {
|
|
61
|
+
value: any[];
|
|
62
|
+
}) => React.ReactNode;
|
|
63
|
+
readonly useBooleanPreview: (props: {
|
|
64
|
+
value: boolean;
|
|
65
|
+
}) => React.ReactNode;
|
|
66
|
+
readonly useRatePreview: (props: {
|
|
67
|
+
value: number;
|
|
68
|
+
}) => React.ReactNode;
|
|
69
|
+
readonly useColorPreview: (props: {
|
|
70
|
+
value: string;
|
|
71
|
+
}) => React.ReactNode;
|
|
29
72
|
};
|
|
@@ -1,41 +1,106 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js";
|
|
2
2
|
import dayjs from "../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/dayjs.min.js";
|
|
3
|
-
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
const useValueToPreview = (props) => {
|
|
5
|
+
const {
|
|
6
|
+
value
|
|
7
|
+
} = props;
|
|
4
8
|
return value != null && value !== "" ? `${value}` : "--";
|
|
5
9
|
};
|
|
6
|
-
const
|
|
7
|
-
|
|
10
|
+
const useSelectToPreview = (props) => {
|
|
11
|
+
const {
|
|
12
|
+
value,
|
|
13
|
+
options
|
|
14
|
+
} = props;
|
|
15
|
+
return useMemo(() => {
|
|
16
|
+
if (value === null || value === void 0) {
|
|
17
|
+
return "--";
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
if (value.length === 0) return "--";
|
|
21
|
+
const labels = value.map((val) => {
|
|
22
|
+
const matched = options.find((item) => item.value === val);
|
|
23
|
+
return matched ? matched.label : null;
|
|
24
|
+
}).filter(Boolean);
|
|
25
|
+
return labels.length > 0 ? labels.join("、") : "--";
|
|
26
|
+
}
|
|
27
|
+
const matchedOption = options.find((item) => item.value === value);
|
|
28
|
+
return matchedOption ? matchedOption.label : "--";
|
|
29
|
+
}, [value, options]);
|
|
8
30
|
};
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
31
|
+
const useDatePreview = (props) => {
|
|
32
|
+
const {
|
|
33
|
+
value
|
|
34
|
+
} = props;
|
|
35
|
+
return useMemo(() => {
|
|
36
|
+
return value ? dayjs(value).format("YYYY-MM-DD") : "--";
|
|
37
|
+
}, [value]);
|
|
12
38
|
};
|
|
13
|
-
const
|
|
14
|
-
|
|
39
|
+
const useDateRangePreview = (props) => {
|
|
40
|
+
const {
|
|
41
|
+
value
|
|
42
|
+
} = props;
|
|
43
|
+
return useMemo(() => {
|
|
44
|
+
if (!Array.isArray(value) || !value[0] || !value[1]) return "--";
|
|
45
|
+
return `${dayjs(value[0]).format("YYYY-MM-DD")} ~ ${dayjs(value[1]).format("YYYY-MM-DD")}`;
|
|
46
|
+
}, [value]);
|
|
15
47
|
};
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
48
|
+
const useTimePreview = (props) => {
|
|
49
|
+
const {
|
|
50
|
+
value
|
|
51
|
+
} = props;
|
|
52
|
+
return useMemo(() => {
|
|
53
|
+
return value ? dayjs(value).format("HH:mm:ss") : "--";
|
|
54
|
+
}, [value]);
|
|
19
55
|
};
|
|
20
|
-
const
|
|
21
|
-
|
|
56
|
+
const useTimeRangePreview = (props) => {
|
|
57
|
+
const {
|
|
58
|
+
value
|
|
59
|
+
} = props;
|
|
60
|
+
return useMemo(() => {
|
|
61
|
+
if (!Array.isArray(value) || !value[0] || !value[1]) return "--";
|
|
62
|
+
return `${dayjs(value[0]).format("HH:mm")} ~ ${dayjs(value[1]).format("HH:mm")}`;
|
|
63
|
+
}, [value]);
|
|
22
64
|
};
|
|
23
|
-
const
|
|
24
|
-
|
|
65
|
+
const useMultiplePreview = (props) => {
|
|
66
|
+
const {
|
|
67
|
+
value
|
|
68
|
+
} = props;
|
|
69
|
+
return useMemo(() => {
|
|
70
|
+
return Array.isArray(value) && value.length > 0 ? value.join(", ") : "--";
|
|
71
|
+
}, [value]);
|
|
25
72
|
};
|
|
26
|
-
const
|
|
27
|
-
|
|
73
|
+
const useBooleanPreview = (props) => {
|
|
74
|
+
const {
|
|
75
|
+
value
|
|
76
|
+
} = props;
|
|
77
|
+
return useMemo(() => {
|
|
78
|
+
return typeof value === "boolean" ? value ? "是" : "否" : "--";
|
|
79
|
+
}, [value]);
|
|
28
80
|
};
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
81
|
+
const useRatePreview = (props) => {
|
|
82
|
+
const {
|
|
83
|
+
value
|
|
84
|
+
} = props;
|
|
85
|
+
return useMemo(() => {
|
|
86
|
+
return typeof value === "number" ? "★".repeat(value) + "☆".repeat(5 - value) : "--";
|
|
87
|
+
}, [value]);
|
|
88
|
+
};
|
|
89
|
+
const useColorPreview = (props) => {
|
|
90
|
+
const {
|
|
91
|
+
value
|
|
92
|
+
} = props;
|
|
93
|
+
return useMemo(() => {
|
|
94
|
+
if (!value) return "--";
|
|
95
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: {
|
|
96
|
+
display: "inline-block",
|
|
97
|
+
width: 16,
|
|
98
|
+
height: 16,
|
|
99
|
+
border: "1px solid #ddd",
|
|
100
|
+
backgroundColor: value,
|
|
101
|
+
borderRadius: 3
|
|
102
|
+
} });
|
|
103
|
+
}, [value]);
|
|
39
104
|
};
|
|
40
105
|
export {
|
|
41
106
|
useBooleanPreview,
|
|
@@ -44,6 +109,7 @@ export {
|
|
|
44
109
|
useDateRangePreview,
|
|
45
110
|
useMultiplePreview,
|
|
46
111
|
useRatePreview,
|
|
112
|
+
useSelectToPreview,
|
|
47
113
|
useTimePreview,
|
|
48
114
|
useTimeRangePreview,
|
|
49
115
|
useValueToPreview
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-antd-xform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "基于mobx的form解决方案",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
"dev": "sb dev -p 6006",
|
|
16
16
|
"build-storybook": "sb build",
|
|
17
17
|
"docs:dev": "dumi dev",
|
|
18
|
-
"docs:build": "dumi build",
|
|
19
|
-
"docs:
|
|
18
|
+
"docs:build-site": "dumi build",
|
|
19
|
+
"docs:build": "cross-env DUMI_ENV=devbuild dumi build",
|
|
20
|
+
"predeploy": "npm run docs:build-site",
|
|
21
|
+
"deploy": "gh-pages -d docs-dist -b gh-pages"
|
|
20
22
|
},
|
|
21
23
|
"keywords": [],
|
|
22
24
|
"author": "",
|
|
23
25
|
"license": "ISC",
|
|
24
|
-
"packageManager": "pnpm@10.12.1",
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@types/invariant": "^2.2.37",
|
|
27
28
|
"@types/stringify-object": "^4.0.5",
|
|
@@ -46,9 +47,12 @@
|
|
|
46
47
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
47
48
|
"@vitejs/plugin-react": "^4.6.0",
|
|
48
49
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
50
|
+
"cross-env": "^10.0.0",
|
|
49
51
|
"dumi": "^2.4.21",
|
|
50
52
|
"dumi-theme-antd": "^0.4.4",
|
|
53
|
+
"gh-pages": "^6.3.0",
|
|
51
54
|
"react": "^18.2.0",
|
|
55
|
+
"react-antd-xform": "^1.0.9",
|
|
52
56
|
"react-dom": "^18.2.0",
|
|
53
57
|
"react-json-view": "^1.21.3",
|
|
54
58
|
"vite": "^5.2.0",
|
package/dist/_virtual/isoWeek.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { commonjsGlobal, getDefaultExportFromCjs } from "../../../../../../_virtual/_commonjsHelpers.js";
|
|
2
|
-
import { __module as isoWeek } from "../../../../../../_virtual/isoWeek.js";
|
|
3
|
-
(function(module, exports) {
|
|
4
|
-
!function(e, t) {
|
|
5
|
-
module.exports = t();
|
|
6
|
-
}(commonjsGlobal, function() {
|
|
7
|
-
var e = "day";
|
|
8
|
-
return function(t, i, s) {
|
|
9
|
-
var a = function(t2) {
|
|
10
|
-
return t2.add(4 - t2.isoWeekday(), e);
|
|
11
|
-
}, d = i.prototype;
|
|
12
|
-
d.isoWeekYear = function() {
|
|
13
|
-
return a(this).year();
|
|
14
|
-
}, d.isoWeek = function(t2) {
|
|
15
|
-
if (!this.$utils().u(t2)) return this.add(7 * (t2 - this.isoWeek()), e);
|
|
16
|
-
var i2, d2, n2, o, r = a(this), u = (i2 = this.isoWeekYear(), d2 = this.$u, n2 = (d2 ? s.utc : s)().year(i2).startOf("year"), o = 4 - n2.isoWeekday(), n2.isoWeekday() > 4 && (o += 7), n2.add(o, e));
|
|
17
|
-
return r.diff(u, "week") + 1;
|
|
18
|
-
}, d.isoWeekday = function(e2) {
|
|
19
|
-
return this.$utils().u(e2) ? this.day() || 7 : this.day(this.day() % 7 ? e2 : e2 - 7);
|
|
20
|
-
};
|
|
21
|
-
var n = d.startOf;
|
|
22
|
-
d.startOf = function(e2, t2) {
|
|
23
|
-
var i2 = this.$utils(), s2 = !!i2.u(t2) || t2;
|
|
24
|
-
return "isoweek" === i2.p(e2) ? s2 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : n.bind(this)(e2, t2);
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
})(isoWeek);
|
|
29
|
-
var isoWeekExports = isoWeek.exports;
|
|
30
|
-
const isoweek = /* @__PURE__ */ getDefaultExportFromCjs(isoWeekExports);
|
|
31
|
-
export {
|
|
32
|
-
isoweek as default
|
|
33
|
-
};
|