umy-ui-table 1.2.0

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 (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/lib/button.js +1 -0
  4. package/lib/icon.js +1 -0
  5. package/lib/index.js +1 -0
  6. package/lib/locale/format.js +56 -0
  7. package/lib/locale/index.js +72 -0
  8. package/lib/locale/lang/en.js +123 -0
  9. package/lib/locale/lang/zh-CN.js +119 -0
  10. package/lib/mixins/locale.js +17 -0
  11. package/lib/theme-chalk/base.css +0 -0
  12. package/lib/theme-chalk/button.css +1 -0
  13. package/lib/theme-chalk/fonts/element-icons.ttf +0 -0
  14. package/lib/theme-chalk/fonts/element-icons.woff +0 -0
  15. package/lib/theme-chalk/fonts/iconfont.1785562768224.ttf +0 -0
  16. package/lib/theme-chalk/fonts/iconfont.1785562768224.woff +0 -0
  17. package/lib/theme-chalk/fonts/iconfont.1785562768224.woff2 +0 -0
  18. package/lib/theme-chalk/icon.css +1 -0
  19. package/lib/theme-chalk/index.css +1 -0
  20. package/lib/theme-chalk/u-table-column.css +0 -0
  21. package/lib/theme-chalk/u-table.css +1 -0
  22. package/lib/theme-chalk/ux-grid.css +1 -0
  23. package/lib/theme-chalk/ux-table-column.css +0 -0
  24. package/lib/u-table-column.js +1 -0
  25. package/lib/u-table.js +1 -0
  26. package/lib/umd/locale/en.js +139 -0
  27. package/lib/umd/locale/zh-CN.js +135 -0
  28. package/lib/umy-ui.common.js +1 -0
  29. package/lib/utils/svg.js +33 -0
  30. package/lib/utils/types.js +35 -0
  31. package/lib/utils/util.js +268 -0
  32. package/lib/ux-grid.js +1 -0
  33. package/lib/ux-table-column.js +1 -0
  34. package/package.json +117 -0
  35. package/packages/button/index.js +7 -0
  36. package/packages/button/src/button-group.vue +10 -0
  37. package/packages/button/src/button.vue +166 -0
  38. package/packages/checkbox/index.js +8 -0
  39. package/packages/checkbox/src/checkbox-button.vue +199 -0
  40. package/packages/checkbox/src/checkbox-group.vue +48 -0
  41. package/packages/checkbox/src/checkbox.vue +222 -0
  42. package/packages/checkbox-button/index.js +8 -0
  43. package/packages/checkbox-group/index.js +8 -0
  44. package/packages/icon/index.js +7 -0
  45. package/packages/icon/src/icon.vue +40 -0
  46. package/packages/input/index.js +2 -0
  47. package/packages/input/src/calcTextareaHeight.js +104 -0
  48. package/packages/input/src/input.vue +424 -0
  49. package/packages/option/index.js +2 -0
  50. package/packages/pagination/index.js +2 -0
  51. package/packages/pagination/src/pager.vue +163 -0
  52. package/packages/pagination/src/pagination.js +386 -0
  53. package/packages/scrollbar/index.js +8 -0
  54. package/packages/scrollbar/src/bar.js +92 -0
  55. package/packages/scrollbar/src/main.js +130 -0
  56. package/packages/scrollbar/src/util.js +34 -0
  57. package/packages/select/index.js +2 -0
  58. package/packages/select/src/navigation-mixin.js +54 -0
  59. package/packages/select/src/option-group.vue +60 -0
  60. package/packages/select/src/option.vue +163 -0
  61. package/packages/select/src/select-dropdown.vue +74 -0
  62. package/packages/select/src/select.vue +889 -0
  63. package/packages/table/index.js +8 -0
  64. package/packages/table/src/config.js +123 -0
  65. package/packages/table/src/dropdown.js +28 -0
  66. package/packages/table/src/filter-panel.vue +194 -0
  67. package/packages/table/src/layout-observer.js +68 -0
  68. package/packages/table/src/store/current.js +71 -0
  69. package/packages/table/src/store/expand.js +65 -0
  70. package/packages/table/src/store/helper.js +37 -0
  71. package/packages/table/src/store/index.js +145 -0
  72. package/packages/table/src/store/tree.js +208 -0
  73. package/packages/table/src/store/watcher.js +448 -0
  74. package/packages/table/src/table-body.js +493 -0
  75. package/packages/table/src/table-column.js +381 -0
  76. package/packages/table/src/table-footer.js +174 -0
  77. package/packages/table/src/table-header.js +537 -0
  78. package/packages/table/src/table-layout.js +231 -0
  79. package/packages/table/src/table.vue +741 -0
  80. package/packages/table/src/util.js +256 -0
  81. package/packages/tag/index.js +8 -0
  82. package/packages/tag/src/tag.vue +58 -0
  83. package/packages/tools/directives/mousewheel.js +18 -0
  84. package/packages/tools/directives/repeat-click.js +24 -0
  85. package/packages/tools/locale/format.js +46 -0
  86. package/packages/tools/locale/index.js +48 -0
  87. package/packages/tools/locale/lang/en.js +120 -0
  88. package/packages/tools/locale/lang/zh-CN.js +116 -0
  89. package/packages/tools/mixins/emitter.js +33 -0
  90. package/packages/tools/mixins/focus.js +9 -0
  91. package/packages/tools/mixins/locale.js +9 -0
  92. package/packages/tools/mixins/migrating.js +54 -0
  93. package/packages/tools/transitions/collapse-transition.js +77 -0
  94. package/packages/tools/utils/after-leave.js +27 -0
  95. package/packages/tools/utils/aria-dialog.js +90 -0
  96. package/packages/tools/utils/aria-utils.js +122 -0
  97. package/packages/tools/utils/clickoutside.js +76 -0
  98. package/packages/tools/utils/date-util.js +292 -0
  99. package/packages/tools/utils/date.js +368 -0
  100. package/packages/tools/utils/dom.js +227 -0
  101. package/packages/tools/utils/menu/aria-menubar.js +14 -0
  102. package/packages/tools/utils/menu/aria-menuitem.js +49 -0
  103. package/packages/tools/utils/menu/aria-submenu.js +59 -0
  104. package/packages/tools/utils/merge.js +15 -0
  105. package/packages/tools/utils/popper.js +1276 -0
  106. package/packages/tools/utils/popup/index.js +218 -0
  107. package/packages/tools/utils/popup/popup-manager.js +194 -0
  108. package/packages/tools/utils/resize-event.js +35 -0
  109. package/packages/tools/utils/scroll-into-view.js +27 -0
  110. package/packages/tools/utils/scrollbar-width.js +29 -0
  111. package/packages/tools/utils/shared.js +7 -0
  112. package/packages/tools/utils/svg.js +1 -0
  113. package/packages/tools/utils/types.js +28 -0
  114. package/packages/tools/utils/util.js +241 -0
  115. package/packages/tools/utils/vdom.js +5 -0
  116. package/packages/tools/utils/vue-popper.js +198 -0
  117. package/packages/tooltip/index.js +8 -0
  118. package/packages/tooltip/src/main.js +241 -0
  119. package/packages/u-table/index.js +4 -0
  120. package/packages/u-table/revise-el-table-mixins/index.js +10 -0
  121. package/packages/u-table/revise-el-table-mixins/table-extend.js +60 -0
  122. package/packages/u-table/revise-el-table-mixins/table.mixins.js +261 -0
  123. package/packages/u-table/revise-el-table-mixins/virtual-table-body-render.js +132 -0
  124. package/packages/u-table/src/u-table.vue +248 -0
  125. package/packages/u-table/u-table-mixins/index.js +483 -0
  126. package/packages/u-table/u-table-tree-mixins/methods.js +120 -0
  127. package/packages/u-table/u-table-tree-mixins/u-table-tree-mixins.js +161 -0
  128. package/packages/u-table-column/index.js +8 -0
  129. package/packages/utils/common.js +27 -0
  130. package/packages/ux-grid/index.js +6 -0
  131. package/packages/ux-grid/mixins/index.js +707 -0
  132. package/packages/ux-grid/src/interceptor.js +6 -0
  133. package/packages/ux-grid/src/ux-grid.vue +301 -0
  134. package/packages/ux-table-column/index.js +10 -0
  135. package/tools/locale/format.js +46 -0
  136. package/tools/locale/index.js +54 -0
  137. package/tools/locale/lang/en.js +120 -0
  138. package/tools/locale/lang/zh-CN.js +116 -0
  139. package/tools/mixins/locale.js +9 -0
  140. package/tools/utils/svg.js +1 -0
  141. package/tools/utils/types.js +28 -0
  142. package/tools/utils/util.js +241 -0
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <ul class="el-select-group__wrap" v-show="visible">
3
+ <li class="el-select-group__title">{{ label }}</li>
4
+ <li>
5
+ <ul class="el-select-group">
6
+ <slot></slot>
7
+ </ul>
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script type="text/babel">
13
+ import Emitter from '../../tools/mixins/emitter';
14
+
15
+ export default {
16
+ mixins: [Emitter],
17
+
18
+ name: 'ElOptionGroup',
19
+
20
+ componentName: 'ElOptionGroup',
21
+
22
+ props: {
23
+ label: String,
24
+ disabled: {
25
+ type: Boolean,
26
+ default: false
27
+ }
28
+ },
29
+
30
+ data() {
31
+ return {
32
+ visible: true
33
+ };
34
+ },
35
+
36
+ watch: {
37
+ disabled(val) {
38
+ this.broadcast('ElOption', 'handleGroupDisabled', val);
39
+ }
40
+ },
41
+
42
+ methods: {
43
+ queryChange() {
44
+ this.visible = this.$children &&
45
+ Array.isArray(this.$children) &&
46
+ this.$children.some(option => option.visible === true);
47
+ }
48
+ },
49
+
50
+ created() {
51
+ this.$on('queryChange', this.queryChange);
52
+ },
53
+
54
+ mounted() {
55
+ if (this.disabled) {
56
+ this.broadcast('ElOption', 'handleGroupDisabled', this.disabled);
57
+ }
58
+ }
59
+ };
60
+ </script>
@@ -0,0 +1,163 @@
1
+ <template>
2
+ <li
3
+ @mouseenter="hoverItem"
4
+ @click.stop="selectOptionClick"
5
+ class="el-select-dropdown__item"
6
+ v-show="visible"
7
+ :class="{
8
+ 'selected': itemSelected,
9
+ 'is-disabled': disabled || groupDisabled || limitReached,
10
+ 'hover': hover
11
+ }">
12
+ <slot>
13
+ <span>{{ currentLabel }}</span>
14
+ </slot>
15
+ </li>
16
+ </template>
17
+
18
+ <script type="text/babel">
19
+ import Emitter from '../../tools/mixins/emitter';
20
+ import { getValueByPath, escapeRegexpString } from '../../tools/utils/util';
21
+
22
+ export default {
23
+ mixins: [Emitter],
24
+
25
+ name: 'ElOption',
26
+
27
+ componentName: 'ElOption',
28
+
29
+ inject: ['select'],
30
+
31
+ props: {
32
+ value: {
33
+ required: true
34
+ },
35
+ label: [String, Number],
36
+ created: Boolean,
37
+ disabled: {
38
+ type: Boolean,
39
+ default: false
40
+ }
41
+ },
42
+
43
+ data() {
44
+ return {
45
+ index: -1,
46
+ groupDisabled: false,
47
+ visible: true,
48
+ hitState: false,
49
+ hover: false
50
+ };
51
+ },
52
+
53
+ computed: {
54
+ isObject() {
55
+ return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
56
+ },
57
+
58
+ currentLabel() {
59
+ return this.label || (this.isObject ? '' : this.value);
60
+ },
61
+
62
+ currentValue() {
63
+ return this.value || this.label || '';
64
+ },
65
+
66
+ itemSelected() {
67
+ if (!this.select.multiple) {
68
+ return this.isEqual(this.value, this.select.value);
69
+ } else {
70
+ return this.contains(this.select.value, this.value);
71
+ }
72
+ },
73
+
74
+ limitReached() {
75
+ if (this.select.multiple) {
76
+ return !this.itemSelected &&
77
+ (this.select.value || []).length >= this.select.multipleLimit &&
78
+ this.select.multipleLimit > 0;
79
+ } else {
80
+ return false;
81
+ }
82
+ }
83
+ },
84
+
85
+ watch: {
86
+ currentLabel() {
87
+ if (!this.created && !this.select.remote) this.dispatch('ElSelect', 'setSelected');
88
+ },
89
+ value(val, oldVal) {
90
+ const { remote, valueKey } = this.select;
91
+ if (!this.created && !remote) {
92
+ if (valueKey && typeof val === 'object' && typeof oldVal === 'object' && val[valueKey] === oldVal[valueKey]) {
93
+ return;
94
+ }
95
+ this.dispatch('ElSelect', 'setSelected');
96
+ }
97
+ }
98
+ },
99
+
100
+ methods: {
101
+ isEqual(a, b) {
102
+ if (!this.isObject) {
103
+ return a === b;
104
+ } else {
105
+ const valueKey = this.select.valueKey;
106
+ return getValueByPath(a, valueKey) === getValueByPath(b, valueKey);
107
+ }
108
+ },
109
+
110
+ contains(arr = [], target) {
111
+ if (!this.isObject) {
112
+ return arr && arr.indexOf(target) > -1;
113
+ } else {
114
+ const valueKey = this.select.valueKey;
115
+ return arr && arr.some(item => {
116
+ return getValueByPath(item, valueKey) === getValueByPath(target, valueKey);
117
+ });
118
+ }
119
+ },
120
+
121
+ handleGroupDisabled(val) {
122
+ this.groupDisabled = val;
123
+ },
124
+
125
+ hoverItem() {
126
+ if (!this.disabled && !this.groupDisabled) {
127
+ this.select.hoverIndex = this.select.options.indexOf(this);
128
+ }
129
+ },
130
+
131
+ selectOptionClick() {
132
+ if (this.disabled !== true && this.groupDisabled !== true) {
133
+ this.dispatch('ElSelect', 'handleOptionClick', [this, true]);
134
+ }
135
+ },
136
+
137
+ queryChange(query) {
138
+ this.visible = new RegExp(escapeRegexpString(query), 'i').test(this.currentLabel) || this.created;
139
+ if (!this.visible) {
140
+ this.select.filteredOptionsCount--;
141
+ }
142
+ }
143
+ },
144
+
145
+ created() {
146
+ this.select.options.push(this);
147
+ this.select.cachedOptions.push(this);
148
+ this.select.optionsCount++;
149
+ this.select.filteredOptionsCount++;
150
+
151
+ this.$on('queryChange', this.queryChange);
152
+ this.$on('handleGroupDisabled', this.handleGroupDisabled);
153
+ },
154
+
155
+ beforeDestroy() {
156
+ let index = this.select.cachedOptions.indexOf(this);
157
+ if (index > -1) {
158
+ this.select.cachedOptions.splice(index, 1);
159
+ }
160
+ this.select.onOptionDestroy(this.select.options.indexOf(this));
161
+ }
162
+ };
163
+ </script>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <div
3
+ class="el-select-dropdown el-popper"
4
+ :class="[{ 'is-multiple': $parent.multiple }, popperClass]"
5
+ :style="{ minWidth: minWidth }">
6
+ <slot></slot>
7
+ </div>
8
+ </template>
9
+
10
+ <script type="text/babel">
11
+ import Popper from '../../tools/utils/vue-popper';
12
+
13
+ export default {
14
+ name: 'ElSelectDropdown',
15
+
16
+ componentName: 'ElSelectDropdown',
17
+
18
+ mixins: [Popper],
19
+
20
+ props: {
21
+ placement: {
22
+ default: 'bottom-start'
23
+ },
24
+
25
+ boundariesPadding: {
26
+ default: 0
27
+ },
28
+
29
+ popperOptions: {
30
+ default() {
31
+ return {
32
+ gpuAcceleration: false
33
+ };
34
+ }
35
+ },
36
+
37
+ visibleArrow: {
38
+ default: true
39
+ },
40
+
41
+ appendToBody: {
42
+ type: Boolean,
43
+ default: true
44
+ }
45
+ },
46
+
47
+ data() {
48
+ return {
49
+ minWidth: ''
50
+ };
51
+ },
52
+
53
+ computed: {
54
+ popperClass() {
55
+ return this.$parent.popperClass;
56
+ }
57
+ },
58
+
59
+ watch: {
60
+ '$parent.inputWidth'() {
61
+ this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
62
+ }
63
+ },
64
+
65
+ mounted() {
66
+ this.referenceElm = this.$parent.$refs.reference.$el;
67
+ this.$parent.popperElm = this.popperElm = this.$el;
68
+ this.$on('updatePopper', () => {
69
+ if (this.$parent.visible) this.updatePopper();
70
+ });
71
+ this.$on('destroyPopper', this.destroyPopper);
72
+ }
73
+ };
74
+ </script>