@milaboratories/uikit 2.2.47 → 2.2.49

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.47",
3
+ "version": "2.2.49",
4
4
  "type": "module",
5
5
  "main": "dist/pl-uikit.umd.js",
6
6
  "module": "dist/pl-uikit.js",
@@ -34,8 +34,8 @@
34
34
  "yarpm": "^1.2.0",
35
35
  "svgo": "^3.3.2",
36
36
  "@types/d3": "^7.4.3",
37
- "@milaboratories/helpers": "^1.6.11",
38
37
  "@milaboratories/eslint-config": "^1.0.1",
38
+ "@milaboratories/helpers": "^1.6.11",
39
39
  "@platforma-sdk/model": "^1.21.20"
40
40
  },
41
41
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, ref } from 'vue';
3
- import { debounce, notEmpty } from '../helpers/utils';
3
+ import { debounce, notEmpty } from '@milaboratories/helpers';
4
4
 
5
5
  const hasElementEllipsis = ref(false);
6
6
 
@@ -11,6 +11,10 @@ export default {
11
11
  import './pl-checkbox-group.scss';
12
12
  import type { SimpleOption } from '@/types';
13
13
  import PlCheckboxBase from '@/components/PlCheckbox/PlCheckboxBase.vue';
14
+ import { PlTooltip } from '../PlTooltip';
15
+ import { useSlots } from 'vue';
16
+
17
+ const slots = useSlots();
14
18
 
15
19
  const emit = defineEmits<{
16
20
  (e: 'update:modelValue', v: M[]): void;
@@ -46,8 +50,15 @@ const updateModel = (value: M) => {
46
50
  </script>
47
51
 
48
52
  <template>
49
- <div class="ui-checkbox-group" :class="{ disabled }">
50
- <label v-if="label">{{ label }}</label>
53
+ <div class="pl-checkbox-group" :class="{ disabled }">
54
+ <label v-if="label">
55
+ <span>{{ label }}</span>
56
+ <PlTooltip v-if="slots.tooltip" class="info" position="top">
57
+ <template #tooltip>
58
+ <slot name="tooltip" />
59
+ </template>
60
+ </PlTooltip>
61
+ </label>
51
62
  <div v-for="(opt, i) in options.map((it) => ({ label: 'label' in it ? it.label : it.text, value: it.value }))" :key="i">
52
63
  <PlCheckboxBase :disabled="disabled" :label="opt.label" :model-value="hasValue(opt.value)" @update:model-value="() => updateModel(opt.value)" />
53
64
  <label @click.stop="() => updateModel(opt.value)">{{ opt.label }}</label>
@@ -1,4 +1,4 @@
1
- .ui-checkbox-group {
1
+ .pl-checkbox-group {
2
2
  --color-label: var(--color-text);
3
3
  --cursor-label: pointer;
4
4
  display: flex;
@@ -9,11 +9,12 @@
9
9
  --cursor-label: default;
10
10
  pointer-events: none;
11
11
  }
12
- label {
12
+ > label {
13
13
  color: var(--color-label);
14
14
  cursor: var(--cursor-label);
15
- }
16
- > label {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: 4px;
17
18
  margin-bottom: 6px;
18
19
  font-size: 14px;
19
20
  font-weight: 600;
@@ -7,7 +7,7 @@ export default {
7
7
  <script lang="ts" setup>
8
8
  import { useEventListener } from '@/composition/useEventListener';
9
9
  import './pl-dialog-modal.scss';
10
- import { computed, ref, useAttrs, useSlots } from 'vue';
10
+ import { computed, ref, useSlots } from 'vue';
11
11
  import PlCloseModalBtn from '@/utils/PlCloseModalBtn.vue';
12
12
  import type { Size } from '@/types';
13
13
 
@@ -109,8 +109,6 @@ const style = computed(() => {
109
109
  return { width, height, minHeight, maxHeight };
110
110
  });
111
111
 
112
- const $attrs = useAttrs();
113
-
114
112
  function onClickShadow(ev: Event) {
115
113
  if (modal.value && props.closeOnOutsideClick && document.contains(ev.target as Node) && !modal.value.contains(ev.target as Node)) {
116
114
  emit('update:modelValue', false);
@@ -1,7 +1,10 @@
1
1
  <script lang="ts" setup>
2
2
  import type { ModelRef, RefOption } from '@/types';
3
3
  import PlDropdownMulti from '../PlDropdownMulti/PlDropdownMulti.vue';
4
- import { computed } from 'vue';
4
+ import { computed, useSlots } from 'vue';
5
+
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ const slots: any = useSlots();
5
8
 
6
9
  defineEmits<{
7
10
  /**
@@ -70,5 +73,9 @@ const options = computed(() =>
70
73
  v-bind="props"
71
74
  :options="options"
72
75
  @update:model-value="$emit('update:modelValue', $event)"
73
- />
76
+ >
77
+ <template v-if="slots.tooltip" #tooltip>
78
+ <slot name="tooltip" />
79
+ </template>
80
+ </PlDropdownMulti>
74
81
  </template>
@@ -10,7 +10,10 @@ export default {
10
10
  <script lang="ts" setup>
11
11
  import type { ModelRef, RefOption } from '@/types';
12
12
  import { PlDropdown } from '../PlDropdown';
13
- import { computed } from 'vue';
13
+ import { computed, useSlots } from 'vue';
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ const slots: any = useSlots();
14
17
 
15
18
  defineEmits<{
16
19
  /**
@@ -98,5 +101,9 @@ const arrowIcon = computed(() => (props.disabled ? 'icon-link-disabled' : 'icon-
98
101
  :loading-options-helper="loadingOptionsHelper"
99
102
  :arrow-icon-large="arrowIcon"
100
103
  @update:model-value="$emit('update:modelValue', $event)"
101
- />
104
+ >
105
+ <template v-if="slots.tooltip" #tooltip>
106
+ <slot name="tooltip" />
107
+ </template>
108
+ </PlDropdown>
102
109
  </template>
@@ -8,7 +8,7 @@ export default {
8
8
  </script>
9
9
 
10
10
  <script lang="ts" setup>
11
- import { computed, ref, watch } from 'vue';
11
+ import { computed, ref, useSlots, watch } from 'vue';
12
12
  import { PlMaskIcon24 } from '../PlMaskIcon24';
13
13
  import './pl-log-view.scss';
14
14
  import { okOptional, tapIf } from '@milaboratories/helpers';
@@ -24,6 +24,8 @@ const getOutputError = <T>(o?: ValueOrErrors<T>) => {
24
24
  }
25
25
  };
26
26
 
27
+ const slots = useSlots();
28
+
27
29
  const props = defineProps<{
28
30
  /**
29
31
  * String contents
@@ -114,7 +116,14 @@ const onContentScroll = (ev: Event) => {
114
116
 
115
117
  <template>
116
118
  <div ref="root" class="pl-log-view" :class="{ 'has-error': computedError }">
117
- <label v-if="label"> {{ label }} </label>
119
+ <label v-if="label">
120
+ <span>{{ label }}</span>
121
+ <PlTooltip v-if="slots.tooltip" class="info" position="top">
122
+ <template #tooltip>
123
+ <slot name="tooltip" />
124
+ </template>
125
+ </PlTooltip>
126
+ </label>
118
127
  <DoubleContour class="pl-log-view__contour" />
119
128
  <div class="pl-log-view__copy">
120
129
  <PlTooltip :close-delay="800" position="top">
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'vue';
2
2
  import { ref, watch } from 'vue';
3
- import { notEmpty } from '@/helpers/utils';
3
+ import { notEmpty } from '@milaboratories/helpers';
4
4
 
5
5
  const $store = new Map<string, Ref<string | null>>();
6
6
 
@@ -4,14 +4,6 @@ export function call<R>(f: () => R): R {
4
4
  return f();
5
5
  }
6
6
 
7
- export function notEmpty<T>(v: T | null | undefined, message: string): T {
8
- if (v === null || v === undefined) {
9
- throw Error(message);
10
- }
11
-
12
- return v;
13
- }
14
-
15
7
  export function requestTick<P>(cb: (...args: P[]) => void) {
16
8
  let tick = false;
17
9
 
@@ -108,17 +100,6 @@ export function animateInfinite(options: { getFraction: (dt: number) => number;
108
100
  /* eslint-disable @typescript-eslint/no-explicit-any */
109
101
  type AnyFunction = (...args: any[]) => any;
110
102
 
111
- export function debounce<F extends AnyFunction>(func: F, delay: number) {
112
- let timerId = -1;
113
- return (...args: Parameters<F>) => {
114
- if (timerId !== -1) {
115
- clearTimeout(timerId);
116
- timerId = -1;
117
- }
118
- timerId = window.setTimeout(() => func(...args), delay);
119
- };
120
- }
121
-
122
103
  export function throttle<F extends AnyFunction>(callback: F, ms: number, trailing = true): (...args: Parameters<F>) => void {
123
104
  let t = 0,
124
105
  call: AnyFunction | null;
@@ -142,6 +123,10 @@ export function listToOptions<T>(list: T[] | readonly T[]): ListOption<T>[] {
142
123
  }
143
124
 
144
125
  export function normalizeListOptions<V = unknown>(options: Readonly<ListOption<V>[]>) {
126
+ if (!Array.isArray(options)) {
127
+ throw Error('Invalid component options: ' + String(options));
128
+ }
129
+
145
130
  return options.map((it) => ({
146
131
  label: 'label' in it ? it.label : it.text,
147
132
  value: it.value,
package/vite.config.ts CHANGED
@@ -40,8 +40,8 @@ export default defineConfig({
40
40
  },
41
41
  },
42
42
  build: {
43
- sourcemap: process.env.DEV_SOURCE_MAP === '1',
44
- emptyOutDir: false,
43
+ sourcemap: true,
44
+ emptyOutDir: true,
45
45
  lib: {
46
46
  // Could also be a dictionary or array of multiple entry points
47
47
  entry: [resolve(__dirname, 'src/index.ts')],