revdev-components 0.273.0 → 0.274.0
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/build/fields/datePicker/index.d.ts +6 -1
- package/build/index.js +24 -1
- package/package.json +5 -2
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DatePickerProps } from "antd";
|
|
3
3
|
import { FormLineProps } from "../line";
|
|
4
|
-
interface
|
|
4
|
+
interface ControlProps extends Omit<DatePickerProps, "value" | "onChange" | "format"> {
|
|
5
|
+
format: string;
|
|
6
|
+
value?: string | null;
|
|
7
|
+
onChange?: (value: string | null) => void;
|
|
8
|
+
}
|
|
9
|
+
interface Props extends FormLineProps, Omit<ControlProps, "name" | "value" | "onChange"> {
|
|
5
10
|
}
|
|
6
11
|
export declare const DatePickerField: React.FC<Props>;
|
|
7
12
|
export {};
|
package/build/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var React = require('react');
|
|
|
4
4
|
var classNames = require('classnames');
|
|
5
5
|
var antd = require('antd');
|
|
6
6
|
var router = require('next/router');
|
|
7
|
+
var dayjs = require('dayjs');
|
|
7
8
|
var Link = require('next/link');
|
|
8
9
|
var numeral = require('numeral');
|
|
9
10
|
|
|
@@ -5442,10 +5443,32 @@ var FormLine = function (_a) {
|
|
|
5442
5443
|
return (React.createElement(antd.Form.Item, __assign({ className: classNames(s$B.root, (_b = {}, _b[s$B.root__right] = !!rightLabel, _b), className), rules: rules, label: singleLabel }, props)));
|
|
5443
5444
|
};
|
|
5444
5445
|
|
|
5446
|
+
var Control = function (_a) {
|
|
5447
|
+
var value = _a.value, format = _a.format, onChange = _a.onChange, props = __rest(_a, ["value", "format", "onChange"]);
|
|
5448
|
+
var handleChange = React.useCallback(function (date) {
|
|
5449
|
+
if (typeof date === "string") {
|
|
5450
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(date);
|
|
5451
|
+
}
|
|
5452
|
+
else if (dayjs.isDayjs(date)) {
|
|
5453
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(date.format(format));
|
|
5454
|
+
}
|
|
5455
|
+
else {
|
|
5456
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
5457
|
+
}
|
|
5458
|
+
}, [onChange, format]);
|
|
5459
|
+
var currentValue = React.useMemo(function () {
|
|
5460
|
+
if (value) {
|
|
5461
|
+
var parsed = dayjs(value, format);
|
|
5462
|
+
return parsed;
|
|
5463
|
+
}
|
|
5464
|
+
return null;
|
|
5465
|
+
}, [value, format]);
|
|
5466
|
+
return React.createElement(antd.DatePicker, __assign({ value: currentValue, onChange: handleChange, format: format }, props));
|
|
5467
|
+
};
|
|
5445
5468
|
var DatePickerField = function (props) {
|
|
5446
5469
|
var _a = useLineProps(props), lineProps = _a[0], controlProps = _a[1];
|
|
5447
5470
|
return (React.createElement(FormLine, __assign({}, lineProps),
|
|
5448
|
-
React.createElement(
|
|
5471
|
+
React.createElement(Control, __assign({}, controlProps))));
|
|
5449
5472
|
};
|
|
5450
5473
|
|
|
5451
5474
|
var HiddenField = function (_a) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "revdev-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.274.0",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"module": "build/index.esm.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"next": "^16.0.3",
|
|
25
25
|
"page-path": ">=0.7",
|
|
26
26
|
"react": "^19.2.0",
|
|
27
|
-
"react-dom": "^19.2.0"
|
|
27
|
+
"react-dom": "^19.2.0",
|
|
28
|
+
"dayjs": ">=1.11"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@ant-design/v5-patch-for-react-19": "^1.0.3",
|
|
@@ -41,8 +42,10 @@
|
|
|
41
42
|
"@types/react-dom": "^19.2.3",
|
|
42
43
|
"antd": "^5.29.0",
|
|
43
44
|
"classnames": "^2.5.1",
|
|
45
|
+
"dayjs": "^1.11.21",
|
|
44
46
|
"eslint-config-varp": "^2.10.0",
|
|
45
47
|
"eslint-plugin-storybook": "10.0.8",
|
|
48
|
+
"moment": "^2.30.1",
|
|
46
49
|
"next": "^16.0.3",
|
|
47
50
|
"numeral": "^2.0.6",
|
|
48
51
|
"page-path": "^0.7.0",
|