eco-vue-js 0.10.5 → 0.10.7
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/components/Button/WButtonDropdown.vue.d.ts +1 -1
- package/dist/components/Button/WButtonDropdown.vue.d.ts.map +1 -1
- package/dist/components/Button/WButtonDropdown.vue.js +1 -12
- package/dist/components/Button/WButtonSelection.vue.d.ts +6 -5
- package/dist/components/Button/WButtonSelection.vue.d.ts.map +1 -1
- package/dist/components/Button/WButtonSelection.vue.js +10 -24
- package/dist/components/Checkbox/WCheckbox.vue.d.ts +0 -2
- package/dist/components/Checkbox/WCheckbox.vue.d.ts.map +1 -1
- package/dist/components/Checkbox/WCheckbox.vue.js +2 -8
- package/dist/components/FieldWrapper/WFieldWrapper.vue.js +1 -14
- package/dist/components/Form/WForm.vue.d.ts +2 -2
- package/dist/components/Form/WFormValidator.vue.d.ts +2 -2
- package/dist/components/Form/WFormValidator.vue.js +1 -14
- package/dist/components/Form/models/utils.js +0 -14
- package/dist/components/FormAsync/use/useFormAsync.d.ts.map +1 -1
- package/dist/components/FormAsync/use/useFormAsync.js +2 -14
- package/dist/components/HeaderBar/WHeaderBar.vue.js +2 -2
- package/dist/components/InfiniteList/WInfiniteList.vue.d.ts +3 -18
- package/dist/components/InfiniteList/WInfiniteList.vue.d.ts.map +1 -1
- package/dist/components/InfiniteList/WInfiniteList.vue.js +25 -83
- package/dist/components/InfiniteList/WInfiniteListWrapper.vue.js +1 -1
- package/dist/components/InfiniteList/components/InfiniteListPage.vue.d.ts +0 -5
- package/dist/components/InfiniteList/components/InfiniteListPage.vue.d.ts.map +1 -1
- package/dist/components/InfiniteList/components/InfiniteListPage.vue.js +8 -27
- package/dist/components/InfiniteList/components/InfiniteListPages.vue.d.ts +1 -8
- package/dist/components/InfiniteList/components/InfiniteListPages.vue.d.ts.map +1 -1
- package/dist/components/InfiniteList/components/InfiniteListPages.vue.js +10 -21
- package/dist/components/InfiniteList/use/useInfiniteListHeader.js +0 -13
- package/dist/components/Input/WInputSuggest.vue.js +3 -3
- package/dist/components/List/WList.vue.d.ts +3 -2
- package/dist/components/List/WList.vue.d.ts.map +1 -1
- package/dist/components/List/WList.vue.js +99 -112
- package/dist/components/List/WListCard.vue.d.ts +13 -11
- package/dist/components/List/WListCard.vue.d.ts.map +1 -1
- package/dist/components/List/WListCard.vue.js +79 -87
- package/dist/components/List/WListHeaderItem.vue.d.ts.map +1 -1
- package/dist/components/List/WListHeaderItem.vue.js +1 -1
- package/dist/components/List/components/HeaderSettings.vue.d.ts +3 -2
- package/dist/components/List/components/HeaderSettings.vue.d.ts.map +1 -1
- package/dist/components/List/components/HeaderSettings.vue.js +20 -24
- package/dist/components/List/components/HeaderSort.vue.d.ts +1 -1
- package/dist/components/List/components/HeaderSort.vue.d.ts.map +1 -1
- package/dist/components/List/components/HeaderSort.vue.js +0 -13
- package/dist/components/List/components/ListCardAction.vue.d.ts +23 -0
- package/dist/components/List/components/ListCardAction.vue.d.ts.map +1 -0
- package/dist/components/List/components/ListCardAction.vue.js +23 -0
- package/dist/components/List/components/ListCardAction.vue2.js +5 -0
- package/dist/components/List/types.d.ts +5 -0
- package/dist/components/List/types.d.ts.map +1 -1
- package/dist/components/List/use/useListConfig.d.ts +3 -10
- package/dist/components/List/use/useListConfig.d.ts.map +1 -1
- package/dist/components/List/use/useListConfig.js +20 -16
- package/dist/components/Modal/WModalStepper.vue.d.ts +26 -26
- package/dist/components/Nav/WNavItemExpand.vue.js +0 -13
- package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelect.vue.js +2 -2
- package/dist/components/Select/WSelectAsync.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsync.vue.js +2 -2
- package/dist/components/Select/WSelectAsyncList.vue.d.ts +1 -1
- package/dist/components/Select/WSelectAsyncList.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsyncList.vue.js +0 -1
- package/dist/components/Select/components/SelectAsyncList.vue.d.ts.map +1 -1
- package/dist/components/Select/components/SelectAsyncList.vue.js +15 -11
- package/dist/components/Tabs/WTabs.vue.d.ts +24 -24
- package/dist/components/Tabs/WTabs.vue.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.js +4 -17
- package/dist/components/Tabs/WTabsColumns.vue.js +2 -2
- package/dist/components/Tabs/components/TabItem.vue.d.ts +12 -12
- package/dist/main.js +2 -2
- package/dist/types/global.d.ts +0 -11
- package/dist/utils/mobile.d.ts +3 -0
- package/dist/utils/mobile.d.ts.map +1 -1
- package/dist/utils/mobile.js +15 -2
- package/dist/utils/useSelected.d.ts +22 -10
- package/dist/utils/useSelected.d.ts.map +1 -1
- package/dist/utils/useSelected.js +177 -45
- package/dist/utils/utils.d.ts +5 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +9 -1
- package/eslint/plugin.js +4 -0
- package/package.json +1 -1
- package/tailwind-base/plugins/default.ts +1 -0
- package/dist/components/InfiniteList/components/InfiniteListPageSelectItem.vue.d.ts +0 -31
- package/dist/components/InfiniteList/components/InfiniteListPageSelectItem.vue.d.ts.map +0 -1
- package/dist/components/InfiniteList/components/InfiniteListPageSelectItem.vue.js +0 -30
- package/dist/components/InfiniteList/components/InfiniteListPageSelectItem.vue2.js +0 -5
- package/dist/components/InfiniteList/components/InfiniteListPageSelection.vue.d.ts +0 -27
- package/dist/components/InfiniteList/components/InfiniteListPageSelection.vue.d.ts.map +0 -1
- package/dist/components/InfiniteList/components/InfiniteListPageSelection.vue.js +0 -66
- package/dist/components/InfiniteList/components/InfiniteListPageSelection.vue2.js +0 -5
- package/dist/components/InfiniteList/models/injection.d.ts +0 -16
- package/dist/components/InfiniteList/models/injection.d.ts.map +0 -1
- package/dist/components/InfiniteList/models/injection.js +0 -4
- package/dist/components/InfiniteList/use/useSelected.d.ts +0 -14
- package/dist/components/InfiniteList/use/useSelected.d.ts.map +0 -1
- package/dist/components/InfiniteList/use/useSelected.js +0 -151
@@ -1,151 +0,0 @@
|
|
1
|
-
import { ref, computed, unref, onBeforeUnmount } from 'vue';
|
2
|
-
|
3
|
-
const isRightOrder = (value) => {
|
4
|
-
return value[0].page < value[1].page || value[0].page === value[1].page && value[0].index <= value[1].index;
|
5
|
-
};
|
6
|
-
const isSelectedBetween = (range, page, index) => {
|
7
|
-
if (range[0].page < page && range[1].page > page) return true;
|
8
|
-
if (range[0].page === range[1].page && range[0].page === page) return range[0].index < index && range[1].index > index;
|
9
|
-
return range[0].page === page && range[0].index < index || range[1].page === page && range[1].index > index;
|
10
|
-
};
|
11
|
-
const isWrongId = (selectionPage, id, page, index) => {
|
12
|
-
return selectionPage.id !== id && selectionPage.page === page && selectionPage.index === index;
|
13
|
-
};
|
14
|
-
const isWrongIdRange = (range, id, page, index) => {
|
15
|
-
return isWrongId(range[0], id, page, index) || isWrongId(range[1], id, page, index);
|
16
|
-
};
|
17
|
-
const getCount = (range, pageLength) => {
|
18
|
-
if (range[1].page === range[0].page) return range[1].index - range[0].index + 1;
|
19
|
-
return (range[1].page - range[0].page) * pageLength + range[1].index - range[0].index + 1;
|
20
|
-
};
|
21
|
-
const useSelected = (count, pageLength, selected, reverse, selectedRange, select, selectReverse, selectRange) => {
|
22
|
-
const isSelecting = ref(false);
|
23
|
-
const rangeCursor = ref(null);
|
24
|
-
const rangeHover = ref(null);
|
25
|
-
const disabled = ref(false);
|
26
|
-
const allowSelectHover = computed(() => rangeCursor.value !== null && isSelecting.value);
|
27
|
-
const selectionRangeCount = computed(() => {
|
28
|
-
if (!selectedRange.value) return void 0;
|
29
|
-
return getCount(selectedRange.value, unref(pageLength));
|
30
|
-
});
|
31
|
-
const cursorReset = () => {
|
32
|
-
rangeCursor.value = null;
|
33
|
-
rangeHover.value = null;
|
34
|
-
isSelecting.value = false;
|
35
|
-
};
|
36
|
-
const setSelectedRange = (value) => {
|
37
|
-
if (!rangeCursor.value) {
|
38
|
-
rangeCursor.value = value;
|
39
|
-
rangeHover.value = value;
|
40
|
-
isSelecting.value = true;
|
41
|
-
select([]);
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
if (value.id === rangeCursor.value.id) {
|
45
|
-
select([value.id]);
|
46
|
-
cursorReset();
|
47
|
-
return;
|
48
|
-
}
|
49
|
-
const result = [value, rangeCursor.value];
|
50
|
-
if (!isRightOrder(result)) result.reverse();
|
51
|
-
if (getCount(result, unref(pageLength)) === unref(count)) {
|
52
|
-
cursorReset();
|
53
|
-
selectReverse([]);
|
54
|
-
return;
|
55
|
-
}
|
56
|
-
selectRange(result);
|
57
|
-
cursorReset();
|
58
|
-
};
|
59
|
-
const resetSelectionRange = () => {
|
60
|
-
rangeCursor.value = null;
|
61
|
-
rangeHover.value = null;
|
62
|
-
select([]);
|
63
|
-
};
|
64
|
-
const setRangeHover = (value) => {
|
65
|
-
rangeHover.value = value;
|
66
|
-
};
|
67
|
-
const getIsSelected = (id) => {
|
68
|
-
if (selectedRange.value) {
|
69
|
-
return selectedRange.value[0].id === id || selectedRange.value[1].id === id;
|
70
|
-
}
|
71
|
-
if (rangeCursor.value && rangeHover.value) {
|
72
|
-
return rangeCursor.value.id === id || rangeHover.value.id === id;
|
73
|
-
}
|
74
|
-
return reverse.value ? !selected.value.includes(id) : selected.value.includes(id);
|
75
|
-
};
|
76
|
-
const getIsSelectedBetween = (id, page, index) => {
|
77
|
-
let is = false;
|
78
|
-
if (selectedRange.value) {
|
79
|
-
is = isSelectedBetween(selectedRange.value, page, index);
|
80
|
-
if (!is && isWrongIdRange(selectedRange.value, id, page, index)) resetSelectionRange();
|
81
|
-
}
|
82
|
-
if (rangeCursor.value && rangeHover.value) {
|
83
|
-
const range = [rangeCursor.value, rangeHover.value];
|
84
|
-
if (!isRightOrder(range)) range.reverse();
|
85
|
-
is = isSelectedBetween(range, page, index);
|
86
|
-
if (!is && isWrongIdRange(range, id, page, index)) resetSelectionRange();
|
87
|
-
}
|
88
|
-
return is;
|
89
|
-
};
|
90
|
-
const setSelectedCursor = (value) => {
|
91
|
-
rangeCursor.value = value;
|
92
|
-
};
|
93
|
-
const toggleSelected = (id, value) => {
|
94
|
-
if (disabled.value) return;
|
95
|
-
if (reverse.value && count?.value === selected.value.length + 1) {
|
96
|
-
select([]);
|
97
|
-
cursorReset();
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
const newSelected = selected.value.slice();
|
101
|
-
const index = newSelected.indexOf(id);
|
102
|
-
if (index !== -1 && !value) {
|
103
|
-
newSelected.splice(index, 1);
|
104
|
-
} else if (value) {
|
105
|
-
newSelected.push(id);
|
106
|
-
}
|
107
|
-
if (reverse.value) {
|
108
|
-
if (count?.value !== void 0 && count.value <= newSelected.length) {
|
109
|
-
if (newSelected.length === 0) selectReverse([]);
|
110
|
-
else select([]);
|
111
|
-
cursorReset();
|
112
|
-
return;
|
113
|
-
}
|
114
|
-
selectReverse(newSelected);
|
115
|
-
} else {
|
116
|
-
select(newSelected);
|
117
|
-
}
|
118
|
-
};
|
119
|
-
const selectedCount = computed(() => {
|
120
|
-
if (selectedRange.value) return getCount(selectedRange.value, unref(pageLength));
|
121
|
-
const _count = unref(count);
|
122
|
-
return reverse.value && _count !== void 0 ? Math.max(_count - selected.value.length, 0) : selected.value.length;
|
123
|
-
});
|
124
|
-
const selectAllValue = computed(() => {
|
125
|
-
if (selectedRange.value) return null;
|
126
|
-
const _count = unref(count);
|
127
|
-
if (_count === 0) return false;
|
128
|
-
if (reverse.value) {
|
129
|
-
return selected.value.length === 0 ? true : null;
|
130
|
-
} else {
|
131
|
-
return _count !== void 0 && selected.value.length >= _count ? true : selected.value.length ? null : false;
|
132
|
-
}
|
133
|
-
});
|
134
|
-
onBeforeUnmount(() => {
|
135
|
-
disabled.value = true;
|
136
|
-
});
|
137
|
-
return {
|
138
|
-
setSelectedRange,
|
139
|
-
getIsSelected,
|
140
|
-
getIsSelectedBetween,
|
141
|
-
setRangeHover,
|
142
|
-
allowSelectHover,
|
143
|
-
selectionRangeCount,
|
144
|
-
setSelectedCursor,
|
145
|
-
toggleSelected,
|
146
|
-
selectedCount,
|
147
|
-
selectAllValue
|
148
|
-
};
|
149
|
-
};
|
150
|
-
|
151
|
-
export { useSelected };
|