@nethserver/ns8-ui-lib 0.0.35 → 0.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethserver/ns8-ui-lib",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "Vue.js library for NethServer 8 UI",
5
5
  "keywords": [
6
6
  "nethserver",
@@ -58,6 +58,7 @@
58
58
  "node": ">=12"
59
59
  },
60
60
  "dependencies": {
61
+ "@rollup/plugin-json": "^4.1.0",
61
62
  "core-js": "^3.15.2",
62
63
  "date-fns": "^2.23.0",
63
64
  "date-fns-tz": "^1.1.6"
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <cv-modal
3
+ kind="danger"
4
+ size="default"
5
+ :visible="isShown"
6
+ @modal-hidden="onModalHidden"
7
+ @primary-click="confirmDelete"
8
+ :primary-button-disabled="name !== userInput"
9
+ >
10
+ <template slot="title">{{ title }}</template>
11
+ <template slot="content">
12
+ <NsInlineNotification
13
+ kind="warning"
14
+ :title="warning"
15
+ :showCloseButton="false"
16
+ />
17
+ <div class="mg-bottom-md" v-html="description"></div>
18
+ <div v-html="typeToConfirmMessage"></div>
19
+ <cv-form @submit.prevent="confirmDelete">
20
+ <cv-text-input
21
+ v-model="userInput"
22
+ class="mg-bottom-md"
23
+ ref="userInput"
24
+ ></cv-text-input>
25
+ </cv-form>
26
+ </template>
27
+ <template slot="secondary-button">{{ cancelLabel }}</template>
28
+ <template slot="primary-button">{{ deleteLabel }}</template>
29
+ </cv-modal>
30
+ </template>
31
+
32
+ <script>
33
+ import UtilService from "../lib-mixins/util.js";
34
+ import IconService from "../lib-mixins/util.js";
35
+ import NsInlineNotification from "./NsInlineNotification.vue";
36
+
37
+ export default {
38
+ name: "NsDangerDeleteModal",
39
+ //component added for storybook to work
40
+ components: { NsInlineNotification },
41
+ mixins: [UtilService, IconService],
42
+ props: {
43
+ isShown: {
44
+ type: Boolean,
45
+ default: true,
46
+ },
47
+ name: {
48
+ type: String,
49
+ required: true,
50
+ },
51
+ title: {
52
+ type: String,
53
+ default: "Confirm deletion",
54
+ },
55
+ warning: {
56
+ type: String,
57
+ default: "Please read carefully",
58
+ },
59
+ description: {
60
+ type: String,
61
+ default:
62
+ "Do you really want to delete this object? This action is irreversible",
63
+ },
64
+ typeToConfirm: {
65
+ type: String,
66
+ default: "",
67
+ },
68
+ cancelLabel: {
69
+ type: String,
70
+ default: "Cancel",
71
+ },
72
+ deleteLabel: {
73
+ type: String,
74
+ default: "I understand, delete",
75
+ },
76
+ },
77
+ data() {
78
+ return {
79
+ userInput: "",
80
+ };
81
+ },
82
+ computed: {
83
+ typeToConfirmMessage() {
84
+ if (this.typeToConfirm) {
85
+ return this.typeToConfirm;
86
+ } else {
87
+ return `Type <strong>${this.name}</strong> to confirm deletion`;
88
+ }
89
+ },
90
+ },
91
+ watch: {
92
+ isShown: function () {
93
+ if (this.isShown) {
94
+ this.userInput = "";
95
+
96
+ setTimeout(() => {
97
+ this.focusElement("userInput");
98
+ }, 300);
99
+ }
100
+ },
101
+ },
102
+ methods: {
103
+ onModalHidden() {
104
+ this.$emit("hide");
105
+ },
106
+ confirmDelete() {
107
+ if (this.name == this.userInput) {
108
+ this.$emit("confirmDelete");
109
+ }
110
+ },
111
+ },
112
+ };
113
+ </script>
114
+
115
+ <style scoped lang="scss"></style>
@@ -5,7 +5,7 @@
5
5
  :animationData="animationData"
6
6
  :refName="animationTitle"
7
7
  :animateOnHover="true"
8
- :loop="1"
8
+ :loop="loop"
9
9
  :autoPlay="true"
10
10
  class="animation image"
11
11
  />
@@ -42,6 +42,10 @@ export default {
42
42
  },
43
43
  animationData: Object,
44
44
  animationTitle: String,
45
+ loop: {
46
+ type: [Boolean, Number],
47
+ default: 1,
48
+ },
45
49
  },
46
50
  computed: {
47
51
  hasPictogramSlot() {
@@ -1,5 +1,7 @@
1
1
  <template>
2
2
  <cv-tile kind="standard" :light="light" class="info-card">
3
+ <!-- overflow menu -->
4
+ <slot v-if="showOverflowMenu" name="menu"></slot>
3
5
  <!-- icon -->
4
6
  <div v-if="icon" class="row">
5
7
  <NsSvg :svg="icon" />
@@ -12,7 +14,7 @@
12
14
  </div>
13
15
  <div class="row slot">
14
16
  <!-- Extra content -->
15
- <slot></slot>
17
+ <slot name="content"></slot>
16
18
  </div>
17
19
  </cv-tile>
18
20
  </template>
@@ -41,6 +43,10 @@ export default {
41
43
  return val.render !== null;
42
44
  },
43
45
  },
46
+ showOverflowMenu: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
44
50
  light: Boolean,
45
51
  },
46
52
  };
@@ -52,6 +58,8 @@ export default {
52
58
  flex-direction: column;
53
59
  justify-content: center;
54
60
  min-height: 7rem;
61
+ // needed for abosulute positioning of overflow menu
62
+ position: relative;
55
63
  }
56
64
 
57
65
  .row {
@@ -105,6 +105,8 @@ export default {
105
105
  .title {
106
106
  margin-right: 0.75rem;
107
107
  margin-bottom: 0.2rem;
108
+ font-size: 0.875rem !important;
109
+ font-weight: 600 !important;
108
110
  }
109
111
 
110
112
  .mg-right {
@@ -120,4 +122,9 @@ export default {
120
122
  .bx--inline-notification__close-button {
121
123
  position: absolute !important;
122
124
  }
125
+
126
+ .bx--inline-notification__text-wrapper p {
127
+ // needed for inline notifications inside modal
128
+ padding-right: 0 !important;
129
+ }
123
130
  </style>
@@ -12,6 +12,7 @@
12
12
  :passwordShowLabel="passwordShowLabel"
13
13
  :passwordVisible="newPasswordVisible"
14
14
  :light="light"
15
+ :disabled="disabled"
15
16
  class="new-password"
16
17
  ref="newPassword"
17
18
  >
@@ -65,6 +66,7 @@
65
66
  :passwordShowLabel="passwordShowLabel"
66
67
  :passwordVisible="confirmPasswordVisible"
67
68
  :light="light"
69
+ :disabled="disabled"
68
70
  class="confirm-password"
69
71
  ref="confirmPassword"
70
72
  >
@@ -136,6 +138,7 @@ export default {
136
138
  type: String,
137
139
  default: "Equal",
138
140
  },
141
+ disabled: Boolean,
139
142
  },
140
143
  data() {
141
144
  return {
@@ -163,25 +166,25 @@ export default {
163
166
  },
164
167
  },
165
168
  watch: {
166
- isLengthOk: function() {
169
+ isLengthOk: function () {
167
170
  this.emitPasswordValidity();
168
171
  },
169
- isLowercaseOk: function() {
172
+ isLowercaseOk: function () {
170
173
  this.emitPasswordValidity();
171
174
  },
172
- isUppercaseOk: function() {
175
+ isUppercaseOk: function () {
173
176
  this.emitPasswordValidity();
174
177
  },
175
- isNumberOk: function() {
178
+ isNumberOk: function () {
176
179
  this.emitPasswordValidity();
177
180
  },
178
- isSymbolOk: function() {
181
+ isSymbolOk: function () {
179
182
  this.emitPasswordValidity();
180
183
  },
181
- isEqualOk: function() {
184
+ isEqualOk: function () {
182
185
  this.emitPasswordValidity();
183
186
  },
184
- focus: function() {
187
+ focus: function () {
185
188
  if (this.focus && this.focus.element) {
186
189
  this.focusElement(this.focus.element);
187
190
  }
@@ -33,11 +33,12 @@ export default {
33
33
  return {
34
34
  progressLine: {
35
35
  width: this.value + "%",
36
+ transition: "width 0.3s",
36
37
  },
37
38
  };
38
39
  },
39
40
  watch: {
40
- value: function() {
41
+ value: function () {
41
42
  this.progressLine.width = this.value + "%";
42
43
  },
43
44
  },
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <path
3
+ id="group"
4
+ d="M24.36,31h-0.72v-7.5c0-3.552-2.414-6.604-5.872-7.424c-0.15-0.036-0.261-0.163-0.275-0.316
5
+ c-0.015-0.154,0.071-0.3,0.212-0.363c1.517-0.675,2.496-2.181,2.496-3.836c0-2.316-1.884-4.201-4.2-4.201S11.8,9.244,11.8,11.561
6
+ c0,1.655,0.98,3.162,2.496,3.836c0.141,0.063,0.227,0.209,0.212,0.363c-0.014,0.153-0.125,0.281-0.275,0.316
7
+ c-3.458,0.82-5.872,3.872-5.872,7.424V31H7.64v-7.5c0-3.592,2.257-6.718,5.585-7.879c-1.326-0.907-2.146-2.421-2.146-4.061
8
+ c0-1.964,1.157-3.664,2.826-4.452C14.101,6.617,14.2,6.097,14.2,5.561c0-2.316-1.884-4.201-4.2-4.201S5.799,3.244,5.799,5.561
9
+ c0,1.656,0.98,3.162,2.496,3.836C8.437,9.46,8.521,9.606,8.507,9.76c-0.014,0.153-0.125,0.281-0.275,0.316
10
+ C4.774,10.896,2.36,13.948,2.36,17.5V25H1.64v-7.5c0-3.592,2.257-6.718,5.585-7.879C5.899,8.714,5.08,7.2,5.08,5.561
11
+ c0-2.713,2.207-4.92,4.92-4.92s4.92,2.207,4.92,4.92c0,0.422-0.052,0.836-0.157,1.237c0.791-0.205,1.683-0.205,2.473,0
12
+ c-0.104-0.401-0.157-0.815-0.157-1.237c0-2.713,2.208-4.92,4.921-4.92s4.921,2.207,4.921,4.92c0,1.64-0.82,3.154-2.146,4.061
13
+ c3.329,1.161,5.586,4.287,5.586,7.879V25H29.64v-7.5c0-3.552-2.414-6.604-5.872-7.424c-0.15-0.036-0.261-0.163-0.275-0.316
14
+ c-0.015-0.154,0.071-0.3,0.212-0.363C25.221,8.722,26.2,7.216,26.2,5.561c0-2.316-1.884-4.201-4.2-4.201s-4.2,1.884-4.2,4.201
15
+ c0,0.536,0.099,1.056,0.295,1.548c1.669,0.789,2.826,2.488,2.826,4.452c0,1.64-0.82,3.154-2.146,4.061
16
+ c3.329,1.161,5.586,4.287,5.586,7.879L24.36,31L24.36,31z"
17
+ />
18
+ </template>