@gisce/react-ooui 2.2.0-rc.5 → 2.2.0-rc.7

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":"AttachmentsButton.d.ts","sourceRoot":"","sources":["../../src/actionbar/AttachmentsButton.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,UAAU,EAEX,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,uBAAuB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF,iBAAS,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CA0GvD;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"AttachmentsButton.d.ts","sourceRoot":"","sources":["../../src/actionbar/AttachmentsButton.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,UAAU,EAEX,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,uBAAuB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3D,CAAC;AAEF,iBAAS,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAmHvD;AAED,eAAe,iBAAiB,CAAC"}
@@ -6774,51 +6774,59 @@ function Dc(e) {
6774
6774
  onListAllAttachments: o,
6775
6775
  onViewAttachmentDetails: s
6776
6776
  } = e, { formRef: a } = ne(ot), [l, d] = w(!1), [u, f] = w([]), [c, m] = w(!1), { t: p } = pe(), h = be(async () => {
6777
- d(!0);
6778
- try {
6779
- const v = await N.getHandler().readObjects({
6780
- model: "ir.attachment",
6781
- ids: t.map((T) => T.id),
6782
- fieldsToRetrieve: ["name", "datas_fname", "link"],
6783
- context: a.current.getContext()
6784
- });
6785
- f(
6786
- v.map((T) => ({
6787
- id: T.id,
6788
- name: T.name,
6789
- datas_fname: T.datas_fname,
6790
- link: T.link
6791
- }))
6792
- );
6793
- } catch (v) {
6794
- ze(v);
6795
- }
6796
- d(!1);
6797
- }, t), g = be(async (v) => {
6798
- if (v.link) {
6799
- window.open(v.link);
6800
- return;
6801
- }
6802
- m(!0);
6803
- let T;
6804
- try {
6805
- T = (await N.getHandler().readObjects({
6806
- model: "ir.attachment",
6807
- ids: [v.id],
6808
- context: a.current.getContext()
6809
- }))[0];
6810
- } catch (b) {
6811
- ze(b);
6777
+ if (!(!t || t.length === 0)) {
6778
+ d(!0);
6779
+ try {
6780
+ const v = await N.getHandler().readObjects({
6781
+ model: "ir.attachment",
6782
+ ids: t.map((T) => T.id),
6783
+ fieldsToRetrieve: ["name", "datas_fname", "link"],
6784
+ context: a.current.getContext()
6785
+ });
6786
+ f(
6787
+ v.map((T) => ({
6788
+ id: T.id,
6789
+ name: T.name,
6790
+ datas_fname: T.datas_fname,
6791
+ link: T.link
6792
+ }))
6793
+ );
6794
+ } catch (v) {
6795
+ ze(v);
6796
+ }
6797
+ d(!1);
6812
6798
  }
6813
- if (m(!1), !!T)
6814
- if (T.datas) {
6815
- const b = await Vt(T.datas);
6816
- gn(T.datas, b.mime);
6817
- } else
6818
- s(T);
6819
- }, []), y = be(async (v) => {
6820
- s(v);
6821
- }, []);
6799
+ }, [t, a]), g = be(
6800
+ async (v) => {
6801
+ if (v.link) {
6802
+ window.open(v.link);
6803
+ return;
6804
+ }
6805
+ m(!0);
6806
+ let T;
6807
+ try {
6808
+ T = (await N.getHandler().readObjects({
6809
+ model: "ir.attachment",
6810
+ ids: [v.id],
6811
+ context: a.current.getContext()
6812
+ }))[0];
6813
+ } catch (b) {
6814
+ ze(b);
6815
+ }
6816
+ if (m(!1), !!T)
6817
+ if (T.datas) {
6818
+ const b = await Vt(T.datas);
6819
+ gn(T.datas, b.mime);
6820
+ } else
6821
+ s(T);
6822
+ },
6823
+ [a, s]
6824
+ ), y = be(
6825
+ async (v) => {
6826
+ s(v);
6827
+ },
6828
+ [s]
6829
+ );
6822
6830
  return fe(() => {
6823
6831
  h();
6824
6832
  }, [h]), /* @__PURE__ */ D(J, { children: [