zartui 0.1.60 → 0.1.61
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/es/hierarchy-select/index.css +1 -0
- package/es/hierarchy-select/index.js +188 -0
- package/es/hierarchy-select/index.less +77 -0
- package/es/hierarchy-select/style/index.js +8 -0
- package/es/hierarchy-select/style/less.js +8 -0
- package/es/index.js +4 -3
- package/es/style/var.less +21 -1
- package/lib/7893e51cf0a4877dac80.worker.js +10 -0
- package/lib/be09b519a460e229fd8d.worker.js +2527 -0
- package/lib/hierarchy-select/index.css +1 -0
- package/lib/hierarchy-select/index.js +203 -0
- package/lib/hierarchy-select/index.less +77 -0
- package/lib/hierarchy-select/style/index.js +8 -0
- package/lib/hierarchy-select/style/less.js +8 -0
- package/lib/index.css +1 -1
- package/lib/index.js +6 -2
- package/lib/index.less +1 -0
- package/lib/style/var.less +21 -1
- package/lib/zart.js +10523 -42667
- package/lib/zart.min.js +4 -4
- package/package.json +1 -1
- package/lib/a037f57fc4d92a8a1f1e.worker.js +0 -60600
- package/lib/b7cf90b4775181215df7.worker.js +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[class*=zt-hairline]::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid rgba(0,0,0,.1);-webkit-transform:scale(.5);transform:scale(.5)}.zt-hairline,.zt-hairline--bottom,.zt-hairline--left,.zt-hairline--right,.zt-hairline--surround,.zt-hairline--top,.zt-hairline--top-bottom{position:relative}.zt-hairline--top::after{border-top-width:1px}.zt-hairline--left::after{border-left-width:1px}.zt-hairline--right::after{border-right-width:1px}.zt-hairline--bottom::after{border-bottom-width:1px}.zt-hairline--top-bottom::after,.zt-hairline-unset--top-bottom::after{border-width:1px 0}.zt-hairline--surround::after{border-width:1px}.zt-hierarchy-select__wrap{width:100%;background:#fff;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column}.zt-hierarchy-select__button-cancel{text-align:center;color:#ff4b50;padding:20px;-webkit-box-flex:1;-webkit-flex:1;flex:1}.zt-hierarchy-select__button-ok{text-align:center;color:#3a90f6;padding:20px;-webkit-box-flex:1;-webkit-flex:1;flex:1}.zt-hierarchy-select__actions{height:350px;overflow-y:auto}.zt-hierarchy-select__actions-item{padding:20px 0;text-align:center;color:#333;font-size:15px}.zt-hierarchy-select__button-wrap{display:-webkit-box;display:-webkit-flex;display:flex;height:50px}.zt-hierarchy-select__container{background-color:#fff;padding:12px 20px 20px 20px;margin:0 0 2px 0}.zt-hierarchy-select__icon-text{font-size:12px;line-height:15px;color:#333}.zt-hierarchy-select__icon-wrap{padding:8px 10px;background-color:#fff;border:1px solid #727e8d;margin:8px 10px 0 0;border-radius:8px;display:-webkit-box;display:-webkit-flex;display:flex;float:left}.zt-hierarchy-select__cancel{height:12px;width:12px;margin:0 0 0 3px}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// Utils
|
|
2
|
+
import { createNamespace } from '../utils'; // Components
|
|
3
|
+
|
|
4
|
+
import Loading from '../loading';
|
|
5
|
+
import Popup from '../popup';
|
|
6
|
+
import Icon from '../icon';
|
|
7
|
+
import { PopupMixin } from '../mixins/popup';
|
|
8
|
+
import { deepClone } from '../utils/deep-clone';
|
|
9
|
+
|
|
10
|
+
var _createNamespace = createNamespace('hierarchy-select'),
|
|
11
|
+
createComponent = _createNamespace[0],
|
|
12
|
+
bem = _createNamespace[1],
|
|
13
|
+
t = _createNamespace[2];
|
|
14
|
+
|
|
15
|
+
import Toast from '../toast';
|
|
16
|
+
export default createComponent({
|
|
17
|
+
mixins: [PopupMixin()],
|
|
18
|
+
props: {
|
|
19
|
+
showPicker: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
maskClosable: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
showCancel: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
},
|
|
31
|
+
cancelText: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '取消'
|
|
34
|
+
},
|
|
35
|
+
getHierarchyList: {
|
|
36
|
+
type: Function,
|
|
37
|
+
default: function _default() {}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
data: function data() {
|
|
41
|
+
return {
|
|
42
|
+
loading: false,
|
|
43
|
+
hierarchyList: [],
|
|
44
|
+
hierarchyListCache: [],
|
|
45
|
+
hierarchyCache: [],
|
|
46
|
+
selectIndex: 0,
|
|
47
|
+
showComfirmBtn: false
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
mounted: function mounted() {
|
|
51
|
+
this.getHierarchyById(-1);
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
handleCancel: function handleCancel() {
|
|
55
|
+
this.$emit('cancel');
|
|
56
|
+
},
|
|
57
|
+
unitNaviBack: function unitNaviBack(index) {
|
|
58
|
+
this.hierarchyList = this.hierarchyListCache[index];
|
|
59
|
+
this.hierarchyCache = this.hierarchyCache.slice(0, index);
|
|
60
|
+
this.hierarchyListCache = this.hierarchyListCache.slice(0, index);
|
|
61
|
+
this.showComfirmBtn = false;
|
|
62
|
+
},
|
|
63
|
+
onClick: function onClick(item, index) {
|
|
64
|
+
this.selectIndex = index;
|
|
65
|
+
var list = deepClone(this.hierarchyList);
|
|
66
|
+
var hierarchyInfo = list[index];
|
|
67
|
+
|
|
68
|
+
if (this.showComfirmBtn) {
|
|
69
|
+
// 不存在子级
|
|
70
|
+
this.hierarchyCache.pop();
|
|
71
|
+
} else {
|
|
72
|
+
this.hierarchyListCache.push(list);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.hierarchyCache.push({
|
|
76
|
+
name: hierarchyInfo.name,
|
|
77
|
+
id: hierarchyInfo.id
|
|
78
|
+
});
|
|
79
|
+
this.getHierarchyById(hierarchyInfo.id);
|
|
80
|
+
},
|
|
81
|
+
handleConfirm: function handleConfirm() {
|
|
82
|
+
this.$emit('confirm', this.hierarchyCache);
|
|
83
|
+
},
|
|
84
|
+
handleResult: function handleResult(data) {
|
|
85
|
+
if (data.length > 0) {
|
|
86
|
+
this.selectIndex = 0;
|
|
87
|
+
this.hierarchyList = deepClone(data);
|
|
88
|
+
this.$nextTick(function () {
|
|
89
|
+
var element = document.getElementById("scrollItem");
|
|
90
|
+
|
|
91
|
+
if (element) {
|
|
92
|
+
element.scrollTop = 0;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
this.showComfirmBtn = false;
|
|
96
|
+
} else {
|
|
97
|
+
this.showComfirmBtn = true;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
getHierarchyById: function getHierarchyById(id) {
|
|
101
|
+
var _this = this;
|
|
102
|
+
|
|
103
|
+
this.loading = true;
|
|
104
|
+
this.getHierarchyList(id).then(function (array) {
|
|
105
|
+
_this.loading = false;
|
|
106
|
+
|
|
107
|
+
_this.handleResult(array || []);
|
|
108
|
+
}).catch(function (err) {
|
|
109
|
+
_this.loading = false;
|
|
110
|
+
Toast(err);
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
hierarchyReset: function hierarchyReset() {
|
|
114
|
+
if (this.hierarchyCache.length > 0) {
|
|
115
|
+
this.unitNaviBack(0);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
genSelector: function genSelector() {
|
|
119
|
+
var _this2 = this;
|
|
120
|
+
|
|
121
|
+
var h = this.$createElement;
|
|
122
|
+
return h("div", {
|
|
123
|
+
"class": bem("wrap")
|
|
124
|
+
}, [this.hierarchyCache && this.hierarchyCache.length > 0 ? h("div", {
|
|
125
|
+
"class": bem("container")
|
|
126
|
+
}, [this.hierarchyCache.map(function (item, index) {
|
|
127
|
+
return h("div", [h("div", {
|
|
128
|
+
"class": bem("icon-wrap")
|
|
129
|
+
}, [h("div", {
|
|
130
|
+
"class": bem("icon-text")
|
|
131
|
+
}, [item.name]), h(Icon, {
|
|
132
|
+
"attrs": {
|
|
133
|
+
"name": "cross"
|
|
134
|
+
},
|
|
135
|
+
"class": bem("cancel"),
|
|
136
|
+
"on": {
|
|
137
|
+
"click": function click() {
|
|
138
|
+
_this2.unitNaviBack(index);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
})])]);
|
|
142
|
+
})]) : h(), h("div", {
|
|
143
|
+
"class": bem("actions"),
|
|
144
|
+
"attrs": {
|
|
145
|
+
"id": "scrollItem"
|
|
146
|
+
}
|
|
147
|
+
}, [this.hierarchyList && this.hierarchyList.length ? this.hierarchyList.map(function (item, index) {
|
|
148
|
+
return h("div", {
|
|
149
|
+
"class": bem("actions-item"),
|
|
150
|
+
"on": {
|
|
151
|
+
"click": function click() {
|
|
152
|
+
_this2.onClick(item, index);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"style": index === _this2.selectIndex ? 'color: #3A90F6' : ''
|
|
156
|
+
}, [item.name]);
|
|
157
|
+
}) : h()]), h("div", {
|
|
158
|
+
"class": bem("button-wrap")
|
|
159
|
+
}, [this.showCancel ? h("div", {
|
|
160
|
+
"class": bem("button-cancel"),
|
|
161
|
+
"on": {
|
|
162
|
+
"click": this.handleCancel
|
|
163
|
+
}
|
|
164
|
+
}, [this.cancelText]) : h(), h("div", {
|
|
165
|
+
"class": bem("button-ok"),
|
|
166
|
+
"on": {
|
|
167
|
+
"click": this.handleConfirm
|
|
168
|
+
}
|
|
169
|
+
}, ["\u786E\u5B9A"])])]);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
render: function render(h) {
|
|
173
|
+
return h(Popup, {
|
|
174
|
+
"attrs": {
|
|
175
|
+
"value": this.showPicker,
|
|
176
|
+
"round": true,
|
|
177
|
+
"position": "bottom",
|
|
178
|
+
"closeOnPopstate": true,
|
|
179
|
+
"closeOnClickOverlay": this.maskClosable
|
|
180
|
+
},
|
|
181
|
+
"class": bem('popup')
|
|
182
|
+
}, [h("div", {
|
|
183
|
+
"class": bem()
|
|
184
|
+
}, [this.loading ? h(Loading, {
|
|
185
|
+
"class": bem('loading')
|
|
186
|
+
}) : h(), this.genSelector()])]);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
@import '../style/hairline';
|
|
3
|
+
.zt-hierarchy-select__popup {
|
|
4
|
+
&.zt-popup {
|
|
5
|
+
// height: 100%;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
.zt-hierarchy-select {
|
|
9
|
+
// height: 100%;
|
|
10
|
+
&__wrap {
|
|
11
|
+
width: 100%;
|
|
12
|
+
// height: 100%;
|
|
13
|
+
background: white;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__button-cancel {
|
|
19
|
+
text-align: center;
|
|
20
|
+
color: @hierarchy-select-cancel-color;
|
|
21
|
+
padding: @hierarchy-select-button-padding;
|
|
22
|
+
flex: 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__button-ok {
|
|
26
|
+
text-align: center;
|
|
27
|
+
color: #3A90F6;
|
|
28
|
+
padding: @hierarchy-select-button-padding;
|
|
29
|
+
flex: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__actions {
|
|
33
|
+
// height: calc(100% - 50px);
|
|
34
|
+
height: @hierarchy-select-actions-height;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__actions-item {
|
|
39
|
+
padding: @hierarchy-select-actions-item-padding;
|
|
40
|
+
text-align: center;
|
|
41
|
+
color: @hierarchy-select-actions-item-color;
|
|
42
|
+
font-size: @hierarchy-select-actions-item-font-size;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__button-wrap{
|
|
46
|
+
display: flex;
|
|
47
|
+
height: @hierarchy-select-button-height;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&__container {
|
|
51
|
+
background-color: white;
|
|
52
|
+
padding: @hierarchy-select-selected-container-padding;
|
|
53
|
+
margin: @hierarchy-select-selected-container-margin;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&__icon-text {
|
|
57
|
+
font-size: @hierarchy-select-selected-font-size;
|
|
58
|
+
line-height: @hierarchy-select-selected-line-height;
|
|
59
|
+
color: @hierarchy-select-selected-color;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__icon-wrap {
|
|
63
|
+
padding: @hierarchy-select-selected-item-padding;
|
|
64
|
+
background-color: #fff;
|
|
65
|
+
border: @hierarchy-select-selected-item-border;
|
|
66
|
+
margin: @hierarchy-select-selected-item-margin;
|
|
67
|
+
border-radius: @hierarchy-select-selected-item-border-radius;
|
|
68
|
+
display: flex;
|
|
69
|
+
float: left;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__cancel {
|
|
73
|
+
height: @hierarchy-select-selected-cancel-size;
|
|
74
|
+
width: @hierarchy-select-selected-cancel-size;
|
|
75
|
+
margin: @hierarchy-select-selected-cancel-margin;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../../style/base.less';
|
|
2
|
+
import '../../overlay/index.less';
|
|
3
|
+
import '../../info/index.less';
|
|
4
|
+
import '../../icon/index.less';
|
|
5
|
+
import '../../popup/index.less';
|
|
6
|
+
import '../../loading/index.less';
|
|
7
|
+
import '../../toast/index.less';
|
|
8
|
+
import '../index.less';
|
package/es/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import Empty from './empty';
|
|
|
23
23
|
import Field from './field';
|
|
24
24
|
import FoldDialog from './fold-dialog';
|
|
25
25
|
import Form from './form';
|
|
26
|
+
import HierarchySelect from './hierarchy-select';
|
|
26
27
|
import Icon from './icon';
|
|
27
28
|
import Image from './image';
|
|
28
29
|
import ImagePreview from './image-preview';
|
|
@@ -69,10 +70,10 @@ import Tabs from './tabs';
|
|
|
69
70
|
import Tag from './tag';
|
|
70
71
|
import Toast from './toast';
|
|
71
72
|
import Uploader from './uploader';
|
|
72
|
-
var version = '0.1.
|
|
73
|
+
var version = '0.1.61';
|
|
73
74
|
|
|
74
75
|
function install(Vue) {
|
|
75
|
-
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Toast, Uploader];
|
|
76
|
+
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Toast, Uploader];
|
|
76
77
|
components.forEach(function (item) {
|
|
77
78
|
if (item.install) {
|
|
78
79
|
Vue.use(item);
|
|
@@ -86,7 +87,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
86
87
|
install(window.Vue);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Toast, Uploader };
|
|
90
|
+
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Toast, Uploader };
|
|
90
91
|
export default {
|
|
91
92
|
install: install,
|
|
92
93
|
version: version
|
package/es/style/var.less
CHANGED
|
@@ -1008,4 +1008,24 @@
|
|
|
1008
1008
|
@foldDialog-content-color: @black;
|
|
1009
1009
|
@foldDialog-content-font-size: @font-size-lg;
|
|
1010
1010
|
@foldDialog-content-line-height: 24px;
|
|
1011
|
-
@foldDialog-button-color: @blue;
|
|
1011
|
+
@foldDialog-button-color: @blue;
|
|
1012
|
+
|
|
1013
|
+
// Hierarchy-Select
|
|
1014
|
+
@hierarchy-select-cancel-color: rgba(255, 75, 80, 1);
|
|
1015
|
+
@hierarchy-select-button-padding: 20px;
|
|
1016
|
+
@hierarchy-select-button-height: 50px;
|
|
1017
|
+
@hierarchy-select-actions-height: 350px;
|
|
1018
|
+
@hierarchy-select-actions-item-padding: 20px 0;
|
|
1019
|
+
@hierarchy-select-actions-item-color: rgba(51, 51, 51, 1);
|
|
1020
|
+
@hierarchy-select-actions-item-font-size: 15px;
|
|
1021
|
+
@hierarchy-select-selected-container-padding: 12px 20px 20px 20px;
|
|
1022
|
+
@hierarchy-select-selected-container-margin: 0 0 2px 0;
|
|
1023
|
+
@hierarchy-select-selected-font-size: 12px;
|
|
1024
|
+
@hierarchy-select-selected-line-height: 15px;
|
|
1025
|
+
@hierarchy-select-selected-color: #333333;
|
|
1026
|
+
@hierarchy-select-selected-item-padding: 8px 10px;
|
|
1027
|
+
@hierarchy-select-selected-item-border: 1px solid rgba(114, 126, 141, 1);
|
|
1028
|
+
@hierarchy-select-selected-item-margin: 8px 10px 0 0;
|
|
1029
|
+
@hierarchy-select-selected-item-border-radius: 8px;
|
|
1030
|
+
@hierarchy-select-selected-cancel-size: 12px;
|
|
1031
|
+
@hierarchy-select-selected-cancel-margin: 0 0 0 3px;
|