From a03768194475db971e308d3a0bbec2299cff4f0d Mon Sep 17 00:00:00 2001 From: 0song <82012629+0song@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:57:20 +0800 Subject: [PATCH 01/11] chore: action memory (#14541) --- .github/workflows/publish-docs-deploy-manual.yml | 1 + .github/workflows/publish-docs-deploy.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/publish-docs-deploy-manual.yml b/.github/workflows/publish-docs-deploy-manual.yml index f6e710a87f..fd1c6a6329 100644 --- a/.github/workflows/publish-docs-deploy-manual.yml +++ b/.github/workflows/publish-docs-deploy-manual.yml @@ -57,6 +57,7 @@ jobs: run: pnpm docs:build env: DOC_ENV: production + NODE_OPTIONS: --max-old-space-size=4096 - name: Deploy uses: JamesIves/github-pages-deploy-action@v4.3.4 diff --git a/.github/workflows/publish-docs-deploy.yml b/.github/workflows/publish-docs-deploy.yml index ef91692ef8..503d45443b 100644 --- a/.github/workflows/publish-docs-deploy.yml +++ b/.github/workflows/publish-docs-deploy.yml @@ -64,6 +64,7 @@ jobs: run: pnpm docs:build env: DOC_ENV: production + NODE_OPTIONS: --max-old-space-size=4096 - name: Deploy uses: JamesIves/github-pages-deploy-action@v4.3.4 From 0f7f88df81c6df77b0b0c1fe99189dcecf76b0ca Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sat, 14 Oct 2023 17:30:41 +0800 Subject: [PATCH 02/11] docs(components): [watermark] update font (#14542) --- docs/en-US/component/watermark.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en-US/component/watermark.md b/docs/en-US/component/watermark.md index 4bf0bcc55c..932a9c91b1 100644 --- a/docs/en-US/component/watermark.md +++ b/docs/en-US/component/watermark.md @@ -69,6 +69,6 @@ watermark/custom | ---------- | ----------- | ---------------------------------------------------- | --------------- | | color | font color | ^[string] | rgba(0,0,0,.15) | | fontSize | font size | ^[number] | 16 | -| fontWeight | font weight | ^[enum]`'normal \| 'light' \| 'weight' \| number` | normal | +| fontWeight | font weight | ^[enum]`'normal' \| 'light' \| 'weight' \| number` | normal | | fontFamily | font family | ^[string] | sans-serif | | fontStyle | font style | ^[enum]`'none' \| 'normal' \| 'italic' \| 'oblique'` | normal | From 61b79d4bbe2204be42cf42728ef089edd95c82ef Mon Sep 17 00:00:00 2001 From: sleepyShen1989 <109908413+sleepyShen1989@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:16:50 +0800 Subject: [PATCH 03/11] test(components): [alert] change test case to match description (#14551) --- packages/components/alert/__tests__/alert.test.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/components/alert/__tests__/alert.test.tsx b/packages/components/alert/__tests__/alert.test.tsx index ed2b6e6943..54e4676f54 100644 --- a/packages/components/alert/__tests__/alert.test.tsx +++ b/packages/components/alert/__tests__/alert.test.tsx @@ -34,7 +34,11 @@ describe('Alert.vue', () => { }) test('title slot', () => { - const wrapper = mount(() => ) + const wrapper = mount(Alert, { + slots: { + title: AXIOM, + }, + }) expect(wrapper.find('.el-alert__title').text()).toEqual(AXIOM) }) From 0e9cadeeed6d51d0e5a23b2179e839f3e6b52a6e Mon Sep 17 00:00:00 2001 From: cuongle-hdwebsoft <102006695+cuongle-hdwebsoft@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:20:59 +0700 Subject: [PATCH 04/11] fix(components): inconsistent style rounded button (#14552) fix(components): fix: inconsistent style rounded button fix: inconsistent style rounded button closed #14550 --- packages/theme-chalk/src/button.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/theme-chalk/src/button.scss b/packages/theme-chalk/src/button.scss index c8f34dcb94..7ac07f8a3b 100644 --- a/packages/theme-chalk/src/button.scss +++ b/packages/theme-chalk/src/button.scss @@ -148,6 +148,7 @@ $button-icon-span-gap: map.merge( border-radius: getCssVar('border-radius', 'round'); } @include when(circle) { + width: map.get($input-height, 'default'); border-radius: 50%; padding: map.get($button-padding-vertical, 'default') - $button-border-width; } From cea19ac161d48f02ce5896127efa432fce7f4d2f Mon Sep 17 00:00:00 2001 From: cuongle-hdwebsoft <102006695+cuongle-hdwebsoft@users.noreply.github.com> Date: Sun, 15 Oct 2023 18:38:17 +0700 Subject: [PATCH 05/11] fix(components): prevent carousel from auto playing (#14553) prevent carousel from auto playing closed #14524 --- packages/components/carousel/src/use-carousel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/carousel/src/use-carousel.ts b/packages/components/carousel/src/use-carousel.ts index 9588b44eb1..93b76a186d 100644 --- a/packages/components/carousel/src/use-carousel.ts +++ b/packages/components/carousel/src/use-carousel.ts @@ -212,7 +212,7 @@ export const useCarousel = ( function resetTimer() { pauseTimer() - startTimer() + if (!props.pauseOnHover) startTimer() } function setContainerHeight(height: number) { From 40b64dfb57ac2274dbec6d27d9be60db3b321807 Mon Sep 17 00:00:00 2001 From: wzc520pyfm <69044080+wzc520pyfm@users.noreply.github.com> Date: Sun, 15 Oct 2023 21:02:13 +0800 Subject: [PATCH 06/11] docs(components): [upload] use new display tag (#12701) * docs(components): [upload] use new display tag * docs(components): [upload] add description for beford-upload * feat(components): [upload] delete useless attribute * docs(components): [upload] adjust description and default for attr * docs(components): [upload] add more detail for data attr --- docs/en-US/component/upload.md | 135 ++++++++++++------ .../components/upload/src/upload-list.vue | 20 ++- packages/components/upload/src/upload.ts | 79 +++++++++- 3 files changed, 178 insertions(+), 56 deletions(-) diff --git a/docs/en-US/component/upload.md b/docs/en-US/component/upload.md index c8a3112ba2..8bd97b114e 100644 --- a/docs/en-US/component/upload.md +++ b/docs/en-US/component/upload.md @@ -89,53 +89,106 @@ upload/manual ::: -## Upload API +## API ### Attributes -| Name | Description | Type | Default | Required | -| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -------- | -------- | -| `action` | request URL. | `string` | — | Yes | -| `headers` | request headers. | `Headers \| Record` | — | No | -| `method` | set upload request method. | `string` | `'post'` | No | -| `multiple` | whether uploading multiple files is permitted. | `boolean` | `false` | No | -| `data` | additions options of request. support `Awaitable` data and `Function` since v2.3.13 | `Record \| Awaitable> \| ((rawFile: UploadRawFile) => Awaitable>)` | — | No | -| `name` | key name for uploaded file. | `string` | `'file'` | No | -| `with-credentials` | whether cookies are sent. | `boolean` | `false` | No | -| `show-file-list` | whether to show the uploaded file list. | `boolean` | `true` | No | -| `drag` | whether to activate drag and drop mode. | `boolean` | `false` | No | -| `accept` | accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true`. | `string` | — | No | -| `on-preview` | hook function when clicking the uploaded files. | `(uploadFile: UploadFile) => void` | — | No | -| `on-remove` | hook function when files are removed. | `(uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | No | -| `on-success` | hook function when uploaded successfully. | `(response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | No | -| `on-error` | hook function when some errors occurs. | `(error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | No | -| `on-progress` | hook function when some progress occurs. | `(evt: UploadProgressEvent, uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | No | -| `on-change` | hook function when select file or upload file success or upload file fail. | `(uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | No | -| `on-exceed` | hook function when limit is exceeded. | `(files: File[], uploadFiles: UploadUserFile[]) => void` | — | No | -| `before-upload` | hook function before uploading with the file to be uploaded as its parameter. If `false` is returned or a `Promise` is returned and then is rejected, uploading will be aborted. | `(rawFile: UploadRawFile) => Awaitable` | — | No | -| `before-remove` | hook function before removing a file with the file and file list as its parameters. If `false` is returned or a `Promise` is returned and then is rejected, removing will be aborted. | `(uploadFile: UploadFile, uploadFiles: UploadFiles) => Awaitable` | — | No | -| `file-list` / `v-model:file-list` | default uploaded files. | `UploadUserFile[]` | `[]` | No | -| `list-type` | type of file list. | `'text' \| 'picture' \| 'picture-card'` | `'text'` | No | -| `auto-upload` | whether to auto upload file. | `boolean` | `true` | No | -| `http-request` | override default xhr behavior, allowing you to implement your own upload-file's request. | `(options: UploadRequestOptions) => XMLHttpRequest \| Promise` | — | No | -| `disabled` | whether to disable upload. | `boolean` | `false` | No | -| `limit` | maximum number of uploads allowed. | `number` | — | No | +| Name | Description | Type | Default | +| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| action ^(required) | request URL. | ^[string] | # | +| headers | request headers. | ^[object]`Headers \| Record` | — | +| method | set upload request method. | ^[string] | post | +| multiple | whether uploading multiple files is permitted. | ^[boolean] | false | +| data | additions options of request. support `Awaitable` data and `Function` since v2.3.13. | ^[object]`Record \| Awaitable>` / ^[Function]`(rawFile: UploadRawFile) => Awaitable>` | {} | +| name | key name for uploaded file. | ^[string] | file | +| with-credentials | whether cookies are sent. | ^[boolean] | false | +| show-file-list | whether to show the uploaded file list. | ^[boolean] | true | +| drag | whether to activate drag and drop mode. | ^[boolean] | false | +| accept | accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true`. | ^[string] | '' | +| on-preview | hook function when clicking the uploaded files. | ^[Function]`(uploadFile: UploadFile) => void` | — | +| on-remove | hook function when files are removed. | ^[Function]`(uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | +| on-success | hook function when uploaded successfully. | ^[Function]`(response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | +| on-error | hook function when some errors occurs. | ^[Function]`(error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | +| on-progress | hook function when some progress occurs. | ^[Function]`(evt: UploadProgressEvent, uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | +| on-change | hook function when select file or upload file success or upload file fail. | ^[Function]`(uploadFile: UploadFile, uploadFiles: UploadFiles) => void` | — | +| on-exceed | hook function when limit is exceeded. | ^[Function]`(files: File[], uploadFiles: UploadUserFile[]) => void` | — | +| before-upload | hook function before uploading with the file to be uploaded as its parameter. If `false` is returned or a `Promise` is returned and then is rejected, uploading will be aborted. | ^[Function]`(rawFile: UploadRawFile) => Awaitable` | — | +| before-remove | hook function before removing a file with the file and file list as its parameters. If `false` is returned or a `Promise` is returned and then is rejected, removing will be aborted. | ^[Function]`(uploadFile: UploadFile, uploadFiles: UploadFiles) => Awaitable` | — | +| file-list / v-model:file-list | default uploaded files. | ^[object]`UploadUserFile[]` | [] | +| list-type | type of file list. | ^[enum]`'text' \| 'picture' \| 'picture-card'` | text | +| auto-upload | whether to auto upload file. | ^[boolean] | true | +| http-request | override default xhr behavior, allowing you to implement your own upload-file's request. | ^[Function]`(options: UploadRequestOptions) => XMLHttpRequest \| Promise` | ajaxUpload [see](https://github.com/element-plus/element-plus/blob/dev/packages/components/upload/src/ajax.ts#L55) | +| disabled | whether to disable upload. | ^[boolean] | false | +| limit | maximum number of uploads allowed. | ^[number] | — | ### Slots -| Name | Description | Type | -| --------- | ----------------------------------- | ---------------------- | -| `default` | customize default content. | - | -| `trigger` | content which triggers file dialog. | - | -| `tip` | content of tips. | - | -| `file` | content of thumbnail template. | `{ file: UploadFile }` | +| Name | Description | Type | +| ------- | ----------------------------------- | ------------------------------- | +| default | customize default content. | - | +| trigger | content which triggers file dialog. | - | +| tip | content of tips. | - | +| file | content of thumbnail template. | ^[object]`{ file: UploadFile }` | ### Exposes -| Name | Description | Type | -| -------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | -| `abort` | cancel upload request. | `(file: UploadFile) => void` | -| `submit` | upload the file list manually. | `() => void` | -| `clearFiles` | clear the file list (this method is not supported in the `before-upload` hook). | `(status?: Array<"ready" \| "uploading" \| "success" \| "fail">) => void` | -| `handleStart` | select the file manually. | `(rawFile: UploadRawFile) => void` | -| `handleRemove` | remove the file manually. `file` and `rawFile` has been merged. `rawFile` will be removed in `v2.2.0`. | `(file: UploadFile \| UploadRawFile, rawFile?: UploadRawFile) => void` | +| Name | Description | Type | +| ------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| abort | cancel upload request. | ^[Function]`(file: UploadFile) => void` | +| submit | upload the file list manually. | ^[Function]`() => void` | +| clearFiles | clear the file list (this method is not supported in the `before-upload` hook). | ^[Function]`(status?: UploadStatus[]) => void` | +| handleStart | select the file manually. | ^[Function]`(rawFile: UploadRawFile) => void` | +| handleRemove | remove the file manually. `file` and `rawFile` has been merged. `rawFile` will be removed in `v2.2.0`. | ^[Function]`(file: UploadFile \| UploadRawFile, rawFile?: UploadRawFile) => void` | + +## Type Declarations + +
+ Show declarations + +```ts + +type UploadFiles = UploadFile[] + +type UploadUserFile = Omit & + Partial> + +type UploadStatus = 'ready' | 'uploading' | 'success' | 'fail' + +type Awaitable = Promise | T + +type Mutable = { -readonly [P in keyof T]: T[P] } + +interface UploadFile { + name: string + percentage?: number + status: UploadStatus + size?: number + response?: unknown + uid: number + url?: string + raw?: UploadRawFile +} + +interface UploadProgressEvent extends ProgressEvent { + percent: number +} + +interface UploadRawFile extends File { + uid: number +} + +interface UploadRequestOptions { + action: string + method: string + data: Record + filename: string + file: File + headers: Headers | Record + onError: (evt: UploadAjaxError) => void + onProgress: (evt: UploadProgressEvent) => void + onSuccess: (response: any) => void + withCredentials: boolean +} +``` + +
diff --git a/packages/components/upload/src/upload-list.vue b/packages/components/upload/src/upload-list.vue index b56832489a..c9cdd1634d 100644 --- a/packages/components/upload/src/upload-list.vue +++ b/packages/components/upload/src/upload-list.vue @@ -1,13 +1,5 @@