@donotdev/crud 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -9
- package/dist/CrudService.bulk.js +1 -1
- package/dist/CrudService.bulkAcross.js +1 -1
- package/dist/CrudService.cache.d.ts.map +1 -1
- package/dist/CrudService.cache.js +1 -1
- package/dist/CrudService.d.ts +1 -1
- package/dist/CrudService.internal.d.ts +16 -4
- package/dist/CrudService.internal.d.ts.map +1 -1
- package/dist/CrudService.internal.js +2 -2
- package/dist/CrudService.mutations.d.ts.map +1 -1
- package/dist/CrudService.mutations.js +1 -1
- package/dist/CrudService.optimistic.d.ts.map +1 -1
- package/dist/CrudService.optimistic.js +1 -1
- package/dist/CrudService.queries.d.ts.map +1 -1
- package/dist/CrudService.queries.js +1 -1
- package/dist/CrudService.subscriptions.d.ts.map +1 -1
- package/dist/CrudService.subscriptions.js +1 -1
- package/dist/CrudStore.js +1 -1
- package/dist/FieldRegistry.d.ts +0 -11
- package/dist/FieldRegistry.d.ts.map +1 -1
- package/dist/FieldRegistry.js +1 -1
- package/dist/components/EntityFilters.js +1 -1
- package/dist/components/FormFieldRenderer.d.ts +0 -2
- package/dist/components/FormFieldRenderer.d.ts.map +1 -1
- package/dist/components/FormFieldRenderer.js +1 -1
- package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
- package/dist/components/controlled/complex/ControlledDateField.js +1 -1
- package/dist/components/controlled/complex/ControlledFieldArrayField.d.ts.map +1 -1
- package/dist/components/controlled/complex/ControlledFieldArrayField.js +1 -1
- package/dist/components/controlled/complex/ControlledGeoPointField.js +1 -1
- package/dist/components/controlled/complex/ControlledMapField.js +1 -1
- package/dist/components/controlled/complex/ControlledMultiInputField.js +1 -1
- package/dist/components/controlled/complex/ControlledRichTextField.js +1 -1
- package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
- package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledFileField.js +1 -1
- package/dist/components/controlled/file/ControlledImageField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
- package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
- package/dist/components/controlled/input/ControlledCheckboxField.js +1 -1
- package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
- package/dist/components/controlled/input/ControlledDurationField.js +1 -1
- package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
- package/dist/components/controlled/input/ControlledNumberField.js +1 -1
- package/dist/components/controlled/input/ControlledPasswordField.js +1 -1
- package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
- package/dist/components/controlled/input/ControlledPriceField.js +1 -1
- package/dist/components/controlled/input/ControlledRangeField.js +1 -1
- package/dist/components/controlled/input/ControlledRatingField.js +1 -1
- package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
- package/dist/components/controlled/input/ControlledTextField.js +1 -1
- package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
- package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
- package/dist/components/controlled/select/ControlledDropdownField.js +1 -1
- package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
- package/dist/components/controlled/select/ControlledRadioField.js +1 -1
- package/dist/components/controlled/select/ControlledReferenceField.js +1 -1
- package/dist/components/controlled/select/ControlledYearField.js +1 -1
- package/dist/components/controlled/types.d.ts +1 -11
- package/dist/components/controlled/types.d.ts.map +1 -1
- package/dist/components/controlled/types.js +1 -1
- package/dist/components/fields/display/TextFieldDisplay.js +1 -1
- package/dist/components/form/fields/DropdownComponent.js +1 -1
- package/dist/components/form/fields/PhoneNumberComponent.js +1 -1
- package/dist/components/form/fields/PriceFieldComponent.js +1 -1
- package/dist/components/form/fields/RangeFieldComponent.js +1 -1
- package/dist/fieldTypeRegistry.types.d.ts +0 -10
- package/dist/fieldTypeRegistry.types.d.ts.map +1 -1
- package/dist/forms/utils/buildInitialValues.js +1 -1
- package/dist/forms/utils/isFieldEditable.js +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/registerBuiltinFieldTypes.d.ts.map +1 -1
- package/dist/registerBuiltinFieldTypes.js +1 -1
- package/dist/stores/FormStore.js +1 -1
- package/dist/symbol-index.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +3 -14
- package/dist/types.d.ts.map +1 -1
- package/dist/useBaseCrudList.d.ts.map +1 -1
- package/dist/useBaseCrudList.js +1 -1
- package/dist/useCrud.js +1 -1
- package/dist/useCrudDoc.d.ts +59 -0
- package/dist/useCrudDoc.d.ts.map +1 -0
- package/dist/useCrudDoc.js +1 -0
- package/dist/useServerPrefetch.d.ts +34 -0
- package/dist/useServerPrefetch.d.ts.map +1 -0
- package/dist/useServerPrefetch.js +1 -0
- package/dist/utils/clientListProcessing.js +1 -1
- package/dist/utils/collections.js +1 -1
- package/dist/utils/mergeWithOptimistic.d.ts +13 -0
- package/dist/utils/mergeWithOptimistic.d.ts.map +1 -1
- package/dist/utils/mergeWithOptimistic.js +1 -1
- package/guidelines/COMPONENTS.md +9 -2
- package/guidelines/CRUD.md +1 -0
- package/package.json +3 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{Plus as F,Trash2 as $}from"lucide-react";import{useFieldArray as q,Controller as B}from"react-hook-form";import{Button as y}from"@donotdev/components";import{getFieldRegistry as D}from"../../../FieldRegistry";import{convertValidationRules as I}from"../types";function R(s){switch(s){case"number":return 0;case"boolean":return!1;default:return""}}function j(s){const{control:d,fieldConfig:c,required:h,t:l}=s,{name:p,label:f,validation:A}=c,v=c.options?.fieldSpecific??{},r=v.fields??[],o=v.direction??"row",{fields:x,append:b,remove:C}=q({control:d,name:p}),w=D(),S=()=>{if(r.length===0)return;const a={};for(const n of r)a[n.name]=R(n.type);b(a)};return r.length===0?t("div",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:[l(f),": no sub-fields configured"]}):t("div",{style:{display:"flex",flexDirection:"column",gap:"var(--gap-sm)"},children:[t("div",{style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},children:[t("span",{style:{fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-medium)"},children:[l(f),h&&i("span",{style:{color:"var(--destructive)",marginInlineStart:"var(--gap-tight)"},children:"*"})]}),i(y,{type:"button",variant:"ghost",display:"compact",icon:F,onClick:S,"aria-label":l(f)+" \u2014 add"})]}),x.map((a,n)=>t("div",{style:{display:"flex",flexDirection:o,gap:"var(--gap-sm)",alignItems:o==="row"?"flex-start":void 0},children:[r.map(e=>{const u=`${p}.${n}.${e.name}`,z={name:u,type:e.type,label:e.label,visibility:c.visibility,validation:{...e.validation??{},...e.required?{required:!0}:{}},options:e.options??{}},g=w.getControlledComponent(e.type);return g?i("div",{style:{flex:o==="row"?1:void 0},children:i(g,{control:d,fieldConfig:z,t:l})},e.name):i("div",{style:{flex:o==="row"?1:void 0},children:i(B,{name:u,control:d,rules:e.validation?I(e.validation):void 0,render:({field:m})=>t("label",{style:{display:"flex",flexDirection:"column",gap:"var(--gap-tight)"},children:[i("span",{style:{fontSize:"var(--font-size-xs)"},children:l(e.label)}),i("input",{className:"dndev-input",value:String(m.value??""),onChange:m.onChange,onBlur:m.onBlur})]})})},e.name)}),i(y,{type:"button",variant:"ghost",display:"compact",icon:$,onClick:()=>C(n),"aria-label":`Remove row ${n+1}`,style:{alignSelf:o==="row"?"center":"flex-end"}})]},a.id))]})}export{j as ControlledFieldArrayField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{GeoPointFieldComponent as p}from"../../form/fields";import{convertValidationRules as C}from"../types";function h(l){const{control:a,fieldConfig:i,required:s,t:d}=l,{name:m,label:g,validation:o}=i;return n(f,{name:m,control:a,rules:o?C(o):void 0,render:({field:e,fieldState:t})=>{const u=r=>{if("target"in r)try{const c=JSON.parse(r.target.value);e.onChange(c)}catch{e.onChange({lat:0,lng:0})}else e.onChange(r||{lat:0,lng:0})};return n(p,{label:d(g),value:e.value||{lat:0,lng:0},onChange:u,error:!!t.error,helperText:t.error?.message,required:s})}})}export{h as ControlledGeoPointField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{MapFieldComponent as g}from"../../form/fields";import{convertValidationRules as C}from"../types";function h(a){const{control:l,
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{MapFieldComponent as g}from"../../form/fields";import{convertValidationRules as C}from"../types";function h(a){const{control:l,fieldConfig:i,required:s,t:d}=a,{name:m,label:u,validation:o}=i;return n(p,{name:m,control:l,rules:o?C(o):void 0,render:({field:e,fieldState:t})=>{const c=r=>{if("target"in r)try{const f=JSON.parse(r.target.value);e.onChange(f)}catch{e.onChange({})}else e.onChange(r||{})};return n(g,{label:d(u),value:e.value||{},onChange:c,error:!!t.error,helperText:t.error?.message,required:s})}})}export{h as ControlledMapField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{MultiInputTextFieldComponent as C}from"../../form/fields";import{convertValidationRules as v}from"../types";function
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{MultiInputTextFieldComponent as C}from"../../form/fields";import{convertValidationRules as v}from"../types";function g(t){const{control:l,fieldConfig:i,required:s,t:u}=t,{name:m,label:c,validation:a,options:d={}}=i;return n(f,{name:m,control:l,rules:a?v(a):void 0,render:({field:r})=>{const p=e=>{if(Array.isArray(e))r.onChange(e);else try{const o=JSON.parse(e.target.value);r.onChange(Array.isArray(o)?o:[])}catch{r.onChange([])}};return n(C,{label:u(c),value:Array.isArray(r.value)?r.value:[],onChange:p,required:s,className:d.className})}})}export{g as ControlledMultiInputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a}from"react/jsx-runtime";import{Controller as
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{RichTextComponent as h}from"../../form/fields";import{convertValidationRules as C}from"../types";function x(n){const{control:t,fieldConfig:i,placeholder:s,required:m,t:d}=n,{name:c,label:p,validation:e,options:r={}}=i;return a(f,{name:c,control:t,rules:e?C(e):void 0,render:({field:o,fieldState:l})=>a(h,{label:d(p),value:o.value??"",onChange:u=>o.onChange(u),error:l.error?.message,helperText:l.error?.message,required:m,placeholder:s||r.placeholder,className:r.className})})}export{x as ControlledRichTextField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{TimestampFieldComponent as p}from"../../form/fields";import{convertValidationRules as c}from"../types";function C(l){const{control:n,fieldConfig:t,required:a,t:i}=l,{name:m,label:s,validation:o}=t;return r(f,{name:m,control:n,rules:o?c(o):void 0,render:({field:e,fieldState:d})=>r(p,{...e,label:i(s),value:e.value??null,onChange:u=>e.onChange(u),error:d.error?.message,required:a})})}export{C as ControlledTimestampField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{DocumentFieldComponent as f}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(i){const{control:m,fieldConfig:e,required:s,t:u}=i,{name:o,label:d,validation:r}=e,l=e.options||{};return n(c,{name:o,control:m,rules:r?g(r):void 0,render:({field:a,fieldState:t})=>n(f,{name:o,label:u(d),value:a.value??null,onChange:p=>a.onChange(p),error:!!t.error,helperText:t.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:l.maxSize,storagePath:l.storagePath})})}export{x as ControlledDocumentField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{FileFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(i){const{control:m,fieldConfig:e,required:s,t:d}=i,{name:r,label:u,validation:o}=e,l=e.options||{};return n(f,{name:r,control:m,rules:o?g(o):void 0,render:({field:t,fieldState:a})=>n(c,{name:r,label:d(u),value:t.value??null,onChange:p=>t.onChange(p),error:!!a.error,helperText:a.error?.message,required:s,multiple:!1,maxFiles:1,maxSize:l.maxSize,storagePath:l.storagePath})})}export{x as ControlledFileField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{useMemo as c}from"react";import{Controller as x}from"react-hook-form";import{readImageProcessingOptions as C}from"../../../utils/imageProcessing";import{ImageFieldComponent as S}from"../../form/fields";import{convertValidationRules as h}from"../types";function v(m){const{control:s,fieldConfig:r,required:f,t:d}=m,{name:o,label:p,validation:i}=r,e=r.options||{},a=e.fieldSpecific?.image,g=c(()=>C({image:a}),[JSON.stringify(a)]);return n(x,{name:o,control:s,rules:i?h(i):void 0,render:({field:t,fieldState:l})=>n(S,{name:o,label:d(p),value:t.value??null,onChange:u=>t.onChange(u),error:!!l.error,helperText:l.error?.message,required:f,multiple:!1,maxFiles:1,maxSize:e.maxSize,storagePath:e.fieldSpecific?.storagePath,processing:g})})}export{v as ControlledImageField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{DocumentFieldComponent as v}from"../../form/fields";import{convertValidationRules as x}from"../types";function g(i){const{control:m,fieldConfig:o,required:s,t:u}=i,{name:l,label:d,validation:t}=o,r=o.options||{};return n(p,{name:l,control:m,rules:t?x(t):void 0,render:({field:e,fieldState:a})=>{const c=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return n(v,{name:l,label:u(d),value:c,onChange:f=>e.onChange(f),error:!!a.error,helperText:a.error?.message,required:s,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.storagePath})}})}export{g as ControlledMultiDocumentField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{FileFieldComponent as c}from"../../form/fields";import{convertValidationRules as x}from"../types";function g(n){const{control:s,fieldConfig:o,required:m,t:u}=n,{name:l,label:d,validation:a}=o,r=o.options||{};return i(v,{name:l,control:s,rules:a?x(a):void 0,render:({field:e,fieldState:t})=>{const p=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return i(c,{name:l,label:u(d),value:p,onChange:f=>e.onChange(f),error:!!t.error,helperText:t.error?.message,required:m,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.storagePath})}})}export{g as ControlledMultiFileField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{useMemo as v}from"react";import{Controller as x}from"react-hook-form";import{readImageProcessingOptions as C}from"../../../utils/imageProcessing";import{ImageFieldComponent as S}from"../../form/fields";import{convertValidationRules as h}from"../types";function
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{useMemo as v}from"react";import{Controller as x}from"react-hook-form";import{readImageProcessingOptions as C}from"../../../utils/imageProcessing";import{ImageFieldComponent as S}from"../../form/fields";import{convertValidationRules as h}from"../types";function y(s){const{control:m,fieldConfig:o,required:u,t:f}=s,{name:i,label:d,validation:a}=o,r=o.options||{},l=r.fieldSpecific?.image,p=v(()=>C({image:l}),[JSON.stringify(l)]);return n(x,{name:i,control:m,rules:a?h(a):void 0,render:({field:e,fieldState:t})=>{const g=Array.isArray(e.value)?e.value:e.value?[e.value]:null;return n(S,{name:i,label:f(d),value:g,onChange:c=>e.onChange(c),error:!!t.error,helperText:t.error?.message,required:u,multiple:!0,maxFiles:r.maxFiles??10,maxSize:r.maxSize,storagePath:r.fieldSpecific?.storagePath,processing:p})}})}export{y as ControlledMultiImageField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{CheckboxFieldComponent as u}from"../../form/fields";import{convertValidationRules as C}from"../types";function p(t){const{control:l,
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{CheckboxFieldComponent as u}from"../../form/fields";import{convertValidationRules as C}from"../types";function p(t){const{control:l,fieldConfig:i,t:a,required:d}=t,{name:c,label:e,validation:o}=i,m=typeof e=="string"?a(e):e;return n(f,{name:c,control:l,rules:o?C(o):void 0,render:({field:r})=>n(u,{label:m,checked:!!r.value,onChange:s=>r.onChange(s.target.checked),required:d})})}export{p as ControlledCheckboxField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i}from"react/jsx-runtime";import{Controller as
|
|
1
|
+
"use client";import{jsx as i}from"react/jsx-runtime";import{Controller as h}from"react-hook-form";import{CurrencyFieldComponent as y}from"../../form/fields";import{convertValidationRules as N}from"../types";function x(u){const{control:c,fieldConfig:o,t:s,placeholder:d,required:f}=u,{name:m,label:p,validation:l}=o,n=(o.options||{}).fieldSpecific;return i(h,{name:m,control:c,rules:l?N(l):void 0,render:({field:e,fieldState:t})=>{const C=g=>{const r=g.target.value;if(r==null||r===""){e.onChange(null);return}const a=typeof r=="number"?r/100:parseFloat(String(r))/100;isNaN(a)?e.onChange(null):e.onChange(a)},v=e.value!=null&&!isNaN(e.value)?Math.round(e.value*100):void 0;return i(y,{label:s(p),value:v,onChange:C,currency:n?.currency||"EUR",locale:n?.locale,error:!!t.error,helperText:t.error?.message,required:f,placeholder:d})}})}export{x as ControlledCurrencyField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{DurationFieldComponent as c}from"../../form/fields";import{convertValidationRules as C}from"../types";function x(l){const{control:d,fieldConfig:r,t:i,required:s}=l,{name:m,label:f,validation:n}=r,e=(r.options||{}).fieldSpecific;return a(p,{name:m,control:d,rules:n?C(n):void 0,render:({field:o,fieldState:t})=>a(c,{label:i(f),value:o.value??0,onChange:u=>o.onChange(u),error:!!t.error,helperText:t.error?.message,required:s,disabled:o.disabled,min:e?.min??0,max:e?.max??480,step:e?.step??5,t:i})})}export{x as ControlledDurationField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import{Controller as u}from"react-hook-form";import{GdprConsentFieldComponent as h}from"../../form/fields";import{convertValidationRules as v}from"../types";function y(i){const{control:a,fieldConfig:l,required:s}=i,{name:c,validation:t,options:d={}}=l,o=d.fieldSpecific,p=o?.privacyPolicyPath||"/legal/privacy",m=o?.termsPath||"/legal/terms";return r(u,{name:c,control:a,rules:t?v(t):void 0,render:({field:n})=>{const e=n.value,g=typeof e=="object"&&e!==null?!!e.gdprConsent:!!e;return r(h,{checked:g,onChange:C=>{if(C.target.checked){const f=new Date().toISOString().split("T")[0];n.onChange({gdprConsent:!0,gdprConsentDate:new Date().toISOString(),gdprConsentVersion:f})}else n.onChange(!1)},required:s,privacyPolicyPath:p,termsPath:m})}})}export{y as ControlledGdprConsentField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as m}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{NumberFieldComponent as C}from"../../form/fields";import{convertValidationRules as h}from"../types";function N(s){const{control:u,fieldConfig:n,t:c,placeholder:x,required:d}=s,{name:f,label:p,validation:r}=n,t=n.options||{},a=t.fieldSpecific;return m(v,{name:f,control:u,rules:r?h(r):void 0,render:({field:e,fieldState:l})=>{const g=o=>{if(o.target.value===""||o.target.value===null){e.onChange(null);return}try{const i=parseFloat(o.target.value);isNaN(i)||e.onChange(i)}catch{e.onChange(0)}};return m(C,{...e,label:c(p),value:e.value??void 0,onChange:g,error:!!l.error,helperText:l.error?.message,required:d,min:r?.min,max:r?.max,step:a?.mask==="currency"?.01:a?.mask==="mileage"?1:void 0,mask:a?.mask||"number",className:t.className})}})}export{N as ControlledNumberField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{PasswordFieldComponent as u}from"../../form/fields";import{convertValidationRules as h}from"../types";function C(n){const{control:
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{PasswordFieldComponent as u}from"../../form/fields";import{convertValidationRules as h}from"../types";function C(n){const{control:t,fieldConfig:s,t:i,placeholder:d,required:m}=n,{name:c,label:p,validation:r,options:o={}}=s;return a(f,{name:c,control:t,rules:r?h(r):void 0,render:({field:e,fieldState:l})=>a(u,{...e,label:i(p),value:e.value??"",onChange:e.onChange,error:!!l.error,helperText:l.error?.message,required:m,placeholder:d||o.placeholder,className:o.className})})}export{C as ControlledPasswordField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{PhoneNumberComponent as p}from"../../form/fields";import{convertValidationRules as g}from"../types";function
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{PhoneNumberComponent as p}from"../../form/fields";import{convertValidationRules as g}from"../types";function c(t){const{control:a,fieldConfig:l,t:i,required:s}=t,{name:m,label:u,validation:r}=l;return n(f,{name:m,control:a,rules:r?g(r):void 0,render:({field:e,fieldState:o})=>n(p,{label:i(u),value:typeof e.value=="string"?e.value:"",onChange:d=>e.onChange(d.target.value||""),error:o.error?.message,helperText:o.error?.message,required:s})})}export{c as ControlledPhoneField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Controller as v}from"react-hook-form";import{PriceFieldComponent as h}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(t){const{control:a,fieldConfig:r,t:c,placeholder:d,required:s}=t,{name:u,label:f,validation:o}=r,e=(r.options||{}).fieldSpecific;return n(v,{name:u,control:a,rules:o?g(o):void 0,render:({field:i,fieldState:l})=>{const p=i.value,m=C=>{i.onChange(C)};return n(h,{label:c(f),value:p??void 0,onChange:m,error:!!l.error,helperText:l.error?.message,required:s,placeholder:d,defaultCurrency:e?.defaultCurrency??"EUR",optionsTitle:e?.optionsTitle,currencies:e?.currencies})}})}export{x as ControlledPriceField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{RangeFieldComponent as g}from"../../form/fields";import{convertValidationRules as v}from"../types";function C(i){const{control:m,fieldConfig:a,t:s,required:d}=i,{name:u,label:f,validation:e}=a,n=a.options||{},p=n.fieldSpecific;return t(c,{name:u,control:m,rules:e?v(e):void 0,render:({field:o,fieldState:l})=>t(g,{label:s(f),value:o.value??void 0,onChange:r=>{typeof r=="number"?o.onChange(r):o.onChange(Number(r.target.value)||0)},error:!!l.error,helperText:l.error?.message,required:d,min:e?.min,max:e?.max,step:n.step,showValue:p?.showValue})})}export{C as ControlledRangeField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i}from"react/jsx-runtime";import{Controller as p}from"react-hook-form";import{RatingFieldComponent as c}from"../../form/fields";import{convertValidationRules as g}from"../types";function x(l){const{control:t,fieldConfig:o,t:m,required:s}=l,{name:d,label:f,validation:e}=o,r=(o.options||{}).fieldSpecific;return i(p,{name:d,control:t,rules:e?g(e):void 0,render:({field:n,fieldState:a})=>i(c,{label:m(f),value:n.value??0,onChange:u=>{n.onChange(u)},error:!!a.error,helperText:a.error?.message,required:s,max:r?.max??e?.max??5,showValue:r?.showValue})})}export{x as ControlledRatingField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as d}from"react/jsx-runtime";import{Controller as S}from"react-hook-form";import{SwitchFieldComponent as v}from"../../form/fields";function x(i){const{control:h,
|
|
1
|
+
"use client";import{jsx as d}from"react/jsx-runtime";import{Controller as S}from"react-hook-form";import{SwitchFieldComponent as v}from"../../form/fields";function x(i){const{control:h,fieldConfig:s,t:o,onChange:c}=i,{name:f,label:m,options:u={}}=s,e=u.fieldSpecific,k=e?.uncheckedValue??!1,l=e?.checkedValue??!0,t=e?.uncheckedLabel,r=e?.checkedLabel;return d(S,{name:f,control:h,render:({field:{value:p,onChange:b},fieldState:C})=>{const g=p===l,L=n=>{const a=n?l:k;b(a),c&&c(a)};return d(v,{label:o(m),checked:g,onChange:n=>L(n.target.checked),uncheckedLabel:t?o(t):void 0,checkedLabel:r?o(r):void 0,helperText:C.error?.message})}})}export{x as ControlledSwitchField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import{Controller as f}from"react-hook-form";import{TextFieldComponent as C}from"../../form/fields";import{convertValidationRules as x}from"../types";function g(n){const{control:i,fieldConfig:r,t:m,placeholder:s,required:d}=n,{name:p,label:u,validation:o,options:l={}}=r,c=o?x(o):void 0,h=r.type==="email"?"email":r.type==="url"?"url":r.type==="color"?"color":"text";return a(f,{name:p,control:i,rules:c,render:({field:e,fieldState:t})=>a(C,{ref:e.ref,name:e.name,value:e.value??"",onChange:e.onChange,onBlur:e.onBlur,label:m(u),error:t.error?.message,helperText:t.error?.message,type:h,required:d,placeholder:s||l.placeholder,maxLength:o?.maxLength,showCharCount:l.showCharCount,className:l.className})})}export{g as ControlledTextField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{TextAreaComponent as p}from"../../form/fields";import{convertValidationRules as C}from"../types";function f(n){const{control:s,
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{Controller as c}from"react-hook-form";import{TextAreaComponent as p}from"../../form/fields";import{convertValidationRules as C}from"../types";function f(n){const{control:s,fieldConfig:a,t:i,placeholder:m,required:d}=n,{name:u,label:h,validation:o}=a,e=a.options||{};return t(c,{name:u,control:s,rules:o?C(o):void 0,render:({field:r,fieldState:l})=>t(p,{...r,label:i(h),value:r.value??"",onChange:r.onChange,error:l.error?.message,helperText:l.error?.message,required:d,placeholder:m||e.placeholder,maxLength:o?.maxLength,showCharCount:e.showCharCount,autoResize:e.autoResize,rows:e.rows,className:e.className})})}export{f as ControlledTextareaField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as O}from"react/jsx-runtime";import{useMemo as y,useEffect as
|
|
1
|
+
"use client";import{jsx as O}from"react/jsx-runtime";import{useMemo as y,useEffect as S,useRef as V}from"react";import{Controller as j,useWatch as D,useFormContext as E}from"react-hook-form";import{translateLabel as L}from"../../../forms/utils";import{ComboboxComponent as M}from"../../form/fields";import{convertValidationRules as w}from"../types";function G(F){const{control:m,fieldConfig:a,t:s,placeholder:q,required:B}=F,{name:i,label:P,validation:t,options:f={}}=a,b=E(),h=b?.setValue,v=b?.resetField,o=D({control:m}),n="dependsOn"in a?a.dependsOn:void 0,l=n&&o?o[n.field]:void 0,d=y(()=>{const e=t?.options;return e?typeof e=="function"?e(o||{}):e:[]},[t?.options,o,l]),C=V(void 0);S(()=>{const e=C.current;if(C.current=l,e===void 0||e===l)return;const r=o?.[i];r&&!d.map(c=>c.value).includes(r)&&v&&v(i)},[l]);const R=y(()=>d.map(e=>({...e,label:L(e.label,s)})),[d,s]),u=f.fieldSpecific;return O(j,{name:i,control:m,rules:t?w(t):void 0,render:({field:e,fieldState:r})=>{const c=p=>{const g=typeof p=="string"?p:p.target.value;if(e.onChange(g),n&&h&&u?.setParentOnChange){const x=u.setParentOnChange(g,o||{});x!=null&&h(n.field,x,{shouldValidate:!0,shouldDirty:!0})}};return O(M,{...e,label:s(P),value:e.value??"",onChange:c,onBlur:e.onBlur,options:R,error:!!r.error,helperText:r.error?.message,required:B,placeholder:q||f.placeholder,creatable:u?.creatable??!1})}})}export{G as ControlledComboboxField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as v}from"react/jsx-runtime";import{useMemo as C}from"react";import{Controller as V,useWatch as q,useFormContext as w}from"react-hook-form";import{translateLabel as B}from"../../../forms/utils";import{DropdownComponent as F}from"../../form/fields";import{convertValidationRules as P}from"../types";function j(g){const{control:d,
|
|
1
|
+
"use client";import{jsx as v}from"react/jsx-runtime";import{useMemo as C}from"react";import{Controller as V,useWatch as q,useFormContext as w}from"react-hook-form";import{translateLabel as B}from"../../../forms/utils";import{DropdownComponent as F}from"../../form/fields";import{convertValidationRules as P}from"../types";function j(g){const{control:d,fieldConfig:l,t:a,onChange:z,required:h}=g,{name:b,label:x,validation:n,options:y={}}=l,u=w()?.setValue,t="dependsOn"in l?l.dependsOn:void 0,o=t?t.field:void 0,O=typeof n?.options=="function",i=q({control:d,name:o,disabled:!o}),f=C(()=>{const e=n?.options;if(!e)return[];if(typeof e=="function"){const r=o?{[o]:i}:{};return e(r)}return e},[n?.options,O,o,i]),D=C(()=>f.map(e=>({...e,label:B(e.label,a)})),[f,a]),p=y.fieldSpecific;return v(V,{name:b,control:d,rules:n?P(n):void 0,render:({field:e,fieldState:r})=>{const S=s=>{const m=typeof s=="string"?s:s.target.value;if(e.onChange(m),t&&u&&p?.setParentOnChange){const c=p.setParentOnChange(m,o?{[o]:i}:{});c!=null&&u(t.field,c,{shouldValidate:!0,shouldDirty:!0})}};return v(F,{label:a(x),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:S,onBlur:e.onBlur,options:D,error:!!r.error,helperText:r.error?.message,required:h})}})}export{j as ControlledDropdownField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as f}from"react/jsx-runtime";import{useMemo as m}from"react";import{Controller as A,useWatch as x}from"react-hook-form";import{translateLabel as M}from"../../../forms/utils";import{MultiDropdownComponent as O}from"../../form/fields";import{convertValidationRules as
|
|
1
|
+
"use client";import{jsx as f}from"react/jsx-runtime";import{useMemo as m}from"react";import{Controller as A,useWatch as x}from"react-hook-form";import{translateLabel as M}from"../../../forms/utils";import{MultiDropdownComponent as O}from"../../form/fields";import{convertValidationRules as w}from"../types";function D(c){const{control:s,fieldConfig:a,t:l,required:v}=c,{name:y,label:b,validation:e}=a,u="dependsOn"in a?a.dependsOn:void 0,o=u?u.field:void 0,g=typeof e?.options=="function",d=x({control:s,name:o,disabled:!o}),p=m(()=>{const r=e?.options;if(!r)return[];if(typeof r=="function"){const n=o?{[o]:d}:{};return r(n)}return r},[e?.options,g,o,d]),C=m(()=>p.map(r=>({value:String(r.value),label:M(r.label,l)})),[p,l]);return f(A,{name:y,control:s,rules:e?w(e):void 0,render:({field:r,fieldState:n})=>{const h=i=>{let t;if(Array.isArray(i))t=i;else try{t=JSON.parse(i.target.value)}catch{t=[]}r.onChange(t)};return f(O,{...r,label:l(b),value:Array.isArray(r.value)?r.value:[],onChange:h,onBlur:r.onBlur,options:C,error:!!n.error,helperText:n.error?.message,required:v})}})}export{D as ControlledMultiDropdownField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as p}from"react/jsx-runtime";import{useMemo as u}from"react";import{Controller as x,useWatch as y}from"react-hook-form";import{translateLabel as R}from"../../../forms/utils";import{RadioFieldComponent as q}from"../../form/fields";import{convertValidationRules as F}from"../types";function O(m){const{control:
|
|
1
|
+
"use client";import{jsx as p}from"react/jsx-runtime";import{useMemo as u}from"react";import{Controller as x,useWatch as y}from"react-hook-form";import{translateLabel as R}from"../../../forms/utils";import{RadioFieldComponent as q}from"../../form/fields";import{convertValidationRules as F}from"../types";function O(m){const{control:a,fieldConfig:t,t:i,required:c}=m,{name:v,label:g,validation:o}=t,s="dependsOn"in t?t.dependsOn:void 0,r=s?s.field:void 0,b=typeof o?.options=="function",d=y({control:a,name:r,disabled:!r}),f=u(()=>{const e=o?.options;if(!e)return[];if(typeof e=="function"){const n=r?{[r]:d}:{};return e(n)}return e},[o?.options,b,r,d]),C=u(()=>f.map(e=>({value:String(e.value),label:R(e.label,i)})),[f,i]);return p(x,{name:v,control:a,rules:o?F(o):void 0,render:({field:e,fieldState:n})=>p(q,{...e,label:i(g),value:e.value??void 0,onChange:l=>{const h=typeof l=="string"?l:l.target.value;e.onChange(h)},options:C,error:!!n.error,helperText:n.error?.message,required:c})})}export{O as ControlledRadioField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as m}from"react/jsx-runtime";import{useMemo as v}from"react";import{Controller as S}from"react-hook-form";import{useCrudList as _}from"../../../useCrudList";import x from"../../form/fields/ReferenceFieldComponent";import{convertValidationRules as L}from"../types";const R=["name","title","label","displayName"];function p(e,n,l){if(n?.length){const r=n.map(i=>e[i]).filter(i=>i!=null&&i!=="");if(r.length)return r.join(" ")}if(l&&e[l]!=null&&e[l]!=="")return String(e[l]);for(const r of R)if(e[r]!=null&&e[r]!=="")return String(e[r]);return e.id??"?"}function j(e){const{control:n,fieldConfig:l,t:r,placeholder:i,required:c}=e,{name:b,label:g,validation:a,options:d={}}=l,s=a?.reference,t=d.fieldSpecific,{items:f,loading:h}=_(s??"__disabled__",{enabled:!!s}),C=v(()=>f.map(o=>({id:o.id,label:p(o,t?.labelFields,t?.displayField)})),[f,t?.labelFields,t?.displayField]);return m(S,{name:b,control:n,rules:a?L(a):void 0,render:({field:o,fieldState:u})=>m(x,{label:r(g),value:o.value??"",onChange:F=>o.onChange(F),onBlur:o.onBlur,options:C,isLoading:h,error:!!u.error,helperText:u.error?.message,required:c,placeholder:i||d.placeholder})})}export{j as ControlledReferenceField,p as buildReferenceLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{useMemo as b}from"react";import{Controller as C}from"react-hook-form";import{translateLabel as x}from"../../../forms/utils";import{ComboboxComponent as S}from"../../form/fields";import{convertValidationRules as y}from"../types";function Y(i){const{control:s,
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{useMemo as b}from"react";import{Controller as C}from"react-hook-form";import{translateLabel as x}from"../../../forms/utils";import{ComboboxComponent as S}from"../../form/fields";import{convertValidationRules as y}from"../types";function Y(i){const{control:s,fieldConfig:m,t:u,placeholder:c,required:p}=i,{name:d,label:f,validation:o,options:v={}}=m,g=b(()=>{const e=o?.min??1900,l=o?.max??new Date().getFullYear()+10,t=[];for(let r=l;r>=e;r--)t.push({value:String(r),label:String(r)});return t},[o?.min,o?.max]);return n(C,{name:d,control:s,rules:o?y(o):void 0,render:({field:e,fieldState:l})=>{const t=r=>{const a=typeof r=="string"?r:r.target.value,h=a===""?void 0:Number(a);e.onChange(h)};return n(S,{...e,label:x(f,u),value:e.value!==void 0&&e.value!==null?String(e.value):"",onChange:t,onBlur:e.onBlur,options:g,error:!!l.error,helperText:l.error?.message,required:p,placeholder:c||v.placeholder,translationNamespace:"crud",placeholderKey:"actions.selectYear",placeholderDefault:"Select or type year",creatable:!0})}})}export{Y as ControlledYearField};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Control, ControllerRenderProps,
|
|
1
|
+
import type { Control, ControllerRenderProps, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
2
2
|
import type { EntityField, FieldType, ValueTypeForField } from '@donotdev/core';
|
|
3
3
|
/**
|
|
4
4
|
* Props for controlled field components (react-hook-form)
|
|
@@ -9,16 +9,6 @@ import type { EntityField, FieldType, ValueTypeForField } from '@donotdev/core';
|
|
|
9
9
|
export interface ControlledFieldProps<T extends FieldValues = FieldValues, FT extends FieldType = FieldType> {
|
|
10
10
|
/** Control object from react-hook-form - use with framework's useController hook */
|
|
11
11
|
control: Control<T>;
|
|
12
|
-
/**
|
|
13
|
-
* Form-wide errors. Withheld when the field type registers `omitFormErrors`.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated Read the error from `fieldState` (useController/Controller), or
|
|
16
|
-
* `useFormState({ control, name })` for nested paths. This object changes
|
|
17
|
-
* identity on every formState update, so receiving it re-renders the field on
|
|
18
|
-
* every validation pass. Removed in the next major — see
|
|
19
|
-
* docs/plans/form-perf-migration.html
|
|
20
|
-
*/
|
|
21
|
-
errors?: FieldErrors<T>;
|
|
22
12
|
fieldConfig: EntityField<FT>;
|
|
23
13
|
t: (key: string, options?: Record<string, unknown>) => string;
|
|
24
14
|
onChange?: (value: ValueTypeForField<FT>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/controlled/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,OAAO,EACP,qBAAqB,EACrB,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/controlled/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,OAAO,EACP,qBAAqB,EACrB,WAAW,EACX,IAAI,EACJ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB,CACnC,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,EAAE,SAAS,SAAS,GAAG,SAAS;IAEhC,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;IAC9D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,6FAA6F;IAC7F,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7B,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AAEH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAsBpB;AAED;;;;GAIG;AAEH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,GAAG,GAAG,eAAe,CA4BvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";function i(
|
|
1
|
+
"use client";function i(e){if(e){if(e instanceof RegExp)return e;try{const t=/^\/(.*)\/([gimyus]*)$/.exec(e);if(t){const[,r,n]=t;if(r)return new RegExp(r,n)}return new RegExp(e)}catch{return}}}function a(e){if(!e)return{};const t={};return e.required!==void 0&&(t.required=e.required),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),e.minLength!==void 0&&(t.minLength=e.minLength),e.maxLength!==void 0&&(t.maxLength=e.maxLength),e.pattern&&typeof e.pattern=="string"&&(t.pattern={value:i(e.pattern)||/.*/,message:"Invalid format"}),t}export{i as convertPatternToRegex,a as convertValidationRules};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Mail as L,Calendar as k,Clock as I}from"lucide-react";import{useState as A}from"react";import{Skeleton as T,Badge as B,BADGE_VARIANT as E,Text as l,cn as f,CopyToClipboard as x,Stack as o}from"@donotdev/components";import{getWeekFromISOString as M,getI18nInstance as b}from"@donotdev/core";const C=({config:i,value:a,t:r,className:s,loading:v=!1,showCopy:
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Mail as L,Calendar as k,Clock as I}from"lucide-react";import{useState as A}from"react";import{Skeleton as T,Badge as B,BADGE_VARIANT as E,Text as l,cn as f,CopyToClipboard as x,Stack as o}from"@donotdev/components";import{getWeekFromISOString as M,getI18nInstance as b}from"@donotdev/core";const C=({config:i,value:a,t:r,className:s,loading:v=!1,showCopy:u=!1,asBadge:w=!1,truncate:c=!1,maxLength:d=50,showLabel:p=!1})=>{const[j,m]=A(!1),F=async()=>{try{await navigator.clipboard.writeText(a),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},h=()=>{switch(i.type){case"email":return e(L,{});case"month":case"week":return e(k,{});case"time":return e(I,{});default:return null}},S=t=>{if(!t)return null;switch(i.type){case"email":return n("a",{href:`mailto:${t}`,style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)"},onMouseEnter:g=>g.currentTarget.style.textDecoration="underline",onMouseLeave:g=>g.currentTarget.style.textDecoration="none",children:[h(),t]});case"month":return new Date(t).toLocaleDateString(b()?.language,{year:"numeric",month:"long"});case"week":return M(t);case"time":return new Date(`2000-01-01T${t}`).toLocaleTimeString(b()?.language);default:return t}},D=t=>!c||t.length<=d?t:`${t.substring(0,d)}...`;if(v)return n(o,{gap:"tight",children:[p&&e(T,{style:{height:"1rem",width:"6rem"}}),e(T,{className:"dndev-w-full",style:{height:"1.5rem"}})]});if(!a)return n(o,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:i.label||i.name}),e(l,{as:"span",variant:"muted",className:f(s),style:{fontStyle:"italic"},children:r("common.noValue",{defaultValue:"No value"})})]});const N=S(a),y=D(String(N));return w?n(o,{direction:"row",align:"center",gap:"tight",children:[h(),e(B,{variant:E.SECONDARY,className:s,children:y}),u&&e(x,{text:a,tooltipText:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyToClipboard")||"Copy to clipboard"})]}):n(o,{gap:"tight",children:[p&&e(l,{as:"span",variant:"muted",children:i.label||i.name}),n(o,{direction:"row",align:"center",gap:"tight",children:[e("div",{className:f("dndev-flex-1",c&&"truncate",s),title:c&&a.length>d?a:void 0,children:e(l,{as:"span",children:y})}),u&&e(x,{text:a,tooltipText:r("copyToClipboard")||"Copy to clipboard",copiedTooltipText:r("copied")||"Copied!",ariaLabel:r("copyToClipboard")||"Copy to clipboard"})]})]})};var V=C;export{C as TextFieldDisplay,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l,jsxs as g}from"react/jsx-runtime";import{Select as d,Stack as v}from"@donotdev/components";import{useTranslation as m}from"@donotdev/core";const f=({label:t,value:r,options:n,error:s,helperText:a,onChange:o,onBlur:i,required:u})=>{const{t:p}=m("crud"),c=r!=null?String(r):"";return g(v,{gap:"tight",children:[l(d,{label:t,value:c,onValueChange:e=>{o&&o({target:{value:e}})},onOpenChange:e=>!e&&i?.(),placeholder:p("actions.select","Select"),required:u,options:n.map(e=>({value:String(e.value),label:e.label}))}),a&&l("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:a})]})};var h=f;export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{useState as L,useMemo as h,useEffect as M,useId as O}from"react";import{Input as j,FloatingLabel as q,Button as B,BUTTON_VARIANT as E,DropdownMenu as U,Stack as f,cn as D}from"@donotdev/components";import{Flag as
|
|
1
|
+
"use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{useState as L,useMemo as h,useEffect as M,useId as O}from"react";import{Input as j,FloatingLabel as q,Button as B,BUTTON_VARIANT as E,DropdownMenu as U,Stack as f,cn as D}from"@donotdev/components";import{Flag as R,COUNTRIES as y}from"@donotdev/core";const V=({label:F,value:d="",onChange:C,error:N,helperText:g,required:S=!1,disabled:v=!1,defaultCountry:x="FR",showFlags:T=!0,preferredCountries:c,countries:m})=>{const n=O(),p=h(()=>m&&m.length>0?m.map(e=>y.find(r=>r.code===e)).filter(e=>e!==void 0):Array.from(y),[m]),l=h(()=>{if(!c||c.length===0)return p;const e=c.map(t=>p.find(k=>k.code===t)).filter(t=>t!==void 0),r=p.filter(t=>!c.includes(t.code));return[...e,...r]},[p,c]),u=h(()=>l.find(e=>e.code===x)||l[0]||y[0],[x,l]),{country:b,phoneNumber:$}=h(()=>{if(!d)return{country:u,phoneNumber:""};const e=l.find(t=>d.startsWith(t.dialCode));if(e){let t=d.slice(e.dialCode.length).trim();return t.startsWith("0")&&(t=t.slice(1).trim()),t=t.replace(/\s+/g," ").trim(),{country:e,phoneNumber:t}}if(d.startsWith("+"))return{country:u,phoneNumber:d};let r=d.trim();return r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim(),{country:u,phoneNumber:r}},[d,u,l]),[a,W]=L(u);M(()=>{b.code!==a.code&&W(b)},[b,a.code]);const z=$,w=e=>{W(e);let r=z;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:e.dialCode+(r?" "+r:"")}};C(t)},A=e=>{let r=e.target.value;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:a.dialCode+(r?" "+r:"")}};C(t)},I=l.map(e=>({label:e.dialCode,onClick:()=>w(e),checked:e.code===a.code,children:T?s(f,{direction:"row",align:"center",gap:"tight",children:[i(R,{code:e.flagCode,title:e.name}),i("span",{children:e.dialCode}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"},children:e.name})]}):s("span",{children:[e.dialCode," ",e.name]})})),o=!!N;return s(f,{gap:"tight",children:[i(q,{htmlFor:n,label:F,disabled:v,required:S,children:s("div",{className:"dndev-relative",style:{display:"flex",gap:0},children:[i(U,{trigger:i(B,{type:"button",variant:E.GHOST,disabled:v,style:{minWidth:"fit-content",padding:"0 var(--gap-md)"},"aria-label":`Country code: ${a.dialCode}`,children:s(f,{direction:"row",align:"center",gap:"tight",children:[T&&i(R,{code:a.flagCode,title:a.name}),i("span",{children:a.dialCode})]})}),items:I,contentWidth:"16rem"}),i(j,{id:n,type:"tel",inputMode:"tel",value:z,onChange:A,disabled:v,placeholder:"6 12 34 56 78",bare:!0,"data-variant":o?"destructive":void 0,className:"dndev-flex-1",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderRadius:"0 var(--radius-md) var(--radius-md) 0"},"aria-describedby":D(o&&`${n}-error`,g&&!o&&`${n}-helper`),"aria-invalid":o})]})}),o&&s(f,{id:`${n}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),N]}),g&&!o&&i("p",{id:`${n}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:g})]})};var _=V;export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as
|
|
1
|
+
"use client";import{jsx as n,jsxs as u}from"react/jsx-runtime";import{CirclePlus as R,CircleMinus as U}from"lucide-react";import{useId as q,useState as z}from"react";import{Input as C,Checkbox as D,Stack as E,Select as A,CollapsiblePrimitive as B,CollapsibleTrigger as G,CollapsibleContent as H}from"@donotdev/components";import{useTranslation as J,getCurrencySymbol as L}from"@donotdev/core";const O=["EUR","USD","GBP","CHF","JPY","KRW"],Y=({label:f,value:a,onChange:I,error:s,helperText:g,required:P=!1,disabled:o=!1,placeholder:N="0",defaultCurrency:d="EUR",optionsTitle:x="Price options",currencies:b})=>{const c=q(),{t:p}=J("crud"),r=b?.length?b:[...O],h=a?.currency??d,m=r.includes(h)?h:r[0]??d,T=a?.vatIncluded??!0,y=a?.discountPercent??0,S=`${f} (${L(m)})`,i=e=>{const l=e.amount!==void 0?e.amount:a?.amount??null;let t=e.currency!==void 0?e.currency:a?.currency??d;r.includes(t)||(t=m);const F=e.vatIncluded!==void 0?e.vatIncluded:a?.vatIncluded??!0,M=e.discountPercent!==void 0?e.discountPercent:a?.discountPercent??0;I({amount:l===null?null:Number(l),currency:t,vatIncluded:F,discountPercent:Number(M)})},k=e=>{const l=e.target.value;if(l===""||l===null){i({amount:null});return}const t=parseFloat(l);i({amount:isNaN(t)?null:t})},V=e=>{i({currency:e||d})},$=e=>{const l=e.target.value;if(l===""||l===null){i({discountPercent:0});return}const t=parseFloat(l);i({discountPercent:isNaN(t)?0:t})},[v,j]=z(!1);return u(B,{open:v,onOpenChange:j,children:[u(E,{children:[u("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:"var(--gap-sm)",alignItems:"end"},children:[n(C,{id:c,type:"number",inputMode:"decimal",label:S,value:a?.amount!==void 0&&a?.amount!==null?a.amount:"",onChange:k,disabled:o,placeholder:N,required:P,min:0,step:.01,"data-variant":s?"destructive":void 0,"aria-invalid":s}),n(G,{asChild:!0,children:n("button",{type:"button","aria-label":x,"aria-expanded":v,className:"dndev-collapsible-trigger",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--gap-sm)",background:"none",border:"none",cursor:"pointer"},children:v?n(U,{className:"dndev-collapsible-icon","aria-hidden":"true"}):n(R,{className:"dndev-collapsible-icon","aria-hidden":"true"})})})]}),n(H,{className:"dndev-collapsible-content",children:u("div",{style:{display:"grid",gridTemplateColumns:r.length>1?"1fr auto 1fr":"auto 1fr",gap:"var(--gap-sm)",alignItems:"end",paddingTop:"var(--gap-md)"},children:[r.length>1&&n(A,{value:m,onValueChange:V,placeholder:d,options:r.map(e=>({value:e,label:e})),disabled:o,label:p("price.currency",{defaultValue:"Currency"})}),n(D,{id:`${c}-vat`,label:p("price.vatIncluded",{defaultValue:"VAT Incl."}),checked:T,onCheckedChange:e=>i({vatIncluded:e===!0}),disabled:o}),n(C,{id:`${c}-discount`,type:"number",inputMode:"decimal",min:0,max:100,step:1,value:y===0?"":y,onChange:$,disabled:o,placeholder:"0",label:p("price.discountLabel",{defaultValue:"Discount (%)"})})]})})]}),g&&n("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)"},children:g})]})};var w=Y;export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as b,Stack as d}from"@donotdev/components";const x=({label:
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as b,Stack as d}from"@donotdev/components";const x=({label:t,value:i=0,onChange:u,error:n,helperText:s,min:r=0,max:c=100,step:v=1,disabled:o,required:m,showValue:f=!0})=>{const g=a=>{const p={target:{value:a.toString()}};u(p)};return l(d,{gap:"tight",children:[l(d,{direction:"row",justify:"between",align:"center",children:[e(h,{required:m,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:t}),f&&e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:i})]}),e(b,{value:[i??r],onValueChange:([a])=>g(a??r),min:r,max:c,step:v,disabled:o,style:{borderColor:n?"var(--destructive)":void 0,opacity:o?"var(--opacity-muted)":void 0,cursor:o?"not-allowed":void 0},"aria-label":t}),s&&e("p",{style:{fontSize:"var(--font-size-xs)",color:n?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:s})]})};var y=x;export{y as default};
|
|
@@ -53,15 +53,5 @@ export interface FieldTypeMetadata {
|
|
|
53
53
|
valueType?: ValueType;
|
|
54
54
|
/** UI components */
|
|
55
55
|
components?: ComponentRegistration;
|
|
56
|
-
/**
|
|
57
|
-
* Omit the form-wide `errors` prop for this field type.
|
|
58
|
-
*
|
|
59
|
-
* Absent (the default) passes `errors` exactly as before. Set `true` when the
|
|
60
|
-
* component reads its error from `fieldState` instead — the RHF-native
|
|
61
|
-
* per-field subscription. `errors` changes identity on every formState
|
|
62
|
-
* update, so withholding it is what lets FormFieldRenderer's memo hold and
|
|
63
|
-
* stops sibling fields re-rendering on every validation pass.
|
|
64
|
-
*/
|
|
65
|
-
omitFormErrors?: boolean;
|
|
66
56
|
}
|
|
67
57
|
//# sourceMappingURL=fieldTypeRegistry.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldTypeRegistry.types.d.ts","sourceRoot":"","sources":["../src/fieldTypeRegistry.types.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,aAAa,GACb,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,4GAA4G;IAC5G,MAAM,CAAC,E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AC;IACxB,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,yBAAyB;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,oBAAoB;IACpB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function s(c,o){if(o in c)return c[o];const
|
|
1
|
+
function s(c,o){if(o in c)return c[o];const n=o.replace(/_([a-z])/g,(i,e)=>e.toUpperCase());if(n!==o&&n in c)return c[n]}function u(c,o){if(o in c)return!0;const n=o.replace(/_([a-z])/g,(i,e)=>e.toUpperCase());return n!==o&&n in c}function a(c,o){const n=o??{},i={...n};return Object.entries(c.fields).forEach(([e,t])=>{const p=s(i,e);p!==void 0&&!(e in i)&&(i[e]=p);const r=!u(n,e)||p===null||p===void 0;if(e==="status"&&r)i[e]="draft";else if(t.type==="switch"){if(p==null){const l=t.options?.fieldSpecific;i[e]=l?.uncheckedValue??!1}}else r&&(t.type==="price"?i[e]=null:t.type==="checkbox"||t.type==="boolean"?i[e]=!1:t.type==="text"||t.type==="textarea"||t.type==="email"||t.type==="url"||t.type==="tel"||t.type==="iban"||t.type==="password"||t.type==="color"?i[e]="":(t.type==="number"||t.type==="range"||t.type==="rating")&&(i[e]=void 0))}),i}function f(c){return a(c,{})}export{a as buildInitialFromRecord,f as buildSchemaDefaults};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EDITABLE as
|
|
1
|
+
import{EDITABLE as i,hasRoleAccess as t}from"@donotdev/core";function o(e,r,s){return e===void 0||e===!0?!0:e===!1||e===i.GENERATED||e===i.COMPUTED?!1:e===i.CREATE_ONLY?s==="create":typeof e=="string"?t(r,e):!0}export{o as isFieldEditable};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export * from './useCrud';
|
|
10
10
|
export * from './useCrudList';
|
|
11
|
+
export * from './useCrudDoc';
|
|
11
12
|
export * from './useCrudCardList';
|
|
12
13
|
export * from './components';
|
|
13
14
|
export * from './stores';
|
|
@@ -20,12 +21,6 @@ export { OPTIMISTIC_STATUSES, CRUD_OPERATION } from './types';
|
|
|
20
21
|
export { loadDeterministicRange, upsertDeterministic, appendToCollection, } from './utils/collections';
|
|
21
22
|
export { getFieldRegistry, registerFieldType, isFieldTypeRegistered, type FieldTypeRegistration, type ControlledFieldProps, type UncontrolledFieldProps, } from './FieldRegistry';
|
|
22
23
|
export { registerBuiltinFieldType, getFieldTypeMetadata, getFilterType, getDisplayFormatter, isFilterable, getValueType, clearFieldTypeRegistry, type FieldTypeMetadata, type FilterType, type ValueType, type DisplayFormatter, type ComponentRegistration, } from './fieldTypeRegistry';
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated No-op shim. Built-in field types are now auto-registered via
|
|
25
|
-
* `fieldTypeRegistry.ts` → `registerBuiltinFieldTypes.tsx` side-effect chain.
|
|
26
|
-
* Exported for backward compatibility with consumers that call it at startup.
|
|
27
|
-
*/
|
|
28
|
-
export { registerBuiltinFieldTypes } from './builtinFieldTypes';
|
|
29
24
|
export { useEntityForm, useEntityField, useController, isFieldEditable, getFieldsForOperation, validateEntity, translateFieldLabel, translateLabel, } from './forms';
|
|
30
25
|
export type { ViewerRole, RenderableField, GetFieldsForOperationOptions, EntityFieldsInput, SchemaOperation, ValidationIssue, ValidationResult, InferEntityData, InferEntityCreate, InferEntityInput, InferEntityOutput, UseEntityFormOptions, EntityFormReturn, EntityFieldReturn, UseControllerProps, UseControllerReturn, ControllerRenderProps, ControllerFieldState, } from './forms';
|
|
31
26
|
export { UploadProvider, useUploadContext } from './contexts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAGH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AA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B,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,YAAY,EACZ,SAAS,EACT,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAG9F,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,UAAU,EACV,gBAAgB,GACjB,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./useCrud";export*from"./useCrudList";export*from"./useCrudCardList";export*from"./components";export*from"./stores";import{FunctionsAdapter as e}from"./adapters/FunctionsAdapter";import{getCrudService as a}from"./CrudService";import{useCrudStore as s}from"./CrudStore";import{OPTIMISTIC_STATUSES as t,CRUD_OPERATION as r}from"./types";import{loadDeterministicRange as i,upsertDeterministic as
|
|
1
|
+
export*from"./useCrud";export*from"./useCrudList";export*from"./useCrudDoc";export*from"./useCrudCardList";export*from"./components";export*from"./stores";import{FunctionsAdapter as e}from"./adapters/FunctionsAdapter";import{getCrudService as a}from"./CrudService";import{useCrudStore as s}from"./CrudStore";import{OPTIMISTIC_STATUSES as t,CRUD_OPERATION as r}from"./types";import{loadDeterministicRange as i,upsertDeterministic as o,appendToCollection as l}from"./utils/collections";import{getFieldRegistry as p,registerFieldType as d,isFieldTypeRegistered as m}from"./FieldRegistry";import{registerBuiltinFieldType as u,getFieldTypeMetadata as F,getFilterType as n,getDisplayFormatter as f,isFilterable as y,getValueType as g,clearFieldTypeRegistry as c}from"./fieldTypeRegistry";import{useEntityForm as S,useEntityField as T,useController as C,isFieldEditable as R,getFieldsForOperation as b,validateEntity as E,translateFieldLabel as U,translateLabel as v}from"./forms";import{UploadProvider as k,useUploadContext as h}from"./contexts";import{useFileUpload as w,useEntityFavorites as I,useRelatedItems as P,useCrudFilters as W,useCrudPageSize as x,useFieldConditions as D,useReferenceResolver as O}from"./hooks";import{isStorageUrl as A,validatePicture as B,checkForBlobUrls as L,hasBlobUrls as M}from"./utils/uploadValidation";import{defineWorkflow as V,useEntityWorkflow as _,saveWorkflowState as z,loadWorkflowState as N,clearWorkflowState as j}from"./workflows";import{formatValue as G}from"./components/DisplayFieldRenderer";import{buildReferenceLabel as H}from"./components/controlled/select/ControlledReferenceField";import{matchesFilter as J}from"./utils/matchesFilter";import{applyFilters as K,applySearch as Q,applySort as X,getSearchableFields as Y}from"./utils/clientListProcessing";export{r as CRUD_OPERATION,e as FunctionsAdapter,t as OPTIMISTIC_STATUSES,k as UploadProvider,l as appendToCollection,K as applyFilters,Q as applySearch,X as applySort,H as buildReferenceLabel,L as checkForBlobUrls,c as clearFieldTypeRegistry,j as clearWorkflowState,V as defineWorkflow,G as formatValue,a as getCrudService,f as getDisplayFormatter,p as getFieldRegistry,F as getFieldTypeMetadata,b as getFieldsForOperation,n as getFilterType,Y as getSearchableFields,g as getValueType,M as hasBlobUrls,R as isFieldEditable,m as isFieldTypeRegistered,y as isFilterable,A as isStorageUrl,i as loadDeterministicRange,N as loadWorkflowState,J as matchesFilter,u as registerBuiltinFieldType,d as registerFieldType,z as saveWorkflowState,U as translateFieldLabel,v as translateLabel,o as upsertDeterministic,C as useController,W as useCrudFilters,x as useCrudPageSize,s as useCrudStore,I as useEntityFavorites,T as useEntityField,S as useEntityForm,_ as useEntityWorkflow,D as useFieldConditions,w as useFileUpload,O as useReferenceResolver,P as useRelatedItems,h as useUploadContext,E as validateEntity,B as validatePicture};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerBuiltinFieldTypes.d.ts","sourceRoot":"","sources":["../src/registerBuiltinFieldTypes.tsx"],"names":[],"mappings":"AA+EA,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,2BAA2B,CAAC;AA00BnC;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAChD,aAAa,EAAE;IACb,iBAAiB,EAAE,CACjB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,EACf,YAAY,CAAC,EAAE,GAAG,KACf,IAAI,CAAC;CACX,GACA,IAAI,
|
|
1
|
+
{"version":3,"file":"registerBuiltinFieldTypes.d.ts","sourceRoot":"","sources":["../src/registerBuiltinFieldTypes.tsx"],"names":[],"mappings":"AA+EA,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,2BAA2B,CAAC;AA00BnC;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAChD,aAAa,EAAE;IACb,iBAAiB,EAAE,CACjB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,EACf,YAAY,CAAC,EAAE,GAAG,KACf,IAAI,CAAC;CACX,GACA,IAAI,CAuuBN"}
|