ct-component-plus 0.0.43 → 0.0.45

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 (95) hide show
  1. package/README.md +3 -3
  2. package/package.json +36 -36
  3. package/packages/components/button/index.js +8 -8
  4. package/packages/components/button/src/button.vue +171 -171
  5. package/packages/components/cascader/index.js +7 -7
  6. package/packages/components/cascader/src/cascader.vue +247 -247
  7. package/packages/components/cascader/src/ct-cascader.vue +260 -260
  8. package/packages/components/cascader/src/index.js +50 -50
  9. package/packages/components/checkbox/index.js +7 -7
  10. package/packages/components/checkbox/src/checkbox.vue +51 -51
  11. package/packages/components/checkbox/src/index.js +12 -12
  12. package/packages/components/date-picker/index.js +8 -8
  13. package/packages/components/date-picker/src/clear-icon.vue +2 -2
  14. package/packages/components/date-picker/src/date-icon.vue +2 -2
  15. package/packages/components/date-picker/src/date-picker.vue +77 -77
  16. package/packages/components/date-picker/src/index.js +33 -33
  17. package/packages/components/dialog/index.js +8 -8
  18. package/packages/components/dialog/src/dialog.vue +103 -103
  19. package/packages/components/empty/index.js +8 -8
  20. package/packages/components/empty/src/empty.vue +97 -97
  21. package/packages/components/index.js +81 -81
  22. package/packages/components/input/index.js +7 -7
  23. package/packages/components/input/src/index.js +13 -13
  24. package/packages/components/input/src/input.vue +106 -106
  25. package/packages/components/input-range/index.js +7 -7
  26. package/packages/components/input-range/src/index.js +29 -29
  27. package/packages/components/input-range/src/input-range.vue +233 -233
  28. package/packages/components/loading/index.js +7 -7
  29. package/packages/components/loading/src/CtLoading.vue +74 -74
  30. package/packages/components/loading/src/beating.vue +71 -71
  31. package/packages/components/loading/src/progress.vue +120 -120
  32. package/packages/components/loading/src/spinner.vue +38 -38
  33. package/packages/components/menu/index.js +7 -7
  34. package/packages/components/menu/src/item.vue +46 -46
  35. package/packages/components/menu/src/link.vue +28 -28
  36. package/packages/components/menu/src/logo.vue +25 -25
  37. package/packages/components/menu/src/menu-item.vue +103 -103
  38. package/packages/components/menu/src/menu.vue +191 -191
  39. package/packages/components/menu/src/utils/index.js +4 -4
  40. package/packages/components/message/icon/ErrorIcon.vue +25 -25
  41. package/packages/components/message/icon/InfoIcon.vue +25 -25
  42. package/packages/components/message/icon/SuccessIcon.vue +25 -25
  43. package/packages/components/message/icon/WarningIcon.vue +25 -25
  44. package/packages/components/message/index.js +8 -8
  45. package/packages/components/message/src/method.js +54 -54
  46. package/packages/components/message-box/index.js +7 -7
  47. package/packages/components/message-box/src/message-box.vue +107 -107
  48. package/packages/components/page/index.js +7 -7
  49. package/packages/components/page/src/modules/DownloadButton.vue +21 -21
  50. package/packages/components/page/src/modules/TableTitle.vue +151 -151
  51. package/packages/components/page/src/page.vue +382 -382
  52. package/packages/components/pagination/index.js +7 -7
  53. package/packages/components/pagination/src/pagination.vue +36 -36
  54. package/packages/components/radio/index.js +7 -7
  55. package/packages/components/radio/src/index.js +12 -12
  56. package/packages/components/radio/src/radio.vue +47 -47
  57. package/packages/components/search-box/index.js +24 -24
  58. package/packages/components/search-box/src/index.js +29 -29
  59. package/packages/components/search-box/src/search-box.vue +250 -250
  60. package/packages/components/search-box/src/slot.vue +4 -4
  61. package/packages/components/select/index.js +7 -7
  62. package/packages/components/select/src/arrow-down.vue +2 -2
  63. package/packages/components/select/src/clear-icon.vue +2 -2
  64. package/packages/components/select/src/empty.vue +13 -13
  65. package/packages/components/select/src/index.js +51 -51
  66. package/packages/components/select/src/select.vue +380 -380
  67. package/packages/components/table/index.js +7 -7
  68. package/packages/components/table/src/TableSort.vue +179 -179
  69. package/packages/components/table/src/index.js +78 -70
  70. package/packages/components/table/src/table.vue +288 -287
  71. package/packages/components/tabs/index.js +7 -7
  72. package/packages/components/tabs/src/tabs.vue +225 -225
  73. package/packages/components/year-select/index.js +7 -7
  74. package/packages/components/year-select/src/index.js +44 -44
  75. package/packages/components/year-select/src/year-select.vue +273 -273
  76. package/packages/constants/aria.ts +17 -17
  77. package/packages/constants/index.ts +1 -1
  78. package/packages/directives/click-outside/index.ts +118 -118
  79. package/packages/echarts/bar/index.js +63 -63
  80. package/packages/echarts/base.js +99 -99
  81. package/packages/echarts/line/index.js +106 -106
  82. package/packages/hooks/index.js +5 -5
  83. package/packages/hooks/use-buried/index.js +46 -46
  84. package/packages/hooks/use-checked-all/index.js +37 -37
  85. package/packages/hooks/use-echarts/index.js +1 -1
  86. package/packages/hooks/use-echarts/use-bar/index.js +72 -72
  87. package/packages/hooks/use-echarts/use-line/index.js +88 -88
  88. package/packages/hooks/use-namespace/index.js +65 -65
  89. package/packages/hooks/use-search-component/index.js +28 -28
  90. package/packages/style/element.less +725 -725
  91. package/packages/style/index.js +2 -2
  92. package/packages/style/init.less +114 -114
  93. package/packages/utils/index.js +1 -1
  94. package/packages/utils/operate.js +77 -77
  95. package/packages/utils/types.js +35 -35
@@ -1,107 +1,107 @@
1
- import { baseOption } from "../base";
2
- export const baseLineOption = {
3
- color: [
4
- 'rgba(77, 100, 255, 1)',
5
- "rgba(255, 173, 44, 1)",
6
- "rgba(30, 183, 173, 1)",
7
- "rgba(255, 146, 24, 1)",
8
- "rgba(66, 166, 255, 1)",
9
- "rgba(136, 206, 119, 1)",
10
- ],
11
- axisPointer: {
12
- lineStyle: {
13
- color: "#D8DEE8",
14
- },
15
- },
16
- ...baseOption,
17
- series: [],
18
- }
19
-
20
- export const seriesItem = {
21
- name: "",
22
- type: "line",
23
- symbol: "circle",
24
- // showSymbol: false,
25
- symbolSize: 6,
26
- lineStyle: {
27
- width: 3,
28
- },
29
- itemStyle: {
30
- borderColor: "#fff",
31
- borderWidth: 2,
32
- shadowColor: "rgba(72, 80, 119, 0.12)",
33
- shadowBlur: 4,
34
- shadowOffsetX: 0,
35
- shadowOffsetY: 2,
36
- },
37
- emphasis: {
38
- scale: 1.33,
39
- itemStyle: {
40
- borderColor: "#fff",
41
- borderWidth: 2.25,
42
- shadowColor: "rgba(72,80,119,0.22)",
43
- shadowBlur: 8,
44
- shadowOffsetX: 0,
45
- shadowOffsetY: 2,
46
- },
47
- },
48
- data: [],
49
- }
50
-
51
- export const areaSeriesItem = {
52
- name: "",
53
- type: "line",
54
- symbol: "circle",
55
- showSymbol: true,
56
- symbolSize: 6,
57
- lineStyle: {
58
- width: 3,
59
- },
60
- label: {
61
- show: false
62
- },
63
- areaStyle: {
64
- color: {
65
- type: "linear",
66
- x: 0,
67
- y: 0,
68
- x2: 0,
69
- y2: 1,
70
- colorStops: [
71
- {
72
- offset: 0,
73
- color: "rgba(77, 100, 255, 0.22)", // 0% 处的颜色
74
- },
75
- {
76
- offset: 1,
77
- color: "rgba(77, 100, 255, 0)", // 100% 处的颜色
78
- },
79
- ],
80
- global: false, // 缺省为 false
81
- },
82
- origin: "start",
83
- },
84
- itemStyle: {
85
- borderColor: "#fff",
86
- borderWidth: 2,
87
- shadowColor: "rgba(72, 80, 119, 0.22)",
88
- shadowBlur: 4,
89
- shadowOffsetX: 0,
90
- shadowOffsetY: 2,
91
- },
92
- emphasis: {
93
- scale: 1.33,
94
- label: {
95
- show: false
96
- },
97
- itemStyle: {
98
- borderColor: "#fff",
99
- borderWidth: 2.25,
100
- shadowColor: "rgba(72,80,119,0.22)",
101
- shadowBlur: 8,
102
- shadowOffsetX: 0,
103
- shadowOffsetY: 2,
104
- },
105
- },
106
- data: [],
1
+ import { baseOption } from "../base";
2
+ export const baseLineOption = {
3
+ color: [
4
+ 'rgba(77, 100, 255, 1)',
5
+ "rgba(255, 173, 44, 1)",
6
+ "rgba(30, 183, 173, 1)",
7
+ "rgba(255, 146, 24, 1)",
8
+ "rgba(66, 166, 255, 1)",
9
+ "rgba(136, 206, 119, 1)",
10
+ ],
11
+ axisPointer: {
12
+ lineStyle: {
13
+ color: "#D8DEE8",
14
+ },
15
+ },
16
+ ...baseOption,
17
+ series: [],
18
+ }
19
+
20
+ export const seriesItem = {
21
+ name: "",
22
+ type: "line",
23
+ symbol: "circle",
24
+ // showSymbol: false,
25
+ symbolSize: 6,
26
+ lineStyle: {
27
+ width: 3,
28
+ },
29
+ itemStyle: {
30
+ borderColor: "#fff",
31
+ borderWidth: 2,
32
+ shadowColor: "rgba(72, 80, 119, 0.12)",
33
+ shadowBlur: 4,
34
+ shadowOffsetX: 0,
35
+ shadowOffsetY: 2,
36
+ },
37
+ emphasis: {
38
+ scale: 1.33,
39
+ itemStyle: {
40
+ borderColor: "#fff",
41
+ borderWidth: 2.25,
42
+ shadowColor: "rgba(72,80,119,0.22)",
43
+ shadowBlur: 8,
44
+ shadowOffsetX: 0,
45
+ shadowOffsetY: 2,
46
+ },
47
+ },
48
+ data: [],
49
+ }
50
+
51
+ export const areaSeriesItem = {
52
+ name: "",
53
+ type: "line",
54
+ symbol: "circle",
55
+ showSymbol: true,
56
+ symbolSize: 6,
57
+ lineStyle: {
58
+ width: 3,
59
+ },
60
+ label: {
61
+ show: false
62
+ },
63
+ areaStyle: {
64
+ color: {
65
+ type: "linear",
66
+ x: 0,
67
+ y: 0,
68
+ x2: 0,
69
+ y2: 1,
70
+ colorStops: [
71
+ {
72
+ offset: 0,
73
+ color: "rgba(77, 100, 255, 0.22)", // 0% 处的颜色
74
+ },
75
+ {
76
+ offset: 1,
77
+ color: "rgba(77, 100, 255, 0)", // 100% 处的颜色
78
+ },
79
+ ],
80
+ global: false, // 缺省为 false
81
+ },
82
+ origin: "start",
83
+ },
84
+ itemStyle: {
85
+ borderColor: "#fff",
86
+ borderWidth: 2,
87
+ shadowColor: "rgba(72, 80, 119, 0.22)",
88
+ shadowBlur: 4,
89
+ shadowOffsetX: 0,
90
+ shadowOffsetY: 2,
91
+ },
92
+ emphasis: {
93
+ scale: 1.33,
94
+ label: {
95
+ show: false
96
+ },
97
+ itemStyle: {
98
+ borderColor: "#fff",
99
+ borderWidth: 2.25,
100
+ shadowColor: "rgba(72,80,119,0.22)",
101
+ shadowBlur: 8,
102
+ shadowOffsetX: 0,
103
+ shadowOffsetY: 2,
104
+ },
105
+ },
106
+ data: [],
107
107
  }
@@ -1,6 +1,6 @@
1
-
2
- export * from './use-namespace'
3
- export * from './use-buried'
4
- export * from './use-search-component'
5
- export * from './use-checked-all'
1
+
2
+ export * from './use-namespace'
3
+ export * from './use-buried'
4
+ export * from './use-search-component'
5
+ export * from './use-checked-all'
6
6
  export * from "./use-echarts"
@@ -1,47 +1,47 @@
1
-
2
- export const buriedParamsKey = 'changeBuriedParams'
3
- import { isFunction, isObject } from '../../utils';
4
- import { watch } from 'vue';
5
- export const useBuriedParams = (props, emitApp, options) => {
6
- const emitKey = buriedParamsKey;
7
- const { label, param } = (props || {});
8
-
9
- const get = (content) => {
10
- const params = {
11
- label,
12
- value: param,
13
- content
14
- }
15
- if (options && isFunction(options.getContent)) {
16
- params.content = options.getContent(params.content)
17
- }
18
- return params
19
- }
20
- const emit = (content) => {
21
- if (isFunction(emitApp)) {
22
- const params = get(content);
23
- if (params.label) {
24
- emitApp(emitKey, params)
25
- }
26
- }
27
- }
28
-
29
- const _emitBuriedParams = () => {
30
- // 发送埋点数据
31
- props.buried && emit(props.modelValue);
32
- };
33
- watch(
34
- () => props.modelValue,
35
- (newValue) => {
36
- _emitBuriedParams();
37
- },
38
- {
39
- immediate: true,
40
- }
41
- );
42
- return {
43
- get,
44
- emit,
45
- emitKey,
46
- }
1
+
2
+ export const buriedParamsKey = 'changeBuriedParams'
3
+ import { isFunction, isObject } from '../../utils';
4
+ import { watch } from 'vue';
5
+ export const useBuriedParams = (props, emitApp, options) => {
6
+ const emitKey = buriedParamsKey;
7
+ const { label, param } = (props || {});
8
+
9
+ const get = (content) => {
10
+ const params = {
11
+ label,
12
+ value: param,
13
+ content
14
+ }
15
+ if (options && isFunction(options.getContent)) {
16
+ params.content = options.getContent(params.content)
17
+ }
18
+ return params
19
+ }
20
+ const emit = (content) => {
21
+ if (isFunction(emitApp)) {
22
+ const params = get(content);
23
+ if (params.label) {
24
+ emitApp(emitKey, params)
25
+ }
26
+ }
27
+ }
28
+
29
+ const _emitBuriedParams = () => {
30
+ // 发送埋点数据
31
+ props.buried && emit(props.modelValue);
32
+ };
33
+ watch(
34
+ () => props.modelValue,
35
+ (newValue) => {
36
+ _emitBuriedParams();
37
+ },
38
+ {
39
+ immediate: true,
40
+ }
41
+ );
42
+ return {
43
+ get,
44
+ emit,
45
+ emitKey,
46
+ }
47
47
  }
@@ -1,38 +1,38 @@
1
- import { computed } from "vue"
2
- import { isArray, isObject } from '../../utils';
3
-
4
- export const useCheckedAll = (list, selects, options = {}) => {
5
- const { key = 'value', onCheckedAll } = (isObject(options) ? options : {})
6
- const listKeys = computed(() => {
7
- if (isArray(list.value)) return list.value.map(item => item[key])
8
- return []
9
- })
10
-
11
- const checkedAll = computed({
12
- get() {
13
- if (isArray(list.value) && isArray(selects.value) && list.value.length && selects.value.length) {
14
- if (list.value.length > selects.value.length) {
15
- return false;
16
- } else {
17
- return listKeys.value.every(item => selects.value.includes(item))
18
- return selects.value.every(item => listKeys.value.includes(item))
19
- }
20
- } else {
21
- return false
22
- }
23
- },
24
- set(newValue) {
25
- if (!newValue) {
26
- // 去掉全选
27
- selects.value = selects.value.filter(item => !listKeys.value.includes(item))
28
- if (typeof onCheckedAll === 'function') onCheckedAll(false)
29
- } else {
30
- // 全选
31
- selects.value = selects.value.concat(listKeys.value.filter(item => !selects.value.includes(item)))
32
- }
33
- }
34
- })
35
- return {
36
- checkedAll
37
- }
1
+ import { computed } from "vue"
2
+ import { isArray, isObject } from '../../utils';
3
+
4
+ export const useCheckedAll = (list, selects, options = {}) => {
5
+ const { key = 'value', onCheckedAll } = (isObject(options) ? options : {})
6
+ const listKeys = computed(() => {
7
+ if (isArray(list.value)) return list.value.map(item => item[key])
8
+ return []
9
+ })
10
+
11
+ const checkedAll = computed({
12
+ get() {
13
+ if (isArray(list.value) && isArray(selects.value) && list.value.length && selects.value.length) {
14
+ if (list.value.length > selects.value.length) {
15
+ return false;
16
+ } else {
17
+ return listKeys.value.every(item => selects.value.includes(item))
18
+ return selects.value.every(item => listKeys.value.includes(item))
19
+ }
20
+ } else {
21
+ return false
22
+ }
23
+ },
24
+ set(newValue) {
25
+ if (!newValue) {
26
+ // 去掉全选
27
+ selects.value = selects.value.filter(item => !listKeys.value.includes(item))
28
+ if (typeof onCheckedAll === 'function') onCheckedAll(false)
29
+ } else {
30
+ // 全选
31
+ selects.value = selects.value.concat(listKeys.value.filter(item => !selects.value.includes(item)))
32
+ }
33
+ }
34
+ })
35
+ return {
36
+ checkedAll
37
+ }
38
38
  }
@@ -1,2 +1,2 @@
1
- export * from "./use-line";
1
+ export * from "./use-line";
2
2
  export * from "./use-bar";
@@ -1,73 +1,73 @@
1
- import { ref, watch, inject } from "vue";
2
- import { baseBarOption, seriesItem } from "../../../echarts/bar";
3
- import { copyObj, getOpacityColor, objectMerge } from "../../../utils";
4
-
5
- /**
6
- *
7
- * @param {string} type -柱状图的类型,目前只有basic基本柱状图
8
- * @param {Object} option -用户想要进行灵活配置所传入的参数
9
- * @param {Array} data - 图表数据
10
- */
11
- export const useBarEcharts = (type, option, data) => {
12
- const themeColor = inject('themeColor', null); //获取系统主题
13
- const barOption = ref(copyObj(baseBarOption));
14
- const itemTemplate = ref({});
15
-
16
- //判断折线图图表类型,确定seriesItem格式
17
- if (type == 'basic') {
18
- itemTemplate.value = copyObj(seriesItem);
19
- }
20
- function initColor() {
21
- barOption.value.color.splice(0, 1, themeColor);//调整调色板第一个主题色
22
- }
23
- if (themeColor) {
24
- initColor();
25
- }
26
- function update(data) {
27
- //数据更新方式
28
- if (data.length == 0) {
29
- console.warn('用户没有传入图表数据,请在hooks外处理');
30
- return;
31
- }
32
- if (data.length > 1) {
33
- barOption.value.legend.data = data.map((item) => item.name);
34
- }
35
- barOption.value.series.splice(0);
36
- data.forEach((item, index) => {
37
- let row = copyObj(itemTemplate.value);
38
- let colorBoard = barOption.value.color;
39
- row.itemStyle.borderColor.colorStops = [
40
- {
41
- offset: 0,
42
- color: getOpacityColor(colorBoard[index % colorBoard.length], '0.5')
43
- },
44
- {
45
- offset: 1,
46
- color: getOpacityColor(colorBoard[index % colorBoard.length], '1')
47
- }
48
- ]
49
- row.data = item.data;
50
- row.name = item.name;
51
- row.label.show = item.showLabel ? true : false;
52
- row.emphasis.label.show = item.showLabel ? true : false;
53
- barOption.value.series.push(row);
54
- })
55
- }
56
- watch(() => data, (val) => {
57
- update(val);
58
- },
59
- { deep: true, immediate: true }
60
- );
61
- // 灵活配置并入option
62
-
63
- watch(() => option, (val) => {
64
- objectMerge(barOption.value, option);
65
- },
66
- {
67
- deep: true, immediate: true
68
- })
69
- return {
70
- barOption,
71
- itemTemplate
72
- }
1
+ import { ref, watch, inject } from "vue";
2
+ import { baseBarOption, seriesItem } from "../../../echarts/bar";
3
+ import { copyObj, getOpacityColor, objectMerge } from "../../../utils";
4
+
5
+ /**
6
+ *
7
+ * @param {string} type -柱状图的类型,目前只有basic基本柱状图
8
+ * @param {Object} option -用户想要进行灵活配置所传入的参数
9
+ * @param {Array} data - 图表数据
10
+ */
11
+ export const useBarEcharts = (type, option, data) => {
12
+ const themeColor = inject('themeColor', null); //获取系统主题
13
+ const barOption = ref(copyObj(baseBarOption));
14
+ const itemTemplate = ref({});
15
+
16
+ //判断折线图图表类型,确定seriesItem格式
17
+ if (type == 'basic') {
18
+ itemTemplate.value = copyObj(seriesItem);
19
+ }
20
+ function initColor() {
21
+ barOption.value.color.splice(0, 1, themeColor);//调整调色板第一个主题色
22
+ }
23
+ if (themeColor) {
24
+ initColor();
25
+ }
26
+ function update(data) {
27
+ //数据更新方式
28
+ if (data.length == 0) {
29
+ console.warn('用户没有传入图表数据,请在hooks外处理');
30
+ return;
31
+ }
32
+ if (data.length > 1) {
33
+ barOption.value.legend.data = data.map((item) => item.name);
34
+ }
35
+ barOption.value.series.splice(0);
36
+ data.forEach((item, index) => {
37
+ let row = copyObj(itemTemplate.value);
38
+ let colorBoard = barOption.value.color;
39
+ row.itemStyle.borderColor.colorStops = [
40
+ {
41
+ offset: 0,
42
+ color: getOpacityColor(colorBoard[index % colorBoard.length], '0.5')
43
+ },
44
+ {
45
+ offset: 1,
46
+ color: getOpacityColor(colorBoard[index % colorBoard.length], '1')
47
+ }
48
+ ]
49
+ row.data = item.data;
50
+ row.name = item.name;
51
+ row.label.show = item.showLabel ? true : false;
52
+ row.emphasis.label.show = item.showLabel ? true : false;
53
+ barOption.value.series.push(row);
54
+ })
55
+ }
56
+ watch(() => data, (val) => {
57
+ update(val);
58
+ },
59
+ { deep: true, immediate: true }
60
+ );
61
+ // 灵活配置并入option
62
+
63
+ watch(() => option, (val) => {
64
+ objectMerge(barOption.value, option);
65
+ },
66
+ {
67
+ deep: true, immediate: true
68
+ })
69
+ return {
70
+ barOption,
71
+ itemTemplate
72
+ }
73
73
  }