@aemforms/af-core 0.22.35 → 0.22.36

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/lib/BaseNode.d.ts CHANGED
@@ -91,4 +91,6 @@ export declare abstract class BaseNode<T extends BaseJson> implements BaseModel
91
91
  protected _applyUpdates(propNames: string[], updates: any): any;
92
92
  get qualifiedName(): any;
93
93
  focus(): void;
94
+ protected _getDefaults(): any;
95
+ protected _applyDefaultsInModel(): void;
94
96
  }
package/lib/BaseNode.js CHANGED
@@ -437,6 +437,23 @@ class BaseNode {
437
437
  this.parent.activeChild = this;
438
438
  }
439
439
  }
440
+ _getDefaults() {
441
+ return {};
442
+ }
443
+ _applyDefaultsInModel() {
444
+ Object.entries(this._getDefaults()).map(([key, value]) => {
445
+ if (this._jsonModel[key] === undefined && value !== undefined) {
446
+ this._jsonModel[key] = value;
447
+ }
448
+ else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
449
+ Object.keys(value).forEach((keyOfValue) => {
450
+ if (this._jsonModel[key][keyOfValue] === undefined) {
451
+ this._jsonModel[key][keyOfValue] = value[keyOfValue];
452
+ }
453
+ });
454
+ }
455
+ });
456
+ }
440
457
  }
441
458
  __decorate([
442
459
  dependencyTracked()
package/lib/Checkbox.d.ts CHANGED
@@ -72,6 +72,11 @@ declare class Checkbox extends Field {
72
72
  readOnly: boolean;
73
73
  enabled: boolean;
74
74
  visible: boolean;
75
+ label: {
76
+ visible: boolean;
77
+ richText: boolean;
78
+ };
79
+ required: boolean;
75
80
  type: string | undefined;
76
81
  };
77
82
  get enum(): any[];
@@ -12,6 +12,11 @@ declare class CheckboxGroup extends Field {
12
12
  readOnly: boolean;
13
13
  enabled: boolean;
14
14
  visible: boolean;
15
+ label: {
16
+ visible: boolean;
17
+ richText: boolean;
18
+ };
19
+ required: boolean;
15
20
  type: string | undefined;
16
21
  };
17
22
  }
package/lib/Field.d.ts CHANGED
@@ -14,6 +14,11 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
14
14
  readOnly: boolean;
15
15
  enabled: boolean;
16
16
  visible: boolean;
17
+ label: {
18
+ visible: boolean;
19
+ richText: boolean;
20
+ };
21
+ required: boolean;
17
22
  type: string | undefined;
18
23
  };
19
24
  protected _getFallbackType(): string | undefined;
package/lib/Field.js CHANGED
@@ -46,6 +46,11 @@ class Field extends Scriptable_1.default {
46
46
  readOnly: false,
47
47
  enabled: true,
48
48
  visible: true,
49
+ label: {
50
+ visible: true,
51
+ richText: false
52
+ },
53
+ required: false,
49
54
  type: this._getFallbackType()
50
55
  };
51
56
  }
@@ -79,11 +84,7 @@ class Field extends Scriptable_1.default {
79
84
  return finalType;
80
85
  }
81
86
  _applyDefaults() {
82
- Object.entries(this._getDefaults()).map(([key, value]) => {
83
- if (this._jsonModel[key] === undefined && value !== undefined) {
84
- this._jsonModel[key] = value;
85
- }
86
- });
87
+ super._applyDefaultsInModel();
87
88
  this.coerceParam('required', 'boolean');
88
89
  this.coerceParam('readOnly', 'boolean');
89
90
  this.coerceParam('enabled', 'boolean');
package/lib/Fieldset.d.ts CHANGED
@@ -6,6 +6,16 @@ export declare class Fieldset extends Container<FieldsetJson> implements Fieldse
6
6
  parent: ContainerModel;
7
7
  fieldFactory: IFormFieldFactory;
8
8
  });
9
+ protected _getDefaults(): {
10
+ visible: boolean;
11
+ enabled: boolean;
12
+ readOnly: boolean;
13
+ required: boolean;
14
+ label: {
15
+ visible: boolean;
16
+ richText: boolean;
17
+ };
18
+ };
9
19
  private _applyDefaults;
10
20
  get type(): "array" | "object" | undefined;
11
21
  get items(): (FieldModel | FieldsetModel)[];
package/lib/Fieldset.js CHANGED
@@ -6,10 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Fieldset = void 0;
7
7
  const Container_1 = __importDefault(require("./Container"));
8
8
  const Events_1 = require("./controller/Events");
9
- const defaults = {
10
- visible: true,
11
- enabled: true
12
- };
13
9
  const notifyChildrenAttributes = [
14
10
  'readOnly', 'enabled'
15
11
  ];
@@ -20,12 +16,20 @@ class Fieldset extends Container_1.default {
20
16
  this.queueEvent(new Events_1.Initialize());
21
17
  this.queueEvent(new Events_1.ExecuteRule());
22
18
  }
23
- _applyDefaults() {
24
- Object.entries(defaults).map(([key, value]) => {
25
- if (this._jsonModel[key] === undefined) {
26
- this._jsonModel[key] = value;
19
+ _getDefaults() {
20
+ return {
21
+ visible: true,
22
+ enabled: true,
23
+ readOnly: false,
24
+ required: false,
25
+ label: {
26
+ visible: true,
27
+ richText: false
27
28
  }
28
- });
29
+ };
30
+ }
31
+ _applyDefaults() {
32
+ super._applyDefaultsInModel();
29
33
  if (this._jsonModel.dataRef && this._jsonModel.type === undefined) {
30
34
  this._jsonModel.type = 'object';
31
35
  }
@@ -8,6 +8,11 @@ declare class FileUpload extends Field implements FieldModel {
8
8
  readOnly: boolean;
9
9
  enabled: boolean;
10
10
  visible: boolean;
11
+ label: {
12
+ visible: boolean;
13
+ richText: boolean;
14
+ };
15
+ required: boolean;
11
16
  type: string | undefined;
12
17
  };
13
18
  protected _getFallbackType(): string | undefined;
@@ -65,7 +65,12 @@ class DataGroup extends DataValue_1.default {
65
65
  }
66
66
  }
67
67
  $removeDataNode(name) {
68
- this.$_items[name] = undefined;
68
+ if (this.$type === 'array') {
69
+ this.$_items.splice(name, 1);
70
+ }
71
+ else {
72
+ this.$_items[name] = undefined;
73
+ }
69
74
  }
70
75
  $getDataNode(name) {
71
76
  if (this.$_items.hasOwnProperty(name)) {
@@ -1,6 +1,6 @@
1
1
  declare type HTTP_VERB = 'GET' | 'POST';
2
2
  export declare const request: (context: any, uri: string, httpVerb: HTTP_VERB, payload: any, success: string, error: string, headers: any) => Promise<void>;
3
- export declare const submit: (context: any, success: string, error: string, submitAs?: 'application/json' | 'multipart/form-data', input_data?: any) => Promise<void>;
3
+ export declare const submit: (context: any, success: string, error: string, submitAs?: 'application/json' | 'multipart/form-data' | 'application/x-www-form-urlencoded', input_data?: any) => Promise<void>;
4
4
  export declare type CustomFunction = Function;
5
5
  export declare type FunctionDefinition = {
6
6
  _func: CustomFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.35",
3
+ "version": "0.22.36",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@adobe/json-formula": "0.1.50",
38
- "@aemforms/af-formatters": "^0.22.35"
38
+ "@aemforms/af-formatters": "^0.22.36"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@babel/preset-env": "^7.20.2",