kui-vue 3.3.12 → 3.4.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.
- package/components/_tool/transfer.js +5 -5
- package/components/_tool/utils.js +0 -135
- package/components/base/drop.jsx +230 -17
- package/components/base/pop.jsx +1 -1
- package/components/button/styles/index.less +1 -0
- package/components/checkbox/styles/index.less +7 -3
- package/components/colorPicker/colorpicker.jsx +4 -3
- package/components/colorPicker/styles/index.less +16 -25
- package/components/datePicker/datepicker.jsx +5 -2
- package/components/datePicker/index.md +0 -1
- package/components/datePicker/styles/datepicker.less +1 -0
- package/components/drawer/demo/form.md +4 -2
- package/components/drawer/styles/index.less +9 -2
- package/components/dropdown/index.md +0 -1
- package/components/dropdown/styles/index.less +4 -0
- package/components/form/demo/align.md +1 -1
- package/components/form/demo/base.md +1 -1
- package/components/form/demo/dynamicvalid.md +1 -1
- package/components/form/demo/length.md +2 -2
- package/components/form/demo/valid.md +2 -2
- package/components/input/styles/index.less +29 -20
- package/components/inputNumber/styles/index.less +3 -3
- package/components/menu/demo/inline.md +4 -4
- package/components/menu/styles/index.less +1 -1
- package/components/popconfirm/index.md +0 -1
- package/components/popconfirm/styles/index.less +4 -2
- package/components/poptip/demo/closeinside.md +1 -1
- package/components/poptip/index.md +1 -2
- package/components/poptip/styles/index.less +10 -5
- package/components/radio/styles/index.less +22 -3
- package/components/rate/styles/index.less +9 -1
- package/components/select/demo/base.md +1 -1
- package/components/select/demo/multiple.md +1 -1
- package/components/select/demo/theme.md +11 -13
- package/components/select/index.md +0 -1
- package/components/select/select.jsx +64 -34
- package/components/select/styles/index.less +144 -128
- package/components/styles/color.less +17 -12
- package/components/styles/var.less +7 -0
- package/components/table/demo/edit.md +34 -12
- package/components/table/styles/index.less +87 -38
- package/components/table/table.jsx +1 -1
- package/components/tooltip/index.md +1 -4
- package/components/tooltip/styles/index.less +8 -4
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.js +2 -2
- package/package.json +2 -2
- /package/{README.md → readme.md} +0 -0
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
const parentNode = el.parentNode
|
|
8
8
|
if (!parentNode) return false;
|
|
9
9
|
|
|
10
|
-
const target = value === true ? document.body : value || document.body
|
|
10
|
+
const target = (value === true ? document.body : value) || document.body
|
|
11
11
|
// let empty = document.createComment('')
|
|
12
12
|
|
|
13
13
|
if (target != document.body) {
|
|
@@ -16,10 +16,10 @@ export default {
|
|
|
16
16
|
} else {
|
|
17
17
|
|
|
18
18
|
let box = document.createElement('div')
|
|
19
|
-
box.style.top = 0
|
|
20
|
-
box.style.left = 0
|
|
21
|
-
box.style.width = '100%'
|
|
22
|
-
box.style.position = 'absolute'
|
|
19
|
+
// box.style.top = 0
|
|
20
|
+
// box.style.left = 0
|
|
21
|
+
// box.style.width = '100%'
|
|
22
|
+
// box.style.position = 'absolute'
|
|
23
23
|
|
|
24
24
|
// parentNode.replaceChild(empty, el)
|
|
25
25
|
|
|
@@ -122,142 +122,7 @@ export function isVnode(element) {
|
|
|
122
122
|
element.tag !== undefined
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
-
export function getPosition(selection, picker, transfer, placement = 'bottom-left', callback) {
|
|
126
|
-
let top = 0, left = 0, offset = 3;
|
|
127
|
-
let origins = {
|
|
128
|
-
top: 'center bottom', 'top-left': 'left bottom', 'top-right': 'right bottom',
|
|
129
|
-
left: 'right center', 'left-top': 'right top', 'left-bottom': 'right bottom',
|
|
130
|
-
right: 'left center', 'right-top': 'left top', 'right-bottom': 'left bottom',
|
|
131
|
-
bottom: 'center top', 'bottom-left': 'left top', 'bottom-right': 'right top'
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (picker && selection) {
|
|
135
|
-
|
|
136
|
-
let selectionRect = selection.getBoundingClientRect();
|
|
137
|
-
let pickerHeight = picker.offsetHeight
|
|
138
|
-
let pickerWidth = picker.offsetWidth
|
|
139
|
-
let clientHeight = document.documentElement.clientHeight
|
|
140
|
-
let clientWidth = document.documentElement.clientWidth
|
|
141
|
-
let scrollTop = document.documentElement.scrollTop
|
|
142
|
-
let scrollLeft = document.documentElement.scrollLeft
|
|
143
|
-
//是否有足够的空间
|
|
144
|
-
//底部
|
|
145
|
-
let showInBottom = clientHeight - selectionRect.bottom > pickerHeight
|
|
146
|
-
//上面
|
|
147
|
-
let showInTop = selectionRect.top > pickerHeight
|
|
148
|
-
//左边
|
|
149
|
-
let showInLeft = selectionRect.left > pickerWidth
|
|
150
|
-
//右边
|
|
151
|
-
let showInRight = clientWidth - selectionRect.right > pickerWidth
|
|
152
|
-
|
|
153
|
-
// console.log(showInRight, selectionRect.left > pickerWidth, selectionRect.right, pickerWidth)
|
|
154
|
-
// console.log('bottom:', showInBottom, 'top:', showInTop, 'left:', showInLeft, 'right:', showInRight)
|
|
155
|
-
// console.log(placement, 'showInTop:', showInTop, 'showInBottom:', showInBottom, clientHeight, scrollTop, selectionRect.top, pickerHeight)
|
|
156
|
-
|
|
157
|
-
let hasBottom = placement.slice(0, 6) == 'bottom'
|
|
158
|
-
let hasTop = placement.slice(0, 3) == 'top'
|
|
159
|
-
let hasLeft = placement.slice(0, 4) == 'left'
|
|
160
|
-
let hasRight = placement.slice(0, 5) == 'right'
|
|
161
|
-
// debugger
|
|
162
|
-
if (hasBottom || hasTop) {
|
|
163
|
-
if ((hasBottom && showInBottom) || (hasTop && !showInTop)) { //正常在底部显示
|
|
164
|
-
if (transfer) {
|
|
165
|
-
top = selectionRect.bottom + offset + scrollTop;
|
|
166
|
-
left = selectionRect.left + scrollLeft
|
|
167
|
-
// left = showInRight ? selectionRect.left + scrollLeft : selectionRect.right - pickerWidth + scrollLeft
|
|
168
|
-
if (placement == 'bottom' || placement == 'top') {
|
|
169
|
-
left = selectionRect.left - (pickerWidth - selectionRect.width) / 2 + scrollLeft
|
|
170
|
-
}
|
|
171
|
-
if (placement == 'bottom-right' || placement == 'top-right') {
|
|
172
|
-
left = selectionRect.left - (pickerWidth - selectionRect.width) + scrollLeft
|
|
173
|
-
}
|
|
174
|
-
if (hasTop) {
|
|
175
|
-
placement = placement.replace('top', 'bottom')
|
|
176
|
-
}
|
|
177
|
-
if (!showInRight && showInLeft) {
|
|
178
|
-
left = selectionRect.right - pickerWidth + scrollLeft
|
|
179
|
-
}
|
|
180
|
-
if (!showInRight) {
|
|
181
|
-
placement = placement.replace('left', 'right') //右边放不下去
|
|
182
|
-
// left = selectionRect.right - pickerWidth + scrollLeft
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
top = selectionRect.height + offset;
|
|
186
|
-
left = 0;
|
|
187
|
-
}
|
|
188
|
-
} else if ((hasBottom && !showInBottom) || (hasTop && showInTop)) {
|
|
189
|
-
if (transfer) {
|
|
190
|
-
left = showInRight ? selectionRect.left + scrollLeft : selectionRect.right - pickerWidth + scrollLeft
|
|
191
|
-
top = selectionRect.top - pickerHeight - offset + scrollTop
|
|
192
|
-
if (placement == 'top' || placement == 'bottom') {
|
|
193
|
-
left = selectionRect.left - (pickerWidth - selectionRect.width) / 2 + scrollLeft
|
|
194
|
-
}
|
|
195
|
-
if (placement == 'top-right' || placement == 'bottom-right') {
|
|
196
|
-
left = selectionRect.left - (pickerWidth - selectionRect.width) + scrollLeft
|
|
197
|
-
}
|
|
198
|
-
if (hasBottom) {
|
|
199
|
-
placement = placement.replace('bottom', 'top')
|
|
200
|
-
}
|
|
201
|
-
if (!showInRight) {
|
|
202
|
-
placement = placement.replace('left', 'right')
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
top = -(pickerHeight + offset);
|
|
206
|
-
left = 0;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
} else if (hasLeft || hasRight) {
|
|
210
|
-
if ((hasLeft && showInLeft) || (hasRight && !showInRight)) {
|
|
211
|
-
if (transfer) {
|
|
212
|
-
top = selectionRect.top + scrollTop
|
|
213
|
-
left = selectionRect.left - pickerWidth - offset + scrollLeft
|
|
214
|
-
if (placement == 'left' || placement == 'right') {
|
|
215
|
-
top = selectionRect.top - (pickerHeight - selectionRect.height) / 2 + scrollTop
|
|
216
|
-
}
|
|
217
|
-
if (placement == 'left-bottom' || placement == 'right-bottom') {
|
|
218
|
-
top = selectionRect.top - (pickerHeight - selectionRect.height) + scrollTop
|
|
219
|
-
}
|
|
220
|
-
if (hasRight) {
|
|
221
|
-
placement = placement.replace('right', 'left')
|
|
222
|
-
}
|
|
223
|
-
} else {
|
|
224
|
-
top = 0
|
|
225
|
-
left = -(pickerWidth + offset)
|
|
226
|
-
}
|
|
227
|
-
} else if ((hasRight && showInRight) || (hasLeft && !showInLeft)) {
|
|
228
|
-
if (transfer) {
|
|
229
|
-
top = selectionRect.top + scrollTop
|
|
230
|
-
left = selectionRect.left + selectionRect.width + offset + scrollLeft
|
|
231
|
-
if (placement == 'right' || placement == 'left') {
|
|
232
|
-
top = selectionRect.top + scrollTop - (pickerHeight - selectionRect.height) / 2
|
|
233
|
-
}
|
|
234
|
-
if (placement == 'right-bottom' || placement == 'left-bottom') {
|
|
235
|
-
top = selectionRect.top + scrollTop - (pickerHeight - selectionRect.height)
|
|
236
|
-
}
|
|
237
|
-
if (hasLeft) {
|
|
238
|
-
placement = placement.replace('left', 'right')
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
125
|
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if (transfer && !showInBottom && (hasRight || hasLeft)) {
|
|
245
|
-
top = selectionRect.top - (pickerHeight - selectionRect.height) + scrollTop
|
|
246
|
-
if (hasRight) {
|
|
247
|
-
placement = showInRight ? 'right-bottom' : 'left-bottom'
|
|
248
|
-
}
|
|
249
|
-
if (hasLeft) {
|
|
250
|
-
placement = showInLeft ? 'left-bottom' : 'right-bottom'
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// console.log(placement, showInBottom,picker, pickerHeight,pickerWidth)
|
|
255
|
-
}
|
|
256
|
-
let origin = origins[placement]
|
|
257
|
-
if (callback) {
|
|
258
|
-
callback(top, left, origin, placement)
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
126
|
export function getOffset(el) {
|
|
262
127
|
// const rect = el.getBoundingClientRect();
|
|
263
128
|
const pos = el ? {
|
package/components/base/drop.jsx
CHANGED
|
@@ -17,14 +17,17 @@ export default {
|
|
|
17
17
|
transitionName: { type: String, default: 'dropdown' },
|
|
18
18
|
selection: { validator: v => true },
|
|
19
19
|
updateKey: [String, Object, Array],
|
|
20
|
-
offsetLeft: { type: Number, default: 0 }
|
|
20
|
+
offsetLeft: { type: Number, default: 0 },
|
|
21
|
+
extendWidth: Boolean
|
|
21
22
|
},
|
|
22
23
|
|
|
23
24
|
watch: {
|
|
24
|
-
updateKey() {
|
|
25
|
-
|
|
26
|
-
this
|
|
27
|
-
|
|
25
|
+
updateKey(o, v) {
|
|
26
|
+
if (o != v) {
|
|
27
|
+
this.$nextTick(e => {
|
|
28
|
+
this.setPosition()
|
|
29
|
+
})
|
|
30
|
+
}
|
|
28
31
|
},
|
|
29
32
|
rendered(value) {
|
|
30
33
|
this.$emit('render')
|
|
@@ -32,9 +35,14 @@ export default {
|
|
|
32
35
|
value(value) {
|
|
33
36
|
this.rendered = true
|
|
34
37
|
this.visible = value
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
|
|
39
|
+
if (value) {
|
|
40
|
+
this.left = 0
|
|
41
|
+
this.top = 0
|
|
42
|
+
this.$nextTick(e => {
|
|
43
|
+
this.setPosition()
|
|
44
|
+
})
|
|
45
|
+
}
|
|
38
46
|
},
|
|
39
47
|
placement(value) {
|
|
40
48
|
this.currentPlacement = value
|
|
@@ -115,18 +123,223 @@ export default {
|
|
|
115
123
|
onMouseDown({ target }) {
|
|
116
124
|
this.mousedownIn = this.visible && this.$el.contains(target)
|
|
117
125
|
},
|
|
118
|
-
setPosition(
|
|
126
|
+
setPosition() {
|
|
119
127
|
if (this.trigger == 'contextmenu' || !this.rendered || !this.value) {
|
|
120
128
|
return;
|
|
121
129
|
}
|
|
122
|
-
let { selection,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
let { selection, placement = 'bottom', offsetLeft } = this
|
|
131
|
+
let picker = this.$el
|
|
132
|
+
if (this.extendWidth) {
|
|
133
|
+
picker.style.width = selection.offsetWidth + 'px'
|
|
134
|
+
}
|
|
135
|
+
let top = 0, left = 0, offset = 3;
|
|
136
|
+
|
|
137
|
+
let origin = ["", ""]
|
|
138
|
+
|
|
139
|
+
if (picker && selection) {
|
|
140
|
+
|
|
141
|
+
let selectionRect = selection.getBoundingClientRect();
|
|
142
|
+
let pickerHeight = picker.offsetHeight
|
|
143
|
+
let pickerWidth = picker.offsetWidth
|
|
144
|
+
let clientHeight = document.documentElement.clientHeight
|
|
145
|
+
let clientWidth = document.documentElement.clientWidth
|
|
146
|
+
let scrollTop = document.documentElement.scrollTop
|
|
147
|
+
let scrollLeft = document.documentElement.scrollLeft
|
|
148
|
+
|
|
149
|
+
//是否有足够的空间
|
|
150
|
+
//底部
|
|
151
|
+
let enoughBottom = clientHeight - selectionRect.bottom > pickerHeight
|
|
152
|
+
let enoughBottomC = clientHeight - selectionRect.top > pickerHeight
|
|
153
|
+
//上面
|
|
154
|
+
let enoughTop = selectionRect.top > pickerHeight
|
|
155
|
+
let enoughTopC = selectionRect.bottom > pickerHeight
|
|
156
|
+
//左边
|
|
157
|
+
let enoughLeft = selectionRect.left > pickerWidth
|
|
158
|
+
let enoughLeftC = selectionRect.right > pickerWidth
|
|
159
|
+
//右边
|
|
160
|
+
let enoughRight = clientWidth - selectionRect.right > pickerWidth
|
|
161
|
+
let enoughRightC = clientWidth - selectionRect.left > pickerWidth
|
|
162
|
+
|
|
163
|
+
// console.log(showInRight, selectionRect.left > pickerWidth, selectionRect.right, pickerWidth)
|
|
164
|
+
// console.log(selectionRect.right, pickerWidth, placement, ', bottom:', enoughBottom, 'top:', enoughTop, 'left:', enoughLeft, 'leftC:', enoughLeftC, 'right:', enoughRight, 'rightC:', enoughRightC)
|
|
165
|
+
// console.log(placement, 'showInTop:', showInTop, 'showInBottom:', showInBottom, clientHeight, scrollTop, selectionRect.top, pickerHeight)
|
|
166
|
+
|
|
167
|
+
//reset placement
|
|
168
|
+
if (placement.startsWith('top')) {
|
|
169
|
+
if (!enoughTop) {
|
|
170
|
+
placement = placement.replace('top', 'bottom')
|
|
171
|
+
}
|
|
172
|
+
if (!enoughLeftC) {
|
|
173
|
+
placement = placement.replace('right', 'left')
|
|
174
|
+
|
|
175
|
+
if (placement == 'top') {
|
|
176
|
+
placement = "top-left"
|
|
177
|
+
}
|
|
178
|
+
if (placement == 'bottom') {
|
|
179
|
+
placement = "bottom-left"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!enoughRightC) {
|
|
183
|
+
placement = placement.replace('left', 'right')
|
|
184
|
+
|
|
185
|
+
if (placement == 'bottom') {
|
|
186
|
+
placement = "bottom-right"
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (placement == 'top') {
|
|
190
|
+
placement = "top-right"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
} else if (placement.startsWith('right')) {
|
|
196
|
+
if (!enoughRight) {
|
|
197
|
+
placement = placement.replace('right', 'left')
|
|
198
|
+
}
|
|
199
|
+
if (!enoughBottomC) {
|
|
200
|
+
placement = placement.replace('top', 'bottom')
|
|
201
|
+
if (placement == 'right') {
|
|
202
|
+
placement = 'right-bottom'
|
|
203
|
+
}
|
|
204
|
+
if (placement == 'left') {
|
|
205
|
+
placement = 'left-bottom'
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (!enoughTopC) {
|
|
209
|
+
placement = placement.replace('bottom', 'top')// ok
|
|
210
|
+
if (placement == 'left') {
|
|
211
|
+
placement = 'left-top'
|
|
212
|
+
}
|
|
213
|
+
if (placement == 'right') {
|
|
214
|
+
placement = 'right-top'
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
} else if (placement.startsWith('bottom')) {
|
|
219
|
+
if (!enoughBottom) {
|
|
220
|
+
placement = placement.replace('bottom', 'top')
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (!enoughLeftC) {
|
|
224
|
+
placement = placement.replace('right', 'left')
|
|
225
|
+
|
|
226
|
+
if (placement == 'bottom') {
|
|
227
|
+
placement = "bottom-left"
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (placement == 'top') {
|
|
231
|
+
placement = "top-left"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (!enoughRightC) {
|
|
235
|
+
placement = placement.replace('left', 'right')
|
|
236
|
+
|
|
237
|
+
if (placement == 'top') {
|
|
238
|
+
placement = "top-right"
|
|
239
|
+
}
|
|
240
|
+
if (placement == 'bottom') {
|
|
241
|
+
placement = "bottom-right"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
} else if (placement.startsWith('left')) {
|
|
246
|
+
if (!enoughLeft) {
|
|
247
|
+
placement = placement.replace('left', 'right')
|
|
248
|
+
}
|
|
249
|
+
if (!enoughTopC) {
|
|
250
|
+
placement = placement.replace('bottom', 'top')
|
|
251
|
+
if (placement == 'right') {
|
|
252
|
+
placement = 'right-top'
|
|
253
|
+
}
|
|
254
|
+
if (placement == 'left') {
|
|
255
|
+
placement = 'left-top'
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (!enoughBottomC) {
|
|
259
|
+
placement = placement.replace('top', 'bottom')
|
|
260
|
+
if (placement == 'right') {
|
|
261
|
+
placement = 'right-bottom'
|
|
262
|
+
}
|
|
263
|
+
if (placement == 'left') {
|
|
264
|
+
placement = 'left-bottom'
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
// console.log('result:' + placement)
|
|
272
|
+
|
|
273
|
+
// set postion
|
|
274
|
+
if (!placement.includes('-')) {
|
|
275
|
+
//equal
|
|
276
|
+
if (placement == 'top') {
|
|
277
|
+
top = selectionRect.top - pickerHeight - offset + scrollTop
|
|
278
|
+
left = selectionRect.left + (selectionRect.width - pickerWidth) / 2 + scrollLeft
|
|
279
|
+
origin = ['center', 'bottom']
|
|
280
|
+
}
|
|
281
|
+
if (placement == 'bottom') {
|
|
282
|
+
top = selectionRect.bottom + offset + scrollTop
|
|
283
|
+
left = selectionRect.left + (selectionRect.width - pickerWidth) / 2 + scrollLeft
|
|
284
|
+
origin = ['center', 'top']
|
|
285
|
+
}
|
|
286
|
+
if (placement == 'left') {
|
|
287
|
+
left = selectionRect.left - pickerWidth - offset + scrollLeft
|
|
288
|
+
top = selectionRect.top + (selectionRect.height - pickerHeight) / 2 + scrollTop
|
|
289
|
+
origin = ['right', 'center']
|
|
290
|
+
}
|
|
291
|
+
if (placement == 'right') {
|
|
292
|
+
left = selectionRect.right + offset + scrollLeft
|
|
293
|
+
top = selectionRect.top + (selectionRect.height - pickerHeight) / 2 + scrollTop
|
|
294
|
+
origin = ['left', 'center']
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
//start
|
|
298
|
+
if (placement.startsWith('bottom')) {
|
|
299
|
+
top = selectionRect.bottom + offset + scrollTop
|
|
300
|
+
origin[1] = 'top'
|
|
301
|
+
}
|
|
302
|
+
if (placement.startsWith('right')) {
|
|
303
|
+
left = selectionRect.right + offset + scrollLeft
|
|
304
|
+
origin[0] = 'left'
|
|
305
|
+
}
|
|
306
|
+
if (placement.startsWith('top')) {
|
|
307
|
+
top = selectionRect.top - pickerHeight - offset + scrollTop
|
|
308
|
+
origin[1] = 'bottom'
|
|
309
|
+
}
|
|
310
|
+
if (placement.startsWith('left')) {
|
|
311
|
+
left = selectionRect.left - pickerWidth - offset + scrollLeft
|
|
312
|
+
origin[0] = 'right'
|
|
313
|
+
}
|
|
314
|
+
//end
|
|
315
|
+
|
|
316
|
+
if (placement.endsWith('left')) {
|
|
317
|
+
left = selectionRect.left + scrollLeft
|
|
318
|
+
origin[0] = 'left'
|
|
319
|
+
}
|
|
320
|
+
if (placement.endsWith('right')) {
|
|
321
|
+
left = selectionRect.right - pickerWidth + scrollLeft - 0.5
|
|
322
|
+
origin[0] = 'right'
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (placement.endsWith('bottom')) {
|
|
326
|
+
top = selectionRect.bottom - pickerHeight + scrollTop
|
|
327
|
+
origin[1] = 'bottom'
|
|
328
|
+
}
|
|
329
|
+
if (placement.endsWith('top')) {
|
|
330
|
+
top = selectionRect.top + scrollTop
|
|
331
|
+
origin[1] = 'top'
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// console.log(placement, origin)
|
|
337
|
+
this.top = top
|
|
338
|
+
this.left = left + (placement.includes('right') ? offsetLeft : -offsetLeft)
|
|
339
|
+
|
|
340
|
+
this.transformOrigin = origin.join(' ')
|
|
341
|
+
this.currentPlacement = placement
|
|
342
|
+
|
|
130
343
|
},
|
|
131
344
|
hide(e) {
|
|
132
345
|
let { target } = e
|
package/components/base/pop.jsx
CHANGED
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.k-checkbox-inner {
|
|
26
|
-
box-sizing:
|
|
26
|
+
box-sizing: border-box;
|
|
27
27
|
display: inline-block;
|
|
28
|
-
width:
|
|
29
|
-
height:
|
|
28
|
+
width: 16px;
|
|
29
|
+
height: 16px;
|
|
30
30
|
position: relative;
|
|
31
31
|
top: 0;
|
|
32
32
|
left: 0;
|
|
@@ -109,6 +109,10 @@
|
|
|
109
109
|
.k-checkbox-label {
|
|
110
110
|
font-size: 16px;
|
|
111
111
|
}
|
|
112
|
+
.k-checkbox-inner{
|
|
113
|
+
width: 18px;
|
|
114
|
+
height: 18px;
|
|
115
|
+
}
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
.k-checkbox-light {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { canvasHelper, limit, hslToRgb, rgbToHsl, parseColor, rgbToHex, cssColorToRgba } from './canvasHelper'
|
|
2
2
|
import { Input } from '../input'
|
|
3
|
-
import {Button} from '../button'
|
|
3
|
+
import { Button } from '../button'
|
|
4
4
|
import Icon from '../icon'
|
|
5
5
|
import Drop from '../base/drop'
|
|
6
6
|
import { ChevronDown, CaretHor } from 'kui-icons'
|
|
@@ -364,7 +364,8 @@ export default {
|
|
|
364
364
|
const props = {
|
|
365
365
|
ref: 'overlay',
|
|
366
366
|
props: {
|
|
367
|
-
|
|
367
|
+
placement: 'bottom-left',
|
|
368
|
+
transfer: true,
|
|
368
369
|
value: this.opened,
|
|
369
370
|
selection: this.$el,
|
|
370
371
|
className: 'k-color-picker-dropdown',
|
|
@@ -430,7 +431,7 @@ export default {
|
|
|
430
431
|
<div class="k-color-picker-color">
|
|
431
432
|
<div class="k-color-picker-color-inner" style={`background-color:${this.currentColor}`}></div>
|
|
432
433
|
</div>
|
|
433
|
-
{showArrow && <Icon type={icon || ChevronDown} />}
|
|
434
|
+
{showArrow && <Icon class="k-color-picker-arrow" type={icon || ChevronDown} />}
|
|
434
435
|
</div>
|
|
435
436
|
{drop}
|
|
436
437
|
</div >)
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
.k-color-picker {
|
|
4
4
|
// width: 55px;
|
|
5
|
-
height:
|
|
5
|
+
height: 32px;
|
|
6
6
|
border: 1px solid var(--kui-color-border);
|
|
7
7
|
border-radius: var(--kui-border-radius);
|
|
8
8
|
position: relative;
|
|
9
|
-
display: inline-
|
|
10
|
-
box-sizing:
|
|
11
|
-
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
align-items: center;
|
|
12
|
+
padding: 0 2px;
|
|
12
13
|
&:hover,
|
|
13
14
|
&:focus {
|
|
14
15
|
border-color: var(--kui-color-main-hover);
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
.k-color-picker-selection {
|
|
22
23
|
display: flex;
|
|
23
24
|
align-items: center;
|
|
24
|
-
padding: 2px;
|
|
25
|
+
// padding: 2px;
|
|
25
26
|
cursor: pointer;
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -41,28 +42,22 @@
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
.k-
|
|
45
|
-
// position: absolute;
|
|
46
|
-
// right: 5px;
|
|
47
|
-
// top: 50%;
|
|
48
|
-
// transform: translateY(-50%);
|
|
45
|
+
.k-color-picker-arrow {
|
|
49
46
|
margin: 0 5px;
|
|
50
47
|
font-size: 16px;
|
|
51
48
|
color: var(--kui-color-icon);
|
|
52
|
-
|
|
53
|
-
#chevron-up {
|
|
54
|
-
transform: rotate(180deg);
|
|
55
|
-
}
|
|
49
|
+
transition: transform .3s cubic-bezier(0.075, 0.82, 0.165, 1);
|
|
56
50
|
}
|
|
57
51
|
|
|
58
|
-
.k-icon-default {
|
|
59
|
-
transform: rotate(180deg);
|
|
60
|
-
}
|
|
61
52
|
}
|
|
62
53
|
|
|
63
54
|
.k-color-picker-opened {
|
|
64
55
|
border: 1px solid var(--kui-color-main);
|
|
65
56
|
box-shadow: 0 0 0 2px var(--kui-color-main-90);
|
|
57
|
+
|
|
58
|
+
.k-color-picker-arrow {
|
|
59
|
+
transform: rotate(180deg);
|
|
60
|
+
}
|
|
66
61
|
}
|
|
67
62
|
|
|
68
63
|
.k-color-picker-disabled {
|
|
@@ -92,11 +87,11 @@
|
|
|
92
87
|
height: 40px;
|
|
93
88
|
|
|
94
89
|
.k-color-picker-color {
|
|
95
|
-
width:
|
|
96
|
-
height:
|
|
90
|
+
width: 34px;
|
|
91
|
+
height: 34px;
|
|
97
92
|
}
|
|
98
93
|
|
|
99
|
-
.k-
|
|
94
|
+
.k-color-picker-arrow {
|
|
100
95
|
font-size: 22px;
|
|
101
96
|
}
|
|
102
97
|
}
|
|
@@ -105,16 +100,12 @@
|
|
|
105
100
|
// width: 45px;
|
|
106
101
|
height: 22px;
|
|
107
102
|
|
|
108
|
-
.k-color-picker-selection {
|
|
109
|
-
padding: 3px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
103
|
.k-color-picker-color {
|
|
113
104
|
width: 16px;
|
|
114
105
|
height: 16px;
|
|
115
106
|
}
|
|
116
107
|
|
|
117
|
-
.k-
|
|
108
|
+
.k-color-picker-arrow {
|
|
118
109
|
font-size: 14px;
|
|
119
110
|
}
|
|
120
111
|
}
|
|
@@ -331,7 +331,10 @@ export default {
|
|
|
331
331
|
calendar.push(presetsNode)
|
|
332
332
|
}
|
|
333
333
|
const leftProps = {
|
|
334
|
-
props: {
|
|
334
|
+
props: {
|
|
335
|
+
format, mode, opened, disabledTime,
|
|
336
|
+
disabledDate, value: dv1, date: d1, v1, v2, h2, pickerSize: pickerSize || size
|
|
337
|
+
},
|
|
335
338
|
on: {
|
|
336
339
|
input: (e, f) => this.picker1Update(e, f),
|
|
337
340
|
close: (v) => {
|
|
@@ -380,7 +383,7 @@ export default {
|
|
|
380
383
|
const props = {
|
|
381
384
|
props: {
|
|
382
385
|
className: ['k-datepicker-dropdown', { 'k-datepicker-range-dropdown': isRange }],
|
|
383
|
-
transfer:
|
|
386
|
+
transfer: true,
|
|
384
387
|
selection: this.$el,
|
|
385
388
|
value: this.opened,
|
|
386
389
|
placement: 'bottom-left',
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
| pickerSize | 值Ï为`small`时日期呈现小尺寸 | String | - |
|
|
9
9
|
| clearable | 是否显示清除图标 | Boolean | true |
|
|
10
10
|
| placeholder | 提示语 | String, Array | - |
|
|
11
|
-
| transfer | 默认渲染到body 上,如定位有问题,请尝试修改为 false | Boolean | true |
|
|
12
11
|
| disabledDate | 不可选择的日期 | Function | - |
|
|
13
12
|
| disabledTime | 不可选择的时间 | Function | - |
|
|
14
13
|
| format | 设置日期格式,为数组时支持多格式匹配,展示以第一个为准。配置参考 [dayjs](http://day.js.org/) | String | YYYY-MM-DD |
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
<Drawer v-model="show1" title="表单验证" @ok="submitForm" @cancel="resetForm" footer>
|
|
12
12
|
<Form ref="form" :model="form" :rules="rules" label-align="left" :labelCol="{span:5}" :wrapperCol="{span:19}">
|
|
13
13
|
<FormItem label="Input" prop="input">
|
|
14
|
-
<Input clearable icon="
|
|
14
|
+
<Input clearable :icon="Home"></Input>
|
|
15
15
|
</FormItem>
|
|
16
16
|
<FormItem label="Number" prop="number">
|
|
17
17
|
<Input number clearable></Input>
|
|
18
18
|
</FormItem>
|
|
19
19
|
<FormItem label="DatePicker" prop="datepicker">
|
|
20
|
-
<DatePicker clearable format="YYYY/MM/DD hh:mm:ss"></DatePicker>
|
|
20
|
+
<DatePicker clearable format="YYYY/MM/DD hh:mm:ss" style="width:210px"></DatePicker>
|
|
21
21
|
</FormItem>
|
|
22
22
|
<FormItem label="Radio" prop="radio">
|
|
23
23
|
<Radio >男</Radio>
|
|
@@ -56,9 +56,11 @@
|
|
|
56
56
|
</div>
|
|
57
57
|
</template>
|
|
58
58
|
<script>
|
|
59
|
+
import { Home } from 'kui-icons'
|
|
59
60
|
export default {
|
|
60
61
|
data() {
|
|
61
62
|
return {
|
|
63
|
+
Home,
|
|
62
64
|
show1: false, show2: false,
|
|
63
65
|
form: {
|
|
64
66
|
switch: true,
|