dattatable 1.7.8 → 1.7.9

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 (42) hide show
  1. package/build/index.d.ts +0 -1
  2. package/build/index.js +1 -2
  3. package/build/itemForm.d.ts +24 -3
  4. package/build/itemForm.js +240 -140
  5. package/dist/dattatable.js +662 -673
  6. package/dist/dattatable.min.js +1 -1
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/CanvasForm.html +1 -1
  9. package/docs/classes/Dashboard.html +2 -2
  10. package/docs/classes/DataTable.html +2 -2
  11. package/docs/classes/Documents.html +5 -5
  12. package/docs/classes/FilterSlideout.html +1 -1
  13. package/docs/classes/Footer.html +1 -1
  14. package/docs/classes/Header.html +1 -1
  15. package/docs/classes/InstallationRequired.html +1 -1
  16. package/docs/classes/ItemForm.html +4 -4
  17. package/docs/classes/LoadingDialog.html +1 -1
  18. package/docs/classes/Modal.html +1 -1
  19. package/docs/classes/Navigation.html +1 -1
  20. package/docs/enums/ActionButtonTypes.html +1 -1
  21. package/docs/index.html +1 -1
  22. package/docs/interfaces/IDashboardProps.html +1 -1
  23. package/docs/interfaces/IDataTable.html +1 -1
  24. package/docs/interfaces/IDataTableProps.html +1 -1
  25. package/docs/interfaces/IDocumentsProps.html +1 -1
  26. package/docs/interfaces/IFilterItem.html +1 -1
  27. package/docs/interfaces/IFilterProps.html +1 -1
  28. package/docs/interfaces/IFooterProps.html +1 -1
  29. package/docs/interfaces/IHeaderProps.html +1 -1
  30. package/docs/interfaces/IItemFormCreateProps.html +1 -1
  31. package/docs/interfaces/IItemFormEditProps.html +1 -1
  32. package/docs/interfaces/IItemFormTab.html +3 -0
  33. package/docs/interfaces/IItemFormTabInfo.html +3 -1
  34. package/docs/interfaces/IItemFormViewProps.html +1 -1
  35. package/docs/interfaces/IShowDialogProps.html +1 -1
  36. package/docs/modules.html +1 -1
  37. package/package.json +2 -2
  38. package/pnpm-lock.yaml +16 -18
  39. package/build/itemFormTabs.d.ts +0 -27
  40. package/build/itemFormTabs.js +0 -95
  41. package/docs/classes/ItemFormTabs.html +0 -3
  42. package/docs/interfaces/IItemFormTabsProps.html +0 -1
package/build/index.d.ts CHANGED
@@ -2,6 +2,5 @@ export * from "./common";
2
2
  export * from "./dashboard";
3
3
  export * from "./documents";
4
4
  export * from "./itemForm";
5
- export * from "./itemFormTabs";
6
5
  /** Styling */
7
6
  import "./styles";
package/build/index.js CHANGED
@@ -22,7 +22,6 @@ var documents_1 = require("./documents");
22
22
  __exportStar(require("./documents"), exports);
23
23
  var itemForm_1 = require("./itemForm");
24
24
  __exportStar(require("./itemForm"), exports);
25
- __exportStar(require("./itemFormTabs"), exports);
26
25
  /** Styling */
27
26
  require("./styles");
28
27
  /** Global Variable */
@@ -31,5 +30,5 @@ window["DattaTable"] = {
31
30
  Common: Common,
32
31
  Dashboard: dashboard_1.Dashboard,
33
32
  Documents: documents_1.Documents,
34
- ItemForm: itemForm_1.ItemForm //, ItemFormTabs
33
+ ItemForm: itemForm_1.ItemForm
35
34
  };
@@ -1,4 +1,16 @@
1
1
  import { Components, Helper } from "gd-sprest-bs";
2
+ /** Tab */
3
+ export interface IItemFormTab {
4
+ title: string;
5
+ fields: string[];
6
+ onRendered: (el?: HTMLElement, item?: Components.IListGroupItem) => void;
7
+ onRendering: (item?: Components.IListGroupItem) => any;
8
+ }
9
+ /** Tab Information */
10
+ export interface IItemFormTabInfo {
11
+ isVertical?: boolean;
12
+ tabs: IItemFormTab[];
13
+ }
2
14
  /** Create Item Properties */
3
15
  export interface IItemFormCreateProps {
4
16
  info?: Helper.IListFormResult;
@@ -10,6 +22,7 @@ export interface IItemFormCreateProps {
10
22
  onSetHeader?: (el: HTMLElement) => void;
11
23
  onUpdate?: (item?: any) => void;
12
24
  onValidation?: (values?: any) => boolean | PromiseLike<boolean>;
25
+ tabInfo?: IItemFormTabInfo;
13
26
  useModal?: boolean;
14
27
  webUrl?: string;
15
28
  }
@@ -25,6 +38,7 @@ export interface IItemFormEditProps {
25
38
  onSetHeader?: (el: HTMLElement) => void;
26
39
  onUpdate?: (item?: any) => void;
27
40
  onValidation?: (values?: any) => boolean | PromiseLike<boolean>;
41
+ tabInfo?: IItemFormTabInfo;
28
42
  useModal?: boolean;
29
43
  webUrl?: string;
30
44
  }
@@ -37,6 +51,7 @@ export interface IItemFormViewProps {
37
51
  onGetListInfo?: (props: Helper.IListFormProps) => Helper.IListFormProps;
38
52
  onSetFooter?: (el: HTMLElement) => void;
39
53
  onSetHeader?: (el: HTMLElement) => void;
54
+ tabInfo?: IItemFormTabInfo;
40
55
  useModal?: boolean;
41
56
  webUrl?: string;
42
57
  }
@@ -52,11 +67,12 @@ export declare class ItemForm {
52
67
  private static _onSetHeader?;
53
68
  private static _onSave;
54
69
  private static _onValidation;
70
+ private static _tabInfo;
55
71
  private static _updateEvent;
56
72
  static set AutoClose(value: boolean);
57
- private static _displayForm;
73
+ private static _displayForms;
58
74
  static get DisplayForm(): Components.IListFormDisplay;
59
- private static _editForm;
75
+ private static _editForms;
60
76
  static get EditForm(): Components.IListFormEdit;
61
77
  private static _info;
62
78
  static get FormInfo(): Helper.IListFormResult;
@@ -76,8 +92,13 @@ export declare class ItemForm {
76
92
  static edit(props: IItemFormEditProps): void;
77
93
  static loadFormInfo(props: Helper.IListFormProps): PromiseLike<void>;
78
94
  static view(props: IItemFormViewProps): void;
79
- /** private static Methods */
95
+ /** Private Methods */
80
96
  private static load;
97
+ private static renderDisplayForm;
98
+ private static renderEditForm;
99
+ private static renderFooter;
100
+ private static renderForm;
101
+ private static renderTabs;
81
102
  static save(form?: Components.IListFormEdit): void;
82
103
  private static validate;
83
104
  }
package/build/itemForm.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.ItemForm = void 0;
4
15
  var gd_sprest_bs_1 = require("gd-sprest-bs");
@@ -19,12 +30,12 @@ var ItemForm = /** @class */ (function () {
19
30
  configurable: true
20
31
  });
21
32
  Object.defineProperty(ItemForm, "DisplayForm", {
22
- get: function () { return this._displayForm; },
33
+ get: function () { return this._displayForms[0]; },
23
34
  enumerable: false,
24
35
  configurable: true
25
36
  });
26
37
  Object.defineProperty(ItemForm, "EditForm", {
27
- get: function () { return this._editForm; },
38
+ get: function () { return this._editForms[0]; },
28
39
  enumerable: false,
29
40
  configurable: true
30
41
  });
@@ -78,6 +89,7 @@ var ItemForm = /** @class */ (function () {
78
89
  this._onSetFooter = props.onSetFooter;
79
90
  this._onSetHeader = props.onSetHeader;
80
91
  this._onValidation = props.onValidation;
92
+ this._tabInfo = props.tabInfo;
81
93
  this._updateEvent = props.onUpdate;
82
94
  typeof (props.useModal) === "boolean" ? this._useModal = props.useModal : false;
83
95
  // Load the item
@@ -95,6 +107,7 @@ var ItemForm = /** @class */ (function () {
95
107
  this._onSetFooter = props.onSetFooter;
96
108
  this._onSetHeader = props.onSetHeader;
97
109
  this._onValidation = props.onValidation;
110
+ this._tabInfo = props.tabInfo;
98
111
  this._updateEvent = props.onUpdate;
99
112
  typeof (props.useModal) === "boolean" ? this._useModal = props.useModal : false;
100
113
  // Load the form
@@ -124,17 +137,18 @@ var ItemForm = /** @class */ (function () {
124
137
  this._onGetListInfo = props.onGetListInfo;
125
138
  this._onSetFooter = props.onSetFooter;
126
139
  this._onSetHeader = props.onSetHeader;
140
+ this._tabInfo = props.tabInfo;
127
141
  typeof (props.useModal) === "boolean" ? this._useModal = props.useModal : false;
128
142
  // Load the form
129
143
  this.load(props.webUrl, props.itemId);
130
144
  };
131
- /** private static Methods */
145
+ /** Private Methods */
132
146
  // Load the form information
133
147
  ItemForm.load = function (webUrl, itemId) {
134
148
  var _this = this;
135
149
  // Clear the forms
136
- this._displayForm = null;
137
- this._editForm = null;
150
+ this._displayForms = [];
151
+ this._editForms = [];
138
152
  // Show a loading dialog
139
153
  common_1.LoadingDialog.setHeader("Loading the Item");
140
154
  common_1.LoadingDialog.setBody("This will close after the form is loaded...");
@@ -167,162 +181,249 @@ var ItemForm = /** @class */ (function () {
167
181
  }
168
182
  });
169
183
  })().then(function () {
170
- // Set the header
171
- (_this._useModal ? common_1.Modal : common_1.CanvasForm).setHeader('<h5 class="m-0">' + (_this._info.item ? _this._info.item.Title : "Create Item") + '</h5>');
172
- // Call the header event
173
- _this._onSetHeader ? _this._onSetHeader(_this._useModal ? common_1.Modal.HeaderElement : common_1.CanvasForm.HeaderElement) : null;
174
- // Render the form based on the type
175
- if (_this.IsDisplay) {
176
- var el = document.createElement("div");
177
- var props = {
178
- el: el,
179
- info: _this._info,
180
- rowClassName: "mb-3"
181
- };
182
- // Call the event if it exists
183
- props = _this._onCreateViewForm ? _this._onCreateViewForm(props) : props;
184
- // Render the display form
185
- _this._displayForm = gd_sprest_bs_1.Components.ListForm.renderDisplayForm(props);
184
+ // Render the form
185
+ _this.renderForm();
186
+ });
187
+ };
188
+ // Renders the display form
189
+ ItemForm.renderDisplayForm = function (el, tab) {
190
+ // Ensure the element exists
191
+ el = el || document.createElement("div");
192
+ // Set the form properties
193
+ var props = {
194
+ el: el,
195
+ info: this._info,
196
+ rowClassName: "mb-3",
197
+ includeFields: tab.fields,
198
+ onFormRendered: function (form) {
186
199
  /* Remove the bottom margin from the last row of the form */
187
- _this._displayForm.el.lastChild.classList.remove("mb-3");
188
- // Render the form buttons
189
- var elButtons = document.createElement("div");
190
- el.appendChild(elButtons);
191
- // Add styling if not using a modal
192
- if (!_this._useModal) {
193
- elButtons.classList.add("float-end");
194
- elButtons.style.padding = "1rem 0";
195
- }
196
- // Append the create/update button
197
- _this._useModal ? common_1.Modal.setFooter(elButtons) : el.appendChild(elButtons);
198
- // Call the item form button rendering event
199
- var formButtons = [];
200
- formButtons = _this._onFormButtonsRendering ? _this._onFormButtonsRendering(formButtons) : formButtons;
201
- // Render the form buttons
202
- formButtons && formButtons.length > 0 ? gd_sprest_bs_1.Components.ButtonGroup({
203
- el: elButtons,
204
- buttons: formButtons
205
- }) : null;
206
- // Call the footer event
207
- _this._onSetFooter ? _this._onSetFooter(_this._useModal ? common_1.Modal.FooterElement : elButtons) : null;
208
- // Update the body
209
- (_this._useModal ? common_1.Modal : common_1.CanvasForm).setBody(el);
200
+ form.el.lastChild.classList.remove("mb-3");
210
201
  }
211
- else {
212
- var el = document.createElement("div");
213
- var props = {
214
- el: el,
215
- info: _this._info,
216
- rowClassName: "mb-3",
217
- controlMode: _this.IsNew ? gd_sprest_bs_1.SPTypes.ControlMode.New : gd_sprest_bs_1.SPTypes.ControlMode.Edit
218
- };
219
- // Call the event if it exists
220
- props = _this._onCreateEditForm ? _this._onCreateEditForm(props) : props;
221
- // Render the edit form
222
- _this._editForm = gd_sprest_bs_1.Components.ListForm.renderEditForm(props);
202
+ };
203
+ // Call the event if it exists
204
+ props = this._onCreateViewForm ? this._onCreateViewForm(props) : props;
205
+ // Render the display form
206
+ var form = gd_sprest_bs_1.Components.ListForm.renderDisplayForm(props);
207
+ this._displayForms.push(form);
208
+ // Return the form element
209
+ return el;
210
+ };
211
+ // Renders the edit form
212
+ ItemForm.renderEditForm = function (el, tab) {
213
+ // Ensure the element exists
214
+ el = el || document.createElement("div");
215
+ // Set the form properties
216
+ var props = {
217
+ el: el,
218
+ info: this._info,
219
+ rowClassName: "mb-3",
220
+ controlMode: this.IsNew ? gd_sprest_bs_1.SPTypes.ControlMode.New : gd_sprest_bs_1.SPTypes.ControlMode.Edit,
221
+ includeFields: tab.fields,
222
+ onFormRendered: function (form) {
223
223
  /* Remove the bottom margin from the last row of the form */
224
- _this._editForm.el.lastChild.classList.remove("mb-3");
225
- // Render the form buttons
226
- var elButtons = document.createElement("div");
227
- // Add styling if not using a modal
228
- if (!_this._useModal) {
229
- elButtons.classList.add("float-end");
230
- elButtons.style.padding = "1rem 0";
224
+ form.el.lastChild.classList.remove("mb-3");
225
+ }
226
+ };
227
+ // Call the event if it exists
228
+ props = this._onCreateEditForm ? this._onCreateEditForm(props) : props;
229
+ // Render the edit form
230
+ var form = gd_sprest_bs_1.Components.ListForm.renderEditForm(props);
231
+ this._editForms.push(form);
232
+ // Return the form element
233
+ return el;
234
+ };
235
+ // Renders the footer
236
+ ItemForm.renderFooter = function () {
237
+ var _this = this;
238
+ // Render the form buttons
239
+ var elButtons = document.createElement("div");
240
+ // Add styling if not using a modal
241
+ if (!this._useModal) {
242
+ elButtons.classList.add("float-end");
243
+ elButtons.style.padding = "1rem 0";
244
+ }
245
+ // Append the create/update button
246
+ this._useModal ? common_1.Modal.setFooter(elButtons) : common_1.CanvasForm.BodyElement.appendChild(elButtons);
247
+ // See if we are rendering a display form
248
+ if (this.IsDisplay) {
249
+ // Call the item form button rendering event
250
+ var formButtons = [];
251
+ formButtons = this._onFormButtonsRendering ? this._onFormButtonsRendering(formButtons) : formButtons;
252
+ // Render the form buttons
253
+ formButtons && formButtons.length > 0 ? gd_sprest_bs_1.Components.ButtonGroup({
254
+ el: elButtons,
255
+ buttons: formButtons
256
+ }) : null;
257
+ }
258
+ else {
259
+ // Call the item form button rendering event
260
+ var formButtons = [{
261
+ text: this.IsNew ? "Create" : "Update",
262
+ type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,
263
+ onClick: function () { _this.save(); }
264
+ }];
265
+ formButtons = this._onFormButtonsRendering ? this._onFormButtonsRendering(formButtons) : formButtons;
266
+ // Render the form buttons
267
+ formButtons && formButtons.length > 0 ? gd_sprest_bs_1.Components.ButtonGroup({
268
+ el: elButtons,
269
+ buttons: formButtons
270
+ }) : null;
271
+ }
272
+ // Call the footer event
273
+ this._onSetFooter ? this._onSetFooter(this._useModal ? common_1.Modal.FooterElement : elButtons) : null;
274
+ };
275
+ // Renders the form
276
+ ItemForm.renderForm = function () {
277
+ // Set the header
278
+ (this._useModal ? common_1.Modal : common_1.CanvasForm).setHeader('<h5 class="m-0">' + (this._info.item ? this._info.item.Title : "Create Item") + '</h5>');
279
+ // Call the header event
280
+ this._onSetHeader ? this._onSetHeader(this._useModal ? common_1.Modal.HeaderElement : common_1.CanvasForm.HeaderElement) : null;
281
+ // See if we are rendering tabs
282
+ if (this._tabInfo) {
283
+ // Render the tabs
284
+ this.renderTabs();
285
+ }
286
+ else {
287
+ // Render the form based on the type
288
+ var elForm = this.IsDisplay ? this.renderDisplayForm() : this.renderEditForm();
289
+ // Update the body
290
+ (this._useModal ? common_1.Modal : common_1.CanvasForm).setBody(elForm);
291
+ }
292
+ // Render the footer
293
+ this.renderFooter();
294
+ // Close the dialog
295
+ common_1.LoadingDialog.hide();
296
+ // Show the form
297
+ (this._useModal ? common_1.Modal : common_1.CanvasForm).show();
298
+ };
299
+ // Generates a tab
300
+ ItemForm.renderTabs = function () {
301
+ var _this = this;
302
+ var tabs = [];
303
+ // Parse the tabs to render
304
+ for (var i = 0; i < this._tabInfo.tabs.length; i++) {
305
+ var tabInfo = this._tabInfo.tabs[i];
306
+ // Generate the tab
307
+ var tab = {
308
+ data: tabInfo,
309
+ isActive: i == 0,
310
+ tabName: tabInfo.title,
311
+ onRender: function (el, item) {
312
+ // Render the form
313
+ _this.IsDisplay ? _this.renderDisplayForm(el, item.data) : _this.renderEditForm(el, item.data);
314
+ // Call the event
315
+ var tab = item.data;
316
+ tab.onRendered ? tab.onRendered(el, item) : null;
231
317
  }
232
- // Append the create/update button
233
- _this._useModal ? common_1.Modal.setFooter(elButtons) : el.appendChild(elButtons);
234
- // Call the item form button rendering event
235
- var formButtons = [{
236
- text: _this.IsNew ? "Create" : "Update",
237
- type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,
238
- onClick: function () { _this.save(_this._editForm); }
239
- }];
240
- formButtons = _this._onFormButtonsRendering ? _this._onFormButtonsRendering(formButtons) : formButtons;
241
- // Render the form buttons
242
- formButtons && formButtons.length > 0 ? gd_sprest_bs_1.Components.ButtonGroup({
243
- el: elButtons,
244
- buttons: formButtons
245
- }) : null;
246
- // Call the footer event
247
- _this._onSetFooter ? _this._onSetFooter(_this._useModal ? common_1.Modal.FooterElement : elButtons) : null;
248
- // Update the body
249
- (_this._useModal ? common_1.Modal : common_1.CanvasForm).setBody(el);
318
+ };
319
+ // Call the rendering event
320
+ tab = tabInfo.onRendering ? tabInfo.onRendering(tab) : tab;
321
+ if (tab) {
322
+ // Append the tab
323
+ tabs.push(tab);
250
324
  }
251
- // Close the dialog
252
- common_1.LoadingDialog.hide();
253
- // Show the form
254
- (_this._useModal ? common_1.Modal : common_1.CanvasForm).show();
255
- });
325
+ }
326
+ // Render the tabs
327
+ return gd_sprest_bs_1.Components.ListGroup({
328
+ el: this.UseModal ? common_1.Modal.BodyElement : common_1.CanvasForm.BodyElement,
329
+ colWidth: this._tabInfo.isVertical ? 4 : 12,
330
+ isTabs: true,
331
+ isHorizontal: this._tabInfo.isVertical != true,
332
+ items: tabs
333
+ }).el;
256
334
  };
257
335
  // Saves the edit form
258
336
  ItemForm.save = function (form) {
259
337
  var _this = this;
260
- if (form === void 0) { form = this._editForm; }
261
- // Validate the form
262
- this.validate(form).then(
338
+ if (form === void 0) { form = this._editForms[0]; }
339
+ var forms = form ? [form] : this._editForms;
340
+ var values = {};
341
+ // Display a loading dialog
342
+ common_1.LoadingDialog.setHeader("Validation");
343
+ common_1.LoadingDialog.setBody("Validating the form...");
344
+ common_1.LoadingDialog.show();
345
+ // Validate the forms
346
+ var isValid = true;
347
+ gd_sprest_bs_1.Helper.Executor(forms, function (form) {
348
+ // Return a promise
349
+ return new Promise(function (resolve) {
350
+ // Validate the form
351
+ _this.validate(form).then(
352
+ // Valid
353
+ function () {
354
+ // Update the values
355
+ values = __assign(__assign({}, values), form.getValues());
356
+ // Resolve the request
357
+ resolve(null);
358
+ },
359
+ // Not Valid
360
+ function () {
361
+ // Set the flag
362
+ isValid = false;
363
+ // Resolve the request
364
+ resolve(null);
365
+ });
366
+ });
367
+ }).then(
263
368
  // Success
264
369
  function () {
265
- // Display a loading dialog
266
- common_1.LoadingDialog.setHeader("Saving the Item");
267
- common_1.LoadingDialog.setBody((_this.IsNew ? "Creating" : "Updating") + " the Item");
268
- common_1.LoadingDialog.show();
269
- // Saves the item
270
- var saveItem = function (values) {
271
- // Save the item
272
- form.save(values).then(function (item) {
273
- // Call the update event
274
- _this._updateEvent ? _this._updateEvent(item) : null;
275
- // Close the dialogs
276
- (_this._useModal ? common_1.Modal : common_1.CanvasForm).hide();
277
- common_1.LoadingDialog.hide();
278
- });
279
- };
280
- // Call the save event
281
- var values = form.getValues();
282
- values = _this._onSave ? _this._onSave(values) : values;
283
- // See if the onSave event returned a promise
284
- if (values && typeof (values.then) === "function") {
285
- // Wait for the promise to complete
286
- values.then(function (values) {
287
- // Save the item
288
- saveItem(values);
370
+ // See if the form(s) are valid
371
+ if (isValid) {
372
+ // Call the custom validation event
373
+ _this.validate(values).then(
374
+ // Valid
375
+ function () {
376
+ // Update the loading dialog
377
+ common_1.LoadingDialog.setHeader("Saving the Item");
378
+ common_1.LoadingDialog.setBody((_this.IsNew ? "Creating" : "Updating") + " the Item");
379
+ // Saves the item
380
+ var saveItem = function (values) {
381
+ // Save the item
382
+ form.save(values).then(function (item) {
383
+ // Call the update event
384
+ _this._updateEvent ? _this._updateEvent(item) : null;
385
+ // Close the dialogs
386
+ (_this._useModal ? common_1.Modal : common_1.CanvasForm).hide();
387
+ common_1.LoadingDialog.hide();
388
+ });
389
+ };
390
+ // Call the save event
391
+ values = _this._onSave ? _this._onSave(values) : values;
392
+ // See if the onSave event returned a promise
393
+ if (values && typeof (values["then"]) === "function") {
394
+ // Wait for the promise to complete
395
+ values["then"](function (values) {
396
+ // Save the item
397
+ saveItem(values);
398
+ });
399
+ }
400
+ else {
401
+ // Save the item
402
+ saveItem(values);
403
+ }
404
+ },
405
+ // Not Valid
406
+ function () {
407
+ // Do nothing
289
408
  });
290
409
  }
291
410
  else {
292
- // Save the item
293
- saveItem(values);
411
+ // Close the dialog
412
+ common_1.LoadingDialog.hide();
294
413
  }
295
- },
296
- // Error
297
- function () {
298
- // Do Nothing
299
414
  });
300
415
  };
301
416
  // Validates the form
302
- ItemForm.validate = function (form) {
417
+ ItemForm.validate = function (values) {
303
418
  var _this = this;
304
419
  // Return a promise
305
420
  return new Promise(function (resolve, reject) {
306
- var isValid = form.isValid();
307
- // Display a loading dialog
308
- common_1.LoadingDialog.setHeader("Validation");
309
- common_1.LoadingDialog.setBody("Validating the form...");
310
- common_1.LoadingDialog.show();
311
- // Ensure it's valid
312
- if (!isValid) {
313
- // Close the dialog
314
- common_1.LoadingDialog.hide();
315
- // Reject the request
316
- reject();
317
- return;
318
- }
421
+ var isValid = true;
319
422
  // Call the validation event
320
- var returnVal = _this._onValidation ? _this._onValidation(form.getValues()) : null;
423
+ var returnVal = _this._onValidation ? _this._onValidation(values) : null;
321
424
  if (returnVal && typeof (returnVal.then) === "function") {
322
425
  // Wait for the promise to complete
323
426
  returnVal.then(function (isValid) {
324
- // Close the dialog
325
- common_1.LoadingDialog.hide();
326
427
  // Resolve the request
327
428
  isValid ? resolve() : reject();
328
429
  });
@@ -332,8 +433,6 @@ var ItemForm = /** @class */ (function () {
332
433
  // Update the flag
333
434
  isValid = returnVal;
334
435
  }
335
- // Close the dialog
336
- common_1.LoadingDialog.hide();
337
436
  // Resolve the request
338
437
  isValid ? resolve() : reject();
339
438
  }
@@ -347,11 +446,12 @@ var ItemForm = /** @class */ (function () {
347
446
  ItemForm._onSetHeader = null;
348
447
  ItemForm._onSave = null;
349
448
  ItemForm._onValidation = null;
449
+ ItemForm._tabInfo = null;
350
450
  ItemForm._updateEvent = null;
351
451
  // Display Form
352
- ItemForm._displayForm = null;
452
+ ItemForm._displayForms = null;
353
453
  // Edit Form
354
- ItemForm._editForm = null;
454
+ ItemForm._editForms = null;
355
455
  // Form Information
356
456
  ItemForm._info = null;
357
457
  // Form Modes