@gisce/react-ooui 1.2.0-rc.66 → 1.2.0-rc.68

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":"Tag.d.ts","sourceRoot":"","sources":["Tag.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAKtC,eAAO,MAAM,GAAG,UAAW,WAAW,gBAMrC,CAAC;AAEF,eAAO,MAAM,QAAQ,oCASpB,CAAA"}
1
+ {"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["Tag.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC,eAAO,MAAM,GAAG,UAAW,WAAW,gBAMrC,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,GAAG,uBASlC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"GraphDefaults.d.ts","sourceRoot":"","sources":["GraphDefaults.ts"],"names":[],"mappings":"AAiCA,QAAA,MAAM,mBAAmB;;;;;;mCAvBK,GAAG;;;;;mCAAH,GAAG;;;;;;;;gCATf,GAAG;;;;;;;;;;;;mCA4DQ,GAAG;;;;;;;;;;;gCA5Dd,GAAG;;;;;;;;;;;;;;;;gCAAH,GAAG;;;;;;;mCASS,GAAG;;;;;mCAAH,GAAG;;;;;;;;;;CAwGhC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"GraphDefaults.d.ts","sourceRoot":"","sources":["GraphDefaults.ts"],"names":[],"mappings":"AA2CA,QAAA,MAAM,mBAAmB;;;;;;mCA/BK,GAAG;;;;;mCAAH,GAAG;;;;;;;;gCATf,GAAG;;;;;;;;;;;;mCAoEQ,GAAG;;;;;;;;;;;gCApEd,GAAG;;;;;;;;;;;;;;;;gCAAH,GAAG;;;;;;;mCASS,GAAG;;;;;mCAAH,GAAG;;;;;;;;;;CAgHhC,CAAC;AA6CF,eAAe,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.2.0-rc.66",
3
+ "version": "1.2.0-rc.68",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -27,17 +27,17 @@
27
27
  "prerelease": "npm version prerelease --preid rc",
28
28
  "prepatch": "npm version prepatch --preid rc",
29
29
  "premajor": "npm version premajor --preid rc",
30
- "start": "while :; do vite build --watch --force; done",
30
+ "start": "while :; do tsc && vite build --watch --force; done",
31
31
  "build:tailwind": "postcss src/tailwind.css -o src/tailwind.generated.css",
32
- "build": "vite build",
32
+ "build": "tsc && vite build",
33
33
  "test": "jest",
34
34
  "storybook": "start-storybook -p 6006",
35
35
  "build-storybook": "build-storybook"
36
36
  },
37
37
  "dependencies": {
38
38
  "@ant-design/plots": "^1.0.9",
39
- "@gisce/ooui": "^0.19.1",
40
- "@gisce/react-formiga-components": "^1.0.9-rc.19",
39
+ "@gisce/ooui": "^0.19.2-rc.1",
40
+ "@gisce/react-formiga-components": "^1.0.9-rc.20",
41
41
  "@gisce/react-formiga-table": "^0.5.0",
42
42
  "@monaco-editor/react": "^4.4.5",
43
43
  "@tabler/icons-react": "^2.11.0",
@@ -3,7 +3,7 @@ import {
3
3
  ExportOptions,
4
4
  PredefinedExport,
5
5
  PredefinedExportField,
6
- } from "@/../../react-formiga-components/dist/components/other/ExportModal/ExportModal.types";
6
+ } from "@gisce/react-formiga-components";
7
7
  import { useCallback, useRef } from "react";
8
8
  import { ConnectionProvider } from "..";
9
9
  import showInfo from "@/ui/InfoDialog";
@@ -161,7 +161,7 @@ export const useExport = ({
161
161
 
162
162
  // We create the lines
163
163
  await Promise.all(
164
- pExport.fields.map(async (field) => {
164
+ pExport.fields.map(async (field: any) => {
165
165
  return await ConnectionProvider.getHandler().create({
166
166
  model: "ir.exports.line",
167
167
  values: {
@@ -367,7 +367,8 @@ const retrieveKeyFieldsForPredefinedExports = async ({
367
367
  onGetFieldChilds: (key: string) => Promise<ExportField[]>;
368
368
  }) => {
369
369
  const allPredefinedExportKeys = predefinedExports.flatMap(
370
- (exp: PredefinedExport) => exp.fields.map((field) => field.key)
370
+ (exp: PredefinedExport) =>
371
+ exp.fields.map((field: any) => field.key)
371
372
  );
372
373
 
373
374
  const keysWithoutChildsInFields = getKeysWithoutChildsInFields({
@@ -1,9 +1,9 @@
1
+ import React from "react";
1
2
  import Field from "@/common/Field";
2
3
  import { WidgetProps } from "@/types";
3
4
  import { Tag as AntdTag } from 'antd';
4
5
  import { colorFromString } from "@/helpers/formHelper";
5
6
 
6
-
7
7
  export const Tag = (props: WidgetProps) => {
8
8
  return (
9
9
  <Field {...props}>
@@ -12,7 +12,7 @@ export const Tag = (props: WidgetProps) => {
12
12
  );
13
13
  };
14
14
 
15
- export const TagInput = (props) => {
15
+ export const TagInput = (props: any) => {
16
16
  const {ooui, value} = props;
17
17
  if (!value) {
18
18
  return null
@@ -1,3 +1,5 @@
1
+ import moment from "moment";
2
+
1
3
  const formatter = (graphType: "pie" | "default" | "barGrouped") => {
2
4
  return (object: any) => {
3
5
  const formattedValue = object.value.toLocaleString("es-ES", {
@@ -17,6 +19,14 @@ const axisFormatter = (value: any) => {
17
19
  return value.toLocaleString("es-ES", {
18
20
  useGrouping: true,
19
21
  });
22
+ } else if (isValidDateString(value)) {
23
+ const dateType = getDateType(value);
24
+ if (dateType === null) {
25
+ return value;
26
+ }
27
+ return moment(value, (dateFormats.input as any)[dateType]).format(
28
+ (dateFormats.output as any)[dateType]
29
+ );
20
30
  } else {
21
31
  return value;
22
32
  }
@@ -114,4 +124,47 @@ const DefaultGraphOptions = {
114
124
  },
115
125
  };
116
126
 
127
+ function isValidDateString(variable: any): boolean {
128
+ // Check if the variable is defined and is a string
129
+ if (typeof variable !== "string" || variable === undefined) {
130
+ return false;
131
+ }
132
+
133
+ // Check if the string is a valid date
134
+ const date = new Date(variable);
135
+ return date.toString() !== "Invalid Date";
136
+ }
137
+
138
+ const dateFormats = {
139
+ input: {
140
+ hours: "YYYY-MM-DD HH:mm",
141
+ days: "YYYY-MM-DD",
142
+ weeks: "YYYY-[W]WW",
143
+ months: "YYYY-MM",
144
+ years: "YYYY",
145
+ },
146
+ output: {
147
+ hours: "DD/MM/YYYY HH:mm",
148
+ days: "DD/MM/YYYY",
149
+ weeks: "[W]WW/YYYY",
150
+ months: "MM/YYYY",
151
+ years: "YYYY",
152
+ },
153
+ };
154
+
155
+ function getDateType(dateString: string): string | null {
156
+ for (const format in dateFormats.input) {
157
+ const isValidFormat = moment(
158
+ dateString,
159
+ (dateFormats.input as any)[format],
160
+ true
161
+ ).isValid();
162
+ if (isValidFormat) {
163
+ return format;
164
+ }
165
+ }
166
+
167
+ return null;
168
+ }
169
+
117
170
  export default DefaultGraphOptions;