@fastkit/vui 0.6.37 → 0.6.41
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/tool/index.js +3 -0
- package/dist/tool/vite-plugin.d.ts.map +1 -1
- package/dist/vui.cjs.js +181 -5
- package/dist/vui.cjs.prod.js +181 -5
- package/dist/vui.css +24 -14
- package/dist/vui.d.ts +3596 -16
- package/dist/vui.esm-bundler.js +181 -7
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/package.json +8 -7
- package/src/.DS_Store +0 -0
- package/src/assets/.DS_Store +0 -0
- package/src/assets/builtins/color-scheme.ts +9 -0
- package/src/assets/builtins/media-match.ts +3 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/VAccordion/VAccordion.scss +2 -0
- package/src/components/VAccordion/VAccordion.tsx +5 -0
- package/src/components/VAccordion/index.ts +1 -0
- package/src/components/VApp/VApp.tsx +17 -0
- package/src/components/VApp/index.ts +1 -0
- package/src/components/VBreadcrumbs/VBreadcrumbs.scss +61 -0
- package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +137 -0
- package/src/components/VBreadcrumbs/index.ts +1 -0
- package/src/components/VButton/.DS_Store +0 -0
- package/src/components/VButton/VButton.scss +137 -0
- package/src/components/VButton/VButton.tsx +148 -0
- package/src/components/VButton/VButtonGroup.scss +23 -0
- package/src/components/VButton/VButtonGroup.tsx +81 -0
- package/src/components/VButton/index.ts +2 -0
- package/src/components/VCard/VCard.scss +3 -0
- package/src/components/VCard/VCard.tsx +20 -0
- package/src/components/VCard/VCardActions.scss +10 -0
- package/src/components/VCard/VCardActions.tsx +16 -0
- package/src/components/VCard/VCardContent.scss +3 -0
- package/src/components/VCard/VCardContent.tsx +16 -0
- package/src/components/VCard/index.ts +3 -0
- package/src/components/VCheckable/VCheckable.scss +103 -0
- package/src/components/VCheckable/VCheckable.tsx +60 -0
- package/src/components/VCheckable/index.ts +1 -0
- package/src/components/VCheckbox/VCheckbox.scss +56 -0
- package/src/components/VCheckbox/VCheckbox.tsx +63 -0
- package/src/components/VCheckbox/index.ts +1 -0
- package/src/components/VCheckboxGroup/.DS_Store +0 -0
- package/src/components/VCheckboxGroup/VCheckboxGroup.tsx +11 -0
- package/src/components/VCheckboxGroup/index.ts +1 -0
- package/src/components/VContentSwitcher/VContentSwitcher.scss +73 -0
- package/src/components/VContentSwitcher/VContentSwitcher.tsx +156 -0
- package/src/components/VContentSwitcher/index.ts +1 -0
- package/src/components/VControlField/VControlField.scss +183 -0
- package/src/components/VControlField/VControlField.tsx +152 -0
- package/src/components/VControlField/index.ts +1 -0
- package/src/components/VDataTable/VDataTable.scss +230 -0
- package/src/components/VDataTable/VDataTable.tsx +761 -0
- package/src/components/VDataTable/index.ts +1 -0
- package/src/components/VDrawerLayout/VDrawerLayout.scss +26 -0
- package/src/components/VDrawerLayout/VDrawerLayout.tsx +35 -0
- package/src/components/VDrawerLayout/index.ts +1 -0
- package/src/components/VForm/VForm.tsx +77 -0
- package/src/components/VForm/index.ts +1 -0
- package/src/components/VFormControl/VFormControl.scss +59 -0
- package/src/components/VFormControl/VFormControl.tsx +85 -0
- package/src/components/VFormControl/index.ts +1 -0
- package/src/components/VGrid/VGridContainer.scss +4 -0
- package/src/components/VGrid/VGridContainer.tsx +191 -0
- package/src/components/VGrid/VGridItem.scss +3 -0
- package/src/components/VGrid/VGridItem.tsx +114 -0
- package/src/components/VGrid/index.ts +2 -0
- package/src/components/VGrid/schemes.ts +28 -0
- package/src/components/VHero/.DS_Store +0 -0
- package/src/components/VHero/VHero.scss +26 -0
- package/src/components/VHero/VHero.tsx +52 -0
- package/src/components/VHero/index.ts +1 -0
- package/src/components/VIcon/VIcon.scss +22 -0
- package/src/components/VIcon/VIcon.tsx +110 -0
- package/src/components/VIcon/index.ts +1 -0
- package/src/components/VListTile/VListTile.scss +71 -0
- package/src/components/VListTile/VListTile.tsx +121 -0
- package/src/components/VListTile/index.ts +1 -0
- package/src/components/VNavigation/VNavigation.scss +12 -0
- package/src/components/VNavigation/VNavigation.tsx +79 -0
- package/src/components/VNavigation/VNavigationItem.scss +14 -0
- package/src/components/VNavigation/VNavigationItem.tsx +252 -0
- package/src/components/VNavigation/index.ts +2 -0
- package/src/components/VOption/VOption.scss +61 -0
- package/src/components/VOption/VOption.tsx +52 -0
- package/src/components/VOption/index.ts +1 -0
- package/src/components/VOptionGroup/VOptionGroup.scss +3 -0
- package/src/components/VOptionGroup/VOptionGroup.tsx +55 -0
- package/src/components/VOptionGroup/index.ts +1 -0
- package/src/components/VPagination/VPagination.scss +100 -0
- package/src/components/VPagination/VPagination.tsx +346 -0
- package/src/components/VPagination/index.ts +1 -0
- package/src/components/VPaper/VPaper.scss +37 -0
- package/src/components/VPaper/VPaper.tsx +78 -0
- package/src/components/VPaper/index.ts +1 -0
- package/src/components/VRadio/.DS_Store +0 -0
- package/src/components/VRadio/VRadio.scss +66 -0
- package/src/components/VRadio/VRadio.tsx +56 -0
- package/src/components/VRadio/index.ts +1 -0
- package/src/components/VRadioGroup/.DS_Store +0 -0
- package/src/components/VRadioGroup/VRadioGroup.tsx +10 -0
- package/src/components/VRadioGroup/index.ts +1 -0
- package/src/components/VSelect/VSelect.scss +78 -0
- package/src/components/VSelect/VSelect.tsx +204 -0
- package/src/components/VSelect/index.ts +1 -0
- package/src/components/VSwitch/VSwitch.scss +125 -0
- package/src/components/VSwitch/VSwitch.tsx +66 -0
- package/src/components/VSwitch/index.ts +1 -0
- package/src/components/VSwitchGroup/.DS_Store +0 -0
- package/src/components/VSwitchGroup/VSwitchGroup.tsx +11 -0
- package/src/components/VSwitchGroup/index.ts +1 -0
- package/src/components/VTabs/.DS_Store +0 -0
- package/src/components/VTabs/VTab.scss +73 -0
- package/src/components/VTabs/VTab.tsx +88 -0
- package/src/components/VTabs/VTabs.scss +49 -0
- package/src/components/VTabs/VTabs.tsx +315 -0
- package/src/components/VTabs/index.ts +1 -0
- package/src/components/VTextCounter/VTextCounter.scss +3 -0
- package/src/components/VTextCounter/VTextCounter.tsx +21 -0
- package/src/components/VTextCounter/index.ts +1 -0
- package/src/components/VTextField/VTextField.scss +45 -0
- package/src/components/VTextField/VTextField.tsx +96 -0
- package/src/components/VTextField/index.ts +1 -0
- package/src/components/VTextarea/VTextarea.scss +41 -0
- package/src/components/VTextarea/VTextarea.tsx +93 -0
- package/src/components/VTextarea/index.ts +1 -0
- package/src/components/VToolbar/.DS_Store +0 -0
- package/src/components/VToolbar/VToolbar.scss +26 -0
- package/src/components/VToolbar/VToolbar.tsx +44 -0
- package/src/components/VToolbar/VToolbarEdge.scss +27 -0
- package/src/components/VToolbar/VToolbarEdge.tsx +35 -0
- package/src/components/VToolbar/VToolbarMenu.scss +7 -0
- package/src/components/VToolbar/VToolbarMenu.tsx +26 -0
- package/src/components/VToolbar/VToolbarTitle.scss +22 -0
- package/src/components/VToolbar/VToolbarTitle.tsx +25 -0
- package/src/components/VToolbar/index.ts +4 -0
- package/src/components/VWysiwygEditor/.DS_Store +0 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.scss +60 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +293 -0
- package/src/components/VWysiwygEditor/index.ts +2 -0
- package/src/components/VWysiwygEditor/schemes.ts +65 -0
- package/src/components/VWysiwygEditor/tools/bullet-list.ts +18 -0
- package/src/components/VWysiwygEditor/tools/format-bold.ts +19 -0
- package/src/components/VWysiwygEditor/tools/format-italic.ts +18 -0
- package/src/components/VWysiwygEditor/tools/format-underline.ts +18 -0
- package/src/components/VWysiwygEditor/tools/history.ts +26 -0
- package/src/components/VWysiwygEditor/tools/index.ts +8 -0
- package/src/components/VWysiwygEditor/tools/link.ts +57 -0
- package/src/components/VWysiwygEditor/tools/ordered-list.ts +21 -0
- package/src/components/VWysiwygEditor/tools/text-color.ts +14 -0
- package/src/components/index.ts +32 -0
- package/src/components/kits.ts +1 -0
- package/src/components/loading.ts +1 -0
- package/src/composables/.DS_Store +0 -0
- package/src/composables/control.ts +118 -0
- package/src/composables/elevation.ts +34 -0
- package/src/composables/form-selector.scss +11 -0
- package/src/composables/form-selector.tsx +101 -0
- package/src/composables/index.ts +4 -0
- package/src/composables/vui.ts +9 -0
- package/src/index.ts +10 -0
- package/src/injections.ts +61 -0
- package/src/logger.ts +7 -0
- package/src/plugin.tsx +76 -0
- package/src/schemes/control.ts +7 -0
- package/src/schemes/elevation.ts +26 -0
- package/src/schemes/index.ts +2 -0
- package/src/service.tsx +242 -0
- package/src/styles/.DS_Store +0 -0
- package/src/styles/after-effects/display-flow.scss +346 -0
- package/src/styles/after-effects/spacing.scss +155 -0
- package/src/styles/after-effects/text.scss +90 -0
- package/src/styles/after-effects.scss +3 -0
- package/src/styles/base.scss +14 -0
- package/src/styles/control.scss +11 -0
- package/src/styles/core/functions.scss +62 -0
- package/src/styles/core/typo.scss +56 -0
- package/src/styles/core.scss +2 -0
- package/src/styles/elevation.scss +9 -0
- package/src/styles/group.scss +57 -0
- package/src/styles/index.scss +9 -0
- package/src/styles/transition.scss +11 -0
- package/src/styles/typo.scss +11 -0
- package/src/styles/variables.scss +320 -0
- package/src/styles/wysiwyg.scss +24 -0
- package/src/tool/.DS_Store +0 -0
- package/src/tool/index.ts +2 -0
- package/src/tool/vite-plugin.ts +281 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import './VPagination.scss';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
defineComponent,
|
|
5
|
+
PropType,
|
|
6
|
+
ref,
|
|
7
|
+
watch,
|
|
8
|
+
computed,
|
|
9
|
+
withDirectives,
|
|
10
|
+
} from 'vue';
|
|
11
|
+
import {
|
|
12
|
+
createPropsOptions,
|
|
13
|
+
rawNumberPropType,
|
|
14
|
+
resolveNumberish,
|
|
15
|
+
} from '@fastkit/vue-utils';
|
|
16
|
+
import { isPromise } from '@fastkit/helpers';
|
|
17
|
+
import { useRouter, RouterLink } from 'vue-router';
|
|
18
|
+
import { resolveRawIconProp } from '../VIcon';
|
|
19
|
+
import { resizeDirectiveArgument } from '@fastkit/vue-utils';
|
|
20
|
+
import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
|
|
21
|
+
import { useVui } from '../../injections';
|
|
22
|
+
|
|
23
|
+
export type VPaginationGuard = (
|
|
24
|
+
page: number,
|
|
25
|
+
) => boolean | void | Promise<boolean | void>;
|
|
26
|
+
|
|
27
|
+
export const PAGINATION_ALIGNS = ['left', 'center', 'right'] as const;
|
|
28
|
+
|
|
29
|
+
export type VPaginationAlign = typeof PAGINATION_ALIGNS[number];
|
|
30
|
+
|
|
31
|
+
export function paginationProps() {
|
|
32
|
+
return createPropsOptions({
|
|
33
|
+
/**
|
|
34
|
+
* Active Pages
|
|
35
|
+
*/
|
|
36
|
+
modelValue: {
|
|
37
|
+
type: rawNumberPropType,
|
|
38
|
+
default: 1,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Total number of pages
|
|
43
|
+
*/
|
|
44
|
+
length: {
|
|
45
|
+
type: rawNumberPropType,
|
|
46
|
+
default: 0,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Maximum number of links to display.
|
|
51
|
+
*/
|
|
52
|
+
totalVisible: rawNumberPropType,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* true when narrowing
|
|
56
|
+
*/
|
|
57
|
+
dense: Boolean,
|
|
58
|
+
disabled: Boolean,
|
|
59
|
+
align: {
|
|
60
|
+
type: String as PropType<VPaginationAlign>,
|
|
61
|
+
default: 'center',
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* To synchronize with a query, use the query name
|
|
66
|
+
*/
|
|
67
|
+
routeQuery: String,
|
|
68
|
+
beforeChange: Function as PropType<VPaginationGuard>,
|
|
69
|
+
color: String as PropType<ScopeName>,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type ItemSource = number | 'prev' | 'next' | 'truncate';
|
|
74
|
+
|
|
75
|
+
export const VPagination = defineComponent({
|
|
76
|
+
name: 'VPagination',
|
|
77
|
+
props: paginationProps(),
|
|
78
|
+
emits: {
|
|
79
|
+
change: (page: number) => true,
|
|
80
|
+
},
|
|
81
|
+
setup(props, ctx) {
|
|
82
|
+
const vui = useVui();
|
|
83
|
+
const elRef = ref<HTMLElement | null>(null);
|
|
84
|
+
const router = useRouter();
|
|
85
|
+
const internalValue = ref(1);
|
|
86
|
+
const containerWidth = ref(0);
|
|
87
|
+
const itemSize = ref(0);
|
|
88
|
+
const capacityLength = computed(() => {
|
|
89
|
+
const _itemSize = itemSize.value;
|
|
90
|
+
if (!_itemSize) return 0;
|
|
91
|
+
return Math.floor(containerWidth.value / _itemSize);
|
|
92
|
+
});
|
|
93
|
+
const colorScope = useScopeColorClass({
|
|
94
|
+
color: () => props.color || vui.setting('primaryScope'),
|
|
95
|
+
});
|
|
96
|
+
const computedLength = computed(() => resolveNumberish(props.length));
|
|
97
|
+
const computedTotalVisible = computed(() =>
|
|
98
|
+
resolveNumberish(props.totalVisible),
|
|
99
|
+
);
|
|
100
|
+
const computedNumbersLength = computed(() => capacityLength.value - 2 - 2);
|
|
101
|
+
const computedPage = computed(() => {
|
|
102
|
+
const { routeQuery } = props;
|
|
103
|
+
if (routeQuery) {
|
|
104
|
+
return vui.location.getQuery(routeQuery, Number, 1);
|
|
105
|
+
}
|
|
106
|
+
return internalValue.value;
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const _range = (from: number, to: number) => {
|
|
110
|
+
const range: number[] = [];
|
|
111
|
+
|
|
112
|
+
from = from > 0 ? from : 1;
|
|
113
|
+
|
|
114
|
+
for (let i = from; i <= to; i++) {
|
|
115
|
+
range.push(i);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return range;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const computedItems = computed<ItemSource[]>(() => {
|
|
122
|
+
const maxButtons = computedNumbersLength.value;
|
|
123
|
+
const totalVisible = computedTotalVisible.value;
|
|
124
|
+
const length = computedLength.value;
|
|
125
|
+
const pageValue = computedPage.value;
|
|
126
|
+
|
|
127
|
+
const maxLength = Math.min(
|
|
128
|
+
Math.max(0, totalVisible || 0) || length,
|
|
129
|
+
Math.max(0, maxButtons) || length,
|
|
130
|
+
length,
|
|
131
|
+
);
|
|
132
|
+
if (length <= maxLength) {
|
|
133
|
+
return _range(1, length);
|
|
134
|
+
}
|
|
135
|
+
const even = maxLength % 2 === 0 ? 1 : 0;
|
|
136
|
+
const left = Math.floor(maxLength / 2);
|
|
137
|
+
const right = length - left + 1 + even;
|
|
138
|
+
|
|
139
|
+
if (pageValue > left && pageValue < right) {
|
|
140
|
+
const start = pageValue - left + 2;
|
|
141
|
+
const end = pageValue + left - 2 - even;
|
|
142
|
+
|
|
143
|
+
return [1, 'truncate', ..._range(start, end), 'truncate', length];
|
|
144
|
+
} else if (pageValue === left) {
|
|
145
|
+
const end = pageValue + left - 1 - even;
|
|
146
|
+
return [..._range(1, end), 'truncate', length];
|
|
147
|
+
} else if (pageValue === right) {
|
|
148
|
+
const start = pageValue - left + 1;
|
|
149
|
+
return [1, 'truncate', ..._range(start, length)];
|
|
150
|
+
} else {
|
|
151
|
+
return [..._range(1, left), 'truncate', ..._range(right, length)];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const isActive = computed(() => computedLength.value > 1);
|
|
156
|
+
|
|
157
|
+
const isTransitioning = computed(() => {
|
|
158
|
+
const { routeQuery } = props;
|
|
159
|
+
return vui.location.isQueryOnlyTransitioning(routeQuery);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const isDisabled = computed(() => props.disabled || isTransitioning.value);
|
|
163
|
+
|
|
164
|
+
const classes = computed(() => [
|
|
165
|
+
{
|
|
166
|
+
'v-pagination--disabled': isDisabled.value,
|
|
167
|
+
'v-pagination--dense': props.dense,
|
|
168
|
+
[`v-pagination--${props.align}`]: true,
|
|
169
|
+
},
|
|
170
|
+
colorScope.value.className,
|
|
171
|
+
]);
|
|
172
|
+
|
|
173
|
+
async function setPage(value: number | string) {
|
|
174
|
+
if (isDisabled.value) return;
|
|
175
|
+
const { beforeChange, routeQuery } = props;
|
|
176
|
+
const newPage = resolveNumberish(value);
|
|
177
|
+
if (computedPage.value === newPage) return;
|
|
178
|
+
if (beforeChange) {
|
|
179
|
+
try {
|
|
180
|
+
let result = beforeChange(newPage);
|
|
181
|
+
if (isPromise(result)) result = await result;
|
|
182
|
+
if (result === false) return;
|
|
183
|
+
} catch (e) {}
|
|
184
|
+
}
|
|
185
|
+
if (routeQuery) {
|
|
186
|
+
const to = createRoutableLocationByPage(newPage, routeQuery);
|
|
187
|
+
return router.push(to).then((failure) => {
|
|
188
|
+
!failure && ctx.emit('change', newPage);
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
internalValue.value = newPage;
|
|
192
|
+
(ctx as any).emit('update:modelValue', newPage);
|
|
193
|
+
ctx.emit('change', newPage);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function createPageInfo(source: ItemSource): {
|
|
198
|
+
number: boolean;
|
|
199
|
+
page: number | undefined;
|
|
200
|
+
active: boolean;
|
|
201
|
+
disabled: boolean;
|
|
202
|
+
} {
|
|
203
|
+
const currentPage = computedPage.value;
|
|
204
|
+
const length = computedLength.value;
|
|
205
|
+
let number: boolean;
|
|
206
|
+
let page: number | undefined;
|
|
207
|
+
let active: boolean;
|
|
208
|
+
let disabled: boolean;
|
|
209
|
+
|
|
210
|
+
if (typeof source === 'number') {
|
|
211
|
+
number = true;
|
|
212
|
+
page = source;
|
|
213
|
+
active = currentPage === page;
|
|
214
|
+
disabled = false;
|
|
215
|
+
} else if (source === 'truncate') {
|
|
216
|
+
number = false;
|
|
217
|
+
active = false;
|
|
218
|
+
disabled = false;
|
|
219
|
+
} else {
|
|
220
|
+
number = false;
|
|
221
|
+
const isPrev = source === 'prev';
|
|
222
|
+
const ammount = isPrev ? -1 : 1;
|
|
223
|
+
page = currentPage + ammount;
|
|
224
|
+
active = false;
|
|
225
|
+
disabled = page < 1 || page > length;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return {
|
|
229
|
+
number,
|
|
230
|
+
page,
|
|
231
|
+
active,
|
|
232
|
+
disabled,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function createRoutableLocationByPage(page: number, routeQuery: string) {
|
|
237
|
+
return vui.location.getQueryMergedLocation({
|
|
238
|
+
[routeQuery]: page,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function genItem(source: ItemSource, index: number) {
|
|
243
|
+
const { number, page, active, disabled } = createPageInfo(source);
|
|
244
|
+
const type = number ? 'num' : source;
|
|
245
|
+
const classes = [
|
|
246
|
+
'v-pagination__item',
|
|
247
|
+
{
|
|
248
|
+
[`v-pagination__item--${type}`]: true,
|
|
249
|
+
'v-pagination__item--active': active,
|
|
250
|
+
'v-pagination__item--disabled': disabled,
|
|
251
|
+
},
|
|
252
|
+
];
|
|
253
|
+
const children = number
|
|
254
|
+
? page
|
|
255
|
+
: (() => {
|
|
256
|
+
if (type === 'truncate') {
|
|
257
|
+
return <span>...</span>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const isPrev = type === 'prev';
|
|
261
|
+
const icon = isPrev ? vui.icon('prev') : vui.icon('next');
|
|
262
|
+
return resolveRawIconProp(false, icon, {
|
|
263
|
+
class: 'v-pagination__item__icon',
|
|
264
|
+
});
|
|
265
|
+
})();
|
|
266
|
+
|
|
267
|
+
const onClick = (ev: MouseEvent) => {
|
|
268
|
+
ev.preventDefault();
|
|
269
|
+
if (page === undefined || active || disabled) return;
|
|
270
|
+
setPage(page);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const key = `${source}-${index}`;
|
|
274
|
+
|
|
275
|
+
const { routeQuery } = props;
|
|
276
|
+
|
|
277
|
+
if (page !== undefined && routeQuery) {
|
|
278
|
+
const to = createRoutableLocationByPage(page, routeQuery);
|
|
279
|
+
return (
|
|
280
|
+
<RouterLink
|
|
281
|
+
class={classes}
|
|
282
|
+
to={to}
|
|
283
|
+
key={key}
|
|
284
|
+
// event=""
|
|
285
|
+
// nativeOn={
|
|
286
|
+
// page === undefined
|
|
287
|
+
// ? undefined
|
|
288
|
+
// : {
|
|
289
|
+
// click: onClick,
|
|
290
|
+
// }
|
|
291
|
+
// }
|
|
292
|
+
>
|
|
293
|
+
{children}
|
|
294
|
+
</RouterLink>
|
|
295
|
+
);
|
|
296
|
+
} else {
|
|
297
|
+
return (
|
|
298
|
+
<button
|
|
299
|
+
class={classes}
|
|
300
|
+
type="button"
|
|
301
|
+
value={page}
|
|
302
|
+
onClick={onClick}
|
|
303
|
+
key={key}>
|
|
304
|
+
{children}
|
|
305
|
+
</button>
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
watch(
|
|
311
|
+
() => props.modelValue,
|
|
312
|
+
(modelValue) => {
|
|
313
|
+
internalValue.value = resolveNumberish(modelValue);
|
|
314
|
+
},
|
|
315
|
+
{ immediate: true },
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
return () => {
|
|
319
|
+
if (!isActive.value) return undefined;
|
|
320
|
+
const $items = [
|
|
321
|
+
'prev' as const,
|
|
322
|
+
...computedItems.value,
|
|
323
|
+
'next' as const,
|
|
324
|
+
].map((i, index) => genItem(i, index));
|
|
325
|
+
|
|
326
|
+
return withDirectives(
|
|
327
|
+
<nav class={['v-pagination', classes.value]} ref={elRef}>
|
|
328
|
+
{$items}
|
|
329
|
+
</nav>,
|
|
330
|
+
[
|
|
331
|
+
resizeDirectiveArgument(({ width }) => {
|
|
332
|
+
const el = elRef.value;
|
|
333
|
+
if (el) {
|
|
334
|
+
const style = window.getComputedStyle(el, 'before');
|
|
335
|
+
const width = style.getPropertyValue('width');
|
|
336
|
+
const margin = style.getPropertyValue('margin');
|
|
337
|
+
const size = parseFloat(width) + parseFloat(margin) * 0.5;
|
|
338
|
+
itemSize.value = size;
|
|
339
|
+
}
|
|
340
|
+
containerWidth.value = width;
|
|
341
|
+
}),
|
|
342
|
+
],
|
|
343
|
+
);
|
|
344
|
+
};
|
|
345
|
+
},
|
|
346
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VPagination';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.v-paper {
|
|
2
|
+
--paper-radius: var(--control-field-radius);
|
|
3
|
+
|
|
4
|
+
&--plain {
|
|
5
|
+
--paper-background--color: var(--palette-background);
|
|
6
|
+
--paper-text-color: inherit;
|
|
7
|
+
--paper-link-color: var(--link-color);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&--has-color {
|
|
11
|
+
--paper-background--color: var(--main-color);
|
|
12
|
+
--paper-text-color: var(--text-color);
|
|
13
|
+
--paper-link-color: var(--nav-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
color: var(--paper-text-color);
|
|
17
|
+
background-color: var(--paper-background--color);
|
|
18
|
+
border-radius: var(--paper-radius);
|
|
19
|
+
|
|
20
|
+
&--square {
|
|
21
|
+
--paper-radius: 0px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
a {
|
|
25
|
+
color: var(--paper-link-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&__header {
|
|
29
|
+
border-top-left-radius: inherit;
|
|
30
|
+
border-top-right-radius: inherit;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__footer {
|
|
34
|
+
border-bottom-right-radius: inherit;
|
|
35
|
+
border-bottom-left-radius: inherit;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import './VPaper.scss';
|
|
2
|
+
import { defineComponent, computed, PropType, VNodeProps } from 'vue';
|
|
3
|
+
import { createElevationProps, useElevation } from '../../composables';
|
|
4
|
+
import { renderSlotOrEmpty, defineSlotsProps } from '@fastkit/vue-utils';
|
|
5
|
+
import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
|
|
6
|
+
|
|
7
|
+
export function createPaperBaseProps() {
|
|
8
|
+
return {
|
|
9
|
+
color: String as PropType<ScopeName>,
|
|
10
|
+
tag: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: 'div',
|
|
13
|
+
},
|
|
14
|
+
...defineSlotsProps<{
|
|
15
|
+
header: void;
|
|
16
|
+
default: void;
|
|
17
|
+
footer: void;
|
|
18
|
+
}>(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type ARGS = Record<string, unknown> & VNodeProps;
|
|
23
|
+
|
|
24
|
+
export function createPaperProps() {
|
|
25
|
+
return {
|
|
26
|
+
...createElevationProps(),
|
|
27
|
+
...createPaperBaseProps(),
|
|
28
|
+
square: Boolean,
|
|
29
|
+
headerProps: Object as PropType<ARGS>,
|
|
30
|
+
bodyProps: Object as PropType<ARGS>,
|
|
31
|
+
footerProps: Object as PropType<ARGS>,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const VPaper = defineComponent({
|
|
36
|
+
name: 'VPaper',
|
|
37
|
+
props: createPaperProps(),
|
|
38
|
+
setup(props, ctx) {
|
|
39
|
+
const tag = computed(() => props.tag);
|
|
40
|
+
const elevation = useElevation(props, { defaultValue: 1 });
|
|
41
|
+
const scope = useScopeColorClass(props);
|
|
42
|
+
const classes = computed(() => [
|
|
43
|
+
elevation.elevationClassName.value,
|
|
44
|
+
scope.value.className,
|
|
45
|
+
{
|
|
46
|
+
'v-paper--plain': !scope.value.value,
|
|
47
|
+
'v-paper--has-color': !!scope.value.value,
|
|
48
|
+
'v-paper--square': props.square,
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
const headerProps = computed<any>(() => props.headerProps);
|
|
52
|
+
const bodyProps = computed<any>(() => props.bodyProps);
|
|
53
|
+
const footerProps = computed<any>(() => props.footerProps);
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
const TagName = tag.value as 'div';
|
|
57
|
+
const header = renderSlotOrEmpty(ctx.slots, 'header');
|
|
58
|
+
const footer = renderSlotOrEmpty(ctx.slots, 'footer');
|
|
59
|
+
return (
|
|
60
|
+
<TagName class={['v-paper', classes.value]}>
|
|
61
|
+
{header && (
|
|
62
|
+
<div class="v-paper__header" {...headerProps.value}>
|
|
63
|
+
{header}
|
|
64
|
+
</div>
|
|
65
|
+
)}
|
|
66
|
+
<div class="v-paper__body" {...bodyProps.value}>
|
|
67
|
+
{renderSlotOrEmpty(ctx.slots, 'default')}
|
|
68
|
+
</div>
|
|
69
|
+
{footer && (
|
|
70
|
+
<div class="v-paper__footer" {...footerProps.value}>
|
|
71
|
+
{footer}
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
</TagName>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VPaper';
|
|
Binary file
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
3
|
+
.v-radio {
|
|
4
|
+
--my-color: var(--color);
|
|
5
|
+
|
|
6
|
+
// color: var(--my-color);
|
|
7
|
+
// --my-faux-bg-color: transparent;
|
|
8
|
+
|
|
9
|
+
// &--selected,
|
|
10
|
+
// &--indeterminate {
|
|
11
|
+
// --my-border-color: transparent;
|
|
12
|
+
// --my-faux-bg-color: var(--color);
|
|
13
|
+
// }
|
|
14
|
+
|
|
15
|
+
&__faux {
|
|
16
|
+
position: relative;
|
|
17
|
+
// display: flex;
|
|
18
|
+
// align-items: center;
|
|
19
|
+
// justify-content: center;
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
// background: var(--my-faux-bg-color);
|
|
24
|
+
// border: solid 2px currentColor;
|
|
25
|
+
// border-radius: 100%;
|
|
26
|
+
transition: border-color 0.2s, background-color 0.2s;
|
|
27
|
+
|
|
28
|
+
&::before,
|
|
29
|
+
&::after {
|
|
30
|
+
position: absolute;
|
|
31
|
+
display: block;
|
|
32
|
+
content: '';
|
|
33
|
+
border-radius: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&::before {
|
|
37
|
+
top: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
border: solid 2px currentColor;
|
|
42
|
+
// display: block;
|
|
43
|
+
// width: 60%;
|
|
44
|
+
// height: 60%;
|
|
45
|
+
// content: '';
|
|
46
|
+
// background: currentColor;
|
|
47
|
+
// border-radius: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
top: 50%;
|
|
52
|
+
left: 50%;
|
|
53
|
+
width: 50%;
|
|
54
|
+
height: 50%;
|
|
55
|
+
background: currentColor;
|
|
56
|
+
transition: transform 0.2s;
|
|
57
|
+
transform: translate(-50%, -50%) scale(0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--selected &__faux {
|
|
62
|
+
&::after {
|
|
63
|
+
transform: translate(-50%, -50%) scale(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import './VRadio.scss';
|
|
2
|
+
import { defineComponent } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
createFormSelectorItemSettings,
|
|
5
|
+
useFormSelectorItemControl,
|
|
6
|
+
renderSlotOrEmpty,
|
|
7
|
+
} from '@fastkit/vue-kit';
|
|
8
|
+
import { createControlProps, useControl } from '../../composables';
|
|
9
|
+
import { VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL } from '../../injections';
|
|
10
|
+
import { VCheckable } from '../VCheckable';
|
|
11
|
+
|
|
12
|
+
const { props, emits } = createFormSelectorItemSettings();
|
|
13
|
+
|
|
14
|
+
export const VRadio = defineComponent({
|
|
15
|
+
name: 'VRadio',
|
|
16
|
+
props: {
|
|
17
|
+
...props,
|
|
18
|
+
...createControlProps(),
|
|
19
|
+
},
|
|
20
|
+
emits,
|
|
21
|
+
setup(props, ctx) {
|
|
22
|
+
const nodeControl = useFormSelectorItemControl(props, ctx, {
|
|
23
|
+
nodeType: VUI_RADIO_SYMBOL,
|
|
24
|
+
parentNodeType: VUI_RADIO_GROUP_SYMBOL,
|
|
25
|
+
});
|
|
26
|
+
const control = useControl(props);
|
|
27
|
+
return {
|
|
28
|
+
...nodeControl.expose(),
|
|
29
|
+
...control,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
render() {
|
|
33
|
+
const { selectorItemControl } = this;
|
|
34
|
+
return (
|
|
35
|
+
<VCheckable
|
|
36
|
+
class={[
|
|
37
|
+
'v-radio',
|
|
38
|
+
{
|
|
39
|
+
'v-radio--selected': selectorItemControl.selected,
|
|
40
|
+
},
|
|
41
|
+
this.classes,
|
|
42
|
+
]}
|
|
43
|
+
checked={this.selected}
|
|
44
|
+
invalid={this.invalid}
|
|
45
|
+
disabled={this.isDisabled}
|
|
46
|
+
readonly={this.isReadonly}
|
|
47
|
+
v-slots={{
|
|
48
|
+
input: () =>
|
|
49
|
+
selectorItemControl.createInputElement({ type: 'radio' }),
|
|
50
|
+
faux: () => <span class="v-radio__faux"></span>,
|
|
51
|
+
label: () => renderSlotOrEmpty(this.$slots, 'default'),
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VRadio';
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VUI_RADIO_GROUP_SYMBOL } from '../../injections';
|
|
2
|
+
import { VRadio } from '../VRadio';
|
|
3
|
+
import { defineFormSelectorComponent } from '../../composables';
|
|
4
|
+
|
|
5
|
+
export const VRadioGroup = defineFormSelectorComponent({
|
|
6
|
+
name: 'VRadioGroup',
|
|
7
|
+
nodeType: VUI_RADIO_GROUP_SYMBOL,
|
|
8
|
+
className: 'v-radio-group',
|
|
9
|
+
itemRenderer: ({ attrs, slots }) => <VRadio {...attrs}>{slots}</VRadio>,
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VRadioGroup';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
@use '../../styles/core.scss';
|
|
2
|
+
|
|
3
|
+
.v-select {
|
|
4
|
+
&__input {
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
|
|
7
|
+
&__element {
|
|
8
|
+
@include core.hidden-input-element;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// &__element {
|
|
12
|
+
// width: 100%;
|
|
13
|
+
// min-width: 0;
|
|
14
|
+
// // width: calc(100% - 8px);
|
|
15
|
+
// padding: 0;
|
|
16
|
+
// margin: 0;
|
|
17
|
+
// overflow: hidden;
|
|
18
|
+
// // margin: 0 8px;
|
|
19
|
+
// font-size: inherit;
|
|
20
|
+
// text-overflow: ellipsis;
|
|
21
|
+
// white-space: nowrap;
|
|
22
|
+
// background: transparent;
|
|
23
|
+
// border: 0;
|
|
24
|
+
// border-radius: 0;
|
|
25
|
+
// outline: 0;
|
|
26
|
+
|
|
27
|
+
// &:-webkit-autofill {
|
|
28
|
+
// color: inherit !important;
|
|
29
|
+
// // box-shadow: 0 0 0 1000px get-color(field) inset;
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
// &::-ms-clear {
|
|
33
|
+
// display: none;
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// // @include placeholder {
|
|
37
|
+
// // color: get-color(text-muted);
|
|
38
|
+
// // }
|
|
39
|
+
// }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__body {
|
|
43
|
+
padding: 0.5em 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__selections {
|
|
47
|
+
display: table;
|
|
48
|
+
width: 100%;
|
|
49
|
+
table-layout: fixed;
|
|
50
|
+
// display: flex;
|
|
51
|
+
// align-items: center;
|
|
52
|
+
// width: 100%;
|
|
53
|
+
// min-width: 0;
|
|
54
|
+
&__inner {
|
|
55
|
+
display: table-cell;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
vertical-align: middle;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&__placeholder {
|
|
64
|
+
font-style: italic;
|
|
65
|
+
color: var(--control-disabled-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// &__selection {
|
|
69
|
+
// // // box-sizing: content-box;
|
|
70
|
+
// // display: table-cell;
|
|
71
|
+
// // // width: 100%;
|
|
72
|
+
// // // min-width: 0;
|
|
73
|
+
// // overflow: hidden;
|
|
74
|
+
// // text-overflow: ellipsis;
|
|
75
|
+
// // white-space: nowrap;
|
|
76
|
+
// // vertical-align: middle;
|
|
77
|
+
// }
|
|
78
|
+
}
|