ct-component-plus 0.0.42 → 0.0.43

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 (91) hide show
  1. package/package.json +36 -36
  2. package/packages/components/button/index.js +8 -8
  3. package/packages/components/button/src/button.vue +171 -171
  4. package/packages/components/cascader/index.js +7 -7
  5. package/packages/components/cascader/src/cascader.vue +247 -247
  6. package/packages/components/cascader/src/ct-cascader.vue +260 -260
  7. package/packages/components/cascader/src/index.js +50 -50
  8. package/packages/components/checkbox/index.js +7 -7
  9. package/packages/components/checkbox/src/checkbox.vue +51 -51
  10. package/packages/components/checkbox/src/index.js +12 -12
  11. package/packages/components/date-picker/index.js +8 -8
  12. package/packages/components/date-picker/src/clear-icon.vue +2 -2
  13. package/packages/components/date-picker/src/date-icon.vue +2 -2
  14. package/packages/components/date-picker/src/date-picker.vue +77 -77
  15. package/packages/components/date-picker/src/index.js +33 -33
  16. package/packages/components/dialog/index.js +8 -8
  17. package/packages/components/dialog/src/dialog.vue +103 -103
  18. package/packages/components/empty/index.js +8 -8
  19. package/packages/components/empty/src/empty.vue +97 -97
  20. package/packages/components/index.js +81 -81
  21. package/packages/components/input/index.js +7 -7
  22. package/packages/components/input/src/index.js +13 -13
  23. package/packages/components/input/src/input.vue +106 -106
  24. package/packages/components/input-range/index.js +7 -7
  25. package/packages/components/input-range/src/index.js +29 -29
  26. package/packages/components/input-range/src/input-range.vue +233 -233
  27. package/packages/components/loading/index.js +7 -7
  28. package/packages/components/loading/src/CtLoading.vue +74 -74
  29. package/packages/components/loading/src/beating.vue +71 -71
  30. package/packages/components/loading/src/progress.vue +120 -120
  31. package/packages/components/loading/src/spinner.vue +38 -38
  32. package/packages/components/menu/index.js +7 -7
  33. package/packages/components/menu/src/item.vue +46 -46
  34. package/packages/components/menu/src/link.vue +28 -28
  35. package/packages/components/menu/src/logo.vue +25 -25
  36. package/packages/components/menu/src/menu-item.vue +103 -103
  37. package/packages/components/menu/src/menu.vue +191 -191
  38. package/packages/components/menu/src/utils/index.js +4 -4
  39. package/packages/components/message/icon/ErrorIcon.vue +25 -25
  40. package/packages/components/message/icon/InfoIcon.vue +25 -25
  41. package/packages/components/message/icon/SuccessIcon.vue +25 -25
  42. package/packages/components/message/icon/WarningIcon.vue +25 -25
  43. package/packages/components/message/index.js +8 -8
  44. package/packages/components/message/src/method.js +54 -54
  45. package/packages/components/message-box/index.js +7 -7
  46. package/packages/components/message-box/src/message-box.vue +107 -107
  47. package/packages/components/page/index.js +7 -7
  48. package/packages/components/page/src/modules/DownloadButton.vue +21 -21
  49. package/packages/components/page/src/modules/TableTitle.vue +151 -151
  50. package/packages/components/page/src/page.vue +382 -382
  51. package/packages/components/pagination/index.js +7 -7
  52. package/packages/components/pagination/src/pagination.vue +36 -36
  53. package/packages/components/radio/index.js +7 -7
  54. package/packages/components/radio/src/index.js +12 -12
  55. package/packages/components/radio/src/radio.vue +47 -47
  56. package/packages/components/search-box/index.js +24 -24
  57. package/packages/components/search-box/src/index.js +29 -29
  58. package/packages/components/search-box/src/search-box.vue +250 -251
  59. package/packages/components/search-box/src/slot.vue +4 -4
  60. package/packages/components/select/index.js +7 -7
  61. package/packages/components/select/src/arrow-down.vue +2 -2
  62. package/packages/components/select/src/clear-icon.vue +2 -2
  63. package/packages/components/select/src/empty.vue +13 -13
  64. package/packages/components/select/src/index.js +51 -51
  65. package/packages/components/select/src/select.vue +380 -380
  66. package/packages/components/table/index.js +7 -7
  67. package/packages/components/table/src/TableSort.vue +179 -179
  68. package/packages/components/table/src/index.js +70 -66
  69. package/packages/components/table/src/table.vue +287 -287
  70. package/packages/components/tabs/index.js +7 -7
  71. package/packages/components/tabs/src/tabs.vue +225 -225
  72. package/packages/components/year-select/index.js +7 -7
  73. package/packages/components/year-select/src/index.js +44 -44
  74. package/packages/components/year-select/src/year-select.vue +273 -273
  75. package/packages/echarts/bar/index.js +63 -63
  76. package/packages/echarts/base.js +99 -99
  77. package/packages/echarts/line/index.js +106 -106
  78. package/packages/hooks/index.js +5 -5
  79. package/packages/hooks/use-buried/index.js +46 -46
  80. package/packages/hooks/use-checked-all/index.js +37 -37
  81. package/packages/hooks/use-echarts/index.js +1 -1
  82. package/packages/hooks/use-echarts/use-bar/index.js +72 -72
  83. package/packages/hooks/use-echarts/use-line/index.js +88 -88
  84. package/packages/hooks/use-namespace/index.js +65 -65
  85. package/packages/hooks/use-search-component/index.js +28 -28
  86. package/packages/style/element.less +725 -725
  87. package/packages/style/index.js +2 -2
  88. package/packages/style/init.less +114 -114
  89. package/packages/utils/index.js +1 -1
  90. package/packages/utils/operate.js +77 -77
  91. package/packages/utils/types.js +35 -35
@@ -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
  }
@@ -1,88 +1,88 @@
1
- import { ref, watch, inject } from "vue";
2
- import {
3
- baseLineOption, seriesItem, areaSeriesItem
4
- } from "../../../echarts/line";
5
- import { copyObj, getOpacityColor, objectMerge } from "../../../utils";
6
- /**
7
- *
8
- * @param {string} type - 折线图的类型 basic-基础折线图 area-面积折线图
9
- * @param {Object} option -用户想要进行灵活配置所传入的参数
10
- * @param {Array} data - 图表数据
11
- */
12
- export const useLineEcharts = (type, option, data) => {
13
- const themeColor = inject('themeColor', null); //获取系统主题
14
- const lineOption = ref(copyObj(baseLineOption));
15
- const itemTemplate = ref({});
16
-
17
- //判断折线图图表类型,确定seriesItem格式
18
- if (type == 'basic') {
19
- itemTemplate.value = copyObj(seriesItem);
20
- } else if (type == 'area') {
21
- itemTemplate.value = copyObj(areaSeriesItem);
22
- }
23
- function initColor() {
24
- lineOption.value.color.splice(0, 1, themeColor);//调整调色板第一个主题色
25
- }
26
- if (themeColor) {
27
- initColor();
28
- }
29
-
30
- function update(data) {
31
- //数据更新方式
32
- if (data.length == 0) {
33
- console.warn('用户没有传入图表数据,请在hooks外处理');
34
- return;
35
- }
36
- if (data.length > 1) {
37
- lineOption.value.legend.data = data.map((item) => item.name);
38
- }
39
- lineOption.value.series.splice(0);
40
- data.forEach((item, index) => {
41
- let row = copyObj(itemTemplate.value);
42
- row.name = item.name;
43
- row.data = item.data;
44
- row.smooth = item.smooth ? true : false;
45
- row.label = {
46
- show: item.showLabel ? true : false
47
- }
48
- row.emphasis.label = {
49
- show: item.showLabel ? true : false,
50
- fontWeight: 600,
51
- color: 'inherit'
52
- }
53
- if (type == 'area') {
54
- //更新面积折线图面积颜色
55
- let colorBoard = lineOption.value.color;
56
- row.areaStyle.color.colorStops = [
57
- {
58
- offset: 0,
59
- color: getOpacityColor(colorBoard[index % colorBoard.length], '0.22')
60
- },
61
- {
62
- offset: 1,
63
- color: getOpacityColor(colorBoard[index % colorBoard.length], '0')
64
- }
65
- ]
66
- }
67
- lineOption.value.series.push(row);
68
- })
69
- }
70
- watch(() => data, (val) => {
71
- update(val);
72
- },
73
- { deep: true, immediate: true }
74
- );
75
- // 灵活配置并入option
76
- watch(() => option, (val) => {
77
- objectMerge(lineOption.value, option);
78
- }, {
79
- deep: true, immediate: true
80
- })
81
-
82
- return {
83
- lineOption,
84
- itemTemplate
85
- }
86
- }
87
-
88
-
1
+ import { ref, watch, inject } from "vue";
2
+ import {
3
+ baseLineOption, seriesItem, areaSeriesItem
4
+ } from "../../../echarts/line";
5
+ import { copyObj, getOpacityColor, objectMerge } from "../../../utils";
6
+ /**
7
+ *
8
+ * @param {string} type - 折线图的类型 basic-基础折线图 area-面积折线图
9
+ * @param {Object} option -用户想要进行灵活配置所传入的参数
10
+ * @param {Array} data - 图表数据
11
+ */
12
+ export const useLineEcharts = (type, option, data) => {
13
+ const themeColor = inject('themeColor', null); //获取系统主题
14
+ const lineOption = ref(copyObj(baseLineOption));
15
+ const itemTemplate = ref({});
16
+
17
+ //判断折线图图表类型,确定seriesItem格式
18
+ if (type == 'basic') {
19
+ itemTemplate.value = copyObj(seriesItem);
20
+ } else if (type == 'area') {
21
+ itemTemplate.value = copyObj(areaSeriesItem);
22
+ }
23
+ function initColor() {
24
+ lineOption.value.color.splice(0, 1, themeColor);//调整调色板第一个主题色
25
+ }
26
+ if (themeColor) {
27
+ initColor();
28
+ }
29
+
30
+ function update(data) {
31
+ //数据更新方式
32
+ if (data.length == 0) {
33
+ console.warn('用户没有传入图表数据,请在hooks外处理');
34
+ return;
35
+ }
36
+ if (data.length > 1) {
37
+ lineOption.value.legend.data = data.map((item) => item.name);
38
+ }
39
+ lineOption.value.series.splice(0);
40
+ data.forEach((item, index) => {
41
+ let row = copyObj(itemTemplate.value);
42
+ row.name = item.name;
43
+ row.data = item.data;
44
+ row.smooth = item.smooth ? true : false;
45
+ row.label = {
46
+ show: item.showLabel ? true : false
47
+ }
48
+ row.emphasis.label = {
49
+ show: item.showLabel ? true : false,
50
+ fontWeight: 600,
51
+ color: 'inherit'
52
+ }
53
+ if (type == 'area') {
54
+ //更新面积折线图面积颜色
55
+ let colorBoard = lineOption.value.color;
56
+ row.areaStyle.color.colorStops = [
57
+ {
58
+ offset: 0,
59
+ color: getOpacityColor(colorBoard[index % colorBoard.length], '0.22')
60
+ },
61
+ {
62
+ offset: 1,
63
+ color: getOpacityColor(colorBoard[index % colorBoard.length], '0')
64
+ }
65
+ ]
66
+ }
67
+ lineOption.value.series.push(row);
68
+ })
69
+ }
70
+ watch(() => data, (val) => {
71
+ update(val);
72
+ },
73
+ { deep: true, immediate: true }
74
+ );
75
+ // 灵活配置并入option
76
+ watch(() => option, (val) => {
77
+ objectMerge(lineOption.value, option);
78
+ }, {
79
+ deep: true, immediate: true
80
+ })
81
+
82
+ return {
83
+ lineOption,
84
+ itemTemplate
85
+ }
86
+ }
87
+
88
+
@@ -1,66 +1,66 @@
1
-
2
- export const defaultNamespace = 'ct'
3
- /**
4
- * 处理生成BEM命名规则的类名
5
- * @param options BEM字段配置项
6
- * @returns BEM命名规则的类名
7
- */
8
- const _bem = (options = {}) => {
9
- let cls = `${defaultNamespace}`;
10
- if (options.block) cls += `-${options.block}`;
11
- if (options.blockSuffix) cls += `-${options.blockSuffix}`;
12
- if (options.element) cls += `__${options.element}`;
13
- if (options.modifier) cls += `--${options.modifier}`;
14
- return cls
15
- }
16
- const statePrefix = 'is-'
17
-
18
- /**
19
- * 采用BEM命名的hooks
20
- * @param block BEM的B,模块名
21
- * @returns
22
- */
23
- export const useNamespace = (block) => {
24
- const options = { block }; //默认的BEM配置
25
-
26
- // 给BEM的B赋值,取使用hook时传入的block
27
- const b = () => _bem(options);
28
- // 给BEM的E赋值
29
- const e = (element) => element ? _bem({ ...options, element, }) : '';
30
- // 给BEM的M赋值
31
- const m = (modifier) => modifier ? _bem({ ...options, modifier, }) : '';
32
- // 给BEM的BE赋值
33
- const be = (blockSuffix, element) =>
34
- blockSuffix && element
35
- ? _bem({ ...options, blockSuffix, element })
36
- : '';
37
- // 给BEM的EM赋值
38
- const em = (element, modifier) =>
39
- element && modifier
40
- ? _bem({ ...options, element, modifier })
41
- : '';
42
- // 给BEM的BM赋值,这里的B是block的后缀名
43
- const bm = (blockSuffix, modifier) =>
44
- blockSuffix && modifier
45
- ? _bem({ ...options, blockSuffix, modifier })
46
- : '';
47
- // 给BEM的BM赋值,这里的B是block的后缀名
48
- const bem = (blockSuffix, element, modifier) =>
49
- blockSuffix && element && modifier
50
- ? _bem({ ...options, blockSuffix, element, modifier })
51
- : '';
52
- const is = (name, ...args) => {
53
- const state = args.length >= 1 ? !!args[0] : true
54
- return name && state ? `${statePrefix}${name}` : ''
55
- }
56
- return {
57
- b,
58
- e,
59
- m,
60
- be,
61
- em,
62
- bm,
63
- bem,
64
- is
65
- }
1
+
2
+ export const defaultNamespace = 'ct'
3
+ /**
4
+ * 处理生成BEM命名规则的类名
5
+ * @param options BEM字段配置项
6
+ * @returns BEM命名规则的类名
7
+ */
8
+ const _bem = (options = {}) => {
9
+ let cls = `${defaultNamespace}`;
10
+ if (options.block) cls += `-${options.block}`;
11
+ if (options.blockSuffix) cls += `-${options.blockSuffix}`;
12
+ if (options.element) cls += `__${options.element}`;
13
+ if (options.modifier) cls += `--${options.modifier}`;
14
+ return cls
15
+ }
16
+ const statePrefix = 'is-'
17
+
18
+ /**
19
+ * 采用BEM命名的hooks
20
+ * @param block BEM的B,模块名
21
+ * @returns
22
+ */
23
+ export const useNamespace = (block) => {
24
+ const options = { block }; //默认的BEM配置
25
+
26
+ // 给BEM的B赋值,取使用hook时传入的block
27
+ const b = () => _bem(options);
28
+ // 给BEM的E赋值
29
+ const e = (element) => element ? _bem({ ...options, element, }) : '';
30
+ // 给BEM的M赋值
31
+ const m = (modifier) => modifier ? _bem({ ...options, modifier, }) : '';
32
+ // 给BEM的BE赋值
33
+ const be = (blockSuffix, element) =>
34
+ blockSuffix && element
35
+ ? _bem({ ...options, blockSuffix, element })
36
+ : '';
37
+ // 给BEM的EM赋值
38
+ const em = (element, modifier) =>
39
+ element && modifier
40
+ ? _bem({ ...options, element, modifier })
41
+ : '';
42
+ // 给BEM的BM赋值,这里的B是block的后缀名
43
+ const bm = (blockSuffix, modifier) =>
44
+ blockSuffix && modifier
45
+ ? _bem({ ...options, blockSuffix, modifier })
46
+ : '';
47
+ // 给BEM的BM赋值,这里的B是block的后缀名
48
+ const bem = (blockSuffix, element, modifier) =>
49
+ blockSuffix && element && modifier
50
+ ? _bem({ ...options, blockSuffix, element, modifier })
51
+ : '';
52
+ const is = (name, ...args) => {
53
+ const state = args.length >= 1 ? !!args[0] : true
54
+ return name && state ? `${statePrefix}${name}` : ''
55
+ }
56
+ return {
57
+ b,
58
+ e,
59
+ m,
60
+ be,
61
+ em,
62
+ bm,
63
+ bem,
64
+ is
65
+ }
66
66
  }
@@ -1,29 +1,29 @@
1
-
2
-
3
- export const searchComponentProps = {
4
- param: String,
5
- label: String,
6
- rawAttr: {
7
- type: Object,
8
- default() {
9
- return {};
10
- },
11
- },
12
- cbs: {
13
- type: Object,
14
- default() {
15
- return {};
16
- },
17
- },
18
- buried: {
19
- type: Boolean,
20
- default: true,
21
- },
22
- }
23
-
24
- export const useSearchComponent = () => {
25
-
26
- return {
27
- props: searchComponentProps,
28
- }
1
+
2
+
3
+ export const searchComponentProps = {
4
+ param: String,
5
+ label: String,
6
+ rawAttr: {
7
+ type: Object,
8
+ default() {
9
+ return {};
10
+ },
11
+ },
12
+ cbs: {
13
+ type: Object,
14
+ default() {
15
+ return {};
16
+ },
17
+ },
18
+ buried: {
19
+ type: Boolean,
20
+ default: true,
21
+ },
22
+ }
23
+
24
+ export const useSearchComponent = () => {
25
+
26
+ return {
27
+ props: searchComponentProps,
28
+ }
29
29
  }