@ahmadmubarak98/namozaj 1.2.0 → 1.3.0

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/dist/main.d.ts CHANGED
@@ -13,6 +13,7 @@ export declare type BaseFieldConfig = {
13
13
  style?: React.CSSProperties;
14
14
  placeholder?: string;
15
15
  tooltip?: TooltipConfig;
16
+ translated?: boolean;
16
17
  helperText?: HelperTextConfig;
17
18
  validations?: ValidationRule[];
18
19
  grid?: GridColumnConfig;
@@ -233,7 +234,7 @@ export declare interface NamozajLocalizationOptions {
233
234
  locales: string[];
234
235
  translatedLabelSuffix?: (label: string, locale: string) => string;
235
236
  translatedFieldNameSuffix?: (locale: string) => string;
236
- translatedFieldGrid?: (locale: string, fieldType: FieldType, fieldMeta: DynamicFormField['meta']) => GridColumnConfig;
237
+ translatedFieldGrid?: (field: DynamicFormField, locale: string) => GridColumnConfig;
237
238
  }
238
239
 
239
240
  export declare type NumberFieldConfig = BaseFieldConfig & {
@@ -355,7 +356,6 @@ export declare type SwitchFieldConfig = BaseFieldConfig & {
355
356
  export declare type TextFieldConfig = BaseFieldConfig & {
356
357
  type: "text";
357
358
  meta: BaseFieldConfig["meta"] & {
358
- translated?: boolean;
359
359
  variant?: FieldVariant;
360
360
  size?: FieldSize;
361
361
  maxLength?: number;
package/dist/namozaj.js CHANGED
@@ -4574,15 +4574,32 @@ const getDefaultValue = (e) => {
4574
4574
  default:
4575
4575
  return a;
4576
4576
  }
4577
- }, getTranslatedFieldLabel = (e, t, a) => a ? a(e, t) : `${e} (${t})`, getTranslatedFieldName = (e, t, a) => a ? `${e}${a(t)}` : `${e}_${t}`, getTranslatedFieldGrid = (e, t, a, l) => l ? l(e, t, a) : t === "text" && (a != null && a.multiline) ? {
4578
- xs: 12,
4579
- sm: 12,
4580
- md: 12,
4581
- lg: 12,
4582
- xl: 12
4583
- } : {
4584
- xs: 12,
4585
- md: 6
4577
+ }, getTranslatedFieldName = (e, t, a) => {
4578
+ if (a)
4579
+ return `${e.name}${a(t)}`;
4580
+ {
4581
+ const l = t.charAt(0).toUpperCase() + t.slice(1);
4582
+ return `${e.name}${l}`;
4583
+ }
4584
+ }, getTranslatedFieldLabel = (e, t, a) => {
4585
+ if (a)
4586
+ return a(e.meta.label, t);
4587
+ {
4588
+ const l = t.charAt(0).toUpperCase() + t.slice(1);
4589
+ return `${e.meta.label} (${l})`;
4590
+ }
4591
+ }, getTranslatedFieldGrid = (e, t, a) => {
4592
+ var l;
4593
+ return a ? a(e, t) : e.type === "text" && ((l = e.meta) != null && l.multiline) ? {
4594
+ xs: 12,
4595
+ sm: 12,
4596
+ md: 12,
4597
+ lg: 12,
4598
+ xl: 12
4599
+ } : {
4600
+ xs: 12,
4601
+ md: 6
4602
+ };
4586
4603
  };
4587
4604
  function chainPropTypes(e, t) {
4588
4605
  return process.env.NODE_ENV === "production" ? () => null : function(...l) {
@@ -82526,17 +82543,16 @@ const Form = React__default.forwardRef(
82526
82543
  var v, b, w;
82527
82544
  const m = { ...c }, y = { ...d };
82528
82545
  m.name = getTranslatedFieldName(
82529
- c.name,
82546
+ c,
82530
82547
  f,
82531
82548
  (v = e.localization) == null ? void 0 : v.translatedFieldNameSuffix
82532
82549
  ), y.label = getTranslatedFieldLabel(
82533
- d.label,
82550
+ c,
82534
82551
  f,
82535
82552
  (b = e.localization) == null ? void 0 : b.translatedLabelSuffix
82536
82553
  ), y.grid = getTranslatedFieldGrid(
82554
+ c,
82537
82555
  f,
82538
- c.type,
82539
- d,
82540
82556
  (w = e.localization) == null ? void 0 : w.translatedFieldGrid
82541
82557
  ), m.meta = y, l.push(m);
82542
82558
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ahmadmubarak98/namozaj",
3
3
  "private": false,
4
- "version": "1.2.0",
4
+ "version": "1.3.0",
5
5
  "type": "module",
6
6
  "main": "dist/namozaj.js",
7
7
  "types": "dist/main.d.ts",