cy-element-ui 1.0.40 → 1.0.41

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 (106) hide show
  1. package/README.md +8 -8
  2. package/lib/alert.js +4 -4
  3. package/lib/aside.js +77 -77
  4. package/lib/autocomplete.js +3943 -160
  5. package/lib/avatar.js +108 -108
  6. package/lib/backtop.js +110 -110
  7. package/lib/badge.js +108 -108
  8. package/lib/breadcrumb-item.js +4 -4
  9. package/lib/breadcrumb.js +4 -4
  10. package/lib/button-group.js +4 -4
  11. package/lib/button.js +4 -4
  12. package/lib/calendar.js +1545 -46
  13. package/lib/card.js +96 -96
  14. package/lib/carousel-item.js +452 -108
  15. package/lib/carousel.js +185 -116
  16. package/lib/cascader-panel.js +2271 -187
  17. package/lib/cascader.js +6454 -275
  18. package/lib/checkbox-button.js +43 -11
  19. package/lib/checkbox-group.js +47 -15
  20. package/lib/checkbox.js +47 -15
  21. package/lib/col.js +2 -2
  22. package/lib/collapse-item.js +815 -110
  23. package/lib/collapse.js +108 -108
  24. package/lib/color-picker.js +3955 -153
  25. package/lib/container.js +88 -88
  26. package/lib/date-picker.js +5227 -414
  27. package/lib/descriptions-item.js +2 -2
  28. package/lib/descriptions.js +63 -8
  29. package/lib/dialog.js +1200 -22
  30. package/lib/divider.js +104 -104
  31. package/lib/drawer.js +875 -105
  32. package/lib/dropdown-item.js +43 -11
  33. package/lib/dropdown-menu.js +2274 -72
  34. package/lib/dropdown.js +1072 -136
  35. package/lib/empty.js +605 -9
  36. package/lib/fileUpload.js +3591 -448
  37. package/lib/footer.js +77 -77
  38. package/lib/form-item.js +420 -30
  39. package/lib/form.js +29 -15
  40. package/lib/header.js +77 -77
  41. package/lib/icon.js +67 -67
  42. package/lib/image.js +1378 -51
  43. package/lib/infinite-scroll.js +311 -21
  44. package/lib/input-number.js +1422 -33
  45. package/lib/input.js +507 -37
  46. package/lib/link.js +4 -4
  47. package/lib/loading.js +804 -67
  48. package/lib/main.js +64 -64
  49. package/lib/menu-item-group.js +4 -4
  50. package/lib/menu-item.js +2925 -41
  51. package/lib/menu.js +745 -54
  52. package/lib/message-box.js +2536 -79
  53. package/lib/message.js +1100 -22
  54. package/lib/notification.js +1100 -23
  55. package/lib/option-group.js +43 -11
  56. package/lib/option.js +394 -18
  57. package/lib/page-header.js +683 -87
  58. package/lib/pagination.js +6081 -140
  59. package/lib/popconfirm.js +3508 -219
  60. package/lib/popover.js +2604 -79
  61. package/lib/progress.js +4 -4
  62. package/lib/radio-button.js +43 -11
  63. package/lib/radio-group.js +43 -11
  64. package/lib/radio.js +47 -15
  65. package/lib/rate.js +756 -113
  66. package/lib/result.js +4 -4
  67. package/lib/row.js +2 -2
  68. package/lib/scrollbar.js +735 -50
  69. package/lib/select.js +4353 -209
  70. package/lib/skeleton-item.js +4 -4
  71. package/lib/skeleton.js +108 -108
  72. package/lib/slider.js +4266 -121
  73. package/lib/spinner.js +100 -100
  74. package/lib/statistic.js +9605 -117
  75. package/lib/step.js +108 -108
  76. package/lib/steps.js +514 -99
  77. package/lib/subTitle.js +91 -91
  78. package/lib/submenu.js +2444 -123
  79. package/lib/switch.js +476 -21
  80. package/lib/tab-pane.js +4 -4
  81. package/lib/tabDialog.js +1544 -18
  82. package/lib/table-column.js +880 -32
  83. package/lib/table.js +4469 -424
  84. package/lib/tabs.js +427 -14
  85. package/lib/tag.js +4 -4
  86. package/lib/time-picker.js +5016 -286
  87. package/lib/time-select.js +4948 -178
  88. package/lib/timeline-item.js +108 -108
  89. package/lib/timeline.js +82 -82
  90. package/lib/tooltip.js +2566 -41
  91. package/lib/transfer.js +2133 -139
  92. package/lib/tree.js +1372 -55
  93. package/lib/treeSelect.js +3420 -105
  94. package/lib/upload.js +1047 -28
  95. package/package.json +4 -5
  96. package/packages/input-number/src/input-number.vue +7 -4
  97. package/packages/selectDisplayInput/index.js +8 -0
  98. package/packages/selectDisplayInput/src/main.vue +75 -0
  99. package/packages/theme-cy/src/base.scss +3 -0
  100. package/packages/theme-cy/src/index.scss +1 -0
  101. package/packages/theme-cy/src/selectDisplayInput.scss +76 -0
  102. package/packages/theme-cy/src/treeSelect.scss +9 -4
  103. package/packages/treeSelect/src/main.vue +79 -0
  104. package/src/index.js +6 -3
  105. package/types/element-ui.d.ts +5 -1
  106. package/types/selectDisplayInput.d.ts +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cy-element-ui",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "基于ElementUI开发的组件",
5
5
  "main": "lib/element-ui.common.js",
6
6
  "files": [
@@ -22,11 +22,11 @@
22
22
  "build:utils": "cross-env BABEL_ENV=utils babel src --out-dir lib --ignore src/index.js",
23
23
  "build:umd": "node build/bin/build-locale.js",
24
24
  "clean": "rimraf lib && rimraf packages/*/lib && rimraf test/**/coverage",
25
- "deploy:build": "npm run build:file && cross-env NODE_ENV=production webpack --config build/webpack.demo.js && echo element.eleme.io>>examples/element-ui/CNAME",
25
+ "deploy:build": "npm run build:file && cross-env NODE_ENV=production NODE_OPTIONS=--openssl-legacy-provider webpack --config build/webpack.demo.js && echo element.eleme.io>>examples/element-ui/CNAME",
26
26
  "deploy:extension": "cross-env NODE_ENV=production webpack --config build/webpack.extension.js",
27
27
  "dev": "npm run bootstrap && npm run build:file && cross-env NODE_ENV=development webpack-dev-server --config build/webpack.demo.js",
28
28
  "dev:play": "npm run build:file && cross-env NODE_ENV=development PLAY_ENV=true webpack-dev-server --config build/webpack.demo.js",
29
- "dist": "npm run clean && npm run build:file && npm run lint && webpack --config build/webpack.conf.js && webpack --config build/webpack.common.js && webpack --config build/webpack.component.js && npm run build:utils && npm run build:umd && npm run build:theme",
29
+ "dist": "npm run clean && npm run build:file && npm run lint && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --config build/webpack.conf.js && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --config build/webpack.common.js && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --config build/webpack.component.js && npm run build:utils && npm run build:umd && npm run build:theme",
30
30
  "lint": "eslint src/**/* test/**/* packages/**/* build/**/* --quiet",
31
31
  "pub": "npm run bootstrap && sh build/git-release.sh && sh build/release.sh && node build/bin/gen-indices.js",
32
32
  "test": "npm run lint && npm run build:theme && cross-env CI_ENV=/dev/ BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
@@ -91,7 +91,6 @@
91
91
  "babel-plugin-transform-vue-jsx": "^3.7.0",
92
92
  "babel-preset-env": "^1.7.0",
93
93
  "babel-preset-stage-2": "^6.24.1",
94
- "babel-regenerator-runtime": "^6.5.0",
95
94
  "chai": "^4.2.0",
96
95
  "chokidar": "^1.7.0",
97
96
  "copy-webpack-plugin": "^5.0.0",
@@ -133,11 +132,11 @@
133
132
  "markdown-it-container": "^2.0.0",
134
133
  "mini-css-extract-plugin": "^0.4.1",
135
134
  "mocha": "^6.0.2",
136
- "sass": "^1.32.0",
137
135
  "optimize-css-assets-webpack-plugin": "^5.0.1",
138
136
  "postcss": "^7.0.14",
139
137
  "progress-bar-webpack-plugin": "^1.11.0",
140
138
  "rimraf": "^2.5.4",
139
+ "sass": "^1.32.0",
141
140
  "sass-loader": "^8.0.0",
142
141
  "select-version-cli": "^0.0.2",
143
142
  "shelljs": "^0.10.0",
@@ -5,13 +5,13 @@
5
5
  'el-input-number',
6
6
  inputNumberSize ? 'el-input-number--' + inputNumberSize : '',
7
7
  { 'is-disabled': inputNumberDisabled },
8
- { 'is-without-controls': !controls },
8
+ { 'is-without-controls': !showControls },
9
9
  { 'is-controls-right': controlsAtRight }
10
10
  ]">
11
11
  <span
12
12
  class="el-input-number__decrease"
13
13
  role="button"
14
- v-if="controls"
14
+ v-if="showControls"
15
15
  v-repeat-click="decrease"
16
16
  :class="{'is-disabled': minDisabled}"
17
17
  @keydown.enter="decrease">
@@ -20,7 +20,7 @@
20
20
  <span
21
21
  class="el-input-number__increase"
22
22
  role="button"
23
- v-if="controls"
23
+ v-if="showControls"
24
24
  v-repeat-click="increase"
25
25
  :class="{'is-disabled': maxDisabled}"
26
26
  @keydown.enter="increase">
@@ -159,7 +159,10 @@
159
159
  }
160
160
  },
161
161
  controlsAtRight() {
162
- return this.controls && this.controlsPosition === 'right';
162
+ return this.showControls && this.controlsPosition === 'right';
163
+ },
164
+ showControls() {
165
+ return this.controls && !this.$attrs['data-unit'];
163
166
  },
164
167
  _elFormItemSize() {
165
168
  return (this.elFormItem || {}).elFormItemSize;
@@ -0,0 +1,8 @@
1
+ import SelectDisplayInput from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ SelectDisplayInput.install = function(Vue) {
5
+ Vue.component(SelectDisplayInput.name, SelectDisplayInput);
6
+ };
7
+
8
+ export default SelectDisplayInput;
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div class="cy-select-display-input">
3
+ <div class="select_display_input_box" :class="{ text_active: cursor, cursor: cursor && value }" @click="handleInfo">
4
+ <div class="text"><span>{{ value }}</span></div>
5
+ <span v-if="!value" class="placeholder">{{ placeholder }}</span>
6
+ <i v-if="showDelete" class="el-icon-circle-close delete" @click.stop="handleDelete"></i>
7
+ </div>
8
+ <el-button v-if="showBtn" type="primary" @click="handleClick">{{ btnText }}</el-button>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: 'CySelectDisplayInput',
15
+ props: {
16
+ // 文本框 需要显示的内容
17
+ value: {
18
+ type: [Number, String],
19
+ default: ''
20
+ },
21
+
22
+ // 文本框 的提示文本
23
+ placeholder: {
24
+ type: String,
25
+ default: ''
26
+ },
27
+
28
+ // 选择按钮 的文字
29
+ btnText: {
30
+ type: String,
31
+ default: '选择'
32
+ },
33
+
34
+ // 选择按钮 的显示条件
35
+ showBtn: {
36
+ type: Boolean,
37
+ default: true
38
+ },
39
+
40
+ // 是否显示 删除按钮
41
+ showDelete: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ },
46
+ data() {
47
+ return {}
48
+ },
49
+ computed: {
50
+ // 文本框 是否需要点击,如果为true,输入框中的字体会变蓝并将鼠标变为小手
51
+ cursor() {
52
+ // 判断父组件是否坚挺了info事件
53
+ return this.$listeners.info;
54
+ }
55
+ },
56
+ created() {
57
+
58
+ },
59
+ methods: {
60
+ handleInfo() {
61
+ if (this.value) {
62
+ this.$emit('info');
63
+ }
64
+ },
65
+
66
+ handleClick() {
67
+ this.$emit('click');
68
+ },
69
+
70
+ handleDelete() {
71
+ this.$emit('delete');
72
+ }
73
+ }
74
+ }
75
+ </script>
@@ -0,0 +1,3 @@
1
+ *, *::before, *::after {
2
+ box-sizing: border-box;
3
+ }
@@ -4,3 +4,4 @@
4
4
  @import "./subTitle.scss";
5
5
  @import "./tabDialog.scss";
6
6
  @import "./treeSelect.scss";
7
+ @import "./selectDisplayInput.scss";
@@ -0,0 +1,76 @@
1
+ @import "./base.scss";
2
+
3
+ .cy-select-display-input {
4
+ display: flex;
5
+ position: relative;
6
+
7
+ & > .el-button {
8
+ flex-shrink: 0;
9
+ margin-left: 10px;
10
+ height: 36px;
11
+ padding: 9px 15px;
12
+ }
13
+ }
14
+
15
+ .select_display_input_box {
16
+ width: 100%;
17
+ height: 36px;
18
+ color: #888888;
19
+ background-color: #F5F7FA;
20
+ border: 1px solid #DCDFE6;
21
+ border-radius: 4px;
22
+ padding: 0 15px;
23
+ position: relative;
24
+ overflow: hidden;
25
+ display: flex;
26
+ align-items: center;
27
+
28
+ &.text_active {
29
+ color: #1890ff;
30
+ }
31
+
32
+ &.cursor {
33
+ cursor: pointer;
34
+ }
35
+
36
+ .text {
37
+ width: 100%;
38
+ line-height: 34px;
39
+ overflow: auto;
40
+
41
+ &::-webkit-scrollbar {
42
+ display: none;
43
+ }
44
+
45
+ span {
46
+ white-space: nowrap;
47
+ }
48
+ }
49
+
50
+ &.cursor .text:hover {
51
+ cursor: pointer;
52
+ }
53
+
54
+ .placeholder {
55
+ color: rgba(192, 196, 204, 0.5);
56
+ text-shadow: 0 0 1px #c0c4cc;
57
+ position: absolute;
58
+ top: 50%;
59
+ left: 15px;
60
+ transform: translateY(-50%);
61
+ }
62
+
63
+ .delete {
64
+ color: #ff4949;
65
+ position: absolute;
66
+ top: 50%;
67
+ right: 5px;
68
+ transform: translateY(-50%);
69
+ cursor: pointer;
70
+ z-index: 10;
71
+
72
+ &:hover {
73
+ color: rgba(255, 73, 73, 0.5);
74
+ }
75
+ }
76
+ }
@@ -9,7 +9,7 @@
9
9
  .cy-tree-select-select {
10
10
  width: 217px;
11
11
  height: 36px;
12
- line-height: 36px;
12
+ line-height: 34px;
13
13
  border: 1px solid #DCDFE6;
14
14
  border-radius: 4px;
15
15
  padding: 0 29px 0 15px;
@@ -33,7 +33,8 @@
33
33
  .cy-tree-select-select-v-icon {
34
34
  color: #C0C4CC;
35
35
  position: absolute;
36
- top: 0;
36
+ top: 50%;
37
+ transform: translateY(-50%);
37
38
  right: 9px;
38
39
 
39
40
  .cy-tree-select-select-v-arrow {
@@ -49,7 +50,7 @@
49
50
 
50
51
  .cy-tree-select-select.small {
51
52
  height: 32px;
52
- line-height: 32px;
53
+ line-height: 30px;
53
54
 
54
55
  .cy-tree-select-select-v {
55
56
  font-size: 13px;
@@ -58,7 +59,7 @@
58
59
 
59
60
  .cy-tree-select-select.mini {
60
61
  height: 28px;
61
- line-height: 28px;
62
+ line-height: 26px;
62
63
 
63
64
  .cy-tree-select-select-v {
64
65
  font-size: 12px;
@@ -69,6 +70,10 @@
69
70
  border-color: #C0C4CC;
70
71
  }
71
72
 
73
+ .cy-tree-select-select-con-s {
74
+ padding-bottom: 8px;
75
+ }
76
+
72
77
  .cy-tree-select-select-con-t {
73
78
  padding-bottom: 5px;
74
79
  margin-bottom: 5px;
@@ -2,6 +2,15 @@
2
2
  <div class="cy-tree-select">
3
3
  <el-popover v-model="popoverOpen" placement="bottom-start" width="300" trigger="click" :popper-class="popperClass" @show="popoverOpen = true" @hide="popoverOpen = false">
4
4
  <div class="cy-tree-select-select-con">
5
+ <div v-if="filterable" class="cy-tree-select-select-con-s">
6
+ <el-input
7
+ v-model="filterText"
8
+ placeholder="搜索"
9
+ prefix-icon="el-icon-search"
10
+ clearable
11
+ size="small"
12
+ ></el-input>
13
+ </div>
5
14
  <div v-if="showCheckStrictly" class="cy-tree-select-select-con-t">
6
15
  <el-checkbox v-model="isCheckStrictly">父子节点联动</el-checkbox>
7
16
  </div>
@@ -16,6 +25,7 @@
16
25
  :props="defaultOptions"
17
26
  :expand-on-click-node="false"
18
27
  :default-expand-all="defaultExpandAll"
28
+ :filter-node-method="filterNode"
19
29
  @check="treeCheck"
20
30
  @node-click="treeClick"
21
31
  ></el-tree>
@@ -72,6 +82,12 @@ export default {
72
82
  type: String,
73
83
  },
74
84
 
85
+ // 是否显示搜索框
86
+ filterable: {
87
+ type: Boolean,
88
+ default: false
89
+ },
90
+
75
91
  // 是否显示 父子节点是否联动 多选框
76
92
  showCheckStrictly: {
77
93
  type: Boolean,
@@ -134,6 +150,8 @@ export default {
134
150
 
135
151
  treeOptions: [], // 部门树列表
136
152
  treeArr: [], // 部门列表
153
+ filterText: '', // 搜索关键词
154
+ matchedNodeIds: [], // 匹配的节点ID集合
137
155
  }
138
156
  },
139
157
  computed: {
@@ -177,12 +195,73 @@ export default {
177
195
  this.treeOptions = this.options;
178
196
  this.treeArr = this.turnFormatTreeData([], this.treeOptions, 0);
179
197
  }
198
+ },
199
+
200
+ filterText(val) {
201
+ if (val) {
202
+ // 先找出所有匹配的节点及其子节点
203
+ this.matchedNodeIds = this.findMatchedNodes(val, this.treeOptions);
204
+ // 执行过滤
205
+ this.$refs.tree.filter(val);
206
+ // 展开所有匹配的节点
207
+ this.$nextTick(() => {
208
+ this.expandMatchedNodes();
209
+ });
210
+ } else {
211
+ this.matchedNodeIds = [];
212
+ this.$refs.tree.filter(val);
213
+ }
180
214
  }
181
215
  },
182
216
  created() {
183
217
 
184
218
  },
185
219
  methods: {
220
+ /**
221
+ * 树节点过滤
222
+ */
223
+ filterNode(value, data) {
224
+ if (!value) return true;
225
+ // 如果当前节点或其祖先节点匹配了,就显示
226
+ return this.matchedNodeIds.includes(data[this.defaultOptions.id]);
227
+ },
228
+
229
+ /**
230
+ * 查找所有匹配的节点及其子节点ID
231
+ */
232
+ findMatchedNodes(value, nodes, parentMatched = false) {
233
+ let matchedIds = [];
234
+
235
+ nodes.forEach(node => {
236
+ const currentNodeMatched = node[this.defaultOptions.label].indexOf(value) !== -1;
237
+ const shouldShow = currentNodeMatched || parentMatched;
238
+
239
+ if (shouldShow) {
240
+ matchedIds.push(node[this.defaultOptions.id]);
241
+ }
242
+
243
+ // 递归处理子节点,如果当前节点或其祖先匹配了,子节点也应该匹配
244
+ if (node[this.defaultOptions.children] && node[this.defaultOptions.children].length > 0) {
245
+ const childIds = this.findMatchedNodes(value, node[this.defaultOptions.children], shouldShow);
246
+ matchedIds = matchedIds.concat(childIds);
247
+ }
248
+ });
249
+
250
+ return matchedIds;
251
+ },
252
+
253
+ /**
254
+ * 展开所有匹配的节点
255
+ */
256
+ expandMatchedNodes() {
257
+ this.matchedNodeIds.forEach(nodeId => {
258
+ const treeNode = this.$refs.tree.store.nodesMap[nodeId];
259
+ if (treeNode) {
260
+ treeNode.expand();
261
+ }
262
+ });
263
+ },
264
+
186
265
  init() {
187
266
  // 初始化是根据value,设置已选中项
188
267
  let arr = [];
package/src/index.js CHANGED
@@ -92,7 +92,8 @@ import Result from '../packages/result/index.js';
92
92
  import TreeSelect from '../packages/treeSelect/index.js';
93
93
  import SubTitle from '../packages/subTitle/index.js';
94
94
  import TabDialog from '../packages/tabDialog/index.js';
95
- import FileUpload from '../packages/fileUpload/index.js';
95
+ import FileUpload from '../packages/fileUpload/index.js';
96
+ import SelectDisplayInput from '../packages/selectDisplayInput/index.js';
96
97
  import locale from 'element-ui/src/locale';
97
98
  import CollapseTransition from 'element-ui/src/transitions/collapse-transition';
98
99
 
@@ -182,7 +183,8 @@ const components = [
182
183
  DescriptionsItem,
183
184
  Result,
184
185
  SubTitle,
185
- FileUpload,
186
+ FileUpload,
187
+ SelectDisplayInput,
186
188
  CollapseTransition
187
189
  ];
188
190
 
@@ -316,5 +318,6 @@ export default {
316
318
  TreeSelect,
317
319
  SubTitle,
318
320
  TabDialog,
319
- FileUpload
321
+ FileUpload,
322
+ SelectDisplayInput
320
323
  };
@@ -94,7 +94,8 @@ import { CyTreeSelect } from './treeSelect'
94
94
  import { CySubTitle } from './subTitle'
95
95
  import { CyTabDialog } from './tabDialog'
96
96
  import { CyFileUpload } from './fileUpload'
97
-
97
+
98
+
98
99
  export interface InstallationOptions {
99
100
  locale: any,
100
101
  i18n: any,
@@ -397,3 +398,6 @@ export class TabDialog extends CyTabDialog {}
397
398
 
398
399
  /** FileUpload Component */
399
400
  export class FileUpload extends CyFileUpload {}
401
+
402
+ /** SelectDisplayInput Component */
403
+ export class SelectDisplayInput extends CySelectDisplayInput {}
@@ -0,0 +1,5 @@
1
+ import { CyUIComponent } from './component'
2
+
3
+ /** SelectDisplayInput Component */
4
+ export declare class CySelectDisplayInput extends CyUIComponent {
5
+ }