Skip to content

Commit

Permalink
feat(FaFormDialog)!: rename event 'fullscreen-change' to 'fullscreenC…
Browse files Browse the repository at this point in the history
…hange'
  • Loading branch information
cloydlau committed Apr 8, 2024
1 parent 8ddd009 commit 3bd77a3
Show file tree
Hide file tree
Showing 26 changed files with 2,289 additions and 1,851 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"json",
"jsonc",
"yaml",
"toml"
"toml",
"gql",
"graphql"
]
}
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,10 @@ new Vue({

### Events

| 名称 | 说明 | 回调参数 |
| ----------------- | ----------------------------- | --------------------- |
| fullscreen-change | 切换全屏状态时触发 | (fullscreen: boolean) |
| ... | `el-dialog``el-form` 的事件 | |
| 名称 | 说明 | 回调参数 |
| ---------------- | ----------------------------- | --------------------- |
| fullscreenChange | 切换全屏状态时触发 | (fullscreen: boolean) |
| ... | `el-dialog``el-form` 的事件 | |

### Slots

Expand Down Expand Up @@ -702,7 +702,7 @@ const faImageRef = ref()
const value = ref([])
const loadCount = ref(0)
function onLoad() {
if (++loadCount === value.length) {
if (++loadCount.value === value.value.length) {
faImageRef.value.hydrate()
}
}
Expand Down Expand Up @@ -1049,7 +1049,8 @@ FaMessageBox.confirm('Are You Sure?').then(() => {
}).catch((e) => {
if (e.isDenied) {
// onDenied
} else if (e.isDismissed) {
}
else if (e.isDismissed) {
// onDismissed
}
})
Expand Down Expand Up @@ -1105,7 +1106,8 @@ FaMessageBox.confirm({
}).catch((e) => {
alert('Deny Failed')
})
} else {
}
else {
FaMessageBox.showValidationMessage('Please fill in the remark')
return false
}
Expand All @@ -1115,7 +1117,8 @@ FaMessageBox.confirm({
}).catch((e) => {
if (e.isDenied) {
alert('Denied')
} else if (e.isDismissed) {
}
else if (e.isDismissed) {
alert('Dismissed')
}
})
Expand Down Expand Up @@ -1224,6 +1227,7 @@ import FaMessageBox from 'faim/dist/components/MessageBox/index'
- 可离线使用,零网络延迟
- 无[域名检测](#域名检测),无弹窗困扰
- 使用 tinymce@6 (MIT),无许可证风险
- 插件全家桶开箱即用
- 提供常用自定义插件示例
- 插入本地图片
Expand Down Expand Up @@ -1366,7 +1370,8 @@ app.use(FaRichText, {
}).then((res) => {
if (typeof res.data?.data === 'string') {
success(res.data.data)
} else {
}
else {
failure(res.data?.message)
}
}).catch((err) => {
Expand Down
4 changes: 2 additions & 2 deletions demo/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function loading() {
@input="() => {
// console.log('input')
}"
@update:model-value="() => {
@update:modelValue="() => {
console.log('update:modelValue')
}"
/>
Expand Down Expand Up @@ -580,7 +580,7 @@ function loading() {
</template>
<style lang="scss">
.FaImageUpload>.el-form-item__content {
.FaImageUpload > .el-form-item__content {
display: flex;
flex-direction: column;
align-items: start;
Expand Down
7 changes: 5 additions & 2 deletions demo/RichText/globalConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// '?raw' 是 Vite 语法,在 webpack 中请使用 https://github.com/webpack-contrib/raw-loader

// 浅色模式
import 'tinymce/skins/ui/oxide/skin.min.css' // 皮肤
import 'tinymce/skins/ui/oxide/skin.min.css'

// 皮肤
import contentCSS from 'tinymce/skins/content/default/content.min.css?raw'
import contentUICSS from 'tinymce/skins/ui/oxide/content.min.css?raw'

Expand Down Expand Up @@ -120,7 +122,8 @@ export default {
}).then((res) => {
if (typeof res.data?.data === 'string') {
return res.data.data
} else {
}
else {
Promise.reject(res)
}
})
Expand Down
2 changes: 1 addition & 1 deletion demo/RichText/langs/zh-Hans.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion demo/RichText/plugins/InsertFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default {
vm.appContext = app._context
render(vm, container)
document.body.appendChild(container)
} else {
}
else {
const { Vue } = await import('vue-demi')
const Constructor = Vue.extend({
render: h => h(this, { props }),
Expand Down
15 changes: 10 additions & 5 deletions demo/RichText/plugins/InsertWord.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ export default {
console.log(`${file.name} 解析结果:`, res)
if (value) {
resolve(value)
} else {
}
else {
reject(new Error(`${file.name} 内容为空`))
}
}).catch((err) => {
reject(err)
})
} else {
}
else {
reject(new Error(`${file.name} 内容为空`))
}
}
Expand All @@ -47,19 +49,22 @@ export default {
const { status, value, reason } = result
if (status === 'fulfilled') {
editor.insertContent(value)
} else {
}
else {
if (reason) {
if (typeof reason === 'string') {
FaMessageBox.showValidationMessage(reason)
} else {
}
else {
console.error(reason)
FaMessageBox.showValidationMessage('解析失败')
}
}
}
})
})
} else {
}
else {
FaMessageBox.showValidationMessage('未选择任何文件')
}
},
Expand Down
18 changes: 12 additions & 6 deletions demo/Upload/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ function sliceFile(file, CHUNK_SIZE = 10 * MB) {
if (end + CHUNK_SIZE >= file.size) {
chunks.push(file.slice(start))
break
} else {
}
else {
end += CHUNK_SIZE
const blob = file.slice(start, end)
chunks.push(blob)
start += CHUNK_SIZE
}
}
} else {
}
else {
chunks.push(file.slice(0))
}
}
Expand Down Expand Up @@ -64,10 +66,12 @@ export default function upload(file, progress, abortController) {
const data = 'data' in res ? ('data' in res.data ? res.data.data : res.data) : res
if (data?.status === '200') {
resolve(data.url)
} else if (count++ < chunks.length - 1) {
}
else if (count++ < chunks.length - 1) {
formData.taskId = data.url
recursion()
} else {
}
else {
FaMessageBox.error('上传失败')
reject(Error('上传失败'))
}
Expand All @@ -78,9 +82,11 @@ export default function upload(file, progress, abortController) {
failTimes = Number.MAX_VALUE
reject(Error('上传取消'))
// 断点续传
} else if (failTimes++ < RETRY_TIMES) {
}
else if (failTimes++ < RETRY_TIMES) {
recursion()
} else {
}
else {
FaMessageBox.error('上传失败')
reject(Error('上传失败'))
}
Expand Down
6 changes: 4 additions & 2 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@ import antfu from '@antfu/eslint-config'
export default antfu(
{
formatters: true,
ignores: ['demo/'],
},
{
rules: {
'brace-style': ['error', 'stroustrup', { allowSingleLine: false }],
'curly': ['error', 'all'],
'no-console': 'off',
'vue/attribute-hyphenation': 'off',
'vue/custom-event-name-casing': 'off',
'vue/max-attributes-per-line': 'error',
'vue/multi-word-component-names': 'off',
'vue/no-deprecated-v-bind-sync': 'off',
'vue/no-deprecated-v-on-native-modifier': 'off',
'vue/no-deprecated-destroyed-lifecycle': 'off',
'vue/no-deprecated-dollar-listeners-api': 'off',
'vue/no-deprecated-dollar-scopedslots-api': 'off',
'vue/no-v-html': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/v-on-event-hyphenation': ['error', 'never'],
},
},
)
24 changes: 11 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ NAME }} (Vue {{ VUE_VERSION }})</title>
</head>

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ NAME }} (Vue {{ VUE_VERSION }})</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/demo/vue{{ VUE_VERSION }}.js"></script>
</body>

<body>
<div id="app"></div>
<script type="module" src="/demo/vue{{ VUE_VERSION }}.js"></script>
</body>
</html>
58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"build": "npx unbuild",
"preview": "vite preview",
"release": "esno ./scripts/release.mts",
"lint": "eslint \"**/*.{vue,js,ts,mjs,mts,jsx,tsx,md,json}\"",
"lint:fix": "eslint \"**/*.{vue,js,ts,mjs,mts,jsx,tsx,md,json}\" --fix",
"lint": "eslint \"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,json,md,html,css,scss,sass}\" --ignore-pattern stats.html",
"lint:fix": "eslint \"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,json,md,html,css,scss,sass}\" --ignore-pattern stats.html --fix",
"preinstall": "node -e \"if (process.env.INIT_CWD === process.cwd()) { process.exit(1) }\" || npx only-allow pnpm",
"postinstall": "node ./scripts/postinstall.mjs"
},
Expand All @@ -68,24 +68,24 @@
}
},
"dependencies": {
"@vueuse/core": "^10.7.2",
"@vueuse/core": "^10.9.0",
"await-to-js": "^3.0.0",
"cropperjs": "^1.6.1",
"cross-spawn": "^7.0.3",
"del": "^7.1.0",
"filepond": "^4.30.6",
"filepond-plugin-file-validate-size": "^2.2.8",
"filepond-plugin-file-validate-type": "^1.2.8",
"filepond-plugin-file-validate-type": "^1.2.9",
"filepond-plugin-image-validate-size": "^1.2.7",
"kolorist": "^1.8.0",
"lodash-es": "^4.17.21",
"mime": "^4.0.1",
"qrcode": "^1.5.3",
"sass": "^1.70.0",
"sass": "^1.74.1",
"sortablejs": "^1.15.2",
"sweetalert2": "^11.10.5",
"swiper": "^11.0.6",
"tinymce": "^6.8.2",
"sweetalert2": "^11.10.7",
"swiper": "^11.1.0",
"tinymce": "^6",
"upng-js": "^2.1.0",
"uuid": "^9.0.1",
"validator": "^13.11.0",
Expand All @@ -94,40 +94,40 @@
"vue-global-config": "^0.6.0"
},
"devDependencies": {
"@antfu/eslint-config": "^2.6.4",
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@antfu/eslint-config": "^2.12.2",
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@element-plus/icons-vue": "^2.3.1",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.11.16",
"@types/node": "^20.12.5",
"@types/uuid": "^9.0.8",
"@types/validator": "^13.11.9",
"@vitejs/plugin-vue": "^5.0.3",
"@vue/compiler-sfc": "^3.4.15",
"@vue/test-utils": "^2.4.4",
"axios": "^1.6.7",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/compiler-sfc": "^3.4.21",
"@vue/test-utils": "^2.4.5",
"axios": "^1.6.8",
"axios-shortcut": "^0.1.3",
"case-police": "^0.6.1",
"element-plus": "^2.5.5",
"eslint": "npm:eslint-ts-patch@8.56.0-0",
"element-plus": "^2.6.3",
"eslint": "npm:eslint-ts-patch@8.57.0-0",
"eslint-plugin-format": "^0.1.0",
"eslint-ts-patch": "8.56.0-0",
"esno": "^4.0.0",
"eslint-ts-patch": "8.57.0-0",
"esno": "^4.7.0",
"faim": "workspace:*",
"json-editor-vue": "^0.12.0",
"json-editor-vue": "^0.13.0",
"lint-staged": "^15.2.2",
"magicast": "^0.3.3",
"mammoth": "^1.6.0",
"mammoth": "^1.7.1",
"only-allow": "^1.2.1",
"open": "^10.0.3",
"open": "^10.1.0",
"prompts": "^2.4.2",
"semver": "^7.6.0",
"simple-git-hooks": "^2.9.0",
"typescript": "^5.3.3",
"simple-git-hooks": "^2.11.1",
"typescript": "^5.4.4",
"unbuild": "^2.0.0",
"vite": "^5.0.12",
"vue": "^3.4.15",
"zhlint": "^0.7.4"
"vite": "^5.2.8",
"vue": "^3.4.21",
"zhlint": "^0.8.1"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged",
Expand All @@ -138,6 +138,6 @@
"case-police --fix",
"zhlint --fix"
],
"*.{vue,js,ts,mjs,mts,jsx,tsx,md,json}": "eslint --cache --fix"
"*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,json,md,html,css,scss,sass}": "eslint --ignore-pattern stats.html --cache --fix"
}
}
Loading

0 comments on commit 3bd77a3

Please sign in to comment.