@formio/js 5.1.0-dev.6012.8e3fc09 → 5.1.0-dev.6019.b7cdf53

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.
@@ -198,6 +198,7 @@ class Component extends Element_1.default {
198
198
  properties: {},
199
199
  allowMultipleMasks: false,
200
200
  addons: [],
201
+ serverOverride: {},
201
202
  }, ...sources);
202
203
  }
203
204
  /**
@@ -87,6 +87,9 @@ declare const _default: ({
87
87
  valueProperty?: undefined;
88
88
  data?: undefined;
89
89
  conditional?: undefined;
90
+ as?: undefined;
91
+ editor?: undefined;
92
+ description?: undefined;
90
93
  } | {
91
94
  type: string;
92
95
  label: string;
@@ -103,6 +106,9 @@ declare const _default: ({
103
106
  valueProperty?: undefined;
104
107
  data?: undefined;
105
108
  conditional?: undefined;
109
+ as?: undefined;
110
+ editor?: undefined;
111
+ description?: undefined;
106
112
  } | {
107
113
  weight: number;
108
114
  type: string;
@@ -125,6 +131,9 @@ declare const _default: ({
125
131
  valueProperty?: undefined;
126
132
  data?: undefined;
127
133
  conditional?: undefined;
134
+ as?: undefined;
135
+ editor?: undefined;
136
+ description?: undefined;
128
137
  } | {
129
138
  weight: number;
130
139
  type: string;
@@ -173,6 +182,9 @@ declare const _default: ({
173
182
  valueProperty?: undefined;
174
183
  data?: undefined;
175
184
  conditional?: undefined;
185
+ as?: undefined;
186
+ editor?: undefined;
187
+ description?: undefined;
176
188
  } | {
177
189
  type: string;
178
190
  input: boolean;
@@ -200,6 +212,9 @@ declare const _default: ({
200
212
  defaultValue?: undefined;
201
213
  values?: undefined;
202
214
  logic?: undefined;
215
+ as?: undefined;
216
+ editor?: undefined;
217
+ description?: undefined;
203
218
  } | {
204
219
  weight: number;
205
220
  type: string;
@@ -216,5 +231,27 @@ declare const _default: ({
216
231
  valueProperty?: undefined;
217
232
  data?: undefined;
218
233
  conditional?: undefined;
234
+ as?: undefined;
235
+ editor?: undefined;
236
+ description?: undefined;
237
+ } | {
238
+ type: string;
239
+ as: string;
240
+ editor: string;
241
+ weight: number;
242
+ input: boolean;
243
+ key: string;
244
+ label: string;
245
+ tooltip: string;
246
+ defaultValue: {};
247
+ description: string;
248
+ placeholder?: undefined;
249
+ inline?: undefined;
250
+ values?: undefined;
251
+ logic?: undefined;
252
+ dataSrc?: undefined;
253
+ valueProperty?: undefined;
254
+ data?: undefined;
255
+ conditional?: undefined;
219
256
  })[];
220
257
  export default _default;
@@ -157,5 +157,16 @@ exports.default = [
157
157
  label: 'Allow Manual Override of Calculated Value',
158
158
  tooltip: 'When checked, this will allow the user to manually override the calculated value.'
159
159
  },
160
+ {
161
+ type: 'textarea',
162
+ as: 'json',
163
+ editor: 'ace',
164
+ weight: 1400,
165
+ input: true,
166
+ key: 'serverOverride',
167
+ label: 'Server Override',
168
+ tooltip: 'A JSON object containing the component settings that should be overriden when the form submission is processed on the server side.',
169
+ defaultValue: {},
170
+ description: '<b>Example</b>: { "clearOnHide": true }',
171
+ }
160
172
  ];
161
- /* eslint-enable max-len */
@@ -20,6 +20,6 @@ export default class DateTimeComponent extends Input {
20
20
  get momentFormat(): string;
21
21
  createWrapper(): boolean;
22
22
  checkValidity(data: any, dirty: any, rowData: any): boolean;
23
- getValueAsString(value: any): any;
23
+ getValueAsString(value: any, options: any): any;
24
24
  }
25
25
  import Input from '../_classes/input/Input';
@@ -104,8 +104,8 @@ class DateTimeComponent extends Input_1.default {
104
104
  /* eslint-disable camelcase */
105
105
  this.component.widget = Object.assign({ type: 'calendar', timezone, displayInTimezone: lodash_1.default.get(this.component, 'displayInTimezone', 'viewer'), locale: this.options.language, useLocaleSettings: lodash_1.default.get(this.component, 'useLocaleSettings', false), allowInput: lodash_1.default.get(this.component, 'allowInput', true), mode: 'single', enableTime: lodash_1.default.get(this.component, 'enableTime', true), noCalendar: !lodash_1.default.get(this.component, 'enableDate', true), format: this.component.format, hourIncrement: lodash_1.default.get(this.component, 'timePicker.hourStep', 1), minuteIncrement: lodash_1.default.get(this.component, 'timePicker.minuteStep', 5), time_24hr: time24hr, readOnly: this.options.readOnly, minDate: lodash_1.default.get(this.component, 'datePicker.minDate'), disabledDates: lodash_1.default.get(this.component, 'datePicker.disable'), disableWeekends: lodash_1.default.get(this.component, 'datePicker.disableWeekends'), disableWeekdays: lodash_1.default.get(this.component, 'datePicker.disableWeekdays'), disableFunction: lodash_1.default.get(this.component, 'datePicker.disableFunction'), maxDate: lodash_1.default.get(this.component, 'datePicker.maxDate') }, customOptions);
106
106
  // update originalComponent to include widget and other updated settings
107
- // it is done here since these settings depend on properties present after the component is initialized
108
- // originalComponent is used to restore the component (and widget) after evaluating field logic
107
+ // it is done here since these settings depend on properties present after the component is initialized
108
+ // originalComponent is used to restore the component (and widget) after evaluating field logic
109
109
  this.originalComponent = (0, utils_2.fastCloneDeep)(this.component);
110
110
  /* eslint-enable camelcase */
111
111
  }
@@ -153,15 +153,15 @@ class DateTimeComponent extends Input_1.default {
153
153
  }
154
154
  return super.checkValidity(data, dirty, rowData);
155
155
  }
156
- getValueAsString(value) {
156
+ getValueAsString(value, options) {
157
157
  let format = utils_1.default.convertFormatToMoment(this.component.format);
158
158
  format += format.match(/z$/) ? '' : ' z';
159
159
  const timezone = this.timezone;
160
160
  if (value && !this.attached && timezone) {
161
161
  if (Array.isArray(value) && this.component.multiple) {
162
- return value.map(item => lodash_1.default.trim(utils_1.default.momentDate(item, format, timezone).format(format))).join(', ');
162
+ return value.map(item => lodash_1.default.trim(utils_1.default.momentDate(item, format, timezone, options).format(format))).join(', ');
163
163
  }
164
- return lodash_1.default.trim(utils_1.default.momentDate(value, format, timezone).format(format));
164
+ return lodash_1.default.trim(utils_1.default.momentDate(value, format, timezone, options).format(format));
165
165
  }
166
166
  if (Array.isArray(value) && this.component.multiple) {
167
167
  return value.map(item => lodash_1.default.trim((0, moment_1.default)(item).format(format))).join(', ');
@@ -208,9 +208,10 @@ export function loadZones(url: string, timezone: string): Promise<any> | any;
208
208
  * @param {string|Date} value - The value to convert into a moment date.
209
209
  * @param {string} format - The format to convert the date to.
210
210
  * @param {string} timezone - The timezone to convert the date to.
211
+ * @param {object} options - The options object
211
212
  * @returns {Date} - The moment date object.
212
213
  */
213
- export function momentDate(value: string | Date, format: string, timezone: string): Date;
214
+ export function momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
214
215
  /**
215
216
  * Format a date provided a value, format, and timezone object.
216
217
  * @param {string} timezonesUrl - The URL to load the timezone data from.
@@ -687,9 +687,10 @@ exports.loadZones = loadZones;
687
687
  * @param {string|Date} value - The value to convert into a moment date.
688
688
  * @param {string} format - The format to convert the date to.
689
689
  * @param {string} timezone - The timezone to convert the date to.
690
+ * @param {object} options - The options object
690
691
  * @returns {Date} - The moment date object.
691
692
  */
692
- function momentDate(value, format, timezone) {
693
+ function momentDate(value, format, timezone, options) {
693
694
  const momentDate = (0, moment_timezone_1.default)(value);
694
695
  if (!timezone) {
695
696
  return momentDate;
@@ -697,7 +698,7 @@ function momentDate(value, format, timezone) {
697
698
  if (timezone === 'UTC') {
698
699
  timezone = 'Etc/UTC';
699
700
  }
700
- if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && moment_timezone_1.default.zonesLoaded) {
701
+ if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (moment_timezone_1.default.zonesLoaded || (options === null || options === void 0 ? void 0 : options.email))) {
701
702
  return momentDate.tz(timezone);
702
703
  }
703
704
  return momentDate;
@@ -161,6 +161,7 @@ export default class Component extends Element {
161
161
  properties: {},
162
162
  allowMultipleMasks: false,
163
163
  addons: [],
164
+ serverOverride: {},
164
165
  }, ...sources);
165
166
  }
166
167
  /**
@@ -87,6 +87,9 @@ declare const _default: ({
87
87
  valueProperty?: undefined;
88
88
  data?: undefined;
89
89
  conditional?: undefined;
90
+ as?: undefined;
91
+ editor?: undefined;
92
+ description?: undefined;
90
93
  } | {
91
94
  type: string;
92
95
  label: string;
@@ -103,6 +106,9 @@ declare const _default: ({
103
106
  valueProperty?: undefined;
104
107
  data?: undefined;
105
108
  conditional?: undefined;
109
+ as?: undefined;
110
+ editor?: undefined;
111
+ description?: undefined;
106
112
  } | {
107
113
  weight: number;
108
114
  type: string;
@@ -125,6 +131,9 @@ declare const _default: ({
125
131
  valueProperty?: undefined;
126
132
  data?: undefined;
127
133
  conditional?: undefined;
134
+ as?: undefined;
135
+ editor?: undefined;
136
+ description?: undefined;
128
137
  } | {
129
138
  weight: number;
130
139
  type: string;
@@ -173,6 +182,9 @@ declare const _default: ({
173
182
  valueProperty?: undefined;
174
183
  data?: undefined;
175
184
  conditional?: undefined;
185
+ as?: undefined;
186
+ editor?: undefined;
187
+ description?: undefined;
176
188
  } | {
177
189
  type: string;
178
190
  input: boolean;
@@ -200,6 +212,9 @@ declare const _default: ({
200
212
  defaultValue?: undefined;
201
213
  values?: undefined;
202
214
  logic?: undefined;
215
+ as?: undefined;
216
+ editor?: undefined;
217
+ description?: undefined;
203
218
  } | {
204
219
  weight: number;
205
220
  type: string;
@@ -216,5 +231,27 @@ declare const _default: ({
216
231
  valueProperty?: undefined;
217
232
  data?: undefined;
218
233
  conditional?: undefined;
234
+ as?: undefined;
235
+ editor?: undefined;
236
+ description?: undefined;
237
+ } | {
238
+ type: string;
239
+ as: string;
240
+ editor: string;
241
+ weight: number;
242
+ input: boolean;
243
+ key: string;
244
+ label: string;
245
+ tooltip: string;
246
+ defaultValue: {};
247
+ description: string;
248
+ placeholder?: undefined;
249
+ inline?: undefined;
250
+ values?: undefined;
251
+ logic?: undefined;
252
+ dataSrc?: undefined;
253
+ valueProperty?: undefined;
254
+ data?: undefined;
255
+ conditional?: undefined;
219
256
  })[];
220
257
  export default _default;
@@ -152,5 +152,16 @@ export default [
152
152
  label: 'Allow Manual Override of Calculated Value',
153
153
  tooltip: 'When checked, this will allow the user to manually override the calculated value.'
154
154
  },
155
+ {
156
+ type: 'textarea',
157
+ as: 'json',
158
+ editor: 'ace',
159
+ weight: 1400,
160
+ input: true,
161
+ key: 'serverOverride',
162
+ label: 'Server Override',
163
+ tooltip: 'A JSON object containing the component settings that should be overriden when the form submission is processed on the server side.',
164
+ defaultValue: {},
165
+ description: '<b>Example</b>: { "clearOnHide": true }',
166
+ }
155
167
  ];
156
- /* eslint-enable max-len */
@@ -20,6 +20,6 @@ export default class DateTimeComponent extends Input {
20
20
  get momentFormat(): string;
21
21
  createWrapper(): boolean;
22
22
  checkValidity(data: any, dirty: any, rowData: any): boolean;
23
- getValueAsString(value: any): any;
23
+ getValueAsString(value: any, options: any): any;
24
24
  }
25
25
  import Input from '../_classes/input/Input';
@@ -128,8 +128,8 @@ export default class DateTimeComponent extends Input {
128
128
  ...customOptions,
129
129
  };
130
130
  // update originalComponent to include widget and other updated settings
131
- // it is done here since these settings depend on properties present after the component is initialized
132
- // originalComponent is used to restore the component (and widget) after evaluating field logic
131
+ // it is done here since these settings depend on properties present after the component is initialized
132
+ // originalComponent is used to restore the component (and widget) after evaluating field logic
133
133
  this.originalComponent = fastCloneDeep(this.component);
134
134
  /* eslint-enable camelcase */
135
135
  }
@@ -177,15 +177,15 @@ export default class DateTimeComponent extends Input {
177
177
  }
178
178
  return super.checkValidity(data, dirty, rowData);
179
179
  }
180
- getValueAsString(value) {
180
+ getValueAsString(value, options) {
181
181
  let format = FormioUtils.convertFormatToMoment(this.component.format);
182
182
  format += format.match(/z$/) ? '' : ' z';
183
183
  const timezone = this.timezone;
184
184
  if (value && !this.attached && timezone) {
185
185
  if (Array.isArray(value) && this.component.multiple) {
186
- return value.map(item => _.trim(FormioUtils.momentDate(item, format, timezone).format(format))).join(', ');
186
+ return value.map(item => _.trim(FormioUtils.momentDate(item, format, timezone, options).format(format))).join(', ');
187
187
  }
188
- return _.trim(FormioUtils.momentDate(value, format, timezone).format(format));
188
+ return _.trim(FormioUtils.momentDate(value, format, timezone, options).format(format));
189
189
  }
190
190
  if (Array.isArray(value) && this.component.multiple) {
191
191
  return value.map(item => _.trim(moment(item).format(format))).join(', ');
@@ -208,9 +208,10 @@ export function loadZones(url: string, timezone: string): Promise<any> | any;
208
208
  * @param {string|Date} value - The value to convert into a moment date.
209
209
  * @param {string} format - The format to convert the date to.
210
210
  * @param {string} timezone - The timezone to convert the date to.
211
+ * @param {object} options - The options object
211
212
  * @returns {Date} - The moment date object.
212
213
  */
213
- export function momentDate(value: string | Date, format: string, timezone: string): Date;
214
+ export function momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
214
215
  /**
215
216
  * Format a date provided a value, format, and timezone object.
216
217
  * @param {string} timezonesUrl - The URL to load the timezone data from.
@@ -632,9 +632,10 @@ export function loadZones(url, timezone) {
632
632
  * @param {string|Date} value - The value to convert into a moment date.
633
633
  * @param {string} format - The format to convert the date to.
634
634
  * @param {string} timezone - The timezone to convert the date to.
635
+ * @param {object} options - The options object
635
636
  * @returns {Date} - The moment date object.
636
637
  */
637
- export function momentDate(value, format, timezone) {
638
+ export function momentDate(value, format, timezone, options) {
638
639
  const momentDate = moment(value);
639
640
  if (!timezone) {
640
641
  return momentDate;
@@ -642,7 +643,7 @@ export function momentDate(value, format, timezone) {
642
643
  if (timezone === 'UTC') {
643
644
  timezone = 'Etc/UTC';
644
645
  }
645
- if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && moment.zonesLoaded) {
646
+ if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (moment.zonesLoaded || options?.email)) {
646
647
  return momentDate.tz(timezone);
647
648
  }
648
649
  return momentDate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6012.8e3fc09",
3
+ "version": "5.1.0-dev.6019.b7cdf53",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {