@futdevpro/fsm-dynamo 1.20.163 → 1.20.164

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.
Files changed (16) hide show
  1. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings-set.interface.d.ts +11 -0
  2. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings-set.interface.d.ts.map +1 -0
  3. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings-set.interface.js +3 -0
  4. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings-set.interface.js.map +1 -0
  5. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings.util.d.ts +33 -0
  6. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings.util.d.ts.map +1 -0
  7. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings.util.js +61 -0
  8. package/build/_modules/ngx-models/_models/control-models/forms-new/field-new-settings.util.js.map +1 -0
  9. package/build/_modules/ngx-models/_models/control-models/forms-new/index.d.ts +2 -0
  10. package/build/_modules/ngx-models/_models/control-models/forms-new/index.d.ts.map +1 -1
  11. package/build/_modules/ngx-models/_models/control-models/forms-new/index.js +2 -0
  12. package/build/_modules/ngx-models/_models/control-models/forms-new/index.js.map +1 -1
  13. package/build-esm/_modules/ngx-models/_models/control-models/forms-new/field-new-settings-set.interface.js +1 -0
  14. package/build-esm/_modules/ngx-models/_models/control-models/forms-new/field-new-settings.util.js +56 -0
  15. package/build-esm/_modules/ngx-models/_models/control-models/forms-new/index.js +2 -0
  16. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { DyFM_FieldNew_Settings } from './field-new-settings.control-model';
2
+ /**
3
+ * BFR-MYASSISTANT-025 S4.1 (26th slice) — the input of `DyFM_FieldNewSettings_Util.of`: the keys EVERY Forms v2 field
4
+ * has, with the default value of any type (the factory keeps it only when it fits the chosen field type).
5
+ */
6
+ export interface DyFM_FieldNewSettings_Set_Interface extends Partial<Pick<DyFM_FieldNew_Settings<unknown>, 'label' | 'description' | 'placeholder' | 'validators' | 'disabled' | 'isDisabled' | 'readOnly' | 'isReadOnly' | 'isDisabledHidden' | 'isControlOnly' | 'gridSize' | 'required' | 'isRequired' | 'testId'>> {
7
+ key: string;
8
+ /** Kept only when it fits the field type (a string for text, a number for number, a boolean for checkbox). */
9
+ defaultValue?: unknown;
10
+ }
11
+ //# sourceMappingURL=field-new-settings-set.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-new-settings-set.interface.d.ts","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/field-new-settings-set.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,mCAAoC,SAAQ,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EACvG,OAAO,GAAG,aAAa,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,GAC5G,kBAAkB,GAAG,eAAe,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAC;IAC5F,GAAG,EAAE,MAAM,CAAC;IACZ,8GAA8G;IAC9G,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=field-new-settings-set.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-new-settings-set.interface.js","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/field-new-settings-set.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { DyFM_Field_Type } from '../../../_enums/field-type.enum';
2
+ import { DyFM_CheckboxFieldNew_Settings } from './checkbox-field-new-settings.control-model';
3
+ import { DyFM_FieldNewSettings_Set_Interface } from './field-new-settings-set.interface';
4
+ import { DyFM_NumberFieldNew_Settings } from './number-field-new-settings.control-model';
5
+ import { DyFM_PasswordFieldNew_Settings } from './password-field-new-settings.control-model';
6
+ import { DyFM_TextAreaFieldNew_Settings } from './textarea-field-new-settings.control-model';
7
+ import { DyFM_TextFieldNew_Settings } from './text-field-new-settings.control-model';
8
+ /**
9
+ * BFR-MYASSISTANT-025 S4.1 (26th slice) — a Forms v2 field whose TYPE is decided at runtime (the legacy
10
+ * `type: this.typeOf(input)`; the MP run form: a flow input's value type ⇒ text / number / checkbox). The Forms v2
11
+ * form builds by `settings.type` at runtime, but every type has its own settings class: this factory picks it.
12
+ *
13
+ * @description The plain value types only — those with no keys of their own to set: `text`, `textarea`, `password`
14
+ * (a string), `number` (a number), `checkbox` (a boolean). The default value is kept only when it fits the type
15
+ * (otherwise none: the field starts empty, never a wrong-typed value). Any other type needs keys of its own
16
+ * (options, a range, a file kind …) ⇒ it throws, naming the class to build instead.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * DyFM_FieldNewSettings_Util.of(this.typeOf(input), { key: input.key, label: input.label, defaultValue: input.value })
21
+ * ```
22
+ */
23
+ export declare class DyFM_FieldNewSettings_Util {
24
+ /** The field types `of` builds (a runtime type outside of these throws). */
25
+ static readonly plainTypes: readonly DyFM_Field_Type[];
26
+ /**
27
+ * The settings of a plain field of a runtime type.
28
+ *
29
+ * @throws an `Error` for a type that needs keys of its own (build it with its own settings class)
30
+ */
31
+ static of(type: DyFM_Field_Type, set: DyFM_FieldNewSettings_Set_Interface): DyFM_TextFieldNew_Settings | DyFM_TextAreaFieldNew_Settings | DyFM_PasswordFieldNew_Settings | DyFM_NumberFieldNew_Settings | DyFM_CheckboxFieldNew_Settings;
32
+ }
33
+ //# sourceMappingURL=field-new-settings.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-new-settings.util.d.ts","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/field-new-settings.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,0BAA0B;IACrC,4EAA4E;IAC5E,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,CAGpD;IAEF;;;;OAIG;IACH,MAAM,CAAC,EAAE,CACP,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE,mCAAmC,GACvC,0BAA0B,GAAG,8BAA8B,GAAG,8BAA8B,GAC3F,4BAA4B,GAAG,8BAA8B;CA6BlE"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DyFM_FieldNewSettings_Util = void 0;
4
+ const field_type_enum_1 = require("../../../_enums/field-type.enum");
5
+ const checkbox_field_new_settings_control_model_1 = require("./checkbox-field-new-settings.control-model");
6
+ const number_field_new_settings_control_model_1 = require("./number-field-new-settings.control-model");
7
+ const password_field_new_settings_control_model_1 = require("./password-field-new-settings.control-model");
8
+ const textarea_field_new_settings_control_model_1 = require("./textarea-field-new-settings.control-model");
9
+ const text_field_new_settings_control_model_1 = require("./text-field-new-settings.control-model");
10
+ /**
11
+ * BFR-MYASSISTANT-025 S4.1 (26th slice) — a Forms v2 field whose TYPE is decided at runtime (the legacy
12
+ * `type: this.typeOf(input)`; the MP run form: a flow input's value type ⇒ text / number / checkbox). The Forms v2
13
+ * form builds by `settings.type` at runtime, but every type has its own settings class: this factory picks it.
14
+ *
15
+ * @description The plain value types only — those with no keys of their own to set: `text`, `textarea`, `password`
16
+ * (a string), `number` (a number), `checkbox` (a boolean). The default value is kept only when it fits the type
17
+ * (otherwise none: the field starts empty, never a wrong-typed value). Any other type needs keys of its own
18
+ * (options, a range, a file kind …) ⇒ it throws, naming the class to build instead.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * DyFM_FieldNewSettings_Util.of(this.typeOf(input), { key: input.key, label: input.label, defaultValue: input.value })
23
+ * ```
24
+ */
25
+ class DyFM_FieldNewSettings_Util {
26
+ /** The field types `of` builds (a runtime type outside of these throws). */
27
+ static plainTypes = [
28
+ field_type_enum_1.DyFM_Field_Type.text, field_type_enum_1.DyFM_Field_Type.textarea, field_type_enum_1.DyFM_Field_Type.password, field_type_enum_1.DyFM_Field_Type.number,
29
+ field_type_enum_1.DyFM_Field_Type.checkbox,
30
+ ];
31
+ /**
32
+ * The settings of a plain field of a runtime type.
33
+ *
34
+ * @throws an `Error` for a type that needs keys of its own (build it with its own settings class)
35
+ */
36
+ static of(type, set) {
37
+ const { defaultValue, ...common } = set;
38
+ const text = typeof defaultValue === 'string' ? { defaultValue: defaultValue } : {};
39
+ switch (type) {
40
+ case field_type_enum_1.DyFM_Field_Type.text:
41
+ return new text_field_new_settings_control_model_1.DyFM_TextFieldNew_Settings({ ...common, ...text });
42
+ case field_type_enum_1.DyFM_Field_Type.textarea:
43
+ return new textarea_field_new_settings_control_model_1.DyFM_TextAreaFieldNew_Settings({ ...common, ...text });
44
+ case field_type_enum_1.DyFM_Field_Type.password:
45
+ return new password_field_new_settings_control_model_1.DyFM_PasswordFieldNew_Settings({ ...common, ...text });
46
+ case field_type_enum_1.DyFM_Field_Type.number:
47
+ return new number_field_new_settings_control_model_1.DyFM_NumberFieldNew_Settings({
48
+ ...common, ...(typeof defaultValue === 'number' ? { defaultValue: defaultValue } : {}),
49
+ });
50
+ case field_type_enum_1.DyFM_Field_Type.checkbox:
51
+ return new checkbox_field_new_settings_control_model_1.DyFM_CheckboxFieldNew_Settings({
52
+ ...common, ...(typeof defaultValue === 'boolean' ? { defaultValue: defaultValue } : {}),
53
+ });
54
+ default:
55
+ throw new Error(`DyFM_FieldNewSettings_Util.of: the '${type}' field needs keys of its own (options, a range, `
56
+ + `a file kind …) - build it with its own settings class (field '${set.key}')`);
57
+ }
58
+ }
59
+ }
60
+ exports.DyFM_FieldNewSettings_Util = DyFM_FieldNewSettings_Util;
61
+ //# sourceMappingURL=field-new-settings.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-new-settings.util.js","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/field-new-settings.util.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAClE,2GAA6F;AAE7F,uGAAyF;AACzF,2GAA6F;AAC7F,2GAA6F;AAC7F,mGAAqF;AAErF;;;;;;;;;;;;;;GAcG;AACH,MAAa,0BAA0B;IACrC,4EAA4E;IAC5E,MAAM,CAAU,UAAU,GAA+B;QACvD,iCAAe,CAAC,IAAI,EAAE,iCAAe,CAAC,QAAQ,EAAE,iCAAe,CAAC,QAAQ,EAAE,iCAAe,CAAC,MAAM;QAChG,iCAAe,CAAC,QAAQ;KACzB,CAAC;IAEF;;;;OAIG;IACH,MAAM,CAAC,EAAE,CACP,IAAqB,EACrB,GAAwC;QAGxC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,GAAwC,GAAG,CAAC;QAC7E,MAAM,IAAI,GAA8B,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/G,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,iCAAe,CAAC,IAAI;gBACvB,OAAO,IAAI,kEAA0B,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;YAEhE,KAAK,iCAAe,CAAC,QAAQ;gBAC3B,OAAO,IAAI,0EAA8B,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;YAEpE,KAAK,iCAAe,CAAC,QAAQ;gBAC3B,OAAO,IAAI,0EAA8B,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;YAEpE,KAAK,iCAAe,CAAC,MAAM;gBACzB,OAAO,IAAI,sEAA4B,CAAC;oBACtC,GAAG,MAAM,EAAE,GAAG,CAAC,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACvF,CAAC,CAAC;YAEL,KAAK,iCAAe,CAAC,QAAQ;gBAC3B,OAAO,IAAI,0EAA8B,CAAC;oBACxC,GAAG,MAAM,EAAE,GAAG,CAAC,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACxF,CAAC,CAAC;YAEL;gBACE,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,mDAAmD;sBAC1G,iEAAiE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;;AA5CH,gEA6CC"}
@@ -25,4 +25,6 @@ export * from './picture-field-new-settings.control-model';
25
25
  export * from './number-range-field-new-settings.control-model';
26
26
  export * from './form-new-settings.control-model';
27
27
  export * from './field-new-types';
28
+ export * from './field-new-settings-set.interface';
29
+ export * from './field-new-settings.util';
28
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/index.ts"],"names":[],"mappings":"AAGA,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,iDAAiD,CAAC;AAChE,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/index.ts"],"names":[],"mappings":"AAGA,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iDAAiD,CAAC;AAChE,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,iDAAiD,CAAC;AAChE,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC"}
@@ -30,4 +30,6 @@ tslib_1.__exportStar(require("./picture-field-new-settings.control-model"), expo
30
30
  tslib_1.__exportStar(require("./number-range-field-new-settings.control-model"), exports);
31
31
  tslib_1.__exportStar(require("./form-new-settings.control-model"), exports);
32
32
  tslib_1.__exportStar(require("./field-new-types"), exports);
33
+ tslib_1.__exportStar(require("./field-new-settings-set.interface"), exports);
34
+ tslib_1.__exportStar(require("./field-new-settings.util"), exports);
33
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/index.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,kCAAkC;;;AAElC,6EAAmD;AACnD,kFAAwD;AACxD,sFAA4D;AAC5D,oFAA0D;AAC1D,sFAA4D;AAC5D,oFAA0D;AAC1D,0FAAgE;AAChE,sFAA4D;AAC5D,0FAAgE;AAChE,0FAAgE;AAChE,yFAA+D;AAC/D,8EAAoD;AACpD,oFAA0D;AAC1D,yFAA+D;AAC/D,0FAAgE;AAChE,kFAAwD;AACxD,sFAA4D;AAC5D,wFAA8D;AAC9D,4FAAkE;AAClE,oFAA0D;AAC1D,uFAA6D;AAC7D,2EAAiD;AACjD,kFAAwD;AACxD,qFAA2D;AAC3D,0FAAgE;AAChE,4EAAkD;AAClD,4DAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/_modules/ngx-models/_models/control-models/forms-new/index.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,kCAAkC;;;AAElC,6EAAmD;AACnD,kFAAwD;AACxD,sFAA4D;AAC5D,oFAA0D;AAC1D,sFAA4D;AAC5D,oFAA0D;AAC1D,0FAAgE;AAChE,sFAA4D;AAC5D,0FAAgE;AAChE,0FAAgE;AAChE,yFAA+D;AAC/D,8EAAoD;AACpD,oFAA0D;AAC1D,yFAA+D;AAC/D,0FAAgE;AAChE,kFAAwD;AACxD,sFAA4D;AAC5D,wFAA8D;AAC9D,4FAAkE;AAClE,oFAA0D;AAC1D,uFAA6D;AAC7D,2EAAiD;AACjD,kFAAwD;AACxD,qFAA2D;AAC3D,0FAAgE;AAChE,4EAAkD;AAClD,4DAAkC;AAClC,6EAAmD;AACnD,oEAA0C"}
@@ -0,0 +1,56 @@
1
+ import { DyFM_Field_Type } from '../../../_enums/field-type.enum';
2
+ import { DyFM_CheckboxFieldNew_Settings } from './checkbox-field-new-settings.control-model';
3
+ import { DyFM_NumberFieldNew_Settings } from './number-field-new-settings.control-model';
4
+ import { DyFM_PasswordFieldNew_Settings } from './password-field-new-settings.control-model';
5
+ import { DyFM_TextAreaFieldNew_Settings } from './textarea-field-new-settings.control-model';
6
+ import { DyFM_TextFieldNew_Settings } from './text-field-new-settings.control-model';
7
+ /**
8
+ * BFR-MYASSISTANT-025 S4.1 (26th slice) — a Forms v2 field whose TYPE is decided at runtime (the legacy
9
+ * `type: this.typeOf(input)`; the MP run form: a flow input's value type ⇒ text / number / checkbox). The Forms v2
10
+ * form builds by `settings.type` at runtime, but every type has its own settings class: this factory picks it.
11
+ *
12
+ * @description The plain value types only — those with no keys of their own to set: `text`, `textarea`, `password`
13
+ * (a string), `number` (a number), `checkbox` (a boolean). The default value is kept only when it fits the type
14
+ * (otherwise none: the field starts empty, never a wrong-typed value). Any other type needs keys of its own
15
+ * (options, a range, a file kind …) ⇒ it throws, naming the class to build instead.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * DyFM_FieldNewSettings_Util.of(this.typeOf(input), { key: input.key, label: input.label, defaultValue: input.value })
20
+ * ```
21
+ */
22
+ export class DyFM_FieldNewSettings_Util {
23
+ /** The field types `of` builds (a runtime type outside of these throws). */
24
+ static plainTypes = [
25
+ DyFM_Field_Type.text, DyFM_Field_Type.textarea, DyFM_Field_Type.password, DyFM_Field_Type.number,
26
+ DyFM_Field_Type.checkbox,
27
+ ];
28
+ /**
29
+ * The settings of a plain field of a runtime type.
30
+ *
31
+ * @throws an `Error` for a type that needs keys of its own (build it with its own settings class)
32
+ */
33
+ static of(type, set) {
34
+ const { defaultValue, ...common } = set;
35
+ const text = typeof defaultValue === 'string' ? { defaultValue: defaultValue } : {};
36
+ switch (type) {
37
+ case DyFM_Field_Type.text:
38
+ return new DyFM_TextFieldNew_Settings({ ...common, ...text });
39
+ case DyFM_Field_Type.textarea:
40
+ return new DyFM_TextAreaFieldNew_Settings({ ...common, ...text });
41
+ case DyFM_Field_Type.password:
42
+ return new DyFM_PasswordFieldNew_Settings({ ...common, ...text });
43
+ case DyFM_Field_Type.number:
44
+ return new DyFM_NumberFieldNew_Settings({
45
+ ...common, ...(typeof defaultValue === 'number' ? { defaultValue: defaultValue } : {}),
46
+ });
47
+ case DyFM_Field_Type.checkbox:
48
+ return new DyFM_CheckboxFieldNew_Settings({
49
+ ...common, ...(typeof defaultValue === 'boolean' ? { defaultValue: defaultValue } : {}),
50
+ });
51
+ default:
52
+ throw new Error(`DyFM_FieldNewSettings_Util.of: the '${type}' field needs keys of its own (options, a range, `
53
+ + `a file kind …) - build it with its own settings class (field '${set.key}')`);
54
+ }
55
+ }
56
+ }
@@ -27,3 +27,5 @@ export * from './picture-field-new-settings.control-model';
27
27
  export * from './number-range-field-new-settings.control-model';
28
28
  export * from './form-new-settings.control-model';
29
29
  export * from './field-new-types';
30
+ export * from './field-new-settings-set.interface';
31
+ export * from './field-new-settings.util';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@futdevpro/fsm-dynamo",
3
- "version": "1.20.163",
3
+ "version": "1.20.164",
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",