oxy-uni-ui 1.1.0 → 1.2.3
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/attributes.json +1 -1
- package/components/common/abstracts/variable.scss +59 -1
- package/components/common/path.ts +9 -0
- package/components/common/util.ts +42 -0
- package/components/composables/index.ts +1 -0
- package/components/composables/useGlobalLoading.ts +42 -0
- package/components/composables/useGlobalMessage.ts +48 -0
- package/components/composables/useGlobalToast.ts +84 -0
- package/components/composables/useVirtualScroll.ts +173 -0
- package/components/oxy-cell/oxy-cell.vue +15 -2
- package/components/oxy-cell/types.ts +4 -0
- package/components/oxy-checkbox/index.scss +1 -1
- package/components/oxy-checkbox/oxy-checkbox.vue +2 -2
- package/components/oxy-col-picker/oxy-col-picker.vue +3 -0
- package/components/oxy-col-picker/types.ts +5 -1
- package/components/oxy-corner/index.scss +121 -1
- package/components/oxy-corner/oxy-corner.vue +18 -5
- package/components/oxy-corner/types.ts +24 -3
- package/components/oxy-date-strip/index.scss +10 -0
- package/components/oxy-date-strip/oxy-date-strip.vue +198 -0
- package/components/oxy-date-strip/types.ts +98 -0
- package/components/oxy-date-strip/utils.ts +67 -0
- package/components/oxy-date-strip-item/index.scss +94 -0
- package/components/oxy-date-strip-item/oxy-date-strip-item.vue +102 -0
- package/components/oxy-date-strip-item/types.ts +53 -0
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +3 -1
- package/components/oxy-datetime-picker/types.ts +5 -1
- package/components/oxy-echarts/index.scss +17 -0
- package/components/oxy-echarts/index.ts +1 -0
- package/components/oxy-echarts/oxy-echarts.vue +32 -0
- package/components/oxy-echarts/types.ts +12 -0
- package/components/oxy-file-list/index.scss +26 -0
- package/components/oxy-file-list/oxy-file-list.vue +208 -34
- package/components/oxy-file-list/types.ts +58 -2
- package/components/oxy-global-loading/oxy-global-loading.vue +53 -0
- package/components/oxy-global-message/oxy-global-message.vue +64 -0
- package/components/oxy-global-toast/oxy-global-toast.vue +53 -0
- package/components/oxy-img-lazy/index.scss +17 -0
- package/components/oxy-img-lazy/oxy-img-lazy.vue +332 -0
- package/components/oxy-img-lazy/types.ts +69 -0
- package/components/oxy-link/index.scss +57 -0
- package/components/oxy-link/oxy-link.vue +130 -0
- package/components/oxy-link/types.ts +81 -0
- package/components/oxy-list/index.scss +8 -1
- package/components/oxy-list/oxy-list.vue +121 -40
- package/components/oxy-list/types.ts +3 -15
- package/components/oxy-picker/oxy-picker.vue +3 -0
- package/components/oxy-picker/types.ts +5 -1
- package/components/oxy-radio/index.scss +3 -3
- package/components/oxy-radio/oxy-radio.vue +1 -1
- package/components/oxy-rich-text/icon/emjio.svg +1 -0
- package/components/oxy-rich-text/icon/quote.svg +1 -0
- package/components/oxy-rich-text/icon/text.svg +1 -0
- package/components/oxy-rich-text/icon/title.svg +1 -0
- package/components/oxy-rich-text/index.scss +159 -0
- package/components/oxy-rich-text/mp-html/card/card.vue +122 -0
- package/components/oxy-rich-text/mp-html/card/index.js +7 -0
- package/components/oxy-rich-text/mp-html/editable/config.js +15 -0
- package/components/oxy-rich-text/mp-html/editable/index.js +553 -0
- package/components/oxy-rich-text/mp-html/emoji/index.js +203 -0
- package/components/oxy-rich-text/mp-html/highlight/config.js +5 -0
- package/components/oxy-rich-text/mp-html/highlight/index.js +96 -0
- package/components/oxy-rich-text/mp-html/highlight/prism.css +1 -0
- package/components/oxy-rich-text/mp-html/highlight/prism.min.js +7 -0
- package/components/oxy-rich-text/mp-html/img-cache/index.js +138 -0
- package/components/oxy-rich-text/mp-html/latex/index.js +80 -0
- package/components/oxy-rich-text/mp-html/latex/katex.css +1 -0
- package/components/oxy-rich-text/mp-html/latex/katex.min.js +1 -0
- package/components/oxy-rich-text/mp-html/markdown/index.js +50 -0
- package/components/oxy-rich-text/mp-html/markdown/marked.min.js +71 -0
- package/components/oxy-rich-text/mp-html/mp-html.d.ts +184 -0
- package/components/oxy-rich-text/mp-html/mp-html.vue +675 -0
- package/components/oxy-rich-text/mp-html/node/node.vue +1161 -0
- package/components/oxy-rich-text/mp-html/parser.js +1428 -0
- package/components/oxy-rich-text/mp-html/search/index.js +132 -0
- package/components/oxy-rich-text/mp-html/style/index.js +129 -0
- package/components/oxy-rich-text/mp-html/style/parser.js +175 -0
- package/components/oxy-rich-text/mp-html/template/index.js +67 -0
- package/components/oxy-rich-text/mp-html/txv-video/index.js +46 -0
- package/components/oxy-rich-text/oxy-rich-text.vue +642 -0
- package/components/oxy-rich-text/types.ts +71 -0
- package/components/oxy-select/index.scss +255 -0
- package/components/oxy-select/oxy-select.vue +421 -0
- package/components/oxy-select/types.ts +71 -0
- package/components/oxy-select-picker/oxy-select-picker.vue +3 -0
- package/components/oxy-select-picker/types.ts +5 -1
- package/components/oxy-stream-render/index.scss +6 -0
- package/components/oxy-stream-render/oxy-stream-render.vue +204 -0
- package/components/oxy-stream-render/types.ts +5 -0
- package/components/oxy-tree/index.scss +43 -5
- package/components/oxy-tree/oxy-tree.vue +233 -35
- package/components/oxy-tree/types.ts +54 -7
- package/components/oxy-tree/utils.ts +51 -0
- package/components/oxy-virtual-scroll/index.scss +1 -1
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +69 -110
- package/components/oxy-virtual-scroll/types.ts +95 -5
- package/components/oxy-waterfall/index.scss +18 -0
- package/components/oxy-waterfall/oxy-waterfall.vue +218 -0
- package/components/oxy-waterfall/types.ts +90 -0
- package/components/oxy-waterfall-item/index.scss +8 -0
- package/components/oxy-waterfall-item/oxy-waterfall-item.vue +89 -0
- package/components/oxy-waterfall-item/types.ts +16 -0
- package/global.d.ts +7 -0
- package/index.ts +3 -0
- package/locale/lang/en-US.ts +35 -9
- package/locale/lang/zh-CN.ts +31 -5
- package/oxy-uni-ui.zip +0 -0
- package/package.json +1 -1
- package/tags.json +1 -1
- package/uni-echarts/changelog.md +2 -0
- package/uni-echarts/components/index.js +1 -0
- package/uni-echarts/components/uni-echarts/events.js +95 -0
- package/uni-echarts/components/uni-echarts/types.d.ts +183 -0
- package/uni-echarts/components/uni-echarts/types.js +1 -0
- package/uni-echarts/components/uni-echarts/uni-echarts.vue +530 -0
- package/uni-echarts/components/uni-echarts/uni-echarts.vue.d.ts +19 -0
- package/uni-echarts/global.d.ts +7 -0
- package/uni-echarts/index.d.ts +440 -0
- package/uni-echarts/index.js +2 -0
- package/uni-echarts/package.json +105 -0
- package/uni-echarts/shared-core.d.ts +269 -0
- package/uni-echarts/shared-core.js +900 -0
- package/web-types.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeArrayProp, makeBooleanProp, makeNumberProp, makeRequiredProp, makeStringProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export const selectProps = {
|
|
5
|
+
...baseProps,
|
|
6
|
+
/**
|
|
7
|
+
* 选中项
|
|
8
|
+
*/
|
|
9
|
+
modelValue: makeRequiredProp([String, Number, Array]),
|
|
10
|
+
/**
|
|
11
|
+
* 是否多选
|
|
12
|
+
*/
|
|
13
|
+
multiple: makeBooleanProp(false),
|
|
14
|
+
/**
|
|
15
|
+
* 是否禁用
|
|
16
|
+
*/
|
|
17
|
+
disabled: makeBooleanProp(false),
|
|
18
|
+
/** 只读 */
|
|
19
|
+
readonly: makeBooleanProp(false),
|
|
20
|
+
/**
|
|
21
|
+
* 多作为 key 唯一标识的键名
|
|
22
|
+
*/
|
|
23
|
+
labelKey: makeStringProp('label'),
|
|
24
|
+
/**
|
|
25
|
+
* 多作为 value 唯一标识的键名
|
|
26
|
+
*/
|
|
27
|
+
valueKey: makeStringProp('value'),
|
|
28
|
+
/**
|
|
29
|
+
* 是否开启搜索
|
|
30
|
+
*/
|
|
31
|
+
filterable: makeBooleanProp(false),
|
|
32
|
+
/**
|
|
33
|
+
* 是否折叠显示标签
|
|
34
|
+
*/
|
|
35
|
+
collapseTags: makeBooleanProp(false),
|
|
36
|
+
/**
|
|
37
|
+
* 超过多少个标签才折叠
|
|
38
|
+
*/
|
|
39
|
+
collapseTagsNum: makeNumberProp(1),
|
|
40
|
+
/**
|
|
41
|
+
* 选择器数据
|
|
42
|
+
*/
|
|
43
|
+
columns: makeArrayProp<Record<string, any>>(),
|
|
44
|
+
/**
|
|
45
|
+
* 左侧标题
|
|
46
|
+
*/
|
|
47
|
+
label: makeStringProp(''),
|
|
48
|
+
/** 设置左侧标题宽度 */
|
|
49
|
+
labelWidth: makeStringProp(''),
|
|
50
|
+
/** 选择器的值靠右展示 */
|
|
51
|
+
alignRight: makeBooleanProp(false),
|
|
52
|
+
/**
|
|
53
|
+
* 输入框的提示文字
|
|
54
|
+
*/
|
|
55
|
+
placeholder: makeStringProp('请选择'),
|
|
56
|
+
/**
|
|
57
|
+
* 无选项提示
|
|
58
|
+
*/
|
|
59
|
+
emptyTips: makeStringProp('无选项'),
|
|
60
|
+
/**
|
|
61
|
+
* 是否可清除
|
|
62
|
+
*/
|
|
63
|
+
clear: makeBooleanProp(true),
|
|
64
|
+
/**
|
|
65
|
+
* 格式化输出
|
|
66
|
+
*/
|
|
67
|
+
format: makeStringProp(''),
|
|
68
|
+
defItem: makeNumberProp(0)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type SelectProps = ExtractPropTypes<typeof selectProps>
|
|
@@ -320,6 +320,9 @@ function close() {
|
|
|
320
320
|
|
|
321
321
|
function open() {
|
|
322
322
|
if (props.disabled || props.readonly) return
|
|
323
|
+
if (isFunction(props.beforeOpen) && !props.beforeOpen()) {
|
|
324
|
+
return
|
|
325
|
+
}
|
|
323
326
|
selectList.value = valueFormat(props.modelValue)
|
|
324
327
|
pickerShow.value = true
|
|
325
328
|
isConfirm.value = false
|
|
@@ -105,7 +105,11 @@ export const selectPickerProps = {
|
|
|
105
105
|
/**
|
|
106
106
|
* 必填标记位置,可选值:before、after
|
|
107
107
|
*/
|
|
108
|
-
markerSide: makeStringProp<'before' | 'after'>('before')
|
|
108
|
+
markerSide: makeStringProp<'before' | 'after'>('before'),
|
|
109
|
+
/**
|
|
110
|
+
* 打开pop之前的校验
|
|
111
|
+
*/
|
|
112
|
+
beforeOpen: Function as PropType<() => boolean>
|
|
109
113
|
}
|
|
110
114
|
export type SelectPickerProps = ExtractPropTypes<typeof selectPickerProps>
|
|
111
115
|
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef H5 || APP-PLUS -->
|
|
3
|
+
<view class="oxy-stream-render" :change:stream-request="appStreamHandler.handleStreamRequest" :stream-request="streamRequest" />
|
|
4
|
+
<!-- #endif -->
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'oxy-stream-render',
|
|
10
|
+
props: {
|
|
11
|
+
streamRequest: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: () => ({})
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
options: {
|
|
17
|
+
addGlobalClass: true,
|
|
18
|
+
virtualHost: true,
|
|
19
|
+
styleIsolation: 'shared'
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
requestTask: null
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
watch: {
|
|
27
|
+
streamRequest: {
|
|
28
|
+
handler(newVal) {
|
|
29
|
+
// #ifndef H5 || APP-PLUS
|
|
30
|
+
this.handleStreamRequest(newVal)
|
|
31
|
+
// #endif
|
|
32
|
+
},
|
|
33
|
+
deep: true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
handleAppStreamData({ chunk, finished }) {
|
|
38
|
+
this.$emit('stream-data', { chunk, finished })
|
|
39
|
+
},
|
|
40
|
+
handleAppStreamError({ message, type }) {
|
|
41
|
+
this.$emit('stream-error', { message, type })
|
|
42
|
+
},
|
|
43
|
+
// #ifndef H5 || APP-PLUS
|
|
44
|
+
handleStreamRequest(newVal) {
|
|
45
|
+
if (newVal && newVal.cancel) {
|
|
46
|
+
if (this.requestTask) {
|
|
47
|
+
this.requestTask.abort()
|
|
48
|
+
this.requestTask = null
|
|
49
|
+
}
|
|
50
|
+
this.handleAppStreamData({
|
|
51
|
+
chunk: null,
|
|
52
|
+
finished: true
|
|
53
|
+
})
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!newVal || !newVal.url) {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (this.requestTask) {
|
|
62
|
+
this.requestTask.abort()
|
|
63
|
+
this.requestTask = null
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const { url, method, headers, body } = newVal
|
|
67
|
+
|
|
68
|
+
this.requestTask = uni.request({
|
|
69
|
+
url,
|
|
70
|
+
method: method || 'GET',
|
|
71
|
+
header: headers || {},
|
|
72
|
+
data: body,
|
|
73
|
+
enableChunked: true,
|
|
74
|
+
success: (res) => {
|
|
75
|
+
this.handleAppStreamData({
|
|
76
|
+
chunk: null,
|
|
77
|
+
finished: true
|
|
78
|
+
})
|
|
79
|
+
this.requestTask = null
|
|
80
|
+
},
|
|
81
|
+
fail: (err) => {
|
|
82
|
+
this.handleAppStreamError({
|
|
83
|
+
message: err.errMsg || 'Request failed',
|
|
84
|
+
type: err.errMsg === 'request:fail abort' ? 'AbortError' : 'Error'
|
|
85
|
+
})
|
|
86
|
+
this.requestTask = null
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
// 这里监听消息
|
|
90
|
+
this.requestTask.onChunkReceived((res) => {
|
|
91
|
+
let decoder = new TextDecoder('utf-8')
|
|
92
|
+
let chunk = decoder.decode(new Uint8Array(res.data))
|
|
93
|
+
this.handleAppStreamData({
|
|
94
|
+
chunk,
|
|
95
|
+
finished: false
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
// #endif
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<script module="appStreamHandler" lang="renderjs">
|
|
105
|
+
// #ifdef H5 || APP-PLUS
|
|
106
|
+
module.exports = {
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
abortController: null,
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
methods: {
|
|
113
|
+
handleStreamRequest(newVal, _oldVal, _ownerInstance) {
|
|
114
|
+
if (newVal && newVal.cancel) {
|
|
115
|
+
if (this.abortController) {
|
|
116
|
+
this.abortController.abort()
|
|
117
|
+
this.abortController = null
|
|
118
|
+
}
|
|
119
|
+
this.$ownerInstance.callMethod('handleAppStreamData', {
|
|
120
|
+
chunk: null,
|
|
121
|
+
finished: true,
|
|
122
|
+
})
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!newVal || !newVal.url) {
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (this.abortController) {
|
|
131
|
+
this.abortController.abort()
|
|
132
|
+
this.abortController = null
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
this.abortController = new AbortController()
|
|
136
|
+
|
|
137
|
+
const { url, method, headers, body } = newVal
|
|
138
|
+
|
|
139
|
+
fetch(url, {
|
|
140
|
+
method,
|
|
141
|
+
headers,
|
|
142
|
+
body,
|
|
143
|
+
signal: this.abortController.signal,
|
|
144
|
+
})
|
|
145
|
+
.then((response) => {
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
throw new Error(`HTTP error! status: ${response.status}`)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (!response.body || !response.body.getReader) {
|
|
151
|
+
throw new Error('ReadableStream not supported')
|
|
152
|
+
}
|
|
153
|
+
const reader = response.body.getReader()
|
|
154
|
+
const decoder = new TextDecoder()
|
|
155
|
+
|
|
156
|
+
const readStream = async () => {
|
|
157
|
+
try {
|
|
158
|
+
const { done, value } = await reader.read()
|
|
159
|
+
|
|
160
|
+
if (done) {
|
|
161
|
+
this.abortController = null
|
|
162
|
+
this.$ownerInstance.callMethod('handleAppStreamData', {
|
|
163
|
+
chunk: null,
|
|
164
|
+
finished: true,
|
|
165
|
+
})
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const chunk = decoder.decode(value, { stream: true })
|
|
170
|
+
|
|
171
|
+
this.$ownerInstance.callMethod('handleAppStreamData', {
|
|
172
|
+
chunk,
|
|
173
|
+
finished: false,
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
return readStream()
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
this.abortController = null
|
|
180
|
+
this.$ownerInstance.callMethod('handleAppStreamError', {
|
|
181
|
+
message: error.message,
|
|
182
|
+
type:error.name
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return readStream()
|
|
188
|
+
})
|
|
189
|
+
.catch((error) => {
|
|
190
|
+
this.abortController = null
|
|
191
|
+
this.$ownerInstance.callMethod('handleAppStreamError', {
|
|
192
|
+
message: error.message,
|
|
193
|
+
type:error.name
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
// #endif
|
|
200
|
+
</script>
|
|
201
|
+
|
|
202
|
+
<style lang="scss" scoped>
|
|
203
|
+
@import './index.scss';
|
|
204
|
+
</style>
|
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
@import '../common/abstracts/variable';
|
|
2
2
|
@import '../common/abstracts/mixin';
|
|
3
|
+
@import '../oxy-virtual-scroll/index.scss';
|
|
4
|
+
|
|
5
|
+
.oxy-tree {
|
|
6
|
+
position: relative;
|
|
7
|
+
&__virtual-scroll {
|
|
8
|
+
position: relative;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__view {
|
|
13
|
+
height: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__container {
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__items {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
}
|
|
26
|
+
.oxy-tree__search{
|
|
27
|
+
display: flex;
|
|
28
|
+
:deep(.oxy-button){
|
|
29
|
+
min-width: 60px;
|
|
30
|
+
}
|
|
31
|
+
:deep(.oxy-tree__search-input) {
|
|
32
|
+
flex: 1;
|
|
33
|
+
background-color: $-tree-search-input-color;
|
|
34
|
+
padding: 6px 12px;
|
|
35
|
+
border-radius: 4px;
|
|
36
|
+
margin-bottom: 8px;
|
|
37
|
+
margin-right: 12px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
}
|
|
3
43
|
|
|
4
44
|
.oxy-tree-node-content {
|
|
5
|
-
line-height: 44px;
|
|
6
|
-
height: 44px;
|
|
7
45
|
display: flex;
|
|
8
46
|
width: fit-content;
|
|
9
47
|
width: 100%;
|
|
@@ -11,13 +49,13 @@
|
|
|
11
49
|
align-items: center;
|
|
12
50
|
|
|
13
51
|
&.expanded {
|
|
14
|
-
.oxy-tree-node-icon {
|
|
52
|
+
:deep(.oxy-tree-node-icon) {
|
|
15
53
|
transform: rotate(0deg);
|
|
16
54
|
}
|
|
17
55
|
}
|
|
18
56
|
|
|
19
57
|
&.is-leaf {
|
|
20
|
-
.oxy-tree-node-icon {
|
|
58
|
+
:deep(.oxy-tree-node-icon) {
|
|
21
59
|
opacity: 0;
|
|
22
60
|
}
|
|
23
61
|
}
|
|
@@ -51,7 +89,7 @@
|
|
|
51
89
|
}
|
|
52
90
|
}
|
|
53
91
|
|
|
54
|
-
.oxy-tree-node-icon {
|
|
92
|
+
:deep(.oxy-tree-node-icon) {
|
|
55
93
|
transform: rotate(-90deg);
|
|
56
94
|
}
|
|
57
95
|
|