@v1nt1248/3nclient-lib 0.3.20 → 0.3.22
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/dist/style.css +1 -1
- package/dist/ui3n-components.js +2030 -5266
- package/package.json +1 -1
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +9 -12
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +10 -16
- package/src/components/ui3n-table/composables/useTable.ts +12 -7
package/package.json
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, onBeforeMount, onBeforeUnmount, ref, useCssModule } from 'vue';
|
|
3
|
-
import
|
|
3
|
+
import toNumber from 'lodash/toNumber';
|
|
4
4
|
import type { Ui3nProgressCircularProps } from './types';
|
|
5
5
|
|
|
6
6
|
const thresholdSize = 64;
|
|
7
7
|
const indeterminateModeValues = [1, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 85, 90, 95, 99];
|
|
8
8
|
|
|
9
|
-
const props = withDefaults(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
color: 'var(--color-bg-control-accent-default)',
|
|
16
|
-
},
|
|
17
|
-
);
|
|
9
|
+
const props = withDefaults(defineProps<Ui3nProgressCircularProps>(), {
|
|
10
|
+
value: 0,
|
|
11
|
+
size: 64,
|
|
12
|
+
bgColor: 'var(--color-bg-control-primary-default)',
|
|
13
|
+
color: 'var(--color-bg-control-accent-default)',
|
|
14
|
+
});
|
|
18
15
|
|
|
19
16
|
const $style = useCssModule();
|
|
20
17
|
|
|
@@ -47,7 +44,7 @@
|
|
|
47
44
|
|
|
48
45
|
const strokeDasharray = computed(() => {
|
|
49
46
|
const value = props.indeterminate ? indeterminateModeValue.value : innerValue.value;
|
|
50
|
-
const dash = Math.round(circumference.value * value! / 100);
|
|
47
|
+
const dash = Math.round((circumference.value * value!) / 100);
|
|
51
48
|
const gap = circumference.value - dash;
|
|
52
49
|
return `${dash} ${gap}`;
|
|
53
50
|
});
|
|
@@ -58,7 +55,7 @@
|
|
|
58
55
|
timerId.value = setInterval(() => {
|
|
59
56
|
indeterminateModeValue.value = indeterminateModeValues[index % indeterminateModeValuesLength];
|
|
60
57
|
index += 1;
|
|
61
|
-
if (
|
|
58
|
+
if (index % indeterminateModeValuesLength === 1) {
|
|
62
59
|
if (element.value?.classList.contains($style.inverse)) {
|
|
63
60
|
element.value?.classList.remove($style.inverse);
|
|
64
61
|
} else {
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed } from 'vue';
|
|
3
|
-
import
|
|
3
|
+
import toNumber from 'lodash/toNumber';
|
|
4
4
|
import type { Ui3nProgressLinearProps } from './types';
|
|
5
5
|
|
|
6
6
|
const thresholdHeight = 12;
|
|
7
7
|
const thresholdValue = 5;
|
|
8
8
|
|
|
9
|
-
const props = withDefaults(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
color: 'var(--color-bg-control-accent-default)',
|
|
16
|
-
},
|
|
17
|
-
);
|
|
9
|
+
const props = withDefaults(defineProps<Ui3nProgressLinearProps>(), {
|
|
10
|
+
value: 0,
|
|
11
|
+
height: 2,
|
|
12
|
+
bgColor: 'var(--color-bg-control-primary-default)',
|
|
13
|
+
color: 'var(--color-bg-control-accent-default)',
|
|
14
|
+
});
|
|
18
15
|
|
|
19
16
|
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
20
17
|
const innerHeight = computed(() => toNumber(props.height));
|
|
21
18
|
const cssHeight = computed(() => `${innerHeight.value}px`);
|
|
22
19
|
const innerValue = computed(() => toNumber(props.value));
|
|
23
|
-
const displayValue = computed(() => props.indeterminate
|
|
24
|
-
? `20%`
|
|
25
|
-
: `${Math.min(innerValue.value, 100)}%`,
|
|
26
|
-
);
|
|
20
|
+
const displayValue = computed(() => (props.indeterminate ? `20%` : `${Math.min(innerValue.value, 100)}%`));
|
|
27
21
|
</script>
|
|
28
22
|
|
|
29
23
|
<template>
|
|
@@ -105,11 +99,11 @@
|
|
|
105
99
|
|
|
106
100
|
@keyframes move {
|
|
107
101
|
from {
|
|
108
|
-
left: -22
|
|
102
|
+
left: -22%;
|
|
109
103
|
}
|
|
110
104
|
|
|
111
105
|
to {
|
|
112
|
-
left: 122
|
|
106
|
+
left: 122%;
|
|
113
107
|
}
|
|
114
108
|
}
|
|
115
109
|
</style>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { computed, type Ref, ref, watch, UnwrapRef } from 'vue';
|
|
2
|
-
import
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
|
+
import size from 'lodash/size';
|
|
3
5
|
import {
|
|
4
6
|
Ui3nTableBodyBaseItem,
|
|
5
7
|
Ui3nTableConfig,
|
|
@@ -25,8 +27,8 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
25
27
|
const selectedRowsArray = computed(() =>
|
|
26
28
|
isRowKeyUsed.value
|
|
27
29
|
? props.body.content.filter(row =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
(selectedRows.value as Array<T[keyof T]>).includes(row[currentConfig.value.fieldAsRowKey as keyof T]),
|
|
31
|
+
)
|
|
30
32
|
: Array.from(selectedRows.value as Set<T>),
|
|
31
33
|
);
|
|
32
34
|
const selectedRowsSize = computed(() =>
|
|
@@ -148,7 +150,7 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
148
150
|
}
|
|
149
151
|
} else {
|
|
150
152
|
isRowKeyUsed.value &&
|
|
151
|
-
|
|
153
|
+
(selectedRows.value as Array<T[keyof T]>).push(row[currentConfig.value.fieldAsRowKey as keyof T]);
|
|
152
154
|
!isRowKeyUsed.value && (selectedRows.value as Set<T>).add(row);
|
|
153
155
|
}
|
|
154
156
|
}
|
|
@@ -186,13 +188,15 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
186
188
|
|
|
187
189
|
function changeSortOrder(field: keyof T) {
|
|
188
190
|
if (currentConfig.value.sortOrder?.field === field) {
|
|
189
|
-
currentConfig.value.sortOrder.direction =
|
|
191
|
+
currentConfig.value.sortOrder.direction =
|
|
192
|
+
currentConfig.value.sortOrder?.direction === 'asc' ? 'desc' : 'asc';
|
|
190
193
|
} else {
|
|
191
194
|
currentConfig.value.sortOrder!.field = field as UnwrapRef<keyof T>;
|
|
192
195
|
currentConfig.value.sortOrder!.direction = 'desc';
|
|
193
196
|
}
|
|
194
197
|
|
|
195
|
-
currentConfig.value.sortOrder?.field &&
|
|
198
|
+
currentConfig.value.sortOrder?.field &&
|
|
199
|
+
emits('change:sort', currentConfig.value.sortOrder as Ui3nTableSort<T>);
|
|
196
200
|
}
|
|
197
201
|
|
|
198
202
|
watch(
|
|
@@ -201,7 +205,8 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
201
205
|
if (val && val !== oVal) {
|
|
202
206
|
tableEl.value && tableEl.value.style.setProperty('--ui3n-table-columns-width', val);
|
|
203
207
|
}
|
|
204
|
-
},
|
|
208
|
+
},
|
|
209
|
+
{
|
|
205
210
|
immediate: true,
|
|
206
211
|
},
|
|
207
212
|
);
|