@gisce/react-ooui 1.2.0-rc.7 → 1.2.0-rc.71
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/actionbar/FormActionBar.d.ts.map +1 -1
- package/dist/actionbar/TreeActionBar.d.ts.map +1 -1
- package/dist/common/DatePicker.d.ts +12 -0
- package/dist/common/DatePicker.d.ts.map +1 -1
- package/dist/context/ActionViewContext.d.ts +5 -1
- package/dist/context/ActionViewContext.d.ts.map +1 -1
- package/dist/context/ContentRootContext.d.ts.map +1 -1
- package/dist/context/FormContext.d.ts +4 -2
- package/dist/context/FormContext.d.ts.map +1 -1
- package/dist/helpers/formHelper.d.ts +5 -3
- package/dist/helpers/formHelper.d.ts.map +1 -1
- package/dist/helpers/iconMapper.d.ts +5 -1
- package/dist/helpers/iconMapper.d.ts.map +1 -1
- package/dist/helpers/one2manyHelper.d.ts +12 -4
- package/dist/helpers/one2manyHelper.d.ts.map +1 -1
- package/dist/helpers/searchHelper.d.ts +1 -1
- package/dist/helpers/searchHelper.d.ts.map +1 -1
- package/dist/helpers/treeHelper.d.ts +1 -1
- package/dist/helpers/treeHelper.d.ts.map +1 -1
- package/dist/hooks/useExport.d.ts +44 -0
- package/dist/hooks/useExport.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/locales/ca_ES.d.ts +2 -0
- package/dist/locales/ca_ES.d.ts.map +1 -1
- package/dist/locales/en_US.d.ts +2 -0
- package/dist/locales/en_US.d.ts.map +1 -1
- package/dist/locales/es_ES.d.ts +2 -0
- package/dist/locales/es_ES.d.ts.map +1 -1
- package/dist/react-ooui.es.js +25403 -27411
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +46 -184
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/views/RootView.d.ts.map +1 -1
- package/dist/views/actionViews/GraphActionView.d.ts.map +1 -1
- package/dist/views/actionViews/TreeActionView.d.ts.map +1 -1
- package/dist/widgets/WidgetFactory.d.ts.map +1 -1
- package/dist/widgets/base/Integer.d.ts.map +1 -1
- package/dist/widgets/base/Label.d.ts.map +1 -1
- package/dist/widgets/base/Reference.d.ts.map +1 -1
- package/dist/widgets/base/ReferenceTree.d.ts +8 -0
- package/dist/widgets/base/ReferenceTree.d.ts.map +1 -0
- package/dist/widgets/base/Separator.d.ts.map +1 -1
- package/dist/widgets/base/many2one/Many2one.d.ts.map +1 -1
- package/dist/widgets/base/many2one/Many2oneTree.d.ts +6 -0
- package/dist/widgets/base/many2one/Many2oneTree.d.ts.map +1 -0
- package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -1
- package/dist/widgets/containers/Group.d.ts.map +1 -1
- package/dist/widgets/custom/MultiCheckbox.d.ts.map +1 -1
- package/dist/widgets/custom/Tag.d.ts +5 -0
- package/dist/widgets/custom/Tag.d.ts.map +1 -0
- package/dist/widgets/custom/Tags.d.ts.map +1 -1
- package/dist/widgets/custom/Timeline.d.ts.map +1 -1
- package/dist/widgets/modals/ExportModal.d.ts +2 -1
- package/dist/widgets/modals/ExportModal.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
- package/dist/widgets/views/Form.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphChart.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphDefaults.d.ts +36 -0
- package/dist/widgets/views/Graph/GraphDefaults.d.ts.map +1 -1
- package/dist/widgets/views/SearchTree.d.ts.map +1 -1
- package/dist/widgets/views/Tree.d.ts +2 -0
- package/dist/widgets/views/Tree.d.ts.map +1 -1
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts +1 -0
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/__tests__/iconMapper.test.ts +20 -5
- package/src/actionbar/ChangeViewButton.tsx +2 -2
- package/src/actionbar/FormActionBar.tsx +82 -11
- package/src/actionbar/TreeActionBar.tsx +23 -28
- package/src/common/DatePicker.tsx +4 -3
- package/src/context/ActionViewContext.tsx +7 -4
- package/src/context/ContentRootContext.tsx +15 -7
- package/src/context/FormContext.tsx +1 -4
- package/src/helpers/formHelper.ts +26 -5
- package/src/helpers/iconMapper.ts +134 -107
- package/src/helpers/one2manyHelper.ts +94 -39
- package/src/helpers/searchHelper.ts +8 -7
- package/src/helpers/treeHelper.ts +17 -5
- package/src/hooks/useExport.ts +439 -0
- package/src/index.ts +2 -0
- package/src/locales/ca_ES.tsx +2 -0
- package/src/locales/en_US.tsx +2 -0
- package/src/locales/es_ES.tsx +2 -0
- package/src/stories/Label.stories.tsx +7 -8
- package/src/stories/Separator.stories.tsx +33 -0
- package/src/stories/containers/Group.stories.tsx +24 -0
- package/src/stories/containers/Notebook.stories.tsx +27 -0
- package/src/stories/custom/Tag.stories.tsx +57 -0
- package/src/stories/mocks/models/crm_case.ts +7 -10
- package/src/stories/views/Tree.stories.jsx +5 -5
- package/src/types/index.ts +1 -0
- package/src/ui/FavouriteButton.tsx +4 -4
- package/src/views/RootView.tsx +7 -1
- package/src/views/actionViews/GraphActionView.tsx +1 -0
- package/src/views/actionViews/TreeActionView.tsx +10 -1
- package/src/widgets/WidgetFactory.tsx +3 -0
- package/src/widgets/base/Integer.tsx +1 -0
- package/src/widgets/base/Label.tsx +5 -9
- package/src/widgets/base/Reference.tsx +13 -3
- package/src/widgets/base/ReferenceTree.tsx +62 -0
- package/src/widgets/base/Separator.tsx +11 -3
- package/src/widgets/base/many2one/Many2one.tsx +10 -19
- package/src/widgets/base/many2one/Many2oneTree.tsx +18 -0
- package/src/widgets/base/one2many/One2manyInput.tsx +79 -23
- package/src/widgets/containers/Group.tsx +7 -4
- package/src/widgets/custom/ButtonGroup.tsx +1 -1
- package/src/widgets/custom/MultiCheckbox.tsx +1 -0
- package/src/widgets/custom/Tag.tsx +24 -0
- package/src/widgets/custom/Tags.tsx +27 -28
- package/src/widgets/custom/Timeline.tsx +9 -3
- package/src/widgets/modals/ExportModal.tsx +33 -134
- package/src/widgets/views/Dashboard/Dashboard.tsx +15 -4
- package/src/widgets/views/Dashboard/DashboardTree.tsx +1 -0
- package/src/widgets/views/Form.tsx +38 -31
- package/src/widgets/views/Graph/GraphChart.tsx +6 -1
- package/src/widgets/views/Graph/GraphDefaults.ts +113 -0
- package/src/widgets/views/Graph/GraphIndicator.tsx +17 -3
- package/src/widgets/views/SearchTree.tsx +3 -0
- package/src/widgets/views/Tree.tsx +111 -25
- package/src/widgets/views/searchFilter/SearchFilter.tsx +12 -6
- package/dist/helpers/icons/antd_icons.d.ts +0 -4
- package/dist/helpers/icons/antd_icons.d.ts.map +0 -1
- package/dist/helpers/icons/tabler_icons.d.ts +0 -4
- package/dist/helpers/icons/tabler_icons.d.ts.map +0 -1
- package/dist/ui/Fieldset.d.ts +0 -8
- package/dist/ui/Fieldset.d.ts.map +0 -1
- package/src/helpers/icons/antd_icons.ts +0 -1583
- package/src/helpers/icons/tabler_icons.ts +0 -5367
- package/src/ui/Fieldset.tsx +0 -31
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ import { Image } from "@/widgets/base/Image";
|
|
|
37
37
|
import showConfirmDialog from "@/ui/ConfirmDialog";
|
|
38
38
|
import Dashboard from "@/widgets/views/Dashboard/Dashboard";
|
|
39
39
|
import { Tags } from "@/widgets/custom/Tags";
|
|
40
|
+
import { Tag } from "@/widgets/custom/Tag";
|
|
40
41
|
import { MultiCheckbox } from "./widgets/custom/MultiCheckbox";
|
|
41
42
|
import { Radio } from "@/widgets/custom/Radio";
|
|
42
43
|
import { Switch } from "@/widgets/custom/Switch";
|
|
@@ -145,6 +146,7 @@ export {
|
|
|
145
146
|
DashboardGridItem,
|
|
146
147
|
DashboardGrid,
|
|
147
148
|
Tags,
|
|
149
|
+
Tag,
|
|
148
150
|
MultiCheckbox,
|
|
149
151
|
Radio,
|
|
150
152
|
Switch,
|
package/src/locales/ca_ES.tsx
CHANGED
|
@@ -88,4 +88,6 @@ export default {
|
|
|
88
88
|
selectAtLeastOneField: "Selecciona almenys un camp per a l'exportació",
|
|
89
89
|
printScreen: "Imprimir pantalla",
|
|
90
90
|
advancedExport: "Exportació avançada",
|
|
91
|
+
savedRegisters: "Registre guardat correctament",
|
|
92
|
+
errorWhileSavingForm: "Error en guardar el formulari",
|
|
91
93
|
};
|
package/src/locales/en_US.tsx
CHANGED
package/src/locales/es_ES.tsx
CHANGED
|
@@ -89,4 +89,6 @@ export default {
|
|
|
89
89
|
selectAtLeastOneField: "Selecciona al menos un campo para la exportación",
|
|
90
90
|
printScreen: "Imprimir pantalla",
|
|
91
91
|
advancedExport: "Exportación avanzada",
|
|
92
|
+
savedRegisters: "Registro guardado correctamente",
|
|
93
|
+
errorWhileSavingForm: "Error al guardar el formulario",
|
|
92
94
|
};
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
export const Default = (): React.ReactElement => {
|
|
13
13
|
const ooui = new LabelOoui({
|
|
14
14
|
name: "field",
|
|
15
|
-
string: "Lorem ipsum",
|
|
15
|
+
string: "<b>Lorem ipsum</b>",
|
|
16
16
|
});
|
|
17
17
|
return (
|
|
18
18
|
<LocaleProvider lang="en_US">
|
|
@@ -25,7 +25,7 @@ export const LabelSecondary = (): React.ReactElement => {
|
|
|
25
25
|
const ooui = new LabelOoui({
|
|
26
26
|
name: "field",
|
|
27
27
|
string: "Lorem ipsum",
|
|
28
|
-
widget_props: "{'label_type': 'secondary'}"
|
|
28
|
+
widget_props: "{'label_type': 'secondary'}",
|
|
29
29
|
});
|
|
30
30
|
return (
|
|
31
31
|
<LocaleProvider lang="en_US">
|
|
@@ -38,7 +38,7 @@ export const LabelWaning = (): React.ReactElement => {
|
|
|
38
38
|
const ooui = new LabelOoui({
|
|
39
39
|
name: "field",
|
|
40
40
|
string: "Lorem ipsum",
|
|
41
|
-
widget_props: "{'label_type': 'warning'}"
|
|
41
|
+
widget_props: "{'label_type': 'warning'}",
|
|
42
42
|
});
|
|
43
43
|
return (
|
|
44
44
|
<LocaleProvider lang="en_US">
|
|
@@ -51,7 +51,7 @@ export const LabelDanger = (): React.ReactElement => {
|
|
|
51
51
|
const ooui = new LabelOoui({
|
|
52
52
|
name: "field",
|
|
53
53
|
string: "Lorem ipsum",
|
|
54
|
-
widget_props: "{'label_type': 'danger'}"
|
|
54
|
+
widget_props: "{'label_type': 'danger'}",
|
|
55
55
|
});
|
|
56
56
|
return (
|
|
57
57
|
<LocaleProvider lang="en_US">
|
|
@@ -64,7 +64,7 @@ export const LabelSuccess = (): React.ReactElement => {
|
|
|
64
64
|
const ooui = new LabelOoui({
|
|
65
65
|
name: "field",
|
|
66
66
|
string: "Lorem ipsum",
|
|
67
|
-
widget_props: "{'label_type': 'success'}"
|
|
67
|
+
widget_props: "{'label_type': 'success'}",
|
|
68
68
|
});
|
|
69
69
|
return (
|
|
70
70
|
<LocaleProvider lang="en_US">
|
|
@@ -73,12 +73,11 @@ export const LabelSuccess = (): React.ReactElement => {
|
|
|
73
73
|
);
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
|
|
77
76
|
export const LabelH1 = (): React.ReactElement => {
|
|
78
77
|
const ooui = new LabelOoui({
|
|
79
78
|
name: "field",
|
|
80
79
|
string: "Lorem ipsum",
|
|
81
|
-
widget_props: "{'label_size': 'h1'}"
|
|
80
|
+
widget_props: "{'label_size': 'h1'}",
|
|
82
81
|
});
|
|
83
82
|
return (
|
|
84
83
|
<LocaleProvider lang="en_US">
|
|
@@ -91,7 +90,7 @@ export const LabelH2Warning = (): React.ReactElement => {
|
|
|
91
90
|
const ooui = new LabelOoui({
|
|
92
91
|
name: "field",
|
|
93
92
|
string: "Lorem ipsum",
|
|
94
|
-
widget_props: "{'label_size': 'h1', 'label_type': 'warning'}"
|
|
93
|
+
widget_props: "{'label_size': 'h1', 'label_type': 'warning'}",
|
|
95
94
|
});
|
|
96
95
|
return (
|
|
97
96
|
<LocaleProvider lang="en_US">
|
|
@@ -19,3 +19,36 @@ export const Default = (): React.ReactElement => {
|
|
|
19
19
|
</LocaleProvider>
|
|
20
20
|
);
|
|
21
21
|
};
|
|
22
|
+
|
|
23
|
+
export const WithoutText = (): React.ReactElement => {
|
|
24
|
+
const ooui = new SeparatorOoui({
|
|
25
|
+
});
|
|
26
|
+
return (
|
|
27
|
+
<LocaleProvider lang="en_US">
|
|
28
|
+
<Separator ooui={ooui} showLabel />
|
|
29
|
+
</LocaleProvider>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const OnlyIcon = (): React.ReactElement => {
|
|
34
|
+
const ooui = new SeparatorOoui({
|
|
35
|
+
icon: "home"
|
|
36
|
+
});
|
|
37
|
+
return (
|
|
38
|
+
<LocaleProvider lang="en_US">
|
|
39
|
+
<Separator ooui={ooui} showLabel />
|
|
40
|
+
</LocaleProvider>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const WithIcon = (): React.ReactElement => {
|
|
45
|
+
const ooui = new SeparatorOoui({
|
|
46
|
+
string: "General",
|
|
47
|
+
icon: "home"
|
|
48
|
+
});
|
|
49
|
+
return (
|
|
50
|
+
<LocaleProvider lang="en_US">
|
|
51
|
+
<Separator ooui={ooui} showLabel />
|
|
52
|
+
</LocaleProvider>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -61,3 +61,27 @@ export const Default = (): React.ReactElement => {
|
|
|
61
61
|
</LocaleProvider>
|
|
62
62
|
);
|
|
63
63
|
};
|
|
64
|
+
|
|
65
|
+
export const WithIcon = (): React.ReactElement => {
|
|
66
|
+
const ooui = new GroupOoui({
|
|
67
|
+
string: "General",
|
|
68
|
+
icon: "home"
|
|
69
|
+
});
|
|
70
|
+
return (
|
|
71
|
+
<LocaleProvider lang="en_US">
|
|
72
|
+
<Group ooui={ooui} />
|
|
73
|
+
</LocaleProvider>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
export const OnlyIcon = (): React.ReactElement => {
|
|
79
|
+
const ooui = new GroupOoui({
|
|
80
|
+
icon: "home"
|
|
81
|
+
});
|
|
82
|
+
return (
|
|
83
|
+
<LocaleProvider lang="en_US">
|
|
84
|
+
<Group ooui={ooui} />
|
|
85
|
+
</LocaleProvider>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
@@ -167,3 +167,30 @@ export const IconTabs = (): React.ReactElement => {
|
|
|
167
167
|
</LocaleProvider>
|
|
168
168
|
);
|
|
169
169
|
};
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
export const IconTablerTabs = (): React.ReactElement => {
|
|
173
|
+
|
|
174
|
+
const arch = `<form>
|
|
175
|
+
<notebook name="notebook">
|
|
176
|
+
<page string="Home" icon="bolt">
|
|
177
|
+
<field name="name" />
|
|
178
|
+
</page>
|
|
179
|
+
<page string="Attributes" icon="address-book">
|
|
180
|
+
<field name="surname" />
|
|
181
|
+
</page>
|
|
182
|
+
</notebook>
|
|
183
|
+
</form>`;
|
|
184
|
+
|
|
185
|
+
const formOoui = new FormOoui(fields);
|
|
186
|
+
formOoui.parse(arch);
|
|
187
|
+
const notebookOoui = formOoui.findById("notebook") as NotebookOoui;
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<LocaleProvider lang="en_US">
|
|
191
|
+
<Form>
|
|
192
|
+
<Notebook ooui={notebookOoui} />
|
|
193
|
+
</Form>
|
|
194
|
+
</LocaleProvider>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { Tag as TagOoui } from "@gisce/ooui";
|
|
4
|
+
import "antd/dist/antd.css";
|
|
5
|
+
import LocaleProvider from "../../context/LocaleContext";
|
|
6
|
+
import { TagInput } from "../../widgets/custom/Tag";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Components/Widgets/Custom/Tag",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = (): React.ReactElement => {
|
|
13
|
+
const ooui = new TagOoui({
|
|
14
|
+
name: "status",
|
|
15
|
+
string: "Status",
|
|
16
|
+
field: "status",
|
|
17
|
+
selection: [['draft', 'Draft'], ['open', 'Open']],
|
|
18
|
+
widget_props: '{"colors": {"draft": "blue", "open": "green"}}'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<LocaleProvider lang="en_US">
|
|
23
|
+
<TagInput value="draft" ooui={ooui}/>
|
|
24
|
+
</LocaleProvider>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const WithoutColor = (): React.ReactElement => {
|
|
29
|
+
const ooui = new TagOoui({
|
|
30
|
+
name: "status",
|
|
31
|
+
string: "Status",
|
|
32
|
+
field: "status",
|
|
33
|
+
selection: [['draft', 'Draft'], ['open', 'Open']],
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<LocaleProvider lang="en_US">
|
|
38
|
+
<TagInput value="draft" ooui={ooui}/>
|
|
39
|
+
</LocaleProvider>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const WithColorAuto = (): React.ReactElement => {
|
|
44
|
+
const ooui = new TagOoui({
|
|
45
|
+
name: "status",
|
|
46
|
+
string: "Status",
|
|
47
|
+
field: "status",
|
|
48
|
+
selection: [['draft', 'Draft'], ['open', 'Open']],
|
|
49
|
+
widget_props: '{"colors": "auto"}'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<LocaleProvider lang="en_US">
|
|
54
|
+
<TagInput value="draft" ooui={ooui}/>
|
|
55
|
+
</LocaleProvider>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -39,13 +39,14 @@ export default {
|
|
|
39
39
|
task_id: false,
|
|
40
40
|
user_id: [1, "Administrator"],
|
|
41
41
|
workdones_ids: [],
|
|
42
|
+
integer: 40003.23,
|
|
42
43
|
},
|
|
43
44
|
form: {
|
|
44
|
-
arch:
|
|
45
|
-
'<form string="Casos">\n <group col="8" colspan="4">\n <field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" select="1"/>\n <field colspan="3" name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)" select="2"/>\n \n <field colspan="3" name="email_from" select="2"/>\n <button name="remind_partner" states="open,pending" string="Envia notificaci\u00f3" type="object"/>\n <field name="user_id" select="1" domain="[(\'id\',\'!=\', 0)]"/>\n <button name="autoassign" string="Assigna-me\'l" type="object"/>\n <button name="remind_user" states="open,pending" string="Envia notificaci\u00f3" type="object"/>\n </group><field name="state" select="1"/></form>',
|
|
45
|
+
arch: '<form string="Casos">\n <field name="integer" /> <group col="8" colspan="4">\n <field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id, email_from)" select="1"/>\n <field colspan="3" name="partner_address_id" on_change="onchange_partner_address_id(partner_address_id, email_from)" select="2"/>\n \n <field colspan="3" name="email_from" select="2"/>\n <button name="remind_partner" states="open,pending" string="Envia notificaci\u00f3" type="object"/>\n <field name="user_id" select="1" domain="[(\'id\',\'!=\', 0)]"/>\n <button name="autoassign" string="Assigna-me\'l" type="object"/>\n <button name="remind_user" states="open,pending" string="Envia notificaci\u00f3" type="object"/>\n </group><field name="state" select="1"/></form>',
|
|
46
46
|
|
|
47
47
|
field_parent: false,
|
|
48
48
|
fields: {
|
|
49
|
+
integer: { string: "Integer", type: "integer" },
|
|
49
50
|
active: { string: "Actiu", type: "boolean", views: {} },
|
|
50
51
|
canal_id: {
|
|
51
52
|
context: "",
|
|
@@ -138,8 +139,7 @@ export default {
|
|
|
138
139
|
type: "one2many",
|
|
139
140
|
views: {
|
|
140
141
|
form: {
|
|
141
|
-
arch:
|
|
142
|
-
'<form string="Historial de comunicació">\n <group col="6" colspan="4">\n <field name="date" select="1"/>\n <field name="email" select="1"/>\n <field name="canal_id" select="2"/>\n </group>\n <newline/>\n <field colspan="4" name="description" nolabel="1" select="2"/>\n </form>\n ',
|
|
142
|
+
arch: '<form string="Historial de comunicació">\n <group col="6" colspan="4">\n <field name="date" select="1"/>\n <field name="email" select="1"/>\n <field name="canal_id" select="2"/>\n </group>\n <newline/>\n <field colspan="4" name="description" nolabel="1" select="2"/>\n </form>\n ',
|
|
143
143
|
fields: {
|
|
144
144
|
canal_id: {
|
|
145
145
|
context: "",
|
|
@@ -160,8 +160,7 @@ export default {
|
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
162
|
tree: {
|
|
163
|
-
arch:
|
|
164
|
-
'<tree string="Historial de comunicació">\n <field name="note"/>\n </tree>\n ',
|
|
163
|
+
arch: '<tree string="Historial de comunicació">\n <field name="note"/>\n </tree>\n ',
|
|
165
164
|
fields: {
|
|
166
165
|
note: {
|
|
167
166
|
digits: [16, 2],
|
|
@@ -185,8 +184,7 @@ export default {
|
|
|
185
184
|
type: "one2many",
|
|
186
185
|
views: {
|
|
187
186
|
form: {
|
|
188
|
-
arch:
|
|
189
|
-
'<form string="Accions">\n <separator colspan="4" string="Informaci\u00f3 de l\'acci\u00f3"/>\n <field colspan="4" name="name"/>\n <field name="date" select="2"/>\n <field name="fefe_id" select="2"/>\n <field name="som" select="2"/>\n <field name="canal_id"/>\n </form>\n ',
|
|
187
|
+
arch: '<form string="Accions">\n <separator colspan="4" string="Informaci\u00f3 de l\'acci\u00f3"/>\n <field colspan="4" name="name"/>\n <field name="date" select="2"/>\n <field name="fefe_id" select="2"/>\n <field name="som" select="2"/>\n <field name="canal_id"/>\n </form>\n ',
|
|
190
188
|
fields: {
|
|
191
189
|
canal_id: {
|
|
192
190
|
context: "",
|
|
@@ -389,8 +387,7 @@ export default {
|
|
|
389
387
|
type: "one2many",
|
|
390
388
|
views: {
|
|
391
389
|
tree: {
|
|
392
|
-
arch:
|
|
393
|
-
'<tree editable="top">\n <field name="date"/>\n <field name="type_id"/>\n <field name="hours" sum="Time spent" widget="float_time"/>\n \n <field name="name"/> \n </tree>\n ',
|
|
390
|
+
arch: '<tree editable="top">\n <field name="date"/>\n <field name="type_id"/>\n <field name="hours" sum="Time spent" widget="float_time"/>\n \n <field name="name"/> \n </tree>\n ',
|
|
394
391
|
fields: {
|
|
395
392
|
date: { string: "Data", type: "datetime", views: {} },
|
|
396
393
|
hours: { string: "Temps dedicat", type: "float", views: {} },
|
|
@@ -30,7 +30,7 @@ Default.args = {
|
|
|
30
30
|
lang: false,
|
|
31
31
|
name: "AGRI ENERGIA ELECTRICA, S.A.",
|
|
32
32
|
ref: "0112",
|
|
33
|
-
title:
|
|
33
|
+
title: "corp",
|
|
34
34
|
numeric: 30.1,
|
|
35
35
|
progressbar: 100,
|
|
36
36
|
},
|
|
@@ -41,7 +41,7 @@ Default.args = {
|
|
|
41
41
|
lang: false,
|
|
42
42
|
name: "Agrolait",
|
|
43
43
|
ref: false,
|
|
44
|
-
title:
|
|
44
|
+
title: "ltd",
|
|
45
45
|
numeric: 30.1,
|
|
46
46
|
progressbar: 70.434331,
|
|
47
47
|
},
|
|
@@ -85,14 +85,14 @@ Default.args = {
|
|
|
85
85
|
lang: false,
|
|
86
86
|
name: "Aragón",
|
|
87
87
|
ref: "02",
|
|
88
|
-
title:
|
|
88
|
+
title: "corp",
|
|
89
89
|
numeric: 30.1,
|
|
90
90
|
progressbar: 20.01,
|
|
91
91
|
},
|
|
92
92
|
],
|
|
93
93
|
treeView: {
|
|
94
94
|
arch:
|
|
95
|
-
|
|
95
|
+
`<tree string="Partners">\n<field name="numeric" sum="Numeric"/><field name="name"/>\n <field name="title" widget="tag" widget_props="{'colors': {'corp': 'red', 'ltd': 'green'}}"/>\n <field name="ref"/>\n <field name="city" select="2"/>\n <field name="country" select="2"/>\n <field name="lang"/>\n <field name="progressbar" string="Progress" /> </tree>`,
|
|
96
96
|
fields: {
|
|
97
97
|
progressbar: {
|
|
98
98
|
string: "Progress bar",
|
|
@@ -149,7 +149,7 @@ Default.args = {
|
|
|
149
149
|
},
|
|
150
150
|
title: {
|
|
151
151
|
selection: [
|
|
152
|
-
["
|
|
152
|
+
["corp", "Corp."],
|
|
153
153
|
["ltd", "Ltd"],
|
|
154
154
|
["", ""],
|
|
155
155
|
],
|
package/src/types/index.ts
CHANGED
|
@@ -55,7 +55,7 @@ const FavouriteButton = (props: Props) => {
|
|
|
55
55
|
const [shortcuts, setShortcuts] = useState<ShortcutApi[]>([]);
|
|
56
56
|
const [loading, setLoading] = useState(true);
|
|
57
57
|
const [currentShortcutId, setCurrentShortcutId] = useState<number>();
|
|
58
|
-
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
58
|
+
const { t } = (useContext(LocaleContext) as LocaleContextType) || {};
|
|
59
59
|
|
|
60
60
|
const tabManagerContext = useContext(
|
|
61
61
|
TabManagerContext
|
|
@@ -150,10 +150,10 @@ const FavouriteButton = (props: Props) => {
|
|
|
150
150
|
<Menu onClick={handleMenuClick}>
|
|
151
151
|
<div style={{ width: 300, padding: 5, display: "flex" }}>
|
|
152
152
|
<div style={{ paddingLeft: 15, color: "#ccc" }}>
|
|
153
|
-
{t("favorites").toUpperCase()}
|
|
153
|
+
{t?.("favorites").toUpperCase()}
|
|
154
154
|
</div>
|
|
155
155
|
<div style={{ flexGrow: 1, paddingLeft: 10 }}>
|
|
156
|
-
<Tooltip title={t("edit_favorites")}>
|
|
156
|
+
<Tooltip title={t?.("edit_favorites")}>
|
|
157
157
|
<EditOutlined
|
|
158
158
|
style={{ color: "#1890FF", cursor: "pointer" }}
|
|
159
159
|
onClick={editFavourites}
|
|
@@ -177,7 +177,7 @@ const FavouriteButton = (props: Props) => {
|
|
|
177
177
|
</>
|
|
178
178
|
) : (
|
|
179
179
|
<div style={{ width: 300, padding: 5, paddingLeft: 15 }}>
|
|
180
|
-
{t("no_favorites")}
|
|
180
|
+
{t?.("no_favorites")}
|
|
181
181
|
</div>
|
|
182
182
|
)}
|
|
183
183
|
</Menu>
|
package/src/views/RootView.tsx
CHANGED
|
@@ -250,6 +250,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
250
250
|
fields,
|
|
251
251
|
values: { ...values, ...globalValues },
|
|
252
252
|
}),
|
|
253
|
+
fields,
|
|
253
254
|
context: { ...rootContext, ...parsedContext },
|
|
254
255
|
})
|
|
255
256
|
: [];
|
|
@@ -437,6 +438,11 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
437
438
|
},
|
|
438
439
|
});
|
|
439
440
|
} else {
|
|
441
|
+
const formattedInitialView =
|
|
442
|
+
initialView && Array.isArray(initialView.id)
|
|
443
|
+
? { ...initialView, id: initialView.id[0] }
|
|
444
|
+
: initialView;
|
|
445
|
+
|
|
440
446
|
addNewTab({
|
|
441
447
|
title,
|
|
442
448
|
action: {
|
|
@@ -454,7 +460,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
454
460
|
context={{ ...rootContext, ...context }}
|
|
455
461
|
domain={domain}
|
|
456
462
|
setCanWeClose={registerViewCloseFn}
|
|
457
|
-
initialView={
|
|
463
|
+
initialView={formattedInitialView}
|
|
458
464
|
res_id={res_id}
|
|
459
465
|
formDefaultValues={values}
|
|
460
466
|
formForcedValues={forced_values}
|
|
@@ -2,7 +2,11 @@ import TreeActionBar from "@/actionbar/TreeActionBar";
|
|
|
2
2
|
import { FormView, TreeView, View } from "@/types";
|
|
3
3
|
import TitleHeader from "@/ui/TitleHeader";
|
|
4
4
|
import SearchTree from "@/widgets/views/SearchTree";
|
|
5
|
-
import React from "react";
|
|
5
|
+
import React, { useContext } from "react";
|
|
6
|
+
import {
|
|
7
|
+
ActionViewContext,
|
|
8
|
+
ActionViewContextType,
|
|
9
|
+
} from "@/context/ActionViewContext";
|
|
6
10
|
|
|
7
11
|
export type TreeActionViewProps = {
|
|
8
12
|
formView?: FormView;
|
|
@@ -38,6 +42,10 @@ export const TreeActionView = (props: TreeActionViewProps) => {
|
|
|
38
42
|
searchTreeNameSearch,
|
|
39
43
|
} = props;
|
|
40
44
|
|
|
45
|
+
const { currentView, setPreviousView } = useContext(
|
|
46
|
+
ActionViewContext
|
|
47
|
+
) as ActionViewContextType;
|
|
48
|
+
|
|
41
49
|
if (!visible) {
|
|
42
50
|
return null;
|
|
43
51
|
}
|
|
@@ -66,6 +74,7 @@ export const TreeActionView = (props: TreeActionViewProps) => {
|
|
|
66
74
|
const itemIndex = results.findIndex((item: any) => {
|
|
67
75
|
return item.id === id;
|
|
68
76
|
});
|
|
77
|
+
setPreviousView?.(currentView);
|
|
69
78
|
setCurrentItemIndex(itemIndex);
|
|
70
79
|
const formView = availableViews.find(
|
|
71
80
|
(v) => v.type === "form"
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
Radio,
|
|
30
30
|
Switch,
|
|
31
31
|
Steps,
|
|
32
|
+
Tag,
|
|
32
33
|
CodeEditor,
|
|
33
34
|
} from "@/index";
|
|
34
35
|
import { Image } from "./base/Image";
|
|
@@ -99,6 +100,8 @@ const getWidgetType = (type: string) => {
|
|
|
99
100
|
return Indicator;
|
|
100
101
|
case "tags":
|
|
101
102
|
return Tags;
|
|
103
|
+
case "tag":
|
|
104
|
+
return Tag;
|
|
102
105
|
case "multicheckbox":
|
|
103
106
|
return MultiCheckbox;
|
|
104
107
|
case "radio":
|
|
@@ -3,6 +3,7 @@ import { Tooltip, Typography } from "antd";
|
|
|
3
3
|
import { WidgetProps } from "@/types";
|
|
4
4
|
import { QuestionCircleOutlined } from "@ant-design/icons";
|
|
5
5
|
import { Label as LabelOoui } from "@gisce/ooui";
|
|
6
|
+
import { Interweave } from "interweave";
|
|
6
7
|
const { Text, Title } = Typography;
|
|
7
8
|
|
|
8
9
|
type Props = WidgetProps & {
|
|
@@ -18,13 +19,8 @@ const alignClass = {
|
|
|
18
19
|
|
|
19
20
|
const Label = (props: Props) => {
|
|
20
21
|
const { ooui, align, responsiveBehaviour } = props;
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
tooltip,
|
|
24
|
-
fieldForLabel,
|
|
25
|
-
labelSize,
|
|
26
|
-
labelType,
|
|
27
|
-
} = ooui as LabelOoui;
|
|
22
|
+
const { label, tooltip, fieldForLabel, labelSize, labelType } =
|
|
23
|
+
ooui as LabelOoui;
|
|
28
24
|
const addColon = fieldForLabel !== null ? true : false;
|
|
29
25
|
const labelText = addColon && label.length > 1 ? label + " :" : label;
|
|
30
26
|
const responsiveAlign = responsiveBehaviour ? "left" : "right";
|
|
@@ -43,10 +39,10 @@ const Label = (props: Props) => {
|
|
|
43
39
|
)}
|
|
44
40
|
<span className="pr-2">
|
|
45
41
|
<TextType
|
|
46
|
-
level={labelSize !== "text" ? (
|
|
42
|
+
level={labelSize !== "text" ? (labelSize as string as any) : null}
|
|
47
43
|
type={labelType as any}
|
|
48
44
|
>
|
|
49
|
-
{labelText}
|
|
45
|
+
<Interweave content={labelText} />
|
|
50
46
|
</TextType>
|
|
51
47
|
</span>
|
|
52
48
|
</div>
|
|
@@ -49,6 +49,8 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
|
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
if (!value) {
|
|
52
|
+
setSelectionValue(undefined);
|
|
53
|
+
setMany2oneValue([]);
|
|
52
54
|
return;
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -73,8 +75,16 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
|
|
|
73
75
|
}
|
|
74
76
|
onChange={(changedValue: string) => {
|
|
75
77
|
setSelectionValue(changedValue);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
let m2oValue = many2oneValue[0] || 0;
|
|
79
|
+
if (changedValue !== selectionValue) {
|
|
80
|
+
setMany2oneValue([]);
|
|
81
|
+
m2oValue = 0;
|
|
82
|
+
}
|
|
83
|
+
const referenceValue = `${changedValue},${m2oValue}`;
|
|
84
|
+
if (referenceValue === value) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
onChange?.(referenceValue);
|
|
78
88
|
}}
|
|
79
89
|
value={selectionValue}
|
|
80
90
|
/>
|
|
@@ -92,7 +102,7 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
|
|
|
92
102
|
value={many2oneValue}
|
|
93
103
|
onChange={(changedValue: any[]) => {
|
|
94
104
|
setMany2oneValue(changedValue);
|
|
95
|
-
const referenceValue = `${selectionValue},${changedValue[0]}`;
|
|
105
|
+
const referenceValue = `${selectionValue},${changedValue[0] || 0}`;
|
|
96
106
|
if (referenceValue === value) {
|
|
97
107
|
return;
|
|
98
108
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ConnectionProvider from "@/ConnectionProvider";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { Many2oneSuffix } from "./many2one/Many2oneSuffix";
|
|
5
|
+
import { LoadingOutlined } from "@ant-design/icons";
|
|
6
|
+
|
|
7
|
+
export type ReferenceTreeProps = {
|
|
8
|
+
value: string;
|
|
9
|
+
context?: any;
|
|
10
|
+
selectionValues?: any;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ReferenceTree = (
|
|
14
|
+
props: ReferenceTreeProps
|
|
15
|
+
): React.ReactElement => {
|
|
16
|
+
const { value, context, selectionValues } = props;
|
|
17
|
+
const [name, setName] = useState();
|
|
18
|
+
const [loading, setLoading] = useState(false);
|
|
19
|
+
|
|
20
|
+
const [model, id] = value ? value.split(",") : [];
|
|
21
|
+
const intId = parseInt(id);
|
|
22
|
+
|
|
23
|
+
const fetchName = useCallback(async () => {
|
|
24
|
+
if (!value) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (value && name) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setLoading(true);
|
|
31
|
+
const nameResponse = await ConnectionProvider.getHandler().execute({
|
|
32
|
+
action: "name_get",
|
|
33
|
+
payload: [intId],
|
|
34
|
+
model,
|
|
35
|
+
context,
|
|
36
|
+
});
|
|
37
|
+
setName(nameResponse[0][1]);
|
|
38
|
+
setLoading(false);
|
|
39
|
+
}, [value, name]);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
fetchName();
|
|
43
|
+
}, [value]);
|
|
44
|
+
|
|
45
|
+
if (!value && !loading) {
|
|
46
|
+
return <></>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (loading) {
|
|
50
|
+
return <LoadingOutlined />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const selectionDescription = selectionValues.get(model);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Space>
|
|
57
|
+
<>{`${selectionDescription}:`}</>
|
|
58
|
+
<>{name}</>
|
|
59
|
+
<Many2oneSuffix id={intId} model={model} />
|
|
60
|
+
</Space>
|
|
61
|
+
);
|
|
62
|
+
};
|