@projectcaluma/ember-form-builder 10.0.1 → 11.0.0-beta.2
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/CHANGELOG.md +1066 -0
- package/addon/components/cfb-form-editor/general.hbs +83 -90
- package/addon/components/cfb-form-editor/general.js +10 -4
- package/addon/components/cfb-form-editor/question/default.js +11 -12
- package/addon/components/cfb-form-editor/question/validation.hbs +1 -0
- package/addon/components/cfb-form-editor/question-list/item.hbs +4 -4
- package/addon/components/cfb-form-editor/question-list.hbs +2 -2
- package/addon/components/cfb-form-editor/question-list.js +2 -2
- package/addon/components/cfb-form-editor/question.hbs +2 -1
- package/addon/components/cfb-form-list.hbs +69 -72
- package/addon/components/cfb-form-list.js +10 -33
- package/addon/components/cfb-navigation.hbs +1 -1
- package/addon/components/cfb-toggle-switch.hbs +1 -1
- package/addon/engine.js +7 -10
- package/addon/gql/fragments/field.graphql +247 -0
- package/addon/gql/fragments/form-info.graphql +1 -0
- package/addon/gql/fragments/question-info.graphql +1 -0
- package/addon/gql/mutations/add-form-question.graphql +2 -0
- package/addon/gql/mutations/remove-form-question.graphql +2 -0
- package/addon/gql/mutations/reorder-form-questions.graphql +2 -0
- package/addon/gql/mutations/save-action-button-question.graphql +1 -0
- package/addon/gql/mutations/save-calculated-float-question.graphql +1 -0
- package/addon/gql/mutations/save-choice-question.graphql +2 -0
- package/addon/gql/mutations/save-date-question.graphql +1 -0
- package/addon/gql/mutations/save-dynamic-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-dynamic-multiple-choice-question.graphql +1 -0
- package/addon/gql/mutations/save-file-question.graphql +1 -0
- package/addon/gql/mutations/save-float-question.graphql +1 -0
- package/addon/gql/mutations/save-form-question.graphql +2 -0
- package/addon/gql/mutations/save-form.graphql +1 -0
- package/addon/gql/mutations/save-integer-question.graphql +1 -0
- package/addon/gql/mutations/save-multiple-choice-question.graphql +2 -0
- package/addon/gql/mutations/save-option.graphql +1 -0
- package/addon/gql/mutations/save-static-question.graphql +1 -0
- package/addon/gql/mutations/save-table-question.graphql +2 -0
- package/addon/gql/mutations/save-text-question.graphql +1 -0
- package/addon/gql/mutations/save-textarea-question.graphql +1 -0
- package/addon/gql/queries/check-form-slug.graphql +1 -0
- package/addon/gql/queries/check-question-slug.graphql +1 -0
- package/addon/gql/queries/form-editor-general.graphql +1 -0
- package/addon/gql/queries/form-editor-question.graphql +7 -0
- package/addon/gql/queries/form-list.graphql +1 -0
- package/addon/gql/queries/search-form-question.graphql +4 -0
- package/addon/gql/queries/search-question.graphql +3 -0
- package/addon/routes/edit/questions/edit.js +1 -1
- package/addon/routes/edit.js +1 -1
- package/addon/utils/and.js +47 -0
- package/addon/utils/or.js +40 -0
- package/addon/validations/option.js +1 -1
- package/addon/validations/question.js +2 -2
- package/addon/validators/slug.js +1 -1
- package/app/utils/and.js +1 -0
- package/app/utils/or.js +1 -0
- package/index.js +6 -4
- package/package.json +27 -24
|
@@ -1,98 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
@
|
|
28
|
-
@
|
|
29
|
-
@
|
|
30
|
-
@
|
|
31
|
-
@
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
+
{{uk-icon "bolt" ratio=5}}
|
|
89
|
+
<p>{{t "caluma.form-builder.form.not-found" slug=@slug}}</p>
|
|
90
|
+
</div>
|
|
91
|
+
{{/if}}
|
|
@@ -1,11 +1,11 @@
|
|
|
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
6
|
import { optional } from "ember-composable-helpers/helpers/optional";
|
|
8
7
|
import { timeout, restartableTask, dropTask } from "ember-concurrency";
|
|
8
|
+
import { useTask } from "ember-resources";
|
|
9
9
|
|
|
10
10
|
import FormValidations from "../../validations/form";
|
|
11
11
|
|
|
@@ -22,10 +22,16 @@ export default class CfbFormEditorGeneral extends Component {
|
|
|
22
22
|
|
|
23
23
|
Validations = FormValidations;
|
|
24
24
|
|
|
25
|
+
get data() {
|
|
26
|
+
return this._data.value?.[0]?.node;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_data = useTask(this, this.fetchData, () => [this.args.slug]);
|
|
30
|
+
|
|
25
31
|
@restartableTask
|
|
26
|
-
*
|
|
32
|
+
*fetchData() {
|
|
27
33
|
if (!this.args.slug) {
|
|
28
|
-
return
|
|
34
|
+
return [
|
|
29
35
|
{
|
|
30
36
|
node: {
|
|
31
37
|
name: "",
|
|
@@ -34,7 +40,7 @@ export default class CfbFormEditorGeneral extends Component {
|
|
|
34
40
|
isPublished: true,
|
|
35
41
|
},
|
|
36
42
|
},
|
|
37
|
-
]
|
|
43
|
+
];
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
return yield this.apollo.watchQuery(
|
|
@@ -92,18 +92,17 @@ export default class CfbFormEditorQuestionDefault extends Component {
|
|
|
92
92
|
: null,
|
|
93
93
|
}));
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
const document =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
}
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
{{/if}}
|
|
59
59
|
|
|
60
60
|
<span
|
|
61
|
-
class="{{if this.showFormLink
|
|
61
|
+
class="{{if this.showFormLink 'uk-width-auto' 'uk-width-expand'}}
|
|
62
62
|
uk-margin-small-right uk-text-small uk-text-muted uk-text-truncate"
|
|
63
63
|
>
|
|
64
64
|
{{@question.label}}
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
uk-tooltip="title: {{if
|
|
84
84
|
this.hidden
|
|
85
85
|
(t
|
|
86
|
-
(concat
|
|
86
|
+
(concat 'caluma.form-builder.question-list.hidden.' this.hiddenType)
|
|
87
87
|
)
|
|
88
88
|
}}; pos: left"
|
|
89
89
|
class="cfb-form-editor__question-list__item__type
|
|
90
90
|
{{if
|
|
91
91
|
this.hidden
|
|
92
|
-
|
|
92
|
+
'cfb-form-editor__question-list__item__type--hidden'
|
|
93
93
|
}}"
|
|
94
94
|
@label={{t
|
|
95
95
|
(concat "caluma.form-builder.question.types." @question.__typename)
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
<span
|
|
106
106
|
uk-tooltip="title: {{t
|
|
107
107
|
(concat
|
|
108
|
-
|
|
108
|
+
'caluma.form-builder.question-list.required.' this.requiredType
|
|
109
109
|
)
|
|
110
110
|
}}; pos: top-left"
|
|
111
111
|
title={{t
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
<input
|
|
43
43
|
class="uk-search-input"
|
|
44
44
|
type="search"
|
|
45
|
-
placeholder="{{t
|
|
46
|
-
aria-label="{{t
|
|
45
|
+
placeholder="{{t 'caluma.form-builder.global.search'}}..."
|
|
46
|
+
aria-label="{{t 'caluma.form-builder.global.search'}}"
|
|
47
47
|
value={{this.search}}
|
|
48
48
|
{{on "input" (fn (mut this.search))}}
|
|
49
49
|
/>
|
|
@@ -5,12 +5,12 @@ import Component from "@glimmer/component";
|
|
|
5
5
|
import { tracked } from "@glimmer/tracking";
|
|
6
6
|
import { queryManager } from "ember-apollo-client";
|
|
7
7
|
import { optional } from "ember-composable-helpers/helpers/optional";
|
|
8
|
-
import { timeout } from "ember-concurrency";
|
|
9
8
|
import {
|
|
9
|
+
timeout,
|
|
10
10
|
enqueueTask,
|
|
11
11
|
lastValue,
|
|
12
12
|
restartableTask,
|
|
13
|
-
} from "ember-concurrency
|
|
13
|
+
} from "ember-concurrency";
|
|
14
14
|
import UIkit from "uikit";
|
|
15
15
|
|
|
16
16
|
import addFormQuestionMutation from "@projectcaluma/ember-form-builder/gql/mutations/add-form-question.graphql";
|
|
@@ -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">
|
|
@@ -1,76 +1,73 @@
|
|
|
1
|
-
<div
|
|
2
|
-
|
|
3
|
-
|
|
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-
|
|
20
|
-
@on-click={{
|
|
21
|
-
@label={{t "caluma.form-builder.form.
|
|
5
|
+
data-test-filter={{category}}
|
|
6
|
+
@on-click={{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
|
-
|
|
10
|
+
{{/each}}
|
|
24
11
|
</div>
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
@on-click={{optional @on-new-form}}
|
|
16
|
+
@label={{t "caluma.form-builder.form.new"}}
|
|
38
17
|
/>
|
|
39
|
-
</
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</
|
|
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
|
+
@on-edit-form={{@on-edit-form}}
|
|
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}}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { action } from "@ember/object";
|
|
2
1
|
import Component from "@glimmer/component";
|
|
3
2
|
import { tracked } from "@glimmer/tracking";
|
|
4
|
-
import {
|
|
5
|
-
import { timeout } from "ember-concurrency";
|
|
6
|
-
import { restartableTask } from "ember-concurrency-decorators";
|
|
3
|
+
import { timeout, restartableTask } from "ember-concurrency";
|
|
7
4
|
|
|
8
|
-
import
|
|
5
|
+
import { useCalumaQuery } from "@projectcaluma/ember-core/caluma-query";
|
|
9
6
|
import { allForms } from "@projectcaluma/ember-core/caluma-query/queries";
|
|
10
7
|
|
|
11
8
|
export default class ComponentsCfbFormListComponent extends Component {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
formsQuery = useCalumaQuery(this, allForms, () => ({
|
|
10
|
+
options: { pageSize: 20 },
|
|
11
|
+
filter: this.filter,
|
|
12
|
+
order: [{ attribute: "NAME", direction: "ASC" }],
|
|
13
|
+
}));
|
|
15
14
|
|
|
16
15
|
@tracked category = "active";
|
|
17
16
|
@tracked search = "";
|
|
@@ -29,33 +28,11 @@ export default class ComponentsCfbFormListComponent extends Component {
|
|
|
29
28
|
return [isArchived, search].filter(Boolean) || null;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
@action
|
|
33
|
-
setFilter(name, eventOrValue) {
|
|
34
|
-
this[name] =
|
|
35
|
-
eventOrValue instanceof Event ? eventOrValue.target.value : eventOrValue;
|
|
36
|
-
|
|
37
|
-
this.fetchForms.perform();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@action
|
|
41
|
-
submit(event) {
|
|
42
|
-
event.preventDefault();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@action
|
|
46
|
-
loadMoreForms(e) {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
|
|
49
|
-
this.formsQuery.fetchMore();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
31
|
@restartableTask
|
|
53
|
-
*
|
|
32
|
+
*setFilter(name, eventOrValue) {
|
|
54
33
|
yield timeout(500);
|
|
55
34
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
order: [{ attribute: "NAME", direction: "ASC" }],
|
|
59
|
-
});
|
|
35
|
+
this[name] =
|
|
36
|
+
eventOrValue instanceof Event ? eventOrValue.target.value : eventOrValue;
|
|
60
37
|
}
|
|
61
38
|
}
|
package/addon/engine.js
CHANGED
|
@@ -6,16 +6,13 @@ import config from "./config/environment";
|
|
|
6
6
|
|
|
7
7
|
const { modulePrefix } = config;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Resolver,
|
|
9
|
+
export default class FormBuilderEngine extends Engine {
|
|
10
|
+
modulePrefix = modulePrefix;
|
|
11
|
+
Resolver = Resolver;
|
|
13
12
|
|
|
14
|
-
dependencies
|
|
13
|
+
dependencies = {
|
|
15
14
|
services: ["apollo", "notification", "intl", "caluma-options", "validator"],
|
|
16
|
-
}
|
|
17
|
-
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
18
17
|
|
|
19
|
-
loadInitializers(
|
|
20
|
-
|
|
21
|
-
export default Eng;
|
|
18
|
+
loadInitializers(FormBuilderEngine, modulePrefix);
|