@gisce/react-ooui 1.2.6-rc.2 → 1.2.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetFactory.d.ts","sourceRoot":"","sources":["WidgetFactory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA0H1B,QAAA,MAAM,iBAAiB,UAAW,GAAG,+DAWpC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,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,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A4M9C;AAED,eAAe,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.6-rc.2",
3
+ "version": "1.2.6",
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.20.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",
@@ -278,7 +278,6 @@ export const useSearch = (opts: UseSearchOpts) => {
278
278
 
279
279
  const changeSort = useCallback(
280
280
  (newSorter: any) => {
281
- if (JSON.stringify(newSorter) === JSON.stringify(sorter)) return;
282
281
  setSorter?.(newSorter);
283
282
  const sortedResults =
284
283
  newSorter !== undefined
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;
@@ -115,27 +115,27 @@ const imageComponent = (value: string): React.ReactElement => {
115
115
  };
116
116
 
117
117
  const TagComponent = (
118
- value: any,
118
+ value: any,
119
119
  key: string,
120
120
  ooui: any,
121
121
  context: any
122
122
  ): React.ReactElement => {
123
123
  return (
124
124
  <>
125
- {value ? (
126
- <Tag color={ooui.colors[value]}>{ooui.selectionValues.get(value)}</Tag>
127
- ) : null}
125
+ {value ? <Tag color={ooui.colors[value]}>{ooui.selectionValues.get(value)}</Tag> : null}
128
126
  </>
129
127
  );
130
128
  };
131
129
 
132
130
  const SelectionComponent = (
133
- value: any,
131
+ value: any,
134
132
  key: string,
135
133
  ooui: any,
136
134
  context: any
137
135
  ): React.ReactElement => {
138
- return <>{ooui.selectionValues.get(value)}</>;
136
+ return (
137
+ <>{ooui.selectionValues.get(value)}</>
138
+ );
139
139
  };
140
140
 
141
141
  const referenceComponent = (
@@ -155,12 +155,9 @@ const referenceComponent = (
155
155
  );
156
156
  };
157
157
 
158
- const AvatarFn = (
159
- value: any,
160
- key: string,
161
- ooui: any,
162
- context: any
163
- ): React.ReactElement => <Avatar ooui={ooui} value={value} />;
158
+ const AvatarFn = (value: any, key:string, ooui: any, context: any): React.ReactElement => (
159
+ <Avatar ooui={ooui} value={value} />
160
+ )
164
161
 
165
162
  function Tree(props: Props): React.ReactElement {
166
163
  const {
@@ -310,7 +307,9 @@ function Tree(props: Props): React.ReactElement {
310
307
  summary.push(`${sumField.label}: ${Math.round(total * 100) / 100}`);
311
308
  });
312
309
 
313
- return <div className="p-1 pb-0 pl-2 mt-2 ">{summary.join(", ")}</div>;
310
+ return (
311
+ <div className="p-1 pb-0 pl-2 mt-2 ">{summary.join(", ")}</div>
312
+ );
314
313
  }
315
314
 
316
315
  let dataTable;
@@ -333,12 +332,11 @@ function Tree(props: Props): React.ReactElement {
333
332
  ) : (
334
333
  <div>
335
334
  {pagination()}
336
- {loading && <Spin className="pb-4" />}
337
335
  <GisceTable
338
336
  height={adjustedHeight!}
339
337
  columns={dataTable.columns}
340
338
  dataSource={items}
341
- loading={false}
339
+ loading={loading}
342
340
  loadingComponent={<Spin />}
343
341
  onRowStyle={(record: any) => {
344
342
  if (colorsForResults![record.id]) {