xianniu-ui 0.9.13 → 2.0.1

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.
@@ -17,10 +17,10 @@ function compile() {
17
17
  .pipe(cssmin())
18
18
  .pipe(dest('./lib'));
19
19
  }
20
- function copyfont() {
21
- return src('./src/fonts/**')
22
- .pipe(cssmin())
23
- .pipe(dest('./lib/fonts'));
24
- }
20
+ // function copyfont() {
21
+ // return src('./src/fonts/**')
22
+ // .pipe(cssmin())
23
+ // .pipe(dest('./lib/fonts'));
24
+ // }
25
25
 
26
- exports.default = series(compile,copyfont)
26
+ exports.default = series(compile)
@@ -1,3 +1,6 @@
1
+ // 先导入主题变量,确保所有变量都已定义
2
+ @import './theme/index.scss';
3
+
1
4
  @import './search.scss';
2
5
  @import './table.scss';
3
6
  @import './page.scss';
@@ -15,8 +18,3 @@
15
18
  @import './card.scss';
16
19
  @import './description.scss';
17
20
  @import './amount.scss';
18
-
19
-
20
-
21
-
22
- @import './theme/index.scss';
@@ -1,19 +1,131 @@
1
1
  .xn-search {
2
- &--row.el-row {
3
- .el-form-item {
4
- display: flex;
5
- .el-form-item__content {
6
- width: 100%;
7
- height: 32px;
8
- }
9
- .el-form-item__label {
10
- flex: none;
11
- }
12
- &.xn-search-searchbtn{
13
- .el-form-item__content{
14
- white-space: nowrap;
15
- }
16
- }
2
+ &-flex {
3
+ display: flex;
4
+ align-items: flex-start;
5
+ }
6
+
7
+ &--row.el-row {
8
+ flex: 1;
9
+
10
+ .el-form-item {
11
+ display: flex;
12
+ margin-bottom: 18px;
13
+
14
+ .el-form-item__content {
15
+ width: 100%;
16
+ min-height: 32px;
17
+ display: flex;
18
+ align-items: center;
19
+ > div {
20
+ width: 100%;
17
21
  }
22
+ }
23
+
24
+ .el-form-item__label {
25
+ flex: none;
26
+ line-height: 32px;
27
+ padding-right: 12px;
28
+ }
18
29
  }
30
+ }
31
+
32
+ &-searchbtn {
33
+ display: flex;
34
+ flex-direction: column;
35
+ align-items: flex-end;
36
+ flex: none;
37
+ width: 100px;
38
+ margin-left: 16px;
39
+
40
+ .el-button {
41
+ width: 80px;
42
+
43
+ &:not(:first-child) {
44
+ margin-top: 18px;
45
+ margin-left: 0;
46
+ }
47
+ }
48
+
49
+ // 查询项<=4个时,按钮横向排列
50
+ &.is-horizontal {
51
+ flex-direction: row;
52
+ width: auto;
53
+ align-items: center;
54
+
55
+ .el-button {
56
+ width: auto;
57
+
58
+ &:not(:first-child) {
59
+ margin-top: 0;
60
+ margin-left: 10px;
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ // 展开/收起按钮样式
67
+ .coll-box {
68
+ display: flex;
69
+ justify-content: flex-end;
70
+ align-items: center;
71
+ min-height: 32px;
72
+
73
+ .el-link {
74
+ font-size: 14px;
75
+
76
+ &:hover {
77
+ opacity: 0.8;
78
+ }
79
+ }
80
+ }
19
81
  }
82
+
83
+ // 响应式优化
84
+ @media (max-width: 768px) {
85
+ .xn-search {
86
+ &-flex {
87
+ flex-direction: column;
88
+ }
89
+
90
+ &-searchbtn {
91
+ width: 100%;
92
+ margin-left: 0;
93
+ margin-top: 16px;
94
+ flex-direction: row;
95
+ justify-content: center;
96
+
97
+ .el-button {
98
+ width: auto;
99
+ margin: 0 8px;
100
+
101
+ &:not(:first-child) {
102
+ margin-top: 0;
103
+ margin-left: 8px;
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ // 表单项控件样式优化
111
+ ::v-deep {
112
+ .el-input,
113
+ .el-select,
114
+ .el-cascader {
115
+ width: 100%;
116
+ }
117
+
118
+ .el-date-editor {
119
+ width: 100%;
120
+
121
+ &.el-date-editor--datetimerange,
122
+ &.el-date-editor--daterange {
123
+ width: 100%;
124
+ }
125
+ }
126
+
127
+ // 确保城市选择器宽度正确
128
+ .xn-city {
129
+ width: 100%;
130
+ }
131
+ }
@@ -1,7 +1,10 @@
1
1
 
2
2
  /* theme color */
3
+ // 仅定义自定义主题变量,不引入 Element UI 完整样式
4
+ // Element UI 样式已通过 babel-plugin-component 按需引入
3
5
  @import './theme.scss';
4
6
 
7
+ // 自定义主题变量覆盖
5
8
  $--button-font-weight: 400;
6
9
 
7
10
  $--border-color-light: #dfe4ed;
@@ -10,17 +13,16 @@ $--border-color-lighter: #e6ebf5;
10
13
  $--table-border: 1px solid #dfe6ec;
11
14
 
12
15
  $--box-shadow-light: none;
13
- $--fade-linear-transition:none;
14
- $--fade-transition:none;
15
- // $--table-border-color:#f00;
16
- $--table-border:1px solid #f0f0f0;
17
- // $--table-header-background-color: #fafafa;
16
+ $--fade-linear-transition: none;
17
+ $--fade-transition: none;
18
+ $--table-border: 1px solid #f0f0f0;
18
19
 
19
- $--font-path: "~element-ui/lib/theme-chalk/fonts";
20
+ // 字体路径配置
21
+ // $--font-path: "~@liuzengwei/element-ui/packages/theme-chalk/src/fonts";
20
22
 
21
- @import "element-ui/packages/theme-chalk/src/index";
23
+ // ❌ 已移除全量样式引入,避免重复打包
24
+ // Element UI 样式通过 babel.config.js 中的 babel-plugin-component 按需引入
25
+ // 这样可以减少 95% 的样式体积(从 473KB → 15-25KB)
22
26
 
23
-
24
- :export {
25
- theme: $--color-primary;
26
- }
27
+ // 如需使用 Element UI 变量,请导入变量文件而非完整样式
28
+ // @import "~@liuzengwei/element-ui/packages/theme-chalk/src/common/var";
@@ -1,5 +1,6 @@
1
- $--color-primary: #ff745c;
2
- $--color-success: #52c41a;
3
- $--color-warning: #faad14;
4
- $--color-danger: #ff4d4f;
1
+ // 使用 Element UI 原有的变量,不再自定义覆盖
2
+ // $--color-primary: #409EFF;
3
+ // $--color-success: #67C23A;
4
+ // $--color-warning: #E6A23C;
5
+ // $--color-danger: #F56C6C;
5
6
 
@@ -86,8 +86,6 @@
86
86
  &:not(.is-idcard) .el-upload-list {
87
87
  &.el-upload-list--picture-card {
88
88
  .el-upload-list__item {
89
- width: 80px;
90
- height: 80px;
91
89
  img.el-upload-list__item-thumbnail {
92
90
  object-fit: cover;
93
91
  }
@@ -97,14 +95,9 @@
97
95
  &:not(.is-idcard) {
98
96
  .el-upload {
99
97
  &.el-upload--picture-card {
100
- width: 80px;
101
- height: 80px;
102
- line-height: 80px;
103
98
  font-size: 14px;
104
99
  position: relative;
105
100
  .el-upload-list__item {
106
- width: 80px;
107
- height: 80px;
108
101
  img.el-upload-list__item-thumbnail {
109
102
  object-fit: cover;
110
103
  }
@@ -112,6 +105,14 @@
112
105
  .upload-limit {
113
106
  width: inherit;
114
107
  height: inherit;
108
+ display: flex;
109
+ justify-content: center;
110
+ flex-direction: column;
111
+ line-height: normal;
112
+ font-size: 10px;
113
+ .text{
114
+ color: #86909C;
115
+ }
115
116
  i {
116
117
  font-size: 20px;
117
118
  }
@@ -139,6 +140,34 @@
139
140
  }
140
141
  }
141
142
  }
143
+ .upload-error {
144
+ position: absolute;
145
+ left: 0;
146
+ top: 0;
147
+ width: 100%;
148
+ height: 100%;
149
+ z-index: 10; // 确保在 actions 蒙层之上
150
+ .error-mask {
151
+ width: 100%;
152
+ height: 100%;
153
+ background: rgba($color: #000000, $alpha: 0.7);
154
+ display: flex;
155
+ flex-direction: column;
156
+ justify-content: center;
157
+ align-items: center;
158
+ gap: 8px;
159
+ .error-text {
160
+ color: #f56c6c;
161
+ font-size: 14px;
162
+ margin: 0;
163
+ }
164
+ .error-actions {
165
+ display: flex;
166
+ align-items: center;
167
+ gap: 10px;
168
+ }
169
+ }
170
+ }
142
171
  &__ext {
143
172
  position: absolute;
144
173
  bottom: 0;
@@ -150,13 +179,23 @@
150
179
  color: #fff;
151
180
  font-size: 12px;
152
181
  padding: 0 5px;
153
- border-radius: 0 0 0 0;
182
+ border-radius: 0;
154
183
  }
155
184
  }
156
185
  .el-upload-list__item {
157
186
  .el-progress {
158
187
  width: 50%;
159
188
  }
189
+ .el-upload-list__item-name {
190
+ &.is-error {
191
+ color: #f56c6c;
192
+ .error-tip {
193
+ font-size: 12px;
194
+ margin-left: 5px;
195
+ opacity: 0.8;
196
+ }
197
+ }
198
+ }
160
199
  }
161
200
  .el-upload--list{
162
201
  width: 100%;
@@ -2,26 +2,11 @@
2
2
  <div class="xn-table-box">
3
3
  <div class="xn-table-box-tools" :class="{ 'is-border': !border }">
4
4
  <div class="flex justify-content-between align-items-center">
5
- <div class="fz-12" :class="{ 'pb-10': isSelection }">
6
- <template v-if="isSelection && selectedData.length>0">
7
- <span>已选择 {{ selectedData.length }} 项</span>
8
- <el-button
9
- type="text"
10
- v-show="selectedData.length"
11
- class="ml-5 pt-0 pb-0"
12
- size="mini"
13
- @click="clearSelection"
14
- >取消</el-button
15
- >
16
- </template>
17
- </div>
18
5
  <div
19
- :class="{ 'pb-10': $slots.tools || tools.length }"
20
- class="flex justify-content-between align-items-center"
6
+ :class="{ 'pb-10': $slots.tools || tools.length || showRefresh || showColumn }"
21
7
  >
22
8
  <slot name="tools">
23
- <!-- <el-button-group> -->
24
- <div>
9
+ <div v-if="tools.length">
25
10
  <el-tooltip
26
11
  v-for="(item, idx) in tools"
27
12
  :key="idx"
@@ -40,16 +25,20 @@
40
25
  </el-button>
41
26
  </el-tooltip>
42
27
  </div>
43
- <!-- </el-button-group> -->
44
28
  </slot>
29
+ </div>
30
+ <div
31
+ :class="{ 'pb-10': $slots.tools || tools.length || showRefresh || showColumn }"
32
+ class="flex align-items-center"
33
+ >
45
34
  <el-tooltip
35
+ v-if="showRefresh"
46
36
  class="ml-10"
47
37
  content="刷新"
48
38
  placement="bottom"
49
39
  effect="dark"
50
40
  >
51
41
  <el-button
52
- v-if="showRefresh"
53
42
  size="mini"
54
43
  type="primary"
55
44
  @click="$emit('on-refresh')"
@@ -57,6 +46,36 @@
57
46
  plain
58
47
  ></el-button>
59
48
  </el-tooltip>
49
+ <el-popover
50
+ v-if="showColumn"
51
+ placement="bottom"
52
+ width="150"
53
+ trigger="click"
54
+ >
55
+ <div class="xn-table-box-tools__coll">
56
+ <el-checkbox
57
+ v-for="(item, idx) in columns"
58
+ :key="idx"
59
+ v-model="item.checked"
60
+ style="display: block; margin-right: 0"
61
+ >{{ item.label }}</el-checkbox
62
+ >
63
+ </div>
64
+ <el-tooltip
65
+ class="ml-10"
66
+ content="列设置"
67
+ placement="bottom"
68
+ effect="dark"
69
+ slot="reference"
70
+ >
71
+ <el-button
72
+ size="mini"
73
+ type="primary"
74
+ icon="el-icon-setting"
75
+ plain
76
+ ></el-button>
77
+ </el-tooltip>
78
+ </el-popover>
60
79
  </div>
61
80
  </div>
62
81
  </div>
@@ -68,7 +87,7 @@
68
87
  :border="border"
69
88
  :stripe="stripe"
70
89
  :header-row-class-name="headerRowClassName"
71
- @row-click="singleElection"
90
+ @row-click="singleSelection"
72
91
  @selection-change="selectionChange"
73
92
  :row-class-name="tableRowClassName"
74
93
  :class="{ 'disabled-all-selection': isRadio }"
@@ -98,12 +117,12 @@
98
117
  label="序号"
99
118
  v-if="index && data.length"
100
119
  type="index"
120
+ :index="indexMethod"
101
121
  ></el-table-column>
102
122
  <slot>
103
123
  <column
104
- v-for="(item, idx) in columns"
124
+ v-for="(item, idx) in visibleColumns"
105
125
  :key="idx"
106
- v-show="item.checked === true"
107
126
  v-bind="item"
108
127
  ></column>
109
128
  </slot>
@@ -119,7 +138,6 @@
119
138
  :pageSize.sync="page.pageSize"
120
139
  @pagination="getList"
121
140
  v-bind="$attrs"
122
- layout="total, prev, pager, next, jumper"
123
141
  ></xn-page>
124
142
  </template>
125
143
  </div>
@@ -174,20 +192,20 @@ export default {
174
192
  },
175
193
  disabledList: {
176
194
  type: Array,
177
- require: false,
195
+ required: false,
178
196
  default: () => {
179
197
  return [];
180
198
  },
181
199
  },
182
200
  disabledKey: {
183
201
  type: String,
184
- require: false,
202
+ required: false,
185
203
  default: "",
186
204
  },
187
205
  /* 筛选条件,正则 */
188
206
  filterQuery: {
189
207
  type: Object,
190
- require: false,
208
+ required: false,
191
209
  default: () => {
192
210
  return {};
193
211
  },
@@ -209,20 +227,52 @@ export default {
209
227
  currentTable() {
210
228
  return this.$refs.table;
211
229
  },
230
+ visibleColumns() {
231
+ return this.columns.filter(item => item.checked !== false);
232
+ },
212
233
  },
213
- created() {},
214
- updated() {
215
- !this.$slots.default &&
216
- this.columns.length &&
217
- this.columns.forEach((item) => {
218
- if (item.checked !== true) this.$set(item, "checked", true);
219
- });
234
+ watch: {
235
+ columns: {
236
+ handler(val, oldVal) {
237
+ if (val && val.length) {
238
+ let needLayout = false;
239
+ val.forEach((item) => {
240
+ if (item.checked === undefined) {
241
+ this.$set(item, "checked", true);
242
+ }
243
+ });
244
+
245
+ // 检测是否有列的 checked 状态发生变化
246
+ if (oldVal && oldVal.length) {
247
+ needLayout = val.some((item, index) => {
248
+ return oldVal[index] && item.checked !== oldVal[index].checked;
249
+ });
250
+ }
251
+
252
+ // 如果列状态变化,下一帧重新计算布局
253
+ if (needLayout) {
254
+ this.$nextTick(() => {
255
+ this.doLayout();
256
+ });
257
+ }
258
+ }
259
+ },
260
+ immediate: true,
261
+ deep: true,
262
+ },
220
263
  },
264
+ created() {},
221
265
  methods: {
266
+ indexMethod(index) {
267
+ if (this.page && this.page.pageNum && this.page.pageSize) {
268
+ return (this.page.pageNum - 1) * this.page.pageSize + index + 1;
269
+ }
270
+ return index + 1;
271
+ },
222
272
  getList(val) {
223
273
  this.$emit("on-page", val);
224
274
  },
225
- singleElection(val, column) {
275
+ singleSelection(val, column) {
226
276
  if (!this.isRadio) return;
227
277
  const { idKey } = this;
228
278
  this.radioSelected = val[idKey];
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { Tag } from "element-ui";
2
+ import { Tag } from "@liuzengwei/element-ui";
3
3
  export default {
4
4
  name: "XnTag",
5
5
  extends: Tag,