@projectcaluma/ember-form-builder 10.0.3 → 11.0.0-beta.4

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 (34) hide show
  1. package/CHANGELOG.md +1089 -0
  2. package/addon/components/cfb-form-editor/general.hbs +83 -90
  3. package/addon/components/cfb-form-editor/general.js +11 -6
  4. package/addon/components/cfb-form-editor/question/default.js +11 -12
  5. package/addon/components/cfb-form-editor/question/options.hbs +1 -1
  6. package/addon/components/cfb-form-editor/question/validation.hbs +1 -0
  7. package/addon/components/cfb-form-editor/question-list/item.hbs +4 -4
  8. package/addon/components/cfb-form-editor/question-list/item.js +2 -2
  9. package/addon/components/cfb-form-editor/question-list.hbs +6 -6
  10. package/addon/components/cfb-form-editor/question-list.js +5 -6
  11. package/addon/components/cfb-form-editor/question.hbs +3 -2
  12. package/addon/components/cfb-form-editor/question.js +4 -3
  13. package/addon/components/cfb-form-editor.hbs +5 -5
  14. package/addon/components/cfb-form-list/item.hbs +1 -1
  15. package/addon/components/cfb-form-list.hbs +69 -72
  16. package/addon/components/cfb-form-list.js +10 -33
  17. package/addon/components/cfb-toggle-switch.hbs +1 -1
  18. package/addon/engine.js +7 -10
  19. package/addon/routes/edit/questions/edit.js +1 -1
  20. package/addon/routes/edit.js +1 -1
  21. package/addon/templates/edit/questions/edit.hbs +1 -1
  22. package/addon/templates/edit/questions/new.hbs +1 -4
  23. package/addon/templates/edit.hbs +5 -5
  24. package/addon/templates/index.hbs +1 -1
  25. package/addon/templates/new.hbs +1 -1
  26. package/addon/utils/and.js +47 -0
  27. package/addon/utils/or.js +40 -0
  28. package/addon/validations/option.js +1 -1
  29. package/addon/validations/question.js +2 -2
  30. package/addon/validators/slug.js +1 -1
  31. package/app/utils/and.js +1 -0
  32. package/app/utils/or.js +1 -0
  33. package/index.js +6 -4
  34. package/package.json +28 -23
@@ -1,98 +1,91 @@
1
- <div
2
- {{did-insert (perform this.data)}}
3
- {{did-update (perform this.data) @slug}}
4
- >
5
- {{#if this.data.isRunning}}
6
- <div class="uk-flex uk-flex-center uk-flex-middle uk-height-small">
7
- <UkSpinner ratio="2" />
8
- </div>
9
- {{else}}
10
- {{#with this.data.lastSuccessful.value.firstObject.node as |model|}}
11
- <ValidatedForm
12
- @model={{changeset model this.Validations}}
13
- @on-submit={{perform this.submit}}
14
- as |f|
15
- >
16
- <f.input
17
- @type="text"
18
- @label={{t "caluma.form-builder.form.name"}}
19
- @name="name"
20
- @required={{true}}
21
- @on-update={{this.updateName}}
22
- />
1
+ {{#if this._data.isRunning}}
2
+ <div class="uk-flex uk-flex-center uk-flex-middle uk-height-small">
3
+ <UkSpinner ratio="2" />
4
+ </div>
5
+ {{else if this.data}}
6
+ <ValidatedForm
7
+ @model={{changeset this.data this.Validations}}
8
+ @on-submit={{perform this.submit}}
9
+ as |f|
10
+ >
11
+ <f.input
12
+ @type="text"
13
+ @label={{t "caluma.form-builder.form.name"}}
14
+ @name="name"
15
+ @required={{true}}
16
+ @on-update={{this.updateName}}
17
+ />
23
18
 
24
- {{#if (or @slug (not this.prefix))}}
19
+ {{#if (or @slug (not this.prefix))}}
20
+ <f.input
21
+ @type="text"
22
+ @name="slug"
23
+ @label={{t "caluma.form-builder.form.slug"}}
24
+ @required={{true}}
25
+ @disabled={{@slug}}
26
+ @on-update={{this.updateSlug}}
27
+ />
28
+ {{else}}
29
+ <f.input
30
+ @name="slug"
31
+ @required={{true}}
32
+ @disabled={{@slug}}
33
+ @label={{t "caluma.form-builder.question.slug"}}
34
+ @on-update={{this.updateSlug value="target.value"}}
35
+ as |fi|
36
+ >
37
+ <div class="cfb-prefixed">
38
+ <span class="cfb-prefixed-slug">{{this.prefix}}</span>
25
39
  <f.input
26
40
  @type="text"
27
- @name="slug"
28
- @label={{t "caluma.form-builder.form.slug"}}
29
- @required={{true}}
30
- @disabled={{@slug}}
31
- @on-update={{this.updateSlug}}
41
+ @model={{fi.model}}
42
+ @name={{fi.name}}
43
+ @value={{fi.value}}
44
+ @update={{fi.update}}
45
+ @setDirty={{fi.setDirty}}
46
+ @inputId={{fi.inputId}}
47
+ @isValid={{fi.isValid}}
48
+ @isInvalid={{fi.isInvalid}}
32
49
  />
33
- {{else}}
34
- <f.input
35
- @name="slug"
36
- @required={{true}}
37
- @disabled={{@slug}}
38
- @label={{t "caluma.form-builder.question.slug"}}
39
- @on-update={{this.updateSlug value="target.value"}}
40
- as |fi|
41
- >
42
- <div class="cfb-prefixed">
43
- <span class="cfb-prefixed-slug">{{this.prefix}}</span>
44
- <f.input
45
- @type="text"
46
- @model={{fi.model}}
47
- @name={{fi.name}}
48
- @value={{fi.value}}
49
- @update={{fi.update}}
50
- @setDirty={{fi.setDirty}}
51
- @inputId={{fi.inputId}}
52
- @isValid={{fi.isValid}}
53
- @isInvalid={{fi.isInvalid}}
54
- />
55
- </div>
56
- </f.input>
57
- {{/if}}
50
+ </div>
51
+ </f.input>
52
+ {{/if}}
58
53
 
59
- <f.input
60
- @name="description"
61
- @type="textarea"
62
- @label={{t "caluma.form-builder.form.description"}}
63
- @rows="4"
64
- />
54
+ <f.input
55
+ @name="description"
56
+ @type="textarea"
57
+ @label={{t "caluma.form-builder.form.description"}}
58
+ @rows="4"
59
+ />
65
60
 
66
- <f.input
67
- class="uk-flex uk-flex-between uk-flex-column"
68
- @name="isArchived"
69
- @label={{t "caluma.form-builder.form.isArchived"}}
70
- @required={{true}}
71
- @renderComponent={{component "cfb-toggle-switch" size="small"}}
72
- />
61
+ <f.input
62
+ class="uk-flex uk-flex-between uk-flex-column"
63
+ @name="isArchived"
64
+ @label={{t "caluma.form-builder.form.isArchived"}}
65
+ @required={{true}}
66
+ @renderComponent={{component "cfb-toggle-switch" size="small"}}
67
+ />
73
68
 
74
- <f.input
75
- class="uk-flex uk-flex-between uk-flex-column"
76
- @name="isPublished"
77
- @label={{t "caluma.form-builder.form.isPublished"}}
78
- @required={{true}}
79
- @renderComponent={{component "cfb-toggle-switch" size="small"}}
80
- />
69
+ <f.input
70
+ class="uk-flex uk-flex-between uk-flex-column"
71
+ @name="isPublished"
72
+ @label={{t "caluma.form-builder.form.isPublished"}}
73
+ @required={{true}}
74
+ @renderComponent={{component "cfb-toggle-switch" size="small"}}
75
+ />
81
76
 
82
- <div class="uk-text-right">
83
- <f.submit
84
- @disabled={{or f.loading f.model.isInvalid}}
85
- @label={{t "caluma.form-builder.global.save"}}
86
- />
87
- </div>
88
- </ValidatedForm>
89
- {{else}}
90
- <div
91
- class="uk-text-center uk-text-muted uk-padding uk-padding-remove-horizontal"
92
- >
93
- {{uk-icon "bolt" ratio=5}}
94
- <p>{{t "caluma.form-builder.form.not-found" slug=@slug}}</p>
95
- </div>
96
- {{/with}}
97
- {{/if}}
98
- </div>
77
+ <div class="uk-text-right">
78
+ <f.submit
79
+ @disabled={{or f.loading f.model.isInvalid}}
80
+ @label={{t "caluma.form-builder.global.save"}}
81
+ />
82
+ </div>
83
+ </ValidatedForm>
84
+ {{else}}
85
+ <div
86
+ class="uk-text-center uk-text-muted uk-padding uk-padding-remove-horizontal"
87
+ >
88
+ <UkIcon @icon="bolt" @ratio={{5}} />
89
+ <p>{{t "caluma.form-builder.form.not-found" slug=@slug}}</p>
90
+ </div>
91
+ {{/if}}
@@ -1,11 +1,10 @@
1
1
  import { getOwner } from "@ember/application";
2
- import { A } from "@ember/array";
3
2
  import { action } from "@ember/object";
4
3
  import { inject as service } from "@ember/service";
5
4
  import Component from "@glimmer/component";
6
5
  import { queryManager } from "ember-apollo-client";
7
- import { optional } from "ember-composable-helpers/helpers/optional";
8
6
  import { timeout, restartableTask, dropTask } from "ember-concurrency";
7
+ import { useTask } from "ember-resources";
9
8
 
10
9
  import FormValidations from "../../validations/form";
11
10
 
@@ -22,10 +21,16 @@ export default class CfbFormEditorGeneral extends Component {
22
21
 
23
22
  Validations = FormValidations;
24
23
 
24
+ get data() {
25
+ return this._data.value?.[0]?.node;
26
+ }
27
+
28
+ _data = useTask(this, this.fetchData, () => [this.args.slug]);
29
+
25
30
  @restartableTask
26
- *data() {
31
+ *fetchData() {
27
32
  if (!this.args.slug) {
28
- return A([
33
+ return [
29
34
  {
30
35
  node: {
31
36
  name: "",
@@ -34,7 +39,7 @@ export default class CfbFormEditorGeneral extends Component {
34
39
  isPublished: true,
35
40
  },
36
41
  },
37
- ]);
42
+ ];
38
43
  }
39
44
 
40
45
  return yield this.apollo.watchQuery(
@@ -83,7 +88,7 @@ export default class CfbFormEditorGeneral extends Component {
83
88
  )
84
89
  );
85
90
 
86
- optional([this.args["on-after-submit"]])(form);
91
+ this.args.onAfterSubmit?.(form);
87
92
  } catch (e) {
88
93
  this.notification.danger(
89
94
  this.intl.t(
@@ -92,18 +92,17 @@ export default class CfbFormEditorQuestionDefault extends Component {
92
92
  : null,
93
93
  }));
94
94
  }
95
-
96
- const document = getOwner(this)
97
- .factoryFor("caluma-model:document")
98
- .create({
99
- raw: {
100
- id: btoa(`Document:dv-document-${this.args.model.slug}`),
101
- rootForm,
102
- forms: [rootForm],
103
- answers: [answer],
104
- __typename: "Document",
105
- },
106
- });
95
+ const owner = getOwner(this);
96
+ const document = new (owner.factoryFor("caluma-model:document").class)({
97
+ raw: {
98
+ id: btoa(`Document:dv-document-${this.args.model.slug}`),
99
+ rootForm,
100
+ forms: [rootForm],
101
+ answers: [answer],
102
+ __typename: "Document",
103
+ },
104
+ owner,
105
+ });
107
106
 
108
107
  return document.findField(this.question.slug);
109
108
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
  <UkSortable
5
5
  @handle=".uk-sortable-handle"
6
- @on-moved={{this._handleMoved}}
6
+ @onMoved={{this._handleMoved}}
7
7
  @tagName="ul"
8
8
  class="uk-list uk-list-divider uk-margin-remove-bottom uk-margin-small-top"
9
9
  >
@@ -6,6 +6,7 @@
6
6
  @placeholder={{this.placeholder}}
7
7
  @options={{this.validators}}
8
8
  @onChange={{this.updateValidators}}
9
+ @renderInPlace={{true}}
9
10
  as |item|
10
11
  >
11
12
  {{item.name}}
@@ -4,8 +4,8 @@
4
4
  @question.isArchived
5
5
  "cfb-form-editor__question-list__item__archived"
6
6
  }}
7
- {{did-insert (fn (optional @on-register) this.elementId @question.slug)}}
8
- {{will-destroy (fn (optional @on-unregister) this.elementId @question.slug)}}
7
+ {{did-insert (fn (optional @onRegister) this.elementId @question.slug)}}
8
+ {{will-destroy (fn (optional @onUnregister) this.elementId @question.slug)}}
9
9
  ...attributes
10
10
  >
11
11
  <div class="uk-flex uk-flex-middle">
@@ -24,7 +24,7 @@
24
24
  data-test-remove-item
25
25
  uk-icon="minus"
26
26
  class="cfb-pointer uk-text-danger"
27
- {{on "click" (fn (optional @on-remove-question) @question)}}
27
+ {{on "click" (fn (optional @onRemoveQuestion) @question)}}
28
28
  >
29
29
  </i>
30
30
  {{else if (eq @mode "add")}}
@@ -33,7 +33,7 @@
33
33
  data-test-add-item
34
34
  uk-icon="plus"
35
35
  class="cfb-pointer uk-text-success"
36
- {{on "click" (fn (optional @on-add-question) @question)}}
36
+ {{on "click" (fn (optional @onAddQuestion) @question)}}
37
37
  >
38
38
  </i>
39
39
  {{/if}}
@@ -51,12 +51,12 @@ export default class CfbFormEditorQuestionListItem extends Component {
51
51
  @action
52
52
  editQuestion(question, e) {
53
53
  e.preventDefault();
54
- this.args["on-edit-question"]?.(question);
54
+ this.args.onEditQuestion?.(question);
55
55
  }
56
56
 
57
57
  @action
58
58
  clickForm(form, e) {
59
59
  e.preventDefault();
60
- this.args["on-click-form"]?.(form);
60
+ this.args.onClickForm?.(form);
61
61
  }
62
62
  }
@@ -76,12 +76,12 @@
76
76
  data-test-question-list-item={{item.node.slug}}
77
77
  @mode={{this.mode}}
78
78
  @question={{item.node}}
79
- @on-edit-question={{@on-edit-question}}
80
- @on-remove-question={{perform this.removeQuestion}}
81
- @on-add-question={{perform this.addQuestion}}
82
- @on-click-form={{@on-click-form}}
83
- @on-register={{this.registerChild}}
84
- @on-unregister={{this.unregisterChild}}
79
+ @onEditQuestion={{@onEditQuestion}}
80
+ @onRemoveQuestion={{perform this.removeQuestion}}
81
+ @onAddQuestion={{perform this.addQuestion}}
82
+ @onClickForm={{@onClickForm}}
83
+ @onRegister={{this.registerChild}}
84
+ @onUnregister={{this.unregisterChild}}
85
85
  />
86
86
  {{else}}
87
87
  <li
@@ -4,13 +4,12 @@ import { inject as service } from "@ember/service";
4
4
  import Component from "@glimmer/component";
5
5
  import { tracked } from "@glimmer/tracking";
6
6
  import { queryManager } from "ember-apollo-client";
7
- import { optional } from "ember-composable-helpers/helpers/optional";
8
- import { timeout } from "ember-concurrency";
9
7
  import {
8
+ timeout,
10
9
  enqueueTask,
11
10
  lastValue,
12
11
  restartableTask,
13
- } from "ember-concurrency-decorators";
12
+ } from "ember-concurrency";
14
13
  import UIkit from "uikit";
15
14
 
16
15
  import addFormQuestionMutation from "@projectcaluma/ember-form-builder/gql/mutations/add-form-question.graphql";
@@ -148,7 +147,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
148
147
 
149
148
  this.questionTask.perform();
150
149
 
151
- optional([this.args["on-after-add-question"]])(question);
150
+ this.args.onAfterAddQuestion?.(question);
152
151
  } catch (e) {
153
152
  this.notification.danger(
154
153
  this.intl.t("caluma.form-builder.notification.form.add-question.error")
@@ -176,7 +175,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
176
175
  )
177
176
  );
178
177
 
179
- optional([this.args["on-after-remove-question"]])(question);
178
+ this.args.onAfterRemoveQuestion?.(question);
180
179
  } catch (e) {
181
180
  this.notification.danger(
182
181
  this.intl.t(
@@ -238,7 +237,7 @@ export default class ComponentsCfbFormEditorQuestionList extends Component {
238
237
  createNewQuestion(e) {
239
238
  e.preventDefault();
240
239
 
241
- this.args["on-create-question"]?.();
240
+ this.args.onCreateQuestion?.();
242
241
  this.setMode("reorder");
243
242
  }
244
243
  }
@@ -11,7 +11,6 @@
11
11
  >
12
12
  {{#if (and f.model.isDirty @slug)}}
13
13
  <div class="uk-alert-warning uk-animation-fade" uk-alert>
14
- <a href="#" class="uk-alert-close" uk-close></a>
15
14
  <div uk-grid class="uk-grid-small">
16
15
  <div class="uk-width-auto uk-flex uk-flex-middle">
17
16
  <UkIcon @icon="warning" @ratio={{1.2}} />
@@ -342,6 +341,7 @@
342
341
  @noMatchesMessage={{t
343
342
  "caluma.form-builder.question.search-empty"
344
343
  }}
344
+ @renderInPlace={{true}}
345
345
  as |form|
346
346
  >
347
347
  <span
@@ -414,6 +414,7 @@
414
414
  "caluma.form-builder.question.search-placeholder"
415
415
  }}
416
416
  @noMatchesMessage={{t "caluma.form-builder.question.search-empty"}}
417
+ @renderInPlace={{true}}
417
418
  as |form|
418
419
  >
419
420
  <span class="uk-width-auto uk-margin-small-right uk-text-truncate">
@@ -449,7 +450,7 @@
449
450
 
450
451
  <UkButton
451
452
  @color="link"
452
- @on-click={{toggle-action "showAdvanced" this}}
453
+ @onClick={{toggle-action "showAdvanced" this}}
453
454
  class="uk-flex uk-flex-middle uk-margin"
454
455
  >
455
456
  {{#if this.showAdvanced}}
@@ -8,7 +8,6 @@ import { tracked } from "@glimmer/tracking";
8
8
  import { queryManager } from "ember-apollo-client";
9
9
  import Changeset from "ember-changeset";
10
10
  import lookupValidator from "ember-changeset-validations";
11
- import { optional } from "ember-composable-helpers/helpers/optional";
12
11
  import { dropTask, restartableTask, task, timeout } from "ember-concurrency";
13
12
  import { all } from "rsvp";
14
13
 
@@ -222,7 +221,9 @@ export default class CfbFormEditorQuestion extends Component {
222
221
  isArchived: changeset.get("isArchived"),
223
222
  };
224
223
 
225
- if (!hasQuestionType(changeset, "static", "calculated-float")) {
224
+ if (
225
+ !hasQuestionType(changeset, "static", "calculated-float", "action-button")
226
+ ) {
226
227
  Object.assign(input, {
227
228
  isRequired: changeset.get("isRequired"),
228
229
  });
@@ -406,7 +407,7 @@ export default class CfbFormEditorQuestion extends Component {
406
407
  this.intl.t("caluma.form-builder.notification.question.save.success")
407
408
  );
408
409
 
409
- optional([this.args["on-after-submit"]])(question);
410
+ this.args.onAfterSubmit?.(question);
410
411
  } catch (e) {
411
412
  // eslint-disable-next-line no-console
412
413
  console.error(e);
@@ -12,11 +12,11 @@
12
12
  {{else}}
13
13
  <CfbFormEditor::QuestionList
14
14
  @form={{@slug}}
15
- @on-edit-question={{@on-edit-question}}
16
- @on-create-question={{@on-create-question}}
17
- @on-after-add-question={{@on-after-add-question}}
18
- @on-after-remove-question={{@on-after-remove-question}}
19
- @on-click-form={{@on-click-form}}
15
+ @onEditQuestion={{@onEditQuestion}}
16
+ @onCreateQuestion={{@onCreateQuestion}}
17
+ @onAfterAddQuestion={{@onAfterAddQuestion}}
18
+ @onAfterRemoveQuestion={{@onAfterRemoveQuestion}}
19
+ @onClickForm={{@onClickForm}}
20
20
  />
21
21
  {{/if}}
22
22
  </div>
@@ -12,7 +12,7 @@
12
12
  type="button"
13
13
  uk-icon="pencil"
14
14
  class="uk-icon-button"
15
- {{on "click" (fn (optional @on-edit-form) @item)}}
15
+ {{on "click" (fn (optional @onEditForm) @item)}}
16
16
  >
17
17
  </button>
18
18
  </span>
@@ -1,76 +1,73 @@
1
- <div
2
- ...attributes
3
- {{did-insert (perform this.fetchForms)}}
4
- {{did-update (perform this.fetchForms)}}
5
- >
6
- <div class="uk-flex uk-flex-between">
7
- <div class="uk-button-group">
8
- {{#each (array "active" "archived" "all") as |category|}}
9
- <UkButton
10
- data-test-filter={{category}}
11
- @on-click={{fn this.setFilter "category" category}}
12
- @label={{t (concat "caluma.form-builder.form." category)}}
13
- @class={{if (eq this.category category) "uk-button-primary" ""}}
14
- />
15
- {{/each}}
16
- </div>
17
- <div>
1
+ <div class="uk-flex uk-flex-between">
2
+ <div class="uk-button-group">
3
+ {{#each (array "active" "archived" "all") as |category|}}
18
4
  <UkButton
19
- data-test-new-form
20
- @on-click={{optional @on-new-form}}
21
- @label={{t "caluma.form-builder.form.new"}}
5
+ data-test-filter={{category}}
6
+ @onClick={{fn (perform this.setFilter) "category" category}}
7
+ @label={{t (concat "caluma.form-builder.form." category)}}
8
+ @class={{if (eq this.category category) "uk-button-primary" ""}}
22
9
  />
23
- </div>
10
+ {{/each}}
24
11
  </div>
25
- <form
26
- class="uk-search uk-search-default uk-width-1-1 uk-margin-small-top"
27
- {{on "submit" this.submit}}
28
- >
29
- <span class="uk-search-icon-flip" uk-search-icon></span>
30
- <input
31
- data-test-form-search-input
32
- class="uk-search-input"
33
- type="search"
34
- placeholder="{{t 'caluma.form-builder.global.search'}}..."
35
- aria-label="{{t 'caluma.form-builder.global.search'}}"
36
- value={{this.search}}
37
- {{on "input" (fn this.setFilter "search")}}
12
+ <div>
13
+ <UkButton
14
+ data-test-new-form
15
+ @onClick={{optional @onNewForm}}
16
+ @label={{t "caluma.form-builder.form.new"}}
38
17
  />
39
- </form>
40
- {{#if this.formsQuery.isLoading}}
41
- <div class="uk-height-small uk-flex uk-flex-center uk-flex-middle">
42
- <UkSpinner ratio="2" />
43
- </div>
44
- {{else if this.formsQuery.value.length}}
45
- <ul data-test-form-list class="uk-list uk-list-divider uk-list-large">
46
- {{#each this.formsQuery.value key="id" as |item|}}
47
- <CfbFormList::Item
48
- data-test-form-list-item={{item.slug}}
49
- @item={{item}}
50
- @on-edit-form={{@on-edit-form}}
51
- />
52
- {{/each}}
53
- {{#if this.formsQuery.hasNextPage}}
54
- <li class="uk-text-center cfb-pointer">
55
- <a
56
- data-test-form-loader-button
57
- href="#"
58
- {{on "click" this.loadMoreForms}}
59
- >
60
- {{t "caluma.form-builder.form.loadMore"}}
61
- </a>
62
- </li>
63
- {{/if}}
64
- </ul>
65
- {{else}}
66
- <div
67
- data-test-form-list-empty
68
- class="uk-padding-large uk-padding-remove-horizontal uk-text-center"
69
- >
70
- <UkIcon @icon="search" @ratio={{10}} />
71
- <p class="uk-text-muted">
72
- {{t "caluma.form-builder.form.empty"}}
73
- </p>
74
- </div>
75
- {{/if}}
76
- </div>
18
+ </div>
19
+ </div>
20
+
21
+ <div class="uk-search uk-search-default uk-width-1-1 uk-margin-top">
22
+ <span class="uk-search-icon-flip" uk-search-icon></span>
23
+ <input
24
+ data-test-form-search-input
25
+ class="uk-search-input"
26
+ type="search"
27
+ placeholder="{{t 'caluma.form-builder.global.search'}}..."
28
+ aria-label="{{t 'caluma.form-builder.global.search'}}"
29
+ value={{this.search}}
30
+ {{on "input" (fn (perform this.setFilter) "search")}}
31
+ />
32
+ </div>
33
+
34
+ {{#if this.formsQuery.value.length}}
35
+ <ul data-test-form-list class="uk-list uk-list-divider uk-list-large">
36
+ {{#each this.formsQuery.value key="id" as |item|}}
37
+ <CfbFormList::Item
38
+ data-test-form-list-item={{item.slug}}
39
+ @item={{item}}
40
+ @onEditForm={{@onEditForm}}
41
+ />
42
+ {{/each}}
43
+ {{#if this.formsQuery.isLoading}}
44
+ <li class="uk-text-center">
45
+ <UkSpinner />
46
+ </li>
47
+ {{else if this.formsQuery.hasNextPage}}
48
+ <li class="uk-text-center cfb-pointer">
49
+ <a
50
+ data-test-form-loader-button
51
+ href="#"
52
+ {{on "click" this.formsQuery.fetchMore}}
53
+ >
54
+ {{t "caluma.form-builder.form.loadMore"}}
55
+ </a>
56
+ </li>
57
+ {{/if}}
58
+ </ul>
59
+ {{else if this.formsQuery.isLoading}}
60
+ <div class="uk-height-small uk-flex uk-flex-center uk-flex-middle">
61
+ <UkSpinner @ratio={{2}} />
62
+ </div>
63
+ {{else}}
64
+ <div
65
+ data-test-form-list-empty
66
+ class="uk-padding-large uk-padding-remove-horizontal uk-text-center"
67
+ >
68
+ <UkIcon @icon="search" @ratio={{10}} />
69
+ <p class="uk-text-muted">
70
+ {{t "caluma.form-builder.form.empty"}}
71
+ </p>
72
+ </div>
73
+ {{/if}}