@yh-ui/components 0.1.56 → 1.0.1

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.
Files changed (250) hide show
  1. package/dist/affix/index.d.ts +11 -6
  2. package/dist/affix/src/affix.d.ts +10 -0
  3. package/dist/affix/src/affix.vue.d.ts +2 -2
  4. package/dist/ai-action-group/index.d.ts +5 -0
  5. package/dist/ai-action-group/src/ai-action-group.d.ts +3 -0
  6. package/dist/ai-agent-card/index.d.ts +7 -0
  7. package/dist/ai-agent-card/src/ai-agent-card.d.ts +10 -0
  8. package/dist/ai-artifacts/index.d.ts +8 -0
  9. package/dist/ai-artifacts/src/ai-artifacts.d.ts +11 -1
  10. package/dist/ai-attachments/index.d.ts +5 -0
  11. package/dist/ai-attachments/src/ai-attachments.d.ts +12 -1
  12. package/dist/ai-bubble/index.d.ts +12 -0
  13. package/dist/ai-bubble/src/ai-bubble.d.ts +8 -1
  14. package/dist/ai-bubble/src/ai-bubble.vue +24 -20
  15. package/dist/ai-bubble-list/index.d.ts +3 -0
  16. package/dist/ai-bubble-list/src/ai-bubble-list.d.ts +14 -1
  17. package/dist/ai-chat/index.d.ts +5 -0
  18. package/dist/ai-chat/src/ai-chat.d.ts +9 -0
  19. package/dist/ai-code-block/index.d.ts +4 -0
  20. package/dist/ai-code-block/src/ai-code-block.d.ts +4 -0
  21. package/dist/ai-code-editor/index.d.ts +5 -0
  22. package/dist/ai-code-editor/src/ai-code-editor.d.ts +2 -0
  23. package/dist/ai-code-runner/index.d.ts +5 -0
  24. package/dist/ai-code-runner/src/ai-code-runner.d.ts +2 -0
  25. package/dist/ai-conversations/index.d.ts +5 -0
  26. package/dist/ai-conversations/src/ai-conversations.d.ts +16 -1
  27. package/dist/ai-editor-sender/index.d.ts +9 -0
  28. package/dist/ai-editor-sender/src/ai-editor-sender.d.ts +15 -0
  29. package/dist/ai-file-card/index.d.ts +8 -0
  30. package/dist/ai-file-card/src/ai-file-card.d.ts +5 -1
  31. package/dist/ai-mention/index.d.ts +9 -0
  32. package/dist/ai-mention/src/ai-mention.d.ts +3 -0
  33. package/dist/ai-mermaid/index.d.ts +5 -0
  34. package/dist/ai-mermaid/src/ai-mermaid.d.ts +6 -1
  35. package/dist/ai-mermaid/src/ai-mermaid.vue +6 -1
  36. package/dist/ai-prompts/index.d.ts +5 -0
  37. package/dist/ai-prompts/src/ai-prompts.d.ts +10 -0
  38. package/dist/ai-provider/index.d.ts +10 -0
  39. package/dist/ai-provider/src/ai-provider.d.ts +28 -0
  40. package/dist/ai-sender/index.d.ts +6 -0
  41. package/dist/ai-sender/src/ai-sender.d.ts +11 -1
  42. package/dist/ai-sources/index.d.ts +6 -0
  43. package/dist/ai-sources/src/ai-sources.d.ts +5 -1
  44. package/dist/ai-thinking/index.d.ts +5 -0
  45. package/dist/ai-thinking/src/ai-thinking.d.ts +3 -0
  46. package/dist/ai-thought-chain/index.d.ts +6 -0
  47. package/dist/ai-thought-chain/src/ai-thought-chain.d.ts +3 -0
  48. package/dist/ai-voice-trigger/index.d.ts +5 -0
  49. package/dist/ai-voice-trigger/src/ai-voice-trigger.d.ts +4 -0
  50. package/dist/ai-welcome/index.d.ts +5 -0
  51. package/dist/ai-welcome/src/ai-welcome.d.ts +6 -0
  52. package/dist/alert/index.d.ts +6 -0
  53. package/dist/alert/src/alert.d.ts +5 -0
  54. package/dist/alert/src/alert.vue +1 -1
  55. package/dist/autocomplete/index.d.ts +8 -0
  56. package/dist/avatar/index.cjs +15 -0
  57. package/dist/avatar/index.d.ts +19 -9
  58. package/dist/avatar/index.mjs +1 -0
  59. package/dist/back-top/index.d.ts +4 -0
  60. package/dist/back-top/src/back-top.d.ts +3 -0
  61. package/dist/badge/index.d.ts +4 -0
  62. package/dist/breadcrumb/index.d.ts +6 -0
  63. package/dist/breadcrumb/src/breadcrumb.d.ts +6 -0
  64. package/dist/button/index.d.ts +9 -0
  65. package/dist/calendar/index.d.ts +16 -1230
  66. package/dist/calendar/src/calendar.d.ts +16 -0
  67. package/dist/calendar/src/calendar.vue.d.ts +2 -415
  68. package/dist/card/index.d.ts +4 -0
  69. package/dist/carousel/index.d.ts +9 -0
  70. package/dist/carousel/src/carousel-item.d.ts +3 -0
  71. package/dist/carousel/src/carousel.d.ts +23 -0
  72. package/dist/cascader/index.d.ts +9 -7
  73. package/dist/cascader/src/cascader.d.ts +2 -2
  74. package/dist/cascader/src/cascader.vue +82 -30
  75. package/dist/cascader/src/cascader.vue.d.ts +1 -1
  76. package/dist/category-nav/index.d.ts +4 -0
  77. package/dist/category-nav/src/category-nav.d.ts +15 -0
  78. package/dist/checkbox/index.d.ts +10 -0
  79. package/dist/col/index.d.ts +34 -180
  80. package/dist/col/src/col.d.ts +14 -30
  81. package/dist/col/src/col.vue.d.ts +15 -90
  82. package/dist/color-picker/index.d.ts +11 -1
  83. package/dist/color-picker/src/color-picker.d.ts +8 -0
  84. package/dist/color-picker/src/color-picker.vue +6 -0
  85. package/dist/color-picker/src/color-picker.vue.d.ts +6 -1
  86. package/dist/config-provider/index.d.ts +3 -0
  87. package/dist/config-provider/src/config-provider.d.ts +3 -0
  88. package/dist/container/index.d.ts +15 -0
  89. package/dist/container/src/container.d.ts +12 -0
  90. package/dist/countdown/index.d.ts +9 -0
  91. package/dist/coupon-card/index.d.ts +3 -0
  92. package/dist/coupon-card/src/coupon-card.d.ts +10 -0
  93. package/dist/date-picker/index.d.ts +8 -0
  94. package/dist/date-picker/src/date-picker.d.ts +9 -0
  95. package/dist/descriptions/index.d.ts +6 -0
  96. package/dist/descriptions/src/descriptions.d.ts +9 -0
  97. package/dist/dialog/index.d.ts +12 -6
  98. package/dist/dialog/src/dialog.d.ts +13 -0
  99. package/dist/dialog/src/dialog.vue.d.ts +2 -2
  100. package/dist/divider/index.d.ts +2 -0
  101. package/dist/drawer/index.d.ts +8 -3
  102. package/dist/drawer/src/drawer.d.ts +11 -0
  103. package/dist/drawer/src/drawer.vue.d.ts +1 -1
  104. package/dist/dropdown/index.d.ts +11 -0
  105. package/dist/dropdown/src/dropdown.d.ts +10 -0
  106. package/dist/empty/index.cjs +15 -0
  107. package/dist/empty/index.d.ts +6 -0
  108. package/dist/empty/index.mjs +1 -0
  109. package/dist/filter-bar/index.d.ts +9 -0
  110. package/dist/filter-bar/src/filter-bar.d.ts +12 -0
  111. package/dist/form/index.d.ts +11 -0
  112. package/dist/gantt-chart/index.d.ts +8 -6
  113. package/dist/gantt-chart/src/gantt-chart.d.ts +1 -4
  114. package/dist/gantt-chart/src/gantt-chart.vue +43 -33
  115. package/dist/grid/index.d.ts +6 -0
  116. package/dist/grid/src/grid.d.ts +3 -0
  117. package/dist/icon/index.d.ts +5 -0
  118. package/dist/image/index.d.ts +18 -1
  119. package/dist/image/src/image-viewer.d.ts +11 -0
  120. package/dist/image/src/image-viewer.vue +56 -9
  121. package/dist/image/src/image-viewer.vue.d.ts +9 -1
  122. package/dist/image/src/image.d.ts +4 -0
  123. package/dist/image/src/image.vue +1 -1
  124. package/dist/image-magnifier/index.d.ts +6 -0
  125. package/dist/image-magnifier/src/image-magnifier.d.ts +15 -0
  126. package/dist/image-magnifier/src/image-magnifier.vue +9 -5
  127. package/dist/infinite-scroll/index.d.ts +5 -0
  128. package/dist/infinite-scroll/src/infinite-scroll.d.ts +10 -0
  129. package/dist/infinite-scroll/src/infinite-scroll.vue +37 -25
  130. package/dist/infinite-scroll/src/infinite-scroll.vue.d.ts +0 -2
  131. package/dist/input/index.d.ts +10 -0
  132. package/dist/input-number/index.d.ts +7 -0
  133. package/dist/input-tag/index.d.ts +7 -0
  134. package/dist/loading/index.d.ts +2 -0
  135. package/dist/loading/src/service.cjs +5 -1
  136. package/dist/loading/src/service.mjs +3 -1
  137. package/dist/lucky-draw/index.d.ts +4 -0
  138. package/dist/lucky-draw/src/lucky-draw.d.ts +6 -0
  139. package/dist/markdown-it.d.ts +2 -1
  140. package/dist/marquee/index.d.ts +12 -6
  141. package/dist/marquee/src/marquee.d.ts +8 -0
  142. package/dist/marquee/src/marquee.vue +16 -6
  143. package/dist/marquee/src/marquee.vue.d.ts +2 -5
  144. package/dist/mention/index.d.ts +9 -0
  145. package/dist/menu/index.d.ts +14 -0
  146. package/dist/menu/src/menu.d.ts +9 -0
  147. package/dist/message/index.d.ts +11 -0
  148. package/dist/message/src/message.d.ts +40 -32
  149. package/dist/message/src/message.vue.d.ts +1 -1
  150. package/dist/message-box/index.d.ts +7 -0
  151. package/dist/notification/index.d.ts +11 -0
  152. package/dist/notification/src/notification.d.ts +37 -33
  153. package/dist/notification/src/notification.vue.d.ts +1 -1
  154. package/dist/pagination/index.d.ts +6 -0
  155. package/dist/pagination/src/pagination.d.ts +3 -0
  156. package/dist/popconfirm/index.d.ts +5 -0
  157. package/dist/popconfirm/src/popconfirm.d.ts +11 -1
  158. package/dist/popover/index.d.ts +6 -0
  159. package/dist/popover/src/popover.d.ts +9 -1
  160. package/dist/price/index.d.ts +1 -0
  161. package/dist/price/src/price.d.ts +7 -0
  162. package/dist/product-card/index.d.ts +7 -3
  163. package/dist/product-card/src/product-card.cjs +1 -36
  164. package/dist/product-card/src/product-card.d.ts +5 -35
  165. package/dist/product-card/src/product-card.mjs +1 -36
  166. package/dist/product-card/src/product-card.vue +8 -14
  167. package/dist/product-card/src/product-card.vue.d.ts +1 -1
  168. package/dist/progress/index.d.ts +5 -0
  169. package/dist/progress/src/progress.d.ts +5 -0
  170. package/dist/radio/index.d.ts +14 -0
  171. package/dist/rate/index.d.ts +11 -6
  172. package/dist/rate/src/rate.d.ts +10 -1
  173. package/dist/rate/src/rate.vue.d.ts +3 -3
  174. package/dist/result/index.d.ts +4 -0
  175. package/dist/row/index.d.ts +18 -12
  176. package/dist/row/src/row.d.ts +13 -8
  177. package/dist/row/src/row.vue.d.ts +6 -6
  178. package/dist/scrollbar/index.d.ts +10 -20
  179. package/dist/scrollbar/src/scrollbar.d.ts +16 -4
  180. package/dist/scrollbar/src/scrollbar.vue.d.ts +2 -8
  181. package/dist/select/index.d.ts +15 -3
  182. package/dist/select/src/select.d.ts +4 -1
  183. package/dist/select/src/select.vue +1 -1
  184. package/dist/select/src/select.vue.d.ts +1 -1
  185. package/dist/skeleton/index.d.ts +6 -0
  186. package/dist/skeleton/src/skeleton.d.ts +4 -0
  187. package/dist/sku-selector/index.d.ts +5 -0
  188. package/dist/sku-selector/src/sku-selector.cjs +1 -14
  189. package/dist/sku-selector/src/sku-selector.d.ts +15 -17
  190. package/dist/sku-selector/src/sku-selector.mjs +1 -14
  191. package/dist/sku-selector/src/sku-selector.vue +6 -11
  192. package/dist/slider/index.d.ts +20 -3
  193. package/dist/slider/src/slider.d.ts +15 -0
  194. package/dist/slider/src/slider.vue +5 -0
  195. package/dist/slider/src/slider.vue.d.ts +5 -1
  196. package/dist/smart-address/index.d.ts +11 -6
  197. package/dist/smart-address/src/smart-address.cjs +0 -19
  198. package/dist/smart-address/src/smart-address.d.ts +13 -20
  199. package/dist/smart-address/src/smart-address.mjs +0 -19
  200. package/dist/smart-address/src/smart-address.vue.d.ts +3 -3
  201. package/dist/space/index.cjs +15 -0
  202. package/dist/space/index.d.ts +22 -12
  203. package/dist/space/index.mjs +1 -0
  204. package/dist/spin/index.d.ts +16 -10
  205. package/dist/spin/src/spin.cjs +5 -1
  206. package/dist/spin/src/spin.d.ts +13 -1
  207. package/dist/spin/src/spin.mjs +4 -0
  208. package/dist/spin/src/spin.vue +2 -2
  209. package/dist/spin/src/spin.vue.d.ts +4 -5
  210. package/dist/steps/index.d.ts +13 -0
  211. package/dist/steps/src/step.d.ts +6 -0
  212. package/dist/steps/src/steps.d.ts +3 -0
  213. package/dist/submit-bar/index.d.ts +3 -0
  214. package/dist/submit-bar/src/submit-bar.d.ts +7 -0
  215. package/dist/switch/index.d.ts +5 -0
  216. package/dist/switch/src/switch.d.ts +11 -1
  217. package/dist/table/index.d.ts +14 -4
  218. package/dist/tabs/index.d.ts +11 -0
  219. package/dist/tabs/src/tab-pane.d.ts +3 -0
  220. package/dist/tabs/src/tabs.d.ts +12 -0
  221. package/dist/tag/index.d.ts +7 -0
  222. package/dist/time-picker/index.d.ts +13 -3
  223. package/dist/time-picker/src/time-picker.d.ts +2 -2
  224. package/dist/time-picker/src/time-picker.vue +1 -1
  225. package/dist/time-picker/src/time-picker.vue.d.ts +1 -1
  226. package/dist/time-select/index.d.ts +10 -3
  227. package/dist/time-select/src/time-select.d.ts +2 -2
  228. package/dist/time-select/src/time-select.vue +79 -35
  229. package/dist/time-select/src/time-select.vue.d.ts +1 -1
  230. package/dist/tooltip/index.d.ts +7 -0
  231. package/dist/tooltip/src/tooltip.d.ts +11 -1
  232. package/dist/transfer/index.d.ts +6 -4
  233. package/dist/transfer/src/transfer-panel.vue +78 -27
  234. package/dist/transfer/src/transfer-panel.vue.d.ts +1 -1
  235. package/dist/transfer/src/transfer.d.ts +4 -4
  236. package/dist/transfer/src/transfer.vue +82 -26
  237. package/dist/transfer/src/transfer.vue.d.ts +2 -2
  238. package/dist/tree/index.d.ts +7 -0
  239. package/dist/tree-select/index.d.ts +8 -0
  240. package/dist/typography/index.d.ts +11 -0
  241. package/dist/upload/index.d.ts +10 -0
  242. package/dist/upload/src/upload.d.ts +19 -0
  243. package/dist/viewerjs.d.ts +2 -1
  244. package/dist/waterfall/index.d.ts +6 -0
  245. package/dist/waterfall/src/waterfall.d.ts +25 -7
  246. package/dist/watermark/index.d.ts +11 -54
  247. package/dist/watermark/src/watermark.d.ts +16 -9
  248. package/dist/watermark/src/watermark.vue +27 -5
  249. package/dist/watermark/src/watermark.vue.d.ts +3 -27
  250. package/package.json +6 -5
@@ -1,7 +1,6 @@
1
1
  import GanttChart from './src/gantt-chart.vue';
2
- import type { GanttChartProps } from './src/gantt-chart';
3
2
  export declare const YhGanttChart: import("@yh-ui/utils").SFCWithInstall<{
4
- new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<GanttChartProps> & Readonly<{
3
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./index.js").GanttChartProps> & Readonly<{
5
4
  "onUpdate:data"?: ((data: import("./index.js").GanttTask[]) => any) | undefined;
6
5
  "onUpdate:viewMode"?: ((value: import("./index.js").GanttViewMode) => any) | undefined;
7
6
  "onTask-click"?: ((task: import("./index.js").GanttTask, event: MouseEvent) => any) | undefined;
@@ -38,7 +37,7 @@ export declare const YhGanttChart: import("@yh-ui/utils").SFCWithInstall<{
38
37
  C: {};
39
38
  M: {};
40
39
  Defaults: {};
41
- }, Readonly<GanttChartProps> & Readonly<{
40
+ }, Readonly<import("./index.js").GanttChartProps> & Readonly<{
42
41
  "onUpdate:data"?: ((data: import("./index.js").GanttTask[]) => any) | undefined;
43
42
  "onUpdate:viewMode"?: ((value: import("./index.js").GanttViewMode) => any) | undefined;
44
43
  "onTask-click"?: ((task: import("./index.js").GanttTask, event: MouseEvent) => any) | undefined;
@@ -64,7 +63,7 @@ export declare const YhGanttChart: import("@yh-ui/utils").SFCWithInstall<{
64
63
  __isFragment?: never;
65
64
  __isTeleport?: never;
66
65
  __isSuspense?: never;
67
- } & import("vue").ComponentOptionsBase<Readonly<GanttChartProps> & Readonly<{
66
+ } & import("vue").ComponentOptionsBase<Readonly<import("./index.js").GanttChartProps> & Readonly<{
68
67
  "onUpdate:data"?: ((data: import("./index.js").GanttTask[]) => any) | undefined;
69
68
  "onUpdate:viewMode"?: ((value: import("./index.js").GanttViewMode) => any) | undefined;
70
69
  "onTask-click"?: ((task: import("./index.js").GanttTask, event: MouseEvent) => any) | undefined;
@@ -109,7 +108,10 @@ export declare const YhGanttChart: import("@yh-ui/utils").SFCWithInstall<{
109
108
  })> & Record<string, unknown>;
110
109
  export default YhGanttChart;
111
110
  export * from './src/gantt-chart';
112
- export type { GanttChartProps };
113
111
  export type GanttChartInstance = InstanceType<typeof GanttChart>;
114
112
  export type YhGanttChartInstance = GanttChartInstance;
115
- export type YhGanttChartProps = GanttChartProps;
113
+ export type YhGanttChartProps = import('./src/gantt-chart').GanttChartProps;
114
+ export type YhGanttChartEmits = import('./src/gantt-chart').GanttChartEmits;
115
+ export type YhGanttTask = import('./src/gantt-chart').GanttTask;
116
+ export type YhGanttColumn = import('./src/gantt-chart').GanttColumn;
117
+ export type YhGanttChartSlots = import('./src/gantt-chart').GanttChartSlots;
@@ -106,7 +106,4 @@ export interface FlattenedGanttTask extends GanttTask {
106
106
  _isMilestone: boolean;
107
107
  _matchesSearch: boolean;
108
108
  }
109
- export type GanttChartInstance = {
110
- visible: boolean;
111
- toggle: (val: boolean) => void;
112
- };
109
+ export type GanttChartInstance = InstanceType<typeof import('./gantt-chart.vue').default>;
@@ -4,7 +4,7 @@ import dayjs from "../../dayjs";
4
4
  import isBetweenPluginModule from "dayjs/plugin/isBetween.js";
5
5
  import isoWeekPluginModule from "dayjs/plugin/isoWeek.js";
6
6
  import quarterOfYearPluginModule from "dayjs/plugin/quarterOfYear.js";
7
- import { useNamespace } from "@yh-ui/hooks";
7
+ import { useNamespace, useLocale } from "@yh-ui/hooks";
8
8
  import { useComponentTheme } from "@yh-ui/theme";
9
9
  import { YhTooltip } from "../../tooltip";
10
10
  import { YhInput } from "../../input";
@@ -15,7 +15,7 @@ dayjs.extend(quarterOfYearPluginModule);
15
15
  defineOptions({ name: "YhGanttChart" });
16
16
  const props = defineProps({
17
17
  data: { type: Array, required: true, default: () => [] },
18
- columns: { type: Array, required: false, default: () => [{ prop: "name", label: "\u4EFB\u52A1\u540D\u79F0", width: 200 }] },
18
+ columns: { type: Array, required: false, default: () => [] },
19
19
  startDate: { type: [String, Number, Date], required: false },
20
20
  endDate: { type: [String, Number, Date], required: false },
21
21
  viewMode: { type: String, required: false, default: "day" },
@@ -34,10 +34,18 @@ const props = defineProps({
34
34
  });
35
35
  const emit = defineEmits(["update:data", "update:viewMode", "task-click", "task-dblclick", "task-drag-end", "progress-drag-end", "dependency-click"]);
36
36
  const ns = useNamespace("gantt-chart");
37
+ const { t } = useLocale();
37
38
  const { themeStyle } = useComponentTheme(
38
- "gantt-chart",
39
+ "gantt",
39
40
  computed(() => props.themeOverrides)
40
41
  );
42
+ const resolvedColumns = computed(() => {
43
+ const isDefaultNameColumn = props.columns.length === 1 && props.columns[0]?.prop === "name" && props.columns[0]?.width === 200;
44
+ return isDefaultNameColumn ? [{ ...props.columns[0], label: t("ganttchart.taskName") }] : props.columns;
45
+ });
46
+ const ganttSearchPlaceholder = computed(() => t("ganttchart.searchPlaceholder"));
47
+ const ganttZoomText = computed(() => t("ganttchart.zoom"));
48
+ const ganttMilestoneText = computed(() => t("ganttchart.milestone"));
41
49
  const ganttRef = ref(null);
42
50
  const timelineBodyRef = ref(null);
43
51
  const sidebarBodyRef = ref(null);
@@ -153,7 +161,7 @@ const getFlattenedTasks = (tasks, parentId = null, level = 0, ancestorHasNext =
153
161
  const visibleAllTasks = computed(() => {
154
162
  let list = getFlattenedTasks(props.data);
155
163
  if (searchKeyword.value) {
156
- return list.filter((t) => t._matchesSearch);
164
+ return list.filter((t2) => t2._matchesSearch);
157
165
  }
158
166
  return list;
159
167
  });
@@ -174,13 +182,13 @@ const renderTasks = computed(
174
182
  const totalHeight = computed(() => visibleAllTasks.value.length * props.rowHeight);
175
183
  const resourceLoadMap = computed(() => {
176
184
  const loadMap = {};
177
- visibleAllTasks.value.forEach((t) => {
178
- if (!t.assignees) return;
179
- let current = dayjs(t._startDate || t.startDate);
180
- const end = dayjs(t._endDate || t.endDate);
185
+ visibleAllTasks.value.forEach((t2) => {
186
+ if (!t2.assignees) return;
187
+ let current = dayjs(t2._startDate || t2.startDate);
188
+ const end = dayjs(t2._endDate || t2.endDate);
181
189
  while (current.isBefore(end) || current.isSame(end, "day")) {
182
190
  const dateStr = current.format("YYYY-MM-DD");
183
- t.assignees.forEach((resId) => {
191
+ t2.assignees.forEach((resId) => {
184
192
  if (!loadMap[resId]) loadMap[resId] = {};
185
193
  loadMap[resId][dateStr] = (loadMap[resId][dateStr] || 0) + 1;
186
194
  });
@@ -291,18 +299,18 @@ const dependenciesLinks = computed(() => {
291
299
  if (!props.showDependencies) return [];
292
300
  const links = [];
293
301
  const idToPos = /* @__PURE__ */ new Map();
294
- taskStyles.value.forEach((t) => idToPos.set(t.task.id, t));
295
- taskStyles.value.forEach((t) => {
296
- if (!t.task.dependencies) return;
297
- t.task.dependencies.forEach((depId) => {
302
+ taskStyles.value.forEach((t2) => idToPos.set(t2.task.id, t2));
303
+ taskStyles.value.forEach((t2) => {
304
+ if (!t2.task.dependencies) return;
305
+ t2.task.dependencies.forEach((depId) => {
298
306
  const from = idToPos.get(depId);
299
307
  if (from) {
300
308
  const x1 = from.left + from.width, y1 = from.top + props.rowHeight / 2;
301
- const x2 = t.left, y2 = t.top + props.rowHeight / 2;
309
+ const x2 = t2.left, y2 = t2.top + props.rowHeight / 2;
302
310
  links.push({
303
- id: `${depId}-${t.task.id}`,
311
+ id: `${depId}-${t2.task.id}`,
304
312
  from: from.task,
305
- to: t.task,
313
+ to: t2.task,
306
314
  path: `M ${x1} ${y1} L ${x2} ${y2}`
307
315
  });
308
316
  }
@@ -324,19 +332,19 @@ const handleBodyScroll = (e) => {
324
332
  };
325
333
  const updateSuccessors = (taskId) => {
326
334
  const findTask = (id, list) => {
327
- for (const t of list) {
328
- if (t.id === id) return t;
329
- if (t.children) {
330
- const found = findTask(id, t.children);
335
+ for (const t2 of list) {
336
+ if (t2.id === id) return t2;
337
+ if (t2.children) {
338
+ const found = findTask(id, t2.children);
331
339
  if (found) return found;
332
340
  }
333
341
  }
334
342
  };
335
343
  const findAffected = (predId, list) => {
336
344
  let affected2 = [];
337
- list.forEach((t) => {
338
- if (t.dependencies?.includes(predId)) affected2.push(t);
339
- if (t.children) affected2 = affected2.concat(findAffected(predId, t.children));
345
+ list.forEach((t2) => {
346
+ if (t2.dependencies?.includes(predId)) affected2.push(t2);
347
+ if (t2.children) affected2 = affected2.concat(findAffected(predId, t2.children));
340
348
  });
341
349
  return affected2;
342
350
  };
@@ -448,14 +456,16 @@ const handleMouseEnter = (e, task) => {
448
456
  <YhInput
449
457
  id="gantt-search-input"
450
458
  v-model="searchKeyword"
451
- placeholder="搜索任务..."
459
+ :placeholder="ganttSearchPlaceholder"
452
460
  prefix-icon="search"
453
461
  size="small"
454
462
  style="width: 200px"
455
463
  />
456
464
  </div>
457
465
  <div :class="ns.e('toolbar-right')">
458
- <span style="font-size: 12px; color: var(--yh-text-color-secondary)">缩放</span>
466
+ <span style="font-size: 12px; color: var(--yh-text-color-secondary)">{{
467
+ ganttZoomText
468
+ }}</span>
459
469
  <input
460
470
  type="range"
461
471
  v-model.number="PIXELS_PER_DAY"
@@ -470,10 +480,10 @@ const handleMouseEnter = (e, task) => {
470
480
  type="button"
471
481
  name="gantt-view-switcher"
472
482
  >
473
- <YhRadioButton value="day">天</YhRadioButton>
474
- <YhRadioButton value="week">周</YhRadioButton>
475
- <YhRadioButton value="month">月</YhRadioButton>
476
- <YhRadioButton value="year">年</YhRadioButton>
483
+ <YhRadioButton value="day">{{ t("ganttchart.day") }}</YhRadioButton>
484
+ <YhRadioButton value="week">{{ t("ganttchart.week") }}</YhRadioButton>
485
+ <YhRadioButton value="month">{{ t("ganttchart.month") }}</YhRadioButton>
486
+ <YhRadioButton value="year">{{ t("ganttchart.year") }}</YhRadioButton>
477
487
  </YhRadioGroup>
478
488
  </div>
479
489
  </div>
@@ -489,7 +499,7 @@ const handleMouseEnter = (e, task) => {
489
499
  >
490
500
  <div :class="ns.e('sidebar-header')">
491
501
  <div
492
- v-for="col in columns"
502
+ v-for="col in resolvedColumns"
493
503
  :key="col.prop"
494
504
  :class="ns.e('sidebar-header-cell')"
495
505
  :style="{
@@ -513,7 +523,7 @@ const handleMouseEnter = (e, task) => {
513
523
  }"
514
524
  >
515
525
  <div
516
- v-for="col in columns"
526
+ v-for="col in resolvedColumns"
517
527
  :key="col.prop"
518
528
  :class="ns.e('cell')"
519
529
  :style="{
@@ -521,7 +531,7 @@ const handleMouseEnter = (e, task) => {
521
531
  }"
522
532
  >
523
533
  <slot name="table-cell" :row="task" :column="col" :index="index">
524
- <template v-if="col.prop === columns[0].prop">
534
+ <template v-if="col.prop === resolvedColumns[0].prop">
525
535
  <span :class="ns.e('tree-node')">
526
536
  <span
527
537
  v-for="(hasNext, i) in task._ancestorHasNext"
@@ -663,7 +673,7 @@ const handleMouseEnter = (e, task) => {
663
673
  <YhTooltip
664
674
  v-for="ts in taskStyles"
665
675
  :key="ts.task.id"
666
- :content="ts.isMilestone ? `${ts.task.name} (Milestone)` : ts.task.name"
676
+ :content="ts.isMilestone ? `${ts.task.name} (${ganttMilestoneText})` : ts.task.name"
667
677
  placement="top"
668
678
  :class="[ns.e('task-wrapper'), ns.is('milestone', ts.isMilestone), ns.is('summary', ts.isSummary), ts.task.status ? ns.e(`task-${ts.task.status}`) : '']"
669
679
  :style="ts.style"
@@ -71,3 +71,9 @@ export default YhGrid;
71
71
  export * from './src/grid';
72
72
  export type GridInstance = InstanceType<typeof Grid>;
73
73
  export type GridItemInstance = InstanceType<typeof GridItem>;
74
+ export type YhGridInstance = GridInstance;
75
+ export type YhGridItemInstance = GridItemInstance;
76
+ export type YhGridProps = import('./src/grid').GridProps;
77
+ export type YhGridItemProps = import('./src/grid').GridItemProps;
78
+ export type YhGridSlots = import('./src/grid').GridSlots;
79
+ export type YhGridItemSlots = import('./src/grid').GridItemSlots;
@@ -74,3 +74,6 @@ export interface GridItemProps {
74
74
  export interface GridSlots {
75
75
  default?: () => void;
76
76
  }
77
+ export interface GridItemSlots {
78
+ default?: () => void;
79
+ }
@@ -147,3 +147,8 @@ export declare const YhIcon: import("@yh-ui/utils").SFCWithInstall<{
147
147
  })> & Record<string, unknown>;
148
148
  export default YhIcon;
149
149
  export type IconInstance = InstanceType<typeof Icon>;
150
+ export type YhIconInstance = IconInstance;
151
+ export type YhIconProps = import('./src/icon').IconProps;
152
+ export type YhIconSlots = import('./src/icon').IconSlots;
153
+ export type YhIconData = import('./src/icon').IconData;
154
+ export type YhIconSet = import('./src/icon').IconSet;
@@ -347,7 +347,15 @@ export declare const YhImageViewer: import("@yh-ui/utils").SFCWithInstall<import
347
347
  readonly type: import("vue").PropType<Record<string, unknown>>;
348
348
  readonly default: () => {};
349
349
  };
350
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
350
+ }>, {
351
+ prev: () => void;
352
+ next: () => void;
353
+ zoomIn: () => void;
354
+ zoomOut: () => void;
355
+ rotateLeft: () => void;
356
+ rotateRight: () => void;
357
+ reset: () => void;
358
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
351
359
  switch: (index: number) => void;
352
360
  close: () => void;
353
361
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -416,3 +424,12 @@ export * from './src/image';
416
424
  export * from './src/image-viewer';
417
425
  export type ImageInstance = InstanceType<typeof Image>;
418
426
  export type ImageViewerInstance = InstanceType<typeof ImageViewer>;
427
+ export type YhImageInstance = ImageInstance;
428
+ export type YhImageViewerInstance = ImageViewerInstance;
429
+ export type YhImageProps = import('./src/image').ImageProps;
430
+ export type YhImageEmits = import('./src/image').ImageEmits;
431
+ export type YhImageSlots = import('./src/image').ImageSlots;
432
+ export type YhImageViewerProps = import('./src/image-viewer').ImageViewerProps;
433
+ export type YhImageViewerEmits = import('./src/image-viewer').ImageViewerEmits;
434
+ export type YhImageViewerSlots = import('./src/image-viewer').ImageViewerSlots;
435
+ export type YhImageViewerExpose = import('./src/image-viewer').ImageViewerExpose;
@@ -88,3 +88,14 @@ export declare const imageViewerEmits: {
88
88
  switch: (index: number) => boolean;
89
89
  };
90
90
  export type ImageViewerEmits = typeof imageViewerEmits;
91
+ export interface ImageViewerSlots {
92
+ }
93
+ export interface ImageViewerExpose {
94
+ prev: () => void;
95
+ next: () => void;
96
+ zoomIn: () => void;
97
+ zoomOut: () => void;
98
+ rotateLeft: () => void;
99
+ rotateRight: () => void;
100
+ reset: () => void;
101
+ }
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, ref, onMounted, onUnmounted, watch } from "vue";
3
- import { useNamespace } from "@yh-ui/hooks";
3
+ import { useNamespace, useLocale } from "@yh-ui/hooks";
4
4
  import { imageViewerProps, imageViewerEmits } from "./image-viewer";
5
5
  import Viewer from "../../viewerjs";
6
6
  import "viewerjs/dist/viewer.css";
@@ -10,6 +10,7 @@ defineOptions({
10
10
  const props = defineProps(imageViewerProps);
11
11
  const emit = defineEmits(imageViewerEmits);
12
12
  const ns = useNamespace("viewer");
13
+ const { t } = useLocale();
13
14
  const index = ref(props.initialIndex);
14
15
  const scale = ref(1);
15
16
  const rotate = ref(0);
@@ -123,6 +124,15 @@ onUnmounted(() => {
123
124
  viewerList = null;
124
125
  }
125
126
  });
127
+ defineExpose({
128
+ prev: handlePrev,
129
+ next: handleNext,
130
+ zoomIn: handleZoomIn,
131
+ zoomOut: handleZoomOut,
132
+ rotateLeft: handleRotateLeft,
133
+ rotateRight: handleRotateRight,
134
+ reset
135
+ });
126
136
  </script>
127
137
 
128
138
  <template>
@@ -133,7 +143,12 @@ onUnmounted(() => {
133
143
  <div :class="ns.e('mask')" @click="hideOnClickModal && handleClose()"></div>
134
144
 
135
145
  <!-- Close -->
136
- <span :class="[ns.e('btn'), ns.e('close')]" @click="handleClose">
146
+ <span
147
+ :class="[ns.e('btn'), ns.e('close')]"
148
+ :title="t('imageviewer.close')"
149
+ :aria-label="t('imageviewer.close')"
150
+ @click="handleClose"
151
+ >
137
152
  <svg viewBox="0 0 1024 1024" width="1em" height="1em">
138
153
  <path
139
154
  fill="currentColor"
@@ -144,7 +159,12 @@ onUnmounted(() => {
144
159
 
145
160
  <!-- Arrows -->
146
161
  <template v-if="urlList.length > 1">
147
- <span :class="[ns.e('btn'), ns.e('prev')]" @click="handlePrev">
162
+ <span
163
+ :class="[ns.e('btn'), ns.e('prev')]"
164
+ :title="t('imageviewer.prev')"
165
+ :aria-label="t('imageviewer.prev')"
166
+ @click="handlePrev"
167
+ >
148
168
  <svg viewBox="0 0 1024 1024" width="1em" height="1em">
149
169
  <path
150
170
  fill="currentColor"
@@ -152,7 +172,12 @@ onUnmounted(() => {
152
172
  />
153
173
  </svg>
154
174
  </span>
155
- <span :class="[ns.e('btn'), ns.e('next')]" @click="handleNext">
175
+ <span
176
+ :class="[ns.e('btn'), ns.e('next')]"
177
+ :title="t('imageviewer.next')"
178
+ :aria-label="t('imageviewer.next')"
179
+ @click="handleNext"
180
+ >
156
181
  <svg viewBox="0 0 1024 1024" width="1em" height="1em">
157
182
  <path
158
183
  fill="currentColor"
@@ -165,25 +190,42 @@ onUnmounted(() => {
165
190
  <!-- Actions -->
166
191
  <div v-if="showProgress" :class="ns.e('actions')">
167
192
  <div :class="ns.e('actions-inner')">
168
- <i :class="ns.e('zoom-out')" @click="handleZoomOut"
193
+ <i
194
+ :class="ns.e('zoom-out')"
195
+ :title="t('imageviewer.zoomOut')"
196
+ :aria-label="t('imageviewer.zoomOut')"
197
+ @click="handleZoomOut"
169
198
  ><svg viewBox="0 0 1024 1024" width="1em" height="1em">
170
199
  <path fill="currentColor" d="M192 480h640v64H192z" /></svg
171
200
  ></i>
172
- <i :class="ns.e('zoom-in')" @click="handleZoomIn"
201
+ <i
202
+ :class="ns.e('zoom-in')"
203
+ :title="t('imageviewer.zoomIn')"
204
+ :aria-label="t('imageviewer.zoomIn')"
205
+ @click="handleZoomIn"
173
206
  ><svg viewBox="0 0 1024 1024" width="1em" height="1em">
174
207
  <path
175
208
  fill="currentColor"
176
209
  d="M480 480V224h64v256h256v64H544v256h-64V544H224v-64h256z"
177
210
  /></svg
178
211
  ></i>
179
- <i :class="ns.e('reset')" @click="reset"
212
+ <i
213
+ :class="ns.e('reset')"
214
+ :title="t('imageviewer.reset')"
215
+ :aria-label="t('imageviewer.reset')"
216
+ @click="reset"
180
217
  ><svg viewBox="0 0 1024 1024" width="1em" height="1em">
181
218
  <path
182
219
  fill="currentColor"
183
220
  d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 64a384 384 0 1 0 0 768 384 384 0 0 0 0-768zm0 128a256 256 0 1 1 0 512 256 256 0 0 1 0-512z"
184
221
  /></svg
185
222
  ></i>
186
- <i :class="ns.e('rotate-left')" @click="handleRotateLeft">
223
+ <i
224
+ :class="ns.e('rotate-left')"
225
+ :title="t('imageviewer.rotateLeft')"
226
+ :aria-label="t('imageviewer.rotateLeft')"
227
+ @click="handleRotateLeft"
228
+ >
187
229
  <svg viewBox="0 0 1024 1024" width="1em" height="1em">
188
230
  <path
189
231
  fill="currentColor"
@@ -191,7 +233,12 @@ onUnmounted(() => {
191
233
  />
192
234
  </svg>
193
235
  </i>
194
- <i :class="ns.e('rotate-right')" @click="handleRotateRight">
236
+ <i
237
+ :class="ns.e('rotate-right')"
238
+ :title="t('imageviewer.rotateRight')"
239
+ :aria-label="t('imageviewer.rotateRight')"
240
+ @click="handleRotateRight"
241
+ >
195
242
  <svg viewBox="0 0 1024 1024" width="1em" height="1em">
196
243
  <path
197
244
  fill="currentColor"
@@ -44,7 +44,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
44
44
  readonly type: import("vue").PropType<Record<string, unknown>>;
45
45
  readonly default: () => {};
46
46
  };
47
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
47
+ }>, {
48
+ prev: () => void;
49
+ next: () => void;
50
+ zoomIn: () => void;
51
+ zoomOut: () => void;
52
+ rotateLeft: () => void;
53
+ rotateRight: () => void;
54
+ reset: () => void;
55
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
56
  switch: (index: number) => void;
49
57
  close: () => void;
50
58
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -137,3 +137,7 @@ export interface ImageEmits {
137
137
  (e: 'close'): void;
138
138
  (e: 'show'): void;
139
139
  }
140
+ export interface ImageSlots {
141
+ placeholder?: () => unknown;
142
+ error?: () => unknown;
143
+ }
@@ -183,7 +183,7 @@ const handleSwitch = (index) => {
183
183
  <template>
184
184
  <div ref="container" :class="ns.b()" :style="themeStyle">
185
185
  <slot v-if="isLoading" name="placeholder">
186
- <div :class="ns.e('placeholder')">{{ t('button.loading') }}</div>
186
+ <div :class="ns.e('placeholder')">{{ t('image.loading') }}</div>
187
187
  </slot>
188
188
  <slot v-else-if="error" name="error">
189
189
  <div :class="ns.e('error')">{{ t("image.error") }}</div>
@@ -466,3 +466,9 @@ export * from './src/image-magnifier';
466
466
  export type ImageMagnifierInstance = InstanceType<typeof ImageMagnifier>;
467
467
  export type YhImageMagnifierInstance = ImageMagnifierInstance;
468
468
  export type YhImageMagnifierProps = import('./src/image-magnifier').ImageMagnifierProps;
469
+ export type YhImageMagnifierEmits = import('./src/image-magnifier').ImageMagnifierEmits;
470
+ export type YhImageMagnifierSlots = import('./src/image-magnifier').ImageMagnifierSlots;
471
+ export type YhImageMagnifierExpose = import('./src/image-magnifier').ImageMagnifierExpose;
472
+ export type YhImageMagnifierImage = import('./src/image-magnifier').ImageMagnifierImage;
473
+ export type YhImageMagnifierPosition = import('./src/image-magnifier').ImageMagnifierPosition;
474
+ export type YhImageMagnifierMaskShape = import('./src/image-magnifier').ImageMagnifierMaskShape;
@@ -144,3 +144,18 @@ export declare const imageMagnifierEmits: {
144
144
  'update:modelValue': (index: number) => boolean;
145
145
  };
146
146
  export type ImageMagnifierEmits = typeof imageMagnifierEmits;
147
+ export interface ImageMagnifierSlots {
148
+ default?: () => unknown;
149
+ title?: () => unknown;
150
+ 'close-icon'?: () => unknown;
151
+ fullscreen?: (props: {
152
+ src: string;
153
+ alt: string;
154
+ }) => unknown;
155
+ }
156
+ export interface ImageMagnifierExpose {
157
+ visible: boolean;
158
+ currentScale: number;
159
+ currentIndex: number;
160
+ switchImage: (index: number) => void;
161
+ }
@@ -1,12 +1,13 @@
1
1
  <script setup>
2
2
  import { ref, computed, reactive, watch, onUnmounted, nextTick } from "vue";
3
- import { useNamespace } from "@yh-ui/hooks";
3
+ import { useNamespace, useLocale } from "@yh-ui/hooks";
4
4
  import { useComponentTheme } from "@yh-ui/theme";
5
5
  import { imageMagnifierProps, imageMagnifierEmits } from "./image-magnifier";
6
6
  defineOptions({ name: "YhImageMagnifier" });
7
7
  const props = defineProps(imageMagnifierProps);
8
8
  const emit = defineEmits(imageMagnifierEmits);
9
9
  const ns = useNamespace("image-magnifier");
10
+ const { t } = useLocale();
10
11
  const { themeStyle } = useComponentTheme(
11
12
  "image-magnifier",
12
13
  computed(() => props.themeOverrides)
@@ -36,6 +37,9 @@ const currentImage = computed(
36
37
  const currentSrc = computed(() => currentImage.value.src);
37
38
  const currentZoomSrc = computed(() => currentImage.value.zoomSrc || currentImage.value.src);
38
39
  const currentAlt = computed(() => currentImage.value.alt || props.alt);
40
+ const getSwitchToImageLabel = (index) => t("imagemagnifier.switchToImage", { index: index + 1 });
41
+ const getGalleryItemAlt = (index) => t("imagemagnifier.galleryItem", { index: index + 1 });
42
+ const fullscreenCloseLabel = computed(() => t("imagemagnifier.close"));
39
43
  const switchImage = (index) => {
40
44
  currentIndex.value = index;
41
45
  emit("update:modelValue", index);
@@ -328,9 +332,9 @@ defineExpose({ visible, currentScale, currentIndex, switchImage });
328
332
  :class="[ns.e('gallery-item'), ns.is('active', idx === currentIndex)]"
329
333
  @click="switchImage(idx)"
330
334
  type="button"
331
- :aria-label="`Switch to image ${idx + 1}`"
335
+ :aria-label="getSwitchToImageLabel(idx)"
332
336
  >
333
- <img :src="img.src" :alt="img.alt || `Gallery ${idx + 1}`" />
337
+ <img :src="img.src" :alt="img.alt || getGalleryItemAlt(idx)" />
334
338
  </button>
335
339
  </div>
336
340
 
@@ -350,7 +354,7 @@ defineExpose({ visible, currentScale, currentIndex, switchImage });
350
354
  :class="ns.e('fullscreen-close')"
351
355
  @click="closeFullscreen"
352
356
  type="button"
353
- aria-label="Close"
357
+ :aria-label="fullscreenCloseLabel"
354
358
  >
355
359
  <slot name="close-icon">✕</slot>
356
360
  </button>
@@ -367,7 +371,7 @@ defineExpose({ visible, currentScale, currentIndex, switchImage });
367
371
  @click="switchImage(idx)"
368
372
  type="button"
369
373
  >
370
- <img :src="img.src" :alt="img.alt || `Gallery ${idx + 1}`" />
374
+ <img :src="img.src" :alt="img.alt || getGalleryItemAlt(idx)" />
371
375
  </button>
372
376
  </div>
373
377
  </div>
@@ -274,3 +274,8 @@ export default YhInfiniteScroll;
274
274
  export * from './src/infinite-scroll';
275
275
  export * from './src/directive';
276
276
  export type InfiniteScrollInstance = InstanceType<typeof InfiniteScroll>;
277
+ export type YhInfiniteScrollInstance = InfiniteScrollInstance;
278
+ export type YhInfiniteScrollProps = import('./src/infinite-scroll').InfiniteScrollProps;
279
+ export type YhInfiniteScrollEmits = import('./src/infinite-scroll').InfiniteScrollEmits;
280
+ export type YhInfiniteScrollSlots = import('./src/infinite-scroll').InfiniteScrollSlots;
281
+ export type YhInfiniteScrollExpose = import('./src/infinite-scroll').InfiniteScrollExpose;
@@ -82,3 +82,13 @@ export declare const infiniteScrollEmits: {
82
82
  };
83
83
  export type InfiniteScrollProps = ExtractPropTypes<typeof infiniteScrollProps>;
84
84
  export type InfiniteScrollEmits = typeof infiniteScrollEmits;
85
+ export interface InfiniteScrollSlots {
86
+ default?: () => unknown;
87
+ loading?: () => unknown;
88
+ finished?: () => unknown;
89
+ error?: () => unknown;
90
+ }
91
+ export interface InfiniteScrollExpose {
92
+ check: () => void;
93
+ retry: () => void;
94
+ }