@devgateway/dvz-ui-react 1.7.9 → 1.7.10

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
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),g=require("react"),d=require("semantic-ui-react"),p=require("../reducers/data.js"),f=require("../../redux/hooks.js"),h=m=>{const{parent:x,editing:j=!1,unique:C,"data-label":r,"data-group":o,"data-app":s,"data-measures-groups":n}=m;let e;const i=f.useAppDispatch(),c=f.useAppSelector(a=>a.getIn(["data","measures",s,o])),l={onReset:p.cleanMeasures,onChange:p.setMeasures};if(n instanceof String||typeof n=="string"?e=JSON.parse(decodeURIComponent(n)):e=n,g.useEffect(()=>{e&&e[s]&&e[s].forEach(a=>{a.defaultSelected&&i(l.onChange({app:s,group:o,mGroup:a}))})},[]),e&&e[s]){const a=e[s];return t.jsxs(d.Container,{className:"measures group",fluid:!0,children:[r&&t.jsx("span",{children:r}),a.map(u=>t.jsxs("div",{className:"inputs lists",onClick:q=>i(l.onChange({app:s,group:o,mGroup:u})),children:[t.jsx("input",{readOnly:!0,checked:!!(c&&c.idx==u.idx),type:"radio"}),t.jsx("span",{children:u.label})]},u.idx))]})}else return t.jsx(d.Container,{className:"measures group",fluid:!0,children:r&&t.jsx("span",{children:r})})};exports.default=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),m=require("react"),d=require("semantic-ui-react"),p=require("../reducers/data.js"),f=require("../../redux/hooks.js"),g=h=>{const{parent:x,editing:j=!1,unique:C,"data-label":n,"data-group":o,"data-app":a,"data-measures-groups":u}=h;let s;const c=f.useAppDispatch(),i=f.useAppSelector(e=>e.getIn(["data","measures",a,o])),l={onReset:p.cleanMeasures,onChange:p.setMeasures};if(u instanceof String||typeof u=="string"){const e=u;let t;try{t=decodeURIComponent(e)}catch{t=e}s=JSON.parse(t)}else s=u;if(m.useEffect(()=>{s&&s[a]&&s[a].forEach(e=>{e.defaultSelected&&c(l.onChange({app:a,group:o,mGroup:e}))})},[]),s&&s[a]){const e=s[a];return r.jsxs(d.Container,{className:"measures group",fluid:!0,children:[n&&r.jsx("span",{children:n}),e.map(t=>r.jsxs("div",{className:"inputs lists",onClick:q=>c(l.onChange({app:a,group:o,mGroup:t})),children:[r.jsx("input",{readOnly:!0,checked:!!(i&&i.idx==t.idx),type:"radio"}),r.jsx("span",{children:t.label})]},t.idx))]})}else return r.jsx(d.Container,{className:"measures group",fluid:!0,children:n&&r.jsx("span",{children:n})})};exports.default=g;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),m=require("react"),l=require("semantic-ui-react"),T="multi-select",p="single-select",j=Number.MIN_SAFE_INTEGER,x=v=>v==null?null:String(v),Y=v=>{const{allLabel:k,noneLabel:O,placeholder:E,options:r,current:N,onChange:s,useSingleColumn:_,enableTextSearch:S,filterType:u,allNoneSameBehaviour:A,hiddenFilters:h,value:o,closeOnSelect:C=!0,noneFunction:R,alphabeticalSort:z,ascOrder:H,...V}=v,d=u===T,I=Array.isArray(o)?o:N||[],f=(Array.isArray(I)?I.some(e=>e===j):!1)?I.filter(e=>e!==j):I,[a,$]=m.useState(""),F=(e,t)=>{if(u===T){const i=x(t),c=Array.isArray(f)?[...f]:[];let y=c.some(P=>x(P)===i)?c.filter(P=>x(P)!==i):[...c,t];return!A&&y.length===0&&(y=[j]),s&&s(e,y)}if(u===p)return s&&s(e,t);C&&g.current&&g.current.close()},K=()=>{const e=(r||[]).filter(t=>{var i;return S&&a&&a.trim().length>0&&t.text?(i=t.text)==null?void 0:i.toString().toLowerCase().includes(a.toLowerCase()):!0}).map(t=>t.value);d&&s&&s({},e),!d&&C&&g.current&&g.current.close()},U=e=>{if(R){R(e);return}else{if(!r)return[];const t=r.filter(i=>{var c;return S&&a&&a.trim().length>0&&i.text?(c=i.text)==null?void 0:c.toString().toLowerCase().includes(a==null?void 0:a.toString().toLowerCase()):!0});if(d&&s){const i=A?t.map(c=>c.value):[j];s({},i)}!d&&C&&g.current&&g.current.close()}},D=e=>{$(e)},b=m.useRef(!1);m.useEffect(()=>{if(!(!d||b.current)&&r&&r.length>0)if(!(Array.isArray(f)?f.length>0:!!f)&&s){b.current=!0;const t=r.map(i=>i.value);s({},t)}else b.current=!0},[d,r]),m.useEffect(()=>{if(d&&r&&r.length>0&&s){const e=r.map(t=>t.value);s({},e)}},[d]);const q=m.useMemo(()=>{if(u==p){const e=o?r==null?void 0:r.filter(t=>t.value==o)[0]:null;return e?`${E?E+" ":""}${e.text}`:""}else{const e=f?f.filter(i=>i==Number.MIN_SAFE_INTEGER?!1:h&&h.length>0?h.indexOf(i)==-1:!0).length:0,t=(r==null?void 0:r.filter(i=>h&&h.length>0?h.indexOf(i.id)==-1:!0).length)||0;return`${E} (${e}/${t})`}},[r,f,u]),g=m.useRef(null),M=q,L=typeof M=="string"?M:"",G=L&&L.length>0?L:E||"",w=m.useRef(void 0);m.useEffect(()=>{u===p&&w.current===void 0&&o!==void 0&&(w.current=o)},[u,o]);const B=u===p?o!=null&&o!==w.current:N&&N.length>0;return n.jsx(l.Dropdown,{...V,ref:g,fluid:!0,text:G,scrolling:!1,button:!0,icon:"angle down",multiple:d,search:!0,floating:!1,value:o,closeOnChange:C,...d?{renderLabel:()=>null}:{},className:`multiple ${B?"applied ":""}`,children:n.jsxs(l.Dropdown.Menu,{children:[u!=p&&n.jsxs(n.Fragment,{children:[n.jsx(l.Segment,{children:n.jsxs(l.Dropdown.Item,{children:[n.jsx(l.Label,{basic:!0,onClick:K,children:k})," ","|"," ",n.jsx(l.Label,{basic:!0,onClick:U,children:O})]})}),S&&n.jsxs(n.Fragment,{children:[n.jsx(l.Container,{children:n.jsx(l.Dropdown.Item,{children:n.jsx("div",{className:"ui action input",children:n.jsxs("div",{className:"ui input",children:[n.jsx("input",{className:"filter-search",value:a,placeholder:"Search...",onChange:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation(),D(e.target.value)},onKeyDown:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation()},onKeyUp:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation()},onKeyPress:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},onFocus:e=>{e.stopPropagation()},type:"text",autoComplete:"off"}),n.jsx(l.Icon,{name:"remove",link:!0,className:"clear-icon ignore",onClick:e=>{D("")}})]})})})}),n.jsx(l.Divider,{})]})]}),n.jsx("br",{}),n.jsx(l.Container,{className:_?"dropdown-single-column":"",children:r==null?void 0:r.filter(e=>{var t;return S&&a&&a.trim().length>0&&e.text?(t=e.text)==null?void 0:t.toString().toLowerCase().includes(a.toLowerCase()):!0}).map(({value:e,text:t},i)=>n.jsxs(l.Dropdown.Item,{className:_?"dropdown-item-single-column":"",children:[u===p&&n.jsx(l.Radio,{checked:o==e,onChange:c=>{F(c,e)},label:t}),u===T&&n.jsx(l.Checkbox,{checked:f&&f.some(c=>x(c)===x(e)),onChange:()=>F(null,e),label:t})]},i))})]})})};exports.default=Y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),g=require("react"),s=require("semantic-ui-react"),k="multi-select",C="single-select",A=Number.MIN_SAFE_INTEGER,w=E=>E==null?null:String(E),ee=E=>{const{allLabel:K,noneLabel:Y,placeholder:N,options:h,current:_,onChange:i,useSingleColumn:D,enableTextSearch:y,filterType:a,allNoneSameBehaviour:$,hiddenFilters:j,autoApply:m,value:o,closeOnSelect:v=!0,noneFunction:q,alphabeticalSort:G,ascOrder:R,...z}=E,x=a===k,T=Array.isArray(o)?o:_||[],L=(Array.isArray(T)?T.some(e=>e===A):!1)?T.filter(e=>e!==A):T,[u,H]=g.useState(""),[f,b]=g.useState(null),S=m===!1&&f!==null?f:L,c=g.useMemo(()=>{if(!h)return[];const e=[...h];return G?e.sort((t,n)=>{const r=t.text?String(t.text).toLowerCase():"",p=n.text?String(n.text).toLowerCase():"";return R?r<p?-1:r>p?1:0:r<p?1:r>p?-1:0}):e.sort((t,n)=>{const r=t.position!==void 0?t.position:0,p=n.position!==void 0?n.position:0;return R?r-p:p-r}),e},[h,G,R]),O=(e,t)=>{if(a===k){const n=w(t),r=Array.isArray(S)?[...S]:[];let I=r.some(P=>w(P)===n)?r.filter(P=>w(P)!==n):[...r,t];!$&&I.length===0&&(I=[A]),m===!1?b(I):i&&i(e,I),v&&d.current&&d.current.close();return}if(a===C){m===!1?b([t]):i&&i(e,t),v&&d.current&&d.current.close();return}},J=()=>{const e=(c||[]).filter(t=>{var n;return y&&u&&u.trim().length>0&&t.text?(n=t.text)==null?void 0:n.toString().toLowerCase().includes(u.toLowerCase()):!0}).map(t=>t.value);x&&(m===!1?b(e):i&&i({},e)),v&&d.current&&d.current.close()},Q=e=>{if(q){q(e);return}else{if(!c)return;const t=c.filter(n=>{var r;return y&&u&&u.trim().length>0&&n.text?(r=n.text)==null?void 0:r.toString().toLowerCase().includes(u==null?void 0:u.toString().toLowerCase()):!0});if(x){const n=$?t.map(r=>r.value):[A];m===!1?b(n):i&&i({},n)}v&&d.current&&d.current.close()}},U=e=>{H(e)},V=g.useRef(!1);g.useEffect(()=>{if(!(!x||V.current)&&h&&h.length>0)if(!(Array.isArray(L)?L.length>0:!!L)&&i){V.current=!0;const t=h.map(n=>n.value);i({},t)}else V.current=!0},[x,h]),g.useEffect(()=>{if(x&&h&&h.length>0&&i){const e=h.map(t=>t.value);i({},e)}},[x]);const W=g.useMemo(()=>{if(a==C){const e=m===!1&&f!==null?f[0]:o,t=e!=null?c==null?void 0:c.filter(n=>n.value==e)[0]:null;return t?`${N?N+" ":""}${t.text}`:""}else{const e=S?S.filter(n=>n==Number.MIN_SAFE_INTEGER?!1:j&&j.length>0?j.indexOf(n)==-1:!0).length:0,t=(c==null?void 0:c.filter(n=>j&&j.length>0?j.indexOf(n.id)==-1:!0).length)||0;return`${N} (${e}/${t})`}},[c,S,a,m,f,o]),d=g.useRef(null),B=W,F=typeof B=="string"?B:"",X=F&&F.length>0?F:N||"",M=g.useRef(void 0);g.useEffect(()=>{a===C&&M.current===void 0&&o!==void 0&&(M.current=o)},[a,o]);const Z=a===C?o!=null&&o!==M.current:_&&_.length>0;return l.jsx(s.Dropdown,{...z,ref:d,fluid:!0,text:X,scrolling:!1,button:!0,icon:"angle down",multiple:x,search:!0,floating:!1,value:o,closeOnChange:v,...x?{renderLabel:()=>null}:{},className:`multiple ${Z?"applied ":""}`,children:l.jsxs(s.Dropdown.Menu,{children:[a!=C&&l.jsxs(l.Fragment,{children:[l.jsx(s.Segment,{children:l.jsxs(s.Dropdown.Item,{children:[l.jsx(s.Label,{basic:!0,onClick:J,children:K})," ","|"," ",l.jsx(s.Label,{basic:!0,onClick:Q,children:Y})]})}),y&&l.jsxs(l.Fragment,{children:[l.jsx(s.Container,{children:l.jsx(s.Dropdown.Item,{children:l.jsx("div",{className:"ui action input",children:l.jsxs("div",{className:"ui input",children:[l.jsx("input",{className:"filter-search",value:u,placeholder:"Search...",onChange:e=>U(e.target.value),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),type:"text",autoComplete:"off"}),l.jsx(s.Icon,{name:"remove",link:!0,className:"clear-icon ignore",onClick:()=>U("")})]})})})}),l.jsx(s.Divider,{})]})]}),l.jsx("br",{}),l.jsx(s.Container,{className:D?"dropdown-single-column":"",children:c==null?void 0:c.filter(e=>{var t;return y&&u&&u.trim().length>0&&e.text?(t=e.text)==null?void 0:t.toString().toLowerCase().includes(u.toLowerCase()):!0}).map(({value:e,text:t},n)=>l.jsxs(s.Dropdown.Item,{className:D?"dropdown-item-single-column":"",children:[a===C&&l.jsx(s.Radio,{checked:(m===!1&&f!==null?f[0]:o)==e,onChange:r=>{O(r,e)},label:t}),a===k&&l.jsx(s.Checkbox,{checked:S&&S.some(r=>w(r)===w(e)),onChange:()=>O(null,e),label:t})]},n))}),m===!1&&l.jsx(s.Segment,{children:l.jsx(s.Dropdown.Item,{children:l.jsx(s.Label,{basic:!0,onClick:()=>{const e=a===C?f!==null?f[0]:o:f!==null?f:L;i&&i({},e),b(null),d.current&&d.current.close()},children:"Apply"})})})]})})};exports.default=ee;
@@ -1,45 +1,56 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
2
  import { useEffect as f } from "react";
3
- import { Container as d } from "semantic-ui-react";
3
+ import { Container as l } from "semantic-ui-react";
4
4
  import { setMeasures as h, cleanMeasures as g } from "../reducers/data.js";
5
5
  import { useAppDispatch as x, useAppSelector as C } from "../../redux/hooks.js";
6
6
  const E = (m) => {
7
7
  const {
8
- parent: N,
9
- editing: S = !1,
10
- unique: b,
11
- "data-label": t,
8
+ parent: y,
9
+ editing: N = !1,
10
+ unique: S,
11
+ "data-label": n,
12
12
  "data-group": p,
13
- "data-app": s,
14
- "data-measures-groups": n
13
+ "data-app": t,
14
+ "data-measures-groups": o
15
15
  } = m;
16
- let e;
17
- const i = x(), u = C((a) => a.getIn(["data", "measures", s, p])), l = {
16
+ let s;
17
+ const i = x(), u = C((e) => e.getIn(["data", "measures", t, p])), c = {
18
18
  onReset: g,
19
19
  onChange: h
20
20
  };
21
- if (n instanceof String || typeof n == "string" ? e = JSON.parse(decodeURIComponent(n)) : e = n, f(() => {
22
- e && e[s] && e[s].forEach((a) => {
23
- a.defaultSelected && i(l.onChange({ app: s, group: p, mGroup: a }));
21
+ if (o instanceof String || typeof o == "string") {
22
+ const e = o;
23
+ let a;
24
+ try {
25
+ a = decodeURIComponent(e);
26
+ } catch {
27
+ a = e;
28
+ }
29
+ s = JSON.parse(a);
30
+ } else
31
+ s = o;
32
+ if (f(() => {
33
+ s && s[t] && s[t].forEach((e) => {
34
+ e.defaultSelected && i(c.onChange({ app: t, group: p, mGroup: e }));
24
35
  });
25
- }, []), e && e[s]) {
26
- const a = e[s];
27
- return /* @__PURE__ */ c(d, { className: "measures group", fluid: !0, children: [
28
- t && /* @__PURE__ */ r("span", { children: t }),
29
- a.map((o) => /* @__PURE__ */ c("div", { className: "inputs lists", onClick: (y) => i(l.onChange({ app: s, group: p, mGroup: o })), children: [
36
+ }, []), s && s[t]) {
37
+ const e = s[t];
38
+ return /* @__PURE__ */ d(l, { className: "measures group", fluid: !0, children: [
39
+ n && /* @__PURE__ */ r("span", { children: n }),
40
+ e.map((a) => /* @__PURE__ */ d("div", { className: "inputs lists", onClick: (b) => i(c.onChange({ app: t, group: p, mGroup: a })), children: [
30
41
  /* @__PURE__ */ r(
31
42
  "input",
32
43
  {
33
44
  readOnly: !0,
34
- checked: !!(u && u.idx == o.idx),
45
+ checked: !!(u && u.idx == a.idx),
35
46
  type: "radio"
36
47
  }
37
48
  ),
38
- /* @__PURE__ */ r("span", { children: o.label })
39
- ] }, o.idx))
49
+ /* @__PURE__ */ r("span", { children: a.label })
50
+ ] }, a.idx))
40
51
  ] });
41
52
  } else
42
- return /* @__PURE__ */ r(d, { className: "measures group", fluid: !0, children: t && /* @__PURE__ */ r("span", { children: t }) });
53
+ return /* @__PURE__ */ r(l, { className: "measures group", fluid: !0, children: n && /* @__PURE__ */ r("span", { children: n }) });
43
54
  };
44
55
  export {
45
56
  E as default
@@ -1,207 +1,203 @@
1
- import { jsx as l, jsxs as g, Fragment as D } from "react/jsx-runtime";
2
- import { useState as W, useRef as A, useEffect as _, useMemo as X } from "react";
3
- import { Dropdown as v, Segment as Z, Label as K, Container as G, Icon as ee, Divider as te, Radio as ne, Checkbox as re } from "semantic-ui-react";
4
- const F = "multi-select", h = "single-select", N = Number.MIN_SAFE_INTEGER, E = (p) => p == null ? null : String(p), de = (p) => {
1
+ import { jsx as r, jsxs as x, Fragment as H } from "react/jsx-runtime";
2
+ import { useState as J, useMemo as Q, useRef as $, useEffect as D } from "react";
3
+ import { Dropdown as E, Segment as W, Label as G, Container as X, Icon as ce, Divider as ae, Radio as ue, Checkbox as fe } from "semantic-ui-react";
4
+ const j = "multi-select", S = "single-select", V = Number.MIN_SAFE_INTEGER, y = (v) => v == null ? null : String(v), pe = (v) => {
5
5
  const {
6
- allLabel: U,
7
- noneLabel: j,
8
- placeholder: S,
9
- options: n,
6
+ allLabel: Z,
7
+ noneLabel: ee,
8
+ placeholder: I,
9
+ options: d,
10
10
  // group,
11
- current: L,
11
+ current: _,
12
12
  onChange: i,
13
- useSingleColumn: k,
14
- enableTextSearch: C,
13
+ useSingleColumn: B,
14
+ enableTextSearch: T,
15
15
  filterType: c,
16
16
  // defaultValues,
17
17
  // showNoDataOption,
18
18
  // defaultValueCriteria,
19
- allNoneSameBehaviour: R,
20
- hiddenFilters: m,
21
- // autoApply,
19
+ allNoneSameBehaviour: K,
20
+ hiddenFilters: C,
21
+ autoApply: h,
22
22
  // taxonomy,
23
23
  // type,
24
- value: o,
25
- closeOnSelect: I = !0,
26
- noneFunction: V,
27
- alphabeticalSort: le,
28
- ascOrder: ie,
29
- ...B
30
- } = p, u = c === F, x = Array.isArray(o) ? o : L || [], d = (Array.isArray(x) ? x.some((e) => e === N) : !1) ? x.filter((e) => e !== N) : x, [a, Y] = W(""), M = (e, t) => {
31
- if (c === F) {
32
- const r = E(t), s = Array.isArray(d) ? [...d] : [];
33
- let T = s.some((w) => E(w) === r) ? s.filter((w) => E(w) !== r) : [...s, t];
34
- return !R && T.length === 0 && (T = [N]), i && i(e, T);
24
+ value: s,
25
+ closeOnSelect: L = !0,
26
+ noneFunction: O,
27
+ alphabeticalSort: U,
28
+ ascOrder: k,
29
+ ...te
30
+ } = v, m = c === j, w = Array.isArray(s) ? s : _ || [], N = (Array.isArray(w) ? w.some((e) => e === V) : !1) ? w.filter((e) => e !== V) : w, [a, ne] = J(""), [u, b] = J(null), p = h === !1 && u !== null ? u : N, o = Q(() => {
31
+ if (!d) return [];
32
+ const e = [...d];
33
+ return U ? e.sort((t, n) => {
34
+ const l = t.text ? String(t.text).toLowerCase() : "", g = n.text ? String(n.text).toLowerCase() : "";
35
+ return k ? l < g ? -1 : l > g ? 1 : 0 : l < g ? 1 : l > g ? -1 : 0;
36
+ }) : e.sort((t, n) => {
37
+ const l = t.position !== void 0 ? t.position : 0, g = n.position !== void 0 ? n.position : 0;
38
+ return k ? l - g : g - l;
39
+ }), e;
40
+ }, [d, U, k]), Y = (e, t) => {
41
+ if (c === j) {
42
+ const n = y(t), l = Array.isArray(p) ? [...p] : [];
43
+ let A = l.some((M) => y(M) === n) ? l.filter((M) => y(M) !== n) : [...l, t];
44
+ !K && A.length === 0 && (A = [V]), h === !1 ? b(A) : i && i(e, A), L && f.current && f.current.close();
45
+ return;
46
+ }
47
+ if (c === S) {
48
+ h === !1 ? b([t]) : i && i(e, t), L && f.current && f.current.close();
49
+ return;
35
50
  }
36
- if (c === h)
37
- return i && i(e, t);
38
- I && f.current && f.current.close();
39
- }, q = () => {
40
- const e = (n || []).filter((t) => {
41
- var r;
42
- return C && a && a.trim().length > 0 && t.text ? (r = t.text) == null ? void 0 : r.toString().toLowerCase().includes(a.toLowerCase()) : !0;
51
+ }, le = () => {
52
+ const e = (o || []).filter((t) => {
53
+ var n;
54
+ return T && a && a.trim().length > 0 && t.text ? (n = t.text) == null ? void 0 : n.toString().toLowerCase().includes(a.toLowerCase()) : !0;
43
55
  }).map((t) => t.value);
44
- u && i && i({}, e), !u && I && f.current && f.current.close();
45
- }, z = (e) => {
46
- if (V) {
47
- V(e);
56
+ m && (h === !1 ? b(e) : i && i({}, e)), L && f.current && f.current.close();
57
+ }, re = (e) => {
58
+ if (O) {
59
+ O(e);
48
60
  return;
49
61
  } else {
50
- if (!n) return [];
51
- const t = n.filter((r) => {
52
- var s;
53
- return C && a && a.trim().length > 0 && r.text ? (s = r.text) == null ? void 0 : s.toString().toLowerCase().includes(a == null ? void 0 : a.toString().toLowerCase()) : !0;
62
+ if (!o) return;
63
+ const t = o.filter((n) => {
64
+ var l;
65
+ return T && a && a.trim().length > 0 && n.text ? (l = n.text) == null ? void 0 : l.toString().toLowerCase().includes(a == null ? void 0 : a.toString().toLowerCase()) : !0;
54
66
  });
55
- if (u && i) {
56
- const r = R ? t.map((s) => s.value) : [N];
57
- i({}, r);
67
+ if (m) {
68
+ const n = K ? t.map((l) => l.value) : [V];
69
+ h === !1 ? b(n) : i && i({}, n);
58
70
  }
59
- !u && I && f.current && f.current.close();
71
+ L && f.current && f.current.close();
60
72
  }
61
- }, O = (e) => {
62
- Y(e);
63
- }, y = A(!1);
64
- _(() => {
65
- if (!(!u || y.current) && n && n.length > 0)
66
- if (!(Array.isArray(d) ? d.length > 0 : !!d) && i) {
67
- y.current = !0;
68
- const t = n.map((r) => r.value);
73
+ }, q = (e) => {
74
+ ne(e);
75
+ }, F = $(!1);
76
+ D(() => {
77
+ if (!(!m || F.current) && d && d.length > 0)
78
+ if (!(Array.isArray(N) ? N.length > 0 : !!N) && i) {
79
+ F.current = !0;
80
+ const t = d.map((n) => n.value);
69
81
  i({}, t);
70
82
  } else
71
- y.current = !0;
72
- }, [u, n]), _(() => {
73
- if (u && n && n.length > 0 && i) {
74
- const e = n.map((t) => t.value);
83
+ F.current = !0;
84
+ }, [m, d]), D(() => {
85
+ if (m && d && d.length > 0 && i) {
86
+ const e = d.map((t) => t.value);
75
87
  i({}, e);
76
88
  }
77
- }, [u]);
78
- const H = X(() => {
79
- if (c == h) {
80
- const e = o ? n == null ? void 0 : n.filter((t) => t.value == o)[0] : null;
81
- return e ? `${S ? S + " " : ""}${e.text}` : "";
89
+ }, [m]);
90
+ const ie = Q(() => {
91
+ if (c == S) {
92
+ const e = h === !1 && u !== null ? u[0] : s, t = e != null ? o == null ? void 0 : o.filter((n) => n.value == e)[0] : null;
93
+ return t ? `${I ? I + " " : ""}${t.text}` : "";
82
94
  } else {
83
- const e = d ? d.filter((r) => r == Number.MIN_SAFE_INTEGER ? !1 : m && m.length > 0 ? m.indexOf(r) == -1 : !0).length : 0, t = (n == null ? void 0 : n.filter((r) => m && m.length > 0 ? m.indexOf(r.id) == -1 : !0).length) || 0;
84
- return `${S} (${e}/${t})`;
95
+ const e = p ? p.filter((n) => n == Number.MIN_SAFE_INTEGER ? !1 : C && C.length > 0 ? C.indexOf(n) == -1 : !0).length : 0, t = (o == null ? void 0 : o.filter((n) => C && C.length > 0 ? C.indexOf(n.id) == -1 : !0).length) || 0;
96
+ return `${I} (${e}/${t})`;
85
97
  }
86
- }, [n, d, c]), f = A(null), $ = H, b = typeof $ == "string" ? $ : "", J = b && b.length > 0 ? b : S || "", P = A(void 0);
87
- _(() => {
88
- c === h && P.current === void 0 && o !== void 0 && (P.current = o);
89
- }, [c, o]);
90
- const Q = c === h ? o != null && o !== P.current : L && L.length > 0;
98
+ }, [o, p, c, h, u, s]), f = $(null), z = ie, P = typeof z == "string" ? z : "", se = P && P.length > 0 ? P : I || "", R = $(void 0);
99
+ D(() => {
100
+ c === S && R.current === void 0 && s !== void 0 && (R.current = s);
101
+ }, [c, s]);
102
+ const oe = c === S ? s != null && s !== R.current : _ && _.length > 0;
91
103
  return (
92
104
  // @ts-ignore
93
- /* @__PURE__ */ l(
94
- v,
105
+ /* @__PURE__ */ r(
106
+ E,
95
107
  {
96
- ...B,
108
+ ...te,
97
109
  ref: f,
98
110
  fluid: !0,
99
- text: J,
111
+ text: se,
100
112
  scrolling: !1,
101
113
  button: !0,
102
114
  icon: "angle down",
103
- multiple: u,
115
+ multiple: m,
104
116
  search: !0,
105
117
  floating: !1,
106
- value: o,
107
- closeOnChange: I,
108
- ...u ? { renderLabel: () => null } : {},
109
- className: `multiple ${Q ? "applied " : ""}`,
110
- children: /* @__PURE__ */ g(v.Menu, { children: [
111
- c != h && /* @__PURE__ */ g(D, { children: [
112
- /* @__PURE__ */ l(Z, { children: /* @__PURE__ */ g(v.Item, { children: [
113
- /* @__PURE__ */ l(K, { basic: !0, onClick: q, children: U }),
118
+ value: s,
119
+ closeOnChange: L,
120
+ ...m ? { renderLabel: () => null } : {},
121
+ className: `multiple ${oe ? "applied " : ""}`,
122
+ children: /* @__PURE__ */ x(E.Menu, { children: [
123
+ c != S && /* @__PURE__ */ x(H, { children: [
124
+ /* @__PURE__ */ r(W, { children: /* @__PURE__ */ x(E.Item, { children: [
125
+ /* @__PURE__ */ r(G, { basic: !0, onClick: le, children: Z }),
114
126
  " ",
115
127
  "|",
116
128
  " ",
117
- /* @__PURE__ */ l(K, { basic: !0, onClick: z, children: j })
129
+ /* @__PURE__ */ r(G, { basic: !0, onClick: re, children: ee })
118
130
  ] }) }),
119
- C && /* @__PURE__ */ g(D, { children: [
120
- /* @__PURE__ */ l(G, { children: /* @__PURE__ */ l(v.Item, { children: /* @__PURE__ */ l("div", { className: "ui action input", children: /* @__PURE__ */ g("div", { className: "ui input", children: [
121
- /* @__PURE__ */ l(
131
+ T && /* @__PURE__ */ x(H, { children: [
132
+ /* @__PURE__ */ r(X, { children: /* @__PURE__ */ r(E.Item, { children: /* @__PURE__ */ r("div", { className: "ui action input", children: /* @__PURE__ */ x("div", { className: "ui input", children: [
133
+ /* @__PURE__ */ r(
122
134
  "input",
123
135
  {
124
136
  className: "filter-search",
125
137
  value: a,
126
138
  placeholder: "Search...",
127
- onChange: (e) => {
128
- e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation(), O(e.target.value);
129
- },
130
- onKeyDown: (e) => {
131
- e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
132
- },
133
- onKeyUp: (e) => {
134
- e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
135
- },
136
- onKeyPress: (e) => {
137
- e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
138
- },
139
- onMouseDown: (e) => {
140
- e.stopPropagation();
141
- },
142
- onClick: (e) => {
143
- e.stopPropagation();
144
- },
145
- onFocus: (e) => {
146
- e.stopPropagation();
147
- },
139
+ onChange: (e) => q(e.target.value),
140
+ onMouseDown: (e) => e.stopPropagation(),
141
+ onClick: (e) => e.stopPropagation(),
148
142
  type: "text",
149
143
  autoComplete: "off"
150
144
  }
151
145
  ),
152
- /* @__PURE__ */ l(
153
- ee,
146
+ /* @__PURE__ */ r(
147
+ ce,
154
148
  {
155
149
  name: "remove",
156
150
  link: !0,
157
151
  className: "clear-icon ignore",
158
- onClick: (e) => {
159
- O("");
160
- }
152
+ onClick: () => q("")
161
153
  }
162
154
  )
163
155
  ] }) }) }) }),
164
- /* @__PURE__ */ l(te, {})
156
+ /* @__PURE__ */ r(ae, {})
165
157
  ] })
166
158
  ] }),
167
- /* @__PURE__ */ l("br", {}),
168
- /* @__PURE__ */ l(G, { className: k ? "dropdown-single-column" : "", children: n == null ? void 0 : n.filter((e) => {
159
+ /* @__PURE__ */ r("br", {}),
160
+ /* @__PURE__ */ r(X, { className: B ? "dropdown-single-column" : "", children: o == null ? void 0 : o.filter((e) => {
169
161
  var t;
170
- return C && a && a.trim().length > 0 && e.text ? (t = e.text) == null ? void 0 : t.toString().toLowerCase().includes(a.toLowerCase()) : !0;
171
- }).map(({ value: e, text: t }, r) => /* @__PURE__ */ g(
172
- v.Item,
162
+ return T && a && a.trim().length > 0 && e.text ? (t = e.text) == null ? void 0 : t.toString().toLowerCase().includes(a.toLowerCase()) : !0;
163
+ }).map(({ value: e, text: t }, n) => /* @__PURE__ */ x(
164
+ E.Item,
173
165
  {
174
- className: k ? "dropdown-item-single-column" : "",
166
+ className: B ? "dropdown-item-single-column" : "",
175
167
  children: [
176
- c === h && /* @__PURE__ */ l(
177
- ne,
168
+ c === S && /* @__PURE__ */ r(
169
+ ue,
178
170
  {
179
- checked: o == e,
180
- onChange: (s) => {
181
- M(s, e);
171
+ checked: (h === !1 && u !== null ? u[0] : s) == e,
172
+ onChange: (l) => {
173
+ Y(l, e);
182
174
  },
183
175
  label: t
184
176
  }
185
177
  ),
186
- c === F && /* @__PURE__ */ l(
187
- re,
178
+ c === j && /* @__PURE__ */ r(
179
+ fe,
188
180
  {
189
- checked: d && d.some(
190
- (s) => E(s) === E(e)
181
+ checked: p && p.some(
182
+ (l) => y(l) === y(e)
191
183
  ),
192
- onChange: () => M(null, e),
184
+ onChange: () => Y(null, e),
193
185
  label: t
194
186
  }
195
187
  )
196
188
  ]
197
189
  },
198
- r
199
- )) })
190
+ n
191
+ )) }),
192
+ h === !1 && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(E.Item, { children: /* @__PURE__ */ r(G, { basic: !0, onClick: () => {
193
+ const e = c === S ? u !== null ? u[0] : s : u !== null ? u : N;
194
+ i && i({}, e), b(null), f.current && f.current.close();
195
+ }, children: "Apply" }) }) })
200
196
  ] })
201
197
  }
202
198
  )
203
199
  );
204
200
  };
205
201
  export {
206
- de as default
202
+ pe as default
207
203
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",