diff --git a/src/POSComponents/IosTab/GListCustom.vue b/src/POSComponents/IosTab/GListCustom.vue
new file mode 100644
index 00000000..f42a9747
--- /dev/null
+++ b/src/POSComponents/IosTab/GListCustom.vue
@@ -0,0 +1,98 @@
+
+
+
diff --git a/src/POSComponents/IosTab/IosTab.vue b/src/POSComponents/IosTab/IosTab.vue
new file mode 100644
index 00000000..98e07afd
--- /dev/null
+++ b/src/POSComponents/IosTab/IosTab.vue
@@ -0,0 +1,106 @@
+
+
+
diff --git a/src/POSComponents/IosTab/__story__/IosTab.stories.js b/src/POSComponents/IosTab/__story__/IosTab.stories.js
new file mode 100644
index 00000000..08bd7578
--- /dev/null
+++ b/src/POSComponents/IosTab/__story__/IosTab.stories.js
@@ -0,0 +1,562 @@
+import {withKnobs, text, boolean, number} from '@storybook/addon-knobs';
+import IosTab from '../IosTab';
+import GList from "../../../components/GList/GList";
+import GTabItemWebAnimation from "../../../components/GTabs/GTabItemWebAnimation";
+import GTabItemVueAnimation from "../../../components/GTabs/GTabItemVueAnimation";
+import GTabItem from "../../../components/GTabs/GTabItem";
+import GListCustom from '../GListCustom';
+
+export default {
+ title: 'IosTab',
+ decorators: [withKnobs]
+}
+
+export const tab = () => ({
+ components: {IosTab, GList, GListCustom, GTabItemWebAnimation, GTabItemVueAnimation, GTabItem},
+ data() {
+ return {
+ items: [
+ {
+ title: 'By Month',
+ icon: 'month',
+ subheader: '2019',
+ list: [
+ {
+ title: 'September',
+ subtitle: '25 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'August',
+ subtitle: '32 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'July',
+ subtitle: '52 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'June',
+ subtitle: '72 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'May',
+ subtitle: '35 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'April',
+ subtitle: '73 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'March',
+ subtitle: '43 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'February',
+ subtitle: '45 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'January',
+ subtitle: '15 Sales',
+ append: '€ 542.742,06'
+ }
+ ]
+ },
+ {
+ title: 'By Day',
+ icon: 'day',
+ subheader: '2019',
+ list: [
+ {
+ title: 'August',
+ subtitle: '25 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'September',
+ subtitle: '32 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'July',
+ subtitle: '52 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'June',
+ subtitle: '72 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'May',
+ subtitle: '35 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'April',
+ subtitle: '73 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'March',
+ subtitle: '43 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'February',
+ subtitle: '45 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'January',
+ subtitle: '15 Sales',
+ append: '€ 542.742,06'
+ }
+ ]
+ },
+ ],
+ model: null,
+ }
+ },
+ created() {
+ this.model = this.items[0]
+ },
+ props: {
+ color: {
+ type: String,
+ default: text('Color', '#D8D8D8')
+ },
+ textColor: {
+ type: String,
+ default: text('Text Color', 'white')
+ },
+ vertical: {
+ type: Boolean,
+ default: boolean('Vertical', false)
+ },
+ right: {
+ type: Boolean,
+ default: boolean('Right', false)
+ },
+ center: {
+ type: Boolean,
+ default: boolean('Center', false)
+ },
+ centerActive: {
+ default: boolean('Center active tab', true)
+ },
+ grow: {
+ type: Boolean,
+ default: boolean('Grow', false)
+ },
+ icon: {
+ type: Boolean,
+ default: boolean('Show icon', false)
+ },
+ sliderSize: {
+ type: Number,
+ default: number('Slider Size', 2)
+ },
+ sliderColor: {
+ type: String,
+ default: text('Slider Color', 'currentColor')
+ },
+ },
+ template: `
+
+
+
+
+
+
+ `,
+});
+
+export const tabVueAnimation = () => ({
+ components: {IosTab, GList, GListCustom, GTabItemWebAnimation, GTabItemVueAnimation, GTabItem},
+ data() {
+ return {
+ items: [
+ {
+ title: 'By Month',
+ icon: 'month',
+ subheader: '2019',
+ list: [
+ {
+ title: 'September',
+ subtitle: '25 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'August',
+ subtitle: '32 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'July',
+ subtitle: '52 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'June',
+ subtitle: '72 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'May',
+ subtitle: '35 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'April',
+ subtitle: '73 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'March',
+ subtitle: '43 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'February',
+ subtitle: '45 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'January',
+ subtitle: '15 Sales',
+ append: '€ 542.742,06'
+ }
+ ]
+ },
+ {
+ title: 'By day',
+ icon: 'day',
+ subheader: '2019',
+ list: [
+ {
+ title: 'August',
+ subtitle: '25 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'September',
+ subtitle: '32 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'July',
+ subtitle: '52 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'June',
+ subtitle: '72 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'May',
+ subtitle: '35 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'April',
+ subtitle: '73 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'March',
+ subtitle: '43 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'February',
+ subtitle: '45 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'January',
+ subtitle: '15 Sales',
+ append: '€ 542.742,06'
+ }
+ ]
+ },
+ ],
+ model: null,
+ }
+ },
+ created() {
+ this.model = this.items[0]
+ },
+ props: {
+ color: {
+ type: String,
+ default: text('Color', '#D8D8D8')
+ },
+ textColor: {
+ type: String,
+ default: text('Text Color', 'white')
+ },
+ vertical: {
+ type: Boolean,
+ default: boolean('Vertical', false)
+ },
+ right: {
+ type: Boolean,
+ default: boolean('Right', false)
+ },
+ center: {
+ type: Boolean,
+ default: boolean('Center', false)
+ },
+ centerActive: {
+ default: boolean('Center active tab', true)
+ },
+ grow: {
+ type: Boolean,
+ default: boolean('Grow', false)
+ },
+ icon: {
+ type: Boolean,
+ default: boolean('Show icon', false)
+ },
+ sliderSize: {
+ type: Number,
+ default: number('Slider Size', 2)
+ },
+ sliderColor: {
+ type: String,
+ default: text('Slider Color', 'currentColor')
+ },
+ },
+ template: `
+
+
+
+
+
+
+ `,
+});
+
+export const tabWebAnimation = () => ({
+ components: {IosTab, GList, GListCustom, GTabItemWebAnimation, GTabItemVueAnimation, GTabItem},
+ data() {
+ return {
+ items: [
+ {
+ title: 'By Month',
+ icon: 'month',
+ subheader: '2019',
+ list: [
+ {
+ title: 'September',
+ subtitle: '25 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'August',
+ subtitle: '32 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'July',
+ subtitle: '52 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'June',
+ subtitle: '72 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'May',
+ subtitle: '35 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'April',
+ subtitle: '73 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'March',
+ subtitle: '43 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'February',
+ subtitle: '45 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'January',
+ subtitle: '15 Sales',
+ append: '€ 542.742,06'
+ }
+ ]
+ },
+ {
+ title: 'By Day',
+ icon: 'day',
+ subheader: '2019',
+ list: [
+ {
+ title: 'August',
+ subtitle: '25 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'September',
+ subtitle: '32 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'July',
+ subtitle: '52 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'June',
+ subtitle: '72 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'May',
+ subtitle: '35 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'April',
+ subtitle: '73 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'March',
+ subtitle: '43 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'February',
+ subtitle: '45 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'January',
+ subtitle: '15 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'February',
+ subtitle: '45 Sales',
+ append: '€ 542.742,06'
+ },
+ {
+ title: 'January',
+ subtitle: '15 Sales',
+ append: '€ 542.742,06'
+ }
+ ]
+ },
+ ],
+ model: null,
+ }
+ },
+ created() {
+ this.model = this.items[0]
+ },
+ props: {
+ color: {
+ type: String,
+ default: text('Color', '#D8D8D8')
+ },
+ textColor: {
+ type: String,
+ default: text('Text Color', 'white')
+ },
+ vertical: {
+ type: Boolean,
+ default: boolean('Vertical', false)
+ },
+ right: {
+ type: Boolean,
+ default: boolean('Right', false)
+ },
+ center: {
+ type: Boolean,
+ default: boolean('Center', false)
+ },
+ centerActive: {
+ default: boolean('Center active tab', true)
+ },
+ grow: {
+ type: Boolean,
+ default: boolean('Grow', false)
+ },
+ icon: {
+ type: Boolean,
+ default: boolean('Show icon', false)
+ },
+ sliderSize: {
+ type: Number,
+ default: number('Slider Size', 2)
+ },
+ sliderColor: {
+ type: String,
+ default: text('Slider Color', 'currentColor')
+ },
+ },
+ template: `
+
+
+
+
+
+
+ `,
+});
\ No newline at end of file
diff --git a/src/components/GTabs/GTab.vue b/src/components/GTabs/GTab.vue
index a62df2d7..389975e3 100644
--- a/src/components/GTabs/GTab.vue
+++ b/src/components/GTabs/GTab.vue
@@ -22,7 +22,6 @@
setup(props, context) {
const model = inject('model', null);
const isActive = computed(() => (model && isEqual(model.value, props.item)));
-
const classes = computed(() => ({
'g-tab': true,
'waves-effect': props.ripple,
diff --git a/src/components/GTabs/GTabItem.vue b/src/components/GTabs/GTabItem.vue
index b1e4f959..13a2255e 100644
--- a/src/components/GTabs/GTabItem.vue
+++ b/src/components/GTabs/GTabItem.vue
@@ -12,11 +12,11 @@
const _transition = inject('transition');
return () =>
-
-
- {context.slots.default()}
-
-
+
+
+ {context.slots.default()}
+
+
}
}
diff --git a/src/components/GTabs/GTabItemVueAnimation.vue b/src/components/GTabs/GTabItemVueAnimation.vue
new file mode 100644
index 00000000..8b75c5ad
--- /dev/null
+++ b/src/components/GTabs/GTabItemVueAnimation.vue
@@ -0,0 +1,76 @@
+
+
+
\ No newline at end of file
diff --git a/src/components/GTabs/GTabItemWebAnimation.vue b/src/components/GTabs/GTabItemWebAnimation.vue
new file mode 100644
index 00000000..564f41b8
--- /dev/null
+++ b/src/components/GTabs/GTabItemWebAnimation.vue
@@ -0,0 +1,74 @@
+
\ No newline at end of file
diff --git a/src/components/GTabs/GTabItems.vue b/src/components/GTabs/GTabItems.vue
index f5eeeecd..d0c843f7 100644
--- a/src/components/GTabs/GTabItems.vue
+++ b/src/components/GTabs/GTabItems.vue
@@ -9,8 +9,8 @@
value: null
},
setup(props, context) {
- const model = inject('model', getVModel(props, context))
- const items = inject('items', props.items)
+ const model = inject('model', getVModel(props, context));
+ const items = inject('items', props.items);
provide('model', model);
const transition = ref('g-tab-transition');
@@ -24,7 +24,7 @@
} else {
transition.value = 'g-tab-transition';
}
- }, { flush: 'pre' })
+ }, { flush: 'pre' });
return () =>
@@ -38,7 +38,6 @@
.g-tab-items {
contain: layout;
flex: 1 1 auto;
- z-index: -1;
overflow: hidden;
}
\ No newline at end of file
diff --git a/src/components/GTabs/GTabs.vue b/src/components/GTabs/GTabs.vue
index 8e30289e..6bbcb510 100644
--- a/src/components/GTabs/GTabs.vue
+++ b/src/components/GTabs/GTabs.vue
@@ -27,21 +27,47 @@
type: [Number, String],
default: 2
},
+ slideTransHorLeft: {
+ type: String,
+ default: 'left 0.5s, right 1s'
+ },
+ slideTransHorRight: {
+ type: String,
+ default: 'left 1s, right 0.5s'
+ },
+ sliderBorderColor: {
+ type: String,
+ default: '0'
+ },
+ sliderZindex: {
+ type: String,
+ },
+ sliderTop: {
+ type: String,
+ default: '46px'
+ },
+ sliderHeight: {
+ type: String,
+ default: '2px'
+ },
vertical: Boolean,
right: Boolean,
center: Boolean,
centerActive: Boolean,
icon: Boolean,
alignWithTitle: Boolean,
+ showSlider: {
+ type: Boolean,
+ default: true
+ }
},
setup(props, context) {
const model = getVModel(props, context);
-
if (!model.value) {
model.value = props.items.find(item => !item.disabled);
}
provide('model', model);
- provide('items', props.items)
+ provide('items', props.items);
const { getColorType, convertColorClass } = colorHandler();
@@ -70,26 +96,28 @@
const sliderStyles = reactive({
'width': '90px',
- 'height': '2px',
- 'top': '46px',
+ 'height': props.sliderHeight,
+ 'top': props.sliderTop,
'right': 'auto',
'left': '0',
'bottom': 'auto',
'background-color': 'currentColor',
- 'transition': 'left 1s, right 0.5s'
+ 'border-radius': props.sliderBorderColor,
+ 'transition': 'left 1s, right 0.5s',
+ 'z-index': props.sliderZindex ? props.sliderZindex : '0'
});
function calculateSliderStyle() {
- if (!itemsRef.value) return
- const children = itemsRef.value.querySelector('.g-slide-group__content').children
+ if (!itemsRef.value) return;
+ const children = itemsRef.value.querySelector('.g-slide-group__content').children;
const activeTab = find(children, i => i.classList.contains('g-tab__active'));
sliderStyles.width = convertToUnit(props.vertical ? props.sliderSize : 'auto');
- sliderStyles.height = convertToUnit(props.vertical ? activeTab.offsetHeight : props.sliderSize);
- sliderStyles.top = convertToUnit(props.vertical ? activeTab.offsetTop : (activeTab.offsetHeight - props.sliderSize));
+ sliderStyles.height = convertToUnit(props.vertical ? activeTab.offsetHeight : (props.sliderHeight ? props.sliderHeight : props.sliderSize));
+ sliderStyles.top = convertToUnit(props.vertical ? activeTab.offsetTop : (props.sliderTop ? props.sliderTop : (activeTab.offsetHeight - props.sliderSize)));
- const parent = context.refs.itemsRef.querySelector('.g-slide-group__content')
- sliderStyles.left = convertToUnit(activeTab.offsetLeft)
- sliderStyles.right = convertToUnit(parent.offsetWidth - activeTab.offsetWidth - activeTab.offsetLeft)
+ const parent = context.refs.itemsRef.querySelector('.g-slide-group__content');
+ sliderStyles.left = convertToUnit(activeTab.offsetLeft);
+ sliderStyles.right = convertToUnit(parent.offsetWidth - activeTab.offsetWidth - activeTab.offsetLeft);
sliderStyles['background-color'] = props.sliderColor
? (getColorType(props.sliderColor) === 'style'
@@ -98,8 +126,18 @@
: 'currentColor';
}
- const itemsRef = ref(null)
- watch(() => [itemsRef.value, props.grow, props.right, props.center, props.vertical, props.sliderSize, props.sliderColor, props.alignWithTitle, props.icon], () => {
+ const itemsRef = ref(null);
+ watch(() => [
+ itemsRef.value,
+ props.grow,
+ props.right,
+ props.center,
+ props.vertical,
+ props.sliderSize,
+ props.sliderColor,
+ props.alignWithTitle,
+ props.icon
+ ], () => {
calculateSliderStyle();
});
@@ -121,53 +159,57 @@
sliderStyles.height = 'auto';
} else {
if (activeTab.offsetLeft < +sliderStyles.left.replace('px', '')) {
- sliderStyles['transition'] = 'left 0.5s, right 1s';
+ sliderStyles['transition'] = props.slideTransHorLeft;
} else {
- sliderStyles['transition'] = 'left 1s, right 0.5s';
+ sliderStyles['transition'] = props.slideTransHorRight;
}
sliderStyles.width = 'auto';
- sliderStyles.right = convertToUnit(parent.offsetWidth - activeTab.offsetWidth - activeTab.offsetLeft)
- sliderStyles.left = convertToUnit(activeTab.offsetLeft)
+ sliderStyles.right = convertToUnit(parent.offsetWidth - activeTab.offsetWidth - activeTab.offsetLeft);
+ sliderStyles.left = convertToUnit(activeTab.offsetLeft);
}
}, { lazy: true });
const fullTitle = computed(() => {
const noTitle = find(props.items, item => item.title === undefined);
- console.warn(`Required prop title for tab`)
+ console.warn(`Required prop title for tab`);
return !noTitle;
});
- const genWrapper = () =>
-
-
- {genTabsBar()}
+ const genWrapper = () =>
+
+
-
- {context.slots.default && context.slots.default()}
-
+ {context.slots.default && context.slots.default()}
+ ;
const genTabIcon = (item) => {
if (props.icon && item.icon) return
{item.icon}
- }
+ };
const genTabs = () => {
return props.items.map((item, index) => (
- (context.slots.tab && context.slots.tab({ item, index }))
- ||
- {genTabIcon(item)}
- {item.title}
-
- ))
- }
-
- const genTabSlider = () =>
+ (context.slots.tab && context.slots.tab({ item, index })) ||
+
+ {genTabIcon(item)}
+ {item.title}
+
+ )
+ )
+ };
+
+ const genTabSlider = () =>
+
+
;
const genTabsBar = () => {
- if (!fullTitle) return
+ if (!fullTitle) return;
const slideGroupData = {
props: {
centerActive: props.centerActive,
@@ -177,13 +219,12 @@
'click:prev': calculateSliderStyle,
'click:next': calculateSliderStyle
},
- slot: 'tabs'
- }
+ };
return
- {genTabs()}
- {genTabSlider()}
-
- }
+ {genTabs()}
+ {props.showSlider && genTabSlider()}
+
+ };
return () =>
diff --git a/src/components/GTabs/__story__/Tab.stories.js b/src/components/GTabs/__story__/Tab.stories.js
index 6c82ec05..fbcee6df 100644
--- a/src/components/GTabs/__story__/Tab.stories.js
+++ b/src/components/GTabs/__story__/Tab.stories.js
@@ -19,7 +19,7 @@ export const tab = () => ({
return {
items: [
{ title: 'Tab 1', icon: 'home' },
- { title: 'Tab 2', icon: 'group' },
+ { title: 'Tab 232233', icon: 'group' },
{ title: 'Tab 3', icon: 'notifications' },
{ title: 'Tab 4', icon: 'block', disabled: true },
{ title: 'Tab 5', icon: 'phone' },