@strictly/react-form 0.0.1 → 0.0.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/.out/core/mobx/field_adapter.d.ts +7 -6
- package/.out/core/mobx/field_adapter_builder.d.ts +12 -13
- package/.out/core/mobx/field_adapter_builder.js +8 -12
- package/.out/core/mobx/field_adapters_of_values.d.ts +4 -0
- package/.out/core/mobx/flattened_adapters_of_fields.d.ts +2 -2
- package/.out/core/mobx/flattened_list_types_of_type.d.ts +8 -0
- package/.out/core/mobx/form_fields_of_field_adapters.d.ts +8 -0
- package/.out/core/mobx/form_presenter.d.ts +21 -24
- package/.out/core/mobx/form_presenter.js +64 -69
- package/.out/core/mobx/merge_field_adapters_with_two_way_converter.d.ts +13 -0
- package/.out/core/mobx/merge_field_adapters_with_two_way_converter.js +11 -0
- package/.out/core/mobx/merge_field_adapters_with_validators.d.ts +11 -0
- package/.out/core/mobx/merge_field_adapters_with_validators.js +45 -0
- package/.out/core/mobx/specs/fixtures.d.ts +7 -0
- package/.out/core/mobx/specs/fixtures.js +20 -0
- package/.out/core/mobx/specs/flattened_adapters_of_fields.tests.js +5 -2
- package/.out/core/mobx/specs/{flattened_list_type_defs_of.tests.js → flattened_list_types_of_types.tests.js} +7 -7
- package/.out/core/mobx/specs/form_presenter.tests.js +162 -60
- package/.out/core/mobx/specs/merge_field_adapters_with_two_way_converter.js +89 -0
- package/.out/core/mobx/specs/merge_field_adapters_with_validators.tests.js +172 -0
- package/.out/core/mobx/types.d.ts +2 -2
- package/.out/field_converters/chain_field_converter.d.ts +3 -3
- package/.out/field_converters/chain_field_converter.js +17 -12
- package/.out/field_converters/identity_converter.d.ts +3 -3
- package/.out/field_converters/identity_converter.js +10 -6
- package/.out/field_converters/integer_to_string_converter.d.ts +5 -4
- package/.out/field_converters/integer_to_string_converter.js +13 -6
- package/.out/field_converters/list_converter.d.ts +2 -2
- package/.out/field_converters/list_converter.js +6 -1
- package/.out/field_converters/maybe_identity_converter.d.ts +3 -3
- package/.out/field_converters/maybe_identity_converter.js +3 -1
- package/.out/field_converters/nullable_to_boolean_converter.d.ts +9 -8
- package/.out/field_converters/nullable_to_boolean_converter.js +13 -7
- package/.out/field_converters/select_value_type_converter.d.ts +20 -15
- package/.out/field_converters/select_value_type_converter.js +29 -14
- package/.out/field_converters/specs/chain_field_converter.tests.d.ts +1 -0
- package/.out/field_converters/specs/chain_field_converter.tests.js +251 -0
- package/.out/field_converters/trimming_string_converter.d.ts +3 -3
- package/.out/field_converters/trimming_string_converter.js +7 -3
- package/.out/field_converters/validating_converter.d.ts +3 -3
- package/.out/field_converters/validating_converter.js +7 -5
- package/.out/index.d.ts +9 -2
- package/.out/index.js +9 -2
- package/.out/mantine/create_checkbox.d.ts +2 -3
- package/.out/mantine/create_checkbox.js +6 -5
- package/.out/mantine/create_pill.js +2 -2
- package/.out/mantine/create_radio.js +1 -1
- package/.out/mantine/create_radio_group.d.ts +2 -3
- package/.out/mantine/create_radio_group.js +4 -3
- package/.out/mantine/create_text_input.d.ts +2 -3
- package/.out/mantine/create_text_input.js +6 -5
- package/.out/mantine/create_value_input.d.ts +2 -3
- package/.out/mantine/create_value_input.js +6 -5
- package/.out/mantine/error_renderer.d.ts +6 -0
- package/.out/mantine/error_renderer.js +5 -0
- package/.out/mantine/hooks.d.ts +9 -13
- package/.out/mantine/hooks.js +10 -15
- package/.out/mantine/specs/checkbox_hooks.stories.d.ts +7 -2
- package/.out/mantine/specs/checkbox_hooks.stories.js +33 -6
- package/.out/mantine/specs/list_hooks.stories.js +2 -2
- package/.out/mantine/specs/radio_group_hooks.stories.d.ts +7 -2
- package/.out/mantine/specs/radio_group_hooks.stories.js +33 -6
- package/.out/mantine/specs/select_hooks.stories.d.ts +8 -2
- package/.out/mantine/specs/select_hooks.stories.js +45 -8
- package/.out/mantine/specs/text_input_hooks.stories.d.ts +5 -1
- package/.out/mantine/specs/text_input_hooks.stories.js +23 -8
- package/.out/mantine/specs/value_input_hooks.stories.d.ts +7 -2
- package/.out/mantine/specs/value_input_hooks.stories.js +49 -15
- package/.out/mantine/types.d.ts +4 -1
- package/.out/tsconfig.tsbuildinfo +1 -1
- package/.out/types/error_of_field.d.ts +2 -0
- package/.out/types/error_of_field.js +1 -0
- package/.out/types/field.d.ts +1 -1
- package/.out/types/field_converters.d.ts +17 -10
- package/.out/types/field_converters.js +5 -5
- package/.out/types/flattened_validators_of_fields.d.ts +8 -0
- package/.out/types/flattened_validators_of_fields.js +1 -0
- package/.out/types/merge_validators.d.ts +7 -0
- package/.out/types/merge_validators.js +38 -0
- package/.out/types/specs/flattened_validators_of_fields.tests.d.ts +1 -0
- package/.out/types/specs/flattened_validators_of_fields.tests.js +16 -0
- package/.out/types/specs/merge_validators.tests.d.ts +1 -0
- package/.out/types/specs/merge_validators.tests.js +192 -0
- package/.out/util/partial.d.ts +11 -5
- package/.out/util/partial.js +55 -15
- package/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-check-types.log +1 -1
- package/.turbo/turbo-release$colon$exports.log +1 -1
- package/README.md +5 -1
- package/core/mobx/field_adapter.ts +15 -7
- package/core/mobx/field_adapter_builder.ts +39 -75
- package/core/mobx/field_adapters_of_values.ts +17 -0
- package/core/mobx/flattened_adapters_of_fields.ts +3 -3
- package/core/mobx/flattened_list_types_of_type.ts +17 -0
- package/core/mobx/form_fields_of_field_adapters.ts +16 -0
- package/core/mobx/form_presenter.ts +117 -104
- package/core/mobx/merge_field_adapters_with_two_way_converter.ts +68 -0
- package/core/mobx/merge_field_adapters_with_validators.ts +99 -0
- package/core/mobx/specs/fixtures.ts +73 -0
- package/core/mobx/specs/flattened_adapters_of_fields.tests.ts +23 -2
- package/core/mobx/specs/flattened_list_types_of_types.tests.ts +35 -0
- package/core/mobx/specs/form_presenter.tests.ts +248 -124
- package/core/mobx/specs/merge_field_adapters_with_two_way_converter.ts +140 -0
- package/core/mobx/specs/merge_field_adapters_with_validators.tests.ts +259 -0
- package/core/mobx/types.ts +3 -3
- package/dist/index.cjs +459 -211
- package/dist/index.d.cts +153 -111
- package/dist/index.d.ts +153 -111
- package/dist/index.js +453 -200
- package/field_converters/chain_field_converter.ts +37 -23
- package/field_converters/identity_converter.ts +14 -10
- package/field_converters/integer_to_string_converter.ts +15 -9
- package/field_converters/list_converter.ts +8 -3
- package/field_converters/maybe_identity_converter.ts +7 -4
- package/field_converters/nullable_to_boolean_converter.ts +23 -16
- package/field_converters/select_value_type_converter.ts +86 -26
- package/field_converters/specs/chain_field_converter.tests.ts +302 -0
- package/field_converters/trimming_string_converter.ts +11 -6
- package/field_converters/validating_converter.ts +21 -11
- package/index.ts +9 -2
- package/mantine/create_checkbox.tsx +15 -8
- package/mantine/create_list.tsx +1 -4
- package/mantine/create_pill.tsx +2 -2
- package/mantine/create_radio.tsx +1 -1
- package/mantine/create_radio_group.tsx +8 -6
- package/mantine/create_text_input.tsx +20 -8
- package/mantine/create_value_input.tsx +17 -8
- package/mantine/error_renderer.ts +15 -0
- package/mantine/hooks.tsx +25 -51
- package/mantine/specs/__snapshots__/checkbox_hooks.tests.tsx.snap +126 -0
- package/mantine/specs/__snapshots__/radio_group_hooks.tests.tsx.snap +356 -0
- package/mantine/specs/__snapshots__/select_hooks.tests.tsx.snap +208 -12
- package/mantine/specs/__snapshots__/text_input_hooks.tests.tsx.snap +45 -0
- package/mantine/specs/__snapshots__/value_input_hooks.tests.tsx.snap +194 -8
- package/mantine/specs/checkbox_hooks.stories.tsx +47 -7
- package/mantine/specs/list_hooks.stories.tsx +2 -2
- package/mantine/specs/radio_group_hooks.stories.tsx +47 -7
- package/mantine/specs/select_hooks.stories.tsx +55 -8
- package/mantine/specs/text_input_hooks.stories.tsx +32 -7
- package/mantine/specs/value_input_hooks.stories.tsx +57 -16
- package/mantine/types.ts +5 -1
- package/package.json +16 -4
- package/tsconfig.json +1 -0
- package/types/error_of_field.ts +3 -0
- package/types/field.ts +1 -1
- package/types/field_converters.ts +21 -10
- package/types/flattened_validators_of_fields.ts +34 -0
- package/types/merge_validators.ts +80 -0
- package/types/specs/error_type_of_field.tests.ts +2 -2
- package/types/specs/flattened_validators_of_fields.tests.ts +93 -0
- package/types/specs/merge_validators.tests.ts +267 -0
- package/util/partial.tsx +200 -16
- package/.out/core/mobx/flattened_list_type_defs_of.d.ts +0 -8
- package/.out/field_validators/minimum_string_length_field_validator.d.ts +0 -2
- package/.out/field_validators/minimum_string_length_field_validator.js +0 -8
- package/.out/types/error_type_of_field.d.ts +0 -2
- package/.out/types/field_validator.d.ts +0 -3
- package/.out/types/flattened_form_fields_of.d.ts +0 -9
- package/.out/types/specs/flattened_form_fields_of.tests.js +0 -13
- package/core/mobx/flattened_list_type_defs_of.ts +0 -17
- package/core/mobx/specs/flattened_list_type_defs_of.tests.ts +0 -35
- package/field_validators/minimum_string_length_field_validator.ts +0 -13
- package/mantine/specs/__snapshots__/check_box_hooks.tests.tsx.snap +0 -227
- package/types/error_type_of_field.ts +0 -3
- package/types/field_validator.ts +0 -7
- package/types/flattened_form_fields_of.ts +0 -16
- package/types/specs/flattened_form_fields_of.tests.ts +0 -43
- /package/.out/core/mobx/{flattened_list_type_defs_of.js → field_adapters_of_values.js} +0 -0
- /package/.out/core/mobx/{specs/flattened_list_type_defs_of.tests.d.ts → flattened_list_types_of_type.js} +0 -0
- /package/.out/{types/error_type_of_field.js → core/mobx/form_fields_of_field_adapters.js} +0 -0
- /package/.out/{types/field_validator.js → core/mobx/specs/flattened_list_types_of_types.tests.d.ts} +0 -0
- /package/.out/{types/flattened_form_fields_of.js → core/mobx/specs/merge_field_adapters_with_two_way_converter.d.ts} +0 -0
- /package/.out/{types/specs/flattened_form_fields_of.tests.d.ts → core/mobx/specs/merge_field_adapters_with_validators.tests.d.ts} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -453,13 +453,16 @@ var require_react_dom = __commonJS({
|
|
|
453
453
|
var index_exports = {};
|
|
454
454
|
__export(index_exports, {
|
|
455
455
|
AbstractSelectValueTypeConverter: () => AbstractSelectValueTypeConverter,
|
|
456
|
+
DefaultErrorRenderer: () => DefaultErrorRenderer,
|
|
456
457
|
FormModel: () => FormModel,
|
|
457
458
|
FormPresenter: () => FormPresenter,
|
|
458
459
|
IntegerToStringConverter: () => IntegerToStringConverter,
|
|
459
460
|
NullableToBooleanConverter: () => NullableToBooleanConverter,
|
|
460
461
|
SelectDiscriminatedUnionConverter: () => SelectDiscriminatedUnionConverter,
|
|
461
462
|
SelectLiteralConverter: () => SelectLiteralConverter,
|
|
463
|
+
SelectStringConverter: () => SelectStringConverter,
|
|
462
464
|
TrimmingStringConverter: () => TrimmingStringConverter,
|
|
465
|
+
UnreliableFieldConversionType: () => UnreliableFieldConversionType,
|
|
463
466
|
adapter: () => adapter,
|
|
464
467
|
adapterFromPrototype: () => adapterFromPrototype,
|
|
465
468
|
adapterFromTwoWayConverter: () => adapterFromTwoWayConverter,
|
|
@@ -469,7 +472,9 @@ __export(index_exports, {
|
|
|
469
472
|
createUnsafePartialObserverComponent: () => createUnsafePartialObserverComponent,
|
|
470
473
|
identityAdapter: () => identityAdapter,
|
|
471
474
|
listAdapter: () => listAdapter,
|
|
472
|
-
|
|
475
|
+
mergeAdaptersWithValidators: () => mergeAdaptersWithValidators,
|
|
476
|
+
mergeFieldAdaptersWithTwoWayConverter: () => mergeFieldAdaptersWithTwoWayConverter,
|
|
477
|
+
mergeValidators: () => mergeValidators,
|
|
473
478
|
prototypingFieldValueFactory: () => prototypingFieldValueFactory,
|
|
474
479
|
useMantineForm: () => useMantineForm,
|
|
475
480
|
usePartialComponent: () => usePartialComponent,
|
|
@@ -480,7 +485,16 @@ module.exports = __toCommonJS(index_exports);
|
|
|
480
485
|
|
|
481
486
|
// field_converters/chain_field_converter.ts
|
|
482
487
|
var import_base = require("@strictly/base");
|
|
483
|
-
|
|
488
|
+
|
|
489
|
+
// types/field_converters.ts
|
|
490
|
+
var UnreliableFieldConversionType = /* @__PURE__ */ ((UnreliableFieldConversionType2) => {
|
|
491
|
+
UnreliableFieldConversionType2[UnreliableFieldConversionType2["Success"] = 0] = "Success";
|
|
492
|
+
UnreliableFieldConversionType2[UnreliableFieldConversionType2["Failure"] = 1] = "Failure";
|
|
493
|
+
return UnreliableFieldConversionType2;
|
|
494
|
+
})(UnreliableFieldConversionType || {});
|
|
495
|
+
|
|
496
|
+
// field_converters/chain_field_converter.ts
|
|
497
|
+
function chainUnreliableFieldConverter(from, to) {
|
|
484
498
|
return function(value, valuePath, context) {
|
|
485
499
|
const fromConversion = from(value, valuePath, context);
|
|
486
500
|
switch (fromConversion.type) {
|
|
@@ -517,20 +531,37 @@ function chainFieldConverter(from, to) {
|
|
|
517
531
|
}
|
|
518
532
|
};
|
|
519
533
|
}
|
|
520
|
-
function
|
|
534
|
+
function chainAnnotatedFieldConverter(from, to) {
|
|
521
535
|
return function(value, valuePath, context) {
|
|
522
|
-
const
|
|
523
|
-
|
|
536
|
+
const {
|
|
537
|
+
required: intermediateRequired,
|
|
538
|
+
readonly: intermediateDisabled,
|
|
539
|
+
value: intermediateValue
|
|
540
|
+
} = from(value, valuePath, context);
|
|
541
|
+
const {
|
|
542
|
+
required: finalRequired,
|
|
543
|
+
readonly: finalDisabled,
|
|
544
|
+
value: finalValue
|
|
545
|
+
} = to(intermediateValue, valuePath, context);
|
|
546
|
+
return {
|
|
547
|
+
value: finalValue,
|
|
548
|
+
required: intermediateRequired || finalRequired,
|
|
549
|
+
readonly: intermediateDisabled || finalDisabled
|
|
550
|
+
};
|
|
524
551
|
};
|
|
525
552
|
}
|
|
526
553
|
|
|
527
554
|
// field_converters/identity_converter.ts
|
|
528
|
-
function
|
|
529
|
-
return function(
|
|
530
|
-
return
|
|
555
|
+
function annotatedIdentityConverter(required = false) {
|
|
556
|
+
return function(value) {
|
|
557
|
+
return {
|
|
558
|
+
value,
|
|
559
|
+
required,
|
|
560
|
+
readonly: false
|
|
561
|
+
};
|
|
531
562
|
};
|
|
532
563
|
}
|
|
533
|
-
function
|
|
564
|
+
function unreliableIdentityConverter() {
|
|
534
565
|
return function(value) {
|
|
535
566
|
return {
|
|
536
567
|
type: 0 /* Success */,
|
|
@@ -542,9 +573,14 @@ function identityConverter() {
|
|
|
542
573
|
// field_converters/list_converter.ts
|
|
543
574
|
function listConverter() {
|
|
544
575
|
return function(from, valuePath) {
|
|
545
|
-
|
|
576
|
+
const value = from.map(function(_v, i) {
|
|
546
577
|
return `${valuePath}.${i}`;
|
|
547
578
|
});
|
|
579
|
+
return {
|
|
580
|
+
value,
|
|
581
|
+
required: false,
|
|
582
|
+
readonly: false
|
|
583
|
+
};
|
|
548
584
|
};
|
|
549
585
|
}
|
|
550
586
|
|
|
@@ -558,36 +594,11 @@ var MaybeIdentityConverter = class {
|
|
|
558
594
|
return this.converter.convert(from, valuePath, context);
|
|
559
595
|
}
|
|
560
596
|
revert(from, valuePath, context) {
|
|
561
|
-
const value = this.isFrom(from) ? this.converter.convert(from, valuePath, context) : from;
|
|
597
|
+
const value = this.isFrom(from) ? this.converter.convert(from, valuePath, context).value : from;
|
|
562
598
|
return this.converter.revert(value, valuePath, context);
|
|
563
599
|
}
|
|
564
600
|
};
|
|
565
601
|
|
|
566
|
-
// field_converters/validating_converter.ts
|
|
567
|
-
function validatingConverter(validators = []) {
|
|
568
|
-
return function(value, valuePath, context) {
|
|
569
|
-
return validators.reduce(
|
|
570
|
-
function(acc, validator) {
|
|
571
|
-
if (acc.type === 0 /* Success */) {
|
|
572
|
-
const error2 = validator(value, valuePath, context);
|
|
573
|
-
if (error2 != null) {
|
|
574
|
-
return {
|
|
575
|
-
type: 1 /* Failure */,
|
|
576
|
-
error: error2,
|
|
577
|
-
value: [value]
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
return acc;
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
type: 0 /* Success */,
|
|
585
|
-
value
|
|
586
|
-
}
|
|
587
|
-
);
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
|
|
591
602
|
// field_value_factories/prototyping_field_value_factory.ts
|
|
592
603
|
function prototypingFieldValueFactory(prototype) {
|
|
593
604
|
return function() {
|
|
@@ -602,34 +613,14 @@ var FieldAdapterBuilder = class _FieldAdapterBuilder {
|
|
|
602
613
|
this.create = create;
|
|
603
614
|
this.revert = revert;
|
|
604
615
|
}
|
|
605
|
-
validateFrom(...validators) {
|
|
606
|
-
return new _FieldAdapterBuilder(
|
|
607
|
-
this.convert,
|
|
608
|
-
this.create,
|
|
609
|
-
this.revert && chainFieldConverter(
|
|
610
|
-
this.revert,
|
|
611
|
-
validatingConverter(validators)
|
|
612
|
-
)
|
|
613
|
-
);
|
|
614
|
-
}
|
|
615
|
-
validateTo(...validators) {
|
|
616
|
-
return new _FieldAdapterBuilder(
|
|
617
|
-
this.convert,
|
|
618
|
-
this.create,
|
|
619
|
-
this.revert && chainFieldConverter(
|
|
620
|
-
validatingConverter(validators),
|
|
621
|
-
this.revert
|
|
622
|
-
)
|
|
623
|
-
);
|
|
624
|
-
}
|
|
625
616
|
chain(converter, reverter) {
|
|
626
617
|
return new _FieldAdapterBuilder(
|
|
627
|
-
|
|
618
|
+
chainAnnotatedFieldConverter(
|
|
628
619
|
this.convert,
|
|
629
620
|
converter
|
|
630
621
|
),
|
|
631
622
|
this.create,
|
|
632
|
-
this.revert && reverter &&
|
|
623
|
+
this.revert && reverter && chainUnreliableFieldConverter(
|
|
633
624
|
reverter,
|
|
634
625
|
this.revert
|
|
635
626
|
)
|
|
@@ -643,17 +634,20 @@ var FieldAdapterBuilder = class _FieldAdapterBuilder {
|
|
|
643
634
|
);
|
|
644
635
|
}
|
|
645
636
|
withIdentity(isFrom) {
|
|
646
|
-
const
|
|
637
|
+
const identityConverter = new MaybeIdentityConverter({
|
|
647
638
|
convert: this.convert,
|
|
648
639
|
// should never get called if null
|
|
649
640
|
revert: this.revert
|
|
650
641
|
}, isFrom);
|
|
651
642
|
return new _FieldAdapterBuilder(
|
|
652
|
-
|
|
643
|
+
identityConverter.convert.bind(identityConverter),
|
|
653
644
|
this.create,
|
|
654
|
-
this.revert &&
|
|
645
|
+
this.revert && identityConverter.revert.bind(identityConverter)
|
|
655
646
|
);
|
|
656
647
|
}
|
|
648
|
+
get narrow() {
|
|
649
|
+
return this;
|
|
650
|
+
}
|
|
657
651
|
};
|
|
658
652
|
function adapter(converter, valueFactory, reverter) {
|
|
659
653
|
return new FieldAdapterBuilder(converter, valueFactory, reverter);
|
|
@@ -669,11 +663,11 @@ function adapterFromPrototype(converter, prototype) {
|
|
|
669
663
|
const factory2 = prototypingFieldValueFactory(prototype);
|
|
670
664
|
return typeof converter === "function" ? new FieldAdapterBuilder(converter, factory2) : new FieldAdapterBuilder(converter.convert.bind(converter), factory2, converter.revert.bind(converter));
|
|
671
665
|
}
|
|
672
|
-
function identityAdapter(prototype) {
|
|
666
|
+
function identityAdapter(prototype, required) {
|
|
673
667
|
return new FieldAdapterBuilder(
|
|
674
|
-
|
|
668
|
+
annotatedIdentityConverter(required),
|
|
675
669
|
prototypingFieldValueFactory(prototype),
|
|
676
|
-
|
|
670
|
+
unreliableIdentityConverter()
|
|
677
671
|
);
|
|
678
672
|
}
|
|
679
673
|
function listAdapter() {
|
|
@@ -688,12 +682,12 @@ var import_base2 = require("@strictly/base");
|
|
|
688
682
|
var import_define = require("@strictly/define");
|
|
689
683
|
var import_mobx = require("mobx");
|
|
690
684
|
var FormPresenter = class {
|
|
691
|
-
constructor(
|
|
692
|
-
this.
|
|
685
|
+
constructor(type, adapters) {
|
|
686
|
+
this.type = type;
|
|
693
687
|
this.adapters = adapters;
|
|
694
688
|
}
|
|
695
689
|
maybeGetAdapterForValuePath(valuePath) {
|
|
696
|
-
const typePath = (0, import_define.valuePathToTypePath)(this.
|
|
690
|
+
const typePath = (0, import_define.valuePathToTypePath)(this.type, valuePath, true);
|
|
697
691
|
return this.adapters[typePath];
|
|
698
692
|
}
|
|
699
693
|
getAdapterForValuePath(valuePath) {
|
|
@@ -704,7 +698,7 @@ var FormPresenter = class {
|
|
|
704
698
|
);
|
|
705
699
|
}
|
|
706
700
|
typePath(valuePath) {
|
|
707
|
-
return (0, import_define.valuePathToTypePath)(this.
|
|
701
|
+
return (0, import_define.valuePathToTypePath)(this.type, valuePath, true);
|
|
708
702
|
}
|
|
709
703
|
setFieldValueAndValidate(model, valuePath, value) {
|
|
710
704
|
return this.internalSetFieldValue(model, valuePath, value, true);
|
|
@@ -712,7 +706,7 @@ var FormPresenter = class {
|
|
|
712
706
|
setFieldValue(model, valuePath, value) {
|
|
713
707
|
return this.internalSetFieldValue(model, valuePath, value, false);
|
|
714
708
|
}
|
|
715
|
-
addListItem(model, valuePath, elementValue, index3) {
|
|
709
|
+
addListItem(model, valuePath, elementValue = null, index3) {
|
|
716
710
|
const listValuePath = valuePath;
|
|
717
711
|
const accessor = model.accessors[valuePath];
|
|
718
712
|
const listTypePath = this.typePath(valuePath);
|
|
@@ -845,9 +839,7 @@ var FormPresenter = class {
|
|
|
845
839
|
const conversion = revert(value, valuePath, model.value);
|
|
846
840
|
const accessor = model.getAccessorForValuePath(valuePath);
|
|
847
841
|
return (0, import_mobx.runInAction)(() => {
|
|
848
|
-
model.fieldOverrides[valuePath] =
|
|
849
|
-
value
|
|
850
|
-
};
|
|
842
|
+
model.fieldOverrides[valuePath] = [value];
|
|
851
843
|
switch (conversion.type) {
|
|
852
844
|
case 1 /* Failure */:
|
|
853
845
|
if (displayValidation) {
|
|
@@ -886,20 +878,26 @@ var FormPresenter = class {
|
|
|
886
878
|
} = adapter2;
|
|
887
879
|
const accessor = model.accessors[valuePath];
|
|
888
880
|
const value = accessor == null ? create(valuePath, model.value) : accessor.value;
|
|
889
|
-
const
|
|
881
|
+
const {
|
|
882
|
+
value: displayValue
|
|
883
|
+
} = convert(value, valuePath, model.value);
|
|
884
|
+
const key = valuePath;
|
|
890
885
|
(0, import_mobx.runInAction)(function() {
|
|
891
|
-
model.fieldOverrides[
|
|
892
|
-
value: displayValue
|
|
893
|
-
};
|
|
886
|
+
model.fieldOverrides[key] = [displayValue];
|
|
894
887
|
});
|
|
895
888
|
}
|
|
896
889
|
clearAll(model, value) {
|
|
897
890
|
(0, import_mobx.runInAction)(() => {
|
|
898
891
|
model.errors = {};
|
|
899
892
|
model.fieldOverrides = {};
|
|
900
|
-
model.value = (0, import_define.mobxCopy)(this.
|
|
893
|
+
model.value = (0, import_define.mobxCopy)(this.type, value);
|
|
901
894
|
});
|
|
902
895
|
}
|
|
896
|
+
isValuePathActive(model, valuePath) {
|
|
897
|
+
const values2 = (0, import_define.flattenValuesOfType)(this.type, model.value);
|
|
898
|
+
const keys2 = new Set(Object.keys(values2));
|
|
899
|
+
return keys2.has(valuePath);
|
|
900
|
+
}
|
|
903
901
|
validateField(model, valuePath) {
|
|
904
902
|
const {
|
|
905
903
|
convert,
|
|
@@ -908,13 +906,15 @@ var FormPresenter = class {
|
|
|
908
906
|
} = this.getAdapterForValuePath(valuePath);
|
|
909
907
|
const fieldOverride = model.fieldOverrides[valuePath];
|
|
910
908
|
const accessor = model.getAccessorForValuePath(valuePath);
|
|
911
|
-
const
|
|
909
|
+
const {
|
|
910
|
+
value: storedValue
|
|
911
|
+
} = convert(
|
|
912
912
|
accessor != null ? accessor.value : create(valuePath, model.value),
|
|
913
913
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
914
914
|
valuePath,
|
|
915
915
|
model.value
|
|
916
916
|
);
|
|
917
|
-
const value = fieldOverride != null ? fieldOverride
|
|
917
|
+
const value = fieldOverride != null ? fieldOverride[0] : storedValue;
|
|
918
918
|
const dirty = storedValue !== value;
|
|
919
919
|
(0, import_base2.assertExists)(revert, "changing field directly not supported {}", valuePath);
|
|
920
920
|
const conversion = revert(value, valuePath, model.value);
|
|
@@ -960,9 +960,11 @@ var FormPresenter = class {
|
|
|
960
960
|
return success;
|
|
961
961
|
}
|
|
962
962
|
const fieldOverride = model.fieldOverrides[adapterPath];
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
|
|
963
|
+
const {
|
|
964
|
+
value: storedValue
|
|
965
|
+
} = convert(accessor.value, valuePath, model.value);
|
|
966
|
+
const value = fieldOverride != null ? fieldOverride[0] : storedValue;
|
|
967
|
+
const dirty = fieldOverride != null && fieldOverride[0] !== storedValue;
|
|
966
968
|
const conversion = revert(value, valuePath, model.value);
|
|
967
969
|
switch (conversion.type) {
|
|
968
970
|
case 1 /* Failure */:
|
|
@@ -987,20 +989,20 @@ var FormPresenter = class {
|
|
|
987
989
|
}
|
|
988
990
|
createModel(value) {
|
|
989
991
|
return new FormModel(
|
|
990
|
-
this.
|
|
992
|
+
this.type,
|
|
991
993
|
value,
|
|
992
994
|
this.adapters
|
|
993
995
|
);
|
|
994
996
|
}
|
|
995
997
|
};
|
|
996
998
|
var FormModel = class {
|
|
997
|
-
constructor(
|
|
998
|
-
this.
|
|
999
|
+
constructor(type, value, adapters) {
|
|
1000
|
+
this.type = type;
|
|
999
1001
|
this.adapters = adapters;
|
|
1000
|
-
this.value = (0, import_define.mobxCopy)(
|
|
1001
|
-
this.flattenedTypeDefs = (0, import_define.
|
|
1002
|
-
|
|
1003
|
-
|
|
1002
|
+
this.value = (0, import_define.mobxCopy)(type, value);
|
|
1003
|
+
this.flattenedTypeDefs = (0, import_define.flattenTypesOfType)(type);
|
|
1004
|
+
const conversions = (0, import_define.flattenValueTo)(
|
|
1005
|
+
type,
|
|
1004
1006
|
this.value,
|
|
1005
1007
|
() => {
|
|
1006
1008
|
},
|
|
@@ -1016,12 +1018,12 @@ var FormModel = class {
|
|
|
1016
1018
|
if (revert == null) {
|
|
1017
1019
|
return;
|
|
1018
1020
|
}
|
|
1019
|
-
|
|
1020
|
-
return {
|
|
1021
|
-
value: displayValue
|
|
1022
|
-
};
|
|
1021
|
+
return convert(value2, valuePath, this.value);
|
|
1023
1022
|
}
|
|
1024
1023
|
);
|
|
1024
|
+
this.fieldOverrides = (0, import_base2.map)(conversions, function(_k, v) {
|
|
1025
|
+
return v && [v.value];
|
|
1026
|
+
});
|
|
1025
1027
|
}
|
|
1026
1028
|
@import_mobx.observable.ref
|
|
1027
1029
|
accessor value;
|
|
@@ -1049,8 +1051,8 @@ var FormModel = class {
|
|
|
1049
1051
|
}
|
|
1050
1052
|
@import_mobx.computed
|
|
1051
1053
|
get knownFields() {
|
|
1052
|
-
return (0, import_define.
|
|
1053
|
-
this.
|
|
1054
|
+
return (0, import_define.flattenValueTo)(
|
|
1055
|
+
this.type,
|
|
1054
1056
|
this.value,
|
|
1055
1057
|
() => {
|
|
1056
1058
|
},
|
|
@@ -1069,7 +1071,7 @@ var FormModel = class {
|
|
|
1069
1071
|
let typePath;
|
|
1070
1072
|
try {
|
|
1071
1073
|
typePath = (0, import_define.valuePathToTypePath)(
|
|
1072
|
-
this.
|
|
1074
|
+
this.type,
|
|
1073
1075
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1074
1076
|
valuePath,
|
|
1075
1077
|
true
|
|
@@ -1091,7 +1093,11 @@ var FormModel = class {
|
|
|
1091
1093
|
const fieldOverride = this.fieldOverrides[valuePath];
|
|
1092
1094
|
const accessor = this.getAccessorForValuePath(valuePath);
|
|
1093
1095
|
const fieldTypeDef = this.flattenedTypeDefs[typePath];
|
|
1094
|
-
const
|
|
1096
|
+
const {
|
|
1097
|
+
value,
|
|
1098
|
+
required,
|
|
1099
|
+
readonly
|
|
1100
|
+
} = convert(
|
|
1095
1101
|
accessor != null ? accessor.value : fieldTypeDef != null ? (0, import_define.mobxCopy)(
|
|
1096
1102
|
fieldTypeDef,
|
|
1097
1103
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
@@ -1103,11 +1109,10 @@ var FormModel = class {
|
|
|
1103
1109
|
);
|
|
1104
1110
|
const error2 = this.errors[valuePath];
|
|
1105
1111
|
return {
|
|
1106
|
-
value,
|
|
1112
|
+
value: fieldOverride != null ? fieldOverride[0] : value,
|
|
1107
1113
|
error: error2,
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
required: this.isRequired(valuePath)
|
|
1114
|
+
readonly,
|
|
1115
|
+
required
|
|
1111
1116
|
};
|
|
1112
1117
|
}
|
|
1113
1118
|
getAccessorForValuePath(valuePath) {
|
|
@@ -1116,32 +1121,107 @@ var FormModel = class {
|
|
|
1116
1121
|
@import_mobx.computed
|
|
1117
1122
|
// should only be referenced internally, so loosely typed
|
|
1118
1123
|
get accessors() {
|
|
1119
|
-
return (0, import_define.
|
|
1120
|
-
this.
|
|
1124
|
+
return (0, import_define.flattenAccessorsOfType)(
|
|
1125
|
+
this.type,
|
|
1121
1126
|
this.value,
|
|
1122
1127
|
(value) => {
|
|
1123
|
-
this.value = (0, import_define.mobxCopy)(this.
|
|
1128
|
+
this.value = (0, import_define.mobxCopy)(this.type, value);
|
|
1124
1129
|
}
|
|
1125
1130
|
);
|
|
1126
1131
|
}
|
|
1127
|
-
isDisabled(_valuePath) {
|
|
1128
|
-
return false;
|
|
1129
|
-
}
|
|
1130
|
-
isRequired(_valuePath) {
|
|
1131
|
-
return false;
|
|
1132
|
-
}
|
|
1133
1132
|
};
|
|
1134
1133
|
|
|
1134
|
+
// core/mobx/merge_field_adapters_with_two_way_converter.ts
|
|
1135
|
+
var import_base3 = require("@strictly/base");
|
|
1136
|
+
function mergeFieldAdaptersWithTwoWayConverter(fieldAdapters, converter) {
|
|
1137
|
+
return (0, import_base3.map)(
|
|
1138
|
+
fieldAdapters,
|
|
1139
|
+
function(_key, adapter2) {
|
|
1140
|
+
return {
|
|
1141
|
+
convert: chainAnnotatedFieldConverter(
|
|
1142
|
+
adapter2.convert.bind(adapter2),
|
|
1143
|
+
converter.convert.bind(converter)
|
|
1144
|
+
),
|
|
1145
|
+
revert: adapter2.revert && chainUnreliableFieldConverter(
|
|
1146
|
+
converter.revert.bind(converter),
|
|
1147
|
+
adapter2.revert.bind(adapter2)
|
|
1148
|
+
),
|
|
1149
|
+
create: adapter2.create.bind(adapter2)
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
// core/mobx/merge_field_adapters_with_validators.ts
|
|
1156
|
+
var import_base4 = require("@strictly/base");
|
|
1157
|
+
var import_define2 = require("@strictly/define");
|
|
1158
|
+
function mergeAdaptersWithValidators(adapters, validators) {
|
|
1159
|
+
return (0, import_base4.reduce)(
|
|
1160
|
+
adapters,
|
|
1161
|
+
function(acc, key, adapter2) {
|
|
1162
|
+
const validator = validators[key];
|
|
1163
|
+
if (validator == null) {
|
|
1164
|
+
acc[key] = adapter2;
|
|
1165
|
+
return acc;
|
|
1166
|
+
}
|
|
1167
|
+
function revert(to, ...params) {
|
|
1168
|
+
const result = adapter2.revert(to, ...params);
|
|
1169
|
+
if (result.type === 1 /* Failure */) {
|
|
1170
|
+
return result;
|
|
1171
|
+
}
|
|
1172
|
+
const validationError = (0, import_define2.validate)(validator, result.value, ...params);
|
|
1173
|
+
if (validationError == null) {
|
|
1174
|
+
return result;
|
|
1175
|
+
}
|
|
1176
|
+
return {
|
|
1177
|
+
type: 1 /* Failure */,
|
|
1178
|
+
value: [result.value],
|
|
1179
|
+
error: validationError
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
function convert(from, ...params) {
|
|
1183
|
+
const {
|
|
1184
|
+
required: required1,
|
|
1185
|
+
readonly: readonly1,
|
|
1186
|
+
value
|
|
1187
|
+
} = adapter2.convert(from, ...params);
|
|
1188
|
+
const {
|
|
1189
|
+
required: required2,
|
|
1190
|
+
readonly: readonly2
|
|
1191
|
+
} = (0, import_define2.annotations)(validator, ...params);
|
|
1192
|
+
return {
|
|
1193
|
+
value,
|
|
1194
|
+
required: required1 || required2,
|
|
1195
|
+
readonly: readonly1 || readonly2
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
acc[key] = {
|
|
1199
|
+
...adapter2,
|
|
1200
|
+
convert,
|
|
1201
|
+
revert: adapter2.revert && revert
|
|
1202
|
+
};
|
|
1203
|
+
return acc;
|
|
1204
|
+
},
|
|
1205
|
+
{}
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1135
1209
|
// field_converters/integer_to_string_converter.ts
|
|
1136
1210
|
var IntegerToStringConverter = class {
|
|
1137
|
-
constructor(isNanError) {
|
|
1211
|
+
constructor(isNanError, base = 10) {
|
|
1138
1212
|
this.isNanError = isNanError;
|
|
1213
|
+
this.base = base;
|
|
1139
1214
|
}
|
|
1140
1215
|
convert(from) {
|
|
1141
|
-
|
|
1216
|
+
const value = Math.floor(from).toString();
|
|
1217
|
+
return {
|
|
1218
|
+
value,
|
|
1219
|
+
required: false,
|
|
1220
|
+
readonly: false
|
|
1221
|
+
};
|
|
1142
1222
|
}
|
|
1143
1223
|
revert(from) {
|
|
1144
|
-
const value = parseInt(from,
|
|
1224
|
+
const value = parseInt(from, this.base);
|
|
1145
1225
|
if (Number.isNaN(value)) {
|
|
1146
1226
|
return {
|
|
1147
1227
|
type: 1 /* Failure */,
|
|
@@ -1158,20 +1238,25 @@ var IntegerToStringConverter = class {
|
|
|
1158
1238
|
};
|
|
1159
1239
|
|
|
1160
1240
|
// field_converters/nullable_to_boolean_converter.ts
|
|
1161
|
-
var
|
|
1241
|
+
var import_define3 = require("@strictly/define");
|
|
1162
1242
|
var NullableToBooleanConverter = class {
|
|
1163
|
-
constructor(typeDef, prototype, defaultToNull = true) {
|
|
1243
|
+
constructor(typeDef, prototype, nullType, defaultToNull = true) {
|
|
1164
1244
|
this.typeDef = typeDef;
|
|
1165
1245
|
this.prototype = prototype;
|
|
1166
|
-
this.
|
|
1246
|
+
this.nullType = nullType;
|
|
1247
|
+
this.defaultValue = defaultToNull ? this.nullType : prototype;
|
|
1167
1248
|
}
|
|
1168
1249
|
defaultValue;
|
|
1169
1250
|
convert(from) {
|
|
1170
|
-
return
|
|
1251
|
+
return {
|
|
1252
|
+
value: from !== this.nullType,
|
|
1253
|
+
required: false,
|
|
1254
|
+
readonly: false
|
|
1255
|
+
};
|
|
1171
1256
|
}
|
|
1172
1257
|
revert(from) {
|
|
1173
1258
|
if (from) {
|
|
1174
|
-
const value = (0,
|
|
1259
|
+
const value = (0, import_define3.copy)(this.typeDef, this.prototype);
|
|
1175
1260
|
return {
|
|
1176
1261
|
type: 0 /* Success */,
|
|
1177
1262
|
value
|
|
@@ -1179,7 +1264,7 @@ var NullableToBooleanConverter = class {
|
|
|
1179
1264
|
}
|
|
1180
1265
|
return {
|
|
1181
1266
|
type: 0 /* Success */,
|
|
1182
|
-
value:
|
|
1267
|
+
value: this.nullType
|
|
1183
1268
|
};
|
|
1184
1269
|
}
|
|
1185
1270
|
create() {
|
|
@@ -1188,14 +1273,15 @@ var NullableToBooleanConverter = class {
|
|
|
1188
1273
|
};
|
|
1189
1274
|
|
|
1190
1275
|
// field_converters/select_value_type_converter.ts
|
|
1191
|
-
var
|
|
1192
|
-
var
|
|
1276
|
+
var import_base5 = require("@strictly/base");
|
|
1277
|
+
var import_define4 = require("@strictly/define");
|
|
1193
1278
|
var AbstractSelectValueTypeConverter = class {
|
|
1194
|
-
constructor(typeDef, values2, defaultValueKey, noSuchValueError) {
|
|
1279
|
+
constructor(typeDef, values2, defaultValueKey, noSuchValueError, required) {
|
|
1195
1280
|
this.typeDef = typeDef;
|
|
1196
1281
|
this.values = values2;
|
|
1197
1282
|
this.defaultValueKey = defaultValueKey;
|
|
1198
1283
|
this.noSuchValueError = noSuchValueError;
|
|
1284
|
+
this.required = required;
|
|
1199
1285
|
}
|
|
1200
1286
|
revert(from) {
|
|
1201
1287
|
const prototype = from == null ? null : this.values[from];
|
|
@@ -1206,29 +1292,32 @@ var AbstractSelectValueTypeConverter = class {
|
|
|
1206
1292
|
value: null
|
|
1207
1293
|
};
|
|
1208
1294
|
}
|
|
1209
|
-
const value = prototype == null ?
|
|
1295
|
+
const value = prototype == null ? prototype : (0, import_define4.copy)(this.typeDef, prototype);
|
|
1210
1296
|
return {
|
|
1211
1297
|
type: 0 /* Success */,
|
|
1212
1298
|
value
|
|
1213
1299
|
};
|
|
1214
1300
|
}
|
|
1215
1301
|
convert(from) {
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1302
|
+
const value = from == null ? from : this.doConvert(from);
|
|
1303
|
+
return {
|
|
1304
|
+
value,
|
|
1305
|
+
required: this.required,
|
|
1306
|
+
readonly: false
|
|
1307
|
+
};
|
|
1220
1308
|
}
|
|
1221
1309
|
create() {
|
|
1222
1310
|
return this.defaultValueKey != null ? this.values[this.defaultValueKey] : null;
|
|
1223
1311
|
}
|
|
1224
1312
|
};
|
|
1225
1313
|
var SelectDiscriminatedUnionConverter = class extends AbstractSelectValueTypeConverter {
|
|
1226
|
-
constructor(
|
|
1314
|
+
constructor(type, values2, defaultValueKey, required) {
|
|
1227
1315
|
super(
|
|
1228
|
-
|
|
1316
|
+
type,
|
|
1229
1317
|
values2,
|
|
1230
1318
|
defaultValueKey,
|
|
1231
|
-
null
|
|
1319
|
+
null,
|
|
1320
|
+
required
|
|
1232
1321
|
);
|
|
1233
1322
|
}
|
|
1234
1323
|
doConvert(from) {
|
|
@@ -1241,17 +1330,38 @@ var SelectDiscriminatedUnionConverter = class extends AbstractSelectValueTypeCon
|
|
|
1241
1330
|
}
|
|
1242
1331
|
};
|
|
1243
1332
|
var SelectLiteralConverter = class extends AbstractSelectValueTypeConverter {
|
|
1244
|
-
constructor(typeDef, valuesToStrings, defaultValue, noSuchValueError) {
|
|
1333
|
+
constructor(typeDef, valuesToStrings, defaultValue, noSuchValueError, required) {
|
|
1245
1334
|
super(
|
|
1246
1335
|
typeDef,
|
|
1247
|
-
(0,
|
|
1336
|
+
(0, import_base5.reverse)(valuesToStrings),
|
|
1248
1337
|
defaultValue && valuesToStrings[defaultValue],
|
|
1249
|
-
noSuchValueError
|
|
1338
|
+
noSuchValueError,
|
|
1339
|
+
required
|
|
1250
1340
|
);
|
|
1251
1341
|
this.valuesToStrings = valuesToStrings;
|
|
1252
1342
|
}
|
|
1253
1343
|
doConvert(from) {
|
|
1254
|
-
return
|
|
1344
|
+
return this.valuesToStrings[from];
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
var SelectStringConverter = class extends AbstractSelectValueTypeConverter {
|
|
1348
|
+
constructor(typeDef, allowedValues, defaultValue, noSuchValueError, required = false) {
|
|
1349
|
+
super(
|
|
1350
|
+
typeDef,
|
|
1351
|
+
allowedValues.reduce(
|
|
1352
|
+
function(acc, value) {
|
|
1353
|
+
acc[value] = value;
|
|
1354
|
+
return acc;
|
|
1355
|
+
},
|
|
1356
|
+
{}
|
|
1357
|
+
),
|
|
1358
|
+
defaultValue,
|
|
1359
|
+
noSuchValueError,
|
|
1360
|
+
required
|
|
1361
|
+
);
|
|
1362
|
+
}
|
|
1363
|
+
doConvert(from) {
|
|
1364
|
+
return from;
|
|
1255
1365
|
}
|
|
1256
1366
|
};
|
|
1257
1367
|
|
|
@@ -1260,7 +1370,11 @@ var TrimmingStringConverter = class {
|
|
|
1260
1370
|
constructor() {
|
|
1261
1371
|
}
|
|
1262
1372
|
convert(to) {
|
|
1263
|
-
return
|
|
1373
|
+
return {
|
|
1374
|
+
value: to.trim(),
|
|
1375
|
+
required: false,
|
|
1376
|
+
readonly: false
|
|
1377
|
+
};
|
|
1264
1378
|
}
|
|
1265
1379
|
revert(from) {
|
|
1266
1380
|
return {
|
|
@@ -1270,16 +1384,40 @@ var TrimmingStringConverter = class {
|
|
|
1270
1384
|
}
|
|
1271
1385
|
};
|
|
1272
1386
|
|
|
1273
|
-
//
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1387
|
+
// field_converters/validating_converter.ts
|
|
1388
|
+
var import_define5 = require("@strictly/define");
|
|
1389
|
+
function validatingConverter(validators = []) {
|
|
1390
|
+
return function(value, valuePath, context) {
|
|
1391
|
+
return validators.reduce(
|
|
1392
|
+
function(acc, validator) {
|
|
1393
|
+
if (acc.type === 0 /* Success */) {
|
|
1394
|
+
const error2 = (0, import_define5.validate)(validator, value, valuePath, context);
|
|
1395
|
+
if (error2 != null) {
|
|
1396
|
+
return {
|
|
1397
|
+
type: 1 /* Failure */,
|
|
1398
|
+
error: error2,
|
|
1399
|
+
value: [value]
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
return acc;
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
type: 0 /* Success */,
|
|
1407
|
+
value
|
|
1408
|
+
}
|
|
1409
|
+
);
|
|
1280
1410
|
};
|
|
1281
1411
|
}
|
|
1282
1412
|
|
|
1413
|
+
// mantine/error_renderer.ts
|
|
1414
|
+
function DefaultErrorRenderer({
|
|
1415
|
+
error: error2
|
|
1416
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1417
|
+
}) {
|
|
1418
|
+
return error2;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1283
1421
|
// ../../node_modules/@mantine/core/esm/core/utils/keys/keys.mjs
|
|
1284
1422
|
function keys(object) {
|
|
1285
1423
|
return Object.keys(object);
|
|
@@ -6724,18 +6862,18 @@ function error() {
|
|
|
6724
6862
|
}
|
|
6725
6863
|
}
|
|
6726
6864
|
function createPubSub() {
|
|
6727
|
-
const
|
|
6865
|
+
const map3 = /* @__PURE__ */ new Map();
|
|
6728
6866
|
return {
|
|
6729
6867
|
emit(event, data) {
|
|
6730
6868
|
var _map$get;
|
|
6731
|
-
(_map$get =
|
|
6869
|
+
(_map$get = map3.get(event)) == null || _map$get.forEach((handler) => handler(data));
|
|
6732
6870
|
},
|
|
6733
6871
|
on(event, listener) {
|
|
6734
|
-
|
|
6872
|
+
map3.set(event, [...map3.get(event) || [], listener]);
|
|
6735
6873
|
},
|
|
6736
6874
|
off(event, listener) {
|
|
6737
6875
|
var _map$get2;
|
|
6738
|
-
|
|
6876
|
+
map3.set(event, ((_map$get2 = map3.get(event)) == null ? void 0 : _map$get2.filter((l) => l !== listener)) || []);
|
|
6739
6877
|
}
|
|
6740
6878
|
};
|
|
6741
6879
|
}
|
|
@@ -10959,7 +11097,7 @@ TextInput.classes = InputBase.classes;
|
|
|
10959
11097
|
TextInput.displayName = "@mantine/core/TextInput";
|
|
10960
11098
|
|
|
10961
11099
|
// mantine/hooks.tsx
|
|
10962
|
-
var
|
|
11100
|
+
var import_base6 = require("@strictly/base");
|
|
10963
11101
|
var import_mobx2 = require("mobx");
|
|
10964
11102
|
var import_react125 = require("react");
|
|
10965
11103
|
|
|
@@ -10982,11 +11120,37 @@ function createSimplePartialComponent(Component, curriedProps) {
|
|
|
10982
11120
|
}
|
|
10983
11121
|
);
|
|
10984
11122
|
}
|
|
10985
|
-
function createPartialComponent(Component, curriedPropsSource) {
|
|
11123
|
+
function createPartialComponent(Component, curriedPropsSource, additionalPropKeys = []) {
|
|
10986
11124
|
return (0, import_react124.forwardRef)(
|
|
10987
|
-
function(
|
|
11125
|
+
function(props, ref) {
|
|
10988
11126
|
const C = Component;
|
|
10989
|
-
const
|
|
11127
|
+
const [
|
|
11128
|
+
additionalProps,
|
|
11129
|
+
exposedProps
|
|
11130
|
+
] = additionalPropKeys.reduce(
|
|
11131
|
+
function([
|
|
11132
|
+
additionalProps2,
|
|
11133
|
+
exposedProps2
|
|
11134
|
+
], key) {
|
|
11135
|
+
const value = props[
|
|
11136
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11137
|
+
key
|
|
11138
|
+
];
|
|
11139
|
+
delete exposedProps2[key];
|
|
11140
|
+
additionalProps2[key] = value;
|
|
11141
|
+
return [
|
|
11142
|
+
additionalProps2,
|
|
11143
|
+
exposedProps2
|
|
11144
|
+
];
|
|
11145
|
+
},
|
|
11146
|
+
[
|
|
11147
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11148
|
+
{},
|
|
11149
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11150
|
+
{ ...props }
|
|
11151
|
+
]
|
|
11152
|
+
);
|
|
11153
|
+
const curriedProps = curriedPropsSource(additionalProps);
|
|
10990
11154
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
10991
11155
|
C,
|
|
10992
11156
|
{
|
|
@@ -10998,28 +11162,64 @@ function createPartialComponent(Component, curriedPropsSource) {
|
|
|
10998
11162
|
}
|
|
10999
11163
|
);
|
|
11000
11164
|
}
|
|
11001
|
-
function usePartialComponent(
|
|
11165
|
+
function usePartialComponent(curriedPropsSource, deps, Component, additionalPropKeys = []) {
|
|
11002
11166
|
return (0, import_react124.useMemo)(
|
|
11003
11167
|
function() {
|
|
11004
|
-
return createPartialComponent(
|
|
11168
|
+
return createPartialComponent(
|
|
11169
|
+
Component,
|
|
11170
|
+
curriedPropsSource,
|
|
11171
|
+
additionalPropKeys
|
|
11172
|
+
);
|
|
11005
11173
|
},
|
|
11006
11174
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11007
11175
|
[
|
|
11008
11176
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11009
11177
|
...deps,
|
|
11010
|
-
Component
|
|
11178
|
+
Component,
|
|
11179
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11180
|
+
...additionalPropKeys
|
|
11011
11181
|
]
|
|
11012
11182
|
);
|
|
11013
11183
|
}
|
|
11014
|
-
function createPartialObserverComponent(Component, curriedPropsSource) {
|
|
11015
|
-
return createUnsafePartialObserverComponent(
|
|
11184
|
+
function createPartialObserverComponent(Component, curriedPropsSource, additionalPropKeys = []) {
|
|
11185
|
+
return createUnsafePartialObserverComponent(
|
|
11186
|
+
Component,
|
|
11187
|
+
curriedPropsSource,
|
|
11188
|
+
additionalPropKeys
|
|
11189
|
+
);
|
|
11016
11190
|
}
|
|
11017
|
-
function createUnsafePartialObserverComponent(Component, curriedPropsSource) {
|
|
11191
|
+
function createUnsafePartialObserverComponent(Component, curriedPropsSource, additionalPropKeys = []) {
|
|
11018
11192
|
return (0, import_mobx_react.observer)(
|
|
11019
11193
|
(0, import_react124.forwardRef)(
|
|
11020
|
-
function(
|
|
11194
|
+
function(props, ref) {
|
|
11021
11195
|
const C = Component;
|
|
11022
|
-
const
|
|
11196
|
+
const [
|
|
11197
|
+
additionalProps,
|
|
11198
|
+
exposedProps
|
|
11199
|
+
] = additionalPropKeys.reduce(
|
|
11200
|
+
function([
|
|
11201
|
+
additionalProps2,
|
|
11202
|
+
exposedProps2
|
|
11203
|
+
], key) {
|
|
11204
|
+
const value = props[
|
|
11205
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11206
|
+
key
|
|
11207
|
+
];
|
|
11208
|
+
delete exposedProps2[key];
|
|
11209
|
+
additionalProps2[key] = value;
|
|
11210
|
+
return [
|
|
11211
|
+
additionalProps2,
|
|
11212
|
+
exposedProps2
|
|
11213
|
+
];
|
|
11214
|
+
},
|
|
11215
|
+
[
|
|
11216
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11217
|
+
{},
|
|
11218
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11219
|
+
{ ...props }
|
|
11220
|
+
]
|
|
11221
|
+
);
|
|
11222
|
+
const curriedProps = curriedPropsSource(additionalProps);
|
|
11023
11223
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
11024
11224
|
C,
|
|
11025
11225
|
{
|
|
@@ -11032,23 +11232,29 @@ function createUnsafePartialObserverComponent(Component, curriedPropsSource) {
|
|
|
11032
11232
|
)
|
|
11033
11233
|
);
|
|
11034
11234
|
}
|
|
11035
|
-
function usePartialObserverComponent(curriedPropsSource, deps, Component) {
|
|
11235
|
+
function usePartialObserverComponent(curriedPropsSource, deps, Component, additionalPropKeys = []) {
|
|
11036
11236
|
return (0, import_react124.useMemo)(
|
|
11037
11237
|
function() {
|
|
11038
|
-
return createPartialObserverComponent(
|
|
11238
|
+
return createPartialObserverComponent(
|
|
11239
|
+
Component,
|
|
11240
|
+
curriedPropsSource,
|
|
11241
|
+
additionalPropKeys
|
|
11242
|
+
);
|
|
11039
11243
|
},
|
|
11040
11244
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11041
11245
|
[
|
|
11042
11246
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11043
11247
|
...deps,
|
|
11044
|
-
Component
|
|
11248
|
+
Component,
|
|
11249
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11250
|
+
...additionalPropKeys
|
|
11045
11251
|
]
|
|
11046
11252
|
);
|
|
11047
11253
|
}
|
|
11048
11254
|
|
|
11049
11255
|
// mantine/create_checkbox.tsx
|
|
11050
11256
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
11051
|
-
function createCheckbox(valuePath, Checkbox2
|
|
11257
|
+
function createCheckbox(valuePath, Checkbox2) {
|
|
11052
11258
|
const onChange = (e) => {
|
|
11053
11259
|
this.onFieldValueChange?.(valuePath, e.target.checked);
|
|
11054
11260
|
};
|
|
@@ -11065,9 +11271,11 @@ function createCheckbox(valuePath, Checkbox2, ErrorRenderer) {
|
|
|
11065
11271
|
}
|
|
11066
11272
|
}
|
|
11067
11273
|
};
|
|
11068
|
-
const propSource = (
|
|
11274
|
+
const propSource = ({
|
|
11275
|
+
ErrorRenderer = DefaultErrorRenderer
|
|
11276
|
+
}) => {
|
|
11069
11277
|
const {
|
|
11070
|
-
|
|
11278
|
+
readonly,
|
|
11071
11279
|
required,
|
|
11072
11280
|
value,
|
|
11073
11281
|
error: error2
|
|
@@ -11076,7 +11284,7 @@ function createCheckbox(valuePath, Checkbox2, ErrorRenderer) {
|
|
|
11076
11284
|
return {
|
|
11077
11285
|
name: valuePath,
|
|
11078
11286
|
checked: value,
|
|
11079
|
-
disabled,
|
|
11287
|
+
disabled: readonly,
|
|
11080
11288
|
required,
|
|
11081
11289
|
error: error2 && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(ErrorRenderer, { error: error2 }),
|
|
11082
11290
|
onChange,
|
|
@@ -11087,7 +11295,8 @@ function createCheckbox(valuePath, Checkbox2, ErrorRenderer) {
|
|
|
11087
11295
|
};
|
|
11088
11296
|
return createUnsafePartialObserverComponent(
|
|
11089
11297
|
Checkbox2,
|
|
11090
|
-
propSource
|
|
11298
|
+
propSource,
|
|
11299
|
+
["ErrorRenderer"]
|
|
11091
11300
|
);
|
|
11092
11301
|
}
|
|
11093
11302
|
|
|
@@ -11115,7 +11324,7 @@ function DefaultList({
|
|
|
11115
11324
|
function createPill(valuePath, Pill2) {
|
|
11116
11325
|
const propSource = () => {
|
|
11117
11326
|
const {
|
|
11118
|
-
|
|
11327
|
+
readonly,
|
|
11119
11328
|
value
|
|
11120
11329
|
// note: individual pills cannot display an error!
|
|
11121
11330
|
// error,
|
|
@@ -11123,7 +11332,7 @@ function createPill(valuePath, Pill2) {
|
|
|
11123
11332
|
} = this.fields[valuePath];
|
|
11124
11333
|
return {
|
|
11125
11334
|
children: value,
|
|
11126
|
-
disabled
|
|
11335
|
+
disabled: readonly
|
|
11127
11336
|
};
|
|
11128
11337
|
};
|
|
11129
11338
|
return createUnsafePartialObserverComponent(Pill2, propSource);
|
|
@@ -11133,7 +11342,7 @@ function createPill(valuePath, Pill2) {
|
|
|
11133
11342
|
function createRadio(valuePath, value, Radio2) {
|
|
11134
11343
|
const propSource = () => {
|
|
11135
11344
|
return {
|
|
11136
|
-
disabled: this.fields[valuePath].
|
|
11345
|
+
disabled: this.fields[valuePath].readonly,
|
|
11137
11346
|
value
|
|
11138
11347
|
};
|
|
11139
11348
|
};
|
|
@@ -11145,7 +11354,7 @@ function createRadio(valuePath, value, Radio2) {
|
|
|
11145
11354
|
|
|
11146
11355
|
// mantine/create_radio_group.tsx
|
|
11147
11356
|
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
11148
|
-
function createRadioGroup(valuePath, RadioGroup2
|
|
11357
|
+
function createRadioGroup(valuePath, RadioGroup2) {
|
|
11149
11358
|
const onChange = (value) => {
|
|
11150
11359
|
this.onFieldValueChange?.(valuePath, value);
|
|
11151
11360
|
};
|
|
@@ -11162,7 +11371,7 @@ function createRadioGroup(valuePath, RadioGroup2, ErrorRenderer) {
|
|
|
11162
11371
|
}
|
|
11163
11372
|
}
|
|
11164
11373
|
};
|
|
11165
|
-
const propSource = () => {
|
|
11374
|
+
const propSource = ({ ErrorRenderer = DefaultErrorRenderer }) => {
|
|
11166
11375
|
const {
|
|
11167
11376
|
required,
|
|
11168
11377
|
value,
|
|
@@ -11179,12 +11388,12 @@ function createRadioGroup(valuePath, RadioGroup2, ErrorRenderer) {
|
|
|
11179
11388
|
onKeyUp
|
|
11180
11389
|
};
|
|
11181
11390
|
};
|
|
11182
|
-
return createUnsafePartialObserverComponent(RadioGroup2, propSource);
|
|
11391
|
+
return createUnsafePartialObserverComponent(RadioGroup2, propSource, ["ErrorRenderer"]);
|
|
11183
11392
|
}
|
|
11184
11393
|
|
|
11185
11394
|
// mantine/create_text_input.tsx
|
|
11186
11395
|
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
11187
|
-
function createTextInput(valuePath, TextInput2
|
|
11396
|
+
function createTextInput(valuePath, TextInput2) {
|
|
11188
11397
|
const onChange = (e) => {
|
|
11189
11398
|
this.onFieldValueChange?.(valuePath, e.target.value);
|
|
11190
11399
|
};
|
|
@@ -11201,9 +11410,11 @@ function createTextInput(valuePath, TextInput2, ErrorRenderer) {
|
|
|
11201
11410
|
}
|
|
11202
11411
|
}
|
|
11203
11412
|
};
|
|
11204
|
-
const propSource = (
|
|
11413
|
+
const propSource = ({
|
|
11414
|
+
ErrorRenderer = DefaultErrorRenderer
|
|
11415
|
+
}) => {
|
|
11205
11416
|
const {
|
|
11206
|
-
|
|
11417
|
+
readonly,
|
|
11207
11418
|
required,
|
|
11208
11419
|
value,
|
|
11209
11420
|
error: error2
|
|
@@ -11213,7 +11424,7 @@ function createTextInput(valuePath, TextInput2, ErrorRenderer) {
|
|
|
11213
11424
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11214
11425
|
name: valuePath,
|
|
11215
11426
|
value,
|
|
11216
|
-
disabled,
|
|
11427
|
+
disabled: readonly,
|
|
11217
11428
|
required,
|
|
11218
11429
|
error: error2 && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(ErrorRenderer, { error: error2 }),
|
|
11219
11430
|
onChange,
|
|
@@ -11224,13 +11435,14 @@ function createTextInput(valuePath, TextInput2, ErrorRenderer) {
|
|
|
11224
11435
|
};
|
|
11225
11436
|
return createUnsafePartialObserverComponent(
|
|
11226
11437
|
TextInput2,
|
|
11227
|
-
propSource
|
|
11438
|
+
propSource,
|
|
11439
|
+
["ErrorRenderer"]
|
|
11228
11440
|
);
|
|
11229
11441
|
}
|
|
11230
11442
|
|
|
11231
11443
|
// mantine/create_value_input.tsx
|
|
11232
11444
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
11233
|
-
function createValueInput(valuePath, ValueInput
|
|
11445
|
+
function createValueInput(valuePath, ValueInput) {
|
|
11234
11446
|
const onChange = (value) => {
|
|
11235
11447
|
this.onFieldValueChange?.(valuePath, value);
|
|
11236
11448
|
};
|
|
@@ -11247,9 +11459,11 @@ function createValueInput(valuePath, ValueInput, ErrorRenderer) {
|
|
|
11247
11459
|
}
|
|
11248
11460
|
}
|
|
11249
11461
|
};
|
|
11250
|
-
const propSource = (
|
|
11462
|
+
const propSource = ({
|
|
11463
|
+
ErrorRenderer = DefaultErrorRenderer
|
|
11464
|
+
}) => {
|
|
11251
11465
|
const {
|
|
11252
|
-
|
|
11466
|
+
readonly,
|
|
11253
11467
|
required,
|
|
11254
11468
|
value,
|
|
11255
11469
|
error: error2
|
|
@@ -11259,7 +11473,7 @@ function createValueInput(valuePath, ValueInput, ErrorRenderer) {
|
|
|
11259
11473
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11260
11474
|
name: valuePath,
|
|
11261
11475
|
value,
|
|
11262
|
-
disabled,
|
|
11476
|
+
disabled: readonly,
|
|
11263
11477
|
required,
|
|
11264
11478
|
error: error2 && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(ErrorRenderer, { error: error2 }),
|
|
11265
11479
|
onChange,
|
|
@@ -11270,7 +11484,8 @@ function createValueInput(valuePath, ValueInput, ErrorRenderer) {
|
|
|
11270
11484
|
};
|
|
11271
11485
|
return createUnsafePartialObserverComponent(
|
|
11272
11486
|
ValueInput,
|
|
11273
|
-
propSource
|
|
11487
|
+
propSource,
|
|
11488
|
+
["ErrorRenderer"]
|
|
11274
11489
|
);
|
|
11275
11490
|
}
|
|
11276
11491
|
|
|
@@ -11279,12 +11494,6 @@ var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
|
11279
11494
|
function SimpleSelect(props) {
|
|
11280
11495
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Select, { ...props });
|
|
11281
11496
|
}
|
|
11282
|
-
function DefaultErrorRenderer({
|
|
11283
|
-
error: error2
|
|
11284
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11285
|
-
}) {
|
|
11286
|
-
return error2;
|
|
11287
|
-
}
|
|
11288
11497
|
function useMantineForm({
|
|
11289
11498
|
onFieldValueChange,
|
|
11290
11499
|
onFieldBlur,
|
|
@@ -11335,25 +11544,25 @@ function useMantineForm({
|
|
|
11335
11544
|
return form;
|
|
11336
11545
|
}
|
|
11337
11546
|
var MantineFormImpl = class {
|
|
11338
|
-
textInputCache = new
|
|
11547
|
+
textInputCache = new import_base6.Cache(
|
|
11339
11548
|
createTextInput.bind(this)
|
|
11340
11549
|
);
|
|
11341
|
-
valueInputCache = new
|
|
11550
|
+
valueInputCache = new import_base6.Cache(
|
|
11342
11551
|
createValueInput.bind(this)
|
|
11343
11552
|
);
|
|
11344
|
-
checkboxCache = new
|
|
11553
|
+
checkboxCache = new import_base6.Cache(
|
|
11345
11554
|
createCheckbox.bind(this)
|
|
11346
11555
|
);
|
|
11347
|
-
radioGroupCache = new
|
|
11556
|
+
radioGroupCache = new import_base6.Cache(
|
|
11348
11557
|
createRadioGroup.bind(this)
|
|
11349
11558
|
);
|
|
11350
|
-
radioCache = new
|
|
11559
|
+
radioCache = new import_base6.Cache(
|
|
11351
11560
|
createRadio.bind(this)
|
|
11352
11561
|
);
|
|
11353
|
-
pillCache = new
|
|
11562
|
+
pillCache = new import_base6.Cache(
|
|
11354
11563
|
createPill.bind(this)
|
|
11355
11564
|
);
|
|
11356
|
-
listCache = new
|
|
11565
|
+
listCache = new import_base6.Cache(
|
|
11357
11566
|
createList.bind(this)
|
|
11358
11567
|
);
|
|
11359
11568
|
@import_mobx2.observable.ref
|
|
@@ -11365,44 +11574,39 @@ var MantineFormImpl = class {
|
|
|
11365
11574
|
constructor(fields) {
|
|
11366
11575
|
this.fields = fields;
|
|
11367
11576
|
}
|
|
11368
|
-
textInput(valuePath, TextInput2 = TextInput
|
|
11577
|
+
textInput(valuePath, TextInput2 = TextInput) {
|
|
11369
11578
|
return this.textInputCache.retrieveOrCreate(
|
|
11370
11579
|
valuePath,
|
|
11371
11580
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11372
|
-
TextInput2
|
|
11373
|
-
ErrorRenderer
|
|
11581
|
+
TextInput2
|
|
11374
11582
|
);
|
|
11375
11583
|
}
|
|
11376
|
-
valueInput(valuePath, ValueInput
|
|
11584
|
+
valueInput(valuePath, ValueInput) {
|
|
11377
11585
|
return this.valueInputCache.retrieveOrCreate(
|
|
11378
11586
|
valuePath,
|
|
11379
11587
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11380
|
-
ValueInput
|
|
11381
|
-
ErrorRenderer
|
|
11588
|
+
ValueInput
|
|
11382
11589
|
);
|
|
11383
11590
|
}
|
|
11384
|
-
select(valuePath
|
|
11591
|
+
select(valuePath) {
|
|
11385
11592
|
return this.valueInputCache.retrieveOrCreate(
|
|
11386
11593
|
valuePath,
|
|
11387
11594
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11388
|
-
SimpleSelect
|
|
11389
|
-
ErrorRenderer
|
|
11595
|
+
SimpleSelect
|
|
11390
11596
|
);
|
|
11391
11597
|
}
|
|
11392
|
-
checkbox(valuePath, Checkbox2 = Checkbox
|
|
11598
|
+
checkbox(valuePath, Checkbox2 = Checkbox) {
|
|
11393
11599
|
return this.checkboxCache.retrieveOrCreate(
|
|
11394
11600
|
valuePath,
|
|
11395
11601
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11396
|
-
Checkbox2
|
|
11397
|
-
ErrorRenderer
|
|
11602
|
+
Checkbox2
|
|
11398
11603
|
);
|
|
11399
11604
|
}
|
|
11400
|
-
radioGroup(valuePath, RadioGroup2 = Radio.Group
|
|
11605
|
+
radioGroup(valuePath, RadioGroup2 = Radio.Group) {
|
|
11401
11606
|
return this.radioGroupCache.retrieveOrCreate(
|
|
11402
11607
|
valuePath,
|
|
11403
11608
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
11404
|
-
RadioGroup2
|
|
11405
|
-
ErrorRenderer
|
|
11609
|
+
RadioGroup2
|
|
11406
11610
|
);
|
|
11407
11611
|
}
|
|
11408
11612
|
radio(valuePath, value, Radio2 = Radio) {
|
|
@@ -11427,16 +11631,58 @@ var MantineFormImpl = class {
|
|
|
11427
11631
|
);
|
|
11428
11632
|
}
|
|
11429
11633
|
};
|
|
11634
|
+
|
|
11635
|
+
// types/merge_validators.ts
|
|
11636
|
+
var import_define6 = require("@strictly/define");
|
|
11637
|
+
function mergeValidators(validators1, validators2) {
|
|
11638
|
+
const validators = {
|
|
11639
|
+
...validators1,
|
|
11640
|
+
...validators2
|
|
11641
|
+
};
|
|
11642
|
+
const keys1 = new Set(Object.keys(validators1));
|
|
11643
|
+
const keys2 = new Set(Object.keys(validators2));
|
|
11644
|
+
return Array.from(keys1.intersection(keys2)).reduce(
|
|
11645
|
+
function(validators3, key) {
|
|
11646
|
+
const validator1 = validators1[key];
|
|
11647
|
+
const validator2 = validators2[key];
|
|
11648
|
+
validators3[key] = {
|
|
11649
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11650
|
+
validate: function(value, valuePath, context) {
|
|
11651
|
+
const error2 = (0, import_define6.validate)(validator1, value, valuePath, context);
|
|
11652
|
+
if (error2 != null) {
|
|
11653
|
+
return error2;
|
|
11654
|
+
}
|
|
11655
|
+
return (0, import_define6.validate)(validator2, value, valuePath, context);
|
|
11656
|
+
},
|
|
11657
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11658
|
+
annotations: function(valuePath, context) {
|
|
11659
|
+
const annotations1 = (0, import_define6.annotations)(validator1, valuePath, context);
|
|
11660
|
+
const annotations22 = (0, import_define6.annotations)(validator2, valuePath, context);
|
|
11661
|
+
return {
|
|
11662
|
+
readonly: annotations1.readonly || annotations22.readonly,
|
|
11663
|
+
required: annotations1.required || annotations22.required
|
|
11664
|
+
};
|
|
11665
|
+
}
|
|
11666
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11667
|
+
};
|
|
11668
|
+
return validators3;
|
|
11669
|
+
},
|
|
11670
|
+
validators
|
|
11671
|
+
);
|
|
11672
|
+
}
|
|
11430
11673
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11431
11674
|
0 && (module.exports = {
|
|
11432
11675
|
AbstractSelectValueTypeConverter,
|
|
11676
|
+
DefaultErrorRenderer,
|
|
11433
11677
|
FormModel,
|
|
11434
11678
|
FormPresenter,
|
|
11435
11679
|
IntegerToStringConverter,
|
|
11436
11680
|
NullableToBooleanConverter,
|
|
11437
11681
|
SelectDiscriminatedUnionConverter,
|
|
11438
11682
|
SelectLiteralConverter,
|
|
11683
|
+
SelectStringConverter,
|
|
11439
11684
|
TrimmingStringConverter,
|
|
11685
|
+
UnreliableFieldConversionType,
|
|
11440
11686
|
adapter,
|
|
11441
11687
|
adapterFromPrototype,
|
|
11442
11688
|
adapterFromTwoWayConverter,
|
|
@@ -11446,7 +11692,9 @@ var MantineFormImpl = class {
|
|
|
11446
11692
|
createUnsafePartialObserverComponent,
|
|
11447
11693
|
identityAdapter,
|
|
11448
11694
|
listAdapter,
|
|
11449
|
-
|
|
11695
|
+
mergeAdaptersWithValidators,
|
|
11696
|
+
mergeFieldAdaptersWithTwoWayConverter,
|
|
11697
|
+
mergeValidators,
|
|
11450
11698
|
prototypingFieldValueFactory,
|
|
11451
11699
|
useMantineForm,
|
|
11452
11700
|
usePartialComponent,
|