@almadar/ui 4.6.3 → 4.6.4

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.
@@ -31753,6 +31753,16 @@ function evaluateFormExpression(expr, formCtx) {
31753
31753
  const ctx = toSharedContext2(formCtx);
31754
31754
  return evaluator.evaluate(expr, ctx);
31755
31755
  }
31756
+ function isOrbitalEntitySchema(value) {
31757
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
31758
+ const fields = value.fields;
31759
+ return Array.isArray(fields);
31760
+ }
31761
+ function isPlainEntityRow(value) {
31762
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
31763
+ const fields = value.fields;
31764
+ return !Array.isArray(fields);
31765
+ }
31756
31766
  function getEnumOptions(field) {
31757
31767
  if (field.options && field.options.length > 0) {
31758
31768
  return [...field.options];
@@ -31898,9 +31908,12 @@ var init_Form = __esm({
31898
31908
  const { t } = useTranslate();
31899
31909
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
31900
31910
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
31901
- const normalizedInitialData = initialData ?? {};
31902
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
31911
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
31912
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
31903
31913
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
31914
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
31915
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
31916
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
31904
31917
  const entityDerivedFields = React126__namespace.default.useMemo(() => {
31905
31918
  if (fields && fields.length > 0) return void 0;
31906
31919
  if (!resolvedEntity) return void 0;
@@ -31937,11 +31950,10 @@ var init_Form = __esm({
31937
31950
  [formData, externalContext]
31938
31951
  );
31939
31952
  React126__namespace.default.useEffect(() => {
31940
- const data = initialData;
31941
- if (data && Object.keys(data).length > 0) {
31942
- setFormData(data);
31953
+ if (Object.keys(normalizedInitialData).length > 0) {
31954
+ setFormData(normalizedInitialData);
31943
31955
  }
31944
- }, [initialData]);
31956
+ }, [normalizedInitialData]);
31945
31957
  const processCalculations = React126__namespace.default.useCallback(
31946
31958
  (changedFieldId, newFormData) => {
31947
31959
  if (!hiddenCalculations.length) return;
package/dist/avl/index.js CHANGED
@@ -31707,6 +31707,16 @@ function evaluateFormExpression(expr, formCtx) {
31707
31707
  const ctx = toSharedContext2(formCtx);
31708
31708
  return evaluate(expr, ctx);
31709
31709
  }
31710
+ function isOrbitalEntitySchema(value) {
31711
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
31712
+ const fields = value.fields;
31713
+ return Array.isArray(fields);
31714
+ }
31715
+ function isPlainEntityRow(value) {
31716
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
31717
+ const fields = value.fields;
31718
+ return !Array.isArray(fields);
31719
+ }
31710
31720
  function getEnumOptions(field) {
31711
31721
  if (field.options && field.options.length > 0) {
31712
31722
  return [...field.options];
@@ -31852,9 +31862,12 @@ var init_Form = __esm({
31852
31862
  const { t } = useTranslate();
31853
31863
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
31854
31864
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
31855
- const normalizedInitialData = initialData ?? {};
31856
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
31865
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
31866
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
31857
31867
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
31868
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
31869
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
31870
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
31858
31871
  const entityDerivedFields = React126__default.useMemo(() => {
31859
31872
  if (fields && fields.length > 0) return void 0;
31860
31873
  if (!resolvedEntity) return void 0;
@@ -31891,11 +31904,10 @@ var init_Form = __esm({
31891
31904
  [formData, externalContext]
31892
31905
  );
31893
31906
  React126__default.useEffect(() => {
31894
- const data = initialData;
31895
- if (data && Object.keys(data).length > 0) {
31896
- setFormData(data);
31907
+ if (Object.keys(normalizedInitialData).length > 0) {
31908
+ setFormData(normalizedInitialData);
31897
31909
  }
31898
- }, [initialData]);
31910
+ }, [normalizedInitialData]);
31899
31911
  const processCalculations = React126__default.useCallback(
31900
31912
  (changedFieldId, newFormData) => {
31901
31913
  if (!hiddenCalculations.length) return;
@@ -27641,6 +27641,16 @@ function evaluateFormExpression(expr, formCtx) {
27641
27641
  const ctx = toSharedContext2(formCtx);
27642
27642
  return evaluator.evaluate(expr, ctx);
27643
27643
  }
27644
+ function isOrbitalEntitySchema(value) {
27645
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
27646
+ const fields = value.fields;
27647
+ return Array.isArray(fields);
27648
+ }
27649
+ function isPlainEntityRow(value) {
27650
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
27651
+ const fields = value.fields;
27652
+ return !Array.isArray(fields);
27653
+ }
27644
27654
  function getEnumOptions(field) {
27645
27655
  if (field.options && field.options.length > 0) {
27646
27656
  return [...field.options];
@@ -27786,9 +27796,12 @@ var init_Form = __esm({
27786
27796
  const { t } = useTranslate();
27787
27797
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
27788
27798
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
27789
- const normalizedInitialData = initialData ?? {};
27790
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
27799
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
27800
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
27791
27801
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
27802
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
27803
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
27804
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
27792
27805
  const entityDerivedFields = React110__namespace.default.useMemo(() => {
27793
27806
  if (fields && fields.length > 0) return void 0;
27794
27807
  if (!resolvedEntity) return void 0;
@@ -27825,11 +27838,10 @@ var init_Form = __esm({
27825
27838
  [formData, externalContext]
27826
27839
  );
27827
27840
  React110__namespace.default.useEffect(() => {
27828
- const data = initialData;
27829
- if (data && Object.keys(data).length > 0) {
27830
- setFormData(data);
27841
+ if (Object.keys(normalizedInitialData).length > 0) {
27842
+ setFormData(normalizedInitialData);
27831
27843
  }
27832
- }, [initialData]);
27844
+ }, [normalizedInitialData]);
27833
27845
  const processCalculations = React110__namespace.default.useCallback(
27834
27846
  (changedFieldId, newFormData) => {
27835
27847
  if (!hiddenCalculations.length) return;
@@ -27596,6 +27596,16 @@ function evaluateFormExpression(expr, formCtx) {
27596
27596
  const ctx = toSharedContext2(formCtx);
27597
27597
  return evaluate(expr, ctx);
27598
27598
  }
27599
+ function isOrbitalEntitySchema(value) {
27600
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
27601
+ const fields = value.fields;
27602
+ return Array.isArray(fields);
27603
+ }
27604
+ function isPlainEntityRow(value) {
27605
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
27606
+ const fields = value.fields;
27607
+ return !Array.isArray(fields);
27608
+ }
27599
27609
  function getEnumOptions(field) {
27600
27610
  if (field.options && field.options.length > 0) {
27601
27611
  return [...field.options];
@@ -27741,9 +27751,12 @@ var init_Form = __esm({
27741
27751
  const { t } = useTranslate();
27742
27752
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
27743
27753
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
27744
- const normalizedInitialData = initialData ?? {};
27745
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
27754
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
27755
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
27746
27756
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
27757
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
27758
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
27759
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
27747
27760
  const entityDerivedFields = React110__default.useMemo(() => {
27748
27761
  if (fields && fields.length > 0) return void 0;
27749
27762
  if (!resolvedEntity) return void 0;
@@ -27780,11 +27793,10 @@ var init_Form = __esm({
27780
27793
  [formData, externalContext]
27781
27794
  );
27782
27795
  React110__default.useEffect(() => {
27783
- const data = initialData;
27784
- if (data && Object.keys(data).length > 0) {
27785
- setFormData(data);
27796
+ if (Object.keys(normalizedInitialData).length > 0) {
27797
+ setFormData(normalizedInitialData);
27786
27798
  }
27787
- }, [initialData]);
27799
+ }, [normalizedInitialData]);
27788
27800
  const processCalculations = React110__default.useCallback(
27789
27801
  (changedFieldId, newFormData) => {
27790
27802
  if (!hiddenCalculations.length) return;
@@ -28588,6 +28588,16 @@ function evaluateFormExpression(expr, formCtx) {
28588
28588
  const ctx = toSharedContext2(formCtx);
28589
28589
  return evaluator.evaluate(expr, ctx);
28590
28590
  }
28591
+ function isOrbitalEntitySchema(value) {
28592
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28593
+ const fields = value.fields;
28594
+ return Array.isArray(fields);
28595
+ }
28596
+ function isPlainEntityRow(value) {
28597
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28598
+ const fields = value.fields;
28599
+ return !Array.isArray(fields);
28600
+ }
28591
28601
  function getEnumOptions(field) {
28592
28602
  if (field.options && field.options.length > 0) {
28593
28603
  return [...field.options];
@@ -28733,9 +28743,12 @@ var init_Form = __esm({
28733
28743
  const { t } = useTranslate();
28734
28744
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
28735
28745
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
28736
- const normalizedInitialData = initialData ?? {};
28737
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
28746
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
28747
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
28738
28748
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28749
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28750
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28751
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28739
28752
  const entityDerivedFields = React115__namespace.default.useMemo(() => {
28740
28753
  if (fields && fields.length > 0) return void 0;
28741
28754
  if (!resolvedEntity) return void 0;
@@ -28772,11 +28785,10 @@ var init_Form = __esm({
28772
28785
  [formData, externalContext]
28773
28786
  );
28774
28787
  React115__namespace.default.useEffect(() => {
28775
- const data = initialData;
28776
- if (data && Object.keys(data).length > 0) {
28777
- setFormData(data);
28788
+ if (Object.keys(normalizedInitialData).length > 0) {
28789
+ setFormData(normalizedInitialData);
28778
28790
  }
28779
- }, [initialData]);
28791
+ }, [normalizedInitialData]);
28780
28792
  const processCalculations = React115__namespace.default.useCallback(
28781
28793
  (changedFieldId, newFormData) => {
28782
28794
  if (!hiddenCalculations.length) return;
@@ -28543,6 +28543,16 @@ function evaluateFormExpression(expr, formCtx) {
28543
28543
  const ctx = toSharedContext2(formCtx);
28544
28544
  return evaluate(expr, ctx);
28545
28545
  }
28546
+ function isOrbitalEntitySchema(value) {
28547
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28548
+ const fields = value.fields;
28549
+ return Array.isArray(fields);
28550
+ }
28551
+ function isPlainEntityRow(value) {
28552
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28553
+ const fields = value.fields;
28554
+ return !Array.isArray(fields);
28555
+ }
28546
28556
  function getEnumOptions(field) {
28547
28557
  if (field.options && field.options.length > 0) {
28548
28558
  return [...field.options];
@@ -28688,9 +28698,12 @@ var init_Form = __esm({
28688
28698
  const { t } = useTranslate();
28689
28699
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
28690
28700
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
28691
- const normalizedInitialData = initialData ?? {};
28692
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
28701
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
28702
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
28693
28703
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28704
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28705
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28706
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28694
28707
  const entityDerivedFields = React115__default.useMemo(() => {
28695
28708
  if (fields && fields.length > 0) return void 0;
28696
28709
  if (!resolvedEntity) return void 0;
@@ -28727,11 +28740,10 @@ var init_Form = __esm({
28727
28740
  [formData, externalContext]
28728
28741
  );
28729
28742
  React115__default.useEffect(() => {
28730
- const data = initialData;
28731
- if (data && Object.keys(data).length > 0) {
28732
- setFormData(data);
28743
+ if (Object.keys(normalizedInitialData).length > 0) {
28744
+ setFormData(normalizedInitialData);
28733
28745
  }
28734
- }, [initialData]);
28746
+ }, [normalizedInitialData]);
28735
28747
  const processCalculations = React115__default.useCallback(
28736
28748
  (changedFieldId, newFormData) => {
28737
28749
  if (!hiddenCalculations.length) return;
@@ -28195,6 +28195,16 @@ function evaluateFormExpression(expr, formCtx) {
28195
28195
  const ctx = toSharedContext2(formCtx);
28196
28196
  return evaluator.evaluate(expr, ctx);
28197
28197
  }
28198
+ function isOrbitalEntitySchema(value) {
28199
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28200
+ const fields = value.fields;
28201
+ return Array.isArray(fields);
28202
+ }
28203
+ function isPlainEntityRow(value) {
28204
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28205
+ const fields = value.fields;
28206
+ return !Array.isArray(fields);
28207
+ }
28198
28208
  function getEnumOptions(field) {
28199
28209
  if (field.options && field.options.length > 0) {
28200
28210
  return [...field.options];
@@ -28340,9 +28350,12 @@ var init_Form = __esm({
28340
28350
  const { t } = useTranslate();
28341
28351
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
28342
28352
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
28343
- const normalizedInitialData = initialData ?? {};
28344
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
28353
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
28354
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
28345
28355
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28356
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28357
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28358
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28346
28359
  const entityDerivedFields = React115__namespace.default.useMemo(() => {
28347
28360
  if (fields && fields.length > 0) return void 0;
28348
28361
  if (!resolvedEntity) return void 0;
@@ -28379,11 +28392,10 @@ var init_Form = __esm({
28379
28392
  [formData, externalContext]
28380
28393
  );
28381
28394
  React115__namespace.default.useEffect(() => {
28382
- const data = initialData;
28383
- if (data && Object.keys(data).length > 0) {
28384
- setFormData(data);
28395
+ if (Object.keys(normalizedInitialData).length > 0) {
28396
+ setFormData(normalizedInitialData);
28385
28397
  }
28386
- }, [initialData]);
28398
+ }, [normalizedInitialData]);
28387
28399
  const processCalculations = React115__namespace.default.useCallback(
28388
28400
  (changedFieldId, newFormData) => {
28389
28401
  if (!hiddenCalculations.length) return;
@@ -28150,6 +28150,16 @@ function evaluateFormExpression(expr, formCtx) {
28150
28150
  const ctx = toSharedContext2(formCtx);
28151
28151
  return evaluate(expr, ctx);
28152
28152
  }
28153
+ function isOrbitalEntitySchema(value) {
28154
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28155
+ const fields = value.fields;
28156
+ return Array.isArray(fields);
28157
+ }
28158
+ function isPlainEntityRow(value) {
28159
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
28160
+ const fields = value.fields;
28161
+ return !Array.isArray(fields);
28162
+ }
28153
28163
  function getEnumOptions(field) {
28154
28164
  if (field.options && field.options.length > 0) {
28155
28165
  return [...field.options];
@@ -28295,9 +28305,12 @@ var init_Form = __esm({
28295
28305
  const { t } = useTranslate();
28296
28306
  const resolvedSubmitLabel = submitLabel ?? t("common.save");
28297
28307
  const resolvedCancelLabel = cancelLabel ?? t("common.cancel");
28298
- const normalizedInitialData = initialData ?? {};
28299
- const resolvedEntity = entity && typeof entity === "object" && !Array.isArray(entity) ? entity : void 0;
28308
+ const isSchemaEntity = isOrbitalEntitySchema(entity);
28309
+ const resolvedEntity = isSchemaEntity ? entity : void 0;
28300
28310
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
28311
+ const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
28312
+ const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
28313
+ const normalizedInitialData = entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
28301
28314
  const entityDerivedFields = React115__default.useMemo(() => {
28302
28315
  if (fields && fields.length > 0) return void 0;
28303
28316
  if (!resolvedEntity) return void 0;
@@ -28334,11 +28347,10 @@ var init_Form = __esm({
28334
28347
  [formData, externalContext]
28335
28348
  );
28336
28349
  React115__default.useEffect(() => {
28337
- const data = initialData;
28338
- if (data && Object.keys(data).length > 0) {
28339
- setFormData(data);
28350
+ if (Object.keys(normalizedInitialData).length > 0) {
28351
+ setFormData(normalizedInitialData);
28340
28352
  }
28341
- }, [initialData]);
28353
+ }, [normalizedInitialData]);
28342
28354
  const processCalculations = React115__default.useCallback(
28343
28355
  (changedFieldId, newFormData) => {
28344
28356
  if (!hiddenCalculations.length) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.6.3",
3
+ "version": "4.6.4",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",