xrk-components 0.3.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/lib/index.css +7 -2
  2. package/lib/index.esm.js +107 -46
  3. package/lib/index.umd.js +107 -46
  4. package/lib/packages/base/button/index.d.ts +1 -1
  5. package/lib/packages/base/dialog/dialog.d.ts +11 -0
  6. package/lib/packages/base/dialog/index.d.ts +4 -3
  7. package/lib/packages/base/select/index.d.ts +4 -1
  8. package/lib/packages/xrk/table/table.d.ts +0 -13
  9. package/lib/packages/xrk/table/types/type.d.ts +2 -2
  10. package/package.json +1 -1
  11. package/packages/base/button/button.vue +0 -83
  12. package/packages/base/button/index.ts +0 -26
  13. package/packages/base/checkbox/checkbox-button.vue +0 -54
  14. package/packages/base/checkbox/checkbox-group.vue +0 -85
  15. package/packages/base/checkbox/checkbox.vue +0 -85
  16. package/packages/base/checkbox/index.ts +0 -62
  17. package/packages/base/date-picker/date-picker.vue +0 -144
  18. package/packages/base/date-picker/index.ts +0 -52
  19. package/packages/base/dialog/dialog.vue +0 -214
  20. package/packages/base/dialog/index.ts +0 -57
  21. package/packages/base/form/form-item.vue +0 -57
  22. package/packages/base/form/form.vue +0 -70
  23. package/packages/base/form/index.ts +0 -39
  24. package/packages/base/input/index.ts +0 -50
  25. package/packages/base/input/input.vue +0 -175
  26. package/packages/base/pagination/index.ts +0 -30
  27. package/packages/base/pagination/pagination.vue +0 -160
  28. package/packages/base/radio/index.ts +0 -49
  29. package/packages/base/radio/radio-button.vue +0 -46
  30. package/packages/base/radio/radio-group.vue +0 -77
  31. package/packages/base/radio/radio.vue +0 -74
  32. package/packages/base/select/index.ts +0 -62
  33. package/packages/base/select/select.vue +0 -258
  34. package/packages/base/switch/index.ts +0 -26
  35. package/packages/base/switch/switch.vue +0 -103
  36. package/packages/base/table/hooks/use-table.ts +0 -15
  37. package/packages/base/table/index.ts +0 -16
  38. package/packages/base/table/store/index.ts +0 -35
  39. package/packages/base/table/table-column.vue +0 -351
  40. package/packages/base/table/table.vue +0 -168
  41. package/packages/base/table/types/type.ts +0 -123
  42. package/packages/base/tag/index.ts +0 -52
  43. package/packages/base/tag/tag-group.vue +0 -182
  44. package/packages/base/tag/tag.vue +0 -54
  45. package/packages/base/tool-tip/index.ts +0 -30
  46. package/packages/base/tool-tip/tool-tip.vue +0 -108
  47. package/packages/components.ts +0 -33
  48. package/packages/functions.ts +0 -16
  49. package/packages/index.ts +0 -30
  50. package/packages/types.ts +0 -54
  51. package/packages/xrk/search/hooks/use-search.ts +0 -96
  52. package/packages/xrk/search/index.ts +0 -22
  53. package/packages/xrk/search/search.vue +0 -197
  54. package/packages/xrk/search/types/type.ts +0 -95
  55. package/packages/xrk/table/hooks/use-table.tsx +0 -34
  56. package/packages/xrk/table/index.ts +0 -10
  57. package/packages/xrk/table/table.vue +0 -218
  58. package/packages/xrk/table/types/type.ts +0 -31
  59. package/rollup.config.js +0 -59
  60. package/styles/element/index.scss +0 -5
  61. package/styles/element/mixin.scss +0 -40
  62. package/tools/check.ts +0 -9
@@ -1,197 +0,0 @@
1
- <!--
2
- * @Description:
3
- * @Date: 2022-06-29 14:48:27
4
- -->
5
- <template>
6
- <div class="xrk-search">
7
- <base-form :model="searchValue">
8
- <base-form-item
9
- v-for="{
10
- style,
11
- label,
12
- prop,
13
- type,
14
- disabled,
15
- config,
16
- listener
17
- } in columns"
18
- :prop="prop"
19
- :label="label"
20
- :key="prop"
21
- >
22
- <component
23
- v-if="type"
24
- :style="style"
25
- :is="components[type]"
26
- v-bind="{ ...config, ...proxyColumnListener(listener || {}) }"
27
- :disabled="isFunction(disabled) ? disabled(searchValue) : disabled"
28
- v-model="searchValue[prop]"
29
- ></component>
30
- </base-form-item>
31
- <base-button v-if="searchBtn.show" :click="handleSearchClick">
32
- {{ searchBtn.text }}
33
- </base-button>
34
- <base-button v-if="resetBtn.show" :plain="true" :click="handleResetClick">
35
- {{ resetBtn.text }}
36
- </base-button>
37
- <base-search-render
38
- :render="render"
39
- v-for="({ render }, index) in otherComponents"
40
- :key="index"
41
- ></base-search-render>
42
- </base-form>
43
- </div>
44
- </template>
45
-
46
- <script lang="tsx">
47
- export default {
48
- name: 'xrk-search'
49
- };
50
- </script>
51
-
52
- <script lang="tsx" setup>
53
- import BaseForm from '../../base/form/form.vue';
54
- import BaseFormItem from '../../base/form/form-item.vue';
55
- import BaseButton from '../../base/button/button.vue';
56
- import BaseInput from '../../base/input/input.vue';
57
- import BaseSelect from '../../base/select/select.vue';
58
- import BaseDatePicker from '../../base/date-picker/date-picker.vue';
59
-
60
- import {
61
- ComponentsType,
62
- SerachColumnType,
63
- SearchBtnType,
64
- ResetBtnType,
65
- ComponentRender
66
- } from './types/type';
67
-
68
- import { ref, withDefaults, reactive, shallowRef, defineComponent } from 'vue';
69
- import { base, check } from 'xrk-tools';
70
- import { isFunction } from '../../../tools/check';
71
-
72
- const components = ref<ComponentsType>({
73
- input: shallowRef(BaseInput),
74
- select: shallowRef(BaseSelect),
75
- datePicker: shallowRef(BaseDatePicker)
76
- });
77
-
78
- const _props = withDefaults(
79
- defineProps<{
80
- columns: any;
81
- searchBtn?: any;
82
- resetBtn?: any;
83
- otherComponents?: any;
84
- }>(),
85
- {
86
- searchBtn: () => ({
87
- text: '搜索',
88
- show: true
89
- }),
90
- resetBtn: () => ({
91
- text: '重置',
92
- show: true
93
- })
94
- }
95
- );
96
-
97
- const props = _props as Readonly<{
98
- columns: Array<SerachColumnType>;
99
- searchBtn?: SearchBtnType | undefined;
100
- resetBtn?: ResetBtnType | undefined;
101
- otherComponents?: ComponentRender[] | undefined;
102
- }>;
103
-
104
- const emits = defineEmits<{
105
- (event: 'search', searchValue: Record<string, any>): void;
106
- }>();
107
-
108
- const columnsToSearchValue = (columns: typeof props.columns) => {
109
- return columns.reduce((pre: Record<string, any>, { prop, defaultValue }) => {
110
- pre[prop] = defaultValue || '';
111
- return pre;
112
- }, {});
113
- };
114
-
115
- // 将 searchValue 传入 每个搜索项的监听事件
116
- const proxyColumnListener = (listener: Record<string, Function>) => {
117
- return Object.keys(listener).reduce((pre: Record<string, Function>, cur) => {
118
- pre[cur] = (...args: any) => {
119
- listener[cur](...args, searchValue);
120
- };
121
- return pre;
122
- }, {});
123
- };
124
-
125
- const searchValue = reactive<Record<string, any>>(
126
- columnsToSearchValue(props.columns)
127
- );
128
-
129
- const BaseSearchRender = defineComponent({
130
- name: 'search-render',
131
- props: {
132
- render: Function
133
- },
134
- render: (ctx: { render: ComponentRender['render'] }) => {
135
- return ctx.render
136
- ? ctx.render({ columns: props.columns, searchValue })
137
- : '';
138
- }
139
- });
140
-
141
- const handleSearchClick = async () => {
142
- let _searchValue = base.deepClone(searchValue);
143
- if (isFunction(props.searchBtn?.beforeSearch)) {
144
- _searchValue = await props.searchBtn?.beforeSearch?.(_searchValue);
145
- }
146
-
147
- emits('search', _searchValue);
148
-
149
- if (isFunction(props.searchBtn?.afterSearch)) {
150
- await props.searchBtn?.afterSearch?.(_searchValue);
151
- }
152
- };
153
-
154
- const handleResetClick = async () => {
155
- Object.keys(searchValue).forEach(
156
- searchKey => (searchValue[searchKey] = null)
157
- );
158
- let _searchValue = base.deepClone(searchValue);
159
- if (isFunction(props.resetBtn?.beforeReset)) {
160
- _searchValue = await props.resetBtn?.beforeReset?.(_searchValue);
161
- }
162
- emits('search', _searchValue);
163
-
164
- if (isFunction(props.resetBtn?.afterReset)) {
165
- await props.resetBtn?.afterReset?.(_searchValue);
166
- }
167
- };
168
-
169
- defineExpose({
170
- getSearchValue: (): Record<string, any> => {
171
- return base.deepClone(searchValue);
172
- },
173
- setSearchValue: (key: string | number, value: any) => {
174
- if (props.columns.findIndex(({ prop }) => prop == key) == -1) {
175
- console.warn(`原始search配置项不存在${key}属性,建议修改`);
176
- }
177
- searchValue[key] = value;
178
- },
179
- handleSearchClick: handleSearchClick,
180
- handleResetClick: handleResetClick
181
- });
182
- </script>
183
-
184
- <style lang="scss" scoped>
185
- .xrk-search {
186
- ::v-deep {
187
- & > .xrk-form {
188
- display: flex;
189
- flex-wrap: wrap;
190
- .xrk-form-item {
191
- margin-bottom: 12px;
192
- margin-right: 12px;
193
- }
194
- }
195
- }
196
- }
197
- </style>
@@ -1,95 +0,0 @@
1
- /*
2
- * @Description:
3
- * @Date: 2022-06-29 16:09:25
4
- */
5
- import { Component, CSSProperties } from 'vue';
6
- import { BaseInputProps } from '../../../base/input';
7
- import { BaseDatePickerProps } from '../../../base/date-picker';
8
- import {
9
- BaseSelectProps,
10
- SelectOptionType,
11
- SelectValueType
12
- } from '../../../base/select';
13
- import { FormItemRule } from 'element-plus';
14
-
15
- type AnyObject = Record<string, any>;
16
-
17
- export type BaseSelectListener = {
18
- onChange?: (
19
- value: SelectValueType,
20
- selectOptions: Array<SelectOptionType>,
21
- searchValue: AnyObject
22
- ) => void;
23
- onRemoveTag?: (value: SelectValueType, searchValue: AnyObject) => void;
24
- onVisibleChange?: (visibleStatus: boolean, searchValue: AnyObject) => void;
25
- onClear?: (searchValue: AnyObject) => void;
26
- };
27
-
28
- export type BaseInputListener = {
29
- onBlur?: (events: Event, searchValue: AnyObject) => void;
30
- onFocus?: (events: Event, searchValue: AnyObject) => void;
31
- onKeyup?: (events: Event, searchValue: AnyObject) => void;
32
- onChange?: (
33
- value: string | number | KeyboardEvent,
34
- searchValue: AnyObject
35
- ) => void;
36
- onInput?: (
37
- value: string | number | KeyboardEvent,
38
- searchValue: AnyObject
39
- ) => void;
40
- onClear?: (searchValue: AnyObject) => void;
41
- };
42
-
43
- export type BaseDatePickerListener = {
44
- onChange?: (value: any, searchValue: AnyObject) => void;
45
- onVisibleChange?: (visibleStatus: boolean, searchValue: AnyObject) => void;
46
- onCalendarChange?: (val: [Date, Date | null], searchValue: AnyObject) => void;
47
- };
48
-
49
- export interface ComponentsType {
50
- input: Component;
51
- select: Component;
52
- datePicker: Component;
53
- }
54
-
55
- export type SerachColumnBaseType<T, S> = {
56
- type?: keyof ComponentsType;
57
- label?: string;
58
- style?: CSSProperties;
59
- defaultValue?: any;
60
- prop: string;
61
- rules?: FormItemRule | Array<FormItemRule>;
62
- disabled?: boolean | ((searchValue: AnyObject) => Promise<boolean> | boolean);
63
- config?: T;
64
- listener?: S;
65
- };
66
-
67
- export type SerachColumnType = SerachColumnBaseType<
68
- BaseInputProps | BaseSelectProps | BaseDatePickerProps,
69
- BaseInputListener | BaseSelectListener | BaseDatePickerListener
70
- >;
71
-
72
- export type SearchBtnType = {
73
- text?: string;
74
- show?: boolean;
75
- beforeSearch?: (searchValue: AnyObject) => AnyObject | Promise<AnyObject>;
76
- afterSearch?: (
77
- searchValue: AnyObject
78
- ) => void | AnyObject | Promise<AnyObject>;
79
- };
80
-
81
- export type ResetBtnType = {
82
- text?: string;
83
- show?: boolean;
84
- beforeReset?: (searchValue: AnyObject) => AnyObject | Promise<AnyObject>;
85
- afterReset?: (
86
- searchValue: AnyObject
87
- ) => void | AnyObject | Promise<AnyObject>;
88
- };
89
-
90
- export interface ComponentRender {
91
- render: (renderInfo: {
92
- columns: Array<SerachColumnType>;
93
- searchValue: Record<string, any>;
94
- }) => Component;
95
- }
@@ -1,34 +0,0 @@
1
- /*
2
- * @Description:
3
- * @Date: 2022-07-04 16:46:02
4
- */
5
- import { ref } from 'vue';
6
- import { isFunction } from '../../../../tools/check';
7
-
8
- export const useTable = (config: any) => {
9
- const pageIsLoading = ref<boolean>(false);
10
- const pageAllData = ref<Array<any>>([]);
11
- const paginationTotal = ref<number>(0);
12
-
13
- const getList = async (query: any) => {
14
- if (pageIsLoading.value) return;
15
- pageIsLoading.value = true;
16
- try {
17
- if (isFunction(config.getListAjax)) {
18
- const res = await config.getListAjax(query);
19
- pageAllData.value = res.data.list;
20
- paginationTotal.value = res.data.total;
21
- }
22
- } catch (error) {
23
- console.warn(error);
24
- }
25
- pageIsLoading.value = false;
26
- };
27
-
28
- return {
29
- pageIsLoading,
30
- pageAllData,
31
- paginationTotal,
32
- getList
33
- };
34
- };
@@ -1,10 +0,0 @@
1
- /*
2
- * @Description:
3
- * @Date: 2022-07-04 17:18:12
4
- */
5
- import { DefineComponent } from 'vue';
6
-
7
- import _XrkTable from './table.vue';
8
- import { XrkTableProps } from './types/type';
9
-
10
- export const XrkTable = _XrkTable as DefineComponent<XrkTableProps>;
@@ -1,218 +0,0 @@
1
- <!--
2
- * @Description:
3
- * @Date: 2022-07-04 16:42:21
4
- -->
5
- <template>
6
- <xrk-search
7
- ref="XrkSearchRef"
8
- :columns="searchConfig.searchColumns"
9
- :search-btn="searchConfig.searchBtn"
10
- :reset-btn="searchConfig.resetBtn"
11
- :other-components="searchConfig.othertComponents"
12
- @search="handleSearch"
13
- ></xrk-search>
14
- <div class="slot-before slot">
15
- <slot
16
- name="tableBefore"
17
- :selectionRows="TableSelectionRows"
18
- :tableData="pageAllData"
19
- :searchQuery="query"
20
- ></slot>
21
- </div>
22
- <base-table
23
- class="xrk-table-content"
24
- v-loading="pageIsLoading"
25
- ref="XrkTablebaseTableRef"
26
- :data="pageAllData"
27
- :columns="tableConfig.tableColumns"
28
- @select-all="handleTableSelect"
29
- @select="handleTableSelect"
30
- ></base-table>
31
- <div class="slot-after slot">
32
- <slot
33
- name="tableAfter"
34
- :selectionRows="TableSelectionRows"
35
- :tableData="pageAllData"
36
- :searchQuery="query"
37
- ></slot>
38
- </div>
39
- <base-pagination
40
- ref="BasePaginationRef"
41
- :total="paginationTotal"
42
- :pageSize="paginationConfig.paginationPageSize"
43
- :currentPage="paginationConfig.paginationCurrentPage"
44
- @size-change="handlePageChange"
45
- @current-change="handlePageChange"
46
- ></base-pagination>
47
- </template>
48
-
49
- <script lang="tsx">
50
- export default {
51
- name: 'xrk-table'
52
- };
53
- </script>
54
-
55
- <script lang="tsx" setup>
56
- import XrkSearch from '../search/search.vue';
57
- import { BaseTable } from '../../base/table';
58
- import { BasePagination } from '../../base/pagination';
59
- import { useTable } from './hooks/use-table';
60
- import { base } from 'xrk-tools';
61
- import { BaseTableColumnProps } from '../../base/table/types/type';
62
- import { onBeforeMount } from 'vue-demi';
63
- import { computed, onMounted, ref } from 'vue';
64
- import { vLoading as _vLoading } from 'element-plus';
65
- import { XrkTableProps } from './types/type';
66
- const _props = withDefaults(
67
- defineProps<{
68
- requestNow?: boolean;
69
- getListAjax: (...args: any) => Promise<any> | any;
70
- searchConfig: {
71
- searchColumns: Array<any>;
72
- searchBtn?: any;
73
- resetBtn?: any;
74
- othertComponents?: Array<any>;
75
- };
76
- tableConfig: {
77
- tableColumns: Array<any>;
78
- };
79
- paginationConfig?: {
80
- pageNoKey?: string;
81
- pageSizeKey?: string;
82
- paginationPageSize: number;
83
- paginationCurrentPage: number;
84
- };
85
- }>(),
86
- {
87
- requestNow: true,
88
- paginationConfig: () => ({
89
- pageNoKey: 'pageNo',
90
- pageSizeKey: 'pageSize',
91
- paginationPageSize: 60,
92
- paginationCurrentPage: 1
93
- })
94
- }
95
- );
96
-
97
- interface _XrkTableProps extends XrkTableProps {
98
- paginationConfig: {
99
- pageNoKey: string;
100
- pageSizeKey: string;
101
- paginationPageSize: number;
102
- paginationCurrentPage: number;
103
- };
104
- }
105
-
106
- const props = _props as Readonly<_XrkTableProps>;
107
-
108
- const vLoading = _vLoading;
109
-
110
- const TableSelectionRows = ref<any>([]);
111
- const XrkSearchRef = ref<any>(null);
112
- const XrkTablebaseTableRef = ref<any>(null);
113
- const BasePaginationRef = ref<any>(null);
114
- const pageNoKey = props.paginationConfig.pageNoKey as string;
115
- const pageSizeKey = props.paginationConfig.pageSizeKey as string;
116
-
117
- const paginationQuery = ref<{
118
- [propname: string]: number;
119
- }>({
120
- [pageNoKey]: props.paginationConfig?.paginationCurrentPage,
121
- [pageSizeKey]: props.paginationConfig?.paginationPageSize
122
- });
123
- const searchQuery = ref<Record<string, any>>({});
124
-
125
- const query = computed(() => ({
126
- ...paginationQuery.value,
127
- ...searchQuery.value
128
- }));
129
-
130
- const initSearchQuery = () => {
131
- const searchQueryDefault = XrkSearchRef.value?.getSearchValue?.() || {};
132
- searchQuery.value = searchQueryDefault;
133
- };
134
-
135
- const initPageInfo = (pageNo = 1) => {
136
- BasePaginationRef.value?.setPageInfo({
137
- pageSize: paginationQuery.value[pageSizeKey],
138
- currentPage: pageNo
139
- });
140
- paginationQuery.value[pageNoKey] = pageNo;
141
- };
142
-
143
- const clearSelectionRows = () => {
144
- XrkTablebaseTableRef.value?.clearSelectionRows?.();
145
- TableSelectionRows.value = [];
146
- };
147
-
148
- const handleSearch = (searchValue: any) => {
149
- searchQuery.value = base.deepClone(searchValue);
150
- initPageInfo(1);
151
- clearSelectionRows();
152
- getList?.(query.value);
153
- };
154
-
155
- const handlePageChange = () => {
156
- const pageInfo = BasePaginationRef.value?.getPageInfo?.();
157
- paginationQuery.value = {
158
- [pageNoKey]: pageInfo.currentPage,
159
- [pageSizeKey]: pageInfo.pageSize
160
- };
161
- getList?.(query.value);
162
- };
163
-
164
- const handleTableSelect = () => {
165
- const res = XrkTablebaseTableRef.value?.getSelectionRows?.();
166
- TableSelectionRows.value = Array.isArray(res) ? res : [];
167
- };
168
-
169
- const { pageAllData, getList, paginationTotal, pageIsLoading } = useTable({
170
- getListAjax: props.getListAjax
171
- });
172
-
173
- onMounted(() => {
174
- initSearchQuery();
175
- clearSelectionRows();
176
- props.requestNow && getList?.(query.value);
177
- });
178
-
179
- defineExpose({
180
- getSelectionRows: () => XrkTablebaseTableRef.value?.getSelectionRows?.(),
181
- addSelectionRow: (rowId: string | number, row: any) =>
182
- XrkTablebaseTableRef.value?.addSelectionRow?.(rowId, row),
183
- removeSelectionRow: (rowId: string | number) =>
184
- XrkTablebaseTableRef.value?.removeSelectionRow?.(rowId),
185
- clearSelectionRows: () => XrkTablebaseTableRef.value?.clearSelectionRows?.(),
186
-
187
- setSearchValue: (key: string | number, value: any) =>
188
- XrkSearchRef.value?.setSearchValue?.(key, value),
189
- initCurrentList: (customQuery: any) => {
190
- initSearchQuery();
191
- getList?.({ ...(customQuery || {}), ...query.value });
192
- },
193
- initList: (customQuery: any) => {
194
- initSearchQuery();
195
- initPageInfo(1);
196
- getList?.({ ...(customQuery || {}), ...query.value });
197
- }
198
- });
199
- </script>
200
-
201
- <style lang="scss" scope>
202
- $margin: 12px;
203
- .xrk-table-content {
204
- margin: $margin 0;
205
- }
206
- .slot {
207
- &:empty {
208
- margin-top: 0;
209
- margin-bottom: 0;
210
- }
211
- &-before {
212
- margin-top: $margin;
213
- }
214
- &-after {
215
- margin-bottom: $margin;
216
- }
217
- }
218
- </style>
@@ -1,31 +0,0 @@
1
- /*
2
- * @Description:
3
- * @Date: 2022-07-04 17:19:44
4
- */
5
- import { BaseTableColumnProps } from '../../../base/table/types/type';
6
- import {
7
- ComponentRender,
8
- ResetBtnType,
9
- SearchBtnType,
10
- SerachColumnType
11
- } from '../../search/types/type';
12
-
13
- export type XrkTableProps = {
14
- requestNow?: boolean;
15
- getListAjax: (...args: any) => Promise<any> | any;
16
- searchConfig: {
17
- searchColumns: Array<SerachColumnType>;
18
- searchBtn?: SearchBtnType;
19
- resetBtn?: ResetBtnType;
20
- othertComponents?: Array<ComponentRender>;
21
- };
22
- tableConfig: {
23
- tableColumns: Array<BaseTableColumnProps>;
24
- };
25
- paginationConfig?: {
26
- pageNoKey?: string;
27
- pageSizeKey?: string;
28
- paginationPageSize: number;
29
- paginationCurrentPage: number;
30
- };
31
- };
package/rollup.config.js DELETED
@@ -1,59 +0,0 @@
1
- /*
2
- * @Description:
3
- * @Date: 2022-07-06 10:15:25
4
- */
5
-
6
- const path = require('path');
7
-
8
- import commonjs from '@rollup/plugin-commonjs';
9
- import resolve from '@rollup/plugin-node-resolve';
10
-
11
- import jsx from 'acorn-jsx';
12
- import babel from 'rollup-plugin-babel';
13
- import typescript from 'typescript';
14
- import clear from 'rollup-plugin-clear';
15
- import rollupTypescript from 'rollup-plugin-typescript2';
16
- import rollupVue from 'rollup-plugin-vue';
17
- import rollupPostcss from 'rollup-plugin-postcss';
18
- import autoprefixer from 'autoprefixer';
19
-
20
- const outdir = 'lib';
21
-
22
- export default {
23
- input: 'packages/index.ts',
24
- output: [
25
- {
26
- format: 'esm',
27
- file: `${outdir}/index.esm.js`
28
- },
29
- {
30
- name: 'Xrk',
31
- format: 'umd',
32
- file: `${outdir}/index.umd.js`
33
- }
34
- ],
35
- plugins: [
36
- clear({ targets: [outdir] }),
37
- resolve(),
38
- rollupTypescript({
39
- check: false,
40
- include: ['*.ts+(|x)', '**/*.ts+(|x)'],
41
- exclude: 'node_modules/**',
42
- typescript: typescript
43
- }),
44
- rollupVue({
45
- preprocessStyles: true
46
- }),
47
- rollupPostcss({
48
- extract: path.resolve(`${outdir}/index.css`),
49
- plugins: [autoprefixer()]
50
- }),
51
- commonjs(),
52
- babel({
53
- runtimeHelpers: true,
54
- exclude: 'node_modules/**'
55
- })
56
- ],
57
- acornInjectPlugins: [jsx()],
58
- external: ['vue', 'element-plus', 'xrk-tools']
59
- };
@@ -1,5 +0,0 @@
1
- @forward '~element-plus/theme-chalk/src/mixins/config.scss' with (
2
- $namespace: 'xrk'
3
- );
4
-
5
- @import '~element-plus/theme-chalk/src/index.scss';
@@ -1,40 +0,0 @@
1
- // 清除浮动
2
- @mixin clearfix {
3
- &:after {
4
- content: '';
5
- display: table;
6
- clear: both;
7
- }
8
- }
9
-
10
- @mixin flex_jc_ai($jc: space-between, $ai: center) {
11
- display: flex;
12
- justify-content: $jc;
13
- align-items: $ai;
14
- }
15
-
16
- // 超出显示省略号
17
- @mixin line_clamp($condition: 2) {
18
- overflow: hidden;
19
- text-overflow: ellipsis;
20
- -webkit-box-orient: vertical;
21
- display: -webkit-box;
22
- -webkit-line-clamp: $condition;
23
- white-space: initial;
24
- }
25
-
26
- // all 上下左右居中, x 左右居中,y上下居中
27
- @mixin absolute_mid($type: 'all') {
28
- position: absolute;
29
- @if $type == 'all' {
30
- top: 50%;
31
- left: 50%;
32
- transform: translate(-50%, -50%);
33
- } @else if $type == 'x' {
34
- left: 50%;
35
- transform: translateX(-50%);
36
- } @else {
37
- top: 50%;
38
- transform: translateY(-50%);
39
- }
40
- }
package/tools/check.ts DELETED
@@ -1,9 +0,0 @@
1
- /*
2
- * @Description:
3
- * @Date: 2022-07-01 11:46:30
4
- */
5
- import { check } from 'xrk-tools';
6
-
7
- export function isFunction<T = Function>(val: unknown): val is T {
8
- return check.isFunction(val) || check.isAsyncFunction(val);
9
- }