@v1nt1248/3nclient-lib 0.1.66 → 0.1.67

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
@@ -2,7 +2,7 @@
2
2
  "name": "@v1nt1248/3nclient-lib",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "v1nt1248",
5
- "version": "0.1.66",
5
+ "version": "0.1.67",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -61,6 +61,10 @@
61
61
  }
62
62
 
63
63
  function turnOnEditMode() {
64
+ if (props.disabled) {
65
+ return;
66
+ }
67
+
64
68
  inEdit.value = true;
65
69
  initialValue.value = value.value;
66
70
 
@@ -80,6 +84,10 @@
80
84
  }
81
85
 
82
86
  function done() {
87
+ if (props.disabled) {
88
+ return;
89
+ }
90
+
83
91
  if (props.disallowEmptyValue && !isValid.value) {
84
92
  return;
85
93
  }
@@ -93,6 +101,10 @@
93
101
  }
94
102
 
95
103
  function cancel() {
104
+ if (props.disabled) {
105
+ return;
106
+ }
107
+
96
108
  if (value.value !== initialValue.value) {
97
109
  value.value = initialValue.value;
98
110
  emits('update:modelValue', value.value);
@@ -102,6 +114,10 @@
102
114
  }
103
115
 
104
116
  function onClickOutside() {
117
+ if (props.disabled) {
118
+ return;
119
+ }
120
+
105
121
  if (inEdit.value) {
106
122
  emits('focusout');
107
123
  done();
@@ -121,7 +137,7 @@
121
137
  watch(
122
138
  () => inEdit.value,
123
139
  val => {
124
- emits('toggle:editMode', val);
140
+ !props.disabled && emits('toggle:editMode', val);
125
141
  },
126
142
  );
127
143
  </script>
@@ -129,7 +145,7 @@
129
145
  <template>
130
146
  <div
131
147
  v-ui3n-click-outside="onClickOutside"
132
- :class="$style.ui3nEditable"
148
+ :class="[$style.ui3nEditable, disabled && $style.ui3nEditableDisabled]"
133
149
  @focusin="emits('focusin', $event);"
134
150
  >
135
151
  <template v-if="inEdit">
@@ -148,11 +164,19 @@
148
164
  @keydown.esc="cancel"
149
165
  />
150
166
 
151
- <div v-ui3n-ripple :class="[$style.btn, $style.doneBtn]" @click.stop.prevent="done">
167
+ <div
168
+ v-ui3n-ripple
169
+ :class="[$style.btn, $style.doneBtn, disabled && $style.btnDisabled]"
170
+ @click.stop.prevent="done"
171
+ >
152
172
  <ui3n-icon icon="round-done" size="12" color="var(--color-icon-table-accent-default)" />
153
173
  </div>
154
174
 
155
- <div v-ui3n-ripple :class="[$style.btn, $style.cancelBtn]" @click.stop.prevent="cancel">
175
+ <div
176
+ v-ui3n-ripple
177
+ :class="[$style.btn, $style.cancelBtn, disabled && $style.btnDisabled]"
178
+ @click.stop.prevent="cancel"
179
+ >
156
180
  <ui3n-icon icon="round-close" size="12" color="var(--color-icon-table-secondary-default)" />
157
181
  </div>
158
182
  </template>
@@ -192,6 +216,11 @@
192
216
  overflow: hidden;
193
217
  }
194
218
 
219
+ .ui3nEditableDisabled {
220
+ cursor: default;
221
+ pointer-events: none;
222
+ }
223
+
195
224
  .content {
196
225
  position: relative;
197
226
  height: var(--ui3n-editable-height);
@@ -300,4 +329,10 @@
300
329
  opacity: 1;
301
330
  }
302
331
  }
332
+
333
+ .btnDisabled {
334
+ cursor: default;
335
+ pointer-events: none;
336
+ opacity: 0.75;
337
+ }
303
338
  </style>