diff --git a/.vscode/settings.json b/.vscode/settings.json index 096d7ad9..bbcf8694 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,8 +25,8 @@ //============= files ======================= //=========================================== "files.trimTrailingWhitespace": true, - "files.insertFinalNewline": true, - "files.trimFinalNewlines": true, + // "files.insertFinalNewline": true, + // "files.trimFinalNewlines": true, "files.eol": "\n", "search.exclude": { "**/node_modules": true, @@ -76,14 +76,14 @@ // =========================================== // ================ Vetur ==================== // =========================================== - "vetur.experimental.templateInterpolationService": true, - "vetur.format.options.tabSize": 2, - "vetur.languageFeatures.codeActions": false, - "vetur.format.defaultFormatterOptions": { - "js-beautify-html": { - "wrap_attributes": "force-expand-multiline" - } - }, + // "vetur.experimental.templateInterpolationService": true, + // "vetur.format.options.tabSize": 2, + // "vetur.languageFeatures.codeActions": false, + // "vetur.format.defaultFormatterOptions": { + // "js-beautify-html": { + // "wrap_attributes": "force-expand-multiline" + // } + // }, "liveServer.settings.donotShowInfoMsg": true, "telemetry.enableCrashReporter": false, "workbench.settings.enableNaturalLanguageSearch": false, diff --git a/build/vite/plugin/compress.ts b/build/vite/plugin/compress.ts index 45583be2..9563679c 100644 --- a/build/vite/plugin/compress.ts +++ b/build/vite/plugin/compress.ts @@ -8,7 +8,7 @@ import compressPlugin from 'vite-plugin-compression'; export function configCompressPlugin( compress: 'gzip' | 'brotli' | 'none', - deleteOriginFile: boolean = false + deleteOriginFile = false ): Plugin | Plugin[] { const compressList = compress.split(','); diff --git a/package.json b/package.json index cab3846e..1fd90090 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "concurrently": "^5.3.0", "@commitlint/cli": "^12.1.4", "@commitlint/config-conventional": "^12.1.4", - "@iconify/json": "^1.1.350", + "@iconify/json": "^1.1.353", "@purge-icons/generated": "^0.7.0", "@types/codemirror": "^5.60.0", "@types/crypto-js": "^4.0.1", @@ -130,7 +130,7 @@ "@types/inquirer": "^7.3.1", "@types/lodash-es": "^4.17.4", "@types/mockjs": "^1.0.3", - "@types/node": "^15.12.0", + "@types/node": "^15.12.1", "@types/nprogress": "^0.2.0", "@types/qrcode": "^1.4.0", "@types/qs": "^6.9.6", @@ -146,12 +146,12 @@ "conventional-changelog-cli": "^2.1.1", "cross-env": "^7.0.3", "dotenv": "^10.0.0", - "eslint": "^7.27.0", + "eslint": "^7.28.0", "eslint-config-prettier": "^8.3.0", "eslint-define-config": "^1.0.8", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-vue": "^7.10.0", - "esno": "^0.6.0", + "esno": "^0.7.0", "fs-extra": "^10.0.0", "http-server": "^0.12.3", "husky": "^6.0.0", @@ -160,7 +160,7 @@ "less": "^4.1.1", "lint-staged": "^11.0.0", "postcss": "^8.3.0", - "prettier": "^2.3.0", + "prettier": "^2.3.1", "pretty-quick": "^3.1.0", "rimraf": "^3.0.2", "rollup-plugin-visualizer": "5.5.0", @@ -187,7 +187,7 @@ "resolutions": { "//": "Used to install imagemin dependencies, because imagemin may not be installed in China. If it is abroad, you can delete it", "bin-wrapper": "npm:bin-wrapper-china", - "rollup": "^2.50.6" + "rollup": "^2.51.0" }, "repository": { "type": "git", diff --git a/src/components/Button/src/BasicButton.vue b/src/components/Button/src/BasicButton.vue index 8d349e8d..d4fadbcb 100644 --- a/src/components/Button/src/BasicButton.vue +++ b/src/components/Button/src/BasicButton.vue @@ -1,47 +1,49 @@ diff --git a/src/components/Button/src/PopConfirmButton.vue b/src/components/Button/src/PopConfirmButton.vue index 7691cf60..4e546a05 100644 --- a/src/components/Button/src/PopConfirmButton.vue +++ b/src/components/Button/src/PopConfirmButton.vue @@ -1,31 +1,33 @@ diff --git a/src/components/Table/src/components/settings/ColumnSetting.vue b/src/components/Table/src/components/settings/ColumnSetting.vue index 9c78c826..e77dae9b 100644 --- a/src/components/Table/src/components/settings/ColumnSetting.vue +++ b/src/components/Table/src/components/settings/ColumnSetting.vue @@ -114,7 +114,7 @@ import { getPopupContainer } from '/@/utils'; import { omit } from 'lodash-es'; - import type { BasicColumn } from '../../types/table'; + import type { BasicColumn, ColumnChangeParam } from '../../types/table'; interface State { checkAll: boolean; @@ -141,8 +141,9 @@ Divider, Icon, }, + emits: ['columns-change'], - setup() { + setup(_, { emit }) { const { t } = useI18n(); const table = useTableContext(); @@ -234,10 +235,10 @@ const checkList = plainOptions.value.map((item) => item.value); if (e.target.checked) { state.checkedList = checkList; - table.setColumns(checkList); + setColumns(checkList); } else { state.checkedList = []; - table.setColumns([]); + setColumns([]); } } @@ -257,7 +258,7 @@ checkedList.sort((prev, next) => { return sortList.indexOf(prev) - sortList.indexOf(next); }); - table.setColumns(checkedList); + setColumns(checkedList); } // reset columns @@ -266,7 +267,7 @@ state.checkAll = true; plainOptions.value = unref(cachePlainOptions); plainSortOptions.value = unref(cachePlainOptions); - table.setColumns(table.getCacheColumns()); + setColumns(table.getCacheColumns()); } // Open the pop-up window for drag and drop initialization @@ -298,7 +299,7 @@ plainSortOptions.value = columns; plainOptions.value = columns; - table.setColumns(columns); + setColumns(columns); }, }); initSortable(); @@ -335,7 +336,21 @@ item.width = 100; } table.setCacheColumnsByField?.(item.dataIndex, { fixed: isFixed }); + setColumns(columns); + } + + function setColumns(columns: BasicColumn[] | string[]) { table.setColumns(columns); + const data: ColumnChangeParam[] = unref(plainOptions).map((col) => { + const visible = + columns.findIndex( + (c: BasicColumn | string) => + c === col.value || (typeof c !== 'string' && c.dataIndex === col.value) + ) !== -1; + return { dataIndex: col.value, fixed: col.fixed, visible }; + }); + + emit('columns-change', data); } return { diff --git a/src/components/Table/src/components/settings/index.vue b/src/components/Table/src/components/settings/index.vue index ed079993..4c0b054d 100644 --- a/src/components/Table/src/components/settings/index.vue +++ b/src/components/Table/src/components/settings/index.vue @@ -2,13 +2,13 @@
- +
diff --git a/src/components/Table/src/hooks/useTable.ts b/src/components/Table/src/hooks/useTable.ts index 58b30502..740420a5 100644 --- a/src/components/Table/src/hooks/useTable.ts +++ b/src/components/Table/src/hooks/useTable.ts @@ -2,16 +2,10 @@ import type { BasicTableProps, TableActionType, FetchParams, BasicColumn } from import type { PaginationProps } from '../types/pagination'; import type { DynamicProps } from '/#/utils'; import type { FormActionType } from '/@/components/Form'; -// import type { WatchStopHandle } from 'vue'; +import type { WatchStopHandle } from 'vue'; import { getDynamicProps } from '/@/utils'; -import { - ref, - onUnmounted, - unref, - // watch, - toRaw, -} from 'vue'; +import { ref, onUnmounted, unref, watch, toRaw } from 'vue'; import { isProdMode } from '/@/utils/env'; import { error } from '/@/utils/log'; @@ -31,7 +25,7 @@ export function useTable(tableProps?: Props): [ const loadedRef = ref>(false); const formRef = ref>(null); - // let stopWatch: WatchStopHandle; + let stopWatch: WatchStopHandle; function register(instance: TableActionType, formInstance: UseTableMethod) { isProdMode() && @@ -47,18 +41,18 @@ export function useTable(tableProps?: Props): [ tableProps && instance.setProps(getDynamicProps(tableProps)); loadedRef.value = true; - // stopWatch?.(); + stopWatch?.(); - // stopWatch = watch( - // () => tableProps, - // () => { - // tableProps && instance.setProps(getDynamicProps(tableProps)); - // }, - // { - // immediate: true, - // deep: true, - // } - // ); + stopWatch = watch( + () => tableProps, + () => { + tableProps && instance.setProps(getDynamicProps(tableProps)); + }, + { + immediate: true, + deep: true, + } + ); } function getTableInstance(): TableActionType { diff --git a/src/components/Table/src/hooks/useTableHeader.ts b/src/components/Table/src/hooks/useTableHeader.ts index 93c3ef4a..a3e77a29 100644 --- a/src/components/Table/src/hooks/useTableHeader.ts +++ b/src/components/Table/src/hooks/useTableHeader.ts @@ -1,5 +1,5 @@ import type { ComputedRef, Slots } from 'vue'; -import type { BasicTableProps } from '../types/table'; +import type { BasicTableProps, InnerHandlers } from '../types/table'; import { unref, computed, h } from 'vue'; import TableHeader from '../components/TableHeader.vue'; @@ -7,7 +7,11 @@ import TableHeader from '../components/TableHeader.vue'; import { isString } from '/@/utils/is'; import { getSlot } from '/@/utils/helper/tsxHelper'; -export function useTableHeader(propsRef: ComputedRef, slots: Slots) { +export function useTableHeader( + propsRef: ComputedRef, + slots: Slots, + handlers: InnerHandlers +) { const getHeaderProps = computed((): Recordable => { const { title, showTableSetting, titleHelpMessage, tableSetting } = unref(propsRef); const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting; @@ -26,6 +30,7 @@ export function useTableHeader(propsRef: ComputedRef, slots: Sl titleHelpMessage, showTableSetting, tableSetting, + onColumnsChange: handlers.onColumnsChange, } as Recordable, { ...(slots.toolbar diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts index 7e61c015..9b5b217a 100644 --- a/src/components/Table/src/types/table.ts +++ b/src/components/Table/src/types/table.ts @@ -381,6 +381,8 @@ export interface BasicTableProps { * @param expandedRows */ onExpandedRowsChange?: (expandedRows: string[] | number[]) => void; + + onColumnsChange?: (data: ColumnChangeParam[]) => void; } export type CellFormat = @@ -427,3 +429,13 @@ export interface BasicColumn extends ColumnProps { // 业务控制是否显示 ifShow?: boolean | ((column: BasicColumn) => boolean); } + +export type ColumnChangeParam = { + dataIndex: string; + fixed: boolean | 'left' | 'right' | undefined; + visible: boolean; +}; + +export interface InnerHandlers { + onColumnsChange: (data: ColumnChangeParam[]) => void; +} diff --git a/src/components/Tinymce/src/Editor.vue b/src/components/Tinymce/src/Editor.vue index 72223f72..94c280a6 100644 --- a/src/components/Tinymce/src/Editor.vue +++ b/src/components/Tinymce/src/Editor.vue @@ -6,6 +6,7 @@ @done="handleDone" v-if="showImageUpload" v-show="editorRef" + :disabled="disabled" /> @@ -170,6 +171,16 @@ }; }); + const disabled = computed(() => { + const { options } = props; + const getdDisabled = options && Reflect.get(options, 'readonly'); + const editor = unref(editorRef); + if (editor) { + editor.setMode(getdDisabled ? 'readonly' : 'design'); + } + return getdDisabled ?? false; + }); + watch( () => attrs.disabled, () => { @@ -301,6 +312,7 @@ handleDone, editorRef, fullscreen, + disabled, }; }, }); diff --git a/src/components/Tinymce/src/ImgUpload.vue b/src/components/Tinymce/src/ImgUpload.vue index 41c8ce6d..2963a50c 100644 --- a/src/components/Tinymce/src/ImgUpload.vue +++ b/src/components/Tinymce/src/ImgUpload.vue @@ -8,14 +8,14 @@ :showUploadList="false" accept=".jpg,.jpeg,.gif,.png,.webp" > - + {{ t('component.upload.imgUpload') }}