@formio/js 5.0.0-rc.41 → 5.0.0-rc.42

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 (40) hide show
  1. package/dist/formio.builder.css +2 -2
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +2 -2
  7. package/dist/formio.form.js +64 -31
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +5 -5
  11. package/dist/formio.full.css +2 -2
  12. package/dist/formio.full.js +65 -32
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +5 -5
  16. package/dist/formio.js +3 -3
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +3 -3
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +3 -3
  22. package/lib/cjs/Form.js +32 -1
  23. package/lib/cjs/Webform.js +1 -1
  24. package/lib/cjs/WebformBuilder.js +18 -2
  25. package/lib/cjs/components/datagrid/DataGrid.js +1 -1
  26. package/lib/cjs/components/datetime/fixtures/comp13.js +118 -0
  27. package/lib/cjs/components/datetime/fixtures/index.js +3 -1
  28. package/lib/cjs/components/form/Form.js +27 -3
  29. package/lib/cjs/components/radio/Radio.js +13 -0
  30. package/lib/cjs/widgets/CalendarWidget.js +8 -0
  31. package/lib/mjs/Form.js +32 -1
  32. package/lib/mjs/Webform.js +1 -1
  33. package/lib/mjs/WebformBuilder.js +17 -1
  34. package/lib/mjs/components/datagrid/DataGrid.js +1 -1
  35. package/lib/mjs/components/datetime/fixtures/comp13.js +116 -0
  36. package/lib/mjs/components/datetime/fixtures/index.js +2 -1
  37. package/lib/mjs/components/form/Form.js +25 -2
  38. package/lib/mjs/components/radio/Radio.js +16 -0
  39. package/lib/mjs/widgets/CalendarWidget.js +8 -0
  40. package/package.json +6 -6
@@ -10,11 +10,11 @@
10
10
  * MIT licensed
11
11
  */
12
12
 
13
- /*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
13
+ /*! @license DOMPurify 3.0.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.11/LICENSE */
14
14
 
15
- /*! @license DOMPurify 3.0.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.9/LICENSE */
15
+ /*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */
16
16
 
17
- /*! formiojs v5.0.0-rc.41 | https://unpkg.com/formiojs@5.0.0-rc.41/LICENSE.txt */
17
+ /*! formiojs v5.0.0-rc.42 | https://unpkg.com/formiojs@5.0.0-rc.42/LICENSE.txt */
18
18
 
19
19
  /**
20
20
  * @license
package/lib/cjs/Form.js CHANGED
@@ -178,6 +178,36 @@ class Form extends Element_1.default {
178
178
  ]
179
179
  };
180
180
  }
181
+ /**
182
+ * Check Subdirectories path and provide correct options
183
+ *
184
+ * @param {string} url - The the URL of the form json.
185
+ * @param {form} object - The form json.
186
+ * @return {object} The initial options with base and project.
187
+ */
188
+ getFormInitOptions(url, form) {
189
+ const options = {};
190
+ const index = url.indexOf(form === null || form === void 0 ? void 0 : form.path);
191
+ // form url doesn't include form path
192
+ if (index === -1) {
193
+ return options;
194
+ }
195
+ const projectUrl = url.substring(0, index - 1);
196
+ const urlParts = Formio_1.Formio.getUrlParts(projectUrl);
197
+ // project url doesn't include subdirectories path
198
+ if (!urlParts || urlParts.filter(part => !!part).length < 4) {
199
+ return options;
200
+ }
201
+ const baseUrl = `${urlParts[1]}${urlParts[2]}`;
202
+ // Skip if baseUrl has already been set
203
+ if (baseUrl !== Formio_1.Formio.baseUrl) {
204
+ return {
205
+ base: baseUrl,
206
+ project: projectUrl,
207
+ };
208
+ }
209
+ return {};
210
+ }
181
211
  setForm(formParam) {
182
212
  let result;
183
213
  formParam = formParam || this.form;
@@ -202,7 +232,8 @@ class Form extends Element_1.default {
202
232
  }
203
233
  this.loading = false;
204
234
  this.instance = this.instance || this.create(form.display);
205
- this.instance.url = formParam;
235
+ const options = this.getFormInitOptions(formParam, form);
236
+ this.instance.setUrl(formParam, options);
206
237
  this.instance.nosubmit = false;
207
238
  this._form = this.instance.form = form;
208
239
  if (submission) {
@@ -1005,7 +1005,7 @@ class Webform extends NestedDataComponent_1.default {
1005
1005
  if (!Array.isArray(errors)) {
1006
1006
  errors = [errors];
1007
1007
  }
1008
- errors = errors.concat(this.customErrors);
1008
+ errors = errors.concat(this.customErrors).filter((err) => !!err);
1009
1009
  if (!errors.length) {
1010
1010
  this.setAlert(false);
1011
1011
  return;
@@ -123,7 +123,7 @@ class WebformBuilder extends Component_1.default {
123
123
  }
124
124
  this.options.hooks = this.options.hooks || {};
125
125
  this.options.hooks.renderComponent = (html, { component, self }) => {
126
- var _a;
126
+ var _a, _b;
127
127
  if (self.type === 'form' && !self.key) {
128
128
  const template = this.hook('renderComponentFormTemplate', html.replace('formio-component-form', ''));
129
129
  // The main webform shouldn't have this class as it adds extra styles.
@@ -136,6 +136,7 @@ class WebformBuilder extends Component_1.default {
136
136
  html,
137
137
  disableBuilderActions: (_a = self === null || self === void 0 ? void 0 : self.component) === null || _a === void 0 ? void 0 : _a.disableBuilderActions,
138
138
  childComponent: component,
139
+ design: (_b = self === null || self === void 0 ? void 0 : self.options) === null || _b === void 0 ? void 0 : _b.design
139
140
  });
140
141
  };
141
142
  this.options.hooks.renderComponents = (html, { components, self }) => {
@@ -486,6 +487,7 @@ class WebformBuilder extends Component_1.default {
486
487
  attach(element) {
487
488
  this.on('change', (form) => {
488
489
  this.populateRecaptchaSettings(form);
490
+ this.webform.setAlert(false);
489
491
  });
490
492
  return super.attach(element).then(() => {
491
493
  this.loadRefs(element, {
@@ -819,6 +821,20 @@ class WebformBuilder extends Component_1.default {
819
821
  return;
820
822
  }
821
823
  }
824
+ if (draggableComponent.uniqueComponent) {
825
+ let isCompAlreadyExists = false;
826
+ (0, formUtils_1.eachComponent)(this.webform.components, (component) => {
827
+ if (component.key === draggableComponent.schema.key) {
828
+ isCompAlreadyExists = true;
829
+ return;
830
+ }
831
+ }, true);
832
+ if (isCompAlreadyExists) {
833
+ this.webform.redraw();
834
+ this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
835
+ return;
836
+ }
837
+ }
822
838
  if (target !== source) {
823
839
  // Ensure the key remains unique in its new container.
824
840
  builder_1.default.uniquify(this.findNamespaceRoot(target.formioComponent), info);
@@ -851,7 +867,7 @@ class WebformBuilder extends Component_1.default {
851
867
  parent.addChildComponent(info, element, target, source, sibling);
852
868
  }
853
869
  const componentInDataGrid = parent.type === 'datagrid';
854
- if (isNew && !this.options.noNewEdit && !info.noNewEdit) {
870
+ if (isNew && !this.options.noNewEdit && !info.noNewEdit && !(this.options.design && info.type === 'reviewpage')) {
855
871
  this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
856
872
  }
857
873
  // Only rebuild the parts needing to be rebuilt.
@@ -199,7 +199,7 @@ class DataGridComponent extends NestedArrayComponent_1.default {
199
199
  return this.hasAddButton() && ['bottom', 'both'].includes(this.addAnotherPosition);
200
200
  }
201
201
  get canAddColumn() {
202
- return this.builderMode;
202
+ return this.builderMode && !this.options.design;
203
203
  }
204
204
  render() {
205
205
  const columns = this.getColumns();
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ components: [
7
+ {
8
+ label: 'Min Date',
9
+ tableView: false,
10
+ datePicker: {
11
+ disableWeekends: false,
12
+ disableWeekdays: false
13
+ },
14
+ enableMinDateInput: false,
15
+ enableMaxDateInput: false,
16
+ key: 'minDate',
17
+ type: 'datetime',
18
+ input: true,
19
+ widget: {
20
+ type: 'calendar',
21
+ displayInTimezone: 'viewer',
22
+ locale: 'en',
23
+ useLocaleSettings: false,
24
+ allowInput: true,
25
+ mode: 'single',
26
+ enableTime: true,
27
+ noCalendar: false,
28
+ format: 'yyyy-MM-dd hh:mm a',
29
+ hourIncrement: 1,
30
+ minuteIncrement: 1,
31
+ // eslint-disable-next-line camelcase
32
+ time_24hr: false,
33
+ minDate: null,
34
+ disableWeekends: false,
35
+ disableWeekdays: false,
36
+ maxDate: null
37
+ }
38
+ },
39
+ {
40
+ label: 'Max Date',
41
+ tableView: false,
42
+ enableMinDateInput: false,
43
+ datePicker: {
44
+ disableWeekends: false,
45
+ disableWeekdays: false
46
+ },
47
+ enableMaxDateInput: false,
48
+ validate: {
49
+ custom: "var minDate = moment(data.minDate);\nvar maxDate = moment(data.maxDate);\nvalid = maxDate.isAfter(minDate)? true : 'Max date must be after min date'"
50
+ },
51
+ key: 'maxDate',
52
+ type: 'datetime',
53
+ input: true,
54
+ widget: {
55
+ type: 'calendar',
56
+ displayInTimezone: 'viewer',
57
+ locale: 'en',
58
+ useLocaleSettings: false,
59
+ allowInput: true,
60
+ mode: 'single',
61
+ enableTime: true,
62
+ noCalendar: false,
63
+ format: 'yyyy-MM-dd hh:mm a',
64
+ hourIncrement: 1,
65
+ minuteIncrement: 1,
66
+ // eslint-disable-next-line camelcase
67
+ time_24hr: false,
68
+ minDate: null,
69
+ disableWeekends: false,
70
+ disableWeekdays: false,
71
+ maxDate: null
72
+ }
73
+ },
74
+ {
75
+ label: 'In Between Date',
76
+ tableView: false,
77
+ datePicker: {
78
+ disableFunction: '!moment(date).isBetween(moment(data.minDate), moment(data.maxDate))',
79
+ disableWeekends: false,
80
+ disableWeekdays: false
81
+ },
82
+ enableMinDateInput: false,
83
+ enableMaxDateInput: false,
84
+ key: 'inBetweenDate',
85
+ customConditional: 'show = !!data.minDate && !!data.maxDate',
86
+ type: 'datetime',
87
+ input: true,
88
+ widget: {
89
+ type: 'calendar',
90
+ displayInTimezone: 'viewer',
91
+ locale: 'en',
92
+ useLocaleSettings: false,
93
+ allowInput: true,
94
+ mode: 'single',
95
+ enableTime: true,
96
+ noCalendar: false,
97
+ format: 'yyyy-MM-dd hh:mm a',
98
+ hourIncrement: 1,
99
+ minuteIncrement: 1,
100
+ // eslint-disable-next-line camelcase
101
+ time_24hr: false,
102
+ minDate: null,
103
+ disableWeekends: false,
104
+ disableWeekdays: false,
105
+ disableFunction: '!moment(date).isBetween(moment(data.minDate), moment(data.maxDate))',
106
+ maxDate: null
107
+ }
108
+ },
109
+ {
110
+ type: 'button',
111
+ label: 'Submit',
112
+ key: 'submit',
113
+ disableOnInvalid: true,
114
+ input: true,
115
+ tableView: false
116
+ }
117
+ ],
118
+ };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp3 = exports.comp2 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp1 = void 0;
6
+ exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp3 = exports.comp2 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp1 = void 0;
7
7
  const comp1_1 = __importDefault(require("./comp1"));
8
8
  exports.comp1 = comp1_1.default;
9
9
  const comp2_1 = __importDefault(require("./comp2"));
@@ -26,3 +26,5 @@ const comp11_1 = __importDefault(require("./comp11"));
26
26
  exports.comp11 = comp11_1.default;
27
27
  const comp12_1 = __importDefault(require("./comp12"));
28
28
  exports.comp12 = comp12_1.default;
29
+ const comp13_1 = __importDefault(require("./comp13"));
30
+ exports.comp13 = comp13_1.default;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ /* eslint-disable max-statements */
6
7
  const lodash_1 = __importDefault(require("lodash"));
7
8
  const Component_1 = __importDefault(require("../_classes/component/Component"));
8
9
  const ComponentModal_1 = __importDefault(require("../_classes/componentModal/ComponentModal"));
@@ -197,6 +198,12 @@ class FormComponent extends Component_1.default {
197
198
  if (this.options.inEditGrid) {
198
199
  options.inEditGrid = this.options.inEditGrid;
199
200
  }
201
+ if (this.options.saveDraft) {
202
+ options.saveDraft = this.options.saveDraft;
203
+ }
204
+ if (this.options.saveDraftThrottle) {
205
+ options.saveDraftThrottle = this.options.saveDraftThrottle;
206
+ }
200
207
  return options;
201
208
  }
202
209
  render() {
@@ -396,6 +403,10 @@ class FormComponent extends Component_1.default {
396
403
  this.subForm.nosubmit = true;
397
404
  this.subForm.root = this.root;
398
405
  this.subForm.localRoot = this.isNestedWizard ? this.localRoot : this.subForm;
406
+ if (this.parent) {
407
+ this.subForm.draftEnabled = this.parent.draftEnabled;
408
+ this.subForm.savingDraft = this.parent.savingDraft;
409
+ }
399
410
  this.restoreValue();
400
411
  this.valueChanged = this.hasSetValue;
401
412
  this.onChange();
@@ -418,7 +429,7 @@ class FormComponent extends Component_1.default {
418
429
  * Load the subform.
419
430
  */
420
431
  loadSubForm(fromAttach) {
421
- var _a;
432
+ var _a, _b, _c;
422
433
  if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
423
434
  return Promise.resolve();
424
435
  }
@@ -432,7 +443,13 @@ class FormComponent extends Component_1.default {
432
443
  }
433
444
  else if (this.formSrc) {
434
445
  this.subFormLoading = true;
435
- return (new Formio_1.Formio(this.formSrc)).loadForm({ params: { live: 1 } })
446
+ const options = ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.base) && ((_c = this.root.formio) === null || _c === void 0 ? void 0 : _c.projectUrl)
447
+ ? {
448
+ base: this.root.formio.base,
449
+ project: this.root.formio.projectUrl,
450
+ }
451
+ : {};
452
+ return (new Formio_1.Formio(this.formSrc, options)).loadForm({ params: { live: 1 } })
436
453
  .then((formObj) => {
437
454
  this.formObj = formObj;
438
455
  if (this.options.pdf && this.component.useOriginalRevision) {
@@ -601,6 +618,7 @@ class FormComponent extends Component_1.default {
601
618
  return changed;
602
619
  }
603
620
  setSubFormValue(submission, flags) {
621
+ var _a, _b;
604
622
  const shouldLoadSubmissionById = submission
605
623
  && submission._id
606
624
  && this.subForm.formio
@@ -608,7 +626,13 @@ class FormComponent extends Component_1.default {
608
626
  if (shouldLoadSubmissionById) {
609
627
  const formId = submission.form || this.formObj.form || this.component.form;
610
628
  const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
611
- this.subForm.setUrl(submissionUrl, this.options);
629
+ const options = ((_a = this.root.formio) === null || _a === void 0 ? void 0 : _a.base) && ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.projectUrl)
630
+ ? {
631
+ base: this.root.formio.base,
632
+ project: this.root.formio.projectUrl,
633
+ }
634
+ : {};
635
+ this.subForm.setUrl(submissionUrl, Object.assign(Object.assign({}, this.options), options));
612
636
  this.subForm.loadSubmission().catch((err) => {
613
637
  console.error(`Unable to load subform submission ${submission._id}:`, err);
614
638
  });
@@ -46,6 +46,19 @@ class RadioComponent extends ListComponent_1.default {
46
46
  };
47
47
  } });
48
48
  }
49
+ static get serverConditionSettings() {
50
+ return Object.assign(Object.assign({}, super.serverConditionSettings), { valueComponent(classComp) {
51
+ return {
52
+ type: 'select',
53
+ dataSrc: 'custom',
54
+ valueProperty: 'value',
55
+ dataType: classComp.dataType || '',
56
+ data: {
57
+ custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`,
58
+ },
59
+ };
60
+ } });
61
+ }
49
62
  static savedValueTypes(schema) {
50
63
  const { boolean, string, number, object, array } = utils_1.componentValueTypes;
51
64
  const { dataType } = schema;
@@ -419,6 +419,14 @@ class CalendarWidget extends InputWidget_1.default {
419
419
  }
420
420
  }
421
421
  });
422
+ // If other fields are used to calculate disabled dates, we need to redraw calendar to refresh disabled dates
423
+ if (this.settings.disableFunction && this.componentInstance && this.componentInstance.root) {
424
+ this.componentInstance.root.on('change', (e) => {
425
+ if (e.changed && this.calendar) {
426
+ this.calendar.redraw();
427
+ }
428
+ });
429
+ }
422
430
  // Restore the calendar value from the component value.
423
431
  this.setValue(this.componentValue);
424
432
  }
package/lib/mjs/Form.js CHANGED
@@ -150,6 +150,36 @@ export default class Form extends Element {
150
150
  ]
151
151
  };
152
152
  }
153
+ /**
154
+ * Check Subdirectories path and provide correct options
155
+ *
156
+ * @param {string} url - The the URL of the form json.
157
+ * @param {form} object - The form json.
158
+ * @return {object} The initial options with base and project.
159
+ */
160
+ getFormInitOptions(url, form) {
161
+ const options = {};
162
+ const index = url.indexOf(form?.path);
163
+ // form url doesn't include form path
164
+ if (index === -1) {
165
+ return options;
166
+ }
167
+ const projectUrl = url.substring(0, index - 1);
168
+ const urlParts = Formio.getUrlParts(projectUrl);
169
+ // project url doesn't include subdirectories path
170
+ if (!urlParts || urlParts.filter(part => !!part).length < 4) {
171
+ return options;
172
+ }
173
+ const baseUrl = `${urlParts[1]}${urlParts[2]}`;
174
+ // Skip if baseUrl has already been set
175
+ if (baseUrl !== Formio.baseUrl) {
176
+ return {
177
+ base: baseUrl,
178
+ project: projectUrl,
179
+ };
180
+ }
181
+ return {};
182
+ }
153
183
  setForm(formParam) {
154
184
  let result;
155
185
  formParam = formParam || this.form;
@@ -174,7 +204,8 @@ export default class Form extends Element {
174
204
  }
175
205
  this.loading = false;
176
206
  this.instance = this.instance || this.create(form.display);
177
- this.instance.url = formParam;
207
+ const options = this.getFormInitOptions(formParam, form);
208
+ this.instance.setUrl(formParam, options);
178
209
  this.instance.nosubmit = false;
179
210
  this._form = this.instance.form = form;
180
211
  if (submission) {
@@ -1005,7 +1005,7 @@ export default class Webform extends NestedDataComponent {
1005
1005
  if (!Array.isArray(errors)) {
1006
1006
  errors = [errors];
1007
1007
  }
1008
- errors = errors.concat(this.customErrors);
1008
+ errors = errors.concat(this.customErrors).filter((err) => !!err);
1009
1009
  if (!errors.length) {
1010
1010
  this.setAlert(false);
1011
1011
  return;
@@ -115,6 +115,7 @@ export default class WebformBuilder extends Component {
115
115
  html,
116
116
  disableBuilderActions: self?.component?.disableBuilderActions,
117
117
  childComponent: component,
118
+ design: self?.options?.design
118
119
  });
119
120
  };
120
121
  this.options.hooks.renderComponents = (html, { components, self }) => {
@@ -472,6 +473,7 @@ export default class WebformBuilder extends Component {
472
473
  attach(element) {
473
474
  this.on('change', (form) => {
474
475
  this.populateRecaptchaSettings(form);
476
+ this.webform.setAlert(false);
475
477
  });
476
478
  return super.attach(element).then(() => {
477
479
  this.loadRefs(element, {
@@ -804,6 +806,20 @@ export default class WebformBuilder extends Component {
804
806
  return;
805
807
  }
806
808
  }
809
+ if (draggableComponent.uniqueComponent) {
810
+ let isCompAlreadyExists = false;
811
+ eachComponent(this.webform.components, (component) => {
812
+ if (component.key === draggableComponent.schema.key) {
813
+ isCompAlreadyExists = true;
814
+ return;
815
+ }
816
+ }, true);
817
+ if (isCompAlreadyExists) {
818
+ this.webform.redraw();
819
+ this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
820
+ return;
821
+ }
822
+ }
807
823
  if (target !== source) {
808
824
  // Ensure the key remains unique in its new container.
809
825
  BuilderUtils.uniquify(this.findNamespaceRoot(target.formioComponent), info);
@@ -836,7 +852,7 @@ export default class WebformBuilder extends Component {
836
852
  parent.addChildComponent(info, element, target, source, sibling);
837
853
  }
838
854
  const componentInDataGrid = parent.type === 'datagrid';
839
- if (isNew && !this.options.noNewEdit && !info.noNewEdit) {
855
+ if (isNew && !this.options.noNewEdit && !info.noNewEdit && !(this.options.design && info.type === 'reviewpage')) {
840
856
  this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
841
857
  }
842
858
  // Only rebuild the parts needing to be rebuilt.
@@ -196,7 +196,7 @@ export default class DataGridComponent extends NestedArrayComponent {
196
196
  return this.hasAddButton() && ['bottom', 'both'].includes(this.addAnotherPosition);
197
197
  }
198
198
  get canAddColumn() {
199
- return this.builderMode;
199
+ return this.builderMode && !this.options.design;
200
200
  }
201
201
  render() {
202
202
  const columns = this.getColumns();
@@ -0,0 +1,116 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'form',
4
+ components: [
5
+ {
6
+ label: 'Min Date',
7
+ tableView: false,
8
+ datePicker: {
9
+ disableWeekends: false,
10
+ disableWeekdays: false
11
+ },
12
+ enableMinDateInput: false,
13
+ enableMaxDateInput: false,
14
+ key: 'minDate',
15
+ type: 'datetime',
16
+ input: true,
17
+ widget: {
18
+ type: 'calendar',
19
+ displayInTimezone: 'viewer',
20
+ locale: 'en',
21
+ useLocaleSettings: false,
22
+ allowInput: true,
23
+ mode: 'single',
24
+ enableTime: true,
25
+ noCalendar: false,
26
+ format: 'yyyy-MM-dd hh:mm a',
27
+ hourIncrement: 1,
28
+ minuteIncrement: 1,
29
+ // eslint-disable-next-line camelcase
30
+ time_24hr: false,
31
+ minDate: null,
32
+ disableWeekends: false,
33
+ disableWeekdays: false,
34
+ maxDate: null
35
+ }
36
+ },
37
+ {
38
+ label: 'Max Date',
39
+ tableView: false,
40
+ enableMinDateInput: false,
41
+ datePicker: {
42
+ disableWeekends: false,
43
+ disableWeekdays: false
44
+ },
45
+ enableMaxDateInput: false,
46
+ validate: {
47
+ custom: "var minDate = moment(data.minDate);\nvar maxDate = moment(data.maxDate);\nvalid = maxDate.isAfter(minDate)? true : 'Max date must be after min date'"
48
+ },
49
+ key: 'maxDate',
50
+ type: 'datetime',
51
+ input: true,
52
+ widget: {
53
+ type: 'calendar',
54
+ displayInTimezone: 'viewer',
55
+ locale: 'en',
56
+ useLocaleSettings: false,
57
+ allowInput: true,
58
+ mode: 'single',
59
+ enableTime: true,
60
+ noCalendar: false,
61
+ format: 'yyyy-MM-dd hh:mm a',
62
+ hourIncrement: 1,
63
+ minuteIncrement: 1,
64
+ // eslint-disable-next-line camelcase
65
+ time_24hr: false,
66
+ minDate: null,
67
+ disableWeekends: false,
68
+ disableWeekdays: false,
69
+ maxDate: null
70
+ }
71
+ },
72
+ {
73
+ label: 'In Between Date',
74
+ tableView: false,
75
+ datePicker: {
76
+ disableFunction: '!moment(date).isBetween(moment(data.minDate), moment(data.maxDate))',
77
+ disableWeekends: false,
78
+ disableWeekdays: false
79
+ },
80
+ enableMinDateInput: false,
81
+ enableMaxDateInput: false,
82
+ key: 'inBetweenDate',
83
+ customConditional: 'show = !!data.minDate && !!data.maxDate',
84
+ type: 'datetime',
85
+ input: true,
86
+ widget: {
87
+ type: 'calendar',
88
+ displayInTimezone: 'viewer',
89
+ locale: 'en',
90
+ useLocaleSettings: false,
91
+ allowInput: true,
92
+ mode: 'single',
93
+ enableTime: true,
94
+ noCalendar: false,
95
+ format: 'yyyy-MM-dd hh:mm a',
96
+ hourIncrement: 1,
97
+ minuteIncrement: 1,
98
+ // eslint-disable-next-line camelcase
99
+ time_24hr: false,
100
+ minDate: null,
101
+ disableWeekends: false,
102
+ disableWeekdays: false,
103
+ disableFunction: '!moment(date).isBetween(moment(data.minDate), moment(data.maxDate))',
104
+ maxDate: null
105
+ }
106
+ },
107
+ {
108
+ type: 'button',
109
+ label: 'Submit',
110
+ key: 'submit',
111
+ disableOnInvalid: true,
112
+ input: true,
113
+ tableView: false
114
+ }
115
+ ],
116
+ };
@@ -9,4 +9,5 @@ import comp9 from './comp9';
9
9
  import comp10 from './comp10';
10
10
  import comp11 from './comp11';
11
11
  import comp12 from './comp12';
12
- export { comp1, comp10, comp11, comp12, comp2, comp3, comp5, comp6, comp7, comp8, comp9 };
12
+ import comp13 from './comp13';
13
+ export { comp1, comp10, comp11, comp12, comp13, comp2, comp3, comp5, comp6, comp7, comp8, comp9 };