@sankhyalabs/sankhyablocks 1.1.21 → 1.1.24

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.
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.15.2",
7
+ "version": "2.16.1",
8
8
  "typescriptVersion": "4.5.4"
9
9
  },
10
10
  "collections": [],
@@ -88,8 +88,8 @@ export class SnkApplication {
88
88
  async confirm(title, message, icon, critical) {
89
89
  return ApplicationUtils.confirm(title, message, icon, critical);
90
90
  }
91
- async info(message) {
92
- return ApplicationUtils.info(message);
91
+ async info(message, options = undefined) {
92
+ return ApplicationUtils.info(message, options);
93
93
  }
94
94
  async loadFormConfig(name) {
95
95
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
@@ -444,10 +444,13 @@ export class SnkApplication {
444
444
  },
445
445
  "info": {
446
446
  "complexType": {
447
- "signature": "(message: string) => Promise<void>",
447
+ "signature": "(message: string, options?: any) => Promise<void>",
448
448
  "parameters": [{
449
449
  "tags": [],
450
450
  "text": ""
451
+ }, {
452
+ "tags": [],
453
+ "text": ""
451
454
  }],
452
455
  "references": {
453
456
  "Promise": {
@@ -123,10 +123,7 @@ export default class DataUnitFetcher {
123
123
  const changes = duChanges.map((change) => {
124
124
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
125
125
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
126
- if (value) {
127
- value = value.toString();
128
- }
129
- return { fieldName, value };
126
+ return { fieldName, value: this.formatValueToServer(value) };
130
127
  });
131
128
  return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
132
129
  });
@@ -155,6 +152,21 @@ export default class DataUnitFetcher {
155
152
  });
156
153
  });
157
154
  }
155
+ formatValueToServer(value) {
156
+ if (value === undefined)
157
+ return value;
158
+ try {
159
+ if (value instanceof Date) {
160
+ return value.toString();
161
+ }
162
+ //Any others objects
163
+ value = JSON.stringify(value);
164
+ }
165
+ catch (_a) {
166
+ value = value.toString();
167
+ }
168
+ return value;
169
+ }
158
170
  removeRecords(dataUnit, recordIds) {
159
171
  const changes = recordIds.map((recordId) => {
160
172
  return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
@@ -18,14 +18,19 @@ export default class ApplicationUtils {
18
18
  static async confirm(title, message, icon = null, critical = false) {
19
19
  return ApplicationUtils.showDialog(title, message, icon, true, critical);
20
20
  }
21
- static async info(message) {
21
+ static async info(message, options = ApplicationUtils.defaultMessageOptions) {
22
22
  let toast = document.querySelector("ez-toast");
23
23
  if (!toast) {
24
24
  toast = document.createElement("ez-toast");
25
25
  window.document.body.appendChild(toast);
26
26
  }
27
+ toast.canClose = options.canClose;
27
28
  toast.message = message;
28
29
  toast.fadeTime = 4000;
29
30
  toast.show();
30
31
  }
31
32
  }
33
+ ApplicationUtils.defaultMessageOptions = {
34
+ canClose: true
35
+ };
36
+ ;