@ahmadmubarak98/namozaj 1.6.17 → 1.6.19
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 +2 -2
- package/dist/namozaj.js +66 -66
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -291,13 +291,13 @@ export declare const Namozaj: default_2.ForwardRefExoticComponent<DynamicFormPro
|
|
|
291
291
|
|
|
292
292
|
export declare interface NamozajLocalizationOptions {
|
|
293
293
|
locales: string[];
|
|
294
|
+
defaultSelectedLocales?: string[];
|
|
295
|
+
includeInDataSubmission?: boolean;
|
|
294
296
|
translatedLabel?: (label: string, locale: string) => string;
|
|
295
297
|
translatedFieldNameSuffix?: (locale: string) => string;
|
|
296
298
|
translatedFieldGrid?: (field: DynamicFormField, locale: string, selectedLocales: string[]) => GridColumnConfig;
|
|
297
299
|
localePicker?: {
|
|
298
|
-
name?: string;
|
|
299
300
|
label?: string;
|
|
300
|
-
defaultValue?: string[];
|
|
301
301
|
getLocaleLabel: (locale: string) => string;
|
|
302
302
|
onLocaleChange: (locale: string[], formMethods: any) => void;
|
|
303
303
|
grid?: GridColumnConfig;
|
package/dist/namozaj.js
CHANGED
|
@@ -85132,9 +85132,9 @@ const Form = React__default.forwardRef(
|
|
|
85132
85132
|
p.current = new Set(e.fields.map((H) => H.name));
|
|
85133
85133
|
}, [e.fields]);
|
|
85134
85134
|
const u = (H) => {
|
|
85135
|
-
var Y;
|
|
85135
|
+
var Y, V;
|
|
85136
85136
|
let G = { ...H };
|
|
85137
|
-
delete G[DEFAULT_LOCALE_PICKER_FIELD_NAME], (
|
|
85137
|
+
(Y = e.localization) != null && Y.includeInDataSubmission || delete G[DEFAULT_LOCALE_PICKER_FIELD_NAME], (V = e.onSubmit) == null || V.call(e, H), e.dirtyLock && c.reset(G);
|
|
85138
85138
|
}, b = async () => (await c.trigger()).valueOf(), h = () => {
|
|
85139
85139
|
var H, G, Y, V;
|
|
85140
85140
|
return /* @__PURE__ */ jsx(Fragment, { children: !((H = e.submitButtonProps) != null && H.hidden) && /* @__PURE__ */ jsx(
|
|
@@ -85256,109 +85256,109 @@ const Form = React__default.forwardRef(
|
|
|
85256
85256
|
}
|
|
85257
85257
|
), Namozaj = forwardRef(
|
|
85258
85258
|
(e, t) => {
|
|
85259
|
-
var d, u
|
|
85259
|
+
var d, u;
|
|
85260
85260
|
const [a, l] = useState(
|
|
85261
|
-
((
|
|
85262
|
-
), c = (
|
|
85263
|
-
var v, w
|
|
85264
|
-
const
|
|
85265
|
-
return
|
|
85261
|
+
((d = e.localization) == null ? void 0 : d.defaultSelectedLocales) || []
|
|
85262
|
+
), c = (b, h) => {
|
|
85263
|
+
var C, v, w;
|
|
85264
|
+
const g = b.meta || {}, m = { ...b }, y = { ...g };
|
|
85265
|
+
return m.name = getTranslatedFieldName(
|
|
85266
|
+
b,
|
|
85266
85267
|
h,
|
|
85267
|
-
|
|
85268
|
-
|
|
85269
|
-
|
|
85268
|
+
(C = e.localization) == null ? void 0 : C.translatedFieldNameSuffix
|
|
85269
|
+
), y.label = getTranslatedFieldLabel(
|
|
85270
|
+
b,
|
|
85270
85271
|
h,
|
|
85271
|
-
|
|
85272
|
-
|
|
85273
|
-
|
|
85272
|
+
(v = e.localization) == null ? void 0 : v.translatedLabel
|
|
85273
|
+
), y.grid = getTranslatedFieldGrid(
|
|
85274
|
+
b,
|
|
85274
85275
|
h,
|
|
85275
|
-
g,
|
|
85276
85276
|
a,
|
|
85277
|
-
(
|
|
85278
|
-
),
|
|
85277
|
+
(w = e.localization) == null ? void 0 : w.translatedFieldGrid
|
|
85278
|
+
), m.meta = y, m.locale = h, m;
|
|
85279
85279
|
}, p = useMemo(() => {
|
|
85280
|
-
var g, m, y
|
|
85281
|
-
const
|
|
85282
|
-
if (e.fields.forEach((
|
|
85283
|
-
const
|
|
85284
|
-
if (
|
|
85285
|
-
const
|
|
85286
|
-
|
|
85287
|
-
if (!(
|
|
85288
|
-
|
|
85280
|
+
var h, g, m, y;
|
|
85281
|
+
const b = [];
|
|
85282
|
+
if (e.fields.forEach((C) => {
|
|
85283
|
+
const w = (C.meta || {}).translated || !1;
|
|
85284
|
+
if (C.type === "field-array" || C.type === "repeater") {
|
|
85285
|
+
const S = C.meta.fields || [], x = [];
|
|
85286
|
+
S.forEach((L) => {
|
|
85287
|
+
if (!(L.meta || {}).translated) {
|
|
85288
|
+
x.push(L);
|
|
85289
85289
|
return;
|
|
85290
85290
|
}
|
|
85291
|
-
a == null || a.forEach((
|
|
85292
|
-
const
|
|
85293
|
-
|
|
85291
|
+
a == null || a.forEach((I) => {
|
|
85292
|
+
const k = c(L, I);
|
|
85293
|
+
x.push(k);
|
|
85294
85294
|
});
|
|
85295
|
-
}),
|
|
85296
|
-
...
|
|
85295
|
+
}), b.push({
|
|
85296
|
+
...C,
|
|
85297
85297
|
meta: {
|
|
85298
|
-
...
|
|
85299
|
-
fields:
|
|
85298
|
+
...C.meta,
|
|
85299
|
+
fields: x
|
|
85300
85300
|
}
|
|
85301
85301
|
});
|
|
85302
85302
|
return;
|
|
85303
85303
|
}
|
|
85304
|
-
if (!
|
|
85305
|
-
|
|
85304
|
+
if (!w) {
|
|
85305
|
+
b.push(C);
|
|
85306
85306
|
return;
|
|
85307
85307
|
}
|
|
85308
|
-
a == null || a.forEach((
|
|
85309
|
-
const
|
|
85310
|
-
|
|
85311
|
-
...
|
|
85308
|
+
a == null || a.forEach((S) => {
|
|
85309
|
+
const x = c(C, S);
|
|
85310
|
+
b.push({
|
|
85311
|
+
...x
|
|
85312
85312
|
});
|
|
85313
85313
|
});
|
|
85314
|
-
}), e.localization &&
|
|
85315
|
-
const
|
|
85316
|
-
name:
|
|
85314
|
+
}), e.localization && ((h = e.localization) == null ? void 0 : h.locales.length) > 0 && ((g = e.localization) != null && g.localePicker)) {
|
|
85315
|
+
const C = {
|
|
85316
|
+
name: DEFAULT_LOCALE_PICKER_FIELD_NAME,
|
|
85317
85317
|
type: "checkbox-group",
|
|
85318
85318
|
meta: {
|
|
85319
|
-
label: ((
|
|
85319
|
+
label: ((m = e.localization) == null ? void 0 : m.localePicker.label) || "Select Input Locale",
|
|
85320
85320
|
defaultValue: a,
|
|
85321
85321
|
horizontal: !0,
|
|
85322
85322
|
min: 1,
|
|
85323
85323
|
options: async () => {
|
|
85324
|
-
var
|
|
85325
|
-
return (((
|
|
85326
|
-
var
|
|
85324
|
+
var v;
|
|
85325
|
+
return (((v = e.localization) == null ? void 0 : v.locales) || []).map((w) => {
|
|
85326
|
+
var S;
|
|
85327
85327
|
return {
|
|
85328
|
-
label: ((
|
|
85329
|
-
|
|
85330
|
-
) ||
|
|
85331
|
-
value:
|
|
85328
|
+
label: ((S = e.localization) == null ? void 0 : S.localePicker).getLocaleLabel(
|
|
85329
|
+
w
|
|
85330
|
+
) || w,
|
|
85331
|
+
value: w
|
|
85332
85332
|
};
|
|
85333
85333
|
});
|
|
85334
85334
|
},
|
|
85335
|
-
onValueChange: (
|
|
85336
|
-
var x, L
|
|
85337
|
-
l(
|
|
85338
|
-
|
|
85339
|
-
var
|
|
85340
|
-
const
|
|
85341
|
-
return
|
|
85335
|
+
onValueChange: (v, w) => {
|
|
85336
|
+
var S, x, L;
|
|
85337
|
+
l(v), (x = (S = e.localization) == null ? void 0 : S.localePicker) != null && x.onLocaleChange && ((L = e.localization) == null || L.localePicker.onLocaleChange(
|
|
85338
|
+
v.sort((D, N) => {
|
|
85339
|
+
var H, G;
|
|
85340
|
+
const I = ((H = e.localization) == null ? void 0 : H.locales.indexOf(D)) || 0, k = ((G = e.localization) == null ? void 0 : G.locales.indexOf(N)) || 0;
|
|
85341
|
+
return I - k;
|
|
85342
85342
|
}),
|
|
85343
|
-
|
|
85343
|
+
w
|
|
85344
85344
|
));
|
|
85345
85345
|
},
|
|
85346
|
-
grid: ((
|
|
85346
|
+
grid: ((y = e.localization) == null ? void 0 : y.localePicker.grid) || {
|
|
85347
85347
|
xs: 12
|
|
85348
85348
|
}
|
|
85349
85349
|
}
|
|
85350
85350
|
};
|
|
85351
|
-
|
|
85351
|
+
b.unshift(C);
|
|
85352
85352
|
}
|
|
85353
|
-
return
|
|
85353
|
+
return b;
|
|
85354
85354
|
}, [e.fields, a, e.localization]);
|
|
85355
85355
|
return useEffect(() => {
|
|
85356
|
-
var h, g
|
|
85357
|
-
if ((h = e.localization) != null && h.
|
|
85358
|
-
const
|
|
85359
|
-
Array.isArray(
|
|
85356
|
+
var b, h, g;
|
|
85357
|
+
if ((h = (b = e.localization) == null ? void 0 : b.defaultSelectedLocales) != null && h.length) {
|
|
85358
|
+
const m = (g = e.localization) == null ? void 0 : g.defaultSelectedLocales;
|
|
85359
|
+
Array.isArray(m) ? l(m) : l([]);
|
|
85360
85360
|
}
|
|
85361
|
-
}, [(
|
|
85361
|
+
}, [JSON.stringify((u = e.localization) == null ? void 0 : u.defaultSelectedLocales)]), /* @__PURE__ */ jsx(
|
|
85362
85362
|
DynamicFormLocalProvider,
|
|
85363
85363
|
{
|
|
85364
85364
|
value: {
|