yc-pro-components 0.0.44 → 0.0.46

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 (80) hide show
  1. package/es/components/display-item/src/index.vue2.mjs +16 -3
  2. package/es/components/index.d.ts +1 -0
  3. package/es/components/index.mjs +2 -0
  4. package/es/components/yc-batch-import-dialog/index.d.ts +167 -0
  5. package/es/components/yc-batch-import-dialog/index.mjs +13 -0
  6. package/es/components/yc-batch-import-dialog/src/UploadRecordList.vue.d.ts +45 -0
  7. package/es/components/yc-batch-import-dialog/src/UploadRecordList.vue.mjs +6 -0
  8. package/es/components/yc-batch-import-dialog/src/UploadRecordList.vue2.mjs +186 -0
  9. package/es/components/yc-batch-import-dialog/src/index.vue.d.ts +73 -0
  10. package/es/components/yc-batch-import-dialog/src/index.vue.mjs +6 -0
  11. package/es/components/yc-batch-import-dialog/src/index.vue2.mjs +579 -0
  12. package/es/components/yc-batch-import-dialog/src/types.d.ts +159 -0
  13. package/es/components/yc-batch-import-dialog/src/types.mjs +1 -0
  14. package/es/components/yc-drawer/src/index.vue.mjs +1 -1
  15. package/es/components/yc-drawer/src/index.vue2.mjs +37 -10
  16. package/es/components/yc-drawer/src/type.d.ts +17 -0
  17. package/es/components/yc-drawer/store.d.ts +6 -0
  18. package/es/components/yc-plus-page/src/index.vue.d.ts +210 -26
  19. package/es/components/yc-plus-page/src/index.vue.mjs +1 -1
  20. package/es/components/yc-plus-page/src/index.vue2.mjs +96 -8
  21. package/es/components/yc-plus-page/src/type.d.ts +12 -0
  22. package/es/dict/createDictStore.d.ts +1 -1
  23. package/es/index.css +13 -11
  24. package/es/index.mjs +2 -0
  25. package/index.css +291 -12
  26. package/index.js +1215 -325
  27. package/index.min.css +5 -3
  28. package/index.min.js +11 -11
  29. package/index.min.mjs +11 -11
  30. package/index.mjs +1215 -328
  31. package/lib/components/display-item/src/index.vue2.js +16 -3
  32. package/lib/components/index.d.ts +1 -0
  33. package/lib/components/index.js +5 -0
  34. package/lib/components/yc-batch-import-dialog/index.d.ts +167 -0
  35. package/lib/components/yc-batch-import-dialog/index.js +20 -0
  36. package/lib/components/yc-batch-import-dialog/src/UploadRecordList.vue.d.ts +45 -0
  37. package/lib/components/yc-batch-import-dialog/src/UploadRecordList.vue.js +10 -0
  38. package/lib/components/yc-batch-import-dialog/src/UploadRecordList.vue2.js +190 -0
  39. package/lib/components/yc-batch-import-dialog/src/index.vue.d.ts +73 -0
  40. package/lib/components/yc-batch-import-dialog/src/index.vue.js +10 -0
  41. package/lib/components/yc-batch-import-dialog/src/index.vue2.js +583 -0
  42. package/lib/components/yc-batch-import-dialog/src/types.d.ts +159 -0
  43. package/lib/components/yc-batch-import-dialog/src/types.js +2 -0
  44. package/lib/components/yc-drawer/src/index.vue.js +1 -1
  45. package/lib/components/yc-drawer/src/index.vue2.js +36 -9
  46. package/lib/components/yc-drawer/src/type.d.ts +17 -0
  47. package/lib/components/yc-drawer/store.d.ts +6 -0
  48. package/lib/components/yc-plus-page/src/index.vue.d.ts +210 -26
  49. package/lib/components/yc-plus-page/src/index.vue.js +1 -1
  50. package/lib/components/yc-plus-page/src/index.vue2.js +95 -7
  51. package/lib/components/yc-plus-page/src/type.d.ts +12 -0
  52. package/lib/dict/createDictStore.d.ts +1 -1
  53. package/lib/index.css +12 -10
  54. package/lib/index.js +5 -0
  55. package/locale/en.js +1 -1
  56. package/locale/en.min.js +1 -1
  57. package/locale/en.min.mjs +1 -1
  58. package/locale/en.mjs +1 -1
  59. package/locale/ja.js +1 -1
  60. package/locale/ja.min.js +1 -1
  61. package/locale/ja.min.mjs +1 -1
  62. package/locale/ja.mjs +1 -1
  63. package/locale/ko.js +1 -1
  64. package/locale/ko.min.js +1 -1
  65. package/locale/ko.min.mjs +1 -1
  66. package/locale/ko.mjs +1 -1
  67. package/locale/zh-cn.js +1 -1
  68. package/locale/zh-cn.min.js +1 -1
  69. package/locale/zh-cn.min.mjs +1 -1
  70. package/locale/zh-cn.mjs +1 -1
  71. package/locale/zh-tw.js +1 -1
  72. package/locale/zh-tw.min.js +1 -1
  73. package/locale/zh-tw.min.mjs +1 -1
  74. package/locale/zh-tw.mjs +1 -1
  75. package/package.json +1 -1
  76. package/theme-chalk/index.css +1 -1
  77. package/theme-chalk/plus-table.css +1 -1
  78. package/theme-chalk/plus-yc-plus-page.css +1 -1
  79. package/theme-chalk/src/table.scss +5 -0
  80. package/theme-chalk/src/yc-plus-page.scss +46 -0
@@ -0,0 +1,159 @@
1
+ /**
2
+ * BatchImportDialog - 类型定义
3
+ * @description 批量导入对话框组件的类型定义
4
+ */
5
+ /**
6
+ * 导入状态类型
7
+ */
8
+ export type ImportStatus = "initial" | "uploaded" | "importing" | "success" | "error";
9
+ /**
10
+ * 响应类型
11
+ * - json: 返回 JSON 格式的导入结果
12
+ * - blob: 返回文件(如带错误标注的 Excel)
13
+ */
14
+ export type ResponseType = "json" | "blob";
15
+ /**
16
+ * 导入接口函数类型
17
+ */
18
+ export type ImportApiFn = (formData: FormData) => Promise<unknown>;
19
+ /**
20
+ * 自定义下载模板函数类型
21
+ */
22
+ export type DownloadTemplateFn = () => void | Promise<void>;
23
+ /**
24
+ * BatchImportDialog Props
25
+ */
26
+ export interface BatchImportDialogProps {
27
+ /**
28
+ * 对话框标题
29
+ * @default "批量导入"
30
+ */
31
+ title?: string;
32
+ /**
33
+ * 对话框宽度
34
+ * @default 520
35
+ */
36
+ width?: number;
37
+ /**
38
+ * 图标 CDN 基础路径(用于加载 import.svg, excel.svg 等)
39
+ * 需要以 / 结尾
40
+ * @example "https://cdn.example.com/assets/"
41
+ */
42
+ iconBaseUrl?: string;
43
+ /**
44
+ * 第一步标题
45
+ * @default "第一步:请严格按照导入模板填写内容后导入,否则将新增失败!"
46
+ */
47
+ stepOneTitle?: string;
48
+ /**
49
+ * 注意事项提示文案
50
+ * @default "注意:单次导入数据不得超过5000条,否则导入可能失败!"
51
+ */
52
+ tips?: string;
53
+ /**
54
+ * 模板下载地址(CDN 地址)
55
+ * 与 onDownloadTemplate 二选一,onDownloadTemplate 优先级更高
56
+ */
57
+ templateUrl?: string;
58
+ /**
59
+ * 下载模板的文件名
60
+ * 如果不提供,则使用 URL 中的文件名
61
+ * @example "客户导入模板.xlsx"
62
+ */
63
+ templateFileName?: string;
64
+ /**
65
+ * 下载导入结果的文件名(不含扩展名和时间戳)
66
+ * 如果不提供,则使用默认值 "导入结果"
67
+ * @example "项目信息导入结果"
68
+ */
69
+ resultFileName?: string;
70
+ /**
71
+ * 下载模板按钮文案
72
+ * @default "下载导入模板"
73
+ */
74
+ templateButtonText?: string;
75
+ /**
76
+ * 自定义下载模板函数
77
+ * 优先级高于 templateUrl
78
+ */
79
+ onDownloadTemplate?: DownloadTemplateFn;
80
+ /**
81
+ * 第二步标题
82
+ * @default "第二步:选择模板文件并开始导入"
83
+ */
84
+ stepTwoTitle?: string;
85
+ /**
86
+ * 接受的文件类型
87
+ * @default ".xls,.xlsx"
88
+ */
89
+ accept?: string;
90
+ /**
91
+ * 最大文件大小(MB)
92
+ * @default 10
93
+ */
94
+ maxFileSize?: number;
95
+ /**
96
+ * 最大导入条数(用于提示文案)
97
+ * @default 5000
98
+ */
99
+ maxRowCount?: number;
100
+ /**
101
+ * 导入接口函数(必填)
102
+ * @param formData 包含 file 字段的表单数据
103
+ * @returns Promise
104
+ */
105
+ importApi: ImportApiFn;
106
+ /**
107
+ * 额外的表单参数
108
+ * 会追加到 FormData 中一起提交
109
+ */
110
+ extraFormData?: Record<string, string | Blob>;
111
+ /**
112
+ * 响应类型
113
+ * - json: 返回 JSON 格式的导入结果
114
+ * - blob: 返回文件(如带错误标注的 Excel)
115
+ * @default "blob"
116
+ */
117
+ responseType?: ResponseType;
118
+ }
119
+ /**
120
+ * BatchImportDialog Emits
121
+ */
122
+ export interface BatchImportDialogEmits {
123
+ /** 导入成功事件 */
124
+ (e: "success", result: unknown): void;
125
+ /** 导入失败事件 */
126
+ (e: "error", error: Error): void;
127
+ /** 对话框关闭事件 */
128
+ (e: "close"): void;
129
+ }
130
+ /**
131
+ * BatchImportDialog Expose
132
+ */
133
+ export interface BatchImportDialogExpose {
134
+ /** 打开对话框 */
135
+ open: () => void;
136
+ /** 关闭对话框 */
137
+ close: () => void;
138
+ /** 重置状态 */
139
+ reset: () => void;
140
+ }
141
+ /**
142
+ * 上传状态枚举
143
+ */
144
+ export type BatchUploadRecordStatus = "uploading" | "paused" | "completed" | "error";
145
+ /**
146
+ * 上传记录接口
147
+ */
148
+ export interface BatchUploadRecord {
149
+ /** 唯一标识 */
150
+ id: string;
151
+ /** 文件名 */
152
+ name: string;
153
+ /** 文件大小(字节) */
154
+ size: number;
155
+ /** 上传进度(0-100) */
156
+ progress: number;
157
+ /** 上传状态 */
158
+ status: BatchUploadRecordStatus;
159
+ }
@@ -1,6 +1,6 @@
1
1
  import _sfc_main from './index.vue2.mjs';
2
2
  import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
3
3
 
4
- var YcDrawerComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e05479bb"], ["__file", "index.vue"]]);
4
+ var YcDrawerComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f6f2fd13"], ["__file", "index.vue"]]);
5
5
 
6
6
  export { YcDrawerComponent as default };
@@ -1,9 +1,10 @@
1
- import { defineComponent, ref, computed, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, createBlock, mergeProps, createSlots, withCtx, createElementVNode, resolveDynamicComponent, normalizeClass, toDisplayString, createVNode, normalizeProps, guardReactiveProps, createTextVNode, pushScopeId, popScopeId } from 'vue';
1
+ import { defineComponent, provide, ref, computed, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, createBlock, mergeProps, createSlots, withCtx, createElementVNode, resolveDynamicComponent, normalizeClass, toDisplayString, createVNode, normalizeProps, guardReactiveProps, createTextVNode, pushScopeId, popScopeId } from 'vue';
2
2
  import { isFunction } from 'lodash-es';
3
3
  import { Close } from '@element-plus/icons-vue';
4
4
  import { drawerStore, closeDrawer } from '../store.mjs';
5
+ import { DictStoreInjectionKey } from '../../../constants/dict.mjs';
5
6
 
6
- const _withScopeId = (n) => (pushScopeId("data-v-e05479bb"), n = n(), popScopeId(), n);
7
+ const _withScopeId = (n) => (pushScopeId("data-v-f6f2fd13"), n = n(), popScopeId(), n);
7
8
  const _hoisted_1 = { class: "custom-drawer-header" };
8
9
  const _hoisted_2 = { class: "header-content" };
9
10
  const _hoisted_3 = ["id"];
@@ -21,6 +22,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
21
22
  },
22
23
  __name: "index",
23
24
  setup(__props) {
25
+ const DictStoreProvider = defineComponent({
26
+ name: "DictStoreProvider",
27
+ props: {
28
+ dictStore: {
29
+ type: Object,
30
+ default: null
31
+ }
32
+ },
33
+ setup(props) {
34
+ if (props.dictStore) {
35
+ provide(DictStoreInjectionKey, props.dictStore);
36
+ }
37
+ },
38
+ render() {
39
+ var _a, _b;
40
+ return (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a);
41
+ }
42
+ });
24
43
  const sureBtnMap = ref({});
25
44
  const footerButtons = computed(() => {
26
45
  return (options) => {
@@ -132,14 +151,22 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
132
151
  _hoisted_4
133
152
  ])
134
153
  ]),
135
- default: withCtx(() => {
136
- var _a, _b;
137
- return [
138
- (openBlock(), createBlock(resolveDynamicComponent((_a = options == null ? void 0 : options.contentRenderer) == null ? void 0 : _a.call(options, { options, index })), mergeProps((_b = options == null ? void 0 : options.props) != null ? _b : {}, {
139
- onClose: (args) => handleClose(options, index, args)
140
- }), null, 16, ["onClose"]))
141
- ];
142
- }),
154
+ default: withCtx(() => [
155
+ createVNode(unref(DictStoreProvider), {
156
+ "dict-store": options == null ? void 0 : options.dictStore
157
+ }, {
158
+ default: withCtx(() => {
159
+ var _a, _b;
160
+ return [
161
+ (openBlock(), createBlock(resolveDynamicComponent((_a = options == null ? void 0 : options.contentRenderer) == null ? void 0 : _a.call(options, { options, index })), mergeProps((_b = options == null ? void 0 : options.props) != null ? _b : {}, {
162
+ onClose: (args) => handleClose(options, index, args)
163
+ }), null, 16, ["onClose"]))
164
+ ];
165
+ }),
166
+ _: 2
167
+ /* DYNAMIC */
168
+ }, 1032, ["dict-store"])
169
+ ]),
143
170
  _: 2
144
171
  /* DYNAMIC */
145
172
  }, [
@@ -1,3 +1,4 @@
1
+ import { DictStoreInterface } from 'yc-pro-components/es/constants';
1
2
  import { CSSProperties, VNode, Component } from 'vue';
2
3
 
3
4
  type DoneFn = (cancel?: boolean) => void;
@@ -202,5 +203,21 @@ interface DrawerOptions extends DrawerProps {
202
203
  index: number;
203
204
  closeLoading: () => void;
204
205
  }) => void;
206
+ /**
207
+ * 字典 Store 实例
208
+ * @description 当传入时,会将此 dictStore 通过 provide 注入到 Drawer 内容的组件树中,
209
+ * 使内容组件中 autoDict: true 的列配置可以正常获取字典数据。
210
+ * @example
211
+ * ```ts
212
+ * import { useDictStore } from '@/store/modules/dict'
213
+ *
214
+ * addDrawer({
215
+ * title: '详情',
216
+ * dictStore: useDictStore(),
217
+ * contentRenderer: () => h(YourContent, { ... })
218
+ * })
219
+ * ```
220
+ */
221
+ dictStore?: DictStoreInterface;
205
222
  }
206
223
  export type { ButtonProps, DrawerOptions, ArgsType, DrawerProps, EventType };
@@ -1,4 +1,5 @@
1
1
  import { Globals } from 'csstype';
2
+ import { OptionsRow } from 'packages/yc-components';
2
3
  import { NavigationGuardWithThis, NavigationGuard } from 'vue-router';
3
4
  import { LooseRequired } from '@vue/shared';
4
5
  import { Ref, FunctionalComponent, Slot, Component, ComputedOptions, MethodOptions, Directive, WatchCallback, WatchOptions, ComponentProvideOptions, DebuggerEvent, ComponentPublicInstance, ComponentOptionsBase, VNode, RendererNode, RendererElement } from 'vue';
@@ -721,6 +722,11 @@ export declare const drawerStore: Ref<{
721
722
  index: number;
722
723
  closeLoading: () => void;
723
724
  }) => void) | undefined;
725
+ dictStore?: {
726
+ getDictData: (field: string) => OptionsRow<undefined>[];
727
+ hasDict?: ((field: string) => boolean) | undefined;
728
+ getDictLabel?: ((field: string, value: string | number) => string) | undefined;
729
+ } | undefined;
724
730
  visible?: boolean | undefined;
725
731
  appendToBody?: boolean | undefined;
726
732
  appendTo?: string | undefined;