@nethserver/ns8-ui-lib 0.0.71 → 0.0.74
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/dist/ns8-ui-lib.esm.js +263 -163
- package/dist/ns8-ui-lib.min.js +1 -1
- package/dist/ns8-ui-lib.ssr.js +233 -145
- package/package.json +1 -1
- package/src/lib-components/NsDangerDeleteModal.vue +19 -0
- package/src/lib-components/NsModal.vue +13 -0
- package/src/lib-components/NsToastNotification.vue +61 -4
- package/src/lib-components/NsWizard.vue +15 -2
package/package.json
CHANGED
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
ref="userInput"
|
|
25
25
|
></cv-text-input>
|
|
26
26
|
</cv-form>
|
|
27
|
+
<NsInlineNotification
|
|
28
|
+
v-if="isErrorShown"
|
|
29
|
+
kind="error"
|
|
30
|
+
:title="errorTitle"
|
|
31
|
+
:description="errorDescription"
|
|
32
|
+
:showCloseButton="false"
|
|
33
|
+
/>
|
|
27
34
|
</template>
|
|
28
35
|
<template slot="secondary-button">{{ cancelLabel }}</template>
|
|
29
36
|
<template slot="primary-button">{{ deleteLabel }}</template>
|
|
@@ -73,6 +80,18 @@ export default {
|
|
|
73
80
|
type: String,
|
|
74
81
|
default: "I understand, delete",
|
|
75
82
|
},
|
|
83
|
+
isErrorShown: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false,
|
|
86
|
+
},
|
|
87
|
+
errorTitle: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: "",
|
|
90
|
+
},
|
|
91
|
+
errorDescription: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: "",
|
|
94
|
+
},
|
|
76
95
|
},
|
|
77
96
|
data() {
|
|
78
97
|
return {
|
|
@@ -19,5 +19,18 @@ export default {
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
+
focusBeforeContent() {
|
|
23
|
+
this.$nextTick(() => {
|
|
24
|
+
if (this.$slots["primary-button"] && !this.primaryButtonDisabled) {
|
|
25
|
+
this.$refs.primary.$el.focus();
|
|
26
|
+
} else if (this.$slots["secondary-button"]) {
|
|
27
|
+
this.$refs.secondary.$el.focus();
|
|
28
|
+
} else if (this.$slots["other-button"]) {
|
|
29
|
+
this.$refs.otherBtn.$el.focus();
|
|
30
|
+
} else {
|
|
31
|
+
this.$refs.close.focus();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
22
35
|
};
|
|
23
36
|
</script>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
`${carbonPrefix}--toast-notification__subtitle`,
|
|
27
27
|
`notification-description-and-progress`,
|
|
28
28
|
`row`,
|
|
29
|
-
{ 'fix-margin-bottom': actionLabel },
|
|
29
|
+
{ 'fix-margin-bottom': actionLabel || isProgressShown },
|
|
30
30
|
]"
|
|
31
31
|
>
|
|
32
32
|
<span v-html="description"></span>
|
|
@@ -38,8 +38,34 @@
|
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
|
+
<!-- cancel button -->
|
|
41
42
|
<div
|
|
42
|
-
v-if="
|
|
43
|
+
v-if="isProgressShown"
|
|
44
|
+
:class="[
|
|
45
|
+
`${carbonPrefix}--toast-notification__caption`,
|
|
46
|
+
`action`,
|
|
47
|
+
`row`,
|
|
48
|
+
]"
|
|
49
|
+
>
|
|
50
|
+
<button
|
|
51
|
+
@click="cancelTask"
|
|
52
|
+
:class="[
|
|
53
|
+
`${carbonPrefix}--inline-notification__action-button`,
|
|
54
|
+
`${carbonPrefix}--btn`,
|
|
55
|
+
`${carbonPrefix}--btn--sm`,
|
|
56
|
+
{ 'bx--btn--ghost': !isConfirmCancelShown },
|
|
57
|
+
{ 'bx--btn--danger': isConfirmCancelShown },
|
|
58
|
+
]"
|
|
59
|
+
:disabled="isCancelButtonDisabled"
|
|
60
|
+
type="button"
|
|
61
|
+
>
|
|
62
|
+
{{ isConfirmCancelShown ? confirmCancelLabel : cancelLabel }}
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<!-- action button -->
|
|
67
|
+
<div
|
|
68
|
+
v-else-if="actionLabel"
|
|
43
69
|
:class="[
|
|
44
70
|
`${carbonPrefix}--toast-notification__caption`,
|
|
45
71
|
`action`,
|
|
@@ -117,6 +143,8 @@ export default {
|
|
|
117
143
|
type: Boolean,
|
|
118
144
|
default: false,
|
|
119
145
|
},
|
|
146
|
+
cancelLabel: { type: String, default: "Abort" },
|
|
147
|
+
confirmCancelLabel: { type: String, default: "Confirm abort" },
|
|
120
148
|
closeAriaLabel: { type: String, default: "Dismiss notification" },
|
|
121
149
|
kind: {
|
|
122
150
|
type: String,
|
|
@@ -125,6 +153,28 @@ export default {
|
|
|
125
153
|
},
|
|
126
154
|
lowContrast: Boolean,
|
|
127
155
|
},
|
|
156
|
+
data() {
|
|
157
|
+
return {
|
|
158
|
+
isConfirmCancelShown: false,
|
|
159
|
+
isCancelButtonDisabled: false,
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
methods: {
|
|
163
|
+
cancelTask() {
|
|
164
|
+
if (!this.isConfirmCancelShown) {
|
|
165
|
+
// show confirmation
|
|
166
|
+
this.isConfirmCancelShown = true;
|
|
167
|
+
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
this.isConfirmCancelShown = false;
|
|
170
|
+
}, 5000);
|
|
171
|
+
} else {
|
|
172
|
+
// cancel task
|
|
173
|
+
this.$emit("cancelTask", this.id);
|
|
174
|
+
this.isCancelButtonDisabled = true;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
},
|
|
128
178
|
};
|
|
129
179
|
</script>
|
|
130
180
|
|
|
@@ -139,10 +189,17 @@ export default {
|
|
|
139
189
|
margin-bottom: 0;
|
|
140
190
|
}
|
|
141
191
|
|
|
142
|
-
.bx--toast-notification .bx--inline-notification__action-button
|
|
192
|
+
.bx--toast-notification .bx--inline-notification__action-button {
|
|
143
193
|
// following rule uses branding color so it's inside core _core.scss
|
|
144
194
|
// color: $inverse-link;
|
|
145
|
-
margin-left: -
|
|
195
|
+
margin-left: -1rem;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@media (min-width: 42rem) {
|
|
199
|
+
}
|
|
200
|
+
.bx--toast-notification
|
|
201
|
+
.bx--inline-notification__action-button.bx--btn--danger {
|
|
202
|
+
margin: 0.5rem 0 0.5rem -1rem;
|
|
146
203
|
}
|
|
147
204
|
|
|
148
205
|
.notification-description-and-progress {
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
@click="$emit('cancel')"
|
|
69
69
|
type="button"
|
|
70
70
|
class="wizard-button"
|
|
71
|
+
ref="wizardCancel"
|
|
71
72
|
>{{ cancelLabel }}
|
|
72
73
|
</NsButton>
|
|
73
74
|
<NsButton
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
:disabled="isPreviousDisabled"
|
|
78
79
|
type="button"
|
|
79
80
|
class="wizard-button"
|
|
81
|
+
ref="wizardPrevious"
|
|
80
82
|
>{{ previousLabel }}
|
|
81
83
|
</NsButton>
|
|
82
84
|
<NsButton
|
|
@@ -103,12 +105,12 @@
|
|
|
103
105
|
</template>
|
|
104
106
|
|
|
105
107
|
<script>
|
|
106
|
-
import
|
|
108
|
+
import NsModal from "./NsModal";
|
|
107
109
|
import IconService from "../lib-mixins/icon.js";
|
|
108
110
|
|
|
109
111
|
export default {
|
|
110
112
|
name: "NsWizard",
|
|
111
|
-
extends:
|
|
113
|
+
extends: NsModal,
|
|
112
114
|
mixins: [IconService],
|
|
113
115
|
props: {
|
|
114
116
|
cancelLabel: { type: String, default: "Cancel" },
|
|
@@ -122,5 +124,16 @@ export default {
|
|
|
122
124
|
visible: Boolean,
|
|
123
125
|
size: String,
|
|
124
126
|
},
|
|
127
|
+
methods: {
|
|
128
|
+
focusBeforeContent() {
|
|
129
|
+
this.$nextTick(() => {
|
|
130
|
+
if (this.isNextDisabled) {
|
|
131
|
+
this.$refs.wizardCancel.$el.focus();
|
|
132
|
+
} else {
|
|
133
|
+
this.$refs.wizardNext.$el.focus();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
},
|
|
125
138
|
};
|
|
126
139
|
</script>
|