@gisce/ooui 2.31.0-alpha.2 → 2.31.0-alpha.3

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.
@@ -15,6 +15,7 @@ declare class Many2one extends Field {
15
15
  _relation: string;
16
16
  get relation(): string;
17
17
  set relation(value: string);
18
+ get showFolder(): boolean;
18
19
  constructor(props: any);
19
20
  }
20
21
  export default Many2one;
@@ -1 +1 @@
1
- {"version":3,"file":"Many2one.d.ts","sourceRoot":"","sources":["../src/Many2one.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;;GAEG;AACH,cAAM,QAAS,SAAQ,KAAK;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAO;IACpB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED;;OAEG;IACH,SAAS,EAAE,MAAM,CAAM;IACvB,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;gBAEW,KAAK,EAAE,GAAG;CAavB;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Many2one.d.ts","sourceRoot":"","sources":["../src/Many2one.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;;GAEG;AACH,cAAM,QAAS,SAAQ,KAAK;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAO;IACpB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED;;OAEG;IACH,SAAS,EAAE,MAAM,CAAM;IACvB,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;gBAEW,KAAK,EAAE,GAAG;CAavB;AAED,eAAe,QAAQ,CAAC"}
package/dist/ooui.es.js CHANGED
@@ -67,12 +67,12 @@ const we = (i = !1) => (i = JSON.parse(i.toString().toLowerCase()), +i > 0), ve
67
67
  fields: e,
68
68
  widgetType: s
69
69
  }) => {
70
- const u = i.replace(/\(/g, "[").replace(/\)/g, "]").replace(/'/g, '"').replace(/True/g, "true").replace(/False/g, "false"), _ = m(u), h = JSON.parse(_), d = {};
70
+ const d = i.replace(/\(/g, "[").replace(/\)/g, "]").replace(/'/g, '"').replace(/True/g, "true").replace(/False/g, "false"), _ = m(d), h = JSON.parse(_), u = {};
71
71
  for (const g of Object.keys(h)) {
72
72
  const p = h[g].map((y) => ve({ entry: y, values: t, fields: e })).every((y) => y);
73
- p ? d[g] = !0 : g === "readonly" && !p && s === "button" && (d[g] = !1);
73
+ p ? u[g] = !0 : g === "readonly" && !p && s === "button" && (u[g] = !1);
74
74
  }
75
- return d;
75
+ return u;
76
76
  }, U = (i) => {
77
77
  if (i === void 0)
78
78
  return {};
@@ -95,21 +95,21 @@ const we = (i = !1) => (i = JSON.parse(i.toString().toLowerCase()), +i > 0), ve
95
95
  n.replace(/'/g, '"')
96
96
  ), l = {};
97
97
  for (const o of Object.keys(a)) {
98
- const u = xe({
98
+ const d = xe({
99
99
  object: t,
100
100
  condition: a[o],
101
101
  evaluateFieldComparison: ({
102
102
  fieldName: _,
103
103
  valueInObject: h,
104
- expectedValue: d
104
+ expectedValue: u
105
105
  }) => X({
106
106
  fieldName: _,
107
107
  valueInObject: h,
108
- expectedValue: d,
108
+ expectedValue: u,
109
109
  fields: e
110
110
  })
111
111
  });
112
- u ? l[o] = !0 : o === "readonly" && !u && s === "button" && (l[o] = !1);
112
+ d ? l[o] = !0 : o === "readonly" && !d && s === "button" && (l[o] = !1);
113
113
  }
114
114
  return l;
115
115
  } catch (n) {
@@ -977,6 +977,9 @@ class Te extends f {
977
977
  set relation(e) {
978
978
  this._relation = e;
979
979
  }
980
+ get showFolder() {
981
+ return this.parsedWidgetProps.showFolder ?? !0;
982
+ }
980
983
  }
981
984
  class Ie extends G {
982
985
  }
@@ -1694,15 +1697,15 @@ const tt = ({
1694
1697
  const n = {}, a = {};
1695
1698
  for (const o of Object.keys(s))
1696
1699
  if (t.state === o) {
1697
- const u = s[o];
1698
- for (const _ of u) {
1699
- const [h, d] = _;
1700
- a[h] || (a[h] = []), a[h].push(d);
1700
+ const d = s[o];
1701
+ for (const _ of d) {
1702
+ const [h, u] = _;
1703
+ a[h] || (a[h] = []), a[h].push(u);
1701
1704
  }
1702
1705
  }
1703
1706
  for (const o of Object.keys(a)) {
1704
- const u = a[o];
1705
- n[o] = u.some((_) => _);
1707
+ const d = a[o];
1708
+ n[o] = d.some((_) => _);
1706
1709
  }
1707
1710
  return n;
1708
1711
  }, it = ({
@@ -1738,8 +1741,8 @@ const ne = ({
1738
1741
  return s;
1739
1742
  if (i.trim().length === 0)
1740
1743
  return;
1741
- const d = i.replace(/"/g, "'").replace(/\s/g, "").replace(/True/g, "true").replace(/False/g, "false").replace(/\{/g, "").replace(/\}/g, "").split(",").map((c) => c.split(":")), g = {};
1742
- return d.forEach((c) => {
1744
+ const u = i.replace(/"/g, "'").replace(/\s/g, "").replace(/True/g, "true").replace(/False/g, "false").replace(/\{/g, "").replace(/\}/g, "").split(",").map((c) => c.split(":")), g = {};
1745
+ return u.forEach((c) => {
1743
1746
  const b = c[1];
1744
1747
  if (!c[1].includes("'") && c[1] !== "true" && c[1] !== "false") {
1745
1748
  const p = st({
@@ -1760,8 +1763,8 @@ const ne = ({
1760
1763
  }, Wt = (i) => {
1761
1764
  const t = [];
1762
1765
  try {
1763
- return !i || le(i) || typeof i != "string" ? t : ae(i) !== null ? [] : (i.trim().length === 0 || i.replace(/"/g, "'").replace(/\s/g, "").replace(/True/g, "true").replace(/False/g, "false").replace(/\{/g, "").replace(/\}/g, "").split(",").map((d) => d.split(":")).forEach((d) => {
1764
- !d[1].includes("'") && d[1] !== "true" && d[1] !== "false" && t.push(d[1].replace(/'/g, ""));
1766
+ return !i || le(i) || typeof i != "string" ? t : ae(i) !== null ? [] : (i.trim().length === 0 || i.replace(/"/g, "'").replace(/\s/g, "").replace(/True/g, "true").replace(/False/g, "false").replace(/\{/g, "").replace(/\}/g, "").split(",").map((u) => u.split(":")).forEach((u) => {
1767
+ !u[1].includes("'") && u[1] !== "true" && u[1] !== "false" && t.push(u[1].replace(/'/g, ""));
1765
1768
  }), t);
1766
1769
  } catch {
1767
1770
  }
@@ -1906,17 +1909,17 @@ class Tt {
1906
1909
  }
1907
1910
  parse(t, e) {
1908
1911
  var o;
1909
- const { values: s = {}, readOnly: n = !1 } = e || {}, a = D.parse(t).filter((u) => u.tagName === "form")[0];
1912
+ const { values: s = {}, readOnly: n = !1 } = e || {}, a = D.parse(t).filter((d) => d.tagName === "form")[0];
1910
1913
  this._string = ((o = a.attributes) == null ? void 0 : o.string) || null, this._string && (this._string = m(this._string)), this._readOnly = n, this._context = s.id ? { active_id: s.id, active_ids: [s.id] } : {}, this._invisibleFields = [], this.parseNode({
1911
1914
  fields: a.children,
1912
1915
  container: this._container,
1913
1916
  values: s
1914
1917
  });
1915
1918
  const l = nt(this._container._rows);
1916
- l.forEach((u) => {
1917
- const _ = u;
1918
- _._id && _._context && (this._contextForFields[_._id] = u._context);
1919
- }), this._autorefreshableFields = l.filter((u) => u instanceof f && u.autoRefresh).map((u) => u._id);
1919
+ l.forEach((d) => {
1920
+ const _ = d;
1921
+ _._id && _._context && (this._contextForFields[_._id] = d._context);
1922
+ }), this._autorefreshableFields = l.filter((d) => d instanceof f && d.autoRefresh).map((d) => d._id);
1920
1923
  }
1921
1924
  parseNode({
1922
1925
  fields: t,
@@ -1926,7 +1929,7 @@ class Tt {
1926
1929
  const n = new $();
1927
1930
  t.filter((a) => typeof a == "object").forEach((a) => {
1928
1931
  var v, F;
1929
- const { tagName: l, attributes: o, children: u } = a;
1932
+ const { tagName: l, attributes: o, children: d } = a;
1930
1933
  let _ = l, h = o;
1931
1934
  if (l === "field") {
1932
1935
  const { name: x, widget: E } = o;
@@ -1948,7 +1951,7 @@ class Tt {
1948
1951
  fieldsWidgetType: this._fields[x].type
1949
1952
  };
1950
1953
  }
1951
- const d = Ce({
1954
+ const u = Ce({
1952
1955
  tagAttributes: h,
1953
1956
  values: s,
1954
1957
  fields: this._fields,
@@ -1974,7 +1977,7 @@ class Tt {
1974
1977
  let b;
1975
1978
  Q(h.domain) ? b = h.domain : Q((F = this._fields[h.name]) == null ? void 0 : F.domain) && (b = this._fields[h.name].domain), this._keyIdx = this._keyIdx + 1;
1976
1979
  const p = {
1977
- ...d,
1980
+ ...u,
1978
1981
  ...g,
1979
1982
  context: c,
1980
1983
  domain: b,
@@ -1983,7 +1986,7 @@ class Tt {
1983
1986
  e.readOnly && (p.readonly = !0);
1984
1987
  const y = n.createWidget(_, p);
1985
1988
  y.invisible && y instanceof f && this._invisibleFields.push(p.name), y instanceof w && this.parseNode({
1986
- fields: u,
1989
+ fields: d,
1987
1990
  container: y.container,
1988
1991
  values: s
1989
1992
  }), y instanceof ee && y.readOnly !== void 0 || (y.readOnly = y.readOnly || this.readOnly), e.addWidget(y);
@@ -2079,30 +2082,30 @@ class It {
2079
2082
  const { tagName: a, attributes: l } = n;
2080
2083
  let o = null;
2081
2084
  if (a === "field") {
2082
- const { name: u, widget: _ } = l;
2085
+ const { name: d, widget: _ } = l;
2083
2086
  let h = l;
2084
- if (u) {
2085
- if (!this._fields[u])
2086
- throw new Error(`Field ${u} doesn't exist in fields defintion`);
2087
- const d = this._fields[u];
2088
- o = d.type, (Array.isArray(d == null ? void 0 : d.domain) && (d == null ? void 0 : d.domain.length) === 0 || (d == null ? void 0 : d.domain) === !1) && l.domain && l.domain.length > 0 && delete d.domain;
2087
+ if (d) {
2088
+ if (!this._fields[d])
2089
+ throw new Error(`Field ${d} doesn't exist in fields defintion`);
2090
+ const u = this._fields[d];
2091
+ o = u.type, (Array.isArray(u == null ? void 0 : u.domain) && (u == null ? void 0 : u.domain.length) === 0 || (u == null ? void 0 : u.domain) === !1) && l.domain && l.domain.length > 0 && delete u.domain;
2089
2092
  const g = ne({
2090
- context: l.context || d.context,
2093
+ context: l.context || u.context,
2091
2094
  values: {},
2092
2095
  fields: this._fields
2093
2096
  });
2094
2097
  h = {
2095
- ...d,
2098
+ ...u,
2096
2099
  ...l,
2097
- fieldsWidgetType: d == null ? void 0 : d.type,
2100
+ fieldsWidgetType: u == null ? void 0 : u.type,
2098
2101
  context: g
2099
- }, this._contextForFields[u] = g;
2102
+ }, this._contextForFields[d] = g;
2100
2103
  }
2101
2104
  if (_ && (o = _), !h.invisible) {
2102
- const d = s.createWidget(o, h);
2103
- this._columns.push(d);
2105
+ const u = s.createWidget(o, h);
2106
+ this._columns.push(u);
2104
2107
  }
2105
- W(h.autorefresh) && this._autorefreshableFields.push(u);
2108
+ W(h.autorefresh) && this._autorefreshableFields.push(d);
2106
2109
  }
2107
2110
  });
2108
2111
  }
@@ -2195,11 +2198,11 @@ const St = ({
2195
2198
  if (!Array.isArray(s))
2196
2199
  return;
2197
2200
  const [n, a, l] = s;
2198
- let o, u;
2199
- n.indexOf(".") !== -1 ? (o = n.substr(0, n.indexOf(".")), u = n.substr(
2201
+ let o, d;
2202
+ n.indexOf(".") !== -1 ? (o = n.substr(0, n.indexOf(".")), d = n.substr(
2200
2203
  n.indexOf(".") + 1,
2201
2204
  n.length - 1
2202
- )) : (o = n, u = "id"), o === t && e.push([u, a, l]);
2205
+ )) : (o = n, d = "id"), o === t && e.push([d, a, l]);
2203
2206
  }), e;
2204
2207
  }, zt = (i) => typeof i != "string" ? [] : i.replace(/[()[\]]/g, "").split(",").map((t) => t.trim()).filter((t) => !t.includes("'"));
2205
2208
  class lt {
@@ -2312,7 +2315,7 @@ const ct = (i) => {
2312
2315
  let e;
2313
2316
  if (i.forEach((s) => {
2314
2317
  if (s.tagName === "field") {
2315
- const n = s.attributes.axis, a = s.attributes.operator, l = s.attributes.name, o = s.attributes.label || void 0, u = s.attributes.stacked || void 0;
2318
+ const n = s.attributes.axis, a = s.attributes.operator, l = s.attributes.name, o = s.attributes.label || void 0, d = s.attributes.stacked || void 0;
2316
2319
  if (!n)
2317
2320
  throw new Error(`Field ${l} doesn't have an axis`);
2318
2321
  if (!l)
@@ -2320,11 +2323,11 @@ const ct = (i) => {
2320
2323
  n === "x" ? e = new ht({
2321
2324
  name: l
2322
2325
  }) : n === "y" && t.push(
2323
- new dt({
2326
+ new ut({
2324
2327
  name: l,
2325
2328
  operator: a,
2326
2329
  label: o,
2327
- stacked: u
2330
+ stacked: d
2328
2331
  })
2329
2332
  );
2330
2333
  }
@@ -2353,7 +2356,7 @@ class j extends oe {
2353
2356
  return this._y;
2354
2357
  }
2355
2358
  }
2356
- const ut = {
2359
+ const dt = {
2357
2360
  indicator: ce,
2358
2361
  indicatorField: ot,
2359
2362
  line: j,
@@ -2363,12 +2366,12 @@ const ut = {
2363
2366
  const t = D.parse(i).filter((n) => n.tagName === "graph")[0], e = t.attributes.type;
2364
2367
  if (!e)
2365
2368
  throw new Error(`${e} is not a valid graph`);
2366
- const s = ut[e];
2369
+ const s = dt[e];
2367
2370
  if (!s)
2368
2371
  throw new Error(`${e} not found as a GraphModel`);
2369
2372
  return new s(e, t);
2370
2373
  };
2371
- class ue {
2374
+ class de {
2372
2375
  constructor({ name: t, axis: e }) {
2373
2376
  r(this, "_name");
2374
2377
  r(this, "_axis");
@@ -2381,7 +2384,7 @@ class ue {
2381
2384
  return this._axis;
2382
2385
  }
2383
2386
  }
2384
- class dt extends ue {
2387
+ class ut extends de {
2385
2388
  constructor({
2386
2389
  name: e,
2387
2390
  operator: s,
@@ -2404,7 +2407,7 @@ class dt extends ue {
2404
2407
  return this._stacked;
2405
2408
  }
2406
2409
  }
2407
- class ht extends ue {
2410
+ class ht extends de {
2408
2411
  constructor({ name: t }) {
2409
2412
  super({ name: t, axis: "x" });
2410
2413
  }
@@ -2462,15 +2465,15 @@ function gt({
2462
2465
  groupBy: "type-stacked"
2463
2466
  }), a = `${t}s`;
2464
2467
  return Object.keys(n).forEach((o) => {
2465
- const u = n[o];
2466
- for (let _ = 0; _ < u.length; _++) {
2467
- const h = u[_];
2468
- if (s.push(h), _ === u.length - 1)
2468
+ const d = n[o];
2469
+ for (let _ = 0; _ < d.length; _++) {
2470
+ const h = d[_];
2471
+ if (s.push(h), _ === d.length - 1)
2469
2472
  return;
2470
- const d = h.x, g = u[_ + 1].x;
2471
- if (!de([d, g], a)) {
2473
+ const u = h.x, g = d[_ + 1].x;
2474
+ if (!ue([u, g], a)) {
2472
2475
  const c = mt({
2473
- dates: [d, g],
2476
+ dates: [u, g],
2474
2477
  timerange: t,
2475
2478
  interval: e
2476
2479
  });
@@ -2484,7 +2487,7 @@ function gt({
2484
2487
  );
2485
2488
  }
2486
2489
  }
2487
- }), s.sort((o, u) => o.x < u.x ? -1 : o.x > u.x ? 1 : 0);
2490
+ }), s.sort((o, d) => o.x < d.x ? -1 : o.x > d.x ? 1 : 0);
2488
2491
  }
2489
2492
  function mt({
2490
2493
  dates: i,
@@ -2496,12 +2499,12 @@ function mt({
2496
2499
  return i;
2497
2500
  const a = i.sort((l, o) => l < o ? -1 : l > o ? 1 : 0);
2498
2501
  for (let l = 0; l < a.length - 1; l++) {
2499
- const o = a[l], u = a[l + 1];
2500
- if (!de([o, u], n)) {
2502
+ const o = a[l], d = a[l + 1];
2503
+ if (!ue([o, d], n)) {
2501
2504
  const _ = T(o, z(n)).add(
2502
2505
  e,
2503
2506
  n
2504
- ), h = T(u, z(n));
2507
+ ), h = T(d, z(n));
2505
2508
  for (; _.isBefore(h); )
2506
2509
  s.push(_.format(z(n))), _.add(e, n);
2507
2510
  }
@@ -2520,13 +2523,13 @@ function bt({
2520
2523
  groupBy: "all"
2521
2524
  });
2522
2525
  return Object.keys(n).forEach((a) => {
2523
- const l = n[a], o = l[0].operator === "count" ? "+" : l[0].operator, u = Y({
2526
+ const l = n[a], o = l[0].operator === "count" ? "+" : l[0].operator, d = Y({
2524
2527
  values: l.map((_) => _.value),
2525
2528
  operator: o
2526
2529
  });
2527
2530
  s.push({
2528
2531
  ...l[0],
2529
- value: u
2532
+ value: d
2530
2533
  });
2531
2534
  }), s;
2532
2535
  }
@@ -2575,7 +2578,7 @@ function pt({
2575
2578
  function xt(i) {
2576
2579
  return i.indexOf(":") ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
2577
2580
  }
2578
- function de(i, t) {
2581
+ function ue(i, t) {
2579
2582
  let e = !1;
2580
2583
  const s = z(t);
2581
2584
  if (i.length === 0)
@@ -2687,21 +2690,21 @@ const wt = {
2687
2690
  i.type === "pie" && h.some((c) => c.x === !1) ? h = h.map((c) => c.x === !1 ? { ...c, x: (s == null ? void 0 : s.uninformedString) || "Not informed" } : c) : _.some((c) => c.x === !1) && (h = h.filter(
2688
2691
  (c) => c.x !== !1
2689
2692
  ));
2690
- let d = h;
2691
- i.timerange ? d = ft({
2692
- values: d,
2693
+ let u = h;
2694
+ i.timerange ? u = ft({
2695
+ values: u,
2693
2696
  timerange: i.timerange,
2694
2697
  interval: i.interval
2695
- }) : i.type == "pie" && (d = h.sort((c, b) => b.value - c.value));
2698
+ }) : i.type == "pie" && (u = h.sort((c, b) => b.value - c.value));
2696
2699
  const g = {
2697
- data: d,
2700
+ data: u,
2698
2701
  isGroup: o || l,
2699
2702
  isStack: o
2700
2703
  };
2701
2704
  if (i.type === "line" && i.y_range && (g.yAxisOpts = {
2702
2705
  mode: i.y_range
2703
2706
  }, i.y_range === "auto")) {
2704
- const { min: c, max: b } = fe(d);
2707
+ const { min: c, max: b } = fe(u);
2705
2708
  g.yAxisOpts.valueOpts = { min: c, max: b };
2706
2709
  }
2707
2710
  return g;
@@ -2828,12 +2831,12 @@ export {
2828
2831
  Se as FloatTime,
2829
2832
  Tt as Form,
2830
2833
  oe as Graph,
2831
- ue as GraphAxis,
2834
+ de as GraphAxis,
2832
2835
  j as GraphChart,
2833
2836
  ce as GraphIndicator,
2834
2837
  ot as GraphIndicatorField,
2835
2838
  ht as GraphXAxis,
2836
- dt as GraphYAxis,
2839
+ ut as GraphYAxis,
2837
2840
  Pe as Group,
2838
2841
  ze as HTMLPreview,
2839
2842
  Ne as Image,