qidian-vue-ui 1.7.0 → 1.8.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.
@@ -1,59 +1,58 @@
1
- .qd-steps[data-v-3fae5c44] {
1
+ .qd-steps[data-v-b9e61b9f] {
2
2
  display: grid;
3
3
  gap: var(--td-comp-paddingTB-xs);
4
4
  }
5
- .qd-steps__nav[data-v-3fae5c44] {
5
+ .qd-steps__nav[data-v-b9e61b9f] {
6
6
  display: flex;
7
7
  align-items: center;
8
8
  width: 100%;
9
9
  }
10
- .qd-steps__phases[data-v-3fae5c44] {
10
+ .qd-steps__phases[data-v-b9e61b9f] {
11
11
  display: flex;
12
12
  align-items: center;
13
13
  flex-wrap: wrap;
14
14
  }
15
- .qd-steps__phase[data-v-3fae5c44] {
15
+ .qd-steps__phase[data-v-b9e61b9f] {
16
16
  display: inline-flex;
17
17
  align-items: center;
18
18
  gap: var(--td-size-3);
19
19
  padding: var(--td-size-1) var(--td-comp-paddingLR-s) var(--td-size-1) var(--td-comp-paddingLR-xs);
20
20
  border-radius: var(--td-radius-round);
21
21
  transition: all 0.15s;
22
- }
23
- .qd-steps__phase--clickable[data-v-3fae5c44] {
24
22
  cursor: pointer;
25
23
  }
26
- .qd-steps__phase--done[data-v-3fae5c44] {
24
+ .qd-steps__phase--done[data-v-b9e61b9f] {
27
25
  color: var(--td-text-color-secondary);
28
26
  }
29
- .qd-steps__phase--done .qd-steps__phase-icon[data-v-3fae5c44] {
27
+ .qd-steps__phase--done .qd-steps__phase-icon[data-v-b9e61b9f] {
30
28
  background-color: var(--td-success-color);
31
29
  color: var(--td-text-color-anti);
32
30
  border-color: transparent;
33
31
  }
34
- .qd-steps__phase--done .qd-steps__phase-name[data-v-3fae5c44] {
32
+ .qd-steps__phase--done .qd-steps__phase-name[data-v-b9e61b9f] {
35
33
  color: var(--td-text-color-secondary);
36
34
  }
37
- .qd-steps__phase--done.qd-steps__phase--clickable[data-v-3fae5c44]:hover {
35
+ .qd-steps__phase--done[data-v-b9e61b9f]:hover {
38
36
  background-color: var(--td-bg-color-container-hover);
39
37
  }
40
- .qd-steps__phase--active[data-v-3fae5c44] {
38
+ .qd-steps__phase--active[data-v-b9e61b9f] {
41
39
  background-color: var(--td-brand-color-light);
42
40
  }
43
- .qd-steps__phase--active .qd-steps__phase-icon[data-v-3fae5c44] {
41
+ .qd-steps__phase--active .qd-steps__phase-icon[data-v-b9e61b9f] {
44
42
  background-color: var(--td-brand-color);
45
43
  color: var(--td-text-color-anti);
46
44
  border-color: transparent;
47
45
  box-shadow: var(--td-shadow-1);
48
46
  }
49
- .qd-steps__phase--active .qd-steps__phase-name[data-v-3fae5c44] {
47
+ .qd-steps__phase--active .qd-steps__phase-name[data-v-b9e61b9f] {
50
48
  color: var(--td-text-color-brand);
51
49
  font-weight: 700;
52
50
  }
53
- .qd-steps__phase--pending[data-v-3fae5c44] {
51
+ .qd-steps__phase--pending[data-v-b9e61b9f] {
54
52
  opacity: 0.6;
53
+ cursor: default;
55
54
  }
56
- .qd-steps__phase-icon[data-v-3fae5c44] {
55
+ .qd-steps__phase-icon[data-v-b9e61b9f] {
57
56
  width: calc(var(--td-comp-size-xxxs) + var(--td-size-1));
58
57
  height: calc(var(--td-comp-size-xxxs) + var(--td-size-1));
59
58
  border-radius: var(--td-radius-circle);
@@ -69,27 +68,27 @@
69
68
  border: calc(var(--td-size-1) / 2) solid var(--td-component-stroke);
70
69
  transition: all 0.15s;
71
70
  }
72
- .qd-steps__phase-name[data-v-3fae5c44] {
71
+ .qd-steps__phase-name[data-v-b9e61b9f] {
73
72
  font-size: var(--td-font-size-body-small);
74
73
  color: var(--td-text-color-placeholder);
75
74
  font-weight: 600;
76
75
  white-space: nowrap;
77
76
  transition: color 0.15s;
78
77
  }
79
- .qd-steps__separator[data-v-3fae5c44] {
78
+ .qd-steps__separator[data-v-b9e61b9f] {
80
79
  color: var(--td-text-color-placeholder);
81
80
  margin: 0 var(--td-comp-margin-s);
82
81
  font-size: var(--td-font-size-body-large);
83
82
  line-height: 1;
84
83
  transform: translateY(calc(var(--td-size-1) / -2));
85
84
  }
86
- .qd-steps__separator--done[data-v-3fae5c44] {
85
+ .qd-steps__separator--done[data-v-b9e61b9f] {
87
86
  color: var(--td-success-color);
88
87
  }
89
- .qd-steps__divider[data-v-3fae5c44] {
88
+ .qd-steps__divider[data-v-b9e61b9f] {
90
89
  border-top: calc(var(--td-size-1) / 2) solid var(--td-border-level-1-color);
91
90
  }
92
- .qd-steps__substeps[data-v-3fae5c44] {
91
+ .qd-steps__substeps[data-v-b9e61b9f] {
93
92
  display: flex;
94
93
  align-items: center;
95
94
  justify-content: space-between;
@@ -98,69 +97,68 @@
98
97
  margin-top: 0;
99
98
  padding-bottom: 0;
100
99
  }
101
- .qd-steps__substep-list[data-v-3fae5c44] {
100
+ .qd-steps__substep-list[data-v-b9e61b9f] {
102
101
  display: flex;
103
102
  align-items: center;
104
103
  flex-wrap: wrap;
105
104
  gap: var(--td-size-1);
106
105
  }
107
- .qd-steps__substep[data-v-3fae5c44] {
106
+ .qd-steps__substep[data-v-b9e61b9f] {
108
107
  display: inline-flex;
109
108
  align-items: center;
110
109
  border-radius: var(--td-radius-medium);
111
110
  padding: var(--td-size-2) var(--td-comp-paddingLR-s);
112
111
  gap: var(--td-size-3);
113
112
  transition: all 0.12s;
114
- }
115
- .qd-steps__substep--clickable[data-v-3fae5c44] {
116
113
  cursor: pointer;
117
114
  }
118
- .qd-steps__substep[data-v-3fae5c44]:hover {
115
+ .qd-steps__substep[data-v-b9e61b9f]:hover {
119
116
  background-color: var(--td-bg-color-container-hover);
120
117
  }
121
- .qd-steps__substep:hover .qd-steps__substep-name[data-v-3fae5c44] {
118
+ .qd-steps__substep:hover .qd-steps__substep-name[data-v-b9e61b9f] {
122
119
  color: var(--td-text-color-primary);
123
120
  }
124
- .qd-steps__substep--done .qd-steps__substep-no[data-v-3fae5c44] {
121
+ .qd-steps__substep--done .qd-steps__substep-no[data-v-b9e61b9f] {
125
122
  color: var(--td-success-color);
126
123
  background-color: transparent;
127
124
  }
128
- .qd-steps__substep--done .qd-steps__substep-no[data-v-3fae5c44]::before {
125
+ .qd-steps__substep--done .qd-steps__substep-no[data-v-b9e61b9f]::before {
129
126
  background-color: var(--td-success-color);
130
127
  border-color: transparent;
131
128
  }
132
- .qd-steps__substep--done .qd-steps__substep-name[data-v-3fae5c44] {
129
+ .qd-steps__substep--done .qd-steps__substep-name[data-v-b9e61b9f] {
133
130
  color: var(--td-text-color-primary);
134
131
  }
135
- .qd-steps__substep--active[data-v-3fae5c44] {
132
+ .qd-steps__substep--active[data-v-b9e61b9f] {
136
133
  background-color: var(--td-bg-color-container-hover);
137
134
  }
138
- .qd-steps__substep--active .qd-steps__substep-no[data-v-3fae5c44] {
135
+ .qd-steps__substep--active .qd-steps__substep-no[data-v-b9e61b9f] {
139
136
  color: var(--td-text-color-brand);
140
137
  background-color: transparent;
141
138
  }
142
- .qd-steps__substep--active .qd-steps__substep-no[data-v-3fae5c44]::before {
139
+ .qd-steps__substep--active .qd-steps__substep-no[data-v-b9e61b9f]::before {
143
140
  background-color: var(--td-brand-color);
144
141
  border-color: transparent;
145
142
  box-shadow: 0 0 0 var(--td-size-1) var(--td-brand-color-light);
146
143
  }
147
- .qd-steps__substep--active .qd-steps__substep-name[data-v-3fae5c44] {
144
+ .qd-steps__substep--active .qd-steps__substep-name[data-v-b9e61b9f] {
148
145
  color: var(--td-text-color-brand);
149
146
  font-weight: 700;
150
147
  }
151
- .qd-steps__substep--pending[data-v-3fae5c44] {
148
+ .qd-steps__substep--pending[data-v-b9e61b9f] {
152
149
  color: var(--td-text-color-placeholder);
150
+ cursor: default;
153
151
  }
154
- .qd-steps__substep--pending .qd-steps__substep-no[data-v-3fae5c44] {
152
+ .qd-steps__substep--pending .qd-steps__substep-no[data-v-b9e61b9f] {
155
153
  color: var(--td-text-color-disabled);
156
154
  }
157
- .qd-steps__substep--pending .qd-steps__substep-no[data-v-3fae5c44]::before {
155
+ .qd-steps__substep--pending .qd-steps__substep-no[data-v-b9e61b9f]::before {
158
156
  border-color: var(--td-component-border);
159
157
  }
160
- .qd-steps__substep--pending .qd-steps__substep-name[data-v-3fae5c44] {
158
+ .qd-steps__substep--pending .qd-steps__substep-name[data-v-b9e61b9f] {
161
159
  color: var(--td-text-color-placeholder);
162
160
  }
163
- .qd-steps__substep-no[data-v-3fae5c44] {
161
+ .qd-steps__substep-no[data-v-b9e61b9f] {
164
162
  position: relative;
165
163
  display: inline-flex;
166
164
  align-items: center;
@@ -174,7 +172,7 @@
174
172
  color: var(--td-text-color-disabled);
175
173
  background-color: transparent;
176
174
  }
177
- .qd-steps__substep-no[data-v-3fae5c44]::before {
175
+ .qd-steps__substep-no[data-v-b9e61b9f]::before {
178
176
  content: '';
179
177
  position: absolute;
180
178
  left: 0;
@@ -187,14 +185,14 @@
187
185
  transform: translateY(-50%);
188
186
  transition: all 0.12s;
189
187
  }
190
- .qd-steps__substep-name[data-v-3fae5c44] {
188
+ .qd-steps__substep-name[data-v-b9e61b9f] {
191
189
  font-size: var(--td-font-size-body-small);
192
190
  font-weight: 600;
193
191
  color: var(--td-text-color-secondary);
194
192
  white-space: nowrap;
195
193
  transition: color 0.12s;
196
194
  }
197
- .qd-steps__indicator[data-v-3fae5c44] {
195
+ .qd-steps__indicator[data-v-b9e61b9f] {
198
196
  flex: none;
199
197
  margin-left: auto;
200
198
  padding: 0;
@@ -205,7 +203,7 @@
205
203
  white-space: nowrap;
206
204
  background-color: transparent;
207
205
  }
208
- .qd-steps__indicator b[data-v-3fae5c44] {
206
+ .qd-steps__indicator b[data-v-b9e61b9f] {
209
207
  color: var(--td-text-color-primary);
210
208
  font-weight: 700;
211
209
  }
@@ -1,10 +1,11 @@
1
1
  import type { QdStepsProps } from './types';
2
2
  declare const _default: import("vue").DefineComponent<QdStepsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
- jump: (stepIndex: number) => any;
3
+ change: (index: number) => any;
4
+ "update:current": (current: number) => any;
4
5
  }, string, import("vue").PublicProps, Readonly<QdStepsProps> & Readonly<{
5
- onJump?: ((stepIndex: number) => any) | undefined;
6
+ onChange?: ((index: number) => any) | undefined;
7
+ "onUpdate:current"?: ((current: number) => any) | undefined;
6
8
  }>, {
7
9
  maxReachedStep: number;
8
- canJumpTo: (stepIndex: number) => boolean;
9
10
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
11
  export default _default;
@@ -2,7 +2,7 @@ import './index.css'
2
2
  import _sfc_main from "./index.vue2.mjs";
3
3
  /* empty css */
4
4
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
5
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3fae5c44"]]);
5
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b9e61b9f"]]);
6
6
  export {
7
7
  index as default
8
8
  };
@@ -1,5 +1,6 @@
1
1
  import './index.css'
2
2
  import { defineComponent, mergeDefaults, computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, Fragment, renderList, createBlock, normalizeClass, toDisplayString, unref, createTextVNode } from "vue";
3
+ import { useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
3
4
  import { ChevronRightSIcon } from "tdesign-icons-vue-next";
4
5
  import { qdStepsProps } from "./props.mjs";
5
6
  const _hoisted_1 = { class: "qd-steps" };
@@ -33,18 +34,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33
34
  props: /* @__PURE__ */ mergeDefaults({
34
35
  options: {},
35
36
  current: {},
36
- maxReachedStep: {},
37
- canJumpTo: { type: Function }
37
+ maxReachedStep: {}
38
38
  }, qdStepsProps),
39
- emits: ["jump"],
39
+ emits: ["change", "update:current"],
40
40
  setup(__props, { emit: __emit }) {
41
41
  const props = __props;
42
42
  const emit = __emit;
43
+ const { current } = useVModels(props, emit);
43
44
  const flatSteps = computed(() => props.options.flatMap((group) => getPhaseStepLabels(group)));
44
- const reachedStep = computed(() => props.maxReachedStep ?? props.current);
45
+ const reachedStep = computed(() => props.maxReachedStep ?? current.value);
45
46
  const hasSubSteps = computed(() => props.options.some((group) => group.steps?.length));
46
47
  const currentPhaseIndex = computed(
47
- () => props.options.findIndex((group) => getPhaseStepIndexes(group).includes(props.current))
48
+ () => props.options.findIndex((group) => getPhaseStepIndexes(group).includes(current.value))
48
49
  );
49
50
  const currentPhaseStepIndexes = computed(() => {
50
51
  const group = props.options[currentPhaseIndex.value];
@@ -63,52 +64,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
64
  }
64
65
  function getPhaseStatus(group) {
65
66
  const stepIndexes = getPhaseStepIndexes(group);
66
- const isActive = stepIndexes.includes(props.current);
67
+ const isActive = stepIndexes.includes(current.value);
67
68
  if (isActive) return "active";
68
- const isDone = stepIndexes.every((stepIndex) => stepIndex <= reachedStep.value);
69
+ const isDone = stepIndexes.every((index) => index <= reachedStep.value);
69
70
  if (isDone) return "done";
70
71
  return "pending";
71
72
  }
72
- function getStepStatus(stepIndex) {
73
- if (stepIndex === props.current) return "active";
74
- if (stepIndex < props.current || stepIndex <= reachedStep.value) return "done";
73
+ function getStepStatus(index) {
74
+ if (index === current.value) return "active";
75
+ if (index < current.value || index <= reachedStep.value) return "done";
75
76
  return "pending";
76
77
  }
77
78
  function handlePhaseClick(phase) {
78
- const stepIndex = getPhaseFirstStepIndex(phase);
79
- if (!props.canJumpTo(stepIndex)) return;
80
- emit("jump", stepIndex);
79
+ const index = getPhaseFirstStepIndex(phase);
80
+ current.value = index;
81
+ emit("change", index);
81
82
  }
82
- function handleStepClick(stepIndex) {
83
- if (!props.canJumpTo(stepIndex)) return;
84
- emit("jump", stepIndex);
83
+ function handleStepClick(index) {
84
+ current.value = index;
85
+ emit("change", index);
85
86
  }
86
87
  return (_ctx, _cache) => {
87
88
  return openBlock(), createElementBlock("div", _hoisted_1, [
88
89
  createElementVNode("div", _hoisted_2, [
89
90
  createElementVNode("div", _hoisted_3, [
90
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (phase, pi) => {
91
- return openBlock(), createElementBlock(Fragment, { key: pi }, [
91
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
92
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
92
93
  createElementVNode("div", {
93
- class: normalizeClass([
94
- "qd-steps__phase",
95
- {
96
- "qd-steps__phase--done": getPhaseStatus(phase) === "done",
97
- "qd-steps__phase--active": getPhaseStatus(phase) === "active",
98
- "qd-steps__phase--pending": getPhaseStatus(phase) === "pending",
99
- "qd-steps__phase--clickable": __props.canJumpTo(getPhaseFirstStepIndex(phase))
100
- }
101
- ]),
102
- onClick: ($event) => handlePhaseClick(phase)
94
+ class: normalizeClass(["qd-steps__phase", `qd-steps__phase--${getPhaseStatus(item)}`]),
95
+ onClick: ($event) => handlePhaseClick(item)
103
96
  }, [
104
- getPhaseStatus(phase) === "done" ? (openBlock(), createElementBlock("span", _hoisted_5, "✓")) : getPhaseStatus(phase) === "active" ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(pi + 1), 1)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(pi + 1), 1)),
105
- createElementVNode("span", _hoisted_8, toDisplayString(phase.title), 1)
97
+ getPhaseStatus(item) === "done" ? (openBlock(), createElementBlock("span", _hoisted_5, "✓")) : getPhaseStatus(item) === "active" ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(index + 1), 1)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(index + 1), 1)),
98
+ createElementVNode("span", _hoisted_8, toDisplayString(item.title), 1)
106
99
  ], 10, _hoisted_4),
107
- pi < __props.options.length - 1 ? (openBlock(), createBlock(unref(ChevronRightSIcon), {
100
+ index < __props.options.length - 1 ? (openBlock(), createBlock(unref(ChevronRightSIcon), {
108
101
  key: 0,
109
102
  class: normalizeClass([
110
103
  "qd-steps__separator",
111
- { "qd-steps__separator--done": getPhaseStatus(phase) === "done" }
104
+ { "qd-steps__separator--done": getPhaseStatus(item) === "done" }
112
105
  ])
113
106
  }, null, 8, ["class"])) : createCommentVNode("", true)
114
107
  ], 64);
@@ -122,13 +115,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
122
115
  (openBlock(true), createElementBlock(Fragment, null, renderList(currentPhaseStepIndexes.value, (stepIndex, subIndex) => {
123
116
  return openBlock(), createElementBlock("div", {
124
117
  key: stepIndex,
125
- class: normalizeClass([
126
- "qd-steps__substep",
127
- `qd-steps__substep--${getStepStatus(stepIndex)}`,
128
- {
129
- "qd-steps__substep--clickable": __props.canJumpTo(stepIndex)
130
- }
131
- ]),
118
+ class: normalizeClass(["qd-steps__substep", `qd-steps__substep--${getStepStatus(stepIndex)}`]),
132
119
  onClick: ($event) => handleStepClick(stepIndex)
133
120
  }, [
134
121
  createElementVNode("span", _hoisted_12, [
@@ -144,7 +131,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
144
131
  ]),
145
132
  createElementVNode("div", _hoisted_14, [
146
133
  _cache[0] || (_cache[0] = createTextVNode(" 第 ", -1)),
147
- createElementVNode("b", null, toDisplayString(__props.current + 1), 1),
134
+ createElementVNode("b", null, toDisplayString(unref(current) + 1), 1),
148
135
  createTextVNode(" / " + toDisplayString(flatSteps.value.length) + " 步 ", 1)
149
136
  ])
150
137
  ])
@@ -1,4 +1,3 @@
1
1
  export declare const qdStepsProps: {
2
2
  readonly maxReachedStep: undefined;
3
- readonly canJumpTo: () => boolean;
4
3
  };
@@ -1,6 +1,5 @@
1
1
  const qdStepsProps = {
2
- maxReachedStep: void 0,
3
- canJumpTo: () => false
2
+ maxReachedStep: void 0
4
3
  };
5
4
  export {
6
5
  qdStepsProps
@@ -6,5 +6,4 @@ export interface QdStepsProps {
6
6
  options: QdStepsGroup[];
7
7
  current: number;
8
8
  maxReachedStep?: number;
9
- canJumpTo?: (stepIndex: number) => boolean;
10
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",