@projectcaluma/ember-form-builder 12.0.1 → 12.2.0

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.
@@ -46,7 +46,7 @@ export default class CfbFormEditorGeneral extends Component {
46
46
  variables: { slug: this.args.slug },
47
47
  fetchPolicy: "cache-and-network",
48
48
  },
49
- "allForms.edges"
49
+ "allForms.edges",
50
50
  );
51
51
  }
52
52
 
@@ -72,15 +72,15 @@ export default class CfbFormEditorGeneral extends Component {
72
72
  },
73
73
  },
74
74
  },
75
- "saveForm.form"
75
+ "saveForm.form",
76
76
  );
77
77
 
78
78
  this.notification.success(
79
79
  this.intl.t(
80
80
  `caluma.form-builder.notification.form.${
81
81
  this.args.slug ? "save" : "create"
82
- }.success`
83
- )
82
+ }.success`,
83
+ ),
84
84
  );
85
85
 
86
86
  this.args.onAfterSubmit?.(form);
@@ -89,8 +89,8 @@ export default class CfbFormEditorGeneral extends Component {
89
89
  this.intl.t(
90
90
  `caluma.form-builder.notification.form.${
91
91
  this.args.slug ? "save" : "create"
92
- }.error`
93
- )
92
+ }.error`,
93
+ ),
94
94
  );
95
95
  }
96
96
  }
@@ -30,11 +30,13 @@ export default class CfbFormEditorQuestionDefault extends Component {
30
30
 
31
31
  if (
32
32
  ["ChoiceQuestion", "MultipleChoiceQuestion"].includes(
33
- this.args.model.__typename
33
+ this.args.model.__typename,
34
34
  )
35
35
  ) {
36
- // Use Power Select for choice questions to save space.
37
- raw.meta = { widgetOverride: "cf-field/input/powerselect" };
36
+ if (!this.args.disableChoicePowerselectOverride) {
37
+ // Use Power Select for choice questions to save space.
38
+ raw.meta = { widgetOverride: "cf-field/input/powerselect" };
39
+ }
38
40
 
39
41
  const key = this.args.model.__typename
40
42
  .replace(/^./, (match) => match.toLowerCase())
@@ -42,14 +42,14 @@ export default class CfbFormEditorQuestionOptions extends Component {
42
42
 
43
43
  this.notification.success(
44
44
  this.intl.t(
45
- "caluma.form-builder.notification.form.reorder-options.success"
46
- )
45
+ "caluma.form-builder.notification.form.reorder-options.success",
46
+ ),
47
47
  );
48
48
  } catch (e) {
49
49
  this.notification.danger(
50
50
  this.intl.t(
51
- "caluma.form-builder.notification.form.reorder-options.error"
52
- )
51
+ "caluma.form-builder.notification.form.reorder-options.error",
52
+ ),
53
53
  );
54
54
  }
55
55
  }
@@ -68,7 +68,7 @@ export default class CfbFormEditorQuestionOptions extends Component {
68
68
  question: this.args.model.slug,
69
69
  },
70
70
  lookupValidator(OptionValidations),
71
- OptionValidations
71
+ OptionValidations,
72
72
  ),
73
73
  ]);
74
74
 
@@ -103,7 +103,7 @@ export default class CfbFormEditorQuestionOptions extends Component {
103
103
  const options = [...sortable.$el.children].slice(0, -1);
104
104
 
105
105
  this.reorderOptions.perform(
106
- options.map((option) => option.firstElementChild.firstElementChild.id)
106
+ options.map((option) => option.firstElementChild.firstElementChild.id),
107
107
  );
108
108
  }
109
109
  }
@@ -16,8 +16,8 @@ export default class CfbFormEditorQuestionValidation extends Component {
16
16
  get selected() {
17
17
  return this.validators.filter((validator) =>
18
18
  (this.args.value?.edges.map((edge) => edge.node.slug) || []).includes(
19
- validator.slug
20
- )
19
+ validator.slug,
20
+ ),
21
21
  );
22
22
  }
23
23
 
@@ -27,7 +27,7 @@ export default class CfbFormEditorQuestionValidation extends Component {
27
27
  *fetchFormatValidators() {
28
28
  return yield this.apollo.watchQuery(
29
29
  { query: allFormatValidatorsQuery, fetchPolicy: "cache-and-network" },
30
- "allFormatValidators.edges"
30
+ "allFormatValidators.edges",
31
31
  );
32
32
  }
33
33
 
@@ -77,7 +77,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
77
77
  },
78
78
  fetchPolicy: "network-only",
79
79
  },
80
- "allQuestions"
80
+ "allQuestions",
81
81
  );
82
82
 
83
83
  this.cursor = questions.pageInfo.endCursor;
@@ -97,7 +97,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
97
97
  },
98
98
  fetchPolicy: "cache-and-network",
99
99
  },
100
- "allForms.edges"
100
+ "allForms.edges",
101
101
  );
102
102
  }
103
103
 
@@ -117,14 +117,14 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
117
117
 
118
118
  this.notification.success(
119
119
  this.intl.t(
120
- "caluma.form-builder.notification.form.reorder-questions.success"
121
- )
120
+ "caluma.form-builder.notification.form.reorder-questions.success",
121
+ ),
122
122
  );
123
123
  } catch (e) {
124
124
  this.notification.danger(
125
125
  this.intl.t(
126
- "caluma.form-builder.notification.form.reorder-questions.error"
127
- )
126
+ "caluma.form-builder.notification.form.reorder-questions.error",
127
+ ),
128
128
  );
129
129
  }
130
130
  }
@@ -145,8 +145,8 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
145
145
 
146
146
  this.notification.success(
147
147
  this.intl.t(
148
- "caluma.form-builder.notification.form.add-question.success"
149
- )
148
+ "caluma.form-builder.notification.form.add-question.success",
149
+ ),
150
150
  );
151
151
 
152
152
  this._resetParameters();
@@ -156,7 +156,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
156
156
  this.args.onAfterAddQuestion?.(question);
157
157
  } catch (e) {
158
158
  this.notification.danger(
159
- this.intl.t("caluma.form-builder.notification.form.add-question.error")
159
+ this.intl.t("caluma.form-builder.notification.form.add-question.error"),
160
160
  );
161
161
  }
162
162
  }
@@ -177,16 +177,16 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
177
177
 
178
178
  this.notification.success(
179
179
  this.intl.t(
180
- "caluma.form-builder.notification.form.remove-question.success"
181
- )
180
+ "caluma.form-builder.notification.form.remove-question.success",
181
+ ),
182
182
  );
183
183
 
184
184
  this.args.onAfterRemoveQuestion?.(question);
185
185
  } catch (e) {
186
186
  this.notification.danger(
187
187
  this.intl.t(
188
- "caluma.form-builder.notification.form.remove-question.error"
189
- )
188
+ "caluma.form-builder.notification.form.remove-question.error",
189
+ ),
190
190
  );
191
191
  }
192
192
  }
@@ -195,7 +195,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
195
195
  const children = [...sortable.$el.children];
196
196
 
197
197
  this.reorderQuestions.perform(
198
- children.map((child) => this._children[child.id])
198
+ children.map((child) => this._children[child.id]),
199
199
  );
200
200
  }
201
201
 
@@ -208,7 +208,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
208
208
  @action
209
209
  setupUIkit() {
210
210
  UIkit.util.on("#question-list", "moved", (...args) =>
211
- run(this, this._handleMoved, ...args)
211
+ run(this, this._handleMoved, ...args),
212
212
  );
213
213
  }
214
214
 
@@ -122,7 +122,7 @@ export default class CfbFormEditorQuestion extends Component {
122
122
  variables: { slug: this.args.slug },
123
123
  fetchPolicy: "cache-and-network",
124
124
  },
125
- "allQuestions.edges"
125
+ "allQuestions.edges",
126
126
  );
127
127
  }
128
128
 
@@ -137,7 +137,7 @@ export default class CfbFormEditorQuestion extends Component {
137
137
  },
138
138
  fetchPolicy: "cache-and-network",
139
139
  },
140
- "allForms.edges"
140
+ "allForms.edges",
141
141
  );
142
142
  if (!forms.map) {
143
143
  return [];
@@ -151,7 +151,7 @@ export default class CfbFormEditorQuestion extends Component {
151
151
  *availableDataSources() {
152
152
  const dataSources = yield this.apollo.watchQuery(
153
153
  { query: allDataSourcesQuery, fetchPolicy: "cache-and-network" },
154
- "allDataSources.edges"
154
+ "allDataSources.edges",
155
155
  );
156
156
  return dataSources.map((edge) => {
157
157
  return {
@@ -363,7 +363,7 @@ export default class CfbFormEditorQuestion extends Component {
363
363
  mutation: saveOptionMutation,
364
364
  variables: { input: { label, slug, isArchived } },
365
365
  });
366
- })
366
+ }),
367
367
  );
368
368
  }
369
369
 
@@ -412,7 +412,7 @@ export default class CfbFormEditorQuestion extends Component {
412
412
  mutation: TYPES[typename],
413
413
  variables: { input },
414
414
  },
415
- `save${typename}.question`
415
+ `save${typename}.question`,
416
416
  );
417
417
 
418
418
  yield this.saveDefaultAnswer.perform(question, changeset);
@@ -432,7 +432,7 @@ export default class CfbFormEditorQuestion extends Component {
432
432
  }
433
433
 
434
434
  this.notification.success(
435
- this.intl.t("caluma.form-builder.notification.question.save.success")
435
+ this.intl.t("caluma.form-builder.notification.question.save.success"),
436
436
  );
437
437
 
438
438
  this.args.onAfterSubmit?.(question);
@@ -440,7 +440,7 @@ export default class CfbFormEditorQuestion extends Component {
440
440
  // eslint-disable-next-line no-console
441
441
  console.error(e);
442
442
  this.notification.danger(
443
- this.intl.t("caluma.form-builder.notification.question.save.error")
443
+ this.intl.t("caluma.form-builder.notification.question.save.error"),
444
444
  );
445
445
  }
446
446
  }
@@ -456,8 +456,8 @@ export default class CfbFormEditorQuestion extends Component {
456
456
  new Changeset(
457
457
  { ...edge.node, slugUnlinked: false, question: this.model.slug },
458
458
  lookupValidator(optionValidations),
459
- optionValidations
460
- )
459
+ optionValidations,
460
+ ),
461
461
  ) ?? [
462
462
  new Changeset(
463
463
  {
@@ -469,14 +469,14 @@ export default class CfbFormEditorQuestion extends Component {
469
469
  question: this.model.slug,
470
470
  },
471
471
  lookupValidator(optionValidations),
472
- optionValidations
472
+ optionValidations,
473
473
  ),
474
474
  ];
475
475
 
476
476
  this.changeset = new Changeset(
477
477
  { ...this.model, options },
478
478
  lookupValidator(validations),
479
- validations
479
+ validations,
480
480
  );
481
481
  }
482
482
  }
@@ -13,7 +13,7 @@ export default class CfbNavigationComponent extends Component {
13
13
  const routeParts = currentRoute.split(".");
14
14
  return routeParts
15
15
  .map((routeName, index) =>
16
- this._lookupRoute(routeName, routeParts, index)
16
+ this._lookupRoute(routeName, routeParts, index),
17
17
  )
18
18
  .filter((route) => route && route.__navigationTitleProperty);
19
19
  }
@@ -32,7 +32,7 @@ export default class EditQuestionsEditRoute extends Route {
32
32
  `,
33
33
  variables: { slug },
34
34
  },
35
- "allQuestions.edges"
35
+ "allQuestions.edges",
36
36
  );
37
37
 
38
38
  return question?.node.label;
@@ -31,7 +31,7 @@ export default class EditRoute extends Route {
31
31
  `,
32
32
  variables: { slug },
33
33
  },
34
- "allForms.edges"
34
+ "allForms.edges",
35
35
  );
36
36
 
37
37
  return form?.node.name;
@@ -24,7 +24,7 @@ export default function and(...validators) {
24
24
  newValue,
25
25
  oldValue,
26
26
  changes,
27
- object
27
+ object,
28
28
  );
29
29
 
30
30
  if (isPromise(validation)) {
@@ -22,67 +22,67 @@ export default {
22
22
  validateType("FormQuestion", true),
23
23
  validateType("StaticQuestion", true),
24
24
  validateType("FilesQuestion", true),
25
- validateLength({ max: 1024, allowBlank: true })
25
+ validateLength({ max: 1024, allowBlank: true }),
26
26
  ),
27
27
  integerMinValue: or(
28
28
  validateType("IntegerQuestion", false),
29
29
  and(
30
30
  validateNumber({ allowBlank: true, integer: true }),
31
- validateGtLt({ lt: "integerMaxValue", allowNone: true })
32
- )
31
+ validateGtLt({ lt: "integerMaxValue", allowNone: true }),
32
+ ),
33
33
  ),
34
34
  integerMaxValue: or(
35
35
  validateType("IntegerQuestion", false),
36
36
  and(
37
37
  validateNumber({ allowBlank: true, integer: true }),
38
- validateGtLt({ gt: "integerMinValue", allowNone: true })
39
- )
38
+ validateGtLt({ gt: "integerMinValue", allowNone: true }),
39
+ ),
40
40
  ),
41
41
 
42
42
  floatMinValue: or(
43
43
  validateType("FloatQuestion", false),
44
44
  and(
45
45
  validateNumber({ allowBlank: true }),
46
- validateGtLt({ lt: "floatMaxValue", allowNone: true })
47
- )
46
+ validateGtLt({ lt: "floatMaxValue", allowNone: true }),
47
+ ),
48
48
  ),
49
49
  floatMaxValue: or(
50
50
  validateType("FloatQuestion", false),
51
51
  and(
52
52
  validateNumber({ allowBlank: true }),
53
- validateGtLt({ gt: "floatMinValue", allowNone: true })
54
- )
53
+ validateGtLt({ gt: "floatMinValue", allowNone: true }),
54
+ ),
55
55
  ),
56
56
 
57
57
  minLength: or(
58
58
  and(
59
59
  validateType("TextQuestion", false),
60
- validateType("TextareaQuestion", false)
60
+ validateType("TextareaQuestion", false),
61
61
  ),
62
- validateNumber({ gt: 0, allowBlank: true })
62
+ validateNumber({ gt: 0, allowBlank: true }),
63
63
  ),
64
64
  maxLength: or(
65
65
  and(
66
66
  validateType("TextQuestion", false),
67
- validateType("TextareaQuestion", false)
67
+ validateType("TextareaQuestion", false),
68
68
  ),
69
- validateNumber({ gt: 0, allowBlank: true })
69
+ validateNumber({ gt: 0, allowBlank: true }),
70
70
  ),
71
71
 
72
72
  options: or(
73
73
  and(
74
74
  validateType("MultipleChoiceQuestion", false),
75
- validateType("ChoiceQuestion", false)
75
+ validateType("ChoiceQuestion", false),
76
76
  ),
77
- and(validateOptions(), validateLength({ min: 1 }))
77
+ and(validateOptions(), validateLength({ min: 1 })),
78
78
  ),
79
79
  "rowForm.slug": or(
80
80
  validateType("TableQuestion", false),
81
- validatePresence(true)
81
+ validatePresence(true),
82
82
  ),
83
83
  "subForm.slug": or(
84
84
  validateType("FormQuestion", false),
85
- validatePresence(true)
85
+ validatePresence(true),
86
86
  ),
87
87
  isHidden: validateJexl(),
88
88
  isRequired: validateJexl(),
@@ -20,7 +20,7 @@ export default function validateGtLt(options = {}) {
20
20
  newValue,
21
21
  oldValue,
22
22
  changes,
23
- content
23
+ content,
24
24
  );
25
25
  };
26
26
  }
@@ -12,6 +12,7 @@ const TRANSFORMS = [
12
12
  "sum",
13
13
  "avg",
14
14
  "stringify",
15
+ "flatten",
15
16
  ];
16
17
  const BINARY_OPS = ["intersects"];
17
18
 
@@ -36,7 +36,7 @@ export class SlugUniquenessValidator {
36
36
 
37
37
  async validate(key, newValue, oldValue, changes, context) {
38
38
  const application = importSync(
39
- "@projectcaluma/ember-form-builder/-private/application"
39
+ "@projectcaluma/ember-form-builder/-private/application",
40
40
  ).default;
41
41
 
42
42
  setOwner(this, application.instance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form-builder",
3
- "version": "12.0.1",
3
+ "version": "12.2.0",
4
4
  "description": "Ember engine for building Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -13,7 +13,7 @@
13
13
  "@ember/legacy-built-in-components": "^0.4.2",
14
14
  "@ember/render-modifiers": "^2.1.0",
15
15
  "@ember/string": "^3.1.1",
16
- "@embroider/macros": "^1.11.1",
16
+ "@embroider/macros": "^1.12.3",
17
17
  "@glimmer/component": "^1.1.2",
18
18
  "@glimmer/tracking": "^1.1.2",
19
19
  "codejar": "^3.7.0",
@@ -24,14 +24,14 @@
24
24
  "ember-cli-babel": "^7.26.11",
25
25
  "ember-cli-htmlbars": "^6.2.0",
26
26
  "ember-composable-helpers": "^5.0.0",
27
- "ember-concurrency": "^2.3.7",
27
+ "ember-concurrency": "^3.0.0",
28
28
  "ember-engines-router-service": "^0.3.0",
29
29
  "ember-fetch": "^8.1.2",
30
30
  "ember-flatpickr": "^4.0.0",
31
31
  "ember-intl": "^5.7.2",
32
32
  "ember-math-helpers": "^3.0.0",
33
- "ember-power-select": "^7.0.0",
34
- "ember-resources": "^5.6.4",
33
+ "ember-power-select": "^7.1.0",
34
+ "ember-resources": "^6.2.2",
35
35
  "ember-test-selectors": "^6.0.0",
36
36
  "ember-uikit": "^8.0.0",
37
37
  "ember-validated-form": "^6.2.0",
@@ -40,9 +40,9 @@
40
40
  "highlight.js": "^11.8.0",
41
41
  "highlightjs-jexl": "^0.0.5",
42
42
  "jexl": "^2.3.0",
43
- "uikit": "^3.16.21",
44
- "@projectcaluma/ember-core": "^12.0.1",
45
- "@projectcaluma/ember-form": "^12.0.1"
43
+ "uikit": "^3.16.22",
44
+ "@projectcaluma/ember-core": "^12.2.0",
45
+ "@projectcaluma/ember-form": "^12.2.0"
46
46
  },
47
47
  "//": [
48
48
  "TODO: remove obsolete dependency to `ember-data` which is only necessary",
@@ -52,7 +52,7 @@
52
52
  ],
53
53
  "devDependencies": {
54
54
  "@ember/optional-features": "2.0.0",
55
- "@ember/test-helpers": "3.1.0",
55
+ "@ember/test-helpers": "3.2.0",
56
56
  "@embroider/test-setup": "3.0.1",
57
57
  "@faker-js/faker": "8.0.2",
58
58
  "broccoli-asset-rev": "3.0.0",
@@ -69,15 +69,15 @@
69
69
  "ember-load-initializers": "2.1.2",
70
70
  "ember-qunit": "7.0.0",
71
71
  "ember-resolver": "10.1.1",
72
- "ember-source": "4.12.0",
72
+ "ember-source": "4.12.3",
73
73
  "ember-source-channel-url": "3.0.0",
74
74
  "ember-try": "2.0.0",
75
75
  "loader.js": "4.7.0",
76
76
  "miragejs": "0.1.47",
77
77
  "qunit": "2.19.4",
78
78
  "qunit-dom": "2.0.0",
79
- "webpack": "5.87.0",
80
- "@projectcaluma/ember-testing": "12.0.1"
79
+ "webpack": "5.88.2",
80
+ "@projectcaluma/ember-testing": "12.2.0"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "ember-engines": "^0.9.0",