@formio/js 5.0.0-dev.5821.2452432 → 5.0.0-dev.5822.ae2ec5b

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/cjs/CDN.d.ts CHANGED
@@ -15,7 +15,6 @@ declare class CDN {
15
15
  ckeditor: string;
16
16
  dragula: string;
17
17
  flatpickr: string;
18
- 'flatpickr-formio': string;
19
18
  'font-awesome': string;
20
19
  grid: string;
21
20
  'moment-timezone': string;
package/lib/cjs/CDN.js CHANGED
@@ -18,8 +18,7 @@ class CDN {
18
18
  'bootstrap-icons': '1.11.1',
19
19
  'ckeditor': '19.0.0',
20
20
  'dragula': '3.7.3',
21
- 'flatpickr': '4.6.8',
22
- 'flatpickr-formio': '4.6.13-formio.3',
21
+ 'flatpickr': '4.6.13',
23
22
  'font-awesome': '4.7.0',
24
23
  'grid': 'latest',
25
24
  'moment-timezone': 'latest',
@@ -1,7 +1,6 @@
1
1
  export default class ListComponent extends Field {
2
2
  get isSelectURL(): boolean;
3
3
  get selectData(): any;
4
- get dataReady(): any;
5
4
  get shouldLoad(): boolean;
6
5
  getTemplateKeys(): void;
7
6
  templateKeys: string[] | undefined;
@@ -11,9 +10,6 @@ export default class ListComponent extends Field {
11
10
  loadItems(): void;
12
11
  getOptionTemplate(data: any, value: any, index: any): any;
13
12
  itemTemplate(data: any, value: any, index: any): any;
14
- set itemsLoaded(promise: any);
15
- get itemsLoaded(): any;
16
- _itemsLoaded: any;
17
13
  handleLoadingError(err: any): void;
18
14
  loading: boolean | undefined;
19
15
  networkError: boolean | undefined;
@@ -26,16 +26,6 @@ class ListComponent extends Field_1.default {
26
26
  const selectData = lodash_1.default.get(this.root, 'submission.metadata.selectData', {});
27
27
  return lodash_1.default.get(selectData, this.path);
28
28
  }
29
- get dataReady() {
30
- // If the root submission has been set, and we are still not attached, then assume
31
- // that our data is ready.
32
- if (this.root &&
33
- this.root.submissionSet &&
34
- !this.attached) {
35
- return Promise.resolve();
36
- }
37
- return this.itemsLoaded;
38
- }
39
29
  get shouldLoad() {
40
30
  if (this.loadingError) {
41
31
  return false;
@@ -122,12 +112,6 @@ class ListComponent extends Field_1.default {
122
112
  return this.sanitize(JSON.stringify(data), this.shouldSanitizeValue);
123
113
  }
124
114
  }
125
- get itemsLoaded() {
126
- return this._itemsLoaded || Promise.resolve();
127
- }
128
- set itemsLoaded(promise) {
129
- this._itemsLoaded = promise;
130
- }
131
115
  handleLoadingError(err) {
132
116
  this.loading = false;
133
117
  if (err.networkError) {
@@ -23,10 +23,10 @@ export default class RadioComponent extends ListComponent {
23
23
  get listData(): any;
24
24
  templateData: {} | undefined;
25
25
  triggerUpdate: ((...args: any[]) => any) | undefined;
26
+ itemsLoaded: Promise<any> | undefined;
26
27
  itemsLoadedResolve: ((value: any) => void) | undefined;
27
28
  optionsLoaded: boolean | undefined;
28
29
  loadedOptions: any[] | undefined;
29
- beforeSubmit(): Promise<any>;
30
30
  render(): import("../_classes/field/Field").default;
31
31
  attach(element: any): Promise<void>;
32
32
  detach(element: any): void;
@@ -126,23 +126,12 @@ class RadioComponent extends ListComponent_1.default {
126
126
  this.itemsLoaded = new Promise((resolve) => {
127
127
  this.itemsLoadedResolve = resolve;
128
128
  });
129
- this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
129
+ this.optionsLoaded = false;
130
130
  this.loadedOptions = [];
131
- if (!this.visible) {
132
- this.itemsLoadedResolve();
133
- }
134
131
  // Get the template keys for this radio component.
135
132
  this.getTemplateKeys();
136
133
  }
137
- beforeSubmit() {
138
- return new Promise(res => {
139
- this.dataReady.then(() => res(true));
140
- });
141
- }
142
134
  render() {
143
- if (!this.optionsLoaded) {
144
- return super.render(this.renderTemplate('loader'));
145
- }
146
135
  return super.render(this.renderTemplate('radio', {
147
136
  input: this.inputInfo,
148
137
  inline: this.component.inline,
@@ -253,22 +242,12 @@ class RadioComponent extends ListComponent_1.default {
253
242
  this.refs.input[index].checked = (inputValue === value.toString());
254
243
  }
255
244
  }
256
- get shouldLoad() {
257
- // do not load options if the value is empty in readOnly and we have options available in metadata
258
- if (this.options.readOnly && this.isEmpty() && this.listData) {
259
- return false;
260
- }
261
- return super.shouldLoad;
262
- }
263
245
  loadItems(url, search, headers, options, method, body) {
264
246
  if (this.optionsLoaded) {
265
- this.itemsLoadedResolve();
266
247
  return;
267
248
  }
268
249
  if (!this.shouldLoad && this.listData) {
269
250
  this.loadItemsFromMetadata();
270
- this.itemsLoadedResolve();
271
- this.optionsLoaded = true;
272
251
  return;
273
252
  }
274
253
  // Ensure we have a method and remove any body if method is get
@@ -299,7 +278,6 @@ class RadioComponent extends ListComponent_1.default {
299
278
  this.redraw();
300
279
  })
301
280
  .catch((err) => {
302
- this.optionsLoaded = true;
303
281
  this.handleLoadingError(err);
304
282
  });
305
283
  }
@@ -340,7 +318,6 @@ class RadioComponent extends ListComponent_1.default {
340
318
  }
341
319
  lodash_1.default.set(submission.metadata.listData, this.path, listData);
342
320
  }
343
- this.itemsLoadedResolve();
344
321
  }
345
322
  setSelectedClasses() {
346
323
  if (this.refs.wrapper) {
@@ -54,6 +54,8 @@ export default class SelectComponent extends ListComponent {
54
54
  static savedValueTypes(schema: any): any[];
55
55
  templateData: {} | undefined;
56
56
  triggerUpdate: ((...args: any[]) => any) | undefined;
57
+ set itemsLoaded(promise: any);
58
+ get itemsLoaded(): any;
57
59
  itemsLoadedResolve: ((value: any) => void) | undefined;
58
60
  isFromSearch: boolean | undefined;
59
61
  searchServerCount: any;
@@ -63,6 +65,7 @@ export default class SelectComponent extends ListComponent {
63
65
  defaultDownloadedResources: any;
64
66
  activated: boolean | undefined;
65
67
  shouldPositionDropdown: any;
68
+ get dataReady(): any;
66
69
  get emptyValue(): {};
67
70
  get valueProperty(): any;
68
71
  get inputInfo(): any;
@@ -138,6 +141,7 @@ export default class SelectComponent extends ListComponent {
138
141
  lazyLoadInit: boolean | undefined;
139
142
  isInitApiCallNeeded(hasValue: any): any;
140
143
  setChoicesValue(value: any, hasPreviousValue: any, flags?: {}): void;
144
+ _itemsLoaded: any;
141
145
  validateValueAvailability(setting: any, value: any): boolean;
142
146
  /**
143
147
  * Performs required transformations on the initial value to use in selectOptions
@@ -150,6 +150,16 @@ class SelectComponent extends ListComponent_1.default {
150
150
  // Get the template keys for this select component.
151
151
  this.getTemplateKeys();
152
152
  }
153
+ get dataReady() {
154
+ // If the root submission has been set, and we are still not attached, then assume
155
+ // that our data is ready.
156
+ if (this.root &&
157
+ this.root.submissionSet &&
158
+ !this.attached) {
159
+ return Promise.resolve();
160
+ }
161
+ return this.itemsLoaded;
162
+ }
153
163
  get defaultSchema() {
154
164
  return SelectComponent.schema();
155
165
  }
@@ -1359,6 +1369,12 @@ class SelectComponent extends ListComponent_1.default {
1359
1369
  }
1360
1370
  }
1361
1371
  }
1372
+ get itemsLoaded() {
1373
+ return this._itemsLoaded || Promise.resolve();
1374
+ }
1375
+ set itemsLoaded(promise) {
1376
+ this._itemsLoaded = promise;
1377
+ }
1362
1378
  validateValueAvailability(setting, value) {
1363
1379
  if (!(0, utils_1.boolValue)(setting) || !value) {
1364
1380
  return true;
@@ -124,7 +124,7 @@ class CalendarWidget extends InputWidget_1.default {
124
124
  }
125
125
  };
126
126
  Formio_1.Formio.requireLibrary('flatpickr-css', 'flatpickr', [
127
- { type: 'styles', src: `${Formio_1.Formio.cdn['flatpickr-formio']}/flatpickr.min.css` }
127
+ { type: 'styles', src: `${Formio_1.Formio.cdn['flatpickr']}/flatpickr.min.css` }
128
128
  ], true);
129
129
  if (this.component.shortcutButtons) {
130
130
  this.component.shortcutButtons = this.component.shortcutButtons.filter((btn) => btn.label && btn.onClick);
@@ -142,7 +142,7 @@ class CalendarWidget extends InputWidget_1.default {
142
142
  }
143
143
  })
144
144
  .then((ShortcutButtonsPlugin) => {
145
- return Formio_1.Formio.requireLibrary('flatpickr', 'flatpickr', `${Formio_1.Formio.cdn['flatpickr-formio']}/flatpickr.min.js`, true)
145
+ return Formio_1.Formio.requireLibrary('flatpickr', 'flatpickr', `${Formio_1.Formio.cdn['flatpickr']}/flatpickr.min.js`, true)
146
146
  .then((Flatpickr) => {
147
147
  var _a;
148
148
  if (((_a = this.component.shortcutButtons) === null || _a === void 0 ? void 0 : _a.length) && ShortcutButtonsPlugin) {
@@ -152,7 +152,7 @@ class CalendarWidget extends InputWidget_1.default {
152
152
  if (this._input) {
153
153
  const { locale } = this.settings;
154
154
  if (locale && locale.length >= 2 && locale !== 'en') {
155
- return Formio_1.Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr-${locale}`, `${Formio_1.Formio.cdn['flatpickr-formio']}/l10n/flatpickr-${locale}.js`, true).then(() => this.initFlatpickr(Flatpickr));
155
+ return Formio_1.Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr.l10ns.${locale}`, `${Formio_1.Formio.cdn['flatpickr']}/l10n/${locale}.js`, true).then(() => this.initFlatpickr(Flatpickr));
156
156
  }
157
157
  else {
158
158
  this.initFlatpickr(Flatpickr);
package/lib/mjs/CDN.d.ts CHANGED
@@ -15,7 +15,6 @@ declare class CDN {
15
15
  ckeditor: string;
16
16
  dragula: string;
17
17
  flatpickr: string;
18
- 'flatpickr-formio': string;
19
18
  'font-awesome': string;
20
19
  grid: string;
21
20
  'moment-timezone': string;
package/lib/mjs/CDN.js CHANGED
@@ -17,8 +17,7 @@ class CDN {
17
17
  'bootstrap-icons': '1.11.1',
18
18
  'ckeditor': '19.0.0',
19
19
  'dragula': '3.7.3',
20
- 'flatpickr': '4.6.8',
21
- 'flatpickr-formio': '4.6.13-formio.3',
20
+ 'flatpickr': '4.6.13',
22
21
  'font-awesome': '4.7.0',
23
22
  'grid': 'latest',
24
23
  'moment-timezone': 'latest',
@@ -1,7 +1,6 @@
1
1
  export default class ListComponent extends Field {
2
2
  get isSelectURL(): boolean;
3
3
  get selectData(): any;
4
- get dataReady(): any;
5
4
  get shouldLoad(): boolean;
6
5
  getTemplateKeys(): void;
7
6
  templateKeys: string[] | undefined;
@@ -11,9 +10,6 @@ export default class ListComponent extends Field {
11
10
  loadItems(): void;
12
11
  getOptionTemplate(data: any, value: any, index: any): any;
13
12
  itemTemplate(data: any, value: any, index: any): any;
14
- set itemsLoaded(promise: any);
15
- get itemsLoaded(): any;
16
- _itemsLoaded: any;
17
13
  handleLoadingError(err: any): void;
18
14
  loading: boolean | undefined;
19
15
  networkError: boolean | undefined;
@@ -21,16 +21,6 @@ export default class ListComponent extends Field {
21
21
  const selectData = _.get(this.root, 'submission.metadata.selectData', {});
22
22
  return _.get(selectData, this.path);
23
23
  }
24
- get dataReady() {
25
- // If the root submission has been set, and we are still not attached, then assume
26
- // that our data is ready.
27
- if (this.root &&
28
- this.root.submissionSet &&
29
- !this.attached) {
30
- return Promise.resolve();
31
- }
32
- return this.itemsLoaded;
33
- }
34
24
  get shouldLoad() {
35
25
  if (this.loadingError) {
36
26
  return false;
@@ -117,12 +107,6 @@ export default class ListComponent extends Field {
117
107
  return this.sanitize(JSON.stringify(data), this.shouldSanitizeValue);
118
108
  }
119
109
  }
120
- get itemsLoaded() {
121
- return this._itemsLoaded || Promise.resolve();
122
- }
123
- set itemsLoaded(promise) {
124
- this._itemsLoaded = promise;
125
- }
126
110
  handleLoadingError(err) {
127
111
  this.loading = false;
128
112
  if (err.networkError) {
@@ -23,10 +23,10 @@ export default class RadioComponent extends ListComponent {
23
23
  get listData(): any;
24
24
  templateData: {} | undefined;
25
25
  triggerUpdate: ((...args: any[]) => any) | undefined;
26
+ itemsLoaded: Promise<any> | undefined;
26
27
  itemsLoadedResolve: ((value: any) => void) | undefined;
27
28
  optionsLoaded: boolean | undefined;
28
29
  loadedOptions: any[] | undefined;
29
- beforeSubmit(): Promise<any>;
30
30
  render(): import("../_classes/field/Field").default;
31
31
  attach(element: any): Promise<void>;
32
32
  detach(element: any): void;
@@ -126,23 +126,12 @@ export default class RadioComponent extends ListComponent {
126
126
  this.itemsLoaded = new Promise((resolve) => {
127
127
  this.itemsLoadedResolve = resolve;
128
128
  });
129
- this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
129
+ this.optionsLoaded = false;
130
130
  this.loadedOptions = [];
131
- if (!this.visible) {
132
- this.itemsLoadedResolve();
133
- }
134
131
  // Get the template keys for this radio component.
135
132
  this.getTemplateKeys();
136
133
  }
137
- beforeSubmit() {
138
- return new Promise(res => {
139
- this.dataReady.then(() => res(true));
140
- });
141
- }
142
134
  render() {
143
- if (!this.optionsLoaded) {
144
- return super.render(this.renderTemplate('loader'));
145
- }
146
135
  return super.render(this.renderTemplate('radio', {
147
136
  input: this.inputInfo,
148
137
  inline: this.component.inline,
@@ -253,22 +242,12 @@ export default class RadioComponent extends ListComponent {
253
242
  this.refs.input[index].checked = (inputValue === value.toString());
254
243
  }
255
244
  }
256
- get shouldLoad() {
257
- // do not load options if the value is empty in readOnly and we have options available in metadata
258
- if (this.options.readOnly && this.isEmpty() && this.listData) {
259
- return false;
260
- }
261
- return super.shouldLoad;
262
- }
263
245
  loadItems(url, search, headers, options, method, body) {
264
246
  if (this.optionsLoaded) {
265
- this.itemsLoadedResolve();
266
247
  return;
267
248
  }
268
249
  if (!this.shouldLoad && this.listData) {
269
250
  this.loadItemsFromMetadata();
270
- this.itemsLoadedResolve();
271
- this.optionsLoaded = true;
272
251
  return;
273
252
  }
274
253
  // Ensure we have a method and remove any body if method is get
@@ -299,7 +278,6 @@ export default class RadioComponent extends ListComponent {
299
278
  this.redraw();
300
279
  })
301
280
  .catch((err) => {
302
- this.optionsLoaded = true;
303
281
  this.handleLoadingError(err);
304
282
  });
305
283
  }
@@ -340,7 +318,6 @@ export default class RadioComponent extends ListComponent {
340
318
  }
341
319
  _.set(submission.metadata.listData, this.path, listData);
342
320
  }
343
- this.itemsLoadedResolve();
344
321
  }
345
322
  setSelectedClasses() {
346
323
  if (this.refs.wrapper) {
@@ -54,6 +54,8 @@ export default class SelectComponent extends ListComponent {
54
54
  static savedValueTypes(schema: any): any[];
55
55
  templateData: {} | undefined;
56
56
  triggerUpdate: ((...args: any[]) => any) | undefined;
57
+ set itemsLoaded(promise: any);
58
+ get itemsLoaded(): any;
57
59
  itemsLoadedResolve: ((value: any) => void) | undefined;
58
60
  isFromSearch: boolean | undefined;
59
61
  searchServerCount: any;
@@ -63,6 +65,7 @@ export default class SelectComponent extends ListComponent {
63
65
  defaultDownloadedResources: any;
64
66
  activated: boolean | undefined;
65
67
  shouldPositionDropdown: any;
68
+ get dataReady(): any;
66
69
  get emptyValue(): {};
67
70
  get valueProperty(): any;
68
71
  get inputInfo(): any;
@@ -138,6 +141,7 @@ export default class SelectComponent extends ListComponent {
138
141
  lazyLoadInit: boolean | undefined;
139
142
  isInitApiCallNeeded(hasValue: any): any;
140
143
  setChoicesValue(value: any, hasPreviousValue: any, flags?: {}): void;
144
+ _itemsLoaded: any;
141
145
  validateValueAvailability(setting: any, value: any): boolean;
142
146
  /**
143
147
  * Performs required transformations on the initial value to use in selectOptions
@@ -150,6 +150,16 @@ export default class SelectComponent extends ListComponent {
150
150
  // Get the template keys for this select component.
151
151
  this.getTemplateKeys();
152
152
  }
153
+ get dataReady() {
154
+ // If the root submission has been set, and we are still not attached, then assume
155
+ // that our data is ready.
156
+ if (this.root &&
157
+ this.root.submissionSet &&
158
+ !this.attached) {
159
+ return Promise.resolve();
160
+ }
161
+ return this.itemsLoaded;
162
+ }
153
163
  get defaultSchema() {
154
164
  return SelectComponent.schema();
155
165
  }
@@ -1387,6 +1397,12 @@ export default class SelectComponent extends ListComponent {
1387
1397
  }
1388
1398
  }
1389
1399
  }
1400
+ get itemsLoaded() {
1401
+ return this._itemsLoaded || Promise.resolve();
1402
+ }
1403
+ set itemsLoaded(promise) {
1404
+ this._itemsLoaded = promise;
1405
+ }
1390
1406
  validateValueAvailability(setting, value) {
1391
1407
  if (!boolValue(setting) || !value) {
1392
1408
  return true;
@@ -118,7 +118,7 @@ export default class CalendarWidget extends InputWidget {
118
118
  }
119
119
  };
120
120
  Formio.requireLibrary('flatpickr-css', 'flatpickr', [
121
- { type: 'styles', src: `${Formio.cdn['flatpickr-formio']}/flatpickr.min.css` }
121
+ { type: 'styles', src: `${Formio.cdn['flatpickr']}/flatpickr.min.css` }
122
122
  ], true);
123
123
  if (this.component.shortcutButtons) {
124
124
  this.component.shortcutButtons = this.component.shortcutButtons.filter((btn) => btn.label && btn.onClick);
@@ -135,7 +135,7 @@ export default class CalendarWidget extends InputWidget {
135
135
  }
136
136
  })
137
137
  .then((ShortcutButtonsPlugin) => {
138
- return Formio.requireLibrary('flatpickr', 'flatpickr', `${Formio.cdn['flatpickr-formio']}/flatpickr.min.js`, true)
138
+ return Formio.requireLibrary('flatpickr', 'flatpickr', `${Formio.cdn['flatpickr']}/flatpickr.min.js`, true)
139
139
  .then((Flatpickr) => {
140
140
  if (this.component.shortcutButtons?.length && ShortcutButtonsPlugin) {
141
141
  this.initShortcutButtonsPlugin(ShortcutButtonsPlugin);
@@ -144,7 +144,7 @@ export default class CalendarWidget extends InputWidget {
144
144
  if (this._input) {
145
145
  const { locale } = this.settings;
146
146
  if (locale && locale.length >= 2 && locale !== 'en') {
147
- return Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr-${locale}`, `${Formio.cdn['flatpickr-formio']}/l10n/flatpickr-${locale}.js`, true).then(() => this.initFlatpickr(Flatpickr));
147
+ return Formio.requireLibrary(`flatpickr-${locale}`, `flatpickr.l10ns.${locale}`, `${Formio.cdn['flatpickr']}/l10n/${locale}.js`, true).then(() => this.initFlatpickr(Flatpickr));
148
148
  }
149
149
  else {
150
150
  this.initFlatpickr(Flatpickr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5821.2452432",
3
+ "version": "5.0.0-dev.5822.ae2ec5b",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {