@kingteza/crud-component 1.7.0 → 1.7.2

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.
@@ -10,9 +10,9 @@ import { CrudImportProps } from './import/CrudImportComponent';
10
10
  import { CrudDragableProps, CrudViewableProps } from './view/CrudViewer';
11
11
  import { SelectTagRenderProps } from '../common/select/SelectComponent';
12
12
  import { default as IdProps } from '../types/Id';
13
- import { TextAreaBasedFieldProps } from './CrudTextAreaComponent';
13
+ import { TextAreaBasedFieldProps } from '.';
14
14
  import { SizeType } from 'antd/es/config-provider/SizeContext';
15
- import { Copyable } from 'src/util/CopyUtil';
15
+ import { Copyable } from 'src/util/CopyUtilComponent';
16
16
  export type SelectFieldItem = {
17
17
  key?: string | number;
18
18
  value: string | number;
@@ -1,6 +1,6 @@
1
1
  import { InitialCrudField } from './CrudComponent';
2
2
  import { FormInstance } from 'antd/lib';
3
- import { Copyable } from 'src/util/CopyUtil';
3
+ import { Copyable } from '.';
4
4
  interface InitialTextAreaProps<T> extends InitialCrudField<T> {
5
5
  type: "textarea";
6
6
  onChange?: (value: string, form: FormInstance<T>) => void;
@@ -22,4 +22,5 @@ export { default as CrudActions } from './actions';
22
22
  export type { CrudActionsProps } from './actions';
23
23
  export { default as CrudModal } from './modal';
24
24
  export type { CrudModalProps, CrudModalRef } from './modal';
25
+ export type * from 'src/util';
25
26
  export * from './view';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("@ant-design/icons"),b=require("antd"),B=require("../FileCrudField.cjs.js"),W=require("../ImageCrudField.cjs.js"),C=require("../../util/DateUtil.cjs.js"),v=require("../../util/NumberUtil.cjs.js"),T=require("../../locale/index.cjs.js"),F=require("../../util/CrudUtil.cjs.js"),h=require("../../common/error/ErrorBoundaryComponent.cjs.js"),i=require("../../util/CopyUtil.cjs.js");function q({type:d,render:e,...p}){try{return d==="object"?(o,n,a)=>t.jsx(i.CopyToClipboardButtonWrapper,{copyable:p.copyable,value:o,children:typeof e=="function"?e(o,n,a):""}):d==="select"?(o,n,a)=>{if(!o)return"-";const r=p,c=o||(r.items??[]).find(s=>s[r.innerFieldId??"key"]===n[F.getRealName(p.name,"upsertFieldName")]),u=r.multiple?Array.isArray(c)?c.map(s=>s==null?void 0:s[r.innerFieldLabel??"name"]):void 0:c==null?void 0:c[r.innerFieldLabel??"value"];return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:typeof e=="function"?e(u,n,a):Array.isArray(u)?u.join(", "):u})}:d==="number"?(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:typeof e=="function"?e(o,n,a):r.int?v.default.toInt(o,r.formatted):v.default.toMoney(o)})}:d==="enum"?(o,n,a)=>{var s;if(!o)return"-";const r=p;if(typeof e=="function")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)});if(r.multiple){const f=(Array.isArray(o)?o:o?[o]:[]).map(l=>{var j,m;const y=(j=r.tagRender)==null?void 0:j[l],x=T.tWithOrWithoutNS(((m=r==null?void 0:r.translation)==null?void 0:m[l??""])??l,void 0,l);return{tagProps:y,translatedValue:x,item:l}});if(typeof r.tagRender=="object")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Space,{wrap:!0,children:f.map(({tagProps:l,translatedValue:y,item:x},j)=>l?t.jsx(b.Tag,{color:l.color,children:y},j+x):y)})})});if(r!=null&&r.translation)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:f==null?void 0:f.map(({translatedValue:l,item:y})=>l??y).join(", ")})});{const l=f.map(({translatedValue:y,item:x})=>y??x).join(", ");return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,l),children:l})}}const c=((s=r==null?void 0:r.translation)==null?void 0:s[o??""])??o,u=T.tWithOrWithoutNS(c,void 0,o);if(typeof r.tagRender=="object"){const f=r.tagRender[o];if(f)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:u,children:t.jsx(b.Tag,{color:f.color,children:u})})}return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:u})}:d==="date"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.formatTime?C.formatDateTime(o):C.formatDate(o);return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:c,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):c})})}:d==="checkbox"?(o,n,a)=>typeof e=="function"?e(o,n,a):o?t.jsx(g.CheckOutlined,{}):t.jsx(g.CloseOutlined,{}):d==="image"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(W.ImageCrudCellValue,{value:o,provider:p.provider})}):"-":d==="file"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(B.FileCrudCellValue,{value:o,provider:p.provider})}):"":d==="time"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.format,u=r.use12Hours,s=C.formatTime(o,c||(u?"hh:mm:ss A":void 0));return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:s,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):s})})}:d==="color"?(o,n,a)=>{const r=p;return o?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):typeof o=="string"&&o.startsWith("#")?t.jsx(b.Tooltip,{title:o,children:t.jsx(b.Avatar,{style:{backgroundColor:o}})}):String(o)})}):"-"}:d==="textarea"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.truncated??1,u=typeof o=="string"&&o.split(" ").length<10;return typeof e=="function"?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)}):c?t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Typography.Paragraph,{ellipsis:!u&&{rows:c===!0?1:c,expandable:"collapsible"},copyable:i.copyableFn(r.copyable,o),children:r.rich?t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}}):o})}):r.rich?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}})}):t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:o})}:typeof e=="function"?e:(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:o})}}catch(o){return console.warn("An error occurred while rendering the value for field: "+String(p.name),o),"-"}}exports.getRendererValueCrudViewer=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("@ant-design/icons"),b=require("antd"),B=require("../FileCrudField.cjs.js"),W=require("../ImageCrudField.cjs.js"),C=require("../../util/DateUtil.cjs.js"),v=require("../../util/NumberUtil.cjs.js"),T=require("../../locale/index.cjs.js"),F=require("../../util/CrudUtil.cjs.js"),h=require("../../common/error/ErrorBoundaryComponent.cjs.js"),i=require("../../util/CopyUtilComponent.cjs.js");function q({type:d,render:e,...p}){try{return d==="object"?(o,n,a)=>t.jsx(i.CopyToClipboardButtonWrapper,{copyable:p.copyable,value:o,children:typeof e=="function"?e(o,n,a):""}):d==="select"?(o,n,a)=>{if(!o)return"-";const r=p,c=o||(r.items??[]).find(s=>s[r.innerFieldId??"key"]===n[F.getRealName(p.name,"upsertFieldName")]),u=r.multiple?Array.isArray(c)?c.map(s=>s==null?void 0:s[r.innerFieldLabel??"name"]):void 0:c==null?void 0:c[r.innerFieldLabel??"value"];return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:typeof e=="function"?e(u,n,a):Array.isArray(u)?u.join(", "):u})}:d==="number"?(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:typeof e=="function"?e(o,n,a):r.int?v.default.toInt(o,r.formatted):v.default.toMoney(o)})}:d==="enum"?(o,n,a)=>{var s;if(!o)return"-";const r=p;if(typeof e=="function")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)});if(r.multiple){const f=(Array.isArray(o)?o:o?[o]:[]).map(l=>{var j,m;const y=(j=r.tagRender)==null?void 0:j[l],x=T.tWithOrWithoutNS(((m=r==null?void 0:r.translation)==null?void 0:m[l??""])??l,void 0,l);return{tagProps:y,translatedValue:x,item:l}});if(typeof r.tagRender=="object")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Space,{wrap:!0,children:f.map(({tagProps:l,translatedValue:y,item:x},j)=>l?t.jsx(b.Tag,{color:l.color,children:y},j+x):y)})})});if(r!=null&&r.translation)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:f==null?void 0:f.map(({translatedValue:l,item:y})=>l??y).join(", ")})});{const l=f.map(({translatedValue:y,item:x})=>y??x).join(", ");return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,l),children:l})}}const c=((s=r==null?void 0:r.translation)==null?void 0:s[o??""])??o,u=T.tWithOrWithoutNS(c,void 0,o);if(typeof r.tagRender=="object"){const f=r.tagRender[o];if(f)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:u,children:t.jsx(b.Tag,{color:f.color,children:u})})}return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:u})}:d==="date"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.formatTime?C.formatDateTime(o):C.formatDate(o);return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:c,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):c})})}:d==="checkbox"?(o,n,a)=>typeof e=="function"?e(o,n,a):o?t.jsx(g.CheckOutlined,{}):t.jsx(g.CloseOutlined,{}):d==="image"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(W.ImageCrudCellValue,{value:o,provider:p.provider})}):"-":d==="file"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(B.FileCrudCellValue,{value:o,provider:p.provider})}):"":d==="time"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.format,u=r.use12Hours,s=C.formatTime(o,c||(u?"hh:mm:ss A":void 0));return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:s,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):s})})}:d==="color"?(o,n,a)=>{const r=p;return o?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):typeof o=="string"&&o.startsWith("#")?t.jsx(b.Tooltip,{title:o,children:t.jsx(b.Avatar,{style:{backgroundColor:o}})}):String(o)})}):"-"}:d==="textarea"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.truncated??1,u=typeof o=="string"&&o.split(" ").length<10;return typeof e=="function"?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)}):c?t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Typography.Paragraph,{ellipsis:!u&&{rows:c===!0?1:c,expandable:"collapsible"},copyable:i.copyableFn(r.copyable,o),children:r.rich?t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}}):o})}):r.rich?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}})}):t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:o})}:typeof e=="function"?e:(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:o})}}catch(o){return console.warn("An error occurred while rendering the value for field: "+String(p.name),o),"-"}}exports.getRendererValueCrudViewer=q;
@@ -8,7 +8,7 @@ import j from "../../util/NumberUtil.es.js";
8
8
  import { tWithOrWithoutNS as A } from "../../locale/index.es.js";
9
9
  import k from "../../util/CrudUtil.es.js";
10
10
  import { ErrorBoundaryComponent as b } from "../../common/error/ErrorBoundaryComponent.es.js";
11
- import { CopyToClipboardButtonWrapper as m, copyableFn as h } from "../../util/CopyUtil.es.js";
11
+ import { CopyToClipboardButtonWrapper as m, copyableFn as h } from "../../util/CopyUtilComponent.es.js";
12
12
  function z({
13
13
  type: y,
14
14
  render: n,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./DateUtil.cjs.js"),e=require("./NumberUtil.cjs.js"),i=require("./ImageUtil.cjs.js"),l=require("./ValidationUtil.cjs.js");exports.DateUtil=t;exports.NumberUtil=e.default;exports.ImageUtil=i;exports.ValidationUtil=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./DateUtil.cjs.js"),o=require("./NumberUtil.cjs.js"),i=require("./ImageUtil.cjs.js"),r=require("./ValidationUtil.cjs.js"),t=require("./CopyUtilComponent.cjs.js");exports.DateUtil=e;exports.NumberUtil=o.default;exports.ImageUtil=i;exports.ValidationUtil=r;exports.CopyToClipboardButtonWrapper=t.CopyToClipboardButtonWrapper;exports.copyableFn=t.copyableFn;
@@ -2,3 +2,4 @@ export { default as DateUtil } from './DateUtil';
2
2
  export { default as NumberUtil } from './NumberUtil';
3
3
  export { default as ImageUtil } from './ImageUtil';
4
4
  export { default as ValidationUtil } from './ValidationUtil';
5
+ export { CopyToClipboardButtonWrapper, type CopyProps, type Copyable, copyableFn, } from './CopyUtilComponent';
@@ -1,10 +1,13 @@
1
- import { default as e } from "./DateUtil.es.js";
2
- import { default as o } from "./NumberUtil.es.js";
3
- import { default as f } from "./ImageUtil.es.js";
4
- import { default as m } from "./ValidationUtil.es.js";
1
+ import { default as a } from "./DateUtil.es.js";
2
+ import { default as r } from "./NumberUtil.es.js";
3
+ import { default as p } from "./ImageUtil.es.js";
4
+ import { default as i } from "./ValidationUtil.es.js";
5
+ import { CopyToClipboardButtonWrapper as d, copyableFn as u } from "./CopyUtilComponent.es.js";
5
6
  export {
6
- e as DateUtil,
7
- f as ImageUtil,
8
- o as NumberUtil,
9
- m as ValidationUtil
7
+ d as CopyToClipboardButtonWrapper,
8
+ a as DateUtil,
9
+ p as ImageUtil,
10
+ r as NumberUtil,
11
+ i as ValidationUtil,
12
+ u as copyableFn
10
13
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.7.0",
4
+ "version": "1.7.2",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",