@gisce/react-ooui 1.2.6-rc.3 → 1.2.7-rc.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/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react-ooui.es.js +4049 -3898
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +11 -11
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/widgets/WidgetFactory.d.ts.map +1 -1
- package/dist/widgets/base/Time.d.ts +12 -0
- package/dist/widgets/base/Time.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/stories/Time.stories.tsx +32 -0
- package/src/widgets/WidgetFactory.tsx +3 -0
- package/src/widgets/base/Time.tsx +41 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetFactory.d.ts","sourceRoot":"","sources":["WidgetFactory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WidgetFactory.d.ts","sourceRoot":"","sources":["WidgetFactory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA6H1B,QAAA,MAAM,iBAAiB,UAAW,GAAG,+DAWpC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Time as TimeOoui } from "@gisce/ooui";
|
|
3
|
+
import { WidgetProps } from '../../types';
|
|
4
|
+
declare const Time: (props: WidgetProps) => React.JSX.Element;
|
|
5
|
+
declare type TimeInputProps = {
|
|
6
|
+
ooui: TimeOoui;
|
|
7
|
+
value?: string;
|
|
8
|
+
onChange?: (value?: string) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const TimeInput: (props: TimeInputProps) => React.JSX.Element;
|
|
11
|
+
export default Time;
|
|
12
|
+
//# sourceMappingURL=Time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["Time.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAQtC,QAAA,MAAM,IAAI,UAAW,WAAW,sBAQ/B,CAAC;AAEF,aAAK,cAAc,GAAG;IACpB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAA;AAED,eAAO,MAAM,SAAS,UAAW,cAAc,sBAU9C,CAAA;AAED,eAAe,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gisce/react-ooui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7-rc.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ant-design/plots": "^1.0.9",
|
|
35
35
|
"@gisce/fiber-diagram": "^1.1.0-rc.3",
|
|
36
|
-
"@gisce/ooui": "^0.
|
|
36
|
+
"@gisce/ooui": "^0.21.0",
|
|
37
37
|
"@gisce/react-formiga-components": "^1.0.9-rc.21",
|
|
38
38
|
"@gisce/react-formiga-table": "^0.5.0",
|
|
39
39
|
"@monaco-editor/react": "^4.4.5",
|
package/src/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { ExportModal } from "@/widgets/modals/ExportModal";
|
|
|
23
23
|
import { SearchModal } from "@/widgets/modals/SearchModal";
|
|
24
24
|
import Date from "@/widgets/base/Date";
|
|
25
25
|
import DateTime from "@/widgets/base/DateTime";
|
|
26
|
+
import Time from "@/widgets/base/Time";
|
|
26
27
|
import type {
|
|
27
28
|
One2manyValue,
|
|
28
29
|
One2manyItem,
|
|
@@ -122,6 +123,7 @@ export {
|
|
|
122
123
|
One2manyValue,
|
|
123
124
|
Date,
|
|
124
125
|
DateTime,
|
|
126
|
+
Time,
|
|
125
127
|
Reference,
|
|
126
128
|
Binary,
|
|
127
129
|
iconMapper,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { TimeInput } from "../widgets/base/Time";
|
|
5
|
+
import { Time as TimeOoui } from "@gisce/ooui";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import LocaleProvider from "../context/LocaleContext";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Components/Widgets/Base/Time",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Default = (): React.ReactElement => {
|
|
15
|
+
const ooui = new TimeOoui({
|
|
16
|
+
name: "field",
|
|
17
|
+
string: "Lorem ipsum",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const [value, setValue] = useState<string>('23:12:34');
|
|
21
|
+
|
|
22
|
+
const onChange = (value: string) => {
|
|
23
|
+
console.log(value);
|
|
24
|
+
setValue(value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<LocaleProvider lang="en_US">
|
|
29
|
+
<TimeInput ooui={ooui} onChange={onChange} value={value} />
|
|
30
|
+
</LocaleProvider>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
Float,
|
|
16
16
|
Date,
|
|
17
17
|
DateTime,
|
|
18
|
+
Time,
|
|
18
19
|
One2many,
|
|
19
20
|
Separator,
|
|
20
21
|
Form,
|
|
@@ -75,6 +76,8 @@ const getWidgetType = (type: string) => {
|
|
|
75
76
|
return Date;
|
|
76
77
|
case "datetime":
|
|
77
78
|
return DateTime;
|
|
79
|
+
case "time":
|
|
80
|
+
return Time;
|
|
78
81
|
case "one2many":
|
|
79
82
|
case "one2many_list":
|
|
80
83
|
case "many2many":
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { TimePicker, theme } from "antd";
|
|
3
|
+
import Field from "@/common/Field";
|
|
4
|
+
import { Time as TimeOoui } from "@gisce/ooui";
|
|
5
|
+
import { WidgetProps } from "@/types";
|
|
6
|
+
import dayjs from "dayjs";
|
|
7
|
+
import { Dayjs } from 'dayjs';
|
|
8
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
dayjs.extend(customParseFormat)
|
|
12
|
+
|
|
13
|
+
const Time = (props: WidgetProps) => {
|
|
14
|
+
const { ooui } = props;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Field {...props}>
|
|
18
|
+
<TimeInput ooui={ooui as TimeOoui} />
|
|
19
|
+
</Field>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type TimeInputProps = {
|
|
24
|
+
ooui: TimeOoui;
|
|
25
|
+
value?: string;
|
|
26
|
+
onChange?: (value?: string) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const TimeInput = (props: TimeInputProps) => {
|
|
30
|
+
|
|
31
|
+
const onChange = (time: Dayjs | null, timestring: string) => {
|
|
32
|
+
if (props.onChange) {
|
|
33
|
+
props.onChange(timestring)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return <TimePicker onChange={onChange} value={props.value ? dayjs(props.value, 'HH:mm:ss') : undefined} />
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default Time;
|