@milaboratories/uikit 2.2.22 → 2.2.24

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": "@milaboratories/uikit",
3
- "version": "2.2.22",
3
+ "version": "2.2.24",
4
4
  "type": "module",
5
5
  "main": "dist/pl-uikit.umd.js",
6
6
  "module": "dist/pl-uikit.js",
@@ -32,8 +32,8 @@
32
32
  "vue-tsc": "^2.1.10",
33
33
  "yarpm": "^1.2.0",
34
34
  "svgo": "^3.3.2",
35
- "@milaboratories/helpers": "^1.6.8",
36
- "@platforma-sdk/model": "^1.14.1"
35
+ "@platforma-sdk/model": "^1.14.1",
36
+ "@milaboratories/helpers": "^1.6.8"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "vite",
@@ -1,15 +1,18 @@
1
1
  <script lang="ts" setup>
2
- import style from './pl-file-dialog.module.scss';
3
- import { watch, reactive, computed, toRef, onMounted } from 'vue';
2
+ import { useEventListener } from '@/composition/useEventListener';
3
+ import type { ImportedFiles } from '@/types';
4
4
  import { between, notEmpty, tapIf } from '@milaboratories/helpers';
5
5
  import type { StorageHandle } from '@platforma-sdk/model';
6
- import type { ImportedFiles } from '@/types';
7
- import { getFilePathBreadcrumbs, normalizeExtensions, type FileDialogItem } from './utils';
6
+ import { computed, onMounted, reactive, toRef, watch } from 'vue';
8
7
  import { PlDropdown } from '../PlDropdown';
9
- import { useEventListener } from '@/composition/useEventListener';
10
- import { defaultData, useVisibleItems, vTextOverflown } from './remote';
11
- import { PlSearchField } from '../PlSearchField';
12
8
  import { PlIcon16 } from '../PlIcon16';
9
+ import { PlSearchField } from '../PlSearchField';
10
+ import style from './pl-file-dialog.module.scss';
11
+ import { defaultData, useVisibleItems, vTextOverflown } from './remote';
12
+ import { getFilePathBreadcrumbs, normalizeExtensions, type FileDialogItem } from './utils';
13
+
14
+ // note that on a Mac, a click combined with the control key is intercepted by the operating system and used to open a context menu, so ctrlKey is not detectable on click events.
15
+ const isCtrlOrMeta = (ev: KeyboardEvent | MouseEvent) => ev.ctrlKey || ev.metaKey;
13
16
 
14
17
  defineEmits<{
15
18
  (e: 'update:modelValue', value: boolean): void;
@@ -119,7 +122,10 @@ const setDirPath = (dirPath: string) => {
119
122
  };
120
123
 
121
124
  const selectFile = (ev: MouseEvent, file: FileDialogItem) => {
122
- const { shiftKey, metaKey } = ev;
125
+ const { shiftKey } = ev;
126
+
127
+ const ctrlOrMetaKey = isCtrlOrMeta(ev);
128
+
123
129
  const { lastSelected } = data;
124
130
 
125
131
  ev.preventDefault();
@@ -135,7 +141,7 @@ const selectFile = (ev: MouseEvent, file: FileDialogItem) => {
135
141
  return;
136
142
  }
137
143
 
138
- if (!metaKey && !shiftKey) {
144
+ if (!ctrlOrMetaKey && !shiftKey) {
139
145
  data.items.forEach((f) => {
140
146
  if (f.id !== file.id) {
141
147
  f.selected = false;
@@ -183,22 +189,18 @@ const loadAvailableStorages = () => {
183
189
  window.platforma.lsDriver
184
190
  .getStorageList()
185
191
  .then((storageEntries) => {
192
+ // local storage is always returned by the ML, so we need to remove it from remote dialog manually
193
+ storageEntries = storageEntries.filter((it) => it.name !== 'local' && !it.name.startsWith('local_disk_'));
194
+
186
195
  data.storageOptions = storageEntries.map((it) => ({
187
196
  text: it.name,
188
197
  value: it,
189
198
  }));
190
199
 
191
200
  if (props.autoSelectStorage) {
192
- tapIf(
193
- storageEntries.find(
194
- (e) =>
195
- e.name === 'local' || // the only local storage on unix systems
196
- (e.name.startsWith('local_disk_') && e.initialFullPath.length > 4),
197
- ), // local drive where home folder is stored, normally C:\
198
- (entry) => {
199
- data.storageEntry = entry;
200
- },
201
- );
201
+ tapIf(storageEntries[0], (entry) => {
202
+ data.storageEntry = entry;
203
+ });
202
204
  }
203
205
  })
204
206
  .catch((err) => (data.error = String(err)));
@@ -238,12 +240,14 @@ useEventListener(document, 'keydown', (ev: KeyboardEvent) => {
238
240
  return;
239
241
  }
240
242
 
241
- if (ev.metaKey && ev.code === 'KeyA') {
243
+ const ctrlOrMetaKey = isCtrlOrMeta(ev);
244
+
245
+ if (ctrlOrMetaKey && ev.code === 'KeyA') {
242
246
  ev.preventDefault();
243
247
  selectAll();
244
248
  }
245
249
 
246
- if (ev.metaKey && ev.shiftKey && ev.code === 'Period') {
250
+ if (ctrlOrMetaKey && ev.shiftKey && ev.code === 'Period') {
247
251
  ev.preventDefault();
248
252
  data.showHiddenItems = !data.showHiddenItems;
249
253
  }
@@ -13,7 +13,7 @@ import DoubleContour from '@/utils/DoubleContour.vue';
13
13
  import { useLabelNotch } from '@/utils/useLabelNotch';
14
14
  import { useValidation } from '@/utils/useValidation';
15
15
  import { PlIcon16 } from '../PlIcon16';
16
- import { PlIcon24 } from '../PlIcon24';
16
+ import { PlMaskIcon24 } from '../PlMaskIcon24';
17
17
  import type { Equal } from '@milaboratories/helpers';
18
18
 
19
19
  const slots = useSlots();
@@ -160,7 +160,7 @@ const displayErrors = computed(() => {
160
160
 
161
161
  const hasErrors = computed(() => displayErrors.value.length > 0);
162
162
 
163
- const canShowClearable = computed(() => props.clearable && nonEmpty.value && props.type !== 'password');
163
+ const canShowClearable = computed(() => props.clearable && nonEmpty.value && props.type !== 'password' && !props.disabled);
164
164
 
165
165
  const togglePasswordVisibility = () => (showPassword.value = !showPassword.value);
166
166
 
@@ -206,7 +206,7 @@ useLabelNotch(rootRef);
206
206
  />
207
207
  <div class="pl-text-field__append">
208
208
  <PlIcon16 v-if="canShowClearable" class="pl-text-field__clearable" name="delete-clear" @click="clear" />
209
- <PlIcon24 v-if="type === 'password'" :name="passwordIcon" style="cursor: pointer" @click="togglePasswordVisibility" />
209
+ <PlMaskIcon24 v-if="type === 'password'" :name="passwordIcon" style="cursor: pointer" @click="togglePasswordVisibility" />
210
210
  <slot name="append" />
211
211
  </div>
212
212
  <DoubleContour class="pl-text-field__contour" />
@@ -3,6 +3,7 @@
3
3
  .pl-text-field {
4
4
  $root: &;
5
5
 
6
+ --pl-text-field-text-color: var(--txt-01);
6
7
  --contour-color: var(--txt-01);
7
8
  --label-color: var(--txt-01);
8
9
  --contour-border-width: 1px;
@@ -36,7 +37,7 @@
36
37
  border: none;
37
38
  font-size: inherit;
38
39
  background-color: transparent;
39
- color: var(--txt-01);
40
+ color: var(--pl-text-field-text-color);
40
41
  caret-color: var(--border-color-focus);
41
42
  cursor: inherit;
42
43
 
@@ -140,6 +141,9 @@
140
141
 
141
142
  &.disabled {
142
143
  --contour-color: var(--color-dis-01);
144
+ --label-color: var(--dis-01);
145
+ --pl-text-field-text-color: var(--dis-01);
146
+ --mask-icon-bg-color: var(--dis-01);
143
147
  cursor: not-allowed;
144
148
  }
145
149
  }