@ahmadmubarak98/namozaj 1.6.12 → 1.6.13
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 +1 -0
- package/dist/namozaj.js +74 -65
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -296,6 +296,7 @@ export declare interface NamozajLocalizationOptions {
|
|
|
296
296
|
localePicker?: {
|
|
297
297
|
name?: string;
|
|
298
298
|
label?: string;
|
|
299
|
+
defaultValue?: string[];
|
|
299
300
|
getLocaleLabel: (locale: string) => string;
|
|
300
301
|
onLocaleChange: (locale: string[], formMethods: any) => void;
|
|
301
302
|
grid?: GridColumnConfig;
|
package/dist/namozaj.js
CHANGED
|
@@ -85238,100 +85238,109 @@ const Form = React__default.forwardRef(
|
|
|
85238
85238
|
}
|
|
85239
85239
|
), Namozaj = forwardRef(
|
|
85240
85240
|
(e, t) => {
|
|
85241
|
-
var d;
|
|
85241
|
+
var d, u, b;
|
|
85242
85242
|
const [a, l] = useState(
|
|
85243
|
-
((d = e.localization) == null ? void 0 : d.
|
|
85244
|
-
), c = (
|
|
85245
|
-
var
|
|
85246
|
-
const
|
|
85247
|
-
return
|
|
85248
|
-
|
|
85249
|
-
|
|
85250
|
-
(
|
|
85251
|
-
),
|
|
85252
|
-
|
|
85253
|
-
|
|
85254
|
-
(
|
|
85255
|
-
),
|
|
85256
|
-
|
|
85257
|
-
|
|
85243
|
+
((u = (d = e.localization) == null ? void 0 : d.localePicker) == null ? void 0 : u.defaultValue) || []
|
|
85244
|
+
), c = (h, g) => {
|
|
85245
|
+
var v, w, S;
|
|
85246
|
+
const m = h.meta || {}, y = { ...h }, C = { ...m };
|
|
85247
|
+
return y.name = getTranslatedFieldName(
|
|
85248
|
+
h,
|
|
85249
|
+
g,
|
|
85250
|
+
(v = e.localization) == null ? void 0 : v.translatedFieldNameSuffix
|
|
85251
|
+
), C.label = getTranslatedFieldLabel(
|
|
85252
|
+
h,
|
|
85253
|
+
g,
|
|
85254
|
+
(w = e.localization) == null ? void 0 : w.translatedLabel
|
|
85255
|
+
), C.grid = getTranslatedFieldGrid(
|
|
85256
|
+
h,
|
|
85257
|
+
g,
|
|
85258
85258
|
a,
|
|
85259
|
-
(
|
|
85260
|
-
),
|
|
85259
|
+
(S = e.localization) == null ? void 0 : S.translatedFieldGrid
|
|
85260
|
+
), y.meta = C, y.locale = g, y;
|
|
85261
85261
|
}, p = useMemo(() => {
|
|
85262
|
-
var
|
|
85263
|
-
const
|
|
85264
|
-
if (e.fields.forEach((
|
|
85265
|
-
const
|
|
85266
|
-
if (
|
|
85267
|
-
const
|
|
85268
|
-
|
|
85269
|
-
if (!(
|
|
85270
|
-
|
|
85262
|
+
var g, m, y, C;
|
|
85263
|
+
const h = [];
|
|
85264
|
+
if (e.fields.forEach((v) => {
|
|
85265
|
+
const S = (v.meta || {}).translated || !1;
|
|
85266
|
+
if (v.type === "field-array" || v.type === "repeater") {
|
|
85267
|
+
const x = v.meta.fields || [], L = [];
|
|
85268
|
+
x.forEach((D) => {
|
|
85269
|
+
if (!(D.meta || {}).translated) {
|
|
85270
|
+
L.push(D);
|
|
85271
85271
|
return;
|
|
85272
85272
|
}
|
|
85273
|
-
a == null || a.forEach((
|
|
85274
|
-
const
|
|
85275
|
-
|
|
85273
|
+
a == null || a.forEach((k) => {
|
|
85274
|
+
const H = c(D, k);
|
|
85275
|
+
L.push(H);
|
|
85276
85276
|
});
|
|
85277
|
-
}),
|
|
85278
|
-
...
|
|
85277
|
+
}), h.push({
|
|
85278
|
+
...v,
|
|
85279
85279
|
meta: {
|
|
85280
|
-
...
|
|
85281
|
-
fields:
|
|
85280
|
+
...v.meta,
|
|
85281
|
+
fields: L
|
|
85282
85282
|
}
|
|
85283
85283
|
});
|
|
85284
85284
|
return;
|
|
85285
85285
|
}
|
|
85286
|
-
if (!
|
|
85287
|
-
|
|
85286
|
+
if (!S) {
|
|
85287
|
+
h.push(v);
|
|
85288
85288
|
return;
|
|
85289
85289
|
}
|
|
85290
|
-
a == null || a.forEach((
|
|
85291
|
-
const
|
|
85292
|
-
|
|
85293
|
-
...
|
|
85290
|
+
a == null || a.forEach((x) => {
|
|
85291
|
+
const L = c(v, x);
|
|
85292
|
+
h.push({
|
|
85293
|
+
...L
|
|
85294
85294
|
});
|
|
85295
85295
|
});
|
|
85296
|
-
}), e.localization && a.length > 0 && ((
|
|
85297
|
-
const
|
|
85298
|
-
name: ((
|
|
85296
|
+
}), e.localization && a.length > 0 && ((g = e.localization) != null && g.localePicker)) {
|
|
85297
|
+
const v = {
|
|
85298
|
+
name: ((m = e.localization) == null ? void 0 : m.localePicker.name) || DEFAULT_LOCALE_PICKER_FIELD_NAME,
|
|
85299
85299
|
type: "checkbox-group",
|
|
85300
85300
|
meta: {
|
|
85301
|
-
label: ((
|
|
85301
|
+
label: ((y = e.localization) == null ? void 0 : y.localePicker.label) || "Select Input Locale",
|
|
85302
85302
|
defaultValue: a,
|
|
85303
85303
|
horizontal: !0,
|
|
85304
85304
|
min: 1,
|
|
85305
|
-
options: async () =>
|
|
85306
|
-
var
|
|
85307
|
-
return {
|
|
85308
|
-
|
|
85309
|
-
|
|
85310
|
-
|
|
85311
|
-
|
|
85312
|
-
|
|
85313
|
-
|
|
85314
|
-
|
|
85315
|
-
|
|
85316
|
-
|
|
85317
|
-
|
|
85318
|
-
|
|
85319
|
-
|
|
85320
|
-
|
|
85305
|
+
options: async () => {
|
|
85306
|
+
var w;
|
|
85307
|
+
return (((w = e.localization) == null ? void 0 : w.locales) || []).map((S) => {
|
|
85308
|
+
var x;
|
|
85309
|
+
return {
|
|
85310
|
+
label: ((x = e.localization) == null ? void 0 : x.localePicker).getLocaleLabel(
|
|
85311
|
+
S
|
|
85312
|
+
) || S,
|
|
85313
|
+
value: S
|
|
85314
|
+
};
|
|
85315
|
+
});
|
|
85316
|
+
},
|
|
85317
|
+
onValueChange: (w, S) => {
|
|
85318
|
+
var x, L, D;
|
|
85319
|
+
l(w), (L = (x = e.localization) == null ? void 0 : x.localePicker) != null && L.onLocaleChange && ((D = e.localization) == null || D.localePicker.onLocaleChange(
|
|
85320
|
+
w.sort((N, I) => {
|
|
85321
|
+
var G, Y;
|
|
85322
|
+
const k = ((G = e.localization) == null ? void 0 : G.locales.indexOf(N)) || 0, H = ((Y = e.localization) == null ? void 0 : Y.locales.indexOf(I)) || 0;
|
|
85323
|
+
return k - H;
|
|
85321
85324
|
}),
|
|
85322
|
-
|
|
85325
|
+
S
|
|
85323
85326
|
));
|
|
85324
85327
|
},
|
|
85325
|
-
grid: ((
|
|
85328
|
+
grid: ((C = e.localization) == null ? void 0 : C.localePicker.grid) || {
|
|
85326
85329
|
xs: 12
|
|
85327
85330
|
}
|
|
85328
85331
|
}
|
|
85329
85332
|
};
|
|
85330
|
-
|
|
85333
|
+
h.unshift(v);
|
|
85331
85334
|
}
|
|
85332
|
-
return
|
|
85335
|
+
return h;
|
|
85333
85336
|
}, [e.fields, a, e.localization]);
|
|
85334
|
-
return
|
|
85337
|
+
return useEffect(() => {
|
|
85338
|
+
var h, g, m;
|
|
85339
|
+
if ((h = e.localization) != null && h.localePicker) {
|
|
85340
|
+
const y = (m = (g = e.localization) == null ? void 0 : g.localePicker) == null ? void 0 : m.defaultValue;
|
|
85341
|
+
Array.isArray(y) ? l(y) : l([]);
|
|
85342
|
+
}
|
|
85343
|
+
}, [(b = e.localization) == null ? void 0 : b.localePicker]), /* @__PURE__ */ jsx(
|
|
85335
85344
|
DynamicFormLocalProvider,
|
|
85336
85345
|
{
|
|
85337
85346
|
value: {
|