@milaboratories/uikit 2.2.25 → 2.2.27
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/CHANGELOG.md +12 -0
- package/dist/pl-uikit.js +6 -7
- package/dist/pl-uikit.umd.cjs +2 -2
- package/dist/src/components/DataTable/index.d.ts +1 -1
- package/dist/src/components/DataTable/types.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/eslint.config.mjs +4 -0
- package/package.json +6 -5
- package/src/assets/dropdown-list-item.scss +1 -0
- package/src/components/DataTable/BaseCellComponent.vue +1 -1
- package/src/components/DataTable/index.ts +1 -1
- package/src/components/DataTable/types.ts +2 -2
- package/src/components/GridTable/types.ts +5 -5
- package/src/components/InputRange.vue +1 -1
- package/src/components/PlAccordion/ExpandTransition.vue +1 -1
- package/src/components/PlBtnSplit/__tests__/PlBtnSplit.spec.ts +1 -1
- package/src/components/PlCheckbox/__tests__/PlCheckbox.spec.ts +1 -1
- package/src/components/PlDropdown/PlDropdown.vue +1 -0
- package/src/components/PlDropdown/__tests__/PlDropdown.spec.ts +2 -2
- package/src/components/PlDropdownLegacy/PlDropdownLegacy.vue +1 -0
- package/src/components/PlDropdownLegacy/__tests__/PlDropdownLegacy.spec.ts +2 -2
- package/src/components/PlDropdownMulti/PlDropdownMulti.vue +10 -9
- package/src/components/PlDropdownMulti/__tests__/PlDropdownMulti.spec.ts +2 -2
- package/src/components/PlDropdownRef/PlDropdownRef.vue +1 -2
- package/src/components/PlDropdownRef/__tests__/PlDropdownRef.spec.ts +2 -2
- package/src/components/PlFileDialog/Shortcuts.vue +1 -1
- package/src/components/PlLogView/PlLogView.vue +1 -1
- package/src/components/PlLogView/useLogHandle.ts +0 -1
- package/src/components/PlNumberField/PlNumberField.vue +2 -1
- package/src/components/PlProgressBar/PlProgressBar.vue +1 -1
- package/src/components/PlSpacer/PlSpacer.vue +1 -1
- package/src/components/PlTextArea/__tests__/PlTextArea.spec.ts +1 -1
- package/src/components/PlTextField/__tests__/TextField.spec.ts +3 -3
- package/src/components/PlTooltip/PlTooltip.vue +1 -1
- package/src/components/Slider.vue +4 -4
- package/src/components/SliderRange.vue +3 -3
- package/src/components/SliderRangeTriple.vue +3 -3
- package/src/composition/useMouseCapture.ts +1 -1
- package/src/composition/useTheme.ts +4 -3
- package/src/drafts/FileBaseInput.vue +1 -1
- package/src/helpers/utils.ts +3 -3
- package/src/index.ts +2 -2
- package/src/types.ts +14 -14
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/uikit",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/pl-uikit.umd.js",
|
|
6
6
|
"module": "dist/pl-uikit.js",
|
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
"resize-observer-polyfill": "^1.5.1",
|
|
28
28
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
29
29
|
"tsc-alias": "^1.8.10",
|
|
30
|
-
"vitest": "^2.1.
|
|
30
|
+
"vitest": "^2.1.8",
|
|
31
31
|
"vite": "^5.4.11",
|
|
32
32
|
"vue-tsc": "^2.1.10",
|
|
33
33
|
"yarpm": "^1.2.0",
|
|
34
34
|
"svgo": "^3.3.2",
|
|
35
|
-
"@milaboratories/helpers": "^1.6.
|
|
36
|
-
"@
|
|
35
|
+
"@milaboratories/helpers": "^1.6.9",
|
|
36
|
+
"@milaboratories/eslint-config": "^1.0.0",
|
|
37
|
+
"@platforma-sdk/model": "^1.17.0"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"dev": "vite",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"parse-icons-folder": "node scripts/parse-icons.js",
|
|
49
50
|
"minify-icons": "svgo -f src/assets/icons/icon-assets -o src/assets/icons/icon-assets-min",
|
|
50
51
|
"generate-icons": "pnpm run parse-icons-folder && pnpm run minify-icons",
|
|
51
|
-
"lint": "eslint .
|
|
52
|
+
"lint": "eslint .",
|
|
52
53
|
"check": "yarpm type-check && yarpm test && yarpm lint",
|
|
53
54
|
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
|
|
54
55
|
}
|
|
@@ -18,7 +18,7 @@ const data = reactive({
|
|
|
18
18
|
const valueTypeRef = computed(() => props.valueType);
|
|
19
19
|
|
|
20
20
|
const onInput = (ev: Event) => {
|
|
21
|
-
|
|
21
|
+
const inputValue = (ev.target as HTMLInputElement)?.value;
|
|
22
22
|
|
|
23
23
|
const valueType = unref(valueTypeRef);
|
|
24
24
|
|
|
@@ -22,7 +22,7 @@ export { Component };
|
|
|
22
22
|
|
|
23
23
|
export { Types };
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/** * Adapters ***/
|
|
26
26
|
|
|
27
27
|
export function rawDataSettings<D extends Types.DataRow>(rows: D[], rawSettings: Types.RawTableSettings<D>): TableSettings {
|
|
28
28
|
const dataSource = new RawData<D>(rows, rawSettings.resolveRowHeight, rawSettings.resolvePrimaryKey);
|
|
@@ -151,7 +151,7 @@ export type ResizeTh = {
|
|
|
151
151
|
right: number;
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
/** * Adapters ***/
|
|
155
155
|
|
|
156
156
|
export type RawTableSettings<D extends DataRow = DataRow> = Readonly<{
|
|
157
157
|
columns: ColumnSpec<D>[];
|
|
@@ -167,7 +167,7 @@ export type RawTableSettings<D extends DataRow = DataRow> = Readonly<{
|
|
|
167
167
|
onUpdatedRow?: (row: Row<D>) => void;
|
|
168
168
|
}>;
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
/** * Static tests ***/
|
|
171
171
|
|
|
172
172
|
type _cell = TableCell<{ age: number; name: string; payload: unknown }>;
|
|
173
173
|
|
|
@@ -53,11 +53,11 @@ export type Data = {
|
|
|
53
53
|
resize: boolean;
|
|
54
54
|
resizeTh:
|
|
55
55
|
| {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
index: number;
|
|
57
|
+
width: number;
|
|
58
|
+
x: number;
|
|
59
|
+
right: number;
|
|
60
|
+
}
|
|
61
61
|
| undefined;
|
|
62
62
|
bodyHeight: number;
|
|
63
63
|
scrollTop: number;
|
|
@@ -56,7 +56,7 @@ function updateModel() {
|
|
|
56
56
|
function validateInput(isLeft: boolean, event: Event) {
|
|
57
57
|
const value: string = (event.target as HTMLInputElement).value;
|
|
58
58
|
const result = /^[0-9]{0,2}$/.test(value);
|
|
59
|
-
//if there is more than 3 digits we cut last one
|
|
59
|
+
// if there is more than 3 digits we cut last one
|
|
60
60
|
if (!result) {
|
|
61
61
|
if (isLeft) {
|
|
62
62
|
data.left = +value.slice(0, value.length - 1);
|
|
@@ -39,7 +39,7 @@ describe('PlBtnSplit.vue', () => {
|
|
|
39
39
|
expect(dropdown?.textContent).toContain('Option 1');
|
|
40
40
|
expect(dropdown?.textContent).not.toContain('Option 3');
|
|
41
41
|
|
|
42
|
-
//Hide dropdown on focusout
|
|
42
|
+
// Hide dropdown on focusout
|
|
43
43
|
wrapper.trigger('focusout');
|
|
44
44
|
await wrapper.vm.$nextTick();
|
|
45
45
|
|
|
@@ -8,9 +8,9 @@ describe('PlDropdown', () => {
|
|
|
8
8
|
it('modelValue', async () => {
|
|
9
9
|
const wrapper = mount(PlDropdown, {
|
|
10
10
|
props: {
|
|
11
|
-
modelValue: 1,
|
|
11
|
+
'modelValue': 1,
|
|
12
12
|
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e }),
|
|
13
|
-
options: [
|
|
13
|
+
'options': [
|
|
14
14
|
{ text: 'Option 1', value: 1 },
|
|
15
15
|
{ text: 'Option 2', value: 2 },
|
|
16
16
|
],
|
|
@@ -7,9 +7,9 @@ describe('PlDropdown', () => {
|
|
|
7
7
|
it('modelValue', async () => {
|
|
8
8
|
const wrapper = mount(PlDropdown, {
|
|
9
9
|
props: {
|
|
10
|
-
modelValue: 1,
|
|
10
|
+
'modelValue': 1,
|
|
11
11
|
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e }),
|
|
12
|
-
options: [
|
|
12
|
+
'options': [
|
|
13
13
|
{ text: 'Option 1', value: 1 },
|
|
14
14
|
{ text: 'Option 2', value: 2 },
|
|
15
15
|
],
|
|
@@ -109,18 +109,18 @@ const filteredOptionsRef = computed(() => {
|
|
|
109
109
|
return (
|
|
110
110
|
data.search
|
|
111
111
|
? options.filter((opt) => {
|
|
112
|
-
|
|
112
|
+
const search = data.search.toLowerCase();
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
if (opt.label.toLowerCase().includes(search)) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
if (typeof opt.value === 'string') {
|
|
119
|
+
return opt.value.toLowerCase().includes(search);
|
|
120
|
+
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
return opt.value === data.search;
|
|
123
|
+
})
|
|
124
124
|
: [...options]
|
|
125
125
|
).map((opt) => ({
|
|
126
126
|
...opt,
|
|
@@ -208,6 +208,7 @@ watch(
|
|
|
208
208
|
);
|
|
209
209
|
|
|
210
210
|
watchPostEffect(() => {
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
211
212
|
data.search;
|
|
212
213
|
|
|
213
214
|
if (data.open) {
|
|
@@ -8,9 +8,9 @@ describe('PlDropdownMulti', () => {
|
|
|
8
8
|
it('modelValue', async () => {
|
|
9
9
|
const wrapper = mount(PlDropdown, {
|
|
10
10
|
props: {
|
|
11
|
-
modelValue: [1],
|
|
11
|
+
'modelValue': [1],
|
|
12
12
|
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e }),
|
|
13
|
-
options: [
|
|
13
|
+
'options': [
|
|
14
14
|
{ text: 'Option 1', value: 1 },
|
|
15
15
|
{ text: 'Option 2', value: 2 },
|
|
16
16
|
],
|
|
@@ -98,6 +98,5 @@ const arrowIcon = computed(() => (props.disabled ? 'icon-link-disabled' : 'icon-
|
|
|
98
98
|
:loading-options-helper="loadingOptionsHelper"
|
|
99
99
|
:arrow-icon-large="arrowIcon"
|
|
100
100
|
@update:model-value="$emit('update:modelValue', $event)"
|
|
101
|
-
|
|
102
|
-
</PlDropdown>
|
|
101
|
+
/>
|
|
103
102
|
</template>
|
|
@@ -8,13 +8,13 @@ describe('PlDropdownRef', () => {
|
|
|
8
8
|
it('modelValue', async () => {
|
|
9
9
|
const wrapper = mount(PlDropdownRef, {
|
|
10
10
|
props: {
|
|
11
|
-
modelValue: {
|
|
11
|
+
'modelValue': {
|
|
12
12
|
__isRef: true as const,
|
|
13
13
|
blockId: '1',
|
|
14
14
|
name: 'Ref to block 1',
|
|
15
15
|
},
|
|
16
16
|
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e }),
|
|
17
|
-
options: [
|
|
17
|
+
'options': [
|
|
18
18
|
{
|
|
19
19
|
label: 'Ref 1',
|
|
20
20
|
ref: {
|
|
@@ -18,7 +18,7 @@ import { useLabelNotch } from '@/utils/useLabelNotch';
|
|
|
18
18
|
import DoubleContour from '@/utils/DoubleContour.vue';
|
|
19
19
|
import { PlTooltip } from '../PlTooltip';
|
|
20
20
|
|
|
21
|
-
const getOutputError = <T
|
|
21
|
+
const getOutputError = <T>(o?: ValueOrErrors<T>) => {
|
|
22
22
|
if (o && o.ok === false) {
|
|
23
23
|
return o.errors.join('\n');
|
|
24
24
|
}
|
|
@@ -53,7 +53,7 @@ const computedValue = computed({
|
|
|
53
53
|
val = val.replace(/,/g, '');
|
|
54
54
|
if (isNumeric(val)) {
|
|
55
55
|
emit('update:modelValue', +val);
|
|
56
|
-
//try press 123.12345678912345 and than 6
|
|
56
|
+
// try press 123.12345678912345 and than 6
|
|
57
57
|
if (val.toString() !== props.modelValue?.toString() && +val === props.modelValue && val[val.length - 1] !== '.') {
|
|
58
58
|
canRenderValue.value = false;
|
|
59
59
|
nextTick(() => {
|
|
@@ -152,6 +152,7 @@ function handleKeyPress(e: { code: string; preventDefault(): void }) {
|
|
|
152
152
|
e.preventDefault();
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
155
156
|
e.code === 'ArrowUp' ? increment() : e.code === 'ArrowDown' ? decrement() : undefined;
|
|
156
157
|
}
|
|
157
158
|
|
|
@@ -15,7 +15,7 @@ const readyMsg = computed(() => (props.progress === 100 ? props.completeMessage
|
|
|
15
15
|
|
|
16
16
|
<template>
|
|
17
17
|
<div v-if="loading" class="ui-progress-bar">
|
|
18
|
-
<div class="ui-progress-bar__indicator" :style="{ width: progress + '%' }"
|
|
18
|
+
<div class="ui-progress-bar__indicator" :style="{ width: progress + '%' }"/>
|
|
19
19
|
<div class="ui-progress-bar__messages d-flex align-center pl-6 pr-6">
|
|
20
20
|
<div class="ui-progress-bar__message flex-grow-1">{{ readyMsg }}</div>
|
|
21
21
|
<div class="ui-progress-bar__percent">{{ progress + '%' }}</div>
|
|
@@ -17,7 +17,7 @@ describe('TextField', () => {
|
|
|
17
17
|
it('modelValue:string', async () => {
|
|
18
18
|
const wrapper = mount(PlTextField<string>, {
|
|
19
19
|
props: {
|
|
20
|
-
modelValue: 'initialText',
|
|
20
|
+
'modelValue': 'initialText',
|
|
21
21
|
'onUpdate:modelValue': (e: string) => wrapper.setProps({ modelValue: e }),
|
|
22
22
|
},
|
|
23
23
|
});
|
|
@@ -29,8 +29,8 @@ describe('TextField', () => {
|
|
|
29
29
|
it('modelValue:string?', async () => {
|
|
30
30
|
const wrapper = mount(PlTextField, {
|
|
31
31
|
props: {
|
|
32
|
-
modelValue: 'initialText' as string | undefined,
|
|
33
|
-
clearable: () => undefined,
|
|
32
|
+
'modelValue': 'initialText' as string | undefined,
|
|
33
|
+
'clearable': () => undefined,
|
|
34
34
|
'onUpdate:modelValue': (e: unknown) => wrapper.setProps({ modelValue: e }),
|
|
35
35
|
},
|
|
36
36
|
});
|
|
@@ -81,7 +81,7 @@ const progressStyle = computed(() => ({
|
|
|
81
81
|
}));
|
|
82
82
|
|
|
83
83
|
const thumbStyle = computed(() => {
|
|
84
|
-
|
|
84
|
+
const value = Math.ceil((1 - position.value) * 100);
|
|
85
85
|
return {
|
|
86
86
|
right: `calc(${value}%) `,
|
|
87
87
|
};
|
|
@@ -131,8 +131,8 @@ function handleKeyPress(e: { code: string; preventDefault(): void }) {
|
|
|
131
131
|
e.preventDefault();
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
const nextStep
|
|
135
|
-
e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;
|
|
134
|
+
const nextStep
|
|
135
|
+
= e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;
|
|
136
136
|
|
|
137
137
|
setModelValue(props.modelValue + nextStep);
|
|
138
138
|
}
|
|
@@ -161,7 +161,7 @@ function handleKeyPress(e: { code: string; preventDefault(): void }) {
|
|
|
161
161
|
</div>
|
|
162
162
|
<div class="ui-slider__container ui-slider__container-thumb">
|
|
163
163
|
<template v-if="props.breakpoints">
|
|
164
|
-
<div v-for="(item, index) in breakpointsRef" :key="index" :style="{ right: `${item}%` }" class="ui-slider__thumb-step"
|
|
164
|
+
<div v-for="(item, index) in breakpointsRef" :key="index" :style="{ right: `${item}%` }" class="ui-slider__thumb-step"/>
|
|
165
165
|
</template>
|
|
166
166
|
<div ref="thumbRef" tabindex="0" class="ui-slider__thumb ui-slider__thumb-active" :style="thumbStyle" @keydown="handleKeyPress">
|
|
167
167
|
<div class="ui-slider__thumb-focused-contour" />
|
|
@@ -165,8 +165,8 @@ function handleKeyPress(e: { code: string; preventDefault(): void }, index: numb
|
|
|
165
165
|
e.preventDefault();
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
const nextStep
|
|
169
|
-
e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;
|
|
168
|
+
const nextStep
|
|
169
|
+
= e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;
|
|
170
170
|
|
|
171
171
|
const arr: [number, number] = [...props.modelValue];
|
|
172
172
|
arr[index] = clamp(arr[index] + nextStep, props.min, props.max);
|
|
@@ -198,7 +198,7 @@ function handleKeyPress(e: { code: string; preventDefault(): void }, index: numb
|
|
|
198
198
|
</div>
|
|
199
199
|
<div class="ui-slider__container ui-slider__container-thumb">
|
|
200
200
|
<template v-if="props.breakpoints">
|
|
201
|
-
<div v-for="(item, index) in breakpointsRef" :key="index" :style="{ right: `${item}%` }" class="ui-slider__thumb-step"
|
|
201
|
+
<div v-for="(item, index) in breakpointsRef" :key="index" :style="{ right: `${item}%` }" class="ui-slider__thumb-step"/>
|
|
202
202
|
</template>
|
|
203
203
|
<div ref="thumbRef1" :style="thumbStyle1" class="ui-slider__thumb" tabindex="0" @keydown="handleKeyPress($event, 0)">
|
|
204
204
|
<div class="ui-slider__thumb-focused-contour" />
|
|
@@ -217,8 +217,8 @@ function handleKeyPress(e: { code: string; preventDefault(): void }, index: numb
|
|
|
217
217
|
e.preventDefault();
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
const nextStep
|
|
221
|
-
e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;
|
|
220
|
+
const nextStep
|
|
221
|
+
= e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;
|
|
222
222
|
|
|
223
223
|
const arr: ModelType = [...props.modelValue];
|
|
224
224
|
arr[index] = clamp(arr[index] + nextStep, props.min, props.max);
|
|
@@ -253,7 +253,7 @@ onMounted(() => {
|
|
|
253
253
|
</div>
|
|
254
254
|
<div class="ui-slider__container ui-slider__container-thumb">
|
|
255
255
|
<template v-if="props.breakpoints">
|
|
256
|
-
<div v-for="(item, index) in breakpointsRef" :key="index" :style="{ right: `${item}%` }" class="ui-slider__thumb-step"
|
|
256
|
+
<div v-for="(item, index) in breakpointsRef" :key="index" :style="{ right: `${item}%` }" class="ui-slider__thumb-step"/>
|
|
257
257
|
</template>
|
|
258
258
|
<div
|
|
259
259
|
ref="thumbRef1"
|
|
@@ -32,7 +32,7 @@ export function useMouseCapture<T extends HTMLElement>(elRef: MaybeRef<T | undef
|
|
|
32
32
|
|
|
33
33
|
useEventListener(document, 'mousedown', (ev) => {
|
|
34
34
|
if (ev.target === unref(elRef)) {
|
|
35
|
-
//disable selection when moving
|
|
35
|
+
// disable selection when moving
|
|
36
36
|
if (ev.stopPropagation) ev.stopPropagation();
|
|
37
37
|
if (ev.preventDefault) ev.preventDefault();
|
|
38
38
|
state.el = unref(elRef);
|
|
@@ -8,10 +8,11 @@ type Callback = (mode: Theme) => void;
|
|
|
8
8
|
|
|
9
9
|
const cm = new Set<Callback>();
|
|
10
10
|
|
|
11
|
-
window.matchMedia
|
|
11
|
+
if (window.matchMedia) {
|
|
12
12
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
|
|
13
13
|
toList(mapIterable(cm.values(), (cb) => cb(e.matches ? 'dark' : 'light')));
|
|
14
14
|
});
|
|
15
|
+
}
|
|
15
16
|
|
|
16
17
|
const init = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
17
18
|
|
|
@@ -25,7 +26,7 @@ export function useTheme(_cb?: Callback) {
|
|
|
25
26
|
|
|
26
27
|
const cb = (theme: Theme) => {
|
|
27
28
|
browserTheme.value = theme;
|
|
28
|
-
_cb
|
|
29
|
+
_cb?.(theme);
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
function toggleTheme() {
|
|
@@ -33,7 +34,7 @@ export function useTheme(_cb?: Callback) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
watch(theme, (v) => {
|
|
36
|
-
_cb
|
|
37
|
+
_cb?.(unref(v));
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
onMounted(() => {
|
|
@@ -75,7 +75,7 @@ function deleteFile(file: File) {
|
|
|
75
75
|
if (file && props.modelValue && props.modelValue.length > 0) {
|
|
76
76
|
const i = props.modelValue.findIndex((f) => f === file);
|
|
77
77
|
if (i !== -1) {
|
|
78
|
-
|
|
78
|
+
const arr = [...props.modelValue];
|
|
79
79
|
arr.splice(i, 1);
|
|
80
80
|
emit('update:modelValue', arr);
|
|
81
81
|
}
|
package/src/helpers/utils.ts
CHANGED
|
@@ -108,7 +108,6 @@ export function animateInfinite(options: { getFraction: (dt: number) => number;
|
|
|
108
108
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
109
109
|
type AnyFunction = (...args: any[]) => any;
|
|
110
110
|
|
|
111
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
112
111
|
export function debounce<F extends AnyFunction>(func: F, delay: number) {
|
|
113
112
|
let timerId = -1;
|
|
114
113
|
return (...args: Parameters<F>) => {
|
|
@@ -128,10 +127,11 @@ export function throttle<F extends AnyFunction>(callback: F, ms: number, trailin
|
|
|
128
127
|
callback.apply(this, args);
|
|
129
128
|
t = new Date().getTime() + ms;
|
|
130
129
|
call = null;
|
|
131
|
-
trailing
|
|
130
|
+
if (trailing) {
|
|
132
131
|
setTimeout(() => {
|
|
133
|
-
call
|
|
132
|
+
call?.();
|
|
134
133
|
}, ms);
|
|
134
|
+
}
|
|
135
135
|
};
|
|
136
136
|
if (new Date().getTime() > t) call();
|
|
137
137
|
};
|
package/src/index.ts
CHANGED
|
@@ -98,7 +98,7 @@ export * from './utils/DropdownOverlay';
|
|
|
98
98
|
*/
|
|
99
99
|
export { useLabelNotch } from './utils/useLabelNotch.ts';
|
|
100
100
|
|
|
101
|
-
//for new version
|
|
101
|
+
// for new version
|
|
102
102
|
import LongText from './components/LongText.vue';
|
|
103
103
|
import SliderRangeTriple from './components/SliderRangeTriple.vue';
|
|
104
104
|
import SliderRange from './components/SliderRange.vue';
|
|
@@ -125,7 +125,7 @@ export { ThemeSwitcher, DropdownListItem, DataTable, ContextProvider, Slider };
|
|
|
125
125
|
// Helpers
|
|
126
126
|
export { showContextMenu };
|
|
127
127
|
|
|
128
|
-
//move to new version pl-uikit
|
|
128
|
+
// move to new version pl-uikit
|
|
129
129
|
export { LongText, SliderRangeTriple, SliderRange, Scrollable };
|
|
130
130
|
|
|
131
131
|
// @todo
|
package/src/types.ts
CHANGED
|
@@ -24,13 +24,13 @@ export type ElementPosition = Omit<DOMRect, 'toJSON'> & {
|
|
|
24
24
|
|
|
25
25
|
export type SimpleOption<T = unknown> =
|
|
26
26
|
| {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
text: string;
|
|
28
|
+
value: T;
|
|
29
|
+
}
|
|
30
30
|
| {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
label: string;
|
|
32
|
+
value: T;
|
|
33
|
+
};
|
|
34
34
|
|
|
35
35
|
export type SimpleOptionNormalized<T = unknown> = {
|
|
36
36
|
label: string;
|
|
@@ -40,15 +40,15 @@ export type SimpleOptionNormalized<T = unknown> = {
|
|
|
40
40
|
|
|
41
41
|
export type ListOption<T = unknown> =
|
|
42
42
|
| {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
text: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
value: T;
|
|
46
|
+
}
|
|
47
47
|
| {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
label: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
value: T;
|
|
51
|
+
};
|
|
52
52
|
|
|
53
53
|
export type ListOptionNormalized<T = unknown> = {
|
|
54
54
|
label: string;
|
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"env": {
|
|
4
|
-
"es2021": true,
|
|
5
|
-
"node": false,
|
|
6
|
-
"browser": true
|
|
7
|
-
},
|
|
8
|
-
"extends": [
|
|
9
|
-
"eslint:recommended",
|
|
10
|
-
/** @see https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#recommended-configs */
|
|
11
|
-
"plugin:@typescript-eslint/recommended",
|
|
12
|
-
"plugin:vue/vue3-recommended",
|
|
13
|
-
"plugin:prettier/recommended"
|
|
14
|
-
],
|
|
15
|
-
"parser": "vue-eslint-parser",
|
|
16
|
-
"parserOptions": {
|
|
17
|
-
"ecmaVersion": 12,
|
|
18
|
-
"sourceType": "module",
|
|
19
|
-
"parser": "@typescript-eslint/parser"
|
|
20
|
-
},
|
|
21
|
-
"plugins": [
|
|
22
|
-
"@typescript-eslint"
|
|
23
|
-
],
|
|
24
|
-
"ignorePatterns": [
|
|
25
|
-
"node_modules/**",
|
|
26
|
-
"**/dist/**"
|
|
27
|
-
],
|
|
28
|
-
"rules": {
|
|
29
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
30
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
|
31
|
-
"vue/multi-word-component-names": "off",
|
|
32
|
-
"vue/no-undef-components": "error",
|
|
33
|
-
"vue/component-name-in-template-casing": "warn",
|
|
34
|
-
"@typescript-eslint/no-explicit-any": "error",
|
|
35
|
-
/**
|
|
36
|
-
* Having a semicolon helps the optimizer interpret your code correctly.
|
|
37
|
-
* This avoids rare errors in optimized code.
|
|
38
|
-
* @see https://twitter.com/alex_kozack/status/1364210394328408066
|
|
39
|
-
*/
|
|
40
|
-
"semi": [
|
|
41
|
-
"warn",
|
|
42
|
-
"always"
|
|
43
|
-
],
|
|
44
|
-
/**
|
|
45
|
-
* Just for beauty
|
|
46
|
-
*/
|
|
47
|
-
"quotes": [
|
|
48
|
-
"warn",
|
|
49
|
-
"single"
|
|
50
|
-
],
|
|
51
|
-
"@typescript-eslint/no-unused-vars": [
|
|
52
|
-
"warn",
|
|
53
|
-
{
|
|
54
|
-
"argsIgnorePattern": "^_",
|
|
55
|
-
"varsIgnorePattern": "^_",
|
|
56
|
-
"caughtErrorsIgnorePattern": "^_"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
}
|