From c8d76ef783d0ff10068cd8ff4cc0b77f0b908802 Mon Sep 17 00:00:00 2001 From: Cloyd Lau <31238760+cloydlau@users.noreply.github.com> Date: Mon, 6 Nov 2023 08:58:16 +0800 Subject: [PATCH] types: add type `Trigger` --- demo/{request.ts => http.ts} | 0 demo/useAdmateAdapter.ts | 11 +- demo/vue2.6/UseUIFramework/AntDesignVue.vue | 1 + demo/vue2.6/UseUIFramework/Element.vue | 1 + demo/vue2.6/UseUIFramework/PrimeVue.vue | 1 + demo/vue2.6/UseUIFramework/Vuetify.vue | 1 + demo/vue2.6/index.ts | 10 +- demo/vue2.6/index.vue | 37 ++-- demo/vue2.6/router/index.ts | 3 +- demo/vue2.7/index.ts | 8 +- demo/vue2.7/index.vue | 29 +-- package.json | 24 +-- pnpm-lock.yaml | 209 +++++++++++++++++++- scripts/dev.mts | 11 +- src/index.ts | 3 +- vite.config.ts | 53 +++-- 16 files changed, 307 insertions(+), 95 deletions(-) rename demo/{request.ts => http.ts} (100%) diff --git a/demo/request.ts b/demo/http.ts similarity index 100% rename from demo/request.ts rename to demo/http.ts diff --git a/demo/useAdmateAdapter.ts b/demo/useAdmateAdapter.ts index e17683e..0171bcc 100644 --- a/demo/useAdmateAdapter.ts +++ b/demo/useAdmateAdapter.ts @@ -1,14 +1,15 @@ import { cloneDeep, merge, mergeWith } from 'lodash-es' import qs from 'qs' +// import Vue from 'vue' + +// import VueCompositionAPI from '@vue/composition-api' // Vue@2.6 or earlier only import useAdmate from '../src' // TODO -import request from './request' // TODO +import http from './http' -// Vue@2.6 or earlier only -/* import VueCompositionAPI from '@vue/composition-api' -Vue.use(VueCompositionAPI) */ +// Vue.use(VueCompositionAPI) // Vue@2.6 or earlier only export default (admateConfig, { // 表单标题 @@ -109,7 +110,7 @@ export default (admateConfig, { disable, updateStatus, } = useAdmate(merge({ - axios: request, + axios: http, axiosConfig: { c: { url: 'create', diff --git a/demo/vue2.6/UseUIFramework/AntDesignVue.vue b/demo/vue2.6/UseUIFramework/AntDesignVue.vue index 8661125..6fbf72c 100644 --- a/demo/vue2.6/UseUIFramework/AntDesignVue.vue +++ b/demo/vue2.6/UseUIFramework/AntDesignVue.vue @@ -1,6 +1,7 @@ + - - diff --git a/demo/vue2.6/router/index.ts b/demo/vue2.6/router/index.ts index 41522f5..ea60da8 100644 --- a/demo/vue2.6/router/index.ts +++ b/demo/vue2.6/router/index.ts @@ -1,8 +1,9 @@ +import Vue from 'vue' import VueRouter from 'vue-router' import routes from './routes' Vue.use(VueRouter) export default new VueRouter({ - routes + routes, }) diff --git a/demo/vue2.7/index.ts b/demo/vue2.7/index.ts index 9988e06..92f7543 100644 --- a/demo/vue2.7/index.ts +++ b/demo/vue2.7/index.ts @@ -6,8 +6,7 @@ import 'uno.css' import 'element-ui/lib/theme-chalk/index.css' import ElementUI from 'element-ui' -import 'kikimore/dist/style.css' -import { FormDialog, Select } from 'kikimore' +import { FaFormDialog, FaSelect } from 'faim' import 'ant-design-vue/dist/antd.css' import AntD from 'ant-design-vue' @@ -16,9 +15,10 @@ import '@mdi/font/css/materialdesignicons.css' import 'vuetify/dist/vuetify.min.css' import Vuetify from 'vuetify' import App from './index.vue' + Vue.use(ElementUI) -Vue.use(FormDialog) -Vue.use(Select) +Vue.use(FaFormDialog) +Vue.use(FaSelect) Vue.use(AntD) Vue.use(Vuetify) diff --git a/demo/vue2.7/index.vue b/demo/vue2.7/index.vue index 50a2655..a9981d1 100644 --- a/demo/vue2.7/index.vue +++ b/demo/vue2.7/index.vue @@ -1,7 +1,22 @@ + + - - diff --git a/package.json b/package.json index aa48a01..e74efdd 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "PascalCasedName": "Admate", "version": "0.9.7", "private": false, - "description": "Mate/Helper/Assistant of admin interfaces for Vue 2.6/2.7/3, extremely concise without losing flexibility.", + "description": "Assistant/Helper of admin interfaces for Vue 2.6/2.7/3, extremely concise without losing flexibility.", "author": { "name": "Cloyd Lau", "url": "https://github.com/cloydlau" @@ -13,24 +13,23 @@ "keywords": [ "admin", "admin-interfaces", + "manage", + "management", + "vue-pure-admin", + "vue-vben-admin", + "vue-element-admin", + "crud", + "vue-demi", + "axios", "antd", "ant-design", "ant-design-vue", - "axios", - "back-office", - "crud", "element", "element-ui", "element-plus", - "manage", - "management", "prime-vue", "quasar", - "vuetify", - "vue-demi", - "vue-element-admin", - "vue-vben-admin", - "vue-pure-admin" + "vuetify" ], "exports": { ".": { @@ -92,6 +91,7 @@ "del": "latest", "element-plus": "latest", "esno": "latest", + "faim": "0.4.0-alpha.7", "kolorist": "latest", "lint-staged": "latest", "lodash-es": "latest", @@ -132,4 +132,4 @@ ], "{scripts,src}": "eslint --cache --fix" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 94080b3..d4880b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,10 +68,13 @@ importers: version: 7.1.0 element-plus: specifier: latest - version: 2.4.1(@vue/composition-api@1.7.2)(vue@3.3.7) + version: 2.4.2(@vue/composition-api@1.7.2)(vue@3.3.7) esno: specifier: latest version: 0.17.0 + faim: + specifier: 0.4.0-alpha.7 + version: 0.4.0-alpha.7(@vue/composition-api@1.7.2)(element-plus@2.4.2)(vue@3.3.7) kolorist: specifier: latest version: 1.8.0 @@ -2378,6 +2381,11 @@ packages: engines: {node: '>= 0.4'} dev: true + /await-to-js@3.0.0: + resolution: {integrity: sha512-zJAaP9zxTcvTHRlejau3ZOY4V7SRpiByf3/dxx2uyKxxor19tpmpV2QRsTKikckwhaPmr2dVpxxMr7jOCYVp5g==} + engines: {node: '>=6.0.0'} + dev: true + /axios@1.6.0: resolution: {integrity: sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==} dependencies: @@ -2708,6 +2716,14 @@ packages: string-width: 5.1.2 dev: true + /cliui@6.0.0: + resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 6.2.0 + dev: true + /cliui@8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} @@ -2923,6 +2939,10 @@ packages: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} dev: true + /cropperjs@1.6.1: + resolution: {integrity: sha512-F4wsi+XkDHCOMrHMYjrTEE4QBOrsHHN5/2VsVAaRq8P7E5z7xQpT75S+f/9WikmBEailas3+yo+6zPIomW+NOA==} + dev: true + /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} @@ -3119,6 +3139,10 @@ packages: randombytes: 2.1.0 dev: true + /dijkstrajs@1.0.3: + resolution: {integrity: sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==} + dev: true + /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -3210,8 +3234,8 @@ packages: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} dev: true - /element-plus@2.4.1(@vue/composition-api@1.7.2)(vue@3.3.7): - resolution: {integrity: sha512-t7nl+vQlkBKVk1Ag6AufSDyFV8YIXxTFsaya4Nz/0tiRlcz65WPN4WMFeNURuFJleu1HLNtP4YyQKMuS7El8uA==} + /element-plus@2.4.2(@vue/composition-api@1.7.2)(vue@3.3.7): + resolution: {integrity: sha512-E/HwXX7JF1LPvQSjs0fZ8WblIoc0quoXsRXQZiL7QDq7xJdNGSUaXtdk7xiEv7axPmLfEFtxE5du9fFspDrmJw==} peerDependencies: vue: ^3.2.0 dependencies: @@ -3255,6 +3279,10 @@ packages: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} dev: true + /encode-utf8@1.0.3: + resolution: {integrity: sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==} + dev: true + /encodeurl@1.0.2: resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} engines: {node: '>= 0.8'} @@ -4031,6 +4059,49 @@ packages: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} dev: true + /faim@0.4.0-alpha.7(@vue/composition-api@1.7.2)(element-plus@2.4.2)(vue@3.3.7): + resolution: {integrity: sha512-MnlIF4aDFnlVfjdSlZjl8qrXCxsoDHQ1SRre4PcY4ZJwquDDLN7Sj3HYYQrQft/uikyru7sPpc+ugmB0LitiwQ==} + requiresBuild: true + peerDependencies: + element-plus: '>=2' + vue: 2||3 + peerDependenciesMeta: + element-plus: + optional: true + vue: + optional: true + dependencies: + '@vueuse/core': 10.5.0(@vue/composition-api@1.7.2)(vue@3.3.7) + await-to-js: 3.0.0 + cropperjs: 1.6.1 + cross-spawn: 7.0.3 + del: 7.1.0 + element-plus: 2.4.2(@vue/composition-api@1.7.2)(vue@3.3.7) + esno: 0.17.0 + filepond: 4.30.4 + filepond-plugin-file-validate-size: 2.2.8(filepond@4.30.4) + filepond-plugin-file-validate-type: 1.2.8(filepond@4.30.4) + filepond-plugin-image-validate-size: 1.2.7(filepond@4.30.4) + kolorist: 1.8.0 + lodash-es: 4.17.21 + mime: 3.0.0 + qrcode: 1.5.3 + sass: 1.69.5 + sortablejs: 1.15.0 + sweetalert2: 11.9.0 + swiper: 11.0.3 + tinymce: 6.7.2 + upng-js: 2.1.0 + uuid: 9.0.1 + validator: 13.11.0 + viewerjs: 1.11.6 + vue: 3.3.7(typescript@5.2.2) + vue-demi: 0.14.6(@vue/composition-api@1.7.2)(vue@3.3.7) + vue-global-config: 0.4.2(@vue/composition-api@1.7.2)(vue@3.3.7) + transitivePeerDependencies: + - '@vue/composition-api' + dev: true + /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: true @@ -4073,6 +4144,34 @@ packages: flat-cache: 3.1.1 dev: true + /filepond-plugin-file-validate-size@2.2.8(filepond@4.30.4): + resolution: {integrity: sha512-yzb8scATmkWqPTP7oKQz6L8WwJm6Xmgc/fuq6DFGRaLz0I7372BUvBsxagBk/hypMIjvieNzhggm33Y60x3rcw==} + peerDependencies: + filepond: '>=3.1.2 <5.x' + dependencies: + filepond: 4.30.4 + dev: true + + /filepond-plugin-file-validate-type@1.2.8(filepond@4.30.4): + resolution: {integrity: sha512-UBTqIWbk5+5R0GBELI8svu01MHWjFSLfc9DfCMvFtHKXLdJMxY1p37ChC4YKQjhfODaTuvLnNVRsukMGMFZBBg==} + peerDependencies: + filepond: '>=1.x <5.x' + dependencies: + filepond: 4.30.4 + dev: true + + /filepond-plugin-image-validate-size@1.2.7(filepond@4.30.4): + resolution: {integrity: sha512-Sxu2XTbQHf9HRWu+AQg6zJkww0O6hTXq9IX5/SAJLuvohpF23XTzCNg+29KXr4Wulm70/jSSpMcJURn9AU72rA==} + peerDependencies: + filepond: '>=1.8.x <5.x' + dependencies: + filepond: 4.30.4 + dev: true + + /filepond@4.30.4: + resolution: {integrity: sha512-FCwsMvG9iiEs6uobdDrTaKsCgsqys0NuLgPPD8n37AYVYBiiDkrPkk9MSIU5rT2FahYcL1bScYI9huIPtlzqyA==} + dev: true + /fill-range@7.0.1: resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} engines: {node: '>=8'} @@ -5140,6 +5239,12 @@ packages: mime-db: 1.52.0 dev: true + /mime@3.0.0: + resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} + engines: {node: '>=10.0.0'} + hasBin: true + dev: true + /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -5637,6 +5742,11 @@ packages: engines: {node: '>=4'} dev: true + /pngjs@5.0.0: + resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==} + engines: {node: '>=10.13.0'} + dev: true + /postcss-selector-parser@6.0.13: resolution: {integrity: sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==} engines: {node: '>=4'} @@ -5715,6 +5825,17 @@ packages: engines: {node: '>=6'} dev: true + /qrcode@1.5.3: + resolution: {integrity: sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==} + engines: {node: '>=10.13.0'} + hasBin: true + dependencies: + dijkstrajs: 1.0.3 + encode-utf8: 1.0.3 + pngjs: 5.0.0 + yargs: 15.4.1 + dev: true + /qs@6.11.2: resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} engines: {node: '>=0.6'} @@ -5855,6 +5976,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /require-main-filename@2.0.0: + resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} + dev: true + /resize-observer-polyfill@1.5.1: resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==} dev: true @@ -6001,6 +6126,10 @@ packages: lru-cache: 6.0.0 dev: true + /set-blocking@2.0.0: + resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} + dev: true + /set-function-length@1.1.1: resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} engines: {node: '>= 0.4'} @@ -6102,6 +6231,10 @@ packages: is-fullwidth-code-point: 4.0.0 dev: true + /sortablejs@1.15.0: + resolution: {integrity: sha512-bv9qgVMjUMf89wAvM6AxVvS/4MX3sPeN0+agqShejLU5z5GX4C75ow1O2e5k4L6XItUyAK3gH6AxSbXrOM5e8w==} + dev: true + /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} @@ -6274,6 +6407,15 @@ packages: engines: {node: '>= 0.4'} dev: true + /sweetalert2@11.9.0: + resolution: {integrity: sha512-PA3qinKZMNGAhA+AUu2wU7yQOpeZCgOaYWRcg26f4cZN6f7M9iPBuobsxOhR9EHs7ihUIxT6vhAMiB4kcmk1SA==} + dev: true + + /swiper@11.0.3: + resolution: {integrity: sha512-MyV9ooQsriAe2EibeamqewLjgCfSvl2xoyratl6S3ln5BXDL4BzlO6mxcbLMCzQL6Z60b/u0AS/nKrepL0+TAg==} + engines: {node: '>= 4.7.0'} + dev: true + /tabbable@6.2.0: resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} dev: true @@ -6309,6 +6451,10 @@ packages: setimmediate: 1.0.5 dev: true + /tinymce@6.7.2: + resolution: {integrity: sha512-6h/02jHmXyghekFzmzccZxUUEFtlPEKHxOd+gd49bjno3ybavZInPIaDd/pp2GeEwsFm20oGgJCL7UiebXm9dw==} + dev: true + /tinypool@0.2.4: resolution: {integrity: sha512-Vs3rhkUH6Qq1t5bqtb816oT+HeJTXfwt2cbPH17sWHIYKTotQIFPk3tf2fgqRrVyMDVOc1EnPgzIxfIulXVzwQ==} engines: {node: '>=14.0.0'} @@ -6646,6 +6792,12 @@ packages: engines: {node: '>=8'} dev: true + /upng-js@2.1.0: + resolution: {integrity: sha512-d3xzZzpMP64YkjP5pr8gNyvBt7dLk/uGI67EctzDuVp4lCZyVMo0aJO6l/VDlgbInJYDY6cnClLoBp29eKWI6g==} + dependencies: + pako: 1.0.11 + dev: true + /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -6678,6 +6830,11 @@ packages: engines: {node: '>= 0.4.0'} dev: true + /uuid@9.0.1: + resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} + hasBin: true + dev: true + /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} dependencies: @@ -6710,6 +6867,10 @@ packages: vfile-message: 2.0.4 dev: true + /viewerjs@1.11.6: + resolution: {integrity: sha512-TlhdSp2oEOLFXvEp4psKaeTjR5zBjTRcM/sHUN8PkV1UWuY8HKC8n7GaVdW5Xqnwdr/F1OmzLik1QwDjI4w/nw==} + dev: true + /vite-plugin-dts@3.6.3(@types/node@20.8.10)(typescript@5.2.2)(vite@4.5.0): resolution: {integrity: sha512-NyRvgobl15rYj65coi/gH7UAEH+CpSjh539DbGb40DfOTZSvDLNYTzc8CK4460W+LqXuMK7+U3JAxRB3ksrNPw==} engines: {node: ^14.18.0 || >=16.0.0} @@ -7080,6 +7241,10 @@ packages: resolution: {integrity: sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==} dev: true + /which-module@2.0.1: + resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==} + dev: true + /which-pm-runs@1.1.0: resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==} engines: {node: '>=4'} @@ -7104,6 +7269,15 @@ packages: isexe: 2.0.0 dev: true + /wrap-ansi@6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + dev: true + /wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -7136,6 +7310,10 @@ packages: engines: {node: '>=0.4'} dev: true + /y18n@4.0.3: + resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} + dev: true + /y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} @@ -7159,6 +7337,14 @@ packages: engines: {node: '>= 14'} dev: true + /yargs-parser@18.1.3: + resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} + engines: {node: '>=6'} + dependencies: + camelcase: 5.3.1 + decamelize: 1.2.0 + dev: true + /yargs-parser@20.2.9: resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} engines: {node: '>=10'} @@ -7169,6 +7355,23 @@ packages: engines: {node: '>=12'} dev: true + /yargs@15.4.1: + resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==} + engines: {node: '>=8'} + dependencies: + cliui: 6.0.0 + decamelize: 1.2.0 + find-up: 4.1.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + require-main-filename: 2.0.0 + set-blocking: 2.0.0 + string-width: 4.2.3 + which-module: 2.0.1 + y18n: 4.0.3 + yargs-parser: 18.1.3 + dev: true + /yargs@17.7.2: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} diff --git a/scripts/dev.mts b/scripts/dev.mts index 0bab372..f71e333 100644 --- a/scripts/dev.mts +++ b/scripts/dev.mts @@ -29,6 +29,7 @@ const toPackageOptions: Record>> '@vue/compiler-sfc': 'latest', '@vue/test-utils': 'latest', 'vue': 'latest', + 'vue-router': 'latest', '@element-plus/icons-vue': 'latest', 'element-plus': 'latest', 'primevue': 'latest', @@ -41,8 +42,9 @@ const toPackageOptions: Record>> devDependencies: { '@vitejs/plugin-vue2': 'latest', '@vue/test-utils': 'legacy', - 'vue': '~2.7.14', - 'vue-template-compiler': '~2.7.14', + 'vue': '~2.7', + 'vue-template-compiler': '~2.7', + 'vue-router': '3', 'element-ui': 'latest', 'primevue': '2', 'ant-design-vue': '1', @@ -55,8 +57,9 @@ const toPackageOptions: Record>> '@vue/test-utils': 'legacy', 'vite-plugin-vue2': 'latest', 'unplugin-vue2-script-setup': 'latest', - 'vue': '~2.6.14', - 'vue-template-compiler': '~2.6.14', + 'vue': '~2.6', + 'vue-template-compiler': '~2.6', + 'vue-router': '3', 'element-ui': 'latest', 'primevue': '2', 'ant-design-vue': '1', diff --git a/src/index.ts b/src/index.ts index 5c684cd..a4392d3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,7 @@ export type PayloadAs = 'data' | 'params' | 'config' | undefined type GetList = (payload: any, payloadAs?: PayloadAs) => Promise type OpenForm = (payload: any, payloadAs?: PayloadAs | 'cache') => Promise | undefined type SubmitForm = (params: any) => Promise +export type Trigger = 'init' | 'pageNumberChange' | 'filterChange' | 'c' | 'r' | 'u' | 'd' | 'updateStatus' | 'enable' | 'disable' interface Form { show?: boolean // closeDelay?: number | null, @@ -102,7 +103,7 @@ export default function useAdmate({ urlPrefix: string form?: Form list?: List - getListProxy?: (getList: GetList, trigger?: string) => void + getListProxy?: (getList: GetList, trigger?: Trigger) => void openFormProxy?: (openForm: OpenForm) => Promise
| Form | undefined submitFormProxy?: (submitForm: SubmitForm) => Promise | Form | undefined }): { diff --git a/vite.config.ts b/vite.config.ts index 6235b22..5b4e580 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -14,6 +14,7 @@ const { major, minor } = parse(version) as SemVer export default { optimizeDeps: { + include: ['faim > mime', 'faim > qrcode', 'faim > sweetalert2', 'faim > upng-js'], exclude: ['vue-demi'], }, build: { @@ -36,35 +37,27 @@ export default { }, }, }, - plugins: [ - { - name: 'html-transform', - transformIndexHtml(html: string) { - return html.replace(/\{\{ NAME \}\}/, name).replace(/\{\{ VUE_VERSION \}\}/g, String(major === 3 ? major : `${major}.${minor}`)) - }, + plugins: [{ + name: 'html-transform', + transformIndexHtml(html: string) { + return html.replace(/\{\{ NAME \}\}/, name).replace(/\{\{ VUE_VERSION \}\}/g, String(major === 3 ? major : `${major}.${minor}`)) }, - dts({ rollupTypes: true }), - AutoImport({ - // targets to transform - include: [ - /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx - /\.vue$/, /\.vue\?vue/, // .vue - /\.md$/, // .md - ], - // global imports to register - imports: [ - // presets - (major === 3 || (major === 2 && minor >= 7)) ? 'vue' : '@vue/composition-api', - ], - }), - UnoCSS({ - presets: [ - presetAttributify({}), - presetUno(), - ], - }), - Components(), - viteMockServe(), - vue(), - ], + }, dts({ rollupTypes: true }), AutoImport({ + // targets to transform + include: [ + /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx + /\.vue$/, /\.vue\?vue/, // .vue + /\.md$/, // .md + ], + // global imports to register + imports: [ + // presets + (major === 3 || (major === 2 && minor >= 7)) ? 'vue' : '@vue/composition-api', + ], + }), UnoCSS({ + presets: [ + presetAttributify({}), + presetUno(), + ], + }), Components(), viteMockServe(), vue()], }