Skip to content

Commit

Permalink
release(workspace): v8.7.0 release
Browse files Browse the repository at this point in the history
feat: added step, enforceStep to numberField

- added isNumberDivisibleBy()
- added nearestDivisibleValues()

feat: added number field

refactor: added ReadFirestoreModelKeyInput

- renamed FirestoreModelKeyPairObject to FirestoreModelCollectionAndIdPairObject
  • Loading branch information
ci committed Jun 23, 2022
1 parent d4b0095 commit 7c926dd
Show file tree
Hide file tree
Showing 65 changed files with 384 additions and 51 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)


### Features

* added number field ([387b002](https://github.com/dereekb/dbx-components/commit/387b002509a2409c707d098512540add06a7b86a))
* added step, enforceStep to numberField ([a57b1c7](https://github.com/dereekb/dbx-components/commit/a57b1c7f9f0194874e4dcadafabf01ee49d44c48))



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
4 changes: 4 additions & 0 deletions apps/demo-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
4 changes: 4 additions & 0 deletions apps/demo-e2e/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
10 changes: 10 additions & 0 deletions apps/demo/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)


### Features

* added number field ([387b002](https://github.com/dereekb/dbx-components/commit/387b002509a2409c707d098512540add06a7b86a))
* added step, enforceStep to numberField ([a57b1c7](https://github.com/dereekb/dbx-components/commit/a57b1c7f9f0194874e4dcadafabf01ee49d44c48))



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<p>There are also several helper builders available.</p>
<doc-form-example-form [dbxFormlyFields]="textFields"></doc-form-example-form>
</doc-feature-example>
<doc-feature-example header="numberField()" hint="Used to configure a number field.">
<doc-form-example-form [dbxFormlyFields]="numberFields"></doc-form-example-form>
</doc-feature-example>
<doc-feature-example header="textAreaField()" hint="Used to configure a text area.">
<doc-form-example-form [dbxFormlyFields]="textAreaField"></doc-form-example-form>
</doc-feature-example>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { FormlyFieldConfig } from '@ngx-formly/core';
import { Component } from '@angular/core';
import { addressField, addressListField, cityField, countryField, emailField, phoneField, nameField, phoneAndLabelSectionField, wrappedPhoneAndLabelField, repeatArrayField, stateField, textAreaField, textField, zipCodeField, phoneListField, dateTimeField, DbxDateTimeFieldTimeMode, toggleField, checkboxField } from '@dereekb/dbx-form';
import { addressField, addressListField, cityField, countryField, emailField, phoneField, nameField, phoneAndLabelSectionField, wrappedPhoneAndLabelField, repeatArrayField, stateField, textAreaField, textField, zipCodeField, phoneListField, dateTimeField, DbxDateTimeFieldTimeMode, toggleField, checkboxField, numberField } from '@dereekb/dbx-form';

@Component({
templateUrl: './value.component.html'
})
export class DocFormValueComponent {
readonly textFields: FormlyFieldConfig[] = [textField({ key: 'test', label: 'Text Field', placeholder: 'Placeholder', required: true, minLength: 4, maxLength: 15 }), nameField(), emailField(), cityField(), stateField(), countryField(), zipCodeField()];
readonly textFields: FormlyFieldConfig[] = [textField({ key: 'test', label: 'Text Field', description: 'A required text field.', placeholder: 'Placeholder', required: true, minLength: 4, maxLength: 15 }), nameField(), emailField(), cityField(), stateField(), countryField(), zipCodeField()];

readonly textAreaField: FormlyFieldConfig[] = [textAreaField({ key: 'test', label: 'Text Area Field', placeholder: 'Placeholder', required: true })];
readonly numberFields: FormlyFieldConfig[] = [
//
numberField({ key: 'test', label: 'Number Field', description: 'A number between 0 and 100.', placeholder: 'Placeholder', min: 0, max: 100 }),
numberField({ key: 'steptest', label: 'Number Field With Step', description: 'Any number, but increases in steps of 5.', step: 5 }),
numberField({ key: 'enforcedsteptest', label: 'Number Divisible by 5', description: 'Any number divisible by 5.', step: 5, enforceStep: true })
];

readonly textAreaField: FormlyFieldConfig[] = [textAreaField({ key: 'test', label: 'Text Area Field', description: 'A required text area field.', placeholder: 'Placeholder', required: true })];

readonly dateTimeFields: FormlyFieldConfig[] = [
dateTimeField({ key: 'date', required: true, description: 'This is the default date field that requires the user pick a date and time.' }),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LOREM } from '../../shared/lorem';
import { Component } from '@angular/core';
import { AbstractDbxListGridViewDirective, DEFAULT_DBX_VALUE_LIST_GRID_DIRECTIVE_TEMPLATE, AbstractDbxSelectionListWrapperDirective, AbstractDbxValueListViewItemComponent, AbstractDbxSelectionListViewDirective, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, DbxSelectionValueListViewConfig, provideDbxListView, DEFAULT_DBX_SELECTION_VALUE_LIST_DIRECTIVE_TEMPLATE, AbstractDbxListWrapperDirective, DbxValueListGridViewConfig } from '@dereekb/dbx-web';
import { AbstractDbxListGridViewDirective, DEFAULT_DBX_VALUE_LIST_GRID_DIRECTIVE_TEMPLATE, AbstractDbxValueListViewItemComponent, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, provideDbxListView, AbstractDbxListWrapperDirective, DbxValueListGridViewConfig } from '@dereekb/dbx-web';
import { of } from 'rxjs';
import { DocValue, DocValueWithSelection } from './item.list';

Expand Down
4 changes: 4 additions & 0 deletions components/demo-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion components/demo-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dereekb/demo-components",
"version": "8.6.1",
"version": "8.7.0",
"peerDependencies": {
"@angular/common": "^13.3.0",
"@angular/core": "^13.3.0"
Expand Down
4 changes: 4 additions & 0 deletions components/demo-firebase/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion components/demo-firebase/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@dereekb/demo-firebase",
"version": "8.6.1",
"version": "8.7.0",
"type": "commonjs"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dereekb/dbx-components",
"version": "8.6.1",
"version": "8.7.0",
"license": "MIT",
"scripts": {
"postinstall": "ngcc --properties es2015 browser module main",
Expand Down
4 changes: 4 additions & 0 deletions packages/browser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@dereekb/browser",
"version": "8.6.1",
"version": "8.7.0",
"type": "commonjs"
}
4 changes: 4 additions & 0 deletions packages/date/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion packages/date/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@dereekb/date",
"version": "8.6.1",
"version": "8.7.0",
"type": "commonjs"
}
4 changes: 4 additions & 0 deletions packages/dbx-analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion packages/dbx-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dereekb/dbx-analytics",
"version": "8.6.1",
"version": "8.7.0",
"peerDependencies": {
"@angular/common": "^13.1.0",
"@angular/core": "^13.1.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/dbx-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion packages/dbx-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dereekb/dbx-core",
"version": "8.6.1",
"version": "8.7.0",
"peerDependencies": {
"@angular/common": "^13.0.0",
"@angular/core": "^13.0.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/dbx-firebase/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion packages/dbx-firebase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dereekb/dbx-firebase",
"version": "8.6.1",
"version": "8.7.0",
"peerDependencies": {
"@angular/common": "^13.0.0",
"@angular/core": "^13.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/dbx-firebase/src/lib/model/store/store.document.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Observable, shareReplay, distinctUntilChanged, map, switchMap, combineLatest, Subscription, of } from 'rxjs';
import { DocumentSnapshot, DocumentReference, FirestoreCollection, FirestoreDocument, documentDataWithId, DocumentDataWithId, FirestoreModelId, FirestoreModelKey, FirestoreCollectionLike, FirestoreModelIdentity, firestoreModelIdsFromKey, firestoreModelKeyPartPairs, FirestoreModelCollectionAndIdPair, firestoreModelKeyPairObject, FirestoreModelKeyPairObject } from '@dereekb/firebase';
import { DocumentSnapshot, DocumentReference, FirestoreCollection, FirestoreDocument, documentDataWithId, DocumentDataWithId, FirestoreModelId, FirestoreModelKey, FirestoreCollectionLike, FirestoreModelIdentity, firestoreModelIdsFromKey, firestoreModelKeyPartPairs, FirestoreModelCollectionAndIdPair, firestoreModelKeyPairObject, FirestoreModelCollectionAndIdPairObject } from '@dereekb/firebase';
import { filterMaybe, LoadingState, beginLoading, successResult, loadingStateFromObs, errorResult, ObservableOrValue } from '@dereekb/rxjs';
import { Maybe, isMaybeSo } from '@dereekb/util';
import { LockSetComponent, LockSetComponentStore } from '@dereekb/dbx-core';
Expand All @@ -25,7 +25,7 @@ export interface DbxFirebaseDocumentStore<T, D extends FirestoreDocument<T> = Fi

readonly keyModelIds$: Observable<FirestoreModelId[]>;
readonly keyPairs$: Observable<FirestoreModelCollectionAndIdPair[]>;
readonly keyPairObject$: Observable<FirestoreModelKeyPairObject>;
readonly keyPairObject$: Observable<FirestoreModelCollectionAndIdPairObject>;

readonly documentLoadingState$: Observable<LoadingState<D>>;
readonly snapshot$: Observable<DocumentSnapshot<T>>;
Expand Down Expand Up @@ -150,7 +150,7 @@ export class AbstractDbxFirebaseDocumentStore<T, D extends FirestoreDocument<T>

readonly keyModelIds$: Observable<FirestoreModelId[]> = this.key$.pipe(map(firestoreModelIdsFromKey), shareReplay(1));
readonly keyPairs$: Observable<FirestoreModelCollectionAndIdPair[]> = this.key$.pipe(map(firestoreModelKeyPartPairs), filterMaybe(), shareReplay(1));
readonly keyPairObject$: Observable<FirestoreModelKeyPairObject> = this.key$.pipe(map(firestoreModelKeyPairObject), filterMaybe(), shareReplay(1));
readonly keyPairObject$: Observable<FirestoreModelCollectionAndIdPairObject> = this.key$.pipe(map(firestoreModelKeyPairObject), filterMaybe(), shareReplay(1));

readonly ref$: Observable<DocumentReference<T>> = this.document$.pipe(
map((x) => x.documentRef),
Expand Down
10 changes: 10 additions & 0 deletions packages/dbx-form/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

# [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)


### Features

* added number field ([387b002](https://github.com/dereekb/dbx-components/commit/387b002509a2409c707d098512540add06a7b86a))
* added step, enforceStep to numberField ([a57b1c7](https://github.com/dereekb/dbx-components/commit/a57b1c7f9f0194874e4dcadafabf01ee49d44c48))



## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)


Expand Down
2 changes: 1 addition & 1 deletion packages/dbx-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dereekb/dbx-form",
"version": "8.6.1",
"version": "8.7.0",
"peerDependencies": {
"@angular/common": "^13.0.0",
"@angular/core": "^13.0.0"
Expand Down
57 changes: 56 additions & 1 deletion packages/dbx-form/src/lib/formly/field/field.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { mergeObjects, filterFromPOJO, mergeObjectsFunction, filterFromPOJOFunction, FilterKeyValueTuplesInput, GeneralFilterFromPOJOFunction } from '@dereekb/util';
import { AsyncValidatorFn, ValidatorFn } from '@angular/forms';
import { mergeObjects, filterFromPOJO, mergeObjectsFunction, filterFromPOJOFunction, FilterKeyValueTuplesInput, GeneralFilterFromPOJOFunction, ArrayOrValue, Maybe, asArray, objectHasNoKeys } from '@dereekb/util';
import { FormlyFieldConfig, FormlyFieldProps } from '@ngx-formly/core';
import { ValidationMessageOption } from '@ngx-formly/core/lib/models';

export interface FieldConfig {
key: string;
Expand Down Expand Up @@ -111,3 +113,56 @@ export function disableFormlyFieldAutofillAttributes(): { name: string; autocomp
autocomplete: 'off'
};
}

export type FormlyMessageProperties = {
[messageProperties: string]: ValidationMessageOption['message'];
};

export interface ValidatorsForFieldConfigInput {
validators?: ArrayOrValue<ValidatorFn>;
asyncValidators?: ArrayOrValue<AsyncValidatorFn>;
messages?: Maybe<FormlyMessageProperties>;
}

export type ValidatorsForFieldConfig = {
validation?: {
messages?: FormlyMessageProperties;
};
validators?: {
validation: ValidatorFn[];
};
asyncValidators?: {
validation: AsyncValidatorFn[];
};
};

export function validatorsForFieldConfig(input: ValidatorsForFieldConfigInput): Maybe<ValidatorsForFieldConfig> {
const validators: ValidatorFn[] = asArray(input.validators);
const asyncValidators: AsyncValidatorFn[] = asArray(input.asyncValidators);
const messages: Maybe<FormlyMessageProperties> = input.messages;
let config: Maybe<ValidatorsForFieldConfig>;

if (messages || validators.length || asyncValidators.length) {
config = {};

if (validators.length) {
config.validators = {
validation: validators
};
}

if (asyncValidators.length) {
config.validators = {
validation: asyncValidators
};
}

if (messages && !objectHasNoKeys(messages)) {
config.validation = {
messages
};
}
}

return config;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FormlyFieldConfig } from '@ngx-formly/core/lib/core';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { LabeledFieldConfig, formlyField } from '../field';

export type HiddenFieldConfig = Pick<LabeledFieldConfig, 'key' | 'required'>;
Expand Down
1 change: 1 addition & 0 deletions packages/dbx-form/src/lib/formly/field/value/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './array';
export * from './boolean';
export * from './date';
export * from './number';
export * from './enum';
export * from './phone';
export * from './text';
Expand Down
2 changes: 2 additions & 0 deletions packages/dbx-form/src/lib/formly/field/value/number/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './number.field';
export * from './number.field.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { FormlyMaterialModule } from '@ngx-formly/material';
import { NgModule } from '@angular/core';
import { DbxFormFormlyWrapperModule } from '../../wrapper/form.wrapper.module';

@NgModule({
imports: [FormlyMaterialModule],
declarations: [],
exports: [DbxFormFormlyWrapperModule]
})
export class DbxFormFormlyNumberFieldModule {}
Loading

0 comments on commit 7c926dd

Please sign in to comment.