@dereekb/dbx-form 9.25.10 → 9.25.12
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/esm2020/lib/formly/field/selection/selection.field.mjs +7 -3
- package/esm2020/lib/formly/formly.context.mjs +6 -5
- package/esm2020/lib/formly/formly.form.component.mjs +16 -4
- package/fesm2015/dereekb-dbx-form.mjs +23 -9
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form.mjs +25 -9
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/extension/calendar/_calendar.scss +4 -1
- package/lib/formly/field/selection/selection.field.d.ts +6 -6
- package/lib/formly/formly.form.component.d.ts +2 -1
- package/mapbox/package.json +4 -4
- package/package.json +4 -4
|
@@ -26,7 +26,7 @@ import * as i1$1 from '@angular/material/button';
|
|
|
26
26
|
import { MatButtonModule } from '@angular/material/button';
|
|
27
27
|
import * as i3$2 from '@angular/flex-layout/flex';
|
|
28
28
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
29
|
-
import { objectIsEmpty, mergeObjectsFunction, filterFromPOJOFunction, mergeObjects, filterFromPOJO, asArray, objectHasNoKeys, addPlusPrefixToNumber, convertMaybeToArray, isSelectedDecisionFunctionFactory, readKeysFrom, hasDifferentValues, makeValuesGroupMap, separateValues, filterUniqueValues, searchStringFilterFunction, caseInsensitiveFilterByIndexOfDecisionFactory, sortByStringFunction, mergeIntoArray, lastValue, arrayToMap, setContainsAllValues, addToSetCopy, setsAreEquivalent, filterMaybeValues, mergeArrays, cachedGetter, makeGetter, asDecisionFunction, getValueFromGetter, asGetter, isISO8601DayStringStart, mapIdentityFunction, MS_IN_MINUTE, isMonthDaySlashDate, HAS_WEBSITE_DOMAIN_NAME_REGEX, KeyValueTypleValueFilter, valuesFromPOJO, allObjectsAreEqual, isNumberDivisibleBy, nearestDivisibleValues, isE164PhoneNumber as isE164PhoneNumber$1, isValidPhoneExtensionNumber, e164PhoneNumberExtensionPair, mapMaybeFunction, transformNumberFunction, concatArrays, e164PhoneNumberFromE164PhoneNumberExtensionPair, transformStringFunction, US_STATE_CODE_STRING_REGEX, ZIP_CODE_STRING_REGEX, LAT_LNG_PATTERN, BooleanStringKeyArrayUtilityInstance, capitalizeFirstLetter } from '@dereekb/util';
|
|
29
|
+
import { objectIsEmpty, mergeObjectsFunction, filterFromPOJOFunction, mergeObjects, filterFromPOJO, asArray, objectHasNoKeys, addPlusPrefixToNumber, convertMaybeToArray, isSelectedDecisionFunctionFactory, readKeysFrom, hasDifferentValues, makeValuesGroupMap, separateValues, filterUniqueValues, searchStringFilterFunction, caseInsensitiveFilterByIndexOfDecisionFactory, sortByStringFunction, mergeIntoArray, lastValue, arrayToMap, setContainsAllValues, addToSetCopy, setsAreEquivalent, filterMaybeValues, mergeArrays, firstValue, cachedGetter, makeGetter, asDecisionFunction, getValueFromGetter, asGetter, isISO8601DayStringStart, mapIdentityFunction, MS_IN_MINUTE, isMonthDaySlashDate, HAS_WEBSITE_DOMAIN_NAME_REGEX, KeyValueTypleValueFilter, valuesFromPOJO, allObjectsAreEqual, isNumberDivisibleBy, nearestDivisibleValues, isE164PhoneNumber as isE164PhoneNumber$1, isValidPhoneExtensionNumber, e164PhoneNumberExtensionPair, mapMaybeFunction, transformNumberFunction, concatArrays, e164PhoneNumberFromE164PhoneNumberExtensionPair, transformStringFunction, US_STATE_CODE_STRING_REGEX, ZIP_CODE_STRING_REGEX, LAT_LNG_PATTERN, BooleanStringKeyArrayUtilityInstance, capitalizeFirstLetter } from '@dereekb/util';
|
|
30
30
|
import * as i2$2 from '@angular/material/slide-toggle';
|
|
31
31
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
32
32
|
import * as i2$3 from '@angular/flex-layout/extended';
|
|
@@ -3164,15 +3164,18 @@ function valueSelectionField(config) {
|
|
|
3164
3164
|
};
|
|
3165
3165
|
}
|
|
3166
3166
|
const options = addClearOption ? asObservable(inputOptions).pipe(map(addValueSelectionOptionFunction(typeof addClearOption === 'string' ? addClearOption : undefined))) : inputOptions;
|
|
3167
|
+
let parsers = undefined;
|
|
3168
|
+
parsers = config.multiple !== true ? [firstValue] : [convertMaybeToArray];
|
|
3167
3169
|
return formlyField({
|
|
3168
3170
|
key,
|
|
3169
3171
|
type: native ? 'native-select' : 'select',
|
|
3170
3172
|
...propsAndConfigForFieldConfig(config, {
|
|
3171
3173
|
...materialFormField,
|
|
3172
3174
|
options,
|
|
3173
|
-
multiple: config.multiple
|
|
3175
|
+
multiple: config.multiple,
|
|
3174
3176
|
...selectAllOptionConfig
|
|
3175
|
-
})
|
|
3177
|
+
}),
|
|
3178
|
+
parsers
|
|
3176
3179
|
});
|
|
3177
3180
|
}
|
|
3178
3181
|
function addValueSelectionOptionFunction(label) {
|
|
@@ -5754,8 +5757,8 @@ class DbxFormlyContext {
|
|
|
5754
5757
|
this._initialValue = new BehaviorSubject(undefined);
|
|
5755
5758
|
this._disabled = new BehaviorSubject(undefined);
|
|
5756
5759
|
this._delegate = new BehaviorSubject(undefined);
|
|
5757
|
-
this.fields$ = this._fields.pipe(filterMaybe());
|
|
5758
|
-
this.disabled$ = this._disabled.pipe(filterMaybe());
|
|
5760
|
+
this.fields$ = this._fields.pipe(filterMaybe(), shareReplay(1));
|
|
5761
|
+
this.disabled$ = this._disabled.pipe(filterMaybe(), shareReplay(1));
|
|
5759
5762
|
this.stream$ = this._delegate.pipe(distinctUntilChanged(), switchMap((x) => (x ? x.stream$ : of(DbxFormlyContext.INITIAL_STATE))), shareReplay(1));
|
|
5760
5763
|
}
|
|
5761
5764
|
destroy() {
|
|
@@ -5771,7 +5774,7 @@ class DbxFormlyContext {
|
|
|
5771
5774
|
if (delegate != null) {
|
|
5772
5775
|
delegate.init({
|
|
5773
5776
|
fields: this.fields$,
|
|
5774
|
-
initialDisabled: this.
|
|
5777
|
+
initialDisabled: this.disabled,
|
|
5775
5778
|
initialValue: this._initialValue.value
|
|
5776
5779
|
});
|
|
5777
5780
|
}
|
|
@@ -5809,7 +5812,8 @@ class DbxFormlyContext {
|
|
|
5809
5812
|
return this._disabled.asObservable();
|
|
5810
5813
|
}
|
|
5811
5814
|
setDisabled(key, disabled = true) {
|
|
5812
|
-
|
|
5815
|
+
const nextDisabled = BooleanStringKeyArrayUtilityInstance.set(this.disabled, key ?? DEFAULT_FORM_DISABLED_KEY, disabled);
|
|
5816
|
+
this._disabled.next(nextDisabled);
|
|
5813
5817
|
if (this._delegate.value) {
|
|
5814
5818
|
this._delegate.value.setDisabled(key, disabled);
|
|
5815
5819
|
}
|
|
@@ -5955,6 +5959,7 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
5955
5959
|
this._reset = new BehaviorSubject(new Date());
|
|
5956
5960
|
this._forceUpdate = new Subject();
|
|
5957
5961
|
this._disabledSub = new SubscriptionObject();
|
|
5962
|
+
this._enforceDisabledSub = new SubscriptionObject();
|
|
5958
5963
|
this.form = new FormGroup({});
|
|
5959
5964
|
this.model = {};
|
|
5960
5965
|
this.options = {};
|
|
@@ -6012,8 +6017,9 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
6012
6017
|
}
|
|
6013
6018
|
ngOnInit() {
|
|
6014
6019
|
this.context.setDelegate(this);
|
|
6015
|
-
|
|
6016
|
-
const isDisabled = BooleanStringKeyArrayUtilityInstance.isTrue(
|
|
6020
|
+
const resyncDisabledState = () => {
|
|
6021
|
+
const isDisabled = BooleanStringKeyArrayUtilityInstance.isTrue(this._disabled.value);
|
|
6022
|
+
let change = false;
|
|
6017
6023
|
if (this.form.disabled !== isDisabled) {
|
|
6018
6024
|
if (isDisabled) {
|
|
6019
6025
|
this.form.disable({ emitEvent: true });
|
|
@@ -6021,7 +6027,16 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
6021
6027
|
else {
|
|
6022
6028
|
this.form.enable({ emitEvent: true });
|
|
6023
6029
|
}
|
|
6030
|
+
change = true;
|
|
6024
6031
|
}
|
|
6032
|
+
return change;
|
|
6033
|
+
};
|
|
6034
|
+
this._disabledSub.subscription = this._disabled.pipe(distinctUntilChanged(hasDifferentValues)).subscribe((disabled) => {
|
|
6035
|
+
resyncDisabledState();
|
|
6036
|
+
});
|
|
6037
|
+
// NOTE: Form sometimes becomes undisabled somewhere/somehow. Re-enforce the disabled state where necessary.
|
|
6038
|
+
this._enforceDisabledSub.subscription = this.form.statusChanges.pipe(throttleTime(50, undefined, { leading: true, trailing: true })).subscribe((change) => {
|
|
6039
|
+
resyncDisabledState();
|
|
6025
6040
|
});
|
|
6026
6041
|
}
|
|
6027
6042
|
ngOnDestroy() {
|
|
@@ -6034,6 +6049,7 @@ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
|
|
|
6034
6049
|
this._forceUpdate.complete();
|
|
6035
6050
|
this._disabled.complete();
|
|
6036
6051
|
this._disabledSub.destroy();
|
|
6052
|
+
this._enforceDisabledSub.destroy();
|
|
6037
6053
|
});
|
|
6038
6054
|
}
|
|
6039
6055
|
// MARK: Delegate
|