@kingteza/crud-component 1.0.61 → 1.0.63

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