fit2cloud-ui-plus 1.0.9 → 1.1.0
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/lib/fit2cloud-ui-plus.es.js +547 -72
- package/lib/fit2cloud-ui-plus.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/ steps/FuHorizontalNavigation.vue +26 -0
- package/src/components/ steps/FuHorizontalSteps.vue +103 -0
- package/src/components/ steps/FuStep.vue +11 -0
- package/src/components/ steps/FuStepButton.vue +8 -0
- package/src/components/ steps/FuSteps.vue +43 -0
- package/src/components/ steps/FuStepsFooter.ts +75 -0
- package/src/components/ steps/FuVerticalNavigation.vue +41 -0
- package/src/components/ steps/FuVerticalSteps.vue +94 -0
- package/src/components/ steps/Stepper.ts +171 -0
- package/src/components/ steps/index.ts +10 -0
- package/src/components/ steps/types.ts +29 -0
- package/types/examples/pages/steps/attributes.d.ts +63 -0
- package/types/examples/pages/steps/demo/BaseSteps.vue.d.ts +2 -0
- package/types/examples/pages/steps/demo/CustomFooterDemo.vue.d.ts +2 -0
- package/types/examples/pages/steps/demo/SettingFooterDemo.vue.d.ts +2 -0
- package/types/examples/pages/steps/demo/StepsHooksDemo.vue.d.ts +2 -0
- package/types/examples/pages/steps/demo/VerticalSteps.vue.d.ts +2 -0
- package/types/examples/pages/steps/index.vue.d.ts +2 -0
- package/types/src/components/ steps/FuHorizontalNavigation.vue.d.ts +13 -0
- package/types/src/components/ steps/FuHorizontalSteps.vue.d.ts +6 -0
- package/types/src/components/ steps/FuStep.vue.d.ts +2 -0
- package/types/src/components/ steps/FuStepButton.vue.d.ts +2 -0
- package/types/src/components/ steps/FuSteps.vue.d.ts +12 -0
- package/types/src/components/ steps/FuStepsFooter.d.ts +6 -0
- package/types/src/components/ steps/FuVerticalNavigation.vue.d.ts +14 -0
- package/types/src/components/ steps/FuVerticalSteps.vue.d.ts +6 -0
- package/types/src/components/ steps/Stepper.d.ts +39 -0
- package/types/src/components/ steps/index.d.ts +2 -0
- package/types/src/components/ steps/types.d.ts +27 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ref, watch, defineComponent, h, computed, Transition, provide } from 'vue';
|
|
3
|
+
import FuHorizontalNavigation from './FuHorizontalNavigation.vue';
|
|
4
|
+
import FuStepsFooter from './FuStepsFooter';
|
|
5
|
+
import { Step, Stepper } from './Stepper';
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'FuHorizontalSteps',
|
|
9
|
+
components: {
|
|
10
|
+
FuHorizontalNavigation,
|
|
11
|
+
FuStepsFooter,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
emits: ['change'],
|
|
15
|
+
|
|
16
|
+
setup(_, { attrs, slots, emit, expose }) {
|
|
17
|
+
const stepper: any = ref(new Stepper());
|
|
18
|
+
stepper.value?.activeSet.add(0);
|
|
19
|
+
|
|
20
|
+
watch(
|
|
21
|
+
() => stepper.value.index,
|
|
22
|
+
(value) => {
|
|
23
|
+
emit('change', stepper.value.steps[value]);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const heightStyle = computed(() => {
|
|
28
|
+
return { height: parseInt(stepper.value?.height) + 'px' || 'auto' };
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function active(index: number) {
|
|
32
|
+
stepper.value?.active(index);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function disable(index: number) {
|
|
36
|
+
return !stepper.value?.isActive(index);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function next() {
|
|
40
|
+
stepper.value.next();
|
|
41
|
+
}
|
|
42
|
+
function prev() {
|
|
43
|
+
stepper.value.prev();
|
|
44
|
+
}
|
|
45
|
+
function $func(name: any) {
|
|
46
|
+
emit(name);
|
|
47
|
+
}
|
|
48
|
+
provide('stepper', stepper.value);
|
|
49
|
+
|
|
50
|
+
expose({
|
|
51
|
+
next,
|
|
52
|
+
prev,
|
|
53
|
+
active,
|
|
54
|
+
});
|
|
55
|
+
return () => {
|
|
56
|
+
let steps: any = [];
|
|
57
|
+
if (slots.default?.()) {
|
|
58
|
+
slots.default?.().forEach((node, index) => {
|
|
59
|
+
const options = {
|
|
60
|
+
index: index,
|
|
61
|
+
...node.props,
|
|
62
|
+
};
|
|
63
|
+
const step = new Step(options);
|
|
64
|
+
steps.push(step);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
stepper.value.steps = steps;
|
|
68
|
+
|
|
69
|
+
stepper.value = Object.assign(stepper.value, attrs);
|
|
70
|
+
return h(
|
|
71
|
+
'div',
|
|
72
|
+
{
|
|
73
|
+
class: ['fu-steps', 'fu-steps--horizontal'],
|
|
74
|
+
},
|
|
75
|
+
[
|
|
76
|
+
h(FuHorizontalNavigation, {
|
|
77
|
+
stepper: stepper.value,
|
|
78
|
+
steps: steps,
|
|
79
|
+
disable: disable,
|
|
80
|
+
onActive: active,
|
|
81
|
+
}),
|
|
82
|
+
h(
|
|
83
|
+
'div',
|
|
84
|
+
{ class: 'fu-steps__wrapper' },
|
|
85
|
+
h(
|
|
86
|
+
'div',
|
|
87
|
+
{ class: 'fu-steps__container', style: heightStyle.value },
|
|
88
|
+
|
|
89
|
+
h(Transition, { name: 'carousel', mode: 'out-in', tag: 'p' }, () =>
|
|
90
|
+
slots.default?.().map((item: any, index) => {
|
|
91
|
+
item['key'] = index;
|
|
92
|
+
return stepper.value.index === index && item;
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
),
|
|
97
|
+
h('div', { class: 'fu-steps__footer' }, slots.footer?.() || h(FuStepsFooter, { onStepperFn: $func })),
|
|
98
|
+
]
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fu-step" v-loading="loading">
|
|
3
|
+
<slot/>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script lang="ts" setup>
|
|
7
|
+
import { inject, computed } from 'vue'
|
|
8
|
+
defineOptions({ name: "FuStep" });
|
|
9
|
+
const stepper: any = inject('stepper')
|
|
10
|
+
const loading = computed(() => stepper.isLoading || false)
|
|
11
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, h, ref } from 'vue';
|
|
3
|
+
import FuHorizontalSteps from './FuHorizontalSteps.vue';
|
|
4
|
+
import FuVerticalSteps from './FuVerticalSteps.vue';
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'FuSteps',
|
|
8
|
+
components: {
|
|
9
|
+
FuHorizontalSteps,
|
|
10
|
+
FuVerticalSteps,
|
|
11
|
+
},
|
|
12
|
+
emits: ['change'],
|
|
13
|
+
props: ['direction'],
|
|
14
|
+
setup(props, { attrs, slots, emit, expose }) {
|
|
15
|
+
const { direction } = props;
|
|
16
|
+
const FuSteps = ref<typeof FuHorizontalSteps | typeof FuVerticalSteps>();
|
|
17
|
+
function next() {
|
|
18
|
+
FuSteps.value?.next();
|
|
19
|
+
}
|
|
20
|
+
function prev() {
|
|
21
|
+
FuSteps.value?.prev();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function active(index: number) {
|
|
25
|
+
FuSteps.value?.active(index);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function handleChange({ id, title, index }: any) {
|
|
29
|
+
emit('change', { id, title, index });
|
|
30
|
+
}
|
|
31
|
+
expose({
|
|
32
|
+
next,
|
|
33
|
+
prev,
|
|
34
|
+
active,
|
|
35
|
+
});
|
|
36
|
+
if (direction === 'vertical') {
|
|
37
|
+
return () => h(FuVerticalSteps, { ref: FuSteps, onChange: handleChange, ...attrs }, slots);
|
|
38
|
+
} else {
|
|
39
|
+
return () => h(FuHorizontalSteps, { ref: FuSteps, onChange: handleChange, ...attrs }, slots);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defineComponent, h, inject, ref, computed } from "vue";
|
|
2
|
+
import FuStepButton from "./FuStepButton.vue";
|
|
3
|
+
export default defineComponent({
|
|
4
|
+
name: "FuStepsFooter",
|
|
5
|
+
components: {
|
|
6
|
+
FuStepButton,
|
|
7
|
+
},
|
|
8
|
+
emits: ["stepperFn"],
|
|
9
|
+
setup(props, { emit }) {
|
|
10
|
+
const stepper: any = inject("stepper");
|
|
11
|
+
const disabledButton = ref(false);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const isFirst = computed(() => {
|
|
15
|
+
return stepper.isFirst(stepper.index);
|
|
16
|
+
});
|
|
17
|
+
const isLast = computed(() => {
|
|
18
|
+
return stepper.isLast(stepper.index);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const showCancel = computed(() => {
|
|
22
|
+
return stepper.showCancel !== false;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const disabled = computed(() => {
|
|
26
|
+
return stepper?.isLoading || disabledButton.value;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
function clickHandle(fnName: string) {
|
|
30
|
+
stepper[fnName] ? stepper[fnName]() : emit("stepperFn", fnName);
|
|
31
|
+
disabledButton.value = true;
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
disabledButton.value = false;
|
|
34
|
+
}, 500);
|
|
35
|
+
}
|
|
36
|
+
const button = (value: string) => {
|
|
37
|
+
return h(
|
|
38
|
+
FuStepButton,
|
|
39
|
+
{
|
|
40
|
+
disabled: disabled.value,
|
|
41
|
+
size: stepper.buttonSize,
|
|
42
|
+
onClick: () => clickHandle(value),
|
|
43
|
+
},
|
|
44
|
+
() => stepper[`${value}ButtonText`]
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
return () =>
|
|
48
|
+
h(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
class: `fu-steps__footer--${stepper.footerAlign}`,
|
|
52
|
+
},
|
|
53
|
+
[
|
|
54
|
+
h(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
class: "fu-steps__footer--block",
|
|
58
|
+
style: "margin-right:10px",
|
|
59
|
+
},
|
|
60
|
+
[showCancel.value && button("onCancel")]
|
|
61
|
+
),
|
|
62
|
+
h(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
class: "fu-steps__footer--block",
|
|
66
|
+
},
|
|
67
|
+
[
|
|
68
|
+
!isFirst.value && button("prev"),
|
|
69
|
+
isLast.value ? button("onFinish") : button("next"),
|
|
70
|
+
]
|
|
71
|
+
),
|
|
72
|
+
]
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-steps :active="active" v-bind="stepper" direction="vertical" >
|
|
3
|
+
<el-step v-for="(step, i) in steps" :key="i" v-bind="step" @click="click(i)"
|
|
4
|
+
:class="disable!(i) && 'fu-step--disable'">
|
|
5
|
+
<template #description>
|
|
6
|
+
<span>{{ step.description }}</span>
|
|
7
|
+
<el-collapse-transition>
|
|
8
|
+
<div class="fu-steps__container" v-if="i === active" :style="heightStyle">
|
|
9
|
+
<slot v-bind:step="step"></slot>
|
|
10
|
+
</div>
|
|
11
|
+
</el-collapse-transition>
|
|
12
|
+
</template>
|
|
13
|
+
</el-step>
|
|
14
|
+
</el-steps>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import type { PropType } from 'vue'
|
|
19
|
+
import { computed } from "vue";
|
|
20
|
+
import {Step} from "@/components/ steps/Stepper";
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
stepper: Object,
|
|
23
|
+
steps: Array as PropType<Step[]>,
|
|
24
|
+
disable: Function as PropType<(index: number) => boolean>
|
|
25
|
+
})
|
|
26
|
+
const emit = defineEmits(["active"])
|
|
27
|
+
|
|
28
|
+
const active = computed(() => {
|
|
29
|
+
return props.stepper!.index
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const heightStyle = computed(() => {
|
|
33
|
+
return {
|
|
34
|
+
height: parseInt(props.stepper?.height) + "px" || "auto",
|
|
35
|
+
};
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
function click(index: number) {
|
|
39
|
+
!props.disable!(index) && emit("active", index);
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ref, watch, defineComponent, h,provide } from 'vue'
|
|
3
|
+
import FuVerticalNavigation from "./FuVerticalNavigation.vue";
|
|
4
|
+
import FuStepsFooter from "./FuStepsFooter";
|
|
5
|
+
import { Stepper, Step } from "./Stepper";
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: "FuVerticalSteps",
|
|
9
|
+
components: { FuVerticalNavigation, FuStepsFooter },
|
|
10
|
+
|
|
11
|
+
emits: ['change'],
|
|
12
|
+
|
|
13
|
+
setup(_, { attrs, slots, emit, expose }) {
|
|
14
|
+
const stepper = ref(new Stepper)
|
|
15
|
+
stepper.value.activeSet.add(0)
|
|
16
|
+
watch(() => stepper.value.index, (value) => {
|
|
17
|
+
emit("change", stepper.value.steps[value]);
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
function active(index: number) {
|
|
21
|
+
stepper.value.active(index);
|
|
22
|
+
}
|
|
23
|
+
function disable(index: number) {
|
|
24
|
+
return !stepper.value.isActive(index);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function next() {
|
|
28
|
+
stepper.value.next();
|
|
29
|
+
}
|
|
30
|
+
function prev() {
|
|
31
|
+
stepper.value.prev();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function $func(name: any) {
|
|
35
|
+
emit(name);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
provide('stepper', stepper.value)
|
|
39
|
+
|
|
40
|
+
expose({
|
|
41
|
+
next,
|
|
42
|
+
prev,
|
|
43
|
+
active
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return () => {
|
|
47
|
+
let currentNode: any;
|
|
48
|
+
let steps: any = [];
|
|
49
|
+
if (slots.default?.()) {
|
|
50
|
+
slots.default?.().forEach((node, index) => {
|
|
51
|
+
const options = {
|
|
52
|
+
index: index,
|
|
53
|
+
...node.props,
|
|
54
|
+
};
|
|
55
|
+
const step = new Step(options);
|
|
56
|
+
steps.push(step);
|
|
57
|
+
if (stepper.value.isCurrent(index)) {
|
|
58
|
+
currentNode = node;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
stepper.value.steps = steps;
|
|
63
|
+
stepper.value = Object.assign(stepper.value, attrs);
|
|
64
|
+
|
|
65
|
+
return h(
|
|
66
|
+
'div',
|
|
67
|
+
{
|
|
68
|
+
class: ['fu-steps', 'fu-steps--vertical']
|
|
69
|
+
},
|
|
70
|
+
[
|
|
71
|
+
h(
|
|
72
|
+
FuVerticalNavigation,
|
|
73
|
+
{
|
|
74
|
+
stepper: stepper.value,
|
|
75
|
+
steps: steps,
|
|
76
|
+
disable: disable,
|
|
77
|
+
onActive: active
|
|
78
|
+
},
|
|
79
|
+
()=> currentNode
|
|
80
|
+
),
|
|
81
|
+
h(
|
|
82
|
+
'div',
|
|
83
|
+
{ class: 'fu-steps__footer' },
|
|
84
|
+
h(FuStepsFooter, { onStepperFn: $func })
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
})
|
|
93
|
+
</script>
|
|
94
|
+
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {useLocale} from '@/hooks';
|
|
2
|
+
|
|
3
|
+
const {t} = useLocale();
|
|
4
|
+
import {StepperOptions, StepOptions} from './types';
|
|
5
|
+
|
|
6
|
+
export class Stepper implements StepperOptions {
|
|
7
|
+
steps: [Step];
|
|
8
|
+
index: number;
|
|
9
|
+
activeSet: any;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
onCancelButtonText: string;
|
|
12
|
+
onFinishButtonText: string;
|
|
13
|
+
prevButtonText: string;
|
|
14
|
+
nextButtonText: string;
|
|
15
|
+
buttonSize: string;
|
|
16
|
+
footerAlign: string;
|
|
17
|
+
showCancel: any;
|
|
18
|
+
beforeActive: Function;
|
|
19
|
+
beforeLeave: Function;
|
|
20
|
+
height: string;
|
|
21
|
+
|
|
22
|
+
constructor(options?: StepperOptions) {
|
|
23
|
+
options = options || ({} as StepperOptions);
|
|
24
|
+
// 所有步骤节点(Step对象数组)
|
|
25
|
+
this.steps = options.steps;
|
|
26
|
+
// 正在执行的节点的索引
|
|
27
|
+
this.index = options.index === undefined ? 0 : options.index;
|
|
28
|
+
// 激活过的节点的索引
|
|
29
|
+
this.activeSet = new Set();
|
|
30
|
+
// loading状态
|
|
31
|
+
this.isLoading = options?.isLoading || false;
|
|
32
|
+
// footer 属性
|
|
33
|
+
this.onCancelButtonText = options.onCancelButtonText || t('fu.steps.cancel');
|
|
34
|
+
this.onFinishButtonText = options.onFinishButtonText || t('fu.steps.finish');
|
|
35
|
+
this.prevButtonText = options.prevButtonText || t('fu.steps.prev');
|
|
36
|
+
this.nextButtonText = options.nextButtonText || t('fu.steps.next');
|
|
37
|
+
this.buttonSize = options.buttonSize || 'default';
|
|
38
|
+
this.footerAlign = options.footerAlign || 'flex';
|
|
39
|
+
// 是否显示取消按钮
|
|
40
|
+
this.showCancel = options.showCancel === undefined ? false : options.showCancel;
|
|
41
|
+
// 激活前钩子
|
|
42
|
+
this.beforeActive = options.beforeActive;
|
|
43
|
+
// 离开前钩子
|
|
44
|
+
this.beforeLeave = options.beforeLeave;
|
|
45
|
+
// 高度
|
|
46
|
+
this.height = options.height;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// index是否为第一个节点
|
|
50
|
+
isFirst(index: number): boolean {
|
|
51
|
+
return index === 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// index是否为最后一个节点
|
|
55
|
+
isLast(index: number): boolean {
|
|
56
|
+
return index === this.steps.length - 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// index的节点是否激活过
|
|
60
|
+
isActive(index: number): boolean {
|
|
61
|
+
return this.activeSet.has(index);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// index的节点是否为正在激活的节点
|
|
65
|
+
isCurrent(index: number): boolean {
|
|
66
|
+
return this.index === index;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 激活
|
|
70
|
+
async active(index: number) {
|
|
71
|
+
// 在节点范围内,并且不等于当前节点
|
|
72
|
+
const isValid: boolean = index >= 0 && index < this.steps.length && this.index !== index;
|
|
73
|
+
const forward: boolean = index > this.index;
|
|
74
|
+
if (isValid) {
|
|
75
|
+
// 离开前钩子返回false,则不执行激活
|
|
76
|
+
if (await (this.executeBeforeLeave(this.index, forward)) !== false) {
|
|
77
|
+
// 激活前钩子返回false,则不执行激活
|
|
78
|
+
if (await (this.executeBeforeActive(index, forward)) !== false) {
|
|
79
|
+
// 激活
|
|
80
|
+
this.index = index;
|
|
81
|
+
this.activeSet.add(index);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 反激活
|
|
88
|
+
// inactive(index: number): void {
|
|
89
|
+
// this.activeSet.delete(index);
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
// 下一步
|
|
93
|
+
next(): void {
|
|
94
|
+
if (!this.isLast(this.index)) {
|
|
95
|
+
this.active(this.index + 1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 上一步
|
|
100
|
+
prev(): void {
|
|
101
|
+
if (!this.isFirst(this.index)) {
|
|
102
|
+
this.active(this.index - 1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 使用索引获取Step对象
|
|
107
|
+
getStep(index: number): Step | undefined {
|
|
108
|
+
if (this.steps && this.steps.length > index) {
|
|
109
|
+
return this.steps[index];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 使用ID获取节点索引
|
|
114
|
+
// getIndex(id: string): number {
|
|
115
|
+
// if (this.steps) {
|
|
116
|
+
// for (let i = 0; i < this.steps.length; i++) {
|
|
117
|
+
// let step: any = this.steps[i];
|
|
118
|
+
// if (id === step.id) {
|
|
119
|
+
// return i;
|
|
120
|
+
// }
|
|
121
|
+
// }
|
|
122
|
+
// }
|
|
123
|
+
// return -1;
|
|
124
|
+
// }
|
|
125
|
+
|
|
126
|
+
executeBeforeLeave(index: number, forward: boolean) {
|
|
127
|
+
const step: any = this.getStep(index);
|
|
128
|
+
if (step.beforeLeave) {
|
|
129
|
+
return step.beforeLeave(step, forward);
|
|
130
|
+
}
|
|
131
|
+
if (this.beforeLeave) {
|
|
132
|
+
return this.beforeLeave(step, forward);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
executeBeforeActive(index: number, forward: boolean) {
|
|
137
|
+
const step: any = this.getStep(index);
|
|
138
|
+
if (step.beforeActive) {
|
|
139
|
+
return step.beforeActive(step, forward);
|
|
140
|
+
}
|
|
141
|
+
if (this.beforeActive) {
|
|
142
|
+
return this.beforeActive(step, forward);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export class Step implements StepOptions {
|
|
148
|
+
id?: string;
|
|
149
|
+
index: number;
|
|
150
|
+
beforeActive?: Function;
|
|
151
|
+
beforeLeave?: Function;
|
|
152
|
+
title?: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
icon?: string;
|
|
155
|
+
status?: string;
|
|
156
|
+
|
|
157
|
+
constructor(options?: StepOptions) {
|
|
158
|
+
options = options || ({} as StepOptions);
|
|
159
|
+
this.id = options.id;
|
|
160
|
+
this.index = options.index;
|
|
161
|
+
// 激活前钩子
|
|
162
|
+
this.beforeActive = options.beforeActive;
|
|
163
|
+
// 离开前钩子
|
|
164
|
+
this.beforeLeave = options.beforeLeave;
|
|
165
|
+
// el-step 属性
|
|
166
|
+
this.title = options.title;
|
|
167
|
+
this.description = options.description;
|
|
168
|
+
this.icon = options.icon;
|
|
169
|
+
this.status = options.status;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import FuSteps from "./FuSteps.vue";
|
|
2
|
+
import FuStep from "./FuStep.vue";
|
|
3
|
+
|
|
4
|
+
import type { App } from "vue";
|
|
5
|
+
FuSteps.install = (app: App): void => {
|
|
6
|
+
app.component(FuStep.name, FuStep);
|
|
7
|
+
app.component(FuSteps.name, FuSteps);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default FuSteps;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {Step} from "@/components/ steps/Stepper";
|
|
2
|
+
|
|
3
|
+
export interface StepperOptions {
|
|
4
|
+
steps: [Step]
|
|
5
|
+
index: number
|
|
6
|
+
activeSet: any
|
|
7
|
+
isLoading?: boolean
|
|
8
|
+
onCancelButtonText: string
|
|
9
|
+
onFinishButtonText: string
|
|
10
|
+
prevButtonText: string
|
|
11
|
+
nextButtonText: string
|
|
12
|
+
buttonSize: string
|
|
13
|
+
footerAlign: string
|
|
14
|
+
showCancel: any
|
|
15
|
+
beforeActive: Function
|
|
16
|
+
beforeLeave: Function
|
|
17
|
+
height: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface StepOptions {
|
|
21
|
+
id?: string
|
|
22
|
+
index: number
|
|
23
|
+
beforeActive?: Function
|
|
24
|
+
beforeLeave?: Function
|
|
25
|
+
title?: string
|
|
26
|
+
description?: string
|
|
27
|
+
icon?: string
|
|
28
|
+
status?: string
|
|
29
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 说明文档
|
|
3
|
+
* @name 表格名称
|
|
4
|
+
* @header 表格头部参数,任意定义
|
|
5
|
+
* @table table内容,字段要和header定义的属性保持一直
|
|
6
|
+
* @children 多表使用
|
|
7
|
+
*/
|
|
8
|
+
export declare const attributes: {
|
|
9
|
+
name: string;
|
|
10
|
+
children: ({
|
|
11
|
+
name: string;
|
|
12
|
+
header: {
|
|
13
|
+
prop: string;
|
|
14
|
+
desc: string;
|
|
15
|
+
type: string;
|
|
16
|
+
enum: string;
|
|
17
|
+
default: string;
|
|
18
|
+
event?: undefined;
|
|
19
|
+
value?: undefined;
|
|
20
|
+
name?: undefined;
|
|
21
|
+
};
|
|
22
|
+
table: {
|
|
23
|
+
prop: string;
|
|
24
|
+
desc: string;
|
|
25
|
+
type: string;
|
|
26
|
+
enum: string;
|
|
27
|
+
default: string;
|
|
28
|
+
}[];
|
|
29
|
+
} | {
|
|
30
|
+
name: string;
|
|
31
|
+
header: {
|
|
32
|
+
event: string;
|
|
33
|
+
desc: string;
|
|
34
|
+
value: string;
|
|
35
|
+
prop?: undefined;
|
|
36
|
+
type?: undefined;
|
|
37
|
+
enum?: undefined;
|
|
38
|
+
default?: undefined;
|
|
39
|
+
name?: undefined;
|
|
40
|
+
};
|
|
41
|
+
table: {
|
|
42
|
+
event: string;
|
|
43
|
+
desc: string;
|
|
44
|
+
value: string;
|
|
45
|
+
}[];
|
|
46
|
+
} | {
|
|
47
|
+
name: string;
|
|
48
|
+
header: {
|
|
49
|
+
name: string;
|
|
50
|
+
desc: string;
|
|
51
|
+
prop?: undefined;
|
|
52
|
+
type?: undefined;
|
|
53
|
+
enum?: undefined;
|
|
54
|
+
default?: undefined;
|
|
55
|
+
event?: undefined;
|
|
56
|
+
value?: undefined;
|
|
57
|
+
};
|
|
58
|
+
table: {
|
|
59
|
+
name: string;
|
|
60
|
+
desc: string;
|
|
61
|
+
}[];
|
|
62
|
+
})[];
|
|
63
|
+
}[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|