Skip to content

Commit

Permalink
[fix]vue3 hooks tools打包
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Feb 17, 2025
1 parent f19e58d commit 8f88424
Show file tree
Hide file tree
Showing 15 changed files with 340 additions and 200 deletions.
45 changes: 27 additions & 18 deletions vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
"module": "es/index.js",
"unpkg": "dist/antd.min.js",
"typings": "es/index.d.ts",
"files": [
"dist",
"lib",
"es",
"typings/global.d.ts",
"locale"
],
"scripts": {
"test:unit": "vitest run --coverage",
"type-check": "vue-tsc --build",
Expand All @@ -33,23 +26,40 @@
},
"dependencies": {
"@ant-design/icons-vue": "^7.0.1",
"@supermapgis/common/locale": "workspace:*",
"@supermapgis/common/hooks": "workspace:*",
"@supermapgis/common/theme-chalk": "workspace:*",
"@supermapgis/common/utils": "workspace:*",
"@supermapgis/mapboxgl/theme-chalk": "workspace:*",
"@supermapgis/mapboxgl/utils": "workspace:*",
"@supermapgis/vue-iclient-common": "workspace:*",
"@supermapgis/vue-iclient-mapboxgl": "workspace:*",
"@types/mapbox-gl": "^3.4.1",
"@types/lodash": "^4.14.182",
"@types/lodash-es": "^4.17.6",
"vue": "3.5.12",
"vue-iclient-core": "workspace:*",
"@types/mapbox-gl": "^3.4.1",
"ant-design-vue": "^4.2.6",
"lodash-es": "^4.17.21"
"lodash-es": "^4.17.21",
"vue": "3.5.12",
"@turf/bbox": "^7.2.0",
"@turf/center": "^7.2.0",
"@turf/helpers": "^6.1.4",
"@turf/transform-scale": "^7.2.0",
"colorcolor": "^1.1.1",
"echarts": "^4.8.0",
"lodash.clonedeep": "^4.5.0",
"lodash.difference": "^4.5.0",
"lodash.max": "^4.0.1",
"lodash.merge": "^4.6.1",
"lodash.mergewith": "^4.6.2",
"lodash.tonumber": "^4.0.3",
"lodash.orderby": "^4.6.0",
"omit.js": "^2.0.2",
"proj4": "^2.15.0",
"simple-statistics": "^7.8.7",
"tinycolor2": "^1.6.0"
},
"devDependencies": {
"vue-iclient-core": "workspace:*",
"@supermapgis/common/hooks": "workspace:*",
"@supermapgis/common/locale": "workspace:*",
"@supermapgis/common/theme-chalk": "workspace:*",
"@supermapgis/common/utils": "workspace:*",
"@supermapgis/mapboxgl/theme-chalk": "workspace:*",
"@supermapgis/mapboxgl/utils": "workspace:*",
"@pnpm/find-workspace-packages": "^4.0.16",
"@supermapgis/build": "workspace:*",
"@supermapgis/build-utils": "workspace:*",
Expand All @@ -65,7 +75,6 @@
"@vue/runtime-dom": "3.5.12",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.1.3",
"@vueuse/core": "^12.6.1",
"eslint": "^9.14.0",
"eslint-plugin-vue": "^9.30.0",
"jsdom": "^25.0.1",
Expand Down
4 changes: 2 additions & 2 deletions vue3/packages/common/components/config-provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { withInstall } from '@supermapgis/common/utils/index.common'
import ConfigProvider from './src/config-provider'
import type { SFCWithInstall } from '@supermapgis/common/utils/index.common'

export const ElConfigProvider: SFCWithInstall<typeof ConfigProvider> =
export const SmConfigProvider: SFCWithInstall<typeof ConfigProvider> =
withInstall(ConfigProvider)
export default ElConfigProvider
export default SmConfigProvider

export * from './src/config-provider'
export * from './src/config-provider-props'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { computed, getCurrentInstance, inject, provide, ref, unref } from 'vue'
import { localeContextKey, useLocale } from '@supermapgis/common/hooks'
import { configProviderContextKey } from '../constants'

import type { MaybeRef } from '@vueuse/core'
import type { App, Ref } from 'vue'
import type { App, Ref, MaybeRef } from 'vue'
import type { ConfigProviderContext } from '../constants'

const globalConfig = ref<ConfigProviderContext>()
Expand Down
2 changes: 1 addition & 1 deletion vue3/packages/common/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './use-locale'
export * from './useMapGetter'
export * from './VmUpdater'
export * from './useVmProps'
3 changes: 1 addition & 2 deletions vue3/packages/common/hooks/use-locale/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { computed, inject, isRef, ref, unref } from 'vue'
import { get } from 'lodash-es'
import ZHCN from '@supermapgis/common/locale/lang/zh-cn'

import type { MaybeRef } from '@vueuse/core'
import type { InjectionKey, Ref } from 'vue'
import type { InjectionKey, Ref, MaybeRef } from 'vue'
import type { Language } from '@supermapgis/common/locale'

export type TranslatorOption = Record<string, string | number>
Expand Down
8 changes: 4 additions & 4 deletions vue3/packages/mapboxgl/components/attributes/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { SFCWithInstall } from '@supermapgis/common/utils'
import { withInstall } from '@supermapgis/common/utils'
import type { SFCWithInstall } from '@supermapgis/common/utils/index.common'
import { withInstall } from '@supermapgis/common/utils/index.common'
import attributes from './attributes.vue'

export const Attributes: SFCWithInstall<typeof attributes> = withInstall(attributes)
export default Attributes
export const SmAttributes: SFCWithInstall<typeof attributes> = withInstall(attributes)
export default SmAttributes

export * from './attributes'
export type { AttributesInstance } from './instance'
5 changes: 5 additions & 0 deletions vue3/packages/mapboxgl/components/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { SmConfigProvider } from '@supermapgis/vue-iclient-common/config-provider'
import { SmAttributes } from './attributes'
import type { Plugin } from 'vue'

export default [SmConfigProvider, SmAttributes] as Plugin[]
4 changes: 4 additions & 0 deletions vue3/packages/mapboxgl/components/defaults.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { makeInstaller } from './make-installer'
import Components from './component'

export default makeInstaller([...Components])
8 changes: 6 additions & 2 deletions vue3/packages/mapboxgl/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
export * from '@supermapgis/vue-iclient-common/index.common'
export * from './web-map'
import installer from './defaults'
export * from '@supermapgis/vue-iclient-mapboxgl/component'
export * from './make-installer'

export const install = installer.install
export default installer
19 changes: 19 additions & 0 deletions vue3/packages/mapboxgl/components/make-installer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { provideGlobalConfig } from '@supermapgis/vue-iclient-common/config-provider'
import type { ConfigProviderContext } from '@supermapgis/vue-iclient-common/config-provider'
import type { App, Plugin } from '@vue/runtime-core'
export const INSTALLED_KEY = Symbol('INSTALLED_KEY')

export const makeInstaller = (components: Plugin[] = []) => {
const install = (app: App, options?: ConfigProviderContext) => {
if (app[INSTALLED_KEY]) return

app[INSTALLED_KEY] = true
components.forEach(c => app.use(c))

if (options) provideGlobalConfig(options, app, true)
}

return {
install
}
}
31 changes: 24 additions & 7 deletions vue3/packages/mapboxgl/components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@supermapgis/vue-iclient-mapboxgl",
"description": "SuperMap iClient for Vue.js",
"version": "11.3.0",
"version": "12.0.0",
"homepage": "http://iclient.supermap.io",
"type": "module",
"main": "lib/index.js",
Expand All @@ -12,18 +12,35 @@
"dist",
"lib",
"es",
"typings/global.d.ts",
"locale"
"global.d.ts",
"theme-chalk"
],
"peerDependencies": {
"vue": ">=3.5.13"
},
"devDependencies": {
"@types/mapbox-gl": "^1.12.1"
},
"dependencies": {
"@ant-design/icons-vue": "^7.0.1",
"resize-detector": "0.x"
"resize-detector": "0.x",
"ant-design-vue": "^4.2.6",
"lodash-es": "^4.17.21",
"vue": "3.5.12",
"@turf/bbox": "^7.2.0",
"@turf/center": "^7.2.0",
"@turf/helpers": "^6.1.4",
"@turf/transform-scale": "^7.2.0",
"colorcolor": "^1.1.1",
"echarts": "^4.8.0",
"lodash.clonedeep": "^4.5.0",
"lodash.difference": "^4.5.0",
"lodash.max": "^4.0.1",
"lodash.merge": "^4.6.1",
"lodash.mergewith": "^4.6.2",
"lodash.tonumber": "^4.0.3",
"lodash.orderby": "^4.6.0",
"omit.js": "^2.0.2",
"proj4": "^2.15.0",
"simple-statistics": "^7.8.7",
"tinycolor2": "^1.6.0"
},
"engines": {
"node": ">= 6.0.0",
Expand Down
Loading

0 comments on commit 8f88424

Please sign in to comment.