@kengic/uni 0.3.2-beta.10
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/README.md +1 -0
- package/dist/index.css +1 -0
- package/dist/kengic-uni.js +5 -0
- package/dist/src/consts/i18n/en.d.ts +45 -0
- package/dist/src/consts/i18n/index.d.ts +90 -0
- package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
- package/dist/src/consts/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/kg.util.d.ts +5 -0
- package/dist/uni-ui/index.ts +11 -0
- package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
- package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
- package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
- package/dist/uni-ui/uni-calendar/calendar.js +546 -0
- package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
- package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
- package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
- package/dist/uni-ui/uni-calendar/util.js +360 -0
- package/dist/uni-ui/uni-card/uni-card.vue +281 -0
- package/dist/uni-ui/uni-col/uni-col.vue +317 -0
- package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
- package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
- package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
- package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
- package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
- package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
- package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
- package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
- package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
- package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
- package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
- package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
- package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
- package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
- package/dist/uni-ui/uni-drawer/keypress.js +45 -0
- package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
- package/dist/uni-ui/uni-easyinput/common.js +56 -0
- package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
- package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
- package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
- package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
- package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
- package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
- package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
- package/dist/uni-ui/uni-file-picker/utils.js +109 -0
- package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
- package/dist/uni-ui/uni-forms/utils.js +293 -0
- package/dist/uni-ui/uni-forms/validate.js +486 -0
- package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
- package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
- package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
- package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
- package/dist/uni-ui/uni-group/uni-group.vue +134 -0
- package/dist/uni-ui/uni-icons/icons.js +1169 -0
- package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
- package/dist/uni-ui/uni-icons/uniicons.css +663 -0
- package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
- package/dist/uni-ui/uni-link/uni-link.vue +128 -0
- package/dist/uni-ui/uni-list/uni-list.vue +123 -0
- package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
- package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
- package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
- package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
- package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
- package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
- package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
- package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
- package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
- package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
- package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
- package/dist/uni-ui/uni-popup/keypress.js +45 -0
- package/dist/uni-ui/uni-popup/popup.js +23 -0
- package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
- package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
- package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
- package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
- package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
- package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
- package/dist/uni-ui/uni-row/uni-row.vue +190 -0
- package/dist/uni-ui/uni-scss/changelog.md +8 -0
- package/dist/uni-ui/uni-scss/index.scss +1 -0
- package/dist/uni-ui/uni-scss/package.json +82 -0
- package/dist/uni-ui/uni-scss/readme.md +4 -0
- package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
- package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
- package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
- package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
- package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
- package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
- package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
- package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
- package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
- package/dist/uni-ui/uni-scss/theme.scss +31 -0
- package/dist/uni-ui/uni-scss/variables.scss +62 -0
- package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
- package/dist/uni-ui/uni-section/uni-section.vue +167 -0
- package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
- package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
- package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
- package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
- package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
- package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
- package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
- package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
- package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
- package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
- package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
- package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
- package/dist/uni-ui/uni-table/uni-table.vue +455 -0
- package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
- package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
- package/dist/uni-ui/uni-td/uni-td.vue +90 -0
- package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
- package/dist/uni-ui/uni-th/uni-th.vue +285 -0
- package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
- package/dist/uni-ui/uni-title/uni-title.vue +171 -0
- package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
- package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
- package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
- package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
- package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
- package/package.json +90 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// #ifdef H5
|
|
2
|
+
export default {
|
|
3
|
+
name: 'Keypress',
|
|
4
|
+
props: {
|
|
5
|
+
disable: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: false
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
mounted () {
|
|
11
|
+
const keyNames = {
|
|
12
|
+
esc: ['Esc', 'Escape'],
|
|
13
|
+
tab: 'Tab',
|
|
14
|
+
enter: 'Enter',
|
|
15
|
+
space: [' ', 'Spacebar'],
|
|
16
|
+
up: ['Up', 'ArrowUp'],
|
|
17
|
+
left: ['Left', 'ArrowLeft'],
|
|
18
|
+
right: ['Right', 'ArrowRight'],
|
|
19
|
+
down: ['Down', 'ArrowDown'],
|
|
20
|
+
delete: ['Backspace', 'Delete', 'Del']
|
|
21
|
+
}
|
|
22
|
+
const listener = ($event) => {
|
|
23
|
+
if (this.disable) {
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
const keyName = Object.keys(keyNames).find(key => {
|
|
27
|
+
const keyName = $event.key
|
|
28
|
+
const value = keyNames[key]
|
|
29
|
+
return value === keyName || (Array.isArray(value) && value.includes(keyName))
|
|
30
|
+
})
|
|
31
|
+
if (keyName) {
|
|
32
|
+
// 避免和其他按键事件冲突
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
this.$emit(keyName, {})
|
|
35
|
+
}, 0)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
document.addEventListener('keyup', listener)
|
|
39
|
+
this.$once('hook:beforeDestroy', () => {
|
|
40
|
+
document.removeEventListener('keyup', listener)
|
|
41
|
+
})
|
|
42
|
+
},
|
|
43
|
+
render: () => {}
|
|
44
|
+
}
|
|
45
|
+
// #endif
|
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-data-tree">
|
|
3
|
+
<view class="uni-data-tree-input" @click="handleInput">
|
|
4
|
+
<slot :options="options" :data="inputSelected" :error="errorMessage">
|
|
5
|
+
<view class="input-value" :class="{'input-value-border': border}">
|
|
6
|
+
<text v-if="errorMessage" class="selected-area error-text">{{errorMessage}}</text>
|
|
7
|
+
<view v-else-if="loading && !isOpened" class="selected-area">
|
|
8
|
+
<uni-load-more class="load-more" :contentText="loadMore" status="loading"></uni-load-more>
|
|
9
|
+
</view>
|
|
10
|
+
<scroll-view v-else-if="inputSelected.length" class="selected-area" scroll-x="true">
|
|
11
|
+
<view class="selected-list">
|
|
12
|
+
<view class="selected-item" v-for="(item,index) in inputSelected" :key="index">
|
|
13
|
+
<text class="text-color">{{item.text}}</text><text v-if="index<inputSelected.length-1"
|
|
14
|
+
class="input-split-line">{{split}}</text>
|
|
15
|
+
</view>
|
|
16
|
+
</view>
|
|
17
|
+
</scroll-view>
|
|
18
|
+
<text v-else class="selected-area placeholder">{{placeholder}}</text>
|
|
19
|
+
<view v-if="clearIcon && !readonly && inputSelected.length" class="icon-clear" @click.stop="clear">
|
|
20
|
+
<uni-icons type="clear" color="#c0c4cc" size="24"></uni-icons>
|
|
21
|
+
</view>
|
|
22
|
+
<view class="arrow-area" v-if="(!clearIcon || !inputSelected.length) && !readonly ">
|
|
23
|
+
<view class="input-arrow"></view>
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|
|
26
|
+
</slot>
|
|
27
|
+
</view>
|
|
28
|
+
<view class="uni-data-tree-cover" v-if="isOpened" @click="handleClose"></view>
|
|
29
|
+
<view class="uni-data-tree-dialog" v-if="isOpened">
|
|
30
|
+
<view class="uni-popper__arrow"></view>
|
|
31
|
+
<view class="dialog-caption">
|
|
32
|
+
<view class="title-area">
|
|
33
|
+
<text class="dialog-title">{{popupTitle}}</text>
|
|
34
|
+
</view>
|
|
35
|
+
<view class="dialog-close" @click="handleClose">
|
|
36
|
+
<view class="dialog-close-plus" data-id="close"></view>
|
|
37
|
+
<view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
40
|
+
<data-picker-view class="picker-view" ref="pickerView" v-model="dataValue" :localdata="localdata"
|
|
41
|
+
:preload="preload" :collection="collection" :field="field" :orderby="orderby" :where="where"
|
|
42
|
+
:step-searh="stepSearh" :self-field="selfField" :parent-field="parentField" :managed-mode="true" :map="map"
|
|
43
|
+
:ellipsis="ellipsis" @change="onchange" @datachange="ondatachange" @nodeclick="onnodeclick">
|
|
44
|
+
</data-picker-view>
|
|
45
|
+
</view>
|
|
46
|
+
</view>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import dataPicker from "../uni-data-pickerview/uni-data-picker.js"
|
|
51
|
+
import DataPickerView from "../uni-data-pickerview/uni-data-pickerview.vue"
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* DataPicker 级联选择
|
|
55
|
+
* @description 支持单列、和多列级联选择。列数没有限制,如果屏幕显示不全,顶部tab区域会左右滚动。
|
|
56
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=3796
|
|
57
|
+
* @property {String} popup-title 弹出窗口标题
|
|
58
|
+
* @property {Array} localdata 本地数据,参考
|
|
59
|
+
* @property {Boolean} border = [true|false] 是否有边框
|
|
60
|
+
* @property {Boolean} readonly = [true|false] 是否仅读
|
|
61
|
+
* @property {Boolean} preload = [true|false] 是否预加载数据
|
|
62
|
+
* @value true 开启预加载数据,点击弹出窗口后显示已加载数据
|
|
63
|
+
* @value false 关闭预加载数据,点击弹出窗口后开始加载数据
|
|
64
|
+
* @property {Boolean} step-searh = [true|false] 是否分布查询
|
|
65
|
+
* @value true 启用分布查询,仅查询当前选中节点
|
|
66
|
+
* @value false 关闭分布查询,一次查询出所有数据
|
|
67
|
+
* @property {String|DBFieldString} self-field 分布查询当前字段名称
|
|
68
|
+
* @property {String|DBFieldString} parent-field 分布查询父字段名称
|
|
69
|
+
* @property {String|DBCollectionString} collection 表名
|
|
70
|
+
* @property {String|DBFieldString} field 查询字段,多个字段用 `,` 分割
|
|
71
|
+
* @property {String} orderby 排序字段及正序倒叙设置
|
|
72
|
+
* @property {String|JQLString} where 查询条件
|
|
73
|
+
* @event {Function} popupshow 弹出的选择窗口打开时触发此事件
|
|
74
|
+
* @event {Function} popuphide 弹出的选择窗口关闭时触发此事件
|
|
75
|
+
*/
|
|
76
|
+
export default {
|
|
77
|
+
name: 'UniDataPicker',
|
|
78
|
+
emits: ['popupopened', 'popupclosed', 'nodeclick', 'input', 'change', 'update:modelValue','inputclick'],
|
|
79
|
+
mixins: [dataPicker],
|
|
80
|
+
components: {
|
|
81
|
+
DataPickerView
|
|
82
|
+
},
|
|
83
|
+
props: {
|
|
84
|
+
options: {
|
|
85
|
+
type: [Object, Array],
|
|
86
|
+
default () {
|
|
87
|
+
return {}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
popupTitle: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: '请选择'
|
|
93
|
+
},
|
|
94
|
+
placeholder: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: '请选择'
|
|
97
|
+
},
|
|
98
|
+
heightMobile: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: ''
|
|
101
|
+
},
|
|
102
|
+
readonly: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false
|
|
105
|
+
},
|
|
106
|
+
clearIcon: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: true
|
|
109
|
+
},
|
|
110
|
+
border: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: true
|
|
113
|
+
},
|
|
114
|
+
split: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: '/'
|
|
117
|
+
},
|
|
118
|
+
ellipsis: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: true
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
data() {
|
|
124
|
+
return {
|
|
125
|
+
isOpened: false,
|
|
126
|
+
inputSelected: []
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
created() {
|
|
130
|
+
this.$nextTick(() => {
|
|
131
|
+
this.load();
|
|
132
|
+
})
|
|
133
|
+
},
|
|
134
|
+
watch: {
|
|
135
|
+
localdata: {
|
|
136
|
+
handler() {
|
|
137
|
+
this.load()
|
|
138
|
+
},
|
|
139
|
+
deep: true
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
methods: {
|
|
143
|
+
clear() {
|
|
144
|
+
this._dispatchEvent([]);
|
|
145
|
+
},
|
|
146
|
+
onPropsChange() {
|
|
147
|
+
this._treeData = [];
|
|
148
|
+
this.selectedIndex = 0;
|
|
149
|
+
|
|
150
|
+
this.load();
|
|
151
|
+
},
|
|
152
|
+
load() {
|
|
153
|
+
if (this.readonly) {
|
|
154
|
+
this._processReadonly(this.localdata, this.dataValue);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 回显本地数据
|
|
159
|
+
if (this.isLocalData) {
|
|
160
|
+
this.loadData();
|
|
161
|
+
this.inputSelected = this.selected.slice(0);
|
|
162
|
+
} else if (this.isCloudDataList || this.isCloudDataTree) { // 回显 Cloud 数据
|
|
163
|
+
this.loading = true;
|
|
164
|
+
this.getCloudDataValue().then((res) => {
|
|
165
|
+
this.loading = false;
|
|
166
|
+
this.inputSelected = res;
|
|
167
|
+
}).catch((err) => {
|
|
168
|
+
this.loading = false;
|
|
169
|
+
this.errorMessage = err;
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
show() {
|
|
174
|
+
this.isOpened = true
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
this.$refs.pickerView.updateData({
|
|
177
|
+
treeData: this._treeData,
|
|
178
|
+
selected: this.selected,
|
|
179
|
+
selectedIndex: this.selectedIndex
|
|
180
|
+
})
|
|
181
|
+
}, 200)
|
|
182
|
+
this.$emit('popupopened')
|
|
183
|
+
},
|
|
184
|
+
hide() {
|
|
185
|
+
this.isOpened = false
|
|
186
|
+
this.$emit('popupclosed')
|
|
187
|
+
},
|
|
188
|
+
handleInput() {
|
|
189
|
+
if (this.readonly) {
|
|
190
|
+
this.$emit('inputclick')
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
this.show()
|
|
194
|
+
},
|
|
195
|
+
handleClose(e) {
|
|
196
|
+
this.hide()
|
|
197
|
+
},
|
|
198
|
+
onnodeclick(e) {
|
|
199
|
+
this.$emit('nodeclick', e)
|
|
200
|
+
},
|
|
201
|
+
ondatachange(e) {
|
|
202
|
+
this._treeData = this.$refs.pickerView._treeData
|
|
203
|
+
},
|
|
204
|
+
onchange(e) {
|
|
205
|
+
this.hide()
|
|
206
|
+
this.$nextTick(() => {
|
|
207
|
+
this.inputSelected = e;
|
|
208
|
+
})
|
|
209
|
+
this._dispatchEvent(e)
|
|
210
|
+
},
|
|
211
|
+
_processReadonly(dataList, value) {
|
|
212
|
+
var isTree = dataList.findIndex((item) => {
|
|
213
|
+
return item.children
|
|
214
|
+
})
|
|
215
|
+
if (isTree > -1) {
|
|
216
|
+
let inputValue
|
|
217
|
+
if (Array.isArray(value)) {
|
|
218
|
+
inputValue = value[value.length - 1]
|
|
219
|
+
if (typeof inputValue === 'object' && inputValue.value) {
|
|
220
|
+
inputValue = inputValue.value
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
inputValue = value
|
|
224
|
+
}
|
|
225
|
+
this.inputSelected = this._findNodePath(inputValue, this.localdata)
|
|
226
|
+
return
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (!this.hasValue) {
|
|
230
|
+
this.inputSelected = []
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
let result = []
|
|
235
|
+
for (let i = 0; i < value.length; i++) {
|
|
236
|
+
var val = value[i]
|
|
237
|
+
var item = dataList.find((v) => {
|
|
238
|
+
return v.value == val
|
|
239
|
+
})
|
|
240
|
+
if (item) {
|
|
241
|
+
result.push(item)
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (result.length) {
|
|
245
|
+
this.inputSelected = result
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
_filterForArray(data, valueArray) {
|
|
249
|
+
var result = []
|
|
250
|
+
for (let i = 0; i < valueArray.length; i++) {
|
|
251
|
+
var value = valueArray[i]
|
|
252
|
+
var found = data.find((item) => {
|
|
253
|
+
return item.value == value
|
|
254
|
+
})
|
|
255
|
+
if (found) {
|
|
256
|
+
result.push(found)
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return result
|
|
260
|
+
},
|
|
261
|
+
_dispatchEvent(selected) {
|
|
262
|
+
let item = {}
|
|
263
|
+
if (selected.length) {
|
|
264
|
+
var value = new Array(selected.length)
|
|
265
|
+
for (var i = 0; i < selected.length; i++) {
|
|
266
|
+
value[i] = selected[i].value
|
|
267
|
+
}
|
|
268
|
+
item = selected[selected.length - 1]
|
|
269
|
+
} else {
|
|
270
|
+
item.value = ''
|
|
271
|
+
}
|
|
272
|
+
if (this.formItem) {
|
|
273
|
+
this.formItem.setValue(item.value)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
this.$emit('input', item.value)
|
|
277
|
+
this.$emit('update:modelValue', item.value)
|
|
278
|
+
this.$emit('change', {
|
|
279
|
+
detail: {
|
|
280
|
+
value: selected
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
</script>
|
|
287
|
+
|
|
288
|
+
<style>
|
|
289
|
+
.uni-data-tree {
|
|
290
|
+
flex: 1;
|
|
291
|
+
position: relative;
|
|
292
|
+
font-size: 14px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.error-text {
|
|
296
|
+
color: #DD524D;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.input-value {
|
|
300
|
+
/* #ifndef APP-NVUE */
|
|
301
|
+
display: flex;
|
|
302
|
+
/* #endif */
|
|
303
|
+
flex-direction: row;
|
|
304
|
+
align-items: center;
|
|
305
|
+
flex-wrap: nowrap;
|
|
306
|
+
font-size: 14px;
|
|
307
|
+
/* line-height: 35px; */
|
|
308
|
+
padding: 0 10px;
|
|
309
|
+
padding-right: 5px;
|
|
310
|
+
overflow: hidden;
|
|
311
|
+
height: 35px;
|
|
312
|
+
/* #ifndef APP-NVUE */
|
|
313
|
+
box-sizing: border-box;
|
|
314
|
+
/* #endif */
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.input-value-border {
|
|
318
|
+
border: 1px solid #e5e5e5;
|
|
319
|
+
border-radius: 5px;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.selected-area {
|
|
323
|
+
flex: 1;
|
|
324
|
+
overflow: hidden;
|
|
325
|
+
/* #ifndef APP-NVUE */
|
|
326
|
+
display: flex;
|
|
327
|
+
/* #endif */
|
|
328
|
+
flex-direction: row;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.load-more {
|
|
332
|
+
/* #ifndef APP-NVUE */
|
|
333
|
+
margin-right: auto;
|
|
334
|
+
/* #endif */
|
|
335
|
+
/* #ifdef APP-NVUE */
|
|
336
|
+
width: 40px;
|
|
337
|
+
/* #endif */
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.selected-list {
|
|
341
|
+
/* #ifndef APP-NVUE */
|
|
342
|
+
display: flex;
|
|
343
|
+
/* #endif */
|
|
344
|
+
flex-direction: row;
|
|
345
|
+
flex-wrap: nowrap;
|
|
346
|
+
/* padding: 0 5px; */
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.selected-item {
|
|
350
|
+
flex-direction: row;
|
|
351
|
+
/* padding: 0 1px; */
|
|
352
|
+
/* #ifndef APP-NVUE */
|
|
353
|
+
white-space: nowrap;
|
|
354
|
+
/* #endif */
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.text-color {
|
|
358
|
+
color: #333;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.placeholder {
|
|
362
|
+
color: grey;
|
|
363
|
+
font-size: 12px;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.input-split-line {
|
|
367
|
+
opacity: .5;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.arrow-area {
|
|
371
|
+
position: relative;
|
|
372
|
+
width: 20px;
|
|
373
|
+
/* #ifndef APP-NVUE */
|
|
374
|
+
margin-bottom: 5px;
|
|
375
|
+
margin-left: auto;
|
|
376
|
+
display: flex;
|
|
377
|
+
/* #endif */
|
|
378
|
+
justify-content: center;
|
|
379
|
+
transform: rotate(-45deg);
|
|
380
|
+
transform-origin: center;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.input-arrow {
|
|
384
|
+
width: 7px;
|
|
385
|
+
height: 7px;
|
|
386
|
+
border-left: 1px solid #999;
|
|
387
|
+
border-bottom: 1px solid #999;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.uni-data-tree-cover {
|
|
391
|
+
position: fixed;
|
|
392
|
+
left: 0;
|
|
393
|
+
top: 0;
|
|
394
|
+
right: 0;
|
|
395
|
+
bottom: 0;
|
|
396
|
+
background-color: rgba(0, 0, 0, .4);
|
|
397
|
+
/* #ifndef APP-NVUE */
|
|
398
|
+
display: flex;
|
|
399
|
+
/* #endif */
|
|
400
|
+
flex-direction: column;
|
|
401
|
+
z-index: 100;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.uni-data-tree-dialog {
|
|
405
|
+
position: fixed;
|
|
406
|
+
left: 0;
|
|
407
|
+
/* #ifndef APP-NVUE */
|
|
408
|
+
top: 20%;
|
|
409
|
+
/* #endif */
|
|
410
|
+
/* #ifdef APP-NVUE */
|
|
411
|
+
top: 200px;
|
|
412
|
+
/* #endif */
|
|
413
|
+
right: 0;
|
|
414
|
+
bottom: 0;
|
|
415
|
+
background-color: #FFFFFF;
|
|
416
|
+
border-top-left-radius: 10px;
|
|
417
|
+
border-top-right-radius: 10px;
|
|
418
|
+
/* #ifndef APP-NVUE */
|
|
419
|
+
display: flex;
|
|
420
|
+
/* #endif */
|
|
421
|
+
flex-direction: column;
|
|
422
|
+
z-index: 102;
|
|
423
|
+
overflow: hidden;
|
|
424
|
+
/* #ifdef APP-NVUE */
|
|
425
|
+
width: 750rpx;
|
|
426
|
+
/* #endif */
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.dialog-caption {
|
|
430
|
+
position: relative;
|
|
431
|
+
/* #ifndef APP-NVUE */
|
|
432
|
+
display: flex;
|
|
433
|
+
/* #endif */
|
|
434
|
+
flex-direction: row;
|
|
435
|
+
/* border-bottom: 1px solid #f0f0f0; */
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.title-area {
|
|
439
|
+
/* #ifndef APP-NVUE */
|
|
440
|
+
display: flex;
|
|
441
|
+
/* #endif */
|
|
442
|
+
align-items: center;
|
|
443
|
+
/* #ifndef APP-NVUE */
|
|
444
|
+
margin: auto;
|
|
445
|
+
/* #endif */
|
|
446
|
+
padding: 0 10px;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.dialog-title {
|
|
450
|
+
/* font-weight: bold; */
|
|
451
|
+
line-height: 44px;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.dialog-close {
|
|
455
|
+
position: absolute;
|
|
456
|
+
top: 0;
|
|
457
|
+
right: 0;
|
|
458
|
+
bottom: 0;
|
|
459
|
+
/* #ifndef APP-NVUE */
|
|
460
|
+
display: flex;
|
|
461
|
+
/* #endif */
|
|
462
|
+
flex-direction: row;
|
|
463
|
+
align-items: center;
|
|
464
|
+
padding: 0 15px;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.dialog-close-plus {
|
|
468
|
+
width: 16px;
|
|
469
|
+
height: 2px;
|
|
470
|
+
background-color: #666;
|
|
471
|
+
border-radius: 2px;
|
|
472
|
+
transform: rotate(45deg);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.dialog-close-rotate {
|
|
476
|
+
position: absolute;
|
|
477
|
+
transform: rotate(-45deg);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.picker-view {
|
|
481
|
+
flex: 1;
|
|
482
|
+
overflow: hidden;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.icon-clear {
|
|
486
|
+
display: flex;
|
|
487
|
+
align-items: center;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* #ifdef H5 */
|
|
491
|
+
@media all and (min-width: 768px) {
|
|
492
|
+
.uni-data-tree-cover {
|
|
493
|
+
background-color: transparent;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.uni-data-tree-dialog {
|
|
497
|
+
position: absolute;
|
|
498
|
+
top: 55px;
|
|
499
|
+
height: auto;
|
|
500
|
+
min-height: 400px;
|
|
501
|
+
max-height: 50vh;
|
|
502
|
+
background-color: #fff;
|
|
503
|
+
border: 1px solid #EBEEF5;
|
|
504
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
505
|
+
border-radius: 4px;
|
|
506
|
+
overflow: unset;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.dialog-caption {
|
|
510
|
+
display: none;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.icon-clear {
|
|
514
|
+
/* margin-right: 5px; */
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/* #endif */
|
|
519
|
+
|
|
520
|
+
/* picker 弹出层通用的指示小三角, todo:扩展至上下左右方向定位 */
|
|
521
|
+
/* #ifndef APP-NVUE */
|
|
522
|
+
.uni-popper__arrow,
|
|
523
|
+
.uni-popper__arrow::after {
|
|
524
|
+
position: absolute;
|
|
525
|
+
display: block;
|
|
526
|
+
width: 0;
|
|
527
|
+
height: 0;
|
|
528
|
+
border-color: transparent;
|
|
529
|
+
border-style: solid;
|
|
530
|
+
border-width: 6px;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.uni-popper__arrow {
|
|
534
|
+
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
|
535
|
+
top: -6px;
|
|
536
|
+
left: 10%;
|
|
537
|
+
margin-right: 3px;
|
|
538
|
+
border-top-width: 0;
|
|
539
|
+
border-bottom-color: #EBEEF5;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.uni-popper__arrow::after {
|
|
543
|
+
content: " ";
|
|
544
|
+
top: 1px;
|
|
545
|
+
margin-left: -6px;
|
|
546
|
+
border-top-width: 0;
|
|
547
|
+
border-bottom-color: #fff;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/* #endif */
|
|
551
|
+
</style>
|