@kingteza/crud-component 1.32.0 → 1.32.1

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.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("antd"),s=require("react"),V=require("../select/SelectComponent.cjs.js"),M=require("../../util/ValidationUtil.cjs.js"),q=({className:b,onSelect:p,label:a,required:d,name:o,mode:u,items:r,selectingMode:j})=>{const n=l.Form.useFormInstance(),[x,k]=s.useState(!0);s.useEffect(()=>{if(r&&x){const e=r.filter(c=>c.alreadySelected).map(c=>c.id);n==null||n.setFieldsValue({[o]:u==="multiple"?e:e==null?void 0:e[0]}),k(!1)}},[x,n,r,u,o]);const[F,h]=s.useState(!1),[C,f]=s.useState(void 0),O=s.useCallback(()=>{h(!1),n.setFieldsValue({[o]:C})},[C,n,o]),g=s.useCallback(()=>{h(!1),f(void 0)},[]),S=s.useCallback(()=>{f(n.getFieldValue(o)),h(!0)},[n,o]),i=j==="checkbox",y=s.useCallback(e=>{i&&e&&S()},[i,S]),I=s.useMemo(()=>{const e=[...r];return e.sort((c,v)=>c.label.localeCompare(v.label)),e},[r]);return t.jsxs(t.Fragment,{children:[i&&t.jsx(l.Modal,{open:F,onCancel:O,onOk:g,destroyOnHidden:!0,title:a,children:t.jsx(l.Form.Item,{name:o,required:d,rules:[...d?M.required(a):[]],className:b,children:t.jsx(l.Checkbox.Group,{onChange:p,style:{width:"100%"},children:t.jsx(l.List,{size:"small",style:{width:"100%"},dataSource:I,renderItem:e=>t.jsx(l.List.Item,{style:{width:"100%"},children:t.jsx(l.List.Item.Meta,{avatar:t.jsx(l.Checkbox,{value:e.id,disabled:e.lock}),title:e.label})},e.id)})})})}),t.jsx(V,{required:d,label:a,mode:u,className:b,name:o,onSelect:p,items:r,showSearch:!1,...i?{open:!1,onOpenChange:y}:{},itemBuilder:e=>t.jsx(l.Select.Option,{value:e.id,disabled:e.lock,children:e.label},e.id)})]})};exports.SelectFieldInReport=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("antd"),l=require("react"),V=require("../select/SelectComponent.cjs.js"),M=require("../../util/ValidationUtil.cjs.js"),q=({className:p,onSelect:x,label:a,required:d,name:o,mode:u,items:r,selectingMode:j})=>{const n=s.Form.useFormInstance(),[b,k]=l.useState(!0);l.useEffect(()=>{if(r&&b){const e=r.filter(c=>c.alreadySelected).map(c=>c.id);n==null||n.setFieldsValue({[o]:u==="multiple"?e:e==null?void 0:e[0]}),k(!1)}},[b,n,r,u,o]);const[F,h]=l.useState(!1),[C,f]=l.useState(void 0),g=l.useCallback(()=>{h(!1),n.setFieldsValue({[o]:C})},[C,n,o]),O=l.useCallback(()=>{h(!1),f(void 0)},[]),S=l.useCallback(()=>{f(n.getFieldValue(o)),h(!0)},[n,o]),i=j==="checkbox",v=l.useCallback(e=>{i&&e&&S()},[i,S]),y=l.useMemo(()=>{const e=[...r];return e.sort((c,I)=>c.label.localeCompare(I.label)),e},[r]);return t.jsxs(t.Fragment,{children:[i&&t.jsx(s.Modal,{open:F,onCancel:g,onOk:O,destroyOnHidden:!0,title:a,children:t.jsx(s.Form.Item,{name:o,required:d,rules:[...d?M.required(a):[]],className:p,children:t.jsx(s.Checkbox.Group,{onChange:x,style:{width:"100%"},children:t.jsx(s.List,{size:"small",style:{width:"100%"},dataSource:y,renderItem:e=>t.jsx(s.List.Item,{style:{width:"100%"},children:t.jsx(s.List.Item.Meta,{avatar:t.jsx(s.Checkbox,{value:e.id,disabled:e.lock}),title:e.label})},e.id)})})})}),t.jsx(V,{required:d,label:a,mode:u,className:p,name:o,onSelect:x,items:r,showSearch:!1,maxTagCount:"responsive",...i?{open:!1,onOpenChange:v}:{},itemBuilder:e=>t.jsx(s.Select.Option,{value:e.id,disabled:e.lock,children:e.label},e.id)})]})};exports.SelectFieldInReport=q;
@@ -1,9 +1,9 @@
1
1
  import { jsxs as j, Fragment as B, jsx as t } from "react/jsx-runtime";
2
- import { Form as S, Modal as z, Checkbox as O, List as p, Select as E } from "antd";
2
+ import { Form as S, Modal as z, Checkbox as x, List as p, Select as E } from "antd";
3
3
  import { useState as f, useEffect as G, useCallback as i, useMemo as H } from "react";
4
4
  import L from "../select/SelectComponent.es.js";
5
5
  import R from "../../util/ValidationUtil.es.js";
6
- const P = ({
6
+ const K = ({
7
7
  className: h,
8
8
  onSelect: C,
9
9
  label: c,
@@ -11,26 +11,26 @@ const P = ({
11
11
  name: o,
12
12
  mode: d,
13
13
  items: r,
14
- selectingMode: x
14
+ selectingMode: O
15
15
  }) => {
16
- const l = S.useFormInstance(), [b, I] = f(!0);
16
+ const l = S.useFormInstance(), [m, g] = f(!0);
17
17
  G(() => {
18
- if (r && b) {
18
+ if (r && m) {
19
19
  const e = r.filter((s) => s.alreadySelected).map((s) => s.id);
20
20
  l == null || l.setFieldsValue({
21
21
  [o]: d === "multiple" ? e : e == null ? void 0 : e[0]
22
- }), I(!1);
22
+ }), g(!1);
23
23
  }
24
- }, [b, l, r, d, o]);
25
- const [V, u] = f(!1), [m, k] = f(void 0), g = i(() => {
24
+ }, [m, l, r, d, o]);
25
+ const [v, u] = f(!1), [b, k] = f(void 0), I = i(() => {
26
26
  u(!1), l.setFieldsValue({
27
- [o]: m
27
+ [o]: b
28
28
  });
29
- }, [m, l, o]), v = i(() => {
29
+ }, [b, l, o]), V = i(() => {
30
30
  u(!1), k(void 0);
31
31
  }, []), F = i(() => {
32
32
  k(l.getFieldValue(o)), u(!0);
33
- }, [l, o]), n = x === "checkbox", y = i(
33
+ }, [l, o]), n = O === "checkbox", y = i(
34
34
  (e) => {
35
35
  n && e && F();
36
36
  },
@@ -43,9 +43,9 @@ const P = ({
43
43
  n && /* @__PURE__ */ t(
44
44
  z,
45
45
  {
46
- open: V,
47
- onCancel: g,
48
- onOk: v,
46
+ open: v,
47
+ onCancel: I,
48
+ onOk: V,
49
49
  destroyOnHidden: !0,
50
50
  title: c,
51
51
  children: /* @__PURE__ */ t(
@@ -55,7 +55,7 @@ const P = ({
55
55
  required: a,
56
56
  rules: [...a ? R.required(c) : []],
57
57
  className: h,
58
- children: /* @__PURE__ */ t(O.Group, { onChange: C, style: { width: "100%" }, children: /* @__PURE__ */ t(
58
+ children: /* @__PURE__ */ t(x.Group, { onChange: C, style: { width: "100%" }, children: /* @__PURE__ */ t(
59
59
  p,
60
60
  {
61
61
  size: "small",
@@ -64,7 +64,7 @@ const P = ({
64
64
  renderItem: (e) => /* @__PURE__ */ t(p.Item, { style: { width: "100%" }, children: /* @__PURE__ */ t(
65
65
  p.Item.Meta,
66
66
  {
67
- avatar: /* @__PURE__ */ t(O, { value: e.id, disabled: e.lock }),
67
+ avatar: /* @__PURE__ */ t(x, { value: e.id, disabled: e.lock }),
68
68
  title: e.label
69
69
  }
70
70
  ) }, e.id)
@@ -85,6 +85,7 @@ const P = ({
85
85
  onSelect: C,
86
86
  items: r,
87
87
  showSearch: !1,
88
+ maxTagCount: "responsive",
88
89
  ...n ? { open: !1, onOpenChange: y } : {},
89
90
  itemBuilder: (e) => /* @__PURE__ */ t(E.Option, { value: e.id, disabled: e.lock, children: e.label }, e.id)
90
91
  }
@@ -92,5 +93,5 @@ const P = ({
92
93
  ] });
93
94
  };
94
95
  export {
95
- P as SelectFieldInReport
96
+ K as SelectFieldInReport
96
97
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.32.0",
4
+ "version": "1.32.1",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",