yuang-framework-ui-pc 1.1.51 → 1.1.52

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 (38) hide show
  1. package/es/core-components.d.ts +1 -2
  2. package/es/core-components.js +2 -4
  3. package/es/ele-upload-list/components/list-item.d.ts +1 -0
  4. package/es/ele-upload-list/components/list-item.js +11 -3
  5. package/es/ele-upload-list/index.d.ts +2 -0
  6. package/es/ele-upload-list/index.js +16 -3
  7. package/es/ele-upload-list/types.d.ts +2 -0
  8. package/es/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.js +31 -50
  9. package/es/yu-framework-slider-captcha-dialog/{SliderCaptcha.js → components/SliderCaptcha.js} +1 -1
  10. package/es/yu-framework-slider-captcha-dialog/index.js +1 -1
  11. package/lib/core-components.cjs +2 -4
  12. package/lib/core-components.d.ts +1 -2
  13. package/lib/ele-upload-list/components/list-item.cjs +11 -3
  14. package/lib/ele-upload-list/components/list-item.d.ts +1 -0
  15. package/lib/ele-upload-list/index.cjs +16 -3
  16. package/lib/ele-upload-list/index.d.ts +2 -0
  17. package/lib/ele-upload-list/types.d.ts +2 -0
  18. package/lib/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.cjs +31 -50
  19. package/lib/yu-framework-slider-captcha-dialog/{SliderCaptcha.cjs → components/SliderCaptcha.cjs} +1 -1
  20. package/lib/yu-framework-slider-captcha-dialog/index.cjs +1 -1
  21. package/package.json +2 -2
  22. package/typings/global.d.ts +1 -2
  23. package/es/yu-framework-attachment-file-upload/CommonUpload/index.d.ts +0 -161
  24. package/es/yu-framework-attachment-file-upload/CommonUpload/index.js +0 -173
  25. package/es/yu-framework-attachment-file-upload/FileUpload/index.d.ts +0 -143
  26. package/es/yu-framework-attachment-file-upload/FileUpload/index.js +0 -219
  27. package/es/yu-framework-attachment-file-upload/index.d.ts +0 -16
  28. package/es/yu-framework-attachment-file-upload/index.js +0 -55
  29. package/lib/yu-framework-attachment-file-upload/CommonUpload/index.cjs +0 -172
  30. package/lib/yu-framework-attachment-file-upload/CommonUpload/index.d.ts +0 -161
  31. package/lib/yu-framework-attachment-file-upload/FileUpload/index.cjs +0 -218
  32. package/lib/yu-framework-attachment-file-upload/FileUpload/index.d.ts +0 -143
  33. package/lib/yu-framework-attachment-file-upload/index.cjs +0 -54
  34. package/lib/yu-framework-attachment-file-upload/index.d.ts +0 -16
  35. /package/es/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.d.ts +0 -0
  36. /package/es/yu-framework-slider-captcha-dialog/{SliderCaptcha.d.ts → components/SliderCaptcha.d.ts} +0 -0
  37. /package/lib/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.d.ts +0 -0
  38. /package/lib/yu-framework-slider-captcha-dialog/{SliderCaptcha.d.ts → components/SliderCaptcha.d.ts} +0 -0
@@ -1,218 +0,0 @@
1
- "use strict";
2
- const vue = require("vue");
3
- const CommonUpload = require("../CommonUpload/index");
4
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
5
- ...{ name: "FileUpload" },
6
- __name: "index",
7
- props: {
8
- modelValue: {},
9
- fileLimit: { default: 100 },
10
- readonly: { type: Boolean },
11
- disabled: { type: Boolean },
12
- preview: { type: Boolean, default: true },
13
- limit: {},
14
- multiple: { type: Boolean },
15
- drag: { type: Boolean, default: true },
16
- accept: { default: "" },
17
- itemStyle: {},
18
- buttonStyle: {},
19
- sortable: { type: [Boolean, Object], default: () => ({ forceFallback: true }) },
20
- imageProps: {},
21
- progressProps: {},
22
- previewProps: {},
23
- tools: { type: Boolean, default: true },
24
- listType: { default: "file" },
25
- beforeUploadClick: {},
26
- beforeItemEdit: {},
27
- locale: {}
28
- },
29
- emits: ["update:modelValue", "change"],
30
- setup(__props, { expose: __expose, emit: __emit }) {
31
- const props = __props;
32
- const emit = __emit;
33
- const files = vue.ref([]);
34
- const isImage = (url) => {
35
- var _a, _b;
36
- const parts = url ? url.split(".") : [];
37
- const suffix = parts.length <= 1 || parts[0] === "" && parts.length === 2 ? "" : (_b = (_a = parts.pop()) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a);
38
- return suffix && ["png", "jpg", "jpeg", "gif", "svg"].includes(suffix);
39
- };
40
- const getItemFileUrl = (item) => {
41
- return item.fileUrl;
42
- };
43
- const handleItemClick = (item) => {
44
- handleItemPreview(item);
45
- };
46
- const handleItemPreview = (item) => {
47
- if (!item.url) {
48
- const fileUrl = getItemFileUrl(item);
49
- if (fileUrl) {
50
- window.open(fileUrl);
51
- } else if (item.file && !item.file.type.startsWith("image")) {
52
- window.open(URL.createObjectURL(item.file));
53
- }
54
- }
55
- };
56
- const updateModelValue = (value) => {
57
- if (props.modelValue !== value) {
58
- emit("update:modelValue", value);
59
- emit("change", value);
60
- }
61
- };
62
- const clearData = () => {
63
- files.value = [];
64
- };
65
- const isDone = () => {
66
- return !files.value.some((d) => d.status !== "done");
67
- };
68
- const getDataValue = (filesValue) => {
69
- const result = [];
70
- filesValue.forEach((item) => {
71
- const fileUrl = getItemFileUrl(item);
72
- if (item.status === "done" && fileUrl != null) {
73
- result.push({ url: fileUrl, name: item.name });
74
- }
75
- });
76
- return result;
77
- };
78
- const getFilesValue = (dataValue, filesValue) => {
79
- if (!dataValue) {
80
- return filesValue.filter((item) => item.status !== "done");
81
- }
82
- const result = [];
83
- if (props.limit === 1) {
84
- try {
85
- const temp2 = JSON.parse(dataValue);
86
- if (temp2) {
87
- const url = temp2.url ?? "";
88
- result.push({
89
- key: temp2.key ?? `0-${url}`,
90
- id: temp2.id ?? ``,
91
- name: temp2.name ?? "",
92
- url: isImage(url) ? url : void 0,
93
- fileUrl: url,
94
- status: "done"
95
- });
96
- return result;
97
- }
98
- } catch (e) {
99
- console.error(e);
100
- }
101
- const temp = filesValue.find((item) => item.status !== "done");
102
- if (temp != null) {
103
- result.push(temp);
104
- }
105
- return result;
106
- }
107
- try {
108
- const temps = JSON.parse(dataValue);
109
- filesValue.forEach((item) => {
110
- const fileUrl = getItemFileUrl(item);
111
- if (fileUrl && temps.some((temp) => temp.url === fileUrl) || item.status !== "done") {
112
- result.push(item);
113
- }
114
- });
115
- temps.forEach((temp, index) => {
116
- const url = (temp == null ? void 0 : temp.url) ?? "";
117
- if (url && !result.some((item) => getItemFileUrl(item) === url)) {
118
- const key = `${index}-${url}`;
119
- const oldIndex = result.findIndex((item) => item.key === key);
120
- if (oldIndex !== -1) {
121
- result.splice(oldIndex, 1);
122
- }
123
- result.push({
124
- key,
125
- id: temp.id ?? "",
126
- name: temp.name ?? "",
127
- url: isImage(url) ? url : void 0,
128
- fileUrl: url,
129
- status: "done"
130
- });
131
- }
132
- });
133
- if (props.limit != null && result.length > props.limit) {
134
- const temp = result.filter((item) => item.status !== "done");
135
- for (const t of temp) {
136
- const i = result.indexOf(t);
137
- result.splice(i, 1);
138
- if (result.length <= props.limit) {
139
- break;
140
- }
141
- }
142
- }
143
- } catch (e) {
144
- console.error(e);
145
- filesValue.forEach((item) => {
146
- if (item.status !== "done") {
147
- result.push(item);
148
- }
149
- });
150
- }
151
- return result;
152
- };
153
- const filesIsChanged = (newFiles, oldFiles) => {
154
- if (newFiles.length !== oldFiles.length) {
155
- return true;
156
- }
157
- for (let i = 0; i < newFiles.length; i++) {
158
- const newItem = newFiles[i];
159
- const oldItem = oldFiles[i];
160
- if (newItem.key !== oldItem.key || newItem.name !== oldItem.name || getItemFileUrl(newItem) !== getItemFileUrl(oldItem) || newItem.status !== oldItem.status) {
161
- return true;
162
- }
163
- }
164
- return false;
165
- };
166
- vue.watch(
167
- files,
168
- (filesValue) => {
169
- const dataValue = getDataValue(filesValue);
170
- if (props.limit === 1) {
171
- updateModelValue(dataValue.length ? JSON.stringify(dataValue[0]) : "");
172
- return;
173
- }
174
- updateModelValue(dataValue.length ? JSON.stringify(dataValue) : "");
175
- },
176
- { deep: true }
177
- );
178
- vue.watch(
179
- () => props.modelValue,
180
- (dataValue) => {
181
- const filesValue = getFilesValue(dataValue, files.value);
182
- if (filesIsChanged(filesValue, files.value)) {
183
- files.value = filesValue;
184
- }
185
- },
186
- { immediate: true }
187
- );
188
- __expose({ clearData, isDone });
189
- return (_ctx, _cache) => {
190
- return vue.openBlock(), vue.createBlock(CommonUpload, {
191
- modelValue: files.value,
192
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => files.value = $event),
193
- fileLimit: _ctx.fileLimit,
194
- readonly: _ctx.readonly,
195
- disabled: _ctx.disabled,
196
- preview: _ctx.preview,
197
- limit: _ctx.limit,
198
- multiple: _ctx.multiple,
199
- drag: _ctx.drag,
200
- accept: _ctx.accept,
201
- itemStyle: _ctx.itemStyle,
202
- buttonStyle: _ctx.buttonStyle,
203
- sortable: _ctx.sortable,
204
- imageProps: _ctx.imageProps,
205
- progressProps: _ctx.progressProps,
206
- previewProps: _ctx.previewProps,
207
- tools: _ctx.tools,
208
- listType: _ctx.listType,
209
- beforeUploadClick: _ctx.beforeUploadClick,
210
- beforeItemEdit: _ctx.beforeItemEdit,
211
- locale: _ctx.locale,
212
- onItemClick: handleItemClick,
213
- onPreview: handleItemPreview
214
- }, null, 8, ["modelValue", "fileLimit", "readonly", "disabled", "preview", "limit", "multiple", "drag", "accept", "itemStyle", "buttonStyle", "sortable", "imageProps", "progressProps", "previewProps", "tools", "listType", "beforeUploadClick", "beforeItemEdit", "locale"]);
215
- };
216
- }
217
- });
218
- module.exports = _sfc_main;
@@ -1,143 +0,0 @@
1
- import { CSSProperties } from 'vue';
2
- import { ElProgressProps, ElImageProps } from '../../ele-app/el';
3
- import { EleImageViewerProps } from '../../ele-app/plus';
4
- import { ListType, BeforeUploadClick, BeforeItemEdit, UploadLocale } from '../../ele-upload-list/types';
5
-
6
- declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
7
- /** 绑定值 */
8
- modelValue?: string;
9
- /** 文件大小限制, 单位MB */
10
- fileLimit?: number;
11
- /** 是否只读 */
12
- readonly?: boolean;
13
- /** 是否禁用 */
14
- disabled?: boolean;
15
- /** 是否支持点击预览 */
16
- preview?: boolean;
17
- /** 最大上传数量 */
18
- limit?: number;
19
- /** 是否支持多选文件 */
20
- multiple?: boolean;
21
- /** 是否启用拖拽上传 */
22
- drag?: boolean;
23
- /** 接受上传的文件类型 */
24
- accept?: string;
25
- /** 自定义样式 */
26
- itemStyle?: CSSProperties;
27
- /** 自定义上传按钮样式 */
28
- buttonStyle?: CSSProperties;
29
- /** 是否开启拖拽排序 */
30
- sortable?: boolean | Record<keyof any, any>;
31
- /** 自定义图片属性 */
32
- imageProps?: ElImageProps;
33
- /** 自定义进度条属性 */
34
- progressProps?: ElProgressProps;
35
- /** 自定义图片预览属性 */
36
- previewProps?: EleImageViewerProps;
37
- /** 是否开启底部预览和修改的操作按钮 */
38
- tools?: boolean;
39
- /** 列表显示样式 */
40
- listType?: ListType;
41
- /** 上传按钮点击前的钩子 */
42
- beforeUploadClick?: BeforeUploadClick;
43
- /** 修改按钮点击前的钩子 */
44
- beforeItemEdit?: BeforeItemEdit;
45
- /** 国际化 */
46
- locale?: Partial<UploadLocale>;
47
- }>, {
48
- fileLimit: number;
49
- preview: boolean;
50
- drag: boolean;
51
- accept: string;
52
- sortable: () => {
53
- forceFallback: boolean;
54
- };
55
- tools: boolean;
56
- listType: string;
57
- }>>, {
58
- clearData: () => void;
59
- isDone: () => boolean;
60
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
61
- "update:modelValue": (value?: string | undefined) => void;
62
- change: (value?: string | undefined) => void;
63
- }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
64
- /** 绑定值 */
65
- modelValue?: string;
66
- /** 文件大小限制, 单位MB */
67
- fileLimit?: number;
68
- /** 是否只读 */
69
- readonly?: boolean;
70
- /** 是否禁用 */
71
- disabled?: boolean;
72
- /** 是否支持点击预览 */
73
- preview?: boolean;
74
- /** 最大上传数量 */
75
- limit?: number;
76
- /** 是否支持多选文件 */
77
- multiple?: boolean;
78
- /** 是否启用拖拽上传 */
79
- drag?: boolean;
80
- /** 接受上传的文件类型 */
81
- accept?: string;
82
- /** 自定义样式 */
83
- itemStyle?: CSSProperties;
84
- /** 自定义上传按钮样式 */
85
- buttonStyle?: CSSProperties;
86
- /** 是否开启拖拽排序 */
87
- sortable?: boolean | Record<keyof any, any>;
88
- /** 自定义图片属性 */
89
- imageProps?: ElImageProps;
90
- /** 自定义进度条属性 */
91
- progressProps?: ElProgressProps;
92
- /** 自定义图片预览属性 */
93
- previewProps?: EleImageViewerProps;
94
- /** 是否开启底部预览和修改的操作按钮 */
95
- tools?: boolean;
96
- /** 列表显示样式 */
97
- listType?: ListType;
98
- /** 上传按钮点击前的钩子 */
99
- beforeUploadClick?: BeforeUploadClick;
100
- /** 修改按钮点击前的钩子 */
101
- beforeItemEdit?: BeforeItemEdit;
102
- /** 国际化 */
103
- locale?: Partial<UploadLocale>;
104
- }>, {
105
- fileLimit: number;
106
- preview: boolean;
107
- drag: boolean;
108
- accept: string;
109
- sortable: () => {
110
- forceFallback: boolean;
111
- };
112
- tools: boolean;
113
- listType: string;
114
- }>>> & Readonly<{
115
- onChange?: ((value?: string | undefined) => any) | undefined;
116
- "onUpdate:modelValue"?: ((value?: string | undefined) => any) | undefined;
117
- }>, {
118
- sortable: boolean | Record<keyof any, any>;
119
- drag: boolean;
120
- preview: boolean;
121
- accept: string;
122
- tools: boolean;
123
- listType: ListType;
124
- fileLimit: number;
125
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
126
- export default _default;
127
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
128
- type __VLS_TypePropsToRuntimeProps<T> = {
129
- [K in keyof T]-?: {} extends Pick<T, K> ? {
130
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
131
- } : {
132
- type: import('vue').PropType<T[K]>;
133
- required: true;
134
- };
135
- };
136
- type __VLS_WithDefaults<P, D> = {
137
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
138
- default: D[K];
139
- }> : P[K];
140
- };
141
- type __VLS_Prettify<T> = {
142
- [K in keyof T]: T[K];
143
- } & {};
@@ -1,54 +0,0 @@
1
- "use strict";
2
- const vue = require("vue");
3
- require("../utils/message");
4
- const FileUpload = require("./FileUpload/index");
5
- const httpConfig = require("yuang-framework-ui-common/lib/config/httpConfig");
6
- const uuidUtils = require("yuang-framework-ui-common/lib/utils/uuidUtils");
7
- const applicationConfig = require("yuang-framework-ui-common/lib/config/applicationConfig");
8
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
9
- ...{ name: "YuFrameworkAttachmentFileUpload" },
10
- __name: "index",
11
- props: /* @__PURE__ */ vue.mergeModels({
12
- modelValue: {},
13
- param: {}
14
- }, {
15
- "modelValue": {},
16
- "modelModifiers": {}
17
- }),
18
- emits: ["update:modelValue"],
19
- setup(__props) {
20
- const files = vue.ref("");
21
- vue.ref(false);
22
- const model = vue.useModel(__props, "modelValue");
23
- debugger;
24
- model.value = model.value ?? uuidUtils.getShortUuid();
25
- vue.onMounted(() => {
26
- httpConfig.http.post(`${applicationConfig.application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/selectPage`, { code: model.value, pageSize: 100 }).then((res) => {
27
- let attachemtList = res.data.data.records;
28
- let fileList = [];
29
- for (let i = 0; i < attachemtList.length; i++) {
30
- fileList.push({
31
- key: attachemtList[i].id,
32
- id: attachemtList[i].id,
33
- // 需要传递name,否则表单上显示url
34
- name: attachemtList[i].name,
35
- url: attachemtList[i].fullUrl,
36
- status: "done"
37
- });
38
- }
39
- files.value = JSON.stringify(fileList);
40
- });
41
- });
42
- return (_ctx, _cache) => {
43
- return vue.openBlock(), vue.createElementBlock("div", null, [
44
- vue.createVNode(FileUpload, {
45
- ref: "filesUploadRef",
46
- limit: 8,
47
- modelValue: files.value,
48
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => files.value = $event)
49
- }, null, 8, ["modelValue"])
50
- ]);
51
- };
52
- }
53
- });
54
- module.exports = _sfc_main;
@@ -1,16 +0,0 @@
1
- import { ComponentParam } from '@/model/component/param';
2
-
3
- declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
- modelValue: import('vue').PropType<any>;
5
- param: {
6
- type: import('vue').PropType<ComponentParam>;
7
- required: true;
8
- };
9
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
- modelValue: import('vue').PropType<any>;
11
- param: {
12
- type: import('vue').PropType<ComponentParam>;
13
- required: true;
14
- };
15
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
16
- export default _default;