@gisce/react-ooui 1.5.6-rc.0 → 1.5.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.
- package/dist/context/ActionViewContext.d.ts +1 -1
- package/dist/context/ActionViewContext.d.ts.map +1 -1
- package/dist/locales/ca_ES.d.ts +1 -0
- package/dist/locales/ca_ES.d.ts.map +1 -1
- package/dist/locales/en_US.d.ts +1 -0
- package/dist/locales/en_US.d.ts.map +1 -1
- package/dist/locales/es_ES.d.ts +1 -0
- package/dist/locales/es_ES.d.ts.map +1 -1
- package/dist/react-ooui.es.js +504 -495
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +9 -9
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/ui/GoToResourceModal.d.ts +1 -1
- package/dist/ui/GoToResourceModal.d.ts.map +1 -1
- package/dist/views/ActionView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/context/ActionViewContext.tsx +1 -1
- package/src/locales/ca_ES.tsx +1 -0
- package/src/locales/en_US.tsx +1 -0
- package/src/locales/es_ES.tsx +1 -0
- package/src/stories/mocks/models/cups.ts +1 -18
- package/src/stories/ui/GoToResourceModal.stories.tsx +3 -2
- package/src/ui/GoToResourceModal.tsx +6 -5
- package/src/views/ActionView.tsx +37 -29
- package/src/widgets/base/one2many/One2manyInput.tsx +1 -1
- package/src/widgets/views/Form.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoToResourceModal.d.ts","sourceRoot":"","sources":["GoToResourceModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAKlD,aAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"GoToResourceModal.d.ts","sourceRoot":"","sources":["GoToResourceModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAKlD,aAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,KAAK,sBA+D7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;AAoBvB,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;;
|
|
1
|
+
{"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;AAoBvB,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;;AAkdF,wBAAsC"}
|
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@ export type ActionViewContextType = {
|
|
|
48
48
|
setSearchTreeNameSearch?: (searchString?: string) => void;
|
|
49
49
|
previousView?: View;
|
|
50
50
|
setPreviousView?: (view: View) => void;
|
|
51
|
-
goToResourceId?: (
|
|
51
|
+
goToResourceId?: (ids: number[]) => Promise<void>;
|
|
52
52
|
searchValues?: any;
|
|
53
53
|
setSearchValues?: (value: any) => void;
|
|
54
54
|
limit?: number;
|
package/src/locales/ca_ES.tsx
CHANGED
|
@@ -71,6 +71,7 @@ export default {
|
|
|
71
71
|
lastUpdatedDate: "Data última modificació",
|
|
72
72
|
goToResourceId: "Vés al recurs amb ID",
|
|
73
73
|
searchId: "ID de cerca:",
|
|
74
|
+
searchIdHelp: "Es pot utiltizar un ID o una llista d'IDs separats per comes",
|
|
74
75
|
idNotFound: "No es troba aquesta id de recurs per l'objecte",
|
|
75
76
|
selectedRegisters: "registres seleccionats",
|
|
76
77
|
translate: "Traduïr",
|
package/src/locales/en_US.tsx
CHANGED
|
@@ -69,6 +69,7 @@ export default {
|
|
|
69
69
|
lastUpdatedDate: "Date of last modification",
|
|
70
70
|
goToResourceId: "Go to resource ID",
|
|
71
71
|
searchId: "Search ID:",
|
|
72
|
+
searchIdHelp: "You can use an ID or a list of IDs separated by commas.",
|
|
72
73
|
idNotFound: "Resource ID does not exist for this object!",
|
|
73
74
|
selectedRegisters: "selected registers",
|
|
74
75
|
translate: "Translate",
|
package/src/locales/es_ES.tsx
CHANGED
|
@@ -72,6 +72,7 @@ export default {
|
|
|
72
72
|
lastUpdatedDate: "Fecha última modificación",
|
|
73
73
|
goToResourceId: "Ir al recurso con ID",
|
|
74
74
|
searchId: "ID de búsqueda:",
|
|
75
|
+
searchIdHelp: "Se puede utilizar un ID o una lista de IDs separados por comas",
|
|
75
76
|
idNotFound: "No se encuentra ésta ID de recursos para el objeto",
|
|
76
77
|
selectedRegisters: "registros seleccionados",
|
|
77
78
|
translate: "Traducir",
|
|
@@ -48,28 +48,11 @@ export default {
|
|
|
48
48
|
pu: "6",
|
|
49
49
|
ref_catastral: "referencia catastral",
|
|
50
50
|
tv: false,
|
|
51
|
-
state: "baixa",
|
|
52
51
|
},
|
|
53
52
|
form: {
|
|
54
|
-
arch: '<form string="CUPS">\n
|
|
53
|
+
arch: '<form string="CUPS">\n <notebook colspan="4">\n <page string="Corbes"> <group colspan="4"> <group string="Validada" colspan="2"> <field name="ax" string="AX"/> <field name="bq" string="Format"/> </group> <group string="Facturada" colspan="2"> <field name="bq" string="Última corba"/> <field name="bq" string="Format"/> </group> <group string="Autoconsumida" colspan="2"> <field name="bq" string="Última corba"/> <field name="bq" string="Format"/> </group> <group string="Generada Neta" colspan="2"> <field name="bq" string="Última corba"/> <field name="bq" string="Format"/> </group> <group string="Quart-Horària" colspan="2"> <field name="bq1" string="Última corba"/> <field name="bq" string="Format"/> </group> </group> </page> <page string="General">\n <field name="name" select="1" size="25"/>\n <field name="active" select="1"/>\n <field name="distribuidora_id" domain="[(\'supplier\',\'=\',True)]" context="{\'task\': \'test\'}" required="1" select="1"/>\n <field name="id_municipi" select="1"/>\n <field name="id_provincia"/>\n <field name="id_poblacio" select="1" domain="[(\'municipi_id.id\', \'=\', id_municipi)]"/>\n <field name="dp"/>\n <field name="direccio" select="1" colspan="4"/>\n <field name="polissa_polissa" select="1"/>\n <field name="polissa_comptador" select="1"/>\n <field name="polissa_potencia"/>\n <field name="potencia_adscrita" attrs="{\'readonly\':[(\'force_potencia_adscrita\',\'=\',0)]}"/>\n <field name="force_potencia_adscrita"/>\n <group colspan="4" string="Adreces">\n <notebook colspan="4">\n <page string="Principal">\n <separator string="Zona urbana" colspan="4"/>\n <field name="tv"/>\n <field name="nv" select="1"/>\n <field name="pnp" select="1"/>\n <field name="bq" select="1"/>\n <field name="es" select="1"/>\n <field name="pt" select="1"/>\n <field name="pu" select="1"/>\n <field name="aclarador" colspan="4" select="1"/>\n <separator string="Zona industrial" colspan="4"/>\n <field name="cpo" select="1"/>\n <field name="cpa" select="1"/>\n </page>\n <page string="Cadastre">\n <separator string="Zona urbana" colspan="4"/>\n <field name="catas_np"/>\n <field name="catas_nm"/>\n <field name="ref_catastral" select="1"/>\n <button type="object" name="update_dir_from_ref" string="Obtenir del Cadastre"/>\n <button type="object" name="delete_dir_ref" string="Eliminar dades del Cadastre" confirm="Està segur que vol eliminar les dades que s\'han obtingut del cadastre?"/>\n <field name="catas_ldt" colspan="4"/>\n <field name="catas_tv"/>\n <field name="catas_nv"/>\n <field name="catas_pnp"/>\n <field name="catas_bq"/>\n <field name="catas_es"/>\n <field name="catas_pt"/>\n <field name="catas_pu"/>\n <field name="catas_dp"/>\n <separator string="Zona industrial" colspan="4"/>\n <field name="catas_cpo"/>\n <field name="catas_cpa"/>\n <separator string="Sincronització amb el cadastre" colspan="4"/>\n <label colspan="2" string="Si disposa de la referencia cadastral pot copiar les dades del cadastre a l\'adreça principal mitjançant aquest botó"/>\n <button type="object" name="copy_to_alternative" string="Copiar a la principal"/>\n </page>\n <page string="Notes">\n <field name="notes" colspan="4" nolabel="1"/>\n </page>\n </notebook>\n </group>\n </page>\n <page string="Autoconsum">\n <field name="autoconsum_id" readonly="1" colspan="4"/>\n <field name="coef_repartiment" readonly="1" colspan="4"/>\n </page>\n <page string="Butlletins">\n <field name="butlletins" colspan="4" nolabel="1" context="{\'cups_id\': active_id}"/>\n </page>\n <page string="Històric d\'autoconsums">\n <field name="hist_autoconsum" nolabel="1" context="{\'default_cups_id\': active_id}" readonly="1"/>\n </page>\n <page string="Històric de pòlisses">\n <field name="polisses" nolabel="1" colspan="4">\n </field>\n </page>\n </notebook>\n </form>',
|
|
55
54
|
field_parent: false,
|
|
56
55
|
fields: {
|
|
57
|
-
state: {
|
|
58
|
-
readonly: true,
|
|
59
|
-
required: true,
|
|
60
|
-
selection: [
|
|
61
|
-
["esborrany", "Esborrany"],
|
|
62
|
-
["actiu", "Actiu"],
|
|
63
|
-
["pendent", "Pendent d'activació"],
|
|
64
|
-
["baixa", "Baixa"],
|
|
65
|
-
["baixa2", "Baixa per modificació"],
|
|
66
|
-
["baixa3", "Baixa per renovació"],
|
|
67
|
-
["baixa4", "Baixa per nova pòlissa"],
|
|
68
|
-
],
|
|
69
|
-
string: "Estat",
|
|
70
|
-
type: "selection",
|
|
71
|
-
views: {},
|
|
72
|
-
},
|
|
73
56
|
aclarador: {
|
|
74
57
|
size: 256,
|
|
75
58
|
string: "Aclarador",
|
|
@@ -15,11 +15,12 @@ export const Default = (): React.ReactElement => {
|
|
|
15
15
|
<LocaleProvider lang="en_US">
|
|
16
16
|
<GoToResourceModal
|
|
17
17
|
visible={true}
|
|
18
|
+
isSearching={false}
|
|
18
19
|
onCancel={() => {
|
|
19
20
|
alert("cancel");
|
|
20
21
|
}}
|
|
21
|
-
onIdSubmitted={(
|
|
22
|
-
alert(
|
|
22
|
+
onIdSubmitted={(ids) => {
|
|
23
|
+
alert(ids);
|
|
23
24
|
}}
|
|
24
25
|
/>
|
|
25
26
|
</LocaleProvider>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext, useRef } from "react";
|
|
2
|
-
import { Button, Col, Form,
|
|
2
|
+
import { Button, Col, Form, Input, Modal, Row, Space, Checkbox } from "antd";
|
|
3
3
|
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
|
|
4
4
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
5
5
|
|
|
6
6
|
type Props = {
|
|
7
7
|
visible: boolean;
|
|
8
|
-
onIdSubmitted: (
|
|
8
|
+
onIdSubmitted: (ids: number[]) => void;
|
|
9
9
|
onCancel: () => void;
|
|
10
10
|
isSearching: boolean;
|
|
11
11
|
};
|
|
@@ -18,7 +18,8 @@ export const GoToResourceModal = (props: Props) => {
|
|
|
18
18
|
const inputRef = useRef<null | HTMLElement>();
|
|
19
19
|
|
|
20
20
|
function handleSubmit(values: any) {
|
|
21
|
-
|
|
21
|
+
const ids = values.id.split(',').map((id:string) => parseInt(id.trim()))
|
|
22
|
+
onIdSubmitted(ids);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
return (
|
|
@@ -39,11 +40,11 @@ export const GoToResourceModal = (props: Props) => {
|
|
|
39
40
|
rules={[
|
|
40
41
|
{
|
|
41
42
|
required: true,
|
|
42
|
-
type: "number",
|
|
43
43
|
},
|
|
44
44
|
]}
|
|
45
|
+
help={t("searchIdHelp")}
|
|
45
46
|
>
|
|
46
|
-
<
|
|
47
|
+
<Input style={{ width: "100%" }} autoFocus ref={inputRef as any}/>
|
|
47
48
|
</Form.Item>
|
|
48
49
|
<Row align="middle" justify="end">
|
|
49
50
|
<Col>
|
package/src/views/ActionView.tsx
CHANGED
|
@@ -318,52 +318,60 @@ function ActionView(props: Props, ref: any) {
|
|
|
318
318
|
setGtResourceModalVisible(true);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
async function goToResourceId(
|
|
321
|
+
async function goToResourceId(ids: number[]) {
|
|
322
322
|
setSearchingForResourceId(true);
|
|
323
323
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
let mode: ViewType;
|
|
325
|
+
let domain: any[];
|
|
326
|
+
if (ids.length === 1) {
|
|
327
|
+
mode = "form";
|
|
328
|
+
domain = [];
|
|
329
|
+
const id = ids[0];
|
|
330
|
+
const itemIndex = results!.findIndex((item: any) => {
|
|
331
|
+
return item.id === id;
|
|
332
|
+
});
|
|
333
|
+
let resource;
|
|
334
|
+
|
|
335
|
+
if (itemIndex === -1) {
|
|
336
|
+
try {
|
|
337
|
+
resource = (
|
|
338
|
+
await ConnectionProvider.getHandler().readObjects({
|
|
339
|
+
model,
|
|
340
|
+
ids: [id],
|
|
341
|
+
context,
|
|
342
|
+
})
|
|
343
|
+
)?.[0];
|
|
344
|
+
} catch (err) {
|
|
345
|
+
}
|
|
329
346
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
)?.[0];
|
|
339
|
-
} catch (err) {}
|
|
340
|
-
|
|
341
|
-
if (!resource) {
|
|
342
|
-
setSearchingForResourceId(false);
|
|
343
|
-
setGtResourceModalVisible(false);
|
|
344
|
-
showInfo(t("idNotFound"));
|
|
345
|
-
return;
|
|
347
|
+
if (!resource) {
|
|
348
|
+
setSearchingForResourceId(false);
|
|
349
|
+
setGtResourceModalVisible(false);
|
|
350
|
+
showInfo(t("idNotFound"));
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
resource = results[itemIndex];
|
|
346
355
|
}
|
|
347
356
|
} else {
|
|
348
|
-
|
|
357
|
+
mode = "tree";
|
|
358
|
+
domain = [["id", "in", ids]]
|
|
349
359
|
}
|
|
350
360
|
|
|
351
361
|
setSearchingForResourceId(false);
|
|
352
362
|
setGtResourceModalVisible(false);
|
|
353
|
-
|
|
354
|
-
const viewForm = views.find((v) => v[1] === "form");
|
|
355
|
-
|
|
363
|
+
const viewForm = views.find((v) => v[1] === mode);
|
|
356
364
|
openAction({
|
|
357
|
-
domain:
|
|
365
|
+
domain: domain,
|
|
358
366
|
context,
|
|
359
367
|
model,
|
|
360
368
|
views,
|
|
361
369
|
title,
|
|
362
370
|
target: "current",
|
|
363
|
-
initialView: {
|
|
371
|
+
initialView: {id: viewForm?.[0]!, type: mode},
|
|
364
372
|
action_id,
|
|
365
373
|
action_type,
|
|
366
|
-
res_id:
|
|
374
|
+
res_id: ids[0],
|
|
367
375
|
});
|
|
368
376
|
}
|
|
369
377
|
|
|
@@ -671,7 +671,7 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
671
671
|
<One2manyTopBar
|
|
672
672
|
mode={currentView}
|
|
673
673
|
title={getTitle()}
|
|
674
|
-
readOnly={readOnly
|
|
674
|
+
readOnly={readOnly}
|
|
675
675
|
isMany2Many={isMany2many}
|
|
676
676
|
formHasChanges={formHasChanges}
|
|
677
677
|
totalItems={itemsToShow.length}
|
|
@@ -1015,7 +1015,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
1015
1015
|
let mustBlockButtons = false;
|
|
1016
1016
|
|
|
1017
1017
|
try {
|
|
1018
|
-
if (
|
|
1018
|
+
if (formHasChanges() || getCurrentId() === undefined) {
|
|
1019
1019
|
mustBlockButtons = true;
|
|
1020
1020
|
updateOperationInProgress(true);
|
|
1021
1021
|
if (submitMode === "2many") {
|