@futdevpro/fsm-dynamo 1.20.7 → 1.20.8
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/__documentations/2026-08-23-forms-v2-color-picker-settings.md +7 -4
- package/build/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.d.ts.map +1 -1
- package/build/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.js +15 -0
- package/build/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.js.map +1 -1
- package/package.json +1 -1
- package/src/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.ts +24 -1
- package/src/_modules/ngx-models/_models/control-models/forms-new/forms-new.spec.ts +20 -2
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
Forms v2 now exposes `DyFM_ColorPickerFieldNew_Settings` as the serializable bedrock Settings model for a
|
|
6
6
|
color-picker field. `DyFM_Field_Type.colorPicker` uses the stable `color-picker` discriminator.
|
|
7
7
|
|
|
8
|
-
The value contract is a CSS/browser-native `#RRGGBB` string.
|
|
9
|
-
|
|
8
|
+
The value contract is a CSS/browser-native `#RRGGBB` string. The constructor adds that contract as a serializable
|
|
9
|
+
pattern validator while preserving consumer validators, so backend and Angular consumers share the same rule.
|
|
10
|
+
Rendering and interaction remain the responsibility of `@futdevpro/ngx-dynamo`; this package owns only the
|
|
11
|
+
framework-independent constructor and discriminated union.
|
|
10
12
|
|
|
11
13
|
## Public surface
|
|
12
14
|
|
|
@@ -16,5 +18,6 @@ of `@futdevpro/ngx-dynamo`; this package owns only the framework-independent con
|
|
|
16
18
|
|
|
17
19
|
## Verification
|
|
18
20
|
|
|
19
|
-
The Forms v2 settings suite verifies constructor persistence
|
|
20
|
-
test and build gates must remain green
|
|
21
|
+
The Forms v2 settings suite verifies constructor persistence, the immutable discriminator, default hexadecimal
|
|
22
|
+
validation, and preservation of consumer validators. The complete package test and build gates must remain green
|
|
23
|
+
before publishing the patch release.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker-field-new-settings.control-model.d.ts","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"color-picker-field-new-settings.control-model.d.ts","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EACL,sBAAsB,EAEvB,MAAM,oCAAoC,CAAC;AAI5C;;;;;GAKG;AACH,qBAAa,iCAAkC,SAAQ,sBAAsB,CAAC,MAAM,CAAC;IACnF,SAAkB,IAAI,EAAE,eAAe,CAAC,WAAW,CAA+B;IAElF,qFAAqF;gBACzE,GAAG,EAAE,OAAO,CAAC,iCAAiC,CAAC;CAwB5D"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DyFM_ColorPickerFieldNew_Settings = void 0;
|
|
4
4
|
const field_type_enum_1 = require("../../../_enums/field-type.enum");
|
|
5
|
+
const field_new_validator_type_enum_1 = require("../../../_enums/forms-new/field-new-validator-type.enum");
|
|
5
6
|
const field_new_settings_control_model_1 = require("./field-new-settings.control-model");
|
|
7
|
+
const DYNAMO_COLOR_PICKER_HEX_PATTERN = '^#[0-9a-fA-F]{6}$';
|
|
6
8
|
/**
|
|
7
9
|
* Forms v2 color-picker settings.
|
|
8
10
|
*
|
|
@@ -17,6 +19,19 @@ class DyFM_ColorPickerFieldNew_Settings extends field_new_settings_control_model
|
|
|
17
19
|
const rest = { ...set };
|
|
18
20
|
Reflect.deleteProperty(rest, 'type');
|
|
19
21
|
Object.assign(this, rest);
|
|
22
|
+
const validators = this.validators ?? [];
|
|
23
|
+
const hasHexValidator = validators.some((validator) => validator.type === field_new_validator_type_enum_1.DyFM_FieldNew_Validator_Type.pattern
|
|
24
|
+
&& validator.value === DYNAMO_COLOR_PICKER_HEX_PATTERN);
|
|
25
|
+
if (!hasHexValidator) {
|
|
26
|
+
this.validators = [
|
|
27
|
+
...validators,
|
|
28
|
+
{
|
|
29
|
+
type: field_new_validator_type_enum_1.DyFM_FieldNew_Validator_Type.pattern,
|
|
30
|
+
value: DYNAMO_COLOR_PICKER_HEX_PATTERN,
|
|
31
|
+
message: 'Enter a color as #RRGGBB.',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
}
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
37
|
exports.DyFM_ColorPickerFieldNew_Settings = DyFM_ColorPickerFieldNew_Settings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker-field-new-settings.control-model.js","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"color-picker-field-new-settings.control-model.js","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/color-picker-field-new-settings.control-model.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAClE,2GAAuG;AACvG,yFAG4C;AAE5C,MAAM,+BAA+B,GAAW,mBAAmB,CAAC;AAEpE;;;;;GAKG;AACH,MAAa,iCAAkC,SAAQ,yDAA8B;IACjE,IAAI,GAAgC,iCAAe,CAAC,WAAW,CAAC;IAElF,qFAAqF;IACrF,YAAY,GAA+C;QACzD,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,MAAM,IAAI,GAA+C,EAAE,GAAG,GAAG,EAAE,CAAC;QAEpE,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE1B,MAAM,UAAU,GAAyC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;QAC/E,MAAM,eAAe,GAAY,UAAU,CAAC,IAAI,CAAC,CAAC,SAA6C,EAAW,EAAE,CAC1G,SAAS,CAAC,IAAI,KAAK,4DAA4B,CAAC,OAAO;eACpD,SAAS,CAAC,KAAK,KAAK,+BAA+B,CACvD,CAAC;QAEF,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG;gBAChB,GAAG,UAAU;gBACb;oBACE,IAAI,EAAE,4DAA4B,CAAC,OAAO;oBAC1C,KAAK,EAAE,+BAA+B;oBACtC,OAAO,EAAE,2BAA2B;iBACrC;aACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA5BD,8EA4BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/fsm-dynamo",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.8",
|
|
4
4
|
"description": "Full Stack Model Collection for Dynamic (NodeJS-Typescript) Framework called Dynamo, by Future Development Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "full-stack-package",
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { DyFM_Field_Type } from '../../../_enums/field-type.enum';
|
|
2
|
-
import {
|
|
2
|
+
import { DyFM_FieldNew_Validator_Type } from '../../../_enums/forms-new/field-new-validator-type.enum';
|
|
3
|
+
import {
|
|
4
|
+
DyFM_FieldNew_Settings,
|
|
5
|
+
DyFM_FieldNew_Validator_Descriptor
|
|
6
|
+
} from './field-new-settings.control-model';
|
|
7
|
+
|
|
8
|
+
const DYNAMO_COLOR_PICKER_HEX_PATTERN: string = '^#[0-9a-fA-F]{6}$';
|
|
3
9
|
|
|
4
10
|
/**
|
|
5
11
|
* Forms v2 color-picker settings.
|
|
@@ -17,5 +23,22 @@ export class DyFM_ColorPickerFieldNew_Settings extends DyFM_FieldNew_Settings<st
|
|
|
17
23
|
|
|
18
24
|
Reflect.deleteProperty(rest, 'type');
|
|
19
25
|
Object.assign(this, rest);
|
|
26
|
+
|
|
27
|
+
const validators: DyFM_FieldNew_Validator_Descriptor[] = this.validators ?? [];
|
|
28
|
+
const hasHexValidator: boolean = validators.some((validator: DyFM_FieldNew_Validator_Descriptor): boolean =>
|
|
29
|
+
validator.type === DyFM_FieldNew_Validator_Type.pattern
|
|
30
|
+
&& validator.value === DYNAMO_COLOR_PICKER_HEX_PATTERN,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (!hasHexValidator) {
|
|
34
|
+
this.validators = [
|
|
35
|
+
...validators,
|
|
36
|
+
{
|
|
37
|
+
type: DyFM_FieldNew_Validator_Type.pattern,
|
|
38
|
+
value: DYNAMO_COLOR_PICKER_HEX_PATTERN,
|
|
39
|
+
message: 'Enter a color as #RRGGBB.',
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
20
43
|
}
|
|
21
44
|
}
|
|
@@ -3,8 +3,9 @@ import { DyFM_FieldNew_Validator_Type } from '../../../_enums/forms-new/field-ne
|
|
|
3
3
|
import {
|
|
4
4
|
DyFM_CheckboxFieldNew_Settings,
|
|
5
5
|
DyFM_ColorPickerFieldNew_Settings,
|
|
6
|
-
DyFM_DateFieldNew_Settings,
|
|
7
|
-
DyFM_FieldNew_Settings,
|
|
6
|
+
DyFM_DateFieldNew_Settings,
|
|
7
|
+
DyFM_FieldNew_Settings,
|
|
8
|
+
DyFM_FieldNew_Validator_Descriptor,
|
|
8
9
|
DyFM_FormNew_Settings,
|
|
9
10
|
DyFM_MultiselectFieldNew_Settings,
|
|
10
11
|
DyFM_NumberFieldNew_Settings,
|
|
@@ -99,6 +100,23 @@ describe('| Forms v2 — Wave-1A Settings layer', () => {
|
|
|
99
100
|
|
|
100
101
|
expect(settings.type).toBe(DyFM_Field_Type.colorPicker);
|
|
101
102
|
expect(settings.defaultValue).toBe('#22d3ee');
|
|
103
|
+
expect(settings.validators).toContain(jasmine.objectContaining({
|
|
104
|
+
type: DyFM_FieldNew_Validator_Type.pattern,
|
|
105
|
+
value: '^#[0-9a-fA-F]{6}$',
|
|
106
|
+
message: 'Enter a color as #RRGGBB.',
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('| preserves consumer validators while adding the strict hexadecimal contract once', () => {
|
|
111
|
+
const settings: DyFM_ColorPickerFieldNew_Settings = new DyFM_ColorPickerFieldNew_Settings({
|
|
112
|
+
key: 'accentColor',
|
|
113
|
+
validators: [{ type: DyFM_FieldNew_Validator_Type.required }],
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
expect(settings.validators?.map(
|
|
117
|
+
(validator: DyFM_FieldNew_Validator_Descriptor): DyFM_FieldNew_Validator_Type => validator.type,
|
|
118
|
+
))
|
|
119
|
+
.toEqual([DyFM_FieldNew_Validator_Type.required, DyFM_FieldNew_Validator_Type.pattern]);
|
|
102
120
|
});
|
|
103
121
|
});
|
|
104
122
|
|