@nethserver/ns8-ui-lib 0.0.82 → 0.0.85

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.82",
3
+ "version": "0.0.85",
4
4
  "description": "Vue.js library for NethServer 8 UI",
5
5
  "keywords": [
6
6
  "nethserver",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="ns-data-table">
3
3
  <cv-search
4
- v-if="isSearchable"
4
+ v-if="isSearchable && !isErrorShown"
5
5
  :label="searchLabel"
6
6
  :placeholder="searchPlaceholder"
7
7
  :clear-aria-label="searchClearLabel"
@@ -13,9 +13,16 @@
13
13
  ref="tableSearch"
14
14
  >
15
15
  </cv-search>
16
+ <NsInlineNotification
17
+ v-if="isErrorShown"
18
+ kind="error"
19
+ :title="errorTitle"
20
+ :description="errorDescription"
21
+ :showCloseButton="false"
22
+ />
16
23
  <!-- loading data -->
17
24
  <cv-data-table-skeleton
18
- v-if="isLoading"
25
+ v-else-if="isLoading"
19
26
  :columns="columns"
20
27
  :rows="skeletonRows"
21
28
  ></cv-data-table-skeleton>
@@ -358,6 +365,9 @@ export default {
358
365
  isSearchable: { type: Boolean, default: false },
359
366
  isLoading: { type: Boolean, default: false },
360
367
  skeletonRows: { type: Number, default: 10 },
368
+ isErrorShown: { type: Boolean, default: false },
369
+ errorTitle: { type: String, default: "Cannot retrieve table data" },
370
+ errorDescription: { type: String, default: "Something went wrong" },
361
371
  noSearchResultsLabel: { type: String, default: "No results" },
362
372
  noSearchResultsDescription: {
363
373
  type: String,
@@ -1,14 +1,145 @@
1
+ <template>
2
+ <div
3
+ data-modal
4
+ :id="uid"
5
+ :class="[
6
+ `cv-modal ${carbonPrefix}--modal`,
7
+ {
8
+ 'is-visible': dataVisible,
9
+ [`${carbonPrefix}--modal--danger`]: kind === 'danger',
10
+ },
11
+ ]"
12
+ tabindex="-1"
13
+ @keydown.esc.prevent="onEsc"
14
+ @click.self="onExternalClick"
15
+ >
16
+ <div
17
+ :class="[
18
+ `${carbonPrefix}--modal-container`,
19
+ { [`${carbonPrefix}--modal-container--${internalSize}`]: internalSize },
20
+ ]"
21
+ v-bind="dialogAttrs"
22
+ ref="modalDialog"
23
+ >
24
+ <div
25
+ class="cv-modal__before-content"
26
+ ref="beforeContent"
27
+ tabindex="0"
28
+ style="position: absolute; height: 1px; width: 1px; left: -9999px"
29
+ @focus="focusBeforeContent"
30
+ />
31
+ <div :class="`${carbonPrefix}--modal-header`">
32
+ <p :class="`${carbonPrefix}--modal-header__label`">
33
+ <slot name="label"></slot>
34
+ </p>
35
+ <p :class="`${carbonPrefix}--modal-header__heading`">
36
+ <slot name="title">Modal Title</slot>
37
+ </p>
38
+ <button
39
+ :class="`${carbonPrefix}--modal-close`"
40
+ type="button"
41
+ @click="onClose"
42
+ ref="close"
43
+ :aria-label="closeAriaLabel"
44
+ >
45
+ <Close16 :class="`${carbonPrefix}--modal-close__icon`" />
46
+ </button>
47
+ </div>
48
+
49
+ <div
50
+ :class="[
51
+ `${carbonPrefix}--modal-content`,
52
+ { [`${carbonPrefix}--modal-content--with-form`]: hasFormContent },
53
+ ]"
54
+ ref="content"
55
+ :tabindex="scrollable ? 0 : undefined"
56
+ >
57
+ <slot name="content"></slot>
58
+ </div>
59
+
60
+ <cv-button-set
61
+ :class="[
62
+ `${carbonPrefix}--modal-footer`,
63
+ {
64
+ [`${carbonPrefix}--modal-footer--three-button`]:
65
+ hasPrimary && hasSecondary && hasOtherBtn,
66
+ },
67
+ ]"
68
+ v-if="hasFooter"
69
+ >
70
+ <cv-button
71
+ type="button"
72
+ kind="secondary"
73
+ @click="onOtherBtnClick"
74
+ v-if="hasOtherBtn"
75
+ ref="otherBtn"
76
+ >
77
+ <slot name="other-button">Other button</slot>
78
+ </cv-button>
79
+ <cv-button
80
+ type="button"
81
+ kind="secondary"
82
+ @click="onSecondaryClick"
83
+ v-if="hasSecondary"
84
+ ref="secondary"
85
+ >
86
+ <slot name="secondary-button">Secondary button</slot>
87
+ </cv-button>
88
+ <NsButton
89
+ :disabled="primaryButtonDisabled"
90
+ type="button"
91
+ :kind="primaryKind"
92
+ @click="onPrimaryClick"
93
+ v-if="hasPrimary"
94
+ ref="primary"
95
+ :loading="isLoading"
96
+ >
97
+ <slot name="primary-button">Primary button</slot>
98
+ </NsButton>
99
+ </cv-button-set>
100
+ <div
101
+ class="cv-modal__after-content"
102
+ ref="afterContent"
103
+ tabindex="0"
104
+ style="position: absolute; height: 1px; width: 1px; left: -9999px"
105
+ @focus="focusAfterContent"
106
+ />
107
+ </div>
108
+ </div>
109
+ </template>
110
+
1
111
  <script>
2
112
  import { CvModal } from "@carbon/vue";
113
+ import NsButton from "./NsButton";
3
114
 
4
115
  export default {
5
116
  name: "NsModal",
6
117
  extends: CvModal,
118
+ components: {
119
+ CvModal,
120
+ NsButton,
121
+ },
7
122
  props: {
8
123
  hideOnClickOutside: {
9
124
  type: Boolean,
10
125
  default: false,
11
126
  },
127
+ isLoading: {
128
+ type: Boolean,
129
+ default: false,
130
+ },
131
+ alert: Boolean,
132
+ closeAriaLabel: { type: String, default: "Close modal" },
133
+ kind: {
134
+ type: String,
135
+ default: "",
136
+ validator: (val) => ["", "danger"].includes(val),
137
+ },
138
+ autoHideOff: Boolean,
139
+ visible: Boolean,
140
+ primaryButtonDisabled: Boolean,
141
+ size: String,
142
+ hasFormContent: Boolean,
12
143
  },
13
144
  methods: {
14
145
  onExternalClick(ev) {
@@ -66,6 +66,7 @@
66
66
  kind="secondary"
67
67
  :icon="Close20"
68
68
  @click="$emit('cancel')"
69
+ :disabled="isCancelDisabled"
69
70
  type="button"
70
71
  class="wizard-button"
71
72
  ref="wizardCancel"
@@ -118,6 +119,7 @@ export default {
118
119
  nextLabel: { type: String, default: "Next" },
119
120
  isPreviousDisabled: Boolean,
120
121
  isNextDisabled: Boolean,
122
+ isCancelDisabled: Boolean,
121
123
  isNextLoading: Boolean,
122
124
  closeAriaLabel: { type: String, default: "Close modal" },
123
125
  autoHideOff: Boolean,