diff --git a/packages/s2-react-components/src/components/common/icons/calendar-icon.tsx b/packages/s2-react-components/src/components/common/icons/calendar-icon.tsx new file mode 100644 index 0000000000..50e3b0bb0d --- /dev/null +++ b/packages/s2-react-components/src/components/common/icons/calendar-icon.tsx @@ -0,0 +1,19 @@ +import React from 'react'; + +export function CalendarIcon(props: React.SVGProps) { + return ( + + + + ); +} diff --git a/packages/s2-react-components/src/components/common/icons/col-icon.tsx b/packages/s2-react-components/src/components/common/icons/col-icon.tsx new file mode 100644 index 0000000000..d01af192b6 --- /dev/null +++ b/packages/s2-react-components/src/components/common/icons/col-icon.tsx @@ -0,0 +1,18 @@ +import React from 'react'; + +export function ColIcon(props: React.SVGProps) { + return ( + + + + + + + ); +} diff --git a/packages/s2-react-components/src/components/common/icons/index.tsx b/packages/s2-react-components/src/components/common/icons/index.tsx index ed0201d507..db0e2029f7 100644 --- a/packages/s2-react-components/src/components/common/icons/index.tsx +++ b/packages/s2-react-components/src/components/common/icons/index.tsx @@ -1,9 +1,8 @@ import './index.less'; -import { ReactComponent as CalendarIcon } from './svg/calendar-icon.svg'; -import { ReactComponent as ColIcon } from './svg/col-icon.svg'; -import { ReactComponent as LocationIcon } from './svg/location-icon.svg'; -import { ReactComponent as RowIcon } from './svg/row-icon.svg'; -import { ReactComponent as TextIcon } from './svg/text-icon.svg'; -import { ReactComponent as ValueIcon } from './svg/value-icon.svg'; -export { CalendarIcon, ColIcon, LocationIcon, RowIcon, TextIcon, ValueIcon }; +export * from './calendar-icon'; +export * from './col-icon'; +export * from './location-icon'; +export * from './row-icon'; +export * from './text-icon'; +export * from './value-icon'; diff --git a/packages/s2-react-components/src/components/common/icons/location-icon.tsx b/packages/s2-react-components/src/components/common/icons/location-icon.tsx new file mode 100644 index 0000000000..45adc5c1fe --- /dev/null +++ b/packages/s2-react-components/src/components/common/icons/location-icon.tsx @@ -0,0 +1,19 @@ +import React from 'react'; + +export function LocationIcon(props: React.SVGProps) { + return ( + + + + ); +} diff --git a/packages/s2-react-components/src/components/common/icons/row-icon.tsx b/packages/s2-react-components/src/components/common/icons/row-icon.tsx new file mode 100644 index 0000000000..d526c9332c --- /dev/null +++ b/packages/s2-react-components/src/components/common/icons/row-icon.tsx @@ -0,0 +1,18 @@ +import React from 'react'; + +export function RowIcon(props: React.SVGProps) { + return ( + + + + + + + ); +} diff --git a/packages/s2-react-components/src/components/common/icons/svg/calendar-icon.svg b/packages/s2-react-components/src/components/common/icons/svg/calendar-icon.svg deleted file mode 100644 index 84ebfceba7..0000000000 --- a/packages/s2-react-components/src/components/common/icons/svg/calendar-icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/packages/s2-react-components/src/components/common/icons/svg/col-icon.svg b/packages/s2-react-components/src/components/common/icons/svg/col-icon.svg deleted file mode 100644 index 048ccc1605..0000000000 --- a/packages/s2-react-components/src/components/common/icons/svg/col-icon.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/s2-react-components/src/components/common/icons/svg/location-icon.svg b/packages/s2-react-components/src/components/common/icons/svg/location-icon.svg deleted file mode 100644 index 49a9c711f8..0000000000 --- a/packages/s2-react-components/src/components/common/icons/svg/location-icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/packages/s2-react-components/src/components/common/icons/svg/row-icon.svg b/packages/s2-react-components/src/components/common/icons/svg/row-icon.svg deleted file mode 100644 index cf29db358b..0000000000 --- a/packages/s2-react-components/src/components/common/icons/svg/row-icon.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packages/s2-react-components/src/components/common/icons/svg/text-icon.svg b/packages/s2-react-components/src/components/common/icons/svg/text-icon.svg deleted file mode 100644 index af3a86d533..0000000000 --- a/packages/s2-react-components/src/components/common/icons/svg/text-icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/packages/s2-react-components/src/components/common/icons/svg/value-icon.svg b/packages/s2-react-components/src/components/common/icons/svg/value-icon.svg deleted file mode 100644 index af3905b602..0000000000 --- a/packages/s2-react-components/src/components/common/icons/svg/value-icon.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/s2-react-components/src/components/common/icons/text-icon.tsx b/packages/s2-react-components/src/components/common/icons/text-icon.tsx new file mode 100644 index 0000000000..409a08eb46 --- /dev/null +++ b/packages/s2-react-components/src/components/common/icons/text-icon.tsx @@ -0,0 +1,19 @@ +import React from 'react'; + +export function TextIcon(props: React.SVGProps) { + return ( + + + + ); +} diff --git a/packages/s2-react-components/src/components/common/icons/value-icon.tsx b/packages/s2-react-components/src/components/common/icons/value-icon.tsx new file mode 100644 index 0000000000..cdde7d3ce3 --- /dev/null +++ b/packages/s2-react-components/src/components/common/icons/value-icon.tsx @@ -0,0 +1,18 @@ +import React from 'react'; + +export function ValueIcon(props: React.SVGProps) { + return ( + + + + + + + ); +} diff --git a/packages/s2-react-components/vite.config.ts b/packages/s2-react-components/vite.config.ts index 7c02136935..d60ba83f44 100644 --- a/packages/s2-react-components/vite.config.ts +++ b/packages/s2-react-components/vite.config.ts @@ -5,7 +5,6 @@ import react from '@vitejs/plugin-react'; import path from 'path'; import type { UserConfig } from 'vite'; import { defineConfig } from 'vite'; -import svgr from 'vite-plugin-svgr'; import { getBaseConfig } from '../../build.config.base.mjs'; const { getViteConfig, isDevMode } = getBaseConfig({ @@ -27,7 +26,6 @@ export default defineConfig({ react({ jsxRuntime: 'classic', }), - svgr(), ] as UserConfig['plugins'], }) as UserConfig), }); diff --git a/packages/s2-vue/package.json b/packages/s2-vue/package.json index f1268f178e..a3ceeed591 100644 --- a/packages/s2-vue/package.json +++ b/packages/s2-vue/package.json @@ -64,7 +64,6 @@ "@vue/shared": "^3.3.4", "@vue/tsconfig": "^0.4.0", "ant-design-vue": "^3.2.20", - "vite-svg-loader": "^3.6.0", "vue": "^3.3.4", "vue-tsc": "^2.1.6" }, diff --git a/packages/s2-vue/playground/App.vue b/packages/s2-vue/playground/App.vue index cac67f2291..da7a38a60e 100644 --- a/packages/s2-vue/playground/App.vue +++ b/packages/s2-vue/playground/App.vue @@ -521,15 +521,20 @@ const fieldMap = { const partDrillDown: PartDrillDown = { drillConfig: { dataSet: [ + { + name: '客户性别', + value: 'sex2', + type: 'location', + }, { name: '销售渠道', value: 'channel', type: 'text', }, { - name: '客户性别', - value: 'sex', - type: 'text', + name: '客户性别111', + value: 'sex1', + type: 'date', }, ], }, diff --git a/packages/s2-vue/src/components/drill-down/index.vue b/packages/s2-vue/src/components/drill-down/index.vue index dec31507ed..eee32f16a9 100644 --- a/packages/s2-vue/src/components/drill-down/index.vue +++ b/packages/s2-vue/src/components/drill-down/index.vue @@ -11,9 +11,9 @@ import type { SelectInfo } from 'ant-design-vue/lib/menu/src/interface'; import { isEmpty } from 'lodash'; import type { Key } from 'ant-design-vue/lib/_util/type'; import type { ChangeEvent } from 'ant-design-vue/lib/_util/EventInterface'; -import LocationIcon from '../../svg/location-icon.svg?component'; -import TextIcon from '../../svg/text-icon.svg?component'; -import CalendarIcon from '../../svg/calendar-icon.svg?component'; +import LocationIcon from '../../icons/location-icon.vue'; +import TextIcon from '../../icons/text-icon.vue'; +import CalendarIcon from '../../icons/calendar-icon.vue'; import { initDrillDownEmits, initDrillDownProps, @@ -136,9 +136,9 @@ export default defineComponent({ :class="`${DRILL_DOWN_PRE_CLASS}-menu-item`" > {{ option?.name }} diff --git a/packages/s2-vue/src/icons/calendar-icon.vue b/packages/s2-vue/src/icons/calendar-icon.vue new file mode 100644 index 0000000000..ebeeaccc2e --- /dev/null +++ b/packages/s2-vue/src/icons/calendar-icon.vue @@ -0,0 +1,22 @@ + + diff --git a/packages/s2-vue/src/icons/location-icon.vue b/packages/s2-vue/src/icons/location-icon.vue new file mode 100644 index 0000000000..152d0c6cf0 --- /dev/null +++ b/packages/s2-vue/src/icons/location-icon.vue @@ -0,0 +1,22 @@ + + diff --git a/packages/s2-vue/src/icons/text-icon.vue b/packages/s2-vue/src/icons/text-icon.vue new file mode 100644 index 0000000000..9fabdeb2c3 --- /dev/null +++ b/packages/s2-vue/src/icons/text-icon.vue @@ -0,0 +1,22 @@ + + diff --git a/packages/s2-vue/src/svg/calendar-icon.svg b/packages/s2-vue/src/svg/calendar-icon.svg deleted file mode 100644 index 84ebfceba7..0000000000 --- a/packages/s2-vue/src/svg/calendar-icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/packages/s2-vue/src/svg/location-icon.svg b/packages/s2-vue/src/svg/location-icon.svg deleted file mode 100644 index 49a9c711f8..0000000000 --- a/packages/s2-vue/src/svg/location-icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/packages/s2-vue/src/svg/text-icon.svg b/packages/s2-vue/src/svg/text-icon.svg deleted file mode 100644 index af3a86d533..0000000000 --- a/packages/s2-vue/src/svg/text-icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/packages/s2-vue/vite.config.ts b/packages/s2-vue/vite.config.ts index 96aa0fd4c0..fee8f107a4 100644 --- a/packages/s2-vue/vite.config.ts +++ b/packages/s2-vue/vite.config.ts @@ -4,7 +4,6 @@ import vue from '@vitejs/plugin-vue'; import vueJsx from '@vitejs/plugin-vue-jsx'; import path from 'path'; import { UserConfig, defineConfig } from 'vite'; -import svgLoader from 'vite-svg-loader'; import { getBaseConfig } from '../../build.config.base.mjs'; const { getViteConfig, isDevMode } = getBaseConfig(); @@ -19,12 +18,6 @@ export default defineConfig({ port: 5050, name: 's2-vue', libName: 'S2Vue', - plugins: [ - vue(), - svgLoader({ - defaultImport: 'component', - }), - vueJsx(), - ] as UserConfig['plugins'], + plugins: [vue(), vueJsx()] as UserConfig['plugins'], }), } as UserConfig); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24628bf251..da8d8414e8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -492,9 +492,6 @@ importers: ant-design-vue: specifier: ^3.2.20 version: 3.2.20(vue@3.4.27(typescript@5.4.5)) - vite-svg-loader: - specifier: ^3.6.0 - version: 3.6.0 vue: specifier: ^3.3.4 version: 3.4.27(typescript@5.4.5) @@ -6353,7 +6350,7 @@ packages: resolution: {integrity: sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==} engines: {node: '>= 4.0'} os: [darwin] - deprecated: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 + deprecated: Upgrade to fsevents v2 to mitigate potential security issues fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} @@ -13141,9 +13138,6 @@ packages: peerDependencies: vite: ^2.6.0 || 3 || 4 - vite-svg-loader@3.6.0: - resolution: {integrity: sha512-bZJffcgCREW57kNkgMhuNqeDznWXyQwJ3wKrRhHLMMzwDnP5jr3vXW3cqsmquRR7VTP5mLdKj1/zzPPooGUuPw==} - vite@4.5.2: resolution: {integrity: sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==} engines: {node: ^14.18.0 || >=16.0.0} @@ -14048,7 +14042,7 @@ snapshots: '@babel/parser': 7.24.7 '@babel/template': 7.24.7 '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 convert-source-map: 2.0.0 debug: 4.3.5 gensync: 1.0.0-beta.2 @@ -14087,7 +14081,7 @@ snapshots: '@babel/generator@7.2.0': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 jsesc: 2.5.2 lodash: 4.17.21 source-map: 0.5.7 @@ -14150,7 +14144,7 @@ snapshots: '@babel/helper-member-expression-to-functions@7.24.7': dependencies: '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -14189,7 +14183,7 @@ snapshots: '@babel/helper-optimise-call-expression@7.24.7': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 '@babel/helper-plugin-utils@7.24.7': {} @@ -14212,7 +14206,7 @@ snapshots: '@babel/helper-skip-transparent-expression-wrappers@7.24.7': dependencies: '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -16056,7 +16050,7 @@ snapshots: '@svgr/hast-util-to-babel-ast@6.5.1': dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 entities: 4.5.0 '@svgr/plugin-jsx@6.5.1(@svgr/core@6.5.1)': @@ -17995,21 +17989,21 @@ snapshots: babel-plugin-jest-hoist@26.6.2: dependencies: '@babel/template': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.20.6 babel-plugin-jest-hoist@29.6.3: dependencies: '@babel/template': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.20.6 babel-plugin-react-compiler@0.0.0-experimental-c23de8d-20240515: dependencies: '@babel/generator': 7.2.0 - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 chalk: 4.1.2 invariant: 2.2.4 pretty-format: 24.9.0 @@ -22448,7 +22442,7 @@ snapshots: '@babel/parser': 7.24.7 '@babel/template': 7.24.7 '@babel/traverse': 7.24.7 - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 istanbul-lib-coverage: 2.0.5 semver: 6.3.1 transitivePeerDependencies: @@ -23072,7 +23066,7 @@ snapshots: jest-snapshot@24.9.0: dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 '@jest/types': 24.9.0 chalk: 2.4.2 expect: 24.9.0 @@ -23090,7 +23084,7 @@ snapshots: jest-snapshot@26.6.2: dependencies: - '@babel/types': 7.24.7 + '@babel/types': 7.26.0 '@jest/types': 26.6.2 '@types/babel__traverse': 7.20.6 '@types/prettier': 2.7.3 @@ -29792,11 +29786,6 @@ snapshots: - rollup - supports-color - vite-svg-loader@3.6.0: - dependencies: - '@vue/compiler-sfc': 3.4.27 - svgo: 2.8.0 - vite@4.5.2(@types/node@20.14.2)(less@4.1.3)(lightningcss@1.22.1)(sass@1.77.4)(terser@5.31.1): dependencies: esbuild: 0.18.20