@hw-component/form 0.0.3 → 0.0.5
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/es/DatePicker/RangePicker.d.ts +1 -1
- package/es/DatePicker/index.d.ts +1 -1
- package/es/Select/components/AllSelect.js +1 -1
- package/es/config.d.ts +0 -1
- package/es/config.js +1 -2
- package/es/hooks/useClassName.js +4 -3
- package/es/index.css +1 -1
- package/lib/DatePicker/RangePicker.d.ts +1 -1
- package/lib/DatePicker/index.d.ts +1 -1
- package/lib/Select/components/AllSelect.js +1 -1
- package/lib/config.d.ts +0 -1
- package/lib/config.js +1 -2
- package/lib/hooks/useClassName.js +3 -2
- package/lib/index.css +1 -1
- package/package.json +1 -1
- package/scripts/rollup.config.js +1 -1
- package/scripts/webpack.config.js +8 -1
- package/src/components/DatePicker/RangePicker.tsx +17 -5
- package/src/components/DatePicker/index.tsx +1 -1
- package/src/components/DatePicker/modal.d.ts +14 -13
- package/src/components/Select/components/AllSelect.tsx +3 -3
- package/src/components/Select/index.less +2 -2
- package/src/components/config.ts +0 -1
- package/src/components/hooks/useClassName.ts +8 -7
- package/src/components/index.tsx +0 -1
- package/src/components/styles/index.less +1 -0
- package/src/components/styles/local.less +1 -0
- package/src/pages/DatePicker/index.tsx +2 -2
- package/src/components/config.less +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IRangePickerProps } from "@/components/DatePicker/modal";
|
|
2
|
+
import type { IRangePickerProps } from "@/components/DatePicker/modal";
|
|
3
3
|
declare const _default: ({ value, onChange, showTime, ...props }: IRangePickerProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
package/es/DatePicker/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IDatePickerProps } from "@/components/DatePicker/modal";
|
|
2
|
+
import type { IDatePickerProps } from "@/components/DatePicker/modal";
|
|
3
3
|
declare const _default: ({ value, onChange, showTime, format, ...props }: IDatePickerProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -17,7 +17,7 @@ var AllSelect = (function (_ref) {
|
|
|
17
17
|
}
|
|
18
18
|
var opLen = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
19
19
|
var checked = (value === null || value === void 0 ? void 0 : value.length) >= opLen;
|
|
20
|
-
var optionsClassName = useClassName("option");
|
|
20
|
+
var optionsClassName = useClassName("hw-option");
|
|
21
21
|
var change = function change() {
|
|
22
22
|
if (!checked) {
|
|
23
23
|
var subItemOps = itemOpProvider(options, fieldNames);
|
package/es/config.d.ts
CHANGED
package/es/config.js
CHANGED
package/es/hooks/useClassName.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// welcome to ww-building-blocks-tmp
|
|
2
2
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/concat';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { useContext, useMemo } from 'react';
|
|
4
|
+
import { ConfigContext } from 'antd/es/config-provider';
|
|
5
5
|
|
|
6
6
|
var useClassName = function useClassName(className) {
|
|
7
|
+
var config = useContext(ConfigContext);
|
|
7
8
|
return useMemo(function () {
|
|
8
9
|
var _context;
|
|
9
|
-
return _concatInstanceProperty(_context = "".concat(
|
|
10
|
+
return _concatInstanceProperty(_context = "".concat(config.getPrefixCls(), "-")).call(_context, className);
|
|
10
11
|
}, [className]);
|
|
11
12
|
};
|
|
12
13
|
|
package/es/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IRangePickerProps } from "@/components/DatePicker/modal";
|
|
2
|
+
import type { IRangePickerProps } from "@/components/DatePicker/modal";
|
|
3
3
|
declare const _default: ({ value, onChange, showTime, ...props }: IRangePickerProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IDatePickerProps } from "@/components/DatePicker/modal";
|
|
2
|
+
import type { IDatePickerProps } from "@/components/DatePicker/modal";
|
|
3
3
|
declare const _default: ({ value, onChange, showTime, format, ...props }: IDatePickerProps) => JSX.Element;
|
|
4
4
|
export default _default;
|
|
@@ -20,7 +20,7 @@ var AllSelect = (function (_ref) {
|
|
|
20
20
|
}
|
|
21
21
|
var opLen = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
22
22
|
var checked = (value === null || value === void 0 ? void 0 : value.length) >= opLen;
|
|
23
|
-
var optionsClassName = useClassName.useClassName("option");
|
|
23
|
+
var optionsClassName = useClassName.useClassName("hw-option");
|
|
24
24
|
var change = function change() {
|
|
25
25
|
if (!checked) {
|
|
26
26
|
var subItemOps = utils.itemOpProvider(options, fieldNames);
|
package/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/concat');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var
|
|
5
|
+
var configProvider = require('antd/es/config-provider');
|
|
6
6
|
|
|
7
7
|
var useClassName = function useClassName(className) {
|
|
8
|
+
var config = React.useContext(configProvider.ConfigContext);
|
|
8
9
|
return React.useMemo(function () {
|
|
9
10
|
var _context;
|
|
10
|
-
return _concatInstanceProperty(_context = "".concat(config.
|
|
11
|
+
return _concatInstanceProperty(_context = "".concat(config.getPrefixCls(), "-")).call(_context, className);
|
|
11
12
|
}, [className]);
|
|
12
13
|
};
|
|
13
14
|
|
package/lib/index.css
CHANGED
package/package.json
CHANGED
package/scripts/rollup.config.js
CHANGED
|
@@ -8,7 +8,7 @@ const autoprefixer = require("autoprefixer");
|
|
|
8
8
|
const inject = require("@rollup/plugin-inject");
|
|
9
9
|
const url = require("@rollup/plugin-url");
|
|
10
10
|
const pkg = require("../package.json");
|
|
11
|
-
const postcss=require("rollup-plugin-postcss");
|
|
11
|
+
const postcss = require("rollup-plugin-postcss");
|
|
12
12
|
const prefix = pkg.cssPrefix;
|
|
13
13
|
const input = path.resolve(__dirname, "../src/components/index.tsx");
|
|
14
14
|
const outDir = path.resolve(__dirname, "../lib");
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {DatePicker} from
|
|
2
|
-
import {IRangePickerProps} from "@/components/DatePicker/modal";
|
|
1
|
+
import { DatePicker } from "antd";
|
|
2
|
+
import type { IRangePickerProps } from "@/components/DatePicker/modal";
|
|
3
3
|
const { RangePicker } = DatePicker;
|
|
4
4
|
|
|
5
|
-
export default ({
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export default ({
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
showTime = true,
|
|
9
|
+
...props
|
|
10
|
+
}: IRangePickerProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<RangePicker
|
|
13
|
+
value={value}
|
|
14
|
+
onChange={value}
|
|
15
|
+
showTime={showTime}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -4,7 +4,7 @@ import { DatePicker } from "antd";
|
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import type { Moment } from "moment";
|
|
6
6
|
import moment from "moment";
|
|
7
|
-
import {IDatePickerProps} from "@/components/DatePicker/modal";
|
|
7
|
+
import type { IDatePickerProps } from "@/components/DatePicker/modal";
|
|
8
8
|
|
|
9
9
|
export default ({
|
|
10
10
|
value,
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {RangePickerProps} from "antd/es/date-picker";
|
|
2
|
-
import {SharedTimeProps} from "rc-picker/lib/panels/TimePanel";
|
|
3
|
-
import {Moment} from "moment";
|
|
4
|
-
import {DatePickerProps} from "antd";
|
|
1
|
+
import type { RangePickerProps } from "antd/es/date-picker";
|
|
2
|
+
import type { SharedTimeProps } from "rc-picker/lib/panels/TimePanel";
|
|
3
|
+
import type { Moment } from "moment";
|
|
4
|
+
import type { DatePickerProps } from "antd";
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export interface IDatePickerProps
|
|
7
|
+
extends Omit<DatePickerProps, "onChange" | "format"> {
|
|
8
|
+
onChange?: (time?: Moment | string | number) => void;
|
|
9
|
+
format?: string;
|
|
10
|
+
showTime?: boolean | SharedTimeProps<Moment>;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export interface IRangePickerProps extends RangePickerProps{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
export interface IRangePickerProps extends RangePickerProps {
|
|
14
|
+
value?: any;
|
|
15
|
+
onChange?: (val: any) => void;
|
|
16
|
+
showTime?: boolean | { defaultValue?: Moment[] };
|
|
17
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HSelectProps } from "@/components/Select/modal";
|
|
2
2
|
import { Checkbox, Space } from "antd";
|
|
3
|
-
import "../index.less"
|
|
3
|
+
import "../index.less";
|
|
4
4
|
import { itemOpProvider } from "../utils";
|
|
5
|
-
import {useClassName} from "
|
|
5
|
+
import { useClassName } from "../../hooks/useClassName";
|
|
6
6
|
interface IProps extends HSelectProps {
|
|
7
7
|
checked?: boolean;
|
|
8
8
|
}
|
|
@@ -20,7 +20,7 @@ export default ({
|
|
|
20
20
|
}
|
|
21
21
|
const opLen = options?.length || 0;
|
|
22
22
|
const checked = (value as any[])?.length >= opLen;
|
|
23
|
-
const optionsClassName=useClassName("option");
|
|
23
|
+
const optionsClassName = useClassName("hw-option");
|
|
24
24
|
const change = () => {
|
|
25
25
|
if (!checked) {
|
|
26
26
|
const subItemOps = itemOpProvider(options, fieldNames);
|
package/src/components/config.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {useMemo} from "react";
|
|
2
|
-
import {
|
|
1
|
+
import {useContext, useMemo} from "react";
|
|
2
|
+
import {ConfigContext} from "antd/es/config-provider";
|
|
3
3
|
|
|
4
|
-
export const useClassName=(className:string)=>{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
}
|
|
4
|
+
export const useClassName = (className: string) => {
|
|
5
|
+
const config=useContext(ConfigContext);
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
return `${config.getPrefixCls()}-${className}`;
|
|
8
|
+
}, [className]);
|
|
9
|
+
};
|
package/src/components/index.tsx
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "../Select/index.less";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@ant-prefix:ant;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Space } from "antd";
|
|
2
|
-
import { HDatePicker
|
|
2
|
+
import { HDatePicker, HRangePicker } from "../../components";
|
|
3
3
|
export default () => {
|
|
4
4
|
return (
|
|
5
5
|
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
@@ -9,7 +9,7 @@ export default () => {
|
|
|
9
9
|
console.log(val);
|
|
10
10
|
}}
|
|
11
11
|
/>
|
|
12
|
-
<HRangePicker/>
|
|
12
|
+
<HRangePicker />
|
|
13
13
|
</Space>
|
|
14
14
|
);
|
|
15
15
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@hw-prefix: hw;
|