@fastkit/vui 0.6.36 → 0.6.40
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 +214 -19
- package/dist/vui.cjs.prod.js +214 -19
- package/dist/vui.css +69 -17
- package/dist/vui.d.ts +3609 -17
- package/dist/vui.esm-bundler.js +214 -21
- 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 +110 -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,204 @@
|
|
|
1
|
+
import './VSelect.scss';
|
|
2
|
+
import { ref, VNodeChild, defineComponent } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
createFormSelectorSettings,
|
|
5
|
+
useFormSelectorControl,
|
|
6
|
+
createFormControlProps,
|
|
7
|
+
defineSlotsProps,
|
|
8
|
+
FormControlSlots,
|
|
9
|
+
FormSelectorItemControl,
|
|
10
|
+
createPropsOptions,
|
|
11
|
+
} from '@fastkit/vue-kit';
|
|
12
|
+
import { VFormControl } from '../VFormControl';
|
|
13
|
+
import {
|
|
14
|
+
VControlField,
|
|
15
|
+
createControlFieldProps,
|
|
16
|
+
InputBoxSlots,
|
|
17
|
+
} from '../VControlField';
|
|
18
|
+
import {
|
|
19
|
+
createControlProps,
|
|
20
|
+
useControl,
|
|
21
|
+
createControlFieldProviderProps,
|
|
22
|
+
useControlField,
|
|
23
|
+
} from '../../composables';
|
|
24
|
+
import { VUI_SELECT_SYMBOL, useVui } from '../../injections';
|
|
25
|
+
import { VIcon } from '../VIcon';
|
|
26
|
+
import { VMenu } from '../kits';
|
|
27
|
+
import { VOption } from '../VOption';
|
|
28
|
+
|
|
29
|
+
const { props, emits } = createFormSelectorSettings();
|
|
30
|
+
|
|
31
|
+
export const VSelect = defineComponent({
|
|
32
|
+
name: 'VSelect',
|
|
33
|
+
props: {
|
|
34
|
+
...props,
|
|
35
|
+
...createFormControlProps(),
|
|
36
|
+
...createControlFieldProps(),
|
|
37
|
+
...createControlFieldProviderProps(),
|
|
38
|
+
...createControlProps(),
|
|
39
|
+
...defineSlotsProps<FormControlSlots & InputBoxSlots>(),
|
|
40
|
+
...createPropsOptions({
|
|
41
|
+
placeholder: String,
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
emits,
|
|
45
|
+
setup(props, ctx) {
|
|
46
|
+
const menuOpened = ref(false);
|
|
47
|
+
const showMenu = () => {
|
|
48
|
+
menuOpened.value = true;
|
|
49
|
+
};
|
|
50
|
+
const closeMenu = () => {
|
|
51
|
+
menuOpened.value = false;
|
|
52
|
+
};
|
|
53
|
+
const inputControl = useFormSelectorControl(props, ctx, {
|
|
54
|
+
nodeType: VUI_SELECT_SYMBOL,
|
|
55
|
+
onSelectItem: (item) => {
|
|
56
|
+
closeMenu();
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const control = useControl(props);
|
|
60
|
+
useControlField(props);
|
|
61
|
+
const vui = useVui();
|
|
62
|
+
const iconName = vui.icon('menuDown');
|
|
63
|
+
const fieldRef = ref<HTMLElement | null>(null);
|
|
64
|
+
|
|
65
|
+
const focus = (opts?: FocusOptions): void => {
|
|
66
|
+
fieldRef.value && fieldRef.value.focus(opts);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const renderSelections = (selectedItems: FormSelectorItemControl[]) => {
|
|
70
|
+
const children: VNodeChild[] = [];
|
|
71
|
+
if (selectedItems.length) {
|
|
72
|
+
selectedItems.forEach((item, index) => {
|
|
73
|
+
if (index > 0) {
|
|
74
|
+
children.push(vui.selectionSeparator());
|
|
75
|
+
}
|
|
76
|
+
children.push(item.renderDefaultSlot());
|
|
77
|
+
});
|
|
78
|
+
} else if (props.placeholder != null) {
|
|
79
|
+
children.push(
|
|
80
|
+
<span class="v-select__placeholder">{props.placeholder}</span>,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return children;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
...inputControl.expose(),
|
|
88
|
+
...control,
|
|
89
|
+
iconName,
|
|
90
|
+
menuOpened,
|
|
91
|
+
fieldRef: () => fieldRef,
|
|
92
|
+
focus,
|
|
93
|
+
showMenu,
|
|
94
|
+
closeMenu,
|
|
95
|
+
renderSelections,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
render() {
|
|
99
|
+
const { nodeControl, selectorControl, selectorItems, selectedItems } = this;
|
|
100
|
+
const children = (this.$slots.default && this.$slots.default()) || [];
|
|
101
|
+
const propOptions = this.propItems.map((item) => {
|
|
102
|
+
return (
|
|
103
|
+
<VOption disabled={item.disabled} value={item.value} key={item.value}>
|
|
104
|
+
{{
|
|
105
|
+
default: () => item.label(selectorControl),
|
|
106
|
+
}}
|
|
107
|
+
</VOption>
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<VFormControl
|
|
113
|
+
nodeControl={nodeControl}
|
|
114
|
+
// focused={this.nodeControl.focused}
|
|
115
|
+
class={['v-select', this.classes]}
|
|
116
|
+
label={this.label}
|
|
117
|
+
hint={this.hint}
|
|
118
|
+
hiddenInfo={this.hiddenInfo}
|
|
119
|
+
onClickLabel={(ev) => {
|
|
120
|
+
this.focus();
|
|
121
|
+
}}
|
|
122
|
+
v-slots={{
|
|
123
|
+
...this.$slots,
|
|
124
|
+
default: () => (
|
|
125
|
+
<VMenu
|
|
126
|
+
width="fit"
|
|
127
|
+
maxWidth="fit"
|
|
128
|
+
distance={0}
|
|
129
|
+
alwaysRender
|
|
130
|
+
v-model={this.menuOpened}
|
|
131
|
+
v-slots={{
|
|
132
|
+
activator: ({ attrs, control }) => [
|
|
133
|
+
<VControlField
|
|
134
|
+
class="v-select__input"
|
|
135
|
+
ref={this.fieldRef()}
|
|
136
|
+
startAdornment={this.startAdornment}
|
|
137
|
+
endAdornment={this.endAdornment}
|
|
138
|
+
// tabindex={this.computedTabindex}
|
|
139
|
+
focused={this.menuOpened}
|
|
140
|
+
onClick={(ev) => {
|
|
141
|
+
if (this.canOperation && !control.isActive) {
|
|
142
|
+
let t = ev.target as HTMLElement;
|
|
143
|
+
const count = 0;
|
|
144
|
+
let hit = false;
|
|
145
|
+
while (count < 5) {
|
|
146
|
+
if (t.classList.contains('v-select__input')) {
|
|
147
|
+
hit = true;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
t = t.parentElement as HTMLElement;
|
|
151
|
+
}
|
|
152
|
+
control.show(hit ? t : ev);
|
|
153
|
+
}
|
|
154
|
+
}}
|
|
155
|
+
v-slots={{
|
|
156
|
+
...this.$slots,
|
|
157
|
+
default: () => [
|
|
158
|
+
<select
|
|
159
|
+
class="v-select__input__element"
|
|
160
|
+
name={this.name}
|
|
161
|
+
tabindex={this.computedTabindex}
|
|
162
|
+
disabled={this.isDisabled}
|
|
163
|
+
multiple={this.multiple}
|
|
164
|
+
onFocus={nodeControl.focusHandler}
|
|
165
|
+
onBlur={nodeControl.blurHandler}
|
|
166
|
+
v-model={this.currentValue}
|
|
167
|
+
// value={nodeControl.value}
|
|
168
|
+
>
|
|
169
|
+
{selectorItems.map((item) => {
|
|
170
|
+
return (
|
|
171
|
+
<option
|
|
172
|
+
value={item.propValue}
|
|
173
|
+
key={item.propValue}>
|
|
174
|
+
{item.renderDefaultSlot()}
|
|
175
|
+
</option>
|
|
176
|
+
);
|
|
177
|
+
})}
|
|
178
|
+
</select>,
|
|
179
|
+
<div class="v-select__selections">
|
|
180
|
+
<div class="v-select__selections__inner">
|
|
181
|
+
{this.renderSelections(selectedItems)}
|
|
182
|
+
</div>
|
|
183
|
+
</div>,
|
|
184
|
+
],
|
|
185
|
+
endAdornment: () => (
|
|
186
|
+
<VIcon
|
|
187
|
+
name={this.iconName}
|
|
188
|
+
rotate={this.menuOpened ? 180 : 0}></VIcon>
|
|
189
|
+
),
|
|
190
|
+
}}
|
|
191
|
+
/>,
|
|
192
|
+
],
|
|
193
|
+
}}>
|
|
194
|
+
<div class={['v-select__body', this.classes]}>
|
|
195
|
+
{children}
|
|
196
|
+
{propOptions}
|
|
197
|
+
</div>
|
|
198
|
+
</VMenu>
|
|
199
|
+
),
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
},
|
|
204
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VSelect';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
3
|
+
.v-switch {
|
|
4
|
+
--my-pin-color: var(--palette-background);
|
|
5
|
+
// --my-faux-bg-color: transparent;
|
|
6
|
+
|
|
7
|
+
&--selected {
|
|
8
|
+
--my-pin-color: var(--color);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&__faux {
|
|
12
|
+
position: relative;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
width: 100%;
|
|
17
|
+
width: var(--control-switch-width);
|
|
18
|
+
height: 100%;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
|
|
21
|
+
&::before {
|
|
22
|
+
display: block;
|
|
23
|
+
width: var(--control-switch-track-width);
|
|
24
|
+
height: var(--control-switch-track-height);
|
|
25
|
+
content: '';
|
|
26
|
+
background: var(--color);
|
|
27
|
+
border-radius: calc(var(--control-switch-track-height) / 2);
|
|
28
|
+
opacity: 0.5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&__pin {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
bottom: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
width: var(--outer-size);
|
|
40
|
+
height: var(--outer-size);
|
|
41
|
+
// background: #f00;
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
44
|
+
transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
45
|
+
|
|
46
|
+
&::before,
|
|
47
|
+
&::after {
|
|
48
|
+
display: block;
|
|
49
|
+
content: '';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&::before {
|
|
53
|
+
position: absolute;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
background: currentColor;
|
|
57
|
+
border-radius: 50%;
|
|
58
|
+
opacity: 0;
|
|
59
|
+
transition: opacity 0.2s;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&::after {
|
|
63
|
+
position: relative;
|
|
64
|
+
width: var(--icon-size);
|
|
65
|
+
height: var(--icon-size);
|
|
66
|
+
background: var(--my-pin-color);
|
|
67
|
+
border-radius: 50%;
|
|
68
|
+
box-shadow: rgb(0 0 0 / 0.2) 0 2px 1px -1px,
|
|
69
|
+
rgb(0 0 0 / 0.14) 0 1px 1px 0, rgb(0 0 0 / 0.12) 0 1px 3px 0;
|
|
70
|
+
transform: scale(var(--control-checkable-faux-scale));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&--selected &__faux {
|
|
76
|
+
&__pin {
|
|
77
|
+
left: calc(100% - var(--outer-size));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&--disabled &__faux {
|
|
82
|
+
&::before {
|
|
83
|
+
background-color: #000;
|
|
84
|
+
opacity: 0.12;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&__pin {
|
|
88
|
+
&::after {
|
|
89
|
+
background-color: rgba(245, 245, 245, 1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__faux:hover &__faux__pin::before {
|
|
95
|
+
opacity: 0.1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:focus-within &__faux {
|
|
99
|
+
&__pin {
|
|
100
|
+
&::before {
|
|
101
|
+
opacity: 0.1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// &--indeterminate &__faux {
|
|
107
|
+
// $x1: math.div(12, 54) * 100%;
|
|
108
|
+
// $x2: 100% - $x1;
|
|
109
|
+
// $y1: math.div(24, 54) * 100%;
|
|
110
|
+
// $y2: 100% - $y1;
|
|
111
|
+
|
|
112
|
+
// clip-path: polygon(
|
|
113
|
+
// 0 0,
|
|
114
|
+
// 0 100%,
|
|
115
|
+
// 100% 100%,
|
|
116
|
+
// 100% 0,
|
|
117
|
+
// #{$x2} #{$y1},
|
|
118
|
+
// #{$x2} #{$y2},
|
|
119
|
+
// #{$x1} #{$y2},
|
|
120
|
+
// #{$x1} #{$y1},
|
|
121
|
+
// #{$x2} #{$y1},
|
|
122
|
+
// 100% 0
|
|
123
|
+
// );
|
|
124
|
+
// }
|
|
125
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import './VSwitch.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_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL } from '../../injections';
|
|
10
|
+
import { VCheckable } from '../VCheckable';
|
|
11
|
+
|
|
12
|
+
const { props, emits } = createFormSelectorItemSettings();
|
|
13
|
+
|
|
14
|
+
export const VSwitch = defineComponent({
|
|
15
|
+
name: 'VSwitch',
|
|
16
|
+
props: {
|
|
17
|
+
...props,
|
|
18
|
+
...createControlProps(),
|
|
19
|
+
},
|
|
20
|
+
emits,
|
|
21
|
+
setup(props, ctx) {
|
|
22
|
+
const nodeControl = useFormSelectorItemControl(props, ctx, {
|
|
23
|
+
nodeType: VUI_SWITCH_SYMBOL,
|
|
24
|
+
parentNodeType: VUI_SWITCH_GROUP_SYMBOL,
|
|
25
|
+
});
|
|
26
|
+
const control = useControl(props);
|
|
27
|
+
if (typeof window !== 'undefined') {
|
|
28
|
+
(window as any).yy = {};
|
|
29
|
+
(window as any).yy[String(Date.now())] = nodeControl;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
...nodeControl.expose(),
|
|
33
|
+
...control,
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
render() {
|
|
37
|
+
const { selectorItemControl } = this;
|
|
38
|
+
return (
|
|
39
|
+
<VCheckable
|
|
40
|
+
class={[
|
|
41
|
+
'v-switch',
|
|
42
|
+
{
|
|
43
|
+
'v-switch--selected': selectorItemControl.selected,
|
|
44
|
+
'v-switch--disabled': selectorItemControl.isDisabled,
|
|
45
|
+
xxxxx: selectorItemControl.booted,
|
|
46
|
+
},
|
|
47
|
+
this.classes,
|
|
48
|
+
]}
|
|
49
|
+
checked={this.selected}
|
|
50
|
+
invalid={this.invalid}
|
|
51
|
+
disabled={this.isDisabled}
|
|
52
|
+
readonly={this.isReadonly}
|
|
53
|
+
v-slots={{
|
|
54
|
+
input: () =>
|
|
55
|
+
selectorItemControl.createInputElement({ type: 'checkbox' }),
|
|
56
|
+
icon: () => (
|
|
57
|
+
<span class="v-switch__faux">
|
|
58
|
+
<span class="v-switch__faux__pin"></span>
|
|
59
|
+
</span>
|
|
60
|
+
),
|
|
61
|
+
label: () => renderSlotOrEmpty(this.$slots, 'default'),
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VSwitch';
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VUI_SWITCH_GROUP_SYMBOL } from '../../injections';
|
|
2
|
+
import { VSwitch } from '../VSwitch';
|
|
3
|
+
import { defineFormSelectorComponent } from '../../composables';
|
|
4
|
+
|
|
5
|
+
export const VSwitchGroup = defineFormSelectorComponent({
|
|
6
|
+
name: 'VSwitchGroup',
|
|
7
|
+
defaultMultiple: true,
|
|
8
|
+
nodeType: VUI_SWITCH_GROUP_SYMBOL,
|
|
9
|
+
className: 'v-switch-group',
|
|
10
|
+
itemRenderer: ({ attrs, slots }) => <VSwitch {...attrs}>{slots}</VSwitch>,
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VSwitchGroup';
|
|
Binary file
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@use '../../styles/core.scss';
|
|
2
|
+
|
|
3
|
+
.v-tab {
|
|
4
|
+
@include core.button-reset;
|
|
5
|
+
|
|
6
|
+
--tab-content-color: var(--palette-caption);
|
|
7
|
+
--tab-content-focus-color: var(--main-color);
|
|
8
|
+
--tab-content-opacity: 0.7;
|
|
9
|
+
|
|
10
|
+
position: relative;
|
|
11
|
+
z-index: 3;
|
|
12
|
+
display: flex;
|
|
13
|
+
// flex: 1 1 auto;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
height: var(--tabs-height);
|
|
17
|
+
padding: 0 1.25em;
|
|
18
|
+
font: inherit;
|
|
19
|
+
font-size: var(--tabs-font-size);
|
|
20
|
+
// color: inherit;
|
|
21
|
+
white-space: nowrap;
|
|
22
|
+
user-select: none;
|
|
23
|
+
transition: color 0.6s;
|
|
24
|
+
|
|
25
|
+
&::before {
|
|
26
|
+
position: absolute;
|
|
27
|
+
right: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
// top: 0;
|
|
30
|
+
left: 0;
|
|
31
|
+
z-index: 1;
|
|
32
|
+
height: 2px;
|
|
33
|
+
content: '';
|
|
34
|
+
background-color: var(--tab-content-focus-color);
|
|
35
|
+
border-radius: inherit;
|
|
36
|
+
transition: all 0.25s;
|
|
37
|
+
transform: scaleX(0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__content {
|
|
41
|
+
position: relative;
|
|
42
|
+
z-index: 2;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
line-height: 1.2;
|
|
46
|
+
color: var(--tab-content-color);
|
|
47
|
+
text-align: center;
|
|
48
|
+
opacity: var(--tab-content-opacity);
|
|
49
|
+
transition: all 0.25s ease;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&__icon {
|
|
53
|
+
margin-right: 8px;
|
|
54
|
+
font-size: 120%;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
--tab-content-color: var(--tab-content-focus-color);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--active {
|
|
62
|
+
--tab-content-color: rgba(0, 0, 0, 0.87);
|
|
63
|
+
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
background: var(--tabs-color);
|
|
66
|
+
|
|
67
|
+
--tab-content-opacity: 1;
|
|
68
|
+
|
|
69
|
+
&::before {
|
|
70
|
+
transform: scaleX(1);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import './VTab.scss';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
defineComponent,
|
|
5
|
+
PropType,
|
|
6
|
+
computed,
|
|
7
|
+
ComponentPublicInstance,
|
|
8
|
+
} from 'vue';
|
|
9
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
10
|
+
import { RawIconProp, resolveRawIconProp } from '../VIcon';
|
|
11
|
+
import { renderSlotOrEmpty } from '@fastkit/vue-utils';
|
|
12
|
+
import { RouterLink } from 'vue-router';
|
|
13
|
+
|
|
14
|
+
export interface VTabExpose {
|
|
15
|
+
value: string;
|
|
16
|
+
active: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface VTabRef extends ComponentPublicInstance, VTabExpose {}
|
|
20
|
+
|
|
21
|
+
export const VTab = defineComponent({
|
|
22
|
+
name: 'VTab',
|
|
23
|
+
props: {
|
|
24
|
+
value: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
active: Boolean,
|
|
29
|
+
to: [String, Object] as PropType<RouteLocationRaw>,
|
|
30
|
+
icon: [String, Function] as PropType<RawIconProp>,
|
|
31
|
+
},
|
|
32
|
+
emits: {
|
|
33
|
+
click: (ev: MouseEvent) => true,
|
|
34
|
+
},
|
|
35
|
+
setup(props, ctx) {
|
|
36
|
+
const classesRef = computed(() => ({
|
|
37
|
+
'v-tab--active': props.active,
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
const exposeValues: VTabExpose = {
|
|
41
|
+
value: props.value,
|
|
42
|
+
active: props.active,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
ctx.expose(exposeValues);
|
|
46
|
+
|
|
47
|
+
return () => {
|
|
48
|
+
const { to, value, icon, active } = props;
|
|
49
|
+
const classes = ['v-tab', classesRef.value];
|
|
50
|
+
|
|
51
|
+
const children = (
|
|
52
|
+
<span class="v-tab__content">
|
|
53
|
+
{icon &&
|
|
54
|
+
resolveRawIconProp(active, icon, {
|
|
55
|
+
class: 'v-tab__icon',
|
|
56
|
+
})}
|
|
57
|
+
{renderSlotOrEmpty(ctx.slots)}
|
|
58
|
+
</span>
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if (to) {
|
|
62
|
+
const replace = typeof to === 'string' ? undefined : to.replace;
|
|
63
|
+
return (
|
|
64
|
+
<RouterLink
|
|
65
|
+
class={classes}
|
|
66
|
+
to={to}
|
|
67
|
+
replace={replace}
|
|
68
|
+
// disableScrollBehavior
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
</RouterLink>
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
return (
|
|
75
|
+
<button
|
|
76
|
+
class={classes}
|
|
77
|
+
type="button"
|
|
78
|
+
value={value}
|
|
79
|
+
onClick={(ev) => {
|
|
80
|
+
ctx.emit('click', ev);
|
|
81
|
+
}}>
|
|
82
|
+
{children}
|
|
83
|
+
</button>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
$my-offset: 30px;
|
|
2
|
+
|
|
3
|
+
.v-tabs {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: var(--tabs-height);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
|
|
9
|
+
&::before {
|
|
10
|
+
position: absolute;
|
|
11
|
+
right: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
display: block;
|
|
15
|
+
height: 2px;
|
|
16
|
+
content: '';
|
|
17
|
+
background: currentColor;
|
|
18
|
+
opacity: 0.25;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&__scroller {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: calc(var(--tabs-height) + #{$my-offset});
|
|
24
|
+
|
|
25
|
+
&__container {
|
|
26
|
+
padding-bottom: $my-offset;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__content {
|
|
31
|
+
position: relative;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: stretch;
|
|
34
|
+
min-width: 100%;
|
|
35
|
+
vertical-align: bottom;
|
|
36
|
+
|
|
37
|
+
// &::after {
|
|
38
|
+
// position: absolute;
|
|
39
|
+
// right: 0;
|
|
40
|
+
// bottom: 0;
|
|
41
|
+
// left: 0;
|
|
42
|
+
// z-index: 1;
|
|
43
|
+
// display: block;
|
|
44
|
+
// height: var(--tabs-bar-height);
|
|
45
|
+
// pointer-events: none;
|
|
46
|
+
// content: '';
|
|
47
|
+
// }
|
|
48
|
+
}
|
|
49
|
+
}
|