@kingteza/crud-component 1.0.43 → 1.0.44

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.
package/App.d.ts CHANGED
@@ -1,2 +1,17 @@
1
+ export declare enum PurchaseStatus {
2
+ PENDING = "PENDING",
3
+ COMPLETED = "COMPLETED",
4
+ CANCELLED = "CANCELLED"
5
+ }
6
+ export declare enum TestEnum {
7
+ TEST = "TEST",
8
+ TEST2 = "TEST2",
9
+ TEST3 = "TEST3"
10
+ }
11
+ export type Purchase = {
12
+ status: PurchaseStatus;
13
+ test: TestEnum;
14
+ value: string;
15
+ };
1
16
  declare function App(): import("react/jsx-runtime").JSX.Element;
2
17
  export default App;
@@ -100,13 +100,16 @@ export interface SelectCrudField<T, ItemType extends SelectFieldItem = SelectFie
100
100
  export interface EnumCrudField<T> extends InitialCrudField<T> {
101
101
  type: "enum";
102
102
  placeholder?: string;
103
+ name: keyof T;
103
104
  enum: object | object[];
104
105
  radio?: boolean;
105
106
  translation?: object;
106
107
  multiple?: boolean;
107
- tagRender?: SelectTagRenderProps;
108
- onChange?: (value: any, form: FormInstance<T>) => void;
109
- onSearch?: (keyword: any, form: FormInstance<T>) => void;
108
+ tagRender?: Record<string, {
109
+ color: string;
110
+ }> | SelectTagRenderProps;
111
+ onChange?: (value: T[keyof T], form: FormInstance<T>) => void;
112
+ onSearch?: (keyword: string, form: FormInstance<T>) => void;
110
113
  }
111
114
  export interface ObjectCrudField<T> extends InitialCrudField<T> {
112
115
  type: "object";
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),v=require("antd"),q=require("react"),_=require("react-highlight-words"),W=require("../locale/index.cjs.js"),G=require("./FileCrudField.cjs.js"),$=require("./ImageCrudField.cjs.js"),z=require("../common/check-box/CheckBox.cjs.js"),J=require("../common/date-picker/DatePicker.cjs.js"),K=require("../common/date-picker/TimePicker.cjs.js"),B=require("../common/select/SelectComponent.cjs.js"),Q=require("../common/text-field/NumberField.cjs.js"),X=require("../common/text-field/TextField.cjs.js"),Y=require("../common/text-field/TextArea.cjs.js"),Z=require("../common/tooltip/TooltipComponent.cjs.js");function V(F){const{label:o,name:c,type:p,required:i,hidden:N,rules:m=[],updatable:h=!0,readonly:w=!1,fieldClassName:f,customFormFieldRender:S,fieldTooltip:b,...e}=F,g=v.Form.useFormInstance();q.useEffect(()=>{if(p==="select"){const{items:a=[],onSearch:n,searchOnType:l}=e;!(a!=null&&a.length)&&!l&&(n==null||n(void 0,g,e==null?void 0:e.updatingValue))}},[g,e,p,e==null?void 0:e.updatingValue]);const{t:T}=W.useTranslationLib();if(w||N)return t.jsx(t.Fragment,{});if(S)return S(g,F);switch(p){case"text":case"email":case"password":{const{onChange:a,placeholder:n}=e;return t.jsx(X.default,{placeholder:n,disabled:!h,rules:m,required:i,onChange:a?l=>a(l,g):void 0,type:p,name:c,tooltip:b,label:o,className:f,autoComplete:"new-password"})}case"number":{const{onChange:a,placeholder:n,allowMinus:l}=e;return t.jsx(Q,{placeholder:n,disabled:!h,moneyField:!!e.formatted,type:p,onChange:a?C=>a(C,g):void 0,rules:m,autoComplete:"false",required:i,tooltip:b,className:f,min:l?null:void 0,name:c,label:o})}case"date":{const{range:a,disableToday:n,disabledFutureDays:l,disabledPastDays:C,onChange:x,placeholder:u,format:y}=e;return t.jsx(J,{placeholder:u,required:i,disabled:!h,type:p,format:y,tooltip:b,range:a,name:c,label:o,onChange:x?s=>x(s,g):void 0,className:f,disableToday:n,disabledFutureDays:l,disabledPastDays:C})}case"time":{const{range:a=!1,disableCurrent:n,disabledFuture:l,disabledPast:C,onChange:x,use12Hours:u,format:y,placeholder:s}=e;return t.jsx(K,{placeholder:s,required:i,format:y,disabled:!h,type:p,tooltip:b,range:a,use12Hours:u,name:c,label:o,onChange:x?j=>x(j,g):void 0,className:f,disableCurrent:n,disabledFuture:l,disabledPast:C})}case"textarea":{const{onChange:a,placeholder:n,rows:l,cols:C}=e;return t.jsx(Y.default,{rules:m,placeholder:n,onChange:a?x=>{var u;return a((u=x==null?void 0:x.target)==null?void 0:u.value,g)}:void 0,tooltip:b,required:i,disabled:!h,name:c,label:o,className:f,rows:l,cols:C})}case"image":return t.jsx($.default,{...e,required:i,name:c,label:o,rules:m,fieldClassName:f,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"file":return t.jsx(G.default,{...e,required:i,name:c,label:o,rules:m,fieldClassName:f,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"select":return t.jsx(E,{...e,required:i,name:c,label:o,rules:m,fieldClassName:f,form:g,updatable:h,readonly:w,fieldTooltip:b});case"enum":{const{enum:a,radio:n=!1,translation:l,onChange:C,onSearch:x,multiple:u}=e,y=Array.isArray(a)?a:Object.keys(a);return n?t.jsx(v.Form.Item,{...e,name:c,required:i,tooltip:b,rules:m,label:o,className:["w-100",f].join(" "),children:t.jsx(v.Radio.Group,{...e,onChange:C?s=>{var j;return C((j=s==null?void 0:s.target)==null?void 0:j.value,g)}:void 0,children:y.map(s=>t.jsx(v.Radio,{disabled:!h,value:s,children:l?T(l[s]):s},s))})}):t.jsx(B,{...e,onChange:C?s=>C(s,g):void 0,className:["w-100",f].join(" "),name:c,items:y,required:i,tooltip:b,rules:m,label:o,disabled:!h,onSearch:x?s=>x(s,g):void 0,allowClear:!0,mode:u?"multiple":void 0,itemBuilder:s=>t.jsx(v.Select.Option,{value:s,children:l?T(l[s]):s},s)})}case"checkbox":{const{onChange:a}=e;return t.jsx(z,{className:f,rules:m,onChange:a?n=>a(n,g):void 0,label:o,tooltip:b,disabled:!h,name:c})}case"color":return t.jsx(H,{...e,type:"color",required:i,name:c,label:o,rules:m,fieldClassName:f,updatable:h,readonly:w,fieldTooltip:b});default:return t.jsx(t.Fragment,{children:`${p} Not Implemented`})}}function E(F){const{items:o=[],loading:c,searchOnType:p,onSearch:i,multiple:N,onChange:m,highlightSearch:h,required:w,fieldClassName:f,rules:S,fieldTooltip:b,updatable:e,label:g,name:T,tagRender:a,updatingValue:n,onSet:l,placeholder:C,allowClear:x=!0}=F,u=F.form,[y,s]=q.useState(""),j=v.Form.useWatch(T,u),[k,O]=q.useState(!0);q.useEffect(()=>{l&&k&&j&&(l==null||l(j,o,u),O(!1))},[k,u,o,T,l,j]),q.useEffect(()=>{j&&O(!0)},[j]);const U=q.useCallback(async r=>{s(r),p&&(i==null||i(r,u,n))},[u,i,p,n]);return t.jsx(B,{...F,maxTagCount:"responsive",maxTagPlaceholder:r=>t.jsxs(Z,{title:t.jsx(t.Fragment,{children:r.map(d=>t.jsxs(t.Fragment,{children:[d.label," ",t.jsx("br",{})]}))}),children:["+",r==null?void 0:r.length]}),placeholder:C,onSelect:r=>{l==null||l(r==null?void 0:r.key,o,u)},onChange:m?r=>{s(""),m(r,u)}:void 0,mode:N?"multiple":void 0,className:["w-100",f].join(" "),name:T,items:o,required:w,tooltip:b,tagRender:a,rules:S,disabled:!e,label:g,allowClear:x,onSearch:U,loading:c,filterOption:h?(r,d)=>{var R,P,I;try{const L=r.toLowerCase().split(/\s+/),D=((typeof(d==null?void 0:d.children)=="string"?d==null?void 0:d.children:(P=(R=d==null?void 0:d.children)==null?void 0:R.props)==null?void 0:P.textToHighlight)??"").toLowerCase(),M=(((I=d==null?void 0:d.value)==null?void 0:I.toString())??"").toLowerCase();return L.every(A=>D.indexOf(A)>=0||M.indexOf(A)>=0)}catch{return!0}}:void 0,itemBuilder:h?r=>{const d=r.value?String(r.value):void 0;return t.jsx(v.Select.Option,{value:r.key,title:d,disabled:r.disabled,children:t.jsx(_,{highlightClassName:"highlight-text",searchWords:(y??"").split(" "),autoEscape:!0,textToHighlight:d??""})},r.key)}:r=>t.jsx(v.Select.Option,{value:r.key,title:r.value,disabled:r.disabled,children:r.value},r.key)})}function H(F){const{required:o,fieldClassName:c,rules:p,fieldTooltip:i,updatable:N,label:m,name:h}=F;return t.jsx(v.Form.Item,{label:m,name:h,required:o,rules:p,tooltip:i,children:t.jsx(v.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!N,...F.innerProps})})}exports.ColorCrudFieldComponent=H;exports.SelectCrudFieldComponent=E;exports.default=V;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),v=require("antd"),N=require("react"),_=require("react-highlight-words"),W=require("../locale/index.cjs.js"),G=require("./FileCrudField.cjs.js"),$=require("./ImageCrudField.cjs.js"),z=require("../common/check-box/CheckBox.cjs.js"),J=require("../common/date-picker/DatePicker.cjs.js"),K=require("../common/date-picker/TimePicker.cjs.js"),E=require("../common/select/SelectComponent.cjs.js"),Q=require("../common/text-field/NumberField.cjs.js"),X=require("../common/text-field/TextField.cjs.js"),Y=require("../common/text-field/TextArea.cjs.js"),Z=require("../common/tooltip/TooltipComponent.cjs.js");function V(y){const{label:s,name:u,type:p,required:i,hidden:w,rules:m=[],updatable:h=!0,readonly:S=!1,fieldClassName:f,customFormFieldRender:R,fieldTooltip:b,...t}=y,g=v.Form.useFormInstance();N.useEffect(()=>{if(p==="select"){const{items:l=[],onSearch:o,searchOnType:n}=t;!(l!=null&&l.length)&&!n&&(o==null||o(void 0,g,t==null?void 0:t.updatingValue))}},[g,t,p,t==null?void 0:t.updatingValue]);const{t:q}=W.useTranslationLib();if(S||w)return e.jsx(e.Fragment,{});if(R)return R(g,y);switch(p){case"text":case"email":case"password":{const{onChange:l,placeholder:o}=t;return e.jsx(X.default,{placeholder:o,disabled:!h,rules:m,required:i,onChange:l?n=>l(n,g):void 0,type:p,name:u,tooltip:b,label:s,className:f,autoComplete:"new-password"})}case"number":{const{onChange:l,placeholder:o,allowMinus:n}=t;return e.jsx(Q,{placeholder:o,disabled:!h,moneyField:!!t.formatted,type:p,onChange:l?x=>l(x,g):void 0,rules:m,autoComplete:"false",required:i,tooltip:b,className:f,min:n?null:void 0,name:u,label:s})}case"date":{const{range:l,disableToday:o,disabledFutureDays:n,disabledPastDays:x,onChange:C,placeholder:d,format:j}=t;return e.jsx(J,{placeholder:d,required:i,disabled:!h,type:p,format:j,tooltip:b,range:l,name:u,label:s,onChange:C?F=>C(F,g):void 0,className:f,disableToday:o,disabledFutureDays:n,disabledPastDays:x})}case"time":{const{range:l=!1,disableCurrent:o,disabledFuture:n,disabledPast:x,onChange:C,use12Hours:d,format:j,placeholder:F}=t;return e.jsx(K,{placeholder:F,required:i,format:j,disabled:!h,type:p,tooltip:b,range:l,use12Hours:d,name:u,label:s,onChange:C?r=>C(r,g):void 0,className:f,disableCurrent:o,disabledFuture:n,disabledPast:x})}case"textarea":{const{onChange:l,placeholder:o,rows:n,cols:x}=t;return e.jsx(Y.default,{rules:m,placeholder:o,onChange:l?C=>{var d;return l((d=C==null?void 0:C.target)==null?void 0:d.value,g)}:void 0,tooltip:b,required:i,disabled:!h,name:u,label:s,className:f,rows:n,cols:x})}case"image":return e.jsx($.default,{...t,required:i,name:u,label:s,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"file":return e.jsx(G.default,{...t,required:i,name:u,label:s,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"select":return e.jsx(H,{...t,required:i,name:u,label:s,rules:m,fieldClassName:f,form:g,updatable:h,readonly:S,fieldTooltip:b});case"enum":{const{enum:l,radio:o=!1,translation:n,onChange:x,onSearch:C,multiple:d,tagRender:j}=t,F=Array.isArray(l)?l:Object.keys(l);return o?e.jsx(v.Form.Item,{...t,name:u,required:i,tooltip:b,rules:m,label:s,className:["w-100",f].join(" "),children:e.jsx(v.Radio.Group,{...t,onChange:x?r=>{var T;return x((T=r==null?void 0:r.target)==null?void 0:T.value,g)}:void 0,children:F.map(r=>e.jsx(v.Radio,{disabled:!h,value:r,children:n?q(n[r]):r},r))})}):e.jsx(E,{...t,tagRender:typeof j=="function"?j:j?r=>{const{value:T,label:k}=r,O=j[T];return O?e.jsx(v.Tag,{color:O.color,children:k}):e.jsx(v.Tag,{children:k})}:void 0,onChange:x?r=>x(r,g):void 0,className:["w-100",f].join(" "),name:u,items:F,required:i,tooltip:b,rules:m,label:s,disabled:!h,onSearch:C?r=>C(r,g):void 0,allowClear:!0,maxCount:d?void 0:1,mode:d?"multiple":typeof j=="function"||typeof j=="object"?"tags":void 0,itemBuilder:r=>e.jsx(v.Select.Option,{value:r,children:n?q(n[r]):r},r)})}case"checkbox":{const{onChange:l}=t;return e.jsx(z,{className:f,rules:m,onChange:l?o=>l(o,g):void 0,label:s,tooltip:b,disabled:!h,name:u})}case"color":return e.jsx(U,{...t,type:"color",required:i,name:u,label:s,rules:m,fieldClassName:f,updatable:h,readonly:S,fieldTooltip:b});default:return e.jsx(e.Fragment,{children:`${p} Not Implemented`})}}function H(y){const{items:s=[],loading:u,searchOnType:p,onSearch:i,multiple:w,onChange:m,highlightSearch:h,required:S,fieldClassName:f,rules:R,fieldTooltip:b,updatable:t,label:g,name:q,tagRender:l,updatingValue:o,onSet:n,placeholder:x,allowClear:C=!0}=y,d=y.form,[j,F]=N.useState(""),r=v.Form.useWatch(q,d),[T,k]=N.useState(!0);N.useEffect(()=>{n&&T&&r&&(n==null||n(r,s,d),k(!1))},[T,d,s,q,n,r]),N.useEffect(()=>{r&&k(!0)},[r]);const O=N.useCallback(async a=>{F(a),p&&(i==null||i(a,d,o))},[d,i,p,o]);return e.jsx(E,{...y,maxTagCount:"responsive",maxTagPlaceholder:a=>e.jsxs(Z,{title:e.jsx(e.Fragment,{children:a.map(c=>e.jsxs(e.Fragment,{children:[c.label," ",e.jsx("br",{})]}))}),children:["+",a==null?void 0:a.length]}),placeholder:x,onSelect:a=>{n==null||n(a==null?void 0:a.key,s,d)},onChange:m?a=>{F(""),m(a,d)}:void 0,mode:w?"multiple":void 0,className:["w-100",f].join(" "),name:q,items:s,required:S,tooltip:b,tagRender:l,rules:R,disabled:!t,label:g,allowClear:C,onSearch:O,loading:u,filterOption:h?(a,c)=>{var P,I,L;try{const A=a.toLowerCase().split(/\s+/),D=((typeof(c==null?void 0:c.children)=="string"?c==null?void 0:c.children:(I=(P=c==null?void 0:c.children)==null?void 0:P.props)==null?void 0:I.textToHighlight)??"").toLowerCase(),M=(((L=c==null?void 0:c.value)==null?void 0:L.toString())??"").toLowerCase();return A.every(B=>D.indexOf(B)>=0||M.indexOf(B)>=0)}catch{return!0}}:void 0,itemBuilder:h?a=>{const c=a.value?String(a.value):void 0;return e.jsx(v.Select.Option,{value:a.key,title:c,disabled:a.disabled,children:e.jsx(_,{highlightClassName:"highlight-text",searchWords:(j??"").split(" "),autoEscape:!0,textToHighlight:c??""})},a.key)}:a=>e.jsx(v.Select.Option,{value:a.key,title:a.value,disabled:a.disabled,children:a.value},a.key)})}function U(y){const{required:s,fieldClassName:u,rules:p,fieldTooltip:i,updatable:w,label:m,name:h}=y;return e.jsx(v.Form.Item,{label:m,name:h,required:s,rules:p,tooltip:i,children:e.jsx(v.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:u,disabled:!w,...y.innerProps})})}exports.ColorCrudFieldComponent=U;exports.SelectCrudFieldComponent=H;exports.default=V;
@@ -1,450 +1,456 @@
1
- import { jsx as a, Fragment as O, jsxs as q } from "react/jsx-runtime";
2
- import { Form as P, Radio as D, Select as R, ColorPicker as $ } from "antd";
3
- import { useEffect as S, useState as E, useCallback as z } from "react";
4
- import J from "react-highlight-words";
5
- import { useTranslationLib as K } from "../locale/index.es.js";
6
- import Q from "./FileCrudField.es.js";
7
- import X from "./ImageCrudField.es.js";
8
- import Y from "../common/check-box/CheckBox.es.js";
9
- import Z from "../common/date-picker/DatePicker.es.js";
10
- import V from "../common/date-picker/TimePicker.es.js";
11
- import W from "../common/select/SelectComponent.es.js";
12
- import ee from "../common/text-field/NumberField.es.js";
13
- import te from "../common/text-field/TextField.es.js";
1
+ import { jsx as r, Fragment as j, jsxs as D } from "react/jsx-runtime";
2
+ import { Form as S, Radio as E, Tag as W, Select as I, ColorPicker as z } from "antd";
3
+ import { useEffect as L, useState as G, useCallback as J } from "react";
4
+ import K from "react-highlight-words";
5
+ import { useTranslationLib as Q } from "../locale/index.es.js";
6
+ import X from "./FileCrudField.es.js";
7
+ import Y from "./ImageCrudField.es.js";
8
+ import Z from "../common/check-box/CheckBox.es.js";
9
+ import V from "../common/date-picker/DatePicker.es.js";
10
+ import ee from "../common/date-picker/TimePicker.es.js";
11
+ import M from "../common/select/SelectComponent.es.js";
12
+ import te from "../common/text-field/NumberField.es.js";
13
+ import oe from "../common/text-field/TextField.es.js";
14
14
  import re from "../common/text-field/TextArea.es.js";
15
- import oe from "../common/tooltip/TooltipComponent.es.js";
16
- function xe(x) {
15
+ import ae from "../common/tooltip/TooltipComponent.es.js";
16
+ function Te(x) {
17
17
  const {
18
18
  label: i,
19
- name: c,
19
+ name: m,
20
20
  type: b,
21
21
  required: s,
22
- hidden: N,
22
+ hidden: w,
23
23
  rules: u = [],
24
24
  updatable: h = !0,
25
- readonly: w = !1,
26
- fieldClassName: g,
27
- customFormFieldRender: k,
25
+ readonly: k = !1,
26
+ fieldClassName: f,
27
+ customFormFieldRender: R,
28
28
  fieldTooltip: v,
29
29
  ...e
30
- } = x, p = P.useFormInstance();
31
- S(() => {
30
+ } = x, p = S.useFormInstance();
31
+ L(() => {
32
32
  if (b === "select") {
33
33
  const {
34
- items: r = [],
34
+ items: a = [],
35
35
  onSearch: n,
36
- searchOnType: o
36
+ searchOnType: l
37
37
  } = e;
38
- !(r != null && r.length) && !o && (n == null || n(void 0, p, e == null ? void 0 : e.updatingValue));
38
+ !(a != null && a.length) && !l && (n == null || n(void 0, p, e == null ? void 0 : e.updatingValue));
39
39
  }
40
40
  }, [p, e, b, e == null ? void 0 : e.updatingValue]);
41
- const { t: F } = K();
42
- if (w || N) return /* @__PURE__ */ a(O, {});
43
- if (k)
44
- return k(p, x);
41
+ const { t: N } = Q();
42
+ if (k || w) return /* @__PURE__ */ r(j, {});
43
+ if (R)
44
+ return R(p, x);
45
45
  switch (b) {
46
46
  case "text":
47
47
  case "email":
48
48
  case "password": {
49
- const { onChange: r, placeholder: n } = e;
50
- return /* @__PURE__ */ a(
51
- te,
49
+ const { onChange: a, placeholder: n } = e;
50
+ return /* @__PURE__ */ r(
51
+ oe,
52
52
  {
53
53
  placeholder: n,
54
54
  disabled: !h,
55
55
  rules: u,
56
56
  required: s,
57
- onChange: r ? (o) => r(o, p) : void 0,
57
+ onChange: a ? (l) => a(l, p) : void 0,
58
58
  type: b,
59
- name: c,
59
+ name: m,
60
60
  tooltip: v,
61
61
  label: i,
62
- className: g,
62
+ className: f,
63
63
  autoComplete: "new-password"
64
64
  }
65
65
  );
66
66
  }
67
67
  case "number": {
68
- const { onChange: r, placeholder: n, allowMinus: o } = e;
69
- return /* @__PURE__ */ a(
70
- ee,
68
+ const { onChange: a, placeholder: n, allowMinus: l } = e;
69
+ return /* @__PURE__ */ r(
70
+ te,
71
71
  {
72
72
  placeholder: n,
73
73
  disabled: !h,
74
74
  moneyField: !!e.formatted,
75
75
  type: b,
76
- onChange: r ? (f) => r(f, p) : void 0,
76
+ onChange: a ? (g) => a(g, p) : void 0,
77
77
  rules: u,
78
78
  autoComplete: "false",
79
79
  required: s,
80
80
  tooltip: v,
81
- className: g,
82
- min: o ? null : void 0,
83
- name: c,
81
+ className: f,
82
+ min: l ? null : void 0,
83
+ name: m,
84
84
  label: i
85
85
  }
86
86
  );
87
87
  }
88
88
  case "date": {
89
89
  const {
90
- range: r,
90
+ range: a,
91
91
  disableToday: n,
92
- disabledFutureDays: o,
93
- disabledPastDays: f,
92
+ disabledFutureDays: l,
93
+ disabledPastDays: g,
94
94
  onChange: C,
95
- placeholder: m,
96
- format: T
95
+ placeholder: d,
96
+ format: y
97
97
  } = e;
98
- return /* @__PURE__ */ a(
99
- Z,
98
+ return /* @__PURE__ */ r(
99
+ V,
100
100
  {
101
- placeholder: m,
101
+ placeholder: d,
102
102
  required: s,
103
103
  disabled: !h,
104
104
  type: b,
105
- format: T,
105
+ format: y,
106
106
  tooltip: v,
107
- range: r,
108
- name: c,
107
+ range: a,
108
+ name: m,
109
109
  label: i,
110
- onChange: C ? (l) => C(l, p) : void 0,
111
- className: g,
110
+ onChange: C ? (T) => C(T, p) : void 0,
111
+ className: f,
112
112
  disableToday: n,
113
- disabledFutureDays: o,
114
- disabledPastDays: f
113
+ disabledFutureDays: l,
114
+ disabledPastDays: g
115
115
  }
116
116
  );
117
117
  }
118
118
  case "time": {
119
119
  const {
120
- range: r = !1,
120
+ range: a = !1,
121
121
  disableCurrent: n,
122
- disabledFuture: o,
123
- disabledPast: f,
122
+ disabledFuture: l,
123
+ disabledPast: g,
124
124
  onChange: C,
125
- use12Hours: m,
126
- format: T,
127
- placeholder: l
125
+ use12Hours: d,
126
+ format: y,
127
+ placeholder: T
128
128
  } = e;
129
- return /* @__PURE__ */ a(
130
- V,
129
+ return /* @__PURE__ */ r(
130
+ ee,
131
131
  {
132
- placeholder: l,
132
+ placeholder: T,
133
133
  required: s,
134
- format: T,
134
+ format: y,
135
135
  disabled: !h,
136
136
  type: b,
137
137
  tooltip: v,
138
- range: r,
139
- use12Hours: m,
140
- name: c,
138
+ range: a,
139
+ use12Hours: d,
140
+ name: m,
141
141
  label: i,
142
- onChange: C ? (y) => C(y, p) : void 0,
143
- className: g,
142
+ onChange: C ? (t) => C(t, p) : void 0,
143
+ className: f,
144
144
  disableCurrent: n,
145
- disabledFuture: o,
146
- disabledPast: f
145
+ disabledFuture: l,
146
+ disabledPast: g
147
147
  }
148
148
  );
149
149
  }
150
150
  case "textarea": {
151
- const { onChange: r, placeholder: n, rows: o, cols: f } = e;
152
- return /* @__PURE__ */ a(
151
+ const { onChange: a, placeholder: n, rows: l, cols: g } = e;
152
+ return /* @__PURE__ */ r(
153
153
  re,
154
154
  {
155
155
  rules: u,
156
156
  placeholder: n,
157
- onChange: r ? (C) => {
158
- var m;
159
- return r((m = C == null ? void 0 : C.target) == null ? void 0 : m.value, p);
157
+ onChange: a ? (C) => {
158
+ var d;
159
+ return a((d = C == null ? void 0 : C.target) == null ? void 0 : d.value, p);
160
160
  } : void 0,
161
161
  tooltip: v,
162
162
  required: s,
163
163
  disabled: !h,
164
- name: c,
164
+ name: m,
165
165
  label: i,
166
- className: g,
167
- rows: o,
168
- cols: f
166
+ className: f,
167
+ rows: l,
168
+ cols: g
169
169
  }
170
170
  );
171
171
  }
172
172
  case "image":
173
- return /* @__PURE__ */ a(
174
- X,
173
+ return /* @__PURE__ */ r(
174
+ Y,
175
175
  {
176
176
  ...e,
177
177
  required: s,
178
- name: c,
178
+ name: m,
179
179
  label: i,
180
180
  rules: u,
181
- fieldClassName: g,
181
+ fieldClassName: f,
182
182
  onRemoved: e.onRemoved,
183
183
  onUploading: e.onUploading,
184
184
  provider: e.provider
185
185
  }
186
186
  );
187
187
  case "file":
188
- return /* @__PURE__ */ a(
189
- Q,
188
+ return /* @__PURE__ */ r(
189
+ X,
190
190
  {
191
191
  ...e,
192
192
  required: s,
193
- name: c,
193
+ name: m,
194
194
  label: i,
195
195
  rules: u,
196
- fieldClassName: g,
196
+ fieldClassName: f,
197
197
  onRemoved: e.onRemoved,
198
198
  onUploading: e.onUploading,
199
199
  provider: e.provider
200
200
  }
201
201
  );
202
202
  case "select":
203
- return /* @__PURE__ */ a(
204
- ae,
203
+ return /* @__PURE__ */ r(
204
+ le,
205
205
  {
206
206
  ...e,
207
207
  required: s,
208
- name: c,
208
+ name: m,
209
209
  label: i,
210
210
  rules: u,
211
- fieldClassName: g,
211
+ fieldClassName: f,
212
212
  form: p,
213
213
  updatable: h,
214
- readonly: w,
214
+ readonly: k,
215
215
  fieldTooltip: v
216
216
  }
217
217
  );
218
218
  case "enum": {
219
219
  const {
220
- enum: r,
220
+ enum: a,
221
221
  radio: n = !1,
222
- translation: o,
223
- onChange: f,
222
+ translation: l,
223
+ onChange: g,
224
224
  onSearch: C,
225
- multiple: m
226
- } = e, T = Array.isArray(r) ? r : Object.keys(r);
227
- return n ? /* @__PURE__ */ a(
228
- P.Item,
225
+ multiple: d,
226
+ tagRender: y
227
+ } = e, T = Array.isArray(a) ? a : Object.keys(a);
228
+ return n ? /* @__PURE__ */ r(
229
+ S.Item,
229
230
  {
230
231
  ...e,
231
- name: c,
232
+ name: m,
232
233
  required: s,
233
234
  tooltip: v,
234
235
  rules: u,
235
236
  label: i,
236
- className: ["w-100", g].join(" "),
237
- children: /* @__PURE__ */ a(
238
- D.Group,
237
+ className: ["w-100", f].join(" "),
238
+ children: /* @__PURE__ */ r(
239
+ E.Group,
239
240
  {
240
241
  ...e,
241
- onChange: f ? (l) => {
242
- var y;
243
- return f((y = l == null ? void 0 : l.target) == null ? void 0 : y.value, p);
242
+ onChange: g ? (t) => {
243
+ var F;
244
+ return g((F = t == null ? void 0 : t.target) == null ? void 0 : F.value, p);
244
245
  } : void 0,
245
- children: T.map((l) => /* @__PURE__ */ a(D, { disabled: !h, value: l, children: o ? F(o[l]) : l }, l))
246
+ children: T.map((t) => /* @__PURE__ */ r(E, { disabled: !h, value: t, children: l ? N(l[t]) : t }, t))
246
247
  }
247
248
  )
248
249
  }
249
- ) : /* @__PURE__ */ a(
250
- W,
250
+ ) : /* @__PURE__ */ r(
251
+ M,
251
252
  {
252
253
  ...e,
253
- onChange: f ? (l) => f(l, p) : void 0,
254
- className: ["w-100", g].join(" "),
255
- name: c,
254
+ tagRender: typeof y == "function" ? y : y ? (t) => {
255
+ const { value: F, label: O } = t, P = y[F];
256
+ return P ? /* @__PURE__ */ r(W, { color: P.color, children: O }) : /* @__PURE__ */ r(W, { children: O });
257
+ } : void 0,
258
+ onChange: g ? (t) => g(t, p) : void 0,
259
+ className: ["w-100", f].join(" "),
260
+ name: m,
256
261
  items: T,
257
262
  required: s,
258
263
  tooltip: v,
259
264
  rules: u,
260
265
  label: i,
261
266
  disabled: !h,
262
- onSearch: C ? (l) => C(l, p) : void 0,
267
+ onSearch: C ? (t) => C(t, p) : void 0,
263
268
  allowClear: !0,
264
- mode: m ? "multiple" : void 0,
265
- itemBuilder: (l) => /* @__PURE__ */ a(R.Option, { value: l, children: o ? F(o[l]) : l }, l)
269
+ maxCount: d ? void 0 : 1,
270
+ mode: d ? "multiple" : typeof y == "function" || typeof y == "object" ? "tags" : void 0,
271
+ itemBuilder: (t) => /* @__PURE__ */ r(I.Option, { value: t, children: l ? N(l[t]) : t }, t)
266
272
  }
267
273
  );
268
274
  }
269
275
  case "checkbox": {
270
- const { onChange: r } = e;
271
- return /* @__PURE__ */ a(
272
- Y,
276
+ const { onChange: a } = e;
277
+ return /* @__PURE__ */ r(
278
+ Z,
273
279
  {
274
- className: g,
280
+ className: f,
275
281
  rules: u,
276
- onChange: r ? (n) => r(n, p) : void 0,
282
+ onChange: a ? (n) => a(n, p) : void 0,
277
283
  label: i,
278
284
  tooltip: v,
279
285
  disabled: !h,
280
- name: c
286
+ name: m
281
287
  }
282
288
  );
283
289
  }
284
290
  case "color":
285
- return /* @__PURE__ */ a(
286
- le,
291
+ return /* @__PURE__ */ r(
292
+ ne,
287
293
  {
288
294
  ...e,
289
295
  type: "color",
290
296
  required: s,
291
- name: c,
297
+ name: m,
292
298
  label: i,
293
299
  rules: u,
294
- fieldClassName: g,
300
+ fieldClassName: f,
295
301
  updatable: h,
296
- readonly: w,
302
+ readonly: k,
297
303
  fieldTooltip: v
298
304
  }
299
305
  );
300
306
  default:
301
- return /* @__PURE__ */ a(O, { children: `${b} Not Implemented` });
307
+ return /* @__PURE__ */ r(j, { children: `${b} Not Implemented` });
302
308
  }
303
309
  }
304
- function ae(x) {
310
+ function le(x) {
305
311
  const {
306
312
  items: i = [],
307
- loading: c,
313
+ loading: m,
308
314
  searchOnType: b,
309
315
  onSearch: s,
310
- multiple: N,
316
+ multiple: w,
311
317
  onChange: u,
312
318
  highlightSearch: h,
313
- required: w,
314
- fieldClassName: g,
315
- rules: k,
319
+ required: k,
320
+ fieldClassName: f,
321
+ rules: R,
316
322
  fieldTooltip: v,
317
323
  updatable: e,
318
324
  label: p,
319
- name: F,
320
- tagRender: r,
325
+ name: N,
326
+ tagRender: a,
321
327
  updatingValue: n,
322
- onSet: o,
323
- placeholder: f,
328
+ onSet: l,
329
+ placeholder: g,
324
330
  allowClear: C = !0
325
- } = x, m = x.form, [T, l] = E(""), y = P.useWatch(F, m), [j, I] = E(!0);
326
- S(() => {
327
- o && j && y && (o == null || o(y, i, m), I(!1));
328
- }, [j, m, i, F, o, y]), S(() => {
329
- y && I(!0);
330
- }, [y]);
331
- const G = z(
332
- async (t) => {
333
- l(t), b && (s == null || s(t, m, n));
331
+ } = x, d = x.form, [y, T] = G(""), t = S.useWatch(N, d), [F, O] = G(!0);
332
+ L(() => {
333
+ l && F && t && (l == null || l(t, i, d), O(!1));
334
+ }, [F, d, i, N, l, t]), L(() => {
335
+ t && O(!0);
336
+ }, [t]);
337
+ const P = J(
338
+ async (o) => {
339
+ T(o), b && (s == null || s(o, d, n));
334
340
  },
335
- [m, s, b, n]
341
+ [d, s, b, n]
336
342
  );
337
- return /* @__PURE__ */ a(
338
- W,
343
+ return /* @__PURE__ */ r(
344
+ M,
339
345
  {
340
346
  ...x,
341
347
  maxTagCount: "responsive",
342
- maxTagPlaceholder: (t) => /* @__PURE__ */ q(
343
- oe,
348
+ maxTagPlaceholder: (o) => /* @__PURE__ */ D(
349
+ ae,
344
350
  {
345
- title: /* @__PURE__ */ a(O, { children: t.map((d) => /* @__PURE__ */ q(O, { children: [
346
- d.label,
351
+ title: /* @__PURE__ */ r(j, { children: o.map((c) => /* @__PURE__ */ D(j, { children: [
352
+ c.label,
347
353
  " ",
348
- /* @__PURE__ */ a("br", {})
354
+ /* @__PURE__ */ r("br", {})
349
355
  ] })) }),
350
356
  children: [
351
357
  "+",
352
- t == null ? void 0 : t.length
358
+ o == null ? void 0 : o.length
353
359
  ]
354
360
  }
355
361
  ),
356
- placeholder: f,
357
- onSelect: (t) => {
358
- o == null || o(t == null ? void 0 : t.key, i, m);
362
+ placeholder: g,
363
+ onSelect: (o) => {
364
+ l == null || l(o == null ? void 0 : o.key, i, d);
359
365
  },
360
- onChange: u ? (t) => {
361
- l(""), u(t, m);
366
+ onChange: u ? (o) => {
367
+ T(""), u(o, d);
362
368
  } : void 0,
363
- mode: N ? "multiple" : void 0,
364
- className: ["w-100", g].join(" "),
365
- name: F,
369
+ mode: w ? "multiple" : void 0,
370
+ className: ["w-100", f].join(" "),
371
+ name: N,
366
372
  items: i,
367
- required: w,
373
+ required: k,
368
374
  tooltip: v,
369
- tagRender: r,
370
- rules: k,
375
+ tagRender: a,
376
+ rules: R,
371
377
  disabled: !e,
372
378
  label: p,
373
379
  allowClear: C,
374
- onSearch: G,
375
- loading: c,
376
- filterOption: h ? (t, d) => {
377
- var L, A, B;
380
+ onSearch: P,
381
+ loading: m,
382
+ filterOption: h ? (o, c) => {
383
+ var A, B, H;
378
384
  try {
379
- const H = t.toLowerCase().split(/\s+/), M = ((typeof (d == null ? void 0 : d.children) == "string" ? d == null ? void 0 : d.children : (A = (L = d == null ? void 0 : d.children) == null ? void 0 : L.props) == null ? void 0 : A.textToHighlight) ?? "").toLowerCase(), _ = (((B = d == null ? void 0 : d.value) == null ? void 0 : B.toString()) ?? "").toLowerCase();
380
- return H.every(
381
- (U) => M.indexOf(U) >= 0 || _.indexOf(U) >= 0
385
+ const U = o.toLowerCase().split(/\s+/), _ = ((typeof (c == null ? void 0 : c.children) == "string" ? c == null ? void 0 : c.children : (B = (A = c == null ? void 0 : c.children) == null ? void 0 : A.props) == null ? void 0 : B.textToHighlight) ?? "").toLowerCase(), $ = (((H = c == null ? void 0 : c.value) == null ? void 0 : H.toString()) ?? "").toLowerCase();
386
+ return U.every(
387
+ (q) => _.indexOf(q) >= 0 || $.indexOf(q) >= 0
382
388
  );
383
389
  } catch {
384
390
  return !0;
385
391
  }
386
392
  } : void 0,
387
- itemBuilder: h ? (t) => {
388
- const d = t.value ? String(t.value) : void 0;
389
- return /* @__PURE__ */ a(
390
- R.Option,
393
+ itemBuilder: h ? (o) => {
394
+ const c = o.value ? String(o.value) : void 0;
395
+ return /* @__PURE__ */ r(
396
+ I.Option,
391
397
  {
392
- value: t.key,
393
- title: d,
394
- disabled: t.disabled,
395
- children: /* @__PURE__ */ a(
396
- J,
398
+ value: o.key,
399
+ title: c,
400
+ disabled: o.disabled,
401
+ children: /* @__PURE__ */ r(
402
+ K,
397
403
  {
398
404
  highlightClassName: "highlight-text",
399
- searchWords: (T ?? "").split(" "),
405
+ searchWords: (y ?? "").split(" "),
400
406
  autoEscape: !0,
401
- textToHighlight: d ?? ""
407
+ textToHighlight: c ?? ""
402
408
  }
403
409
  )
404
410
  },
405
- t.key
411
+ o.key
406
412
  );
407
- } : (t) => /* @__PURE__ */ a(
408
- R.Option,
413
+ } : (o) => /* @__PURE__ */ r(
414
+ I.Option,
409
415
  {
410
- value: t.key,
411
- title: t.value,
412
- disabled: t.disabled,
413
- children: t.value
416
+ value: o.key,
417
+ title: o.value,
418
+ disabled: o.disabled,
419
+ children: o.value
414
420
  },
415
- t.key
421
+ o.key
416
422
  )
417
423
  }
418
424
  );
419
425
  }
420
- function le(x) {
426
+ function ne(x) {
421
427
  const {
422
428
  required: i,
423
- fieldClassName: c,
429
+ fieldClassName: m,
424
430
  rules: b,
425
431
  fieldTooltip: s,
426
- updatable: N,
432
+ updatable: w,
427
433
  label: u,
428
434
  name: h
429
435
  } = x;
430
- return /* @__PURE__ */ a(
431
- P.Item,
436
+ return /* @__PURE__ */ r(
437
+ S.Item,
432
438
  {
433
439
  label: u,
434
440
  name: h,
435
441
  required: i,
436
442
  rules: b,
437
443
  tooltip: s,
438
- children: /* @__PURE__ */ a(
439
- $,
444
+ children: /* @__PURE__ */ r(
445
+ z,
440
446
  {
441
447
  disabledAlpha: !0,
442
448
  format: "hex",
443
449
  defaultFormat: "hex",
444
450
  showText: !0,
445
451
  trigger: "click",
446
- className: c,
447
- disabled: !N,
452
+ className: m,
453
+ disabled: !w,
448
454
  ...x.innerProps
449
455
  }
450
456
  )
@@ -452,7 +458,7 @@ function le(x) {
452
458
  );
453
459
  }
454
460
  export {
455
- le as ColorCrudFieldComponent,
456
- ae as SelectCrudFieldComponent,
457
- xe as default
461
+ ne as ColorCrudFieldComponent,
462
+ le as SelectCrudFieldComponent,
463
+ Te as default
458
464
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),r=require("@ant-design/icons"),v=require("antd"),y=require("../../common/show-more/index.cjs.js"),d=require("../FileCrudField.cjs.js"),g=require("../ImageCrudField.cjs.js"),m=require("../../util/DateUtil.cjs.js"),s=require("../../util/NumberUtil.cjs.js"),x=require("../../locale/index.cjs.js");function j({type:a,render:i,...u}){return a==="object"?(t,n,o)=>typeof i=="function"?i(t,n,o):"":a==="select"?(t,n,o)=>{const e=u;let c=e.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[e.innerFieldLabel??"name"]):void 0:t==null?void 0:t[e.innerFieldLabel??"name"];return(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,n,o):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,n,o)=>typeof i=="function"?i(t,n,o):u!=null&&u.int?s.default.toInt(t,u.formatted):s.default.toMoney(t):a==="enum"?(t,n,o)=>{var c;const e=x.t(((c=u==null?void 0:u.translation)==null?void 0:c[t??""])??t);return typeof i=="function"?i(t,n,o):e}:a==="date"?(t,n,o)=>{if(!t)return"-";const e=u!=null&&u.formatTime?m.formatDateTime(t):m.formatDate(t);return typeof i=="function"?i(t,n,o):e}:a==="checkbox"?(t,n,o)=>typeof i=="function"?i(t,n,o):t?l.jsx(r.CheckOutlined,{}):l.jsx(r.CloseOutlined,{}):a==="image"?(t,n,o)=>typeof i=="function"?i(t,n,o):l.jsx(g.ImageCrudCellValue,{value:t,provider:u.provider}):a==="file"?(t,n,o)=>typeof i=="function"?i(t,n,o):l.jsx(d.FileCrudCellValue,{value:t,provider:u.provider}):a==="time"?(t,n,o)=>{if(!t)return"-";const e=u==null?void 0:u.format,c=u==null?void 0:u.use12Hours,f=m.formatTime(t,e||(c?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,n,o):f}:a==="color"?(t,n,o)=>typeof i=="function"?i(t,n,o):typeof t=="string"&&t.startsWith("#")?l.jsx(v.Tooltip,{title:t,children:l.jsx(v.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,n,o)=>{const e=(u==null?void 0:u.truncated)??1;return typeof i=="function"?i(t,n,o):e?l.jsx(y.ShowMore,{lines:e===!0?1:e,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),d=require("@ant-design/icons"),r=require("antd"),y=require("../../common/show-more/index.cjs.js"),j=require("../FileCrudField.cjs.js"),x=require("../ImageCrudField.cjs.js"),m=require("../../util/DateUtil.cjs.js"),v=require("../../util/NumberUtil.cjs.js"),s=require("../../locale/index.cjs.js");function b({type:a,render:n,...i}){return a==="object"?(t,u,e)=>typeof n=="function"?n(t,u,e):"":a==="select"?(t,u,e)=>{const o=i;let c=o.multiple?Array.isArray(t)?t.map(l=>l==null?void 0:l[o.innerFieldLabel??"name"]):void 0:t==null?void 0:t[o.innerFieldLabel??"name"];return(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof n=="function"?n(c,u,e):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,e)=>typeof n=="function"?n(t,u,e):i!=null&&i.int?v.default.toInt(t,i.formatted):v.default.toMoney(t):a==="enum"?(t,u,e)=>{var l;const o=s.t(((l=i==null?void 0:i.translation)==null?void 0:l[t??""])??t),c=i==null?void 0:i.tagRender;if(typeof n=="function")return n(t,u,e);if(typeof c=="object"){const g=c[t];if(g)return f.jsx(r.Tag,{color:g.color,children:o})}return o}:a==="date"?(t,u,e)=>{if(!t)return"-";const o=i!=null&&i.formatTime?m.formatDateTime(t):m.formatDate(t);return typeof n=="function"?n(t,u,e):o}:a==="checkbox"?(t,u,e)=>typeof n=="function"?n(t,u,e):t?f.jsx(d.CheckOutlined,{}):f.jsx(d.CloseOutlined,{}):a==="image"?(t,u,e)=>typeof n=="function"?n(t,u,e):f.jsx(x.ImageCrudCellValue,{value:t,provider:i.provider}):a==="file"?(t,u,e)=>typeof n=="function"?n(t,u,e):f.jsx(j.FileCrudCellValue,{value:t,provider:i.provider}):a==="time"?(t,u,e)=>{if(!t)return"-";const o=i==null?void 0:i.format,c=i==null?void 0:i.use12Hours,l=m.formatTime(t,o||(c?"hh:mm:ss A":void 0));return typeof n=="function"?n(t,u,e):l}:a==="color"?(t,u,e)=>typeof n=="function"?n(t,u,e):typeof t=="string"&&t.startsWith("#")?f.jsx(r.Tooltip,{title:t,children:f.jsx(r.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,e)=>{const o=(i==null?void 0:i.truncated)??1;return typeof n=="function"?n(t,u,e):o?f.jsx(y.ShowMore,{lines:o===!0?1:o,children:t}):t}:typeof n=="function"?n:t=>t}exports.getRendererValueCrudViewer=b;
@@ -1,54 +1,61 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import { CheckOutlined as y, CloseOutlined as e } from "@ant-design/icons";
3
- import { Tooltip as b, Avatar as g } from "antd";
4
- import { ShowMore as h } from "../../common/show-more/index.es.js";
5
- import { FileCrudCellValue as C } from "../FileCrudField.es.js";
6
- import { ImageCrudCellValue as A } from "../ImageCrudField.es.js";
2
+ import { CheckOutlined as g, CloseOutlined as y } from "@ant-design/icons";
3
+ import { Tag as b, Tooltip as h, Avatar as C } from "antd";
4
+ import { ShowMore as A } from "../../common/show-more/index.es.js";
5
+ import { FileCrudCellValue as T } from "../FileCrudField.es.js";
6
+ import { ImageCrudCellValue as j } from "../ImageCrudField.es.js";
7
7
  import r from "../../util/DateUtil.es.js";
8
8
  import v from "../../util/NumberUtil.es.js";
9
9
  import { t as x } from "../../locale/index.es.js";
10
10
  function I({
11
- type: m,
12
- render: i,
13
- ...o
11
+ type: a,
12
+ render: o,
13
+ ...i
14
14
  }) {
15
- return m === "object" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : "" : m === "select" ? (t, n, f) => {
16
- const u = o;
17
- let a = u.multiple ? Array.isArray(t) ? t.map((c) => c == null ? void 0 : c[u.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[u.innerFieldLabel ?? "name"];
18
- return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, n, f) : Array.isArray(a) ? a.join(", ") : a;
19
- } : m === "number" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : o != null && o.int ? v.toInt(t, o.formatted) : v.toMoney(t) : m === "enum" ? (t, n, f) => {
20
- var a;
15
+ return a === "object" ? (t, n, f) => typeof o == "function" ? o(t, n, f) : "" : a === "select" ? (t, n, f) => {
16
+ const u = i;
17
+ let m = u.multiple ? Array.isArray(t) ? t.map((c) => c == null ? void 0 : c[u.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[u.innerFieldLabel ?? "name"];
18
+ return (!m && typeof t == "string" || typeof t == "number") && (m = t), typeof o == "function" ? o(m, n, f) : Array.isArray(m) ? m.join(", ") : m;
19
+ } : a === "number" ? (t, n, f) => typeof o == "function" ? o(t, n, f) : i != null && i.int ? v.toInt(t, i.formatted) : v.toMoney(t) : a === "enum" ? (t, n, f) => {
20
+ var c;
21
21
  const u = x(
22
- ((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t
23
- );
24
- return typeof i == "function" ? i(t, n, f) : u;
25
- } : m === "date" ? (t, n, f) => {
22
+ ((c = i == null ? void 0 : i.translation) == null ? void 0 : c[t ?? ""]) ?? t
23
+ ), m = i == null ? void 0 : i.tagRender;
24
+ if (typeof o == "function")
25
+ return o(t, n, f);
26
+ if (typeof m == "object") {
27
+ const e = m[t];
28
+ if (e)
29
+ return /* @__PURE__ */ l(b, { color: e.color, children: u });
30
+ }
31
+ return u;
32
+ } : a === "date" ? (t, n, f) => {
26
33
  if (!t) return "-";
27
- const u = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
28
- return typeof i == "function" ? i(t, n, f) : u;
29
- } : m === "checkbox" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : t ? /* @__PURE__ */ l(y, {}) : /* @__PURE__ */ l(e, {}) : m === "image" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
30
- A,
34
+ const u = i != null && i.formatTime ? r.formatDateTime(t) : r.formatDate(t);
35
+ return typeof o == "function" ? o(t, n, f) : u;
36
+ } : a === "checkbox" ? (t, n, f) => typeof o == "function" ? o(t, n, f) : t ? /* @__PURE__ */ l(g, {}) : /* @__PURE__ */ l(y, {}) : a === "image" ? (t, n, f) => typeof o == "function" ? o(t, n, f) : /* @__PURE__ */ l(
37
+ j,
31
38
  {
32
39
  value: t,
33
- provider: o.provider
40
+ provider: i.provider
34
41
  }
35
- ) : m === "file" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
36
- C,
42
+ ) : a === "file" ? (t, n, f) => typeof o == "function" ? o(t, n, f) : /* @__PURE__ */ l(
43
+ T,
37
44
  {
38
45
  value: t,
39
- provider: o.provider
46
+ provider: i.provider
40
47
  }
41
- ) : m === "time" ? (t, n, f) => {
48
+ ) : a === "time" ? (t, n, f) => {
42
49
  if (!t) return "-";
43
- const u = o == null ? void 0 : o.format, a = o == null ? void 0 : o.use12Hours, c = r.formatTime(
50
+ const u = i == null ? void 0 : i.format, m = i == null ? void 0 : i.use12Hours, c = r.formatTime(
44
51
  t,
45
- u || (a ? "hh:mm:ss A" : void 0)
52
+ u || (m ? "hh:mm:ss A" : void 0)
46
53
  );
47
- return typeof i == "function" ? i(t, n, f) : c;
48
- } : m === "color" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ l(b, { title: t, children: /* @__PURE__ */ l(g, { style: { backgroundColor: t } }) }) : String(t) : m === "textarea" ? (t, n, f) => {
49
- const u = (o == null ? void 0 : o.truncated) ?? 1;
50
- return typeof i == "function" ? i(t, n, f) : u ? /* @__PURE__ */ l(h, { lines: u === !0 ? 1 : u, children: t }) : t;
51
- } : typeof i == "function" ? i : (t) => t;
54
+ return typeof o == "function" ? o(t, n, f) : c;
55
+ } : a === "color" ? (t, n, f) => typeof o == "function" ? o(t, n, f) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ l(h, { title: t, children: /* @__PURE__ */ l(C, { style: { backgroundColor: t } }) }) : String(t) : a === "textarea" ? (t, n, f) => {
56
+ const u = (i == null ? void 0 : i.truncated) ?? 1;
57
+ return typeof o == "function" ? o(t, n, f) : u ? /* @__PURE__ */ l(A, { lines: u === !0 ? 1 : u, children: t }) : t;
58
+ } : typeof o == "function" ? o : (t) => t;
52
59
  }
53
60
  export {
54
61
  I as getRendererValueCrudViewer
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.43",
4
+ "version": "1.0.44",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",