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,226 +1,226 @@
1
- <template>
2
- <div :class="[ns.b(), ns.m(type), ns.is('nav', nav)]" ref="_ref">
3
- <div
4
- v-for="(item, index) in list"
5
- :key="index"
6
- :class="[
7
- ns.e('item'),
8
- ns.is('disabled', item.disabled),
9
- ns.is('active', modelValue === item.value),
10
- ]"
11
- @click="handleClick(item, index)"
12
- >
13
- <slot :index="index" :item="item">
14
- <span :class="ns.e('item-text')">{{ item.label }}</span>
15
- </slot>
16
- </div>
17
- </div>
18
- </template>
19
-
20
- <script setup>
21
- import { onMounted, ref } from "vue";
22
- import { useNamespace } from "../../../hooks";
23
- const ns = useNamespace("tabs");
24
- const props = defineProps({
25
- nav: {
26
- type: Boolean,
27
- default: false,
28
- },
29
- type: {
30
- type: String,
31
- default: "default",
32
- },
33
- modelValue: {
34
- type: [String, Number],
35
- default: "",
36
- },
37
- list: {
38
- type: Array,
39
- default: () => [],
40
- },
41
- beforeLeave: Function,
42
- });
43
- const emit = defineEmits(["click", "change", "update:modelValue"]);
44
- const _ref = ref(null);
45
-
46
- const handleClick = async (item, index) => {
47
- if (item.disabled) return;
48
- try {
49
- emit("click", item.value, index, item);
50
- if (item.value === props.modelValue) return;
51
- // 可以继续的标志
52
- let canContinue = true;
53
- if (props.beforeLeave) {
54
- canContinue = await props.beforeLeave(item.value, index, item);
55
- }
56
- if (canContinue !== false) {
57
- emit("update:modelValue", item.value);
58
- emit("change", item.value, index, item);
59
- }
60
- } catch (error) {
61
- console.error(error);
62
- return;
63
- }
64
- };
65
- onMounted(() => {
66
- if (!props.modelValue && props.list.length) {
67
- handleClick(props.list[0], 0);
68
- }
69
- });
70
- defineExpose({
71
- ref: _ref,
72
- });
73
- </script>
74
- <style lang='less'>
75
- .ct-tabs {
76
- display: inline-flex;
77
- align-items: center;
78
- @R: .ct-tabs;
79
- --tabs-button-border-radius: var(--ct-border-radius);
80
- &__item {
81
- cursor: pointer;
82
- &.is-disabled {
83
- cursor: not-allowed;
84
- }
85
- }
86
- &--default {
87
- @{R}__item {
88
- position: relative;
89
- padding: 12px 0;
90
- margin-right: 32px;
91
- line-height: 20px;
92
- &:last-child {
93
- margin-right: 0;
94
- }
95
- &.is-active {
96
- font-weight: 600;
97
- color: var(--ct-color-primary);
98
- &::after {
99
- content: "";
100
- position: absolute;
101
- bottom: 0;
102
- left: 0;
103
- width: 100%;
104
- height: 2px;
105
- background-color: var(--ct-color-primary);
106
- }
107
- }
108
- &.is-disabled {
109
- color: var(--ct-color-disabled);
110
- }
111
- &:not(.is-disabled):hover {
112
- color: var(--ct-color-primary);
113
- }
114
- }
115
- }
116
- &--block {
117
- @{R}__item {
118
- padding: 5px 12px;
119
- margin-right: 8px;
120
- background-color: var(--ct-color-bg);
121
- border-radius: 3px;
122
- line-height: 18px;
123
- &:last-child {
124
- margin-right: 0;
125
- }
126
- &.is-active {
127
- font-weight: 600;
128
- background-color: var(--ct-color-primary-bg);
129
- color: var(--ct-color-primary);
130
- }
131
- &.is-disabled {
132
- color: var(--ct-color-disabled);
133
- }
134
- &:not(.is-disabled):hover {
135
- background-color: var(--ct-color-primary-bg);
136
- }
137
- }
138
- }
139
- &--button {
140
- box-sizing: border-box;
141
- border-radius: var(--tabs-button-border-radius);
142
- @{R}__item {
143
- padding: 5px 12px;
144
- border: 1px solid #a4afbb;
145
- border-right-width: 0;
146
- &:first-child {
147
- border-radius: var(--tabs-button-border-radius) 0 0
148
- var(--tabs-button-border-radius);
149
- }
150
- &:last-child {
151
- border-right-width: 1px;
152
- border-radius: 0 var(--tabs-button-border-radius)
153
- var(--tabs-button-border-radius) 0;
154
- }
155
- &.is-active {
156
- font-weight: 600;
157
- background-color: var(--ct-color-primary);
158
- color: #fff;
159
- border-color: var(--ct-color-primary);
160
- border-right-width: 0;
161
- & + div {
162
- border-left-color: transparent;
163
- }
164
- }
165
- &.is-disabled {
166
- color: var(--ct-color-disabled);
167
- }
168
- &:not(.is-disabled):not(.is-active):hover {
169
- color: var(--ct-color-primary);
170
- }
171
- }
172
- }
173
- &--button-bg {
174
- background-color: var(--ct-color-bg);
175
- border-radius: var(--tabs-button-border-radius);
176
- @{R}__item {
177
- position: relative;
178
- padding: 5px 12px;
179
- background-color: var(--ct-color-bg);
180
- border-radius: 3px;
181
- line-height: 18px;
182
- &::before {
183
- content: "";
184
- position: absolute;
185
- top: 50%;
186
- left: 0;
187
- transform: translateY(-50%);
188
- width: 1px;
189
- height: 16px;
190
- background-color: var(--ct-color-separator);
191
- }
192
- &:first-child {
193
- &::before {
194
- display: none;
195
- }
196
- }
197
- &.is-active {
198
- font-weight: 600;
199
- background-color: var(--ct-color-primary);
200
- color: #fff;
201
- &::before {
202
- display: none;
203
- }
204
- }
205
- &.is-disabled {
206
- color: var(--ct-color-disabled);
207
- }
208
- &:not(.is-disabled):not(.is-active):hover {
209
- color: var(--ct-color-primary);
210
- }
211
- }
212
- }
213
- &.is-nav {
214
- font-size: 18px;
215
- font-weight: 600;
216
- line-height: 22px;
217
- @{R}__item {
218
- padding: 23px 0;
219
- margin-right: 36px;
220
- &:last-child {
221
- margin-right: 0;
222
- }
223
- }
224
- }
225
- }
1
+ <template>
2
+ <div :class="[ns.b(), ns.m(type), ns.is('nav', nav)]" ref="_ref">
3
+ <div
4
+ v-for="(item, index) in list"
5
+ :key="index"
6
+ :class="[
7
+ ns.e('item'),
8
+ ns.is('disabled', item.disabled),
9
+ ns.is('active', modelValue === item.value),
10
+ ]"
11
+ @click="handleClick(item, index)"
12
+ >
13
+ <slot :index="index" :item="item">
14
+ <span :class="ns.e('item-text')">{{ item.label }}</span>
15
+ </slot>
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup>
21
+ import { onMounted, ref } from "vue";
22
+ import { useNamespace } from "../../../hooks";
23
+ const ns = useNamespace("tabs");
24
+ const props = defineProps({
25
+ nav: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ type: {
30
+ type: String,
31
+ default: "default",
32
+ },
33
+ modelValue: {
34
+ type: [String, Number],
35
+ default: "",
36
+ },
37
+ list: {
38
+ type: Array,
39
+ default: () => [],
40
+ },
41
+ beforeLeave: Function,
42
+ });
43
+ const emit = defineEmits(["click", "change", "update:modelValue"]);
44
+ const _ref = ref(null);
45
+
46
+ const handleClick = async (item, index) => {
47
+ if (item.disabled) return;
48
+ try {
49
+ emit("click", item.value, index, item);
50
+ if (item.value === props.modelValue) return;
51
+ // 可以继续的标志
52
+ let canContinue = true;
53
+ if (props.beforeLeave) {
54
+ canContinue = await props.beforeLeave(item.value, index, item);
55
+ }
56
+ if (canContinue !== false) {
57
+ emit("update:modelValue", item.value);
58
+ emit("change", item.value, index, item);
59
+ }
60
+ } catch (error) {
61
+ console.error(error);
62
+ return;
63
+ }
64
+ };
65
+ onMounted(() => {
66
+ if (!props.modelValue && props.list.length) {
67
+ handleClick(props.list[0], 0);
68
+ }
69
+ });
70
+ defineExpose({
71
+ ref: _ref,
72
+ });
73
+ </script>
74
+ <style lang='less'>
75
+ .ct-tabs {
76
+ display: inline-flex;
77
+ align-items: center;
78
+ @R: .ct-tabs;
79
+ --tabs-button-border-radius: var(--ct-border-radius);
80
+ &__item {
81
+ cursor: pointer;
82
+ &.is-disabled {
83
+ cursor: not-allowed;
84
+ }
85
+ }
86
+ &--default {
87
+ @{R}__item {
88
+ position: relative;
89
+ padding: 12px 0;
90
+ margin-right: 32px;
91
+ line-height: 20px;
92
+ &:last-child {
93
+ margin-right: 0;
94
+ }
95
+ &.is-active {
96
+ font-weight: 600;
97
+ color: var(--ct-color-primary);
98
+ &::after {
99
+ content: "";
100
+ position: absolute;
101
+ bottom: 0;
102
+ left: 0;
103
+ width: 100%;
104
+ height: 2px;
105
+ background-color: var(--ct-color-primary);
106
+ }
107
+ }
108
+ &.is-disabled {
109
+ color: var(--ct-color-disabled);
110
+ }
111
+ &:not(.is-disabled):hover {
112
+ color: var(--ct-color-primary);
113
+ }
114
+ }
115
+ }
116
+ &--block {
117
+ @{R}__item {
118
+ padding: 5px 12px;
119
+ margin-right: 8px;
120
+ background-color: var(--ct-color-bg);
121
+ border-radius: 3px;
122
+ line-height: 18px;
123
+ &:last-child {
124
+ margin-right: 0;
125
+ }
126
+ &.is-active {
127
+ font-weight: 600;
128
+ background-color: var(--ct-color-primary-bg);
129
+ color: var(--ct-color-primary);
130
+ }
131
+ &.is-disabled {
132
+ color: var(--ct-color-disabled);
133
+ }
134
+ &:not(.is-disabled):hover {
135
+ background-color: var(--ct-color-primary-bg);
136
+ }
137
+ }
138
+ }
139
+ &--button {
140
+ box-sizing: border-box;
141
+ border-radius: var(--tabs-button-border-radius);
142
+ @{R}__item {
143
+ padding: 5px 12px;
144
+ border: 1px solid #a4afbb;
145
+ border-right-width: 0;
146
+ &:first-child {
147
+ border-radius: var(--tabs-button-border-radius) 0 0
148
+ var(--tabs-button-border-radius);
149
+ }
150
+ &:last-child {
151
+ border-right-width: 1px;
152
+ border-radius: 0 var(--tabs-button-border-radius)
153
+ var(--tabs-button-border-radius) 0;
154
+ }
155
+ &.is-active {
156
+ font-weight: 600;
157
+ background-color: var(--ct-color-primary);
158
+ color: #fff;
159
+ border-color: var(--ct-color-primary);
160
+ border-right-width: 0;
161
+ & + div {
162
+ border-left-color: transparent;
163
+ }
164
+ }
165
+ &.is-disabled {
166
+ color: var(--ct-color-disabled);
167
+ }
168
+ &:not(.is-disabled):not(.is-active):hover {
169
+ color: var(--ct-color-primary);
170
+ }
171
+ }
172
+ }
173
+ &--button-bg {
174
+ background-color: var(--ct-color-bg);
175
+ border-radius: var(--tabs-button-border-radius);
176
+ @{R}__item {
177
+ position: relative;
178
+ padding: 5px 12px;
179
+ background-color: var(--ct-color-bg);
180
+ border-radius: 3px;
181
+ line-height: 18px;
182
+ &::before {
183
+ content: "";
184
+ position: absolute;
185
+ top: 50%;
186
+ left: 0;
187
+ transform: translateY(-50%);
188
+ width: 1px;
189
+ height: 16px;
190
+ background-color: var(--ct-color-separator);
191
+ }
192
+ &:first-child {
193
+ &::before {
194
+ display: none;
195
+ }
196
+ }
197
+ &.is-active {
198
+ font-weight: 600;
199
+ background-color: var(--ct-color-primary);
200
+ color: #fff;
201
+ &::before {
202
+ display: none;
203
+ }
204
+ }
205
+ &.is-disabled {
206
+ color: var(--ct-color-disabled);
207
+ }
208
+ &:not(.is-disabled):not(.is-active):hover {
209
+ color: var(--ct-color-primary);
210
+ }
211
+ }
212
+ }
213
+ &.is-nav {
214
+ font-size: 18px;
215
+ font-weight: 600;
216
+ line-height: 22px;
217
+ @{R}__item {
218
+ padding: 23px 0;
219
+ margin-right: 36px;
220
+ &:last-child {
221
+ margin-right: 0;
222
+ }
223
+ }
224
+ }
225
+ }
226
226
  </style>
@@ -1,8 +1,8 @@
1
- import CtYearSelect from './src/year-select.vue';
2
-
3
- /* istanbul ignore next */
4
- CtYearSelect.install = function (Vue) {
5
- Vue.component('CtYearSelect', CtYearSelect);
6
- };
7
-
1
+ import CtYearSelect from './src/year-select.vue';
2
+
3
+ /* istanbul ignore next */
4
+ CtYearSelect.install = function (Vue) {
5
+ Vue.component('CtYearSelect', CtYearSelect);
6
+ };
7
+
8
8
  export default CtYearSelect;
@@ -1,45 +1,45 @@
1
- import { buriedParamsKey, searchComponentProps } from '../../../hooks';
2
-
3
- export const yearSelectEmits = [
4
- "update:modelValue",
5
- buriedParamsKey,
6
- 'change',
7
- 'change-select',
8
- 'visible-change',
9
- 'blur',
10
- 'focus'
11
- ];
12
- export const yearSelectProps = {
13
- ...searchComponentProps,
14
- modelValue: [Number, String, Array],
15
- disabled: Boolean,
16
- multiple: {
17
- type: Boolean,
18
- default: true
19
- },
20
- startPlaceholder: String,
21
- endPlaceholder: String,
22
- range: {
23
- type: Array,
24
- default() {
25
- return [1950, new Date().getFullYear()];
26
- },
27
- validator(valueArr) {
28
- if (valueArr.length !== 2) {
29
- throw `请输入合理的年份取值范围:${valueArr}`;
30
- }
31
- let count = 0;
32
- valueArr.forEach((item) => {
33
- count += /\d{4}/.test(item) ? 1 : 0;
34
- });
35
- if (count !== 2) {
36
- throw `请确保传入的两个范围都是年份:${valueArr}`;
37
- }
38
- return true;
39
- },
40
- },
41
- separator: {
42
- type: [String, Object],
43
- default: "至",
44
- },
1
+ import { buriedParamsKey, searchComponentProps } from '../../../hooks';
2
+
3
+ export const yearSelectEmits = [
4
+ "update:modelValue",
5
+ buriedParamsKey,
6
+ 'change',
7
+ 'change-select',
8
+ 'visible-change',
9
+ 'blur',
10
+ 'focus'
11
+ ];
12
+ export const yearSelectProps = {
13
+ ...searchComponentProps,
14
+ modelValue: [Number, String, Array],
15
+ disabled: Boolean,
16
+ multiple: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ startPlaceholder: String,
21
+ endPlaceholder: String,
22
+ range: {
23
+ type: Array,
24
+ default() {
25
+ return [1950, new Date().getFullYear()];
26
+ },
27
+ validator(valueArr) {
28
+ if (valueArr.length !== 2) {
29
+ throw `请输入合理的年份取值范围:${valueArr}`;
30
+ }
31
+ let count = 0;
32
+ valueArr.forEach((item) => {
33
+ count += /\d{4}/.test(item) ? 1 : 0;
34
+ });
35
+ if (count !== 2) {
36
+ throw `请确保传入的两个范围都是年份:${valueArr}`;
37
+ }
38
+ return true;
39
+ },
40
+ },
41
+ separator: {
42
+ type: [String, Object],
43
+ default: "至",
44
+ },
45
45
  }