Skip to content

Commit

Permalink
chore: 移除 s2-vue 中的 shared 依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Sep 23, 2024
1 parent 91e3401 commit efbea58
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 41 deletions.
2 changes: 1 addition & 1 deletion packages/s2-core/src/shared/styles/tooltip/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../variables.less';
@import '../../../ui/tooltip/index.less';

.@{tooltip-cls-prefix} {
&-tips,
Expand Down
6 changes: 3 additions & 3 deletions packages/s2-core/src/styles/variables.less
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// s2 类名前缀
@s2-cls-prefix: antv-s2;

// Tooltip
@tooltip-cls-prefix: ~'@{s2-cls-prefix}-tooltip';

// css 变量前缀
@css-var-prefix: ~'--@{s2-cls-prefix}';

// Tooltip
@tooltip-cls-prefix: ~'@{s2-cls-prefix}-tooltip';

// 图标
@icon-cls-prefix: ~'@{s2-cls-prefix}-icon';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ReactComponent as CalendarIcon } from '@antv/s2/shared/src/icons/calendar-icon.svg';
import { ReactComponent as ColIcon } from '@antv/s2/shared/src/icons/col-icon.svg';
import { ReactComponent as LocationIcon } from '@antv/s2/shared/src/icons/location-icon.svg';
import { ReactComponent as RowIcon } from '@antv/s2/shared/src/icons/row-icon.svg';
import { ReactComponent as TextIcon } from '@antv/s2/shared/src/icons/text-icon.svg';
import { ReactComponent as ValueIcon } from '@antv/s2/shared/src/icons/value-icon.svg';
import { ReactComponent as CalendarIcon } from '@antv/s2/esm/shared/icons/calendar-icon.svg';
import { ReactComponent as ColIcon } from '@antv/s2/esm/shared/icons/col-icon.svg';
import { ReactComponent as LocationIcon } from '@antv/s2/esm/shared/icons/location-icon.svg';
import { ReactComponent as RowIcon } from '@antv/s2/esm/shared/icons/row-icon.svg';
import { ReactComponent as TextIcon } from '@antv/s2/esm/shared/icons/text-icon.svg';
import { ReactComponent as ValueIcon } from '@antv/s2/esm/shared/icons/value-icon.svg';
import './index.less';

export { CalendarIcon, ColIcon, LocationIcon, RowIcon, TextIcon, ValueIcon };
1 change: 1 addition & 0 deletions packages/s2-react-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"paths": {
"@antv/s2":["s2-core/src/index.ts"],
"@antv/s2/*":["s2-core/src/*"],
"@antv/s2/shared":["s2-core/src/shared/index.ts"],
"@antv/s2-react":["s2-react/src/index.ts"],
"@/*":["s2-react-components/src/*"],
"tests/*":["s2-react-components/__tests__/*"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
} from '../interface';
import { TooltipIcon } from './icon';

import '@antv/s2/shared/esm/styles/tooltip/operator.less';
import '@antv/s2/esm/shared/styles/tooltip/operator.less';

export const TooltipOperator: React.FC<Required<TooltipOperatorProps>> =
React.memo((props) => {
Expand Down
1 change: 1 addition & 0 deletions packages/s2-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"paths": {
"@antv/s2": ["s2-core/src/index.ts"],
"@antv/s2/*": ["s2-core/src/*"],
"@antv/s2/shared": ["s2-core/src/shared/index.ts"],
"@antv/s2-react-components": ["s2-react-components/src/index.ts"],
"@/*": ["s2-react/src/*"],
"tests/*": ["s2-react/__tests__/*"]
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"README.md"
],
"scripts": {
"build": "pnpm clean && father build && pnpm build:dts",
"build": "npm-run-all clean --parallel build:umd build:cjs build:esm",
"build:analysis": "cross-env FORMAT=es ANALYSIS=true vite build",
"build:cjs": "cross-env FORMAT=cjs vite build",
"build:dts": "run-s dts:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-vue/playground/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
PartDrillDown,
PartDrillDownInfo,
SheetType,
} from '@antv/s2-shared';
} from '@antv/s2/shared';
import { forEach, random } from 'lodash';
import { defineComponent, reactive, ref, shallowRef } from 'vue';
import { SheetComponent } from '../src';
Expand Down
18 changes: 9 additions & 9 deletions packages/s2-vue/src/components/drill-down/index.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<script lang="ts">
import { defineComponent, ref } from 'vue';
import type { Ref } from 'vue';
import type {
BaseDrillDownDataSet,
BaseDrillDownComponentProps,
} from '@antv/s2-shared';
import {
DRILL_DOWN_PRE_CLASS,
type BaseDrillDownDataSet,
type BaseDrillDownComponentProps,
} from '@antv/s2/shared';
import { Button, Input, Empty, Menu, MenuItem } from 'ant-design-vue';
import type { SelectInfo } from 'ant-design-vue/lib/menu/src/interface';
import { isEmpty } from 'lodash';
import LocationIcon from '@antv/s2-shared/src/icons/location-icon.svg?component';
import TextIcon from '@antv/s2-shared/src/icons/text-icon.svg?component';
import CalendarIcon from '@antv/s2-shared/src/icons/calendar-icon.svg?component';
import LocationIcon from '@antv/s2/esm/shared/icons/location-icon.svg?component';
import TextIcon from '@antv/s2/esm/shared/icons/text-icon.svg?component';
import CalendarIcon from '@antv/s2/esm/shared/icons/calendar-icon.svg?component';
import type { Key } from 'ant-design-vue/lib/_util/type';
import type { ChangeEvent } from 'ant-design-vue/lib/_util/EventInterface';
import { DRILL_DOWN_PRE_CLASS } from '@antv/s2-shared';
import {
initDrillDownEmits,
initDrillDownProps,
Expand Down Expand Up @@ -147,5 +147,5 @@ export default defineComponent({
</template>

<style lang="less" scoped>
@import '@antv/s2-shared/src/styles/drill-down.less';
@import '@antv/s2/esm/shared/styles/drill-down.less';
</style>
2 changes: 1 addition & 1 deletion packages/s2-vue/src/components/sheets/base-sheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default defineComponent({
</template>

<style lang="less">
@import '@antv/s2-shared/src/styles/variables.less';
@import '@antv/s2/esm/shared/styles/variables.less';
.@{s2-cls-prefix} {
&-spin.ant-spin-nested-loading,
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-vue/src/components/sheets/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { SheetType } from '@antv/s2-shared';
import type { SheetType } from '@antv/s2/shared';
import { computed, defineComponent } from 'vue';
import { useExpose } from '../../hooks/useExpose';
import type { BaseSheetInitEmits, BaseSheetInitProps } from '../../interface';
Expand Down
16 changes: 10 additions & 6 deletions packages/s2-vue/src/components/sheets/pivot-sheet.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<script lang="ts">
import { computed, defineComponent, ref, toRefs, createVNode } from 'vue';
import type { S2Options } from '@antv/s2';
import {
buildDrillDownOptions,
handleDrillDown,
type ActionIconCallbackParams,
type PartDrillDown,
} from '@antv/s2/shared';
import { isEmpty } from 'lodash';
import { buildDrillDownOptions, handleDrillDown } from '@antv/s2-shared';
import type { SpreadSheet, S2Options } from '@antv/s2';
import type { PartDrillDown, ActionIconCallbackParams } from '@antv/s2-shared';
import { computed, createVNode, defineComponent, ref, toRefs } from 'vue';
import { useExpose } from '../../hooks/useExpose';
import type { BaseSheetInitEmits } from '../../interface';
import { initBaseSheetProps } from '../../utils/initPropAndEmits';
Expand Down Expand Up @@ -36,7 +40,7 @@ export default defineComponent({
drillFields: fields,
fetchData: partDrillDown.value?.['fetchData'],
drillItemsNum: partDrillDown.value?.['drillItemsNum'],
spreadsheet: instance as SpreadSheet,
spreadsheet: instance,
});
}
};
Expand Down Expand Up @@ -71,7 +75,7 @@ export default defineComponent({
// 展示下钻icon
const options = computed(() =>
buildDrillDownOptions(
pivotOptions.value as S2Options,
pivotOptions.value as any,
partDrillDown.value as PartDrillDown,
(params) => onDrillDownIconClick(params),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
type TooltipBaseOperatorMenuItem,
TOOLTIP_PREFIX_CLS,
} from '@antv/s2';
import type { TooltipOperatorProps as BaseTooltipOperatorProps } from '@antv/s2-shared';
import type { TooltipOperatorProps as BaseTooltipOperatorProps } from '@antv/s2/shared';
import { Menu, Dropdown, type MenuProps } from 'ant-design-vue';
import { defineComponent } from 'vue';
import type { MenuClickEventHandler } from 'ant-design-vue/lib/menu/src/interface';
Expand Down Expand Up @@ -83,5 +83,5 @@ export default defineComponent({
</template>
<style lang="less">
@import '@antv/s2-shared/src/styles/tooltip/operator.less';
@import '@antv/s2/esm/shared/styles/tooltip/operator.less';
</style>
3 changes: 1 addition & 2 deletions packages/s2-vue/src/components/tooltip/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,5 @@ export default defineComponent({
</template>
<style lang="less">
@import '@antv/s2/src/ui/tooltip/index.less';
@import '@antv/s2-shared/src/styles/tooltip/index.less';
@import '@antv/s2/esm/shared/styles/tooltip/index.less';
</style>
2 changes: 1 addition & 1 deletion packages/s2-vue/src/hooks/useResize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SpreadSheet } from '@antv/s2';
import { createResizeObserver } from '@antv/s2-shared';
import { createResizeObserver } from '@antv/s2/shared';
import { ref, watch, type Ref } from 'vue';
import type { BaseSheetProps } from '../utils/initPropAndEmits';

Expand Down
2 changes: 1 addition & 1 deletion packages/s2-vue/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
BaseDrillDownComponentProps,
BaseSheetComponentProps,
PartDrillDown,
} from '@antv/s2-shared';
} from '@antv/s2/shared';
import type { UnionToIntersection } from '@vue/shared';
import type { PaginationProps } from 'ant-design-vue';
import type { PropType } from 'vue';
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-vue/src/utils/extendLocale.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extendLocale } from '@antv/s2';
import { Locale } from '@antv/s2-shared';
import { Locale } from '@antv/s2/shared';

extendLocale(Locale);
2 changes: 1 addition & 1 deletion packages/s2-vue/src/utils/initPropAndEmits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
Adaptive,
BaseDrillDownDataSet,
SheetType,
} from '@antv/s2-shared';
} from '@antv/s2/shared';
import type { ExtractPropTypes, PropType } from 'vue';
import type {
BaseDrillDownEmitKeys,
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-vue/src/utils/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { S2Options } from '@antv/s2';
import { getBaseSheetComponentOptions } from '@antv/s2-shared';
import { getBaseSheetComponentOptions } from '@antv/s2/shared';
import { RENDER_TOOLTIP_OPTION } from '../common/constant';

export const getSheetComponentOptions = (
Expand Down
8 changes: 6 additions & 2 deletions packages/s2-vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
"target": "ESNext",
"jsx": "preserve",
"strict": false,
// father 对于 vue 打包有点问题, 还是使用单独打包 dts 的方式
"declaration": false,
"declaration": true,
"noImplicitAny": false,
"paths": {
"@antv/s2": ["s2-core/src/index.ts"],
"@antv/s2/*": ["s2-core/src/*"],
"@antv/s2/shared": ["s2-core/src/shared/index.ts"]
},
},
"exclude": ["node_modules", "coverage", "esm", "lib", "dist", "temp"],
"include": ["src", "./typings.d.ts", "../../global.d.ts"]
Expand Down

0 comments on commit efbea58

Please sign in to comment.