cbvirtua 1.0.102 → 1.0.103

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 (50) hide show
  1. package/package.json +1 -1
  2. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/.hbuilderx/launch.json +11 -0
  3. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/App.vue +17 -0
  4. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/README.md +13 -0
  5. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/code.js +408 -0
  6. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/css/icon.css +342 -0
  7. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/css/style.scss +119 -0
  8. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/search/index.vue +66 -0
  9. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/tree.vue +70 -0
  10. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/main.js +11 -0
  11. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/manifest.json +78 -0
  12. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/chooseUser/chooseUser.vue +69 -0
  13. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/chooseUser/data.js +96 -0
  14. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/index/index.vue +122 -0
  15. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages.json +25 -0
  16. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/changelog.md +80 -0
  17. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/en.json +7 -0
  18. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/index.js +8 -0
  19. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json +7 -0
  20. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json +7 -0
  21. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/keypress.js +45 -0
  22. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/popup.js +26 -0
  23. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/uni-popup.uvue +90 -0
  24. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/uni-popup.vue +496 -0
  25. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js +45 -0
  26. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue +313 -0
  27. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue +143 -0
  28. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue +187 -0
  29. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/package.json +87 -0
  30. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/readme.md +17 -0
  31. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/changelog.md +8 -0
  32. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/index.scss +1 -0
  33. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/package.json +82 -0
  34. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/readme.md +4 -0
  35. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/index.scss +7 -0
  36. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_border.scss +3 -0
  37. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_color.scss +66 -0
  38. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_radius.scss +55 -0
  39. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_space.scss +56 -0
  40. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_styles.scss +167 -0
  41. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_text.scss +24 -0
  42. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_variables.scss +146 -0
  43. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/tools/functions.scss +19 -0
  44. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/theme.scss +31 -0
  45. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/variables.scss +62 -0
  46. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/changelog.md +22 -0
  47. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/components/uni-transition/createAnimation.js +131 -0
  48. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/components/uni-transition/uni-transition.vue +286 -0
  49. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/package.json +84 -0
  50. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/readme.md +11 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbvirtua",
3
- "version": "1.0.102",
3
+ "version": "1.0.103",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,11 @@
1
+ { // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
2
+ // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
3
+ "version": "0.0",
4
+ "configurations": [{
5
+ "type": "uniCloud",
6
+ "default": {
7
+ "launchtype": "remote"
8
+ }
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,17 @@
1
+ <script>
2
+ export default {
3
+ onLaunch: function() {
4
+ // console.log('App Launch')
5
+ },
6
+ onShow: function() {
7
+ // console.log('App Show')
8
+ },
9
+ onHide: function() {
10
+ // console.log('App Hide')
11
+ }
12
+ }
13
+ </script>
14
+
15
+ <style>
16
+ /*每个页面公共css */
17
+ </style>
@@ -0,0 +1,13 @@
1
+ # xiaolu-tree-plugin
2
+ 在线预览地址:https://lsz579.github.io/xiaolu-tree-plugin/#/
3
+ 无限极树形结构选择器,树形选择器增强版,支持多选、单选、父级选择,单选支持查找路径
4
+
5
+ ## 文档地址
6
+ <a href="https://ext.dcloud.net.cn/plugin?id=2423">查看说明文档</a>
7
+
8
+ ## 效果图
9
+ <img src="https://img-blog.csdnimg.cn/2021051112360651.gif#pic_center"></img>
10
+
11
+ # 觉得好用的话,务必给start
12
+
13
+ 动态加载版(只支持单选或单纯展示数据): <a href="https://github.com/LSZ579/xiaolu-dynamic-load-tree">点击跳转</a>
@@ -0,0 +1,408 @@
1
+ import search from './search/index.vue'
2
+ /*
3
+ * 已兼容h5和小程序端,其它端没测试过,估计问题不大,只需要改一下传值的方式
4
+ *
5
+ * 如有问题可以加qq:122720267
6
+ *
7
+ * 使用该插件的朋友请给个好评,或者到git start一下
8
+ * git地址:https://github.com/LSZ579/xiaolu-tree-plugin.git
9
+ * 插件市场地址: https://ext.dcloud.net.cn/plugin?id=2423
10
+ *
11
+ */
12
+ export default {
13
+ name: "treeComponent",
14
+ data() {
15
+ return {
16
+ is_search: false,
17
+ tree: Object.freeze(this.treeNone),
18
+ newNum: 0,
19
+ oldNum: 0,
20
+ catchTreeNone: [...this.treeNone],
21
+ tree_stack: [1],
22
+ searchResult: [],
23
+ newCheckList: this.checkList,
24
+ scrollLeft: 999,
25
+ nodePathArray: []
26
+ }
27
+ },
28
+ components: {
29
+ search
30
+ },
31
+ computed: {
32
+ isSelect() {
33
+ return (item) => {
34
+ const checkList = this.newCheckList
35
+ if (checkList.length == 0) {
36
+ this.props.checkStrictly ? (item.bx = 0, item.qx = 0) : ''
37
+ return false
38
+ }
39
+ const select = checkList.some(e => item[this.keyValue] == e[this.keyValue]);
40
+ return select && !item.qx
41
+ }
42
+ },
43
+ radioSelect() {
44
+ const list = this.newCheckList
45
+ return (item) => {
46
+ return list.length > 0 && item[this.keyValue] == list[0][this.keyValue]
47
+ }
48
+ },
49
+ isActive() {
50
+ return (index) => {
51
+ return index === this.tree_stack.length - 1
52
+ }
53
+ }
54
+ },
55
+ created() {
56
+ this.Init()
57
+ },
58
+ methods: {
59
+ // 初始化
60
+ Init() {
61
+ if (this.newCheckList.length !== 0) {
62
+ let {
63
+ tree_stack,
64
+ props,
65
+ catchTreeNone,
66
+ newCheckList
67
+ } = this, index = 0, flag = props.multiple && props.checkStrictly;
68
+ flag && (index = newCheckList.length - 1);
69
+ this.getNodeRoute(catchTreeNone, newCheckList[index][this.keyValue])
70
+ let arr = this.nodePathArray.reverse()
71
+ if (arr.length == 0) return;
72
+ this.tree_stack = tree_stack.concat(arr);
73
+ this.tree = this.tree_stack[this.tree_stack.length - 1][this.props.children];
74
+ flag && this.checkAllChoose();
75
+ }
76
+ },
77
+ // 点击项目处理
78
+ handleClick(item, index) {
79
+ let children = item[this.props.children]
80
+ if (index > -1 && children && children.length > 0) {
81
+ this.toChildren(item)
82
+ } else if (this.props.multiple) {
83
+ this.checkboxChange(item, index, item.bx, item.qx)
84
+ } else {
85
+ this.checkbox(item, index)
86
+ }
87
+ },
88
+ // (tree为目标树,targetId为目标节点id)
89
+ getNodeRoutePath(tree, targetId, nodePathArray = []) {
90
+ for (let index = 0; index < tree.length; index++) {
91
+ if (tree[index][this.props.children]) {
92
+ let endRecursiveLoop = this.getNodeRoutePath(tree[index][this.props.children], targetId,
93
+ nodePathArray)
94
+ if (endRecursiveLoop) {
95
+ nodePathArray.push(tree[index])
96
+ return true
97
+ }
98
+ }
99
+ if (tree[index][this.keyValue] === targetId) {
100
+ return true
101
+ }
102
+ }
103
+ },
104
+ // 获取路径
105
+ getPath(id) {
106
+ if (!this.props.hasPath) return '';
107
+ const {
108
+ keyValue,
109
+ tree_stack,
110
+ props
111
+ } = this
112
+ if (this.is_search) {
113
+ // 搜索情况下,无法获取完整的路径,如果需要获取,则只能通过完整的树去查找
114
+ let path = []
115
+ this.getNodeRoutePath(this.catchTreeNone, id, path)
116
+ console.log(path)
117
+ return path.reverse();
118
+ }
119
+ const path = [...tree_stack].map(e => {
120
+ const item = Object.assign({}, e)
121
+ delete item[props.child]
122
+ return item
123
+ })
124
+ return path.slice(1, path.length) || []
125
+ },
126
+ //多选
127
+ async checkboxChange(item, index, bx, qx) {
128
+ let that = this;
129
+ const {
130
+ props
131
+ } = that
132
+ if (!props.multiple) return;
133
+ let findIdex = that.newCheckList.findIndex(e => item[this.keyValue] == e[this.keyValue]);
134
+ const path = this.getPath(item[this.keyValue])
135
+ if (findIdex > -1) { //反选
136
+ if (props.checkStrictly) { //关联子级
137
+ if (item.user) { //用户
138
+ that.newCheckList.splice(findIdex, 1)
139
+ } else { //非用户,取消所有下一级
140
+ that.getIdBydelete(item[this.props.children])
141
+ }
142
+ } else {
143
+ that.newCheckList.splice(findIdex, 1)
144
+ }
145
+ // if (props.checkStrictly && !item.user) { //关联子级 非用户,取消所有下一级
146
+ // item.qx = item.bx = 0
147
+ // that.getIdBydelete(item[this.props.children])
148
+ // }
149
+ } else { //选中
150
+ if (!item.user && props.checkStrictly) { //选中下一级
151
+ if (qx || bx) { //取消下级
152
+ await that.getIdBydelete(item[this.props.children]);
153
+ item.qx = item.bx = 0
154
+ that.newCheckList.splice(findIdex, 1)
155
+ } else {
156
+ item.qx = 1;
157
+ item.bx = 0;
158
+ const {
159
+ id,
160
+ name,
161
+ user
162
+ } = item
163
+ const newObj = {
164
+ id,
165
+ name,
166
+ user
167
+ }
168
+ const pathList = this.tree_stack.length === 1 ? [newObj, ...path] : [...path, newObj]
169
+ await that.chooseChild(item[this.props.children], pathList);
170
+ // that.newCheckList.push({
171
+ // ...item,
172
+ // paths
173
+ // });
174
+ }
175
+ this.$forceUpdate()
176
+ return
177
+ }
178
+ that.newCheckList.push({
179
+ ...item,
180
+ path
181
+ });
182
+ }
183
+ },
184
+ // 取消下一级的选中
185
+ getIdBydelete(arr) {
186
+ arr.forEach(e => {
187
+ if (e.user) {
188
+ for (var i = 0; i < this.newCheckList.length; i++) {
189
+ if (e[this.keyValue] == this.newCheckList[i][this.keyValue]) {
190
+ this.newCheckList.splice(i, 1)
191
+ break;
192
+ }
193
+ }
194
+ } else {
195
+ this.getIdBydelete(e[this.props.children])
196
+ }
197
+ })
198
+ },
199
+
200
+ // 关联下一级,选中
201
+ chooseChild(arr, path) {
202
+ let that = this;
203
+ const oldPath = [...path]
204
+ for (var i = 0, len = arr.length; i < len; i++) {
205
+ let item = arr[i];
206
+ if (item.user) {
207
+ that.newCheckList.push({
208
+ ...item,
209
+ path: oldPath
210
+ })
211
+ } else {
212
+ const newItem = {
213
+ ...item
214
+ }
215
+ delete newItem[that.props.children]
216
+ const newPath = [...oldPath, newItem]
217
+ that.chooseChild(item[this.props.children], newPath)
218
+ }
219
+ }
220
+ },
221
+
222
+ // (tree为目标树,targetId为目标节点id)
223
+ getNodeRoute(tree, targetId) {
224
+ for (let index = 0; index < tree.length; index++) {
225
+ if (tree[index][this.props.children]) {
226
+ let endRecursiveLoop = this.getNodeRoute(tree[index][this.props.children], targetId)
227
+ if (endRecursiveLoop) {
228
+ this.nodePathArray.push(tree[index])
229
+ return true
230
+ }
231
+ }
232
+ if (tree[index][this.keyValue] === targetId) {
233
+ return true
234
+ }
235
+ }
236
+ },
237
+
238
+ //单选
239
+ checkbox(item, index) {
240
+ const path = this.getPath(item[this.keyValue])
241
+ this.$set(this, 'newCheckList', [{
242
+ ...item,
243
+ path
244
+ }])
245
+ },
246
+ //到下一级
247
+ toChildren(item) {
248
+ if (item.user) return
249
+ var that = this;
250
+ uni.showLoading({
251
+ title: '加载中'
252
+ })
253
+ let children = that.props.children;
254
+ if (!item.user && item[children].length > 0 && !(that.tree_stack[0][this.keyValue] == item[this
255
+ .keyValue])) {
256
+ that.tree = item[children];
257
+ that.tree_stack.push(item);
258
+ }
259
+ this.$nextTick(() => {
260
+ uni.hideLoading()
261
+ this.scrollLeft += 200;
262
+ })
263
+ if (this.props.checkStrictly) this.checkAllChoose();
264
+ },
265
+ //搜索
266
+ confirmSearch(val) {
267
+ this.searchResult = []
268
+ this.search(this.catchTreeNone, val)
269
+ this.is_search = true
270
+ this.tree_stack.splice(1, 1000)
271
+ uni.showLoading({
272
+ title: '正在查找'
273
+ })
274
+ setTimeout(() => {
275
+ this.tree = this.searchResult
276
+ if (this.props.checkStrictly) this.checkAllChoose();
277
+ uni.hideLoading()
278
+ }, 300)
279
+ },
280
+ search(data, keyword) {
281
+ let that = this
282
+ let {
283
+ label,
284
+ children
285
+ } = that.props
286
+ for (var i = 0, len = data.length; i < len; i++) {
287
+ if (data[i][label].indexOf(keyword) >= 0) {
288
+ that.searchResult.push(data[i])
289
+ }
290
+ if (!data[i].user && data[i][children].length > 0) {
291
+ that.search(data[i][children], keyword)
292
+ }
293
+ }
294
+ },
295
+ checkAllChoose() {
296
+ this.tree.forEach((e, i) => {
297
+ if (!e.user) {
298
+ e.qx = e.bx = false;
299
+ this.computAllNumber(e.children);
300
+ // console.log(this.newNum,this.oldNum)
301
+ if (this.newNum != 0 && this.oldNum != 0) {
302
+ e.qx = this.newNum == this.oldNum
303
+ e.bx = !e.qx
304
+ }
305
+ if (this.newNum != 0 && this.oldNum == 0) {
306
+ this.$set(this.tree[i], 'bx', false);
307
+ this.$set(this.tree[i], 'qx', false);
308
+ }
309
+ this.$forceUpdate()
310
+ this.newNum = this.oldNum = 0
311
+ }
312
+ })
313
+ },
314
+ computAllNumber(arr) {
315
+ for (let j = 0; j < arr.length; j++) {
316
+ var e = arr[j];
317
+ this.checkSum(e[this.keyValue])
318
+ if (e.user) {
319
+ this.newNum++;
320
+ } else {
321
+ this.computAllNumber(e.children)
322
+ }
323
+ }
324
+ },
325
+ checkSum(id) {
326
+ for (let i = 0; i < this.newCheckList.length; i++) {
327
+ if (id == this.newCheckList[i][this.keyValue]) {
328
+ this.oldNum++;
329
+ break
330
+ }
331
+ }
332
+ },
333
+ //返回其它层
334
+ backTree(item, index) {
335
+ let that = this,
336
+ tree_stack = that.tree_stack,
337
+ max = 300;
338
+ if (index === -1) {
339
+ that.tree = that.catchTreeNone
340
+ that.tree_stack.splice(1, max)
341
+ that.is_search = false
342
+ that.$refs.sea?.clears()
343
+ } else if (index === -2) { //搜索
344
+ that.tree = that.searchResult
345
+ that.tree_stack.splice(1, max)
346
+ } else {
347
+ if (tree_stack.length - index > 2) {
348
+ that.tree_stack.splice(index + 1, max)
349
+ } else if (index !== tree_stack.length - 1) {
350
+ that.tree_stack.splice(tree_stack.length - 1, 1)
351
+ }
352
+ that.tree = item[that.props.children]
353
+ }
354
+ if (this.props.checkStrictly) this.checkAllChoose();
355
+ this.$forceUpdate()
356
+ },
357
+ backConfirm() {
358
+ this.$emit('sendValue', this.newCheckList, 'back')
359
+ }
360
+ },
361
+ props: {
362
+ // 树形数据源
363
+ treeNone: {
364
+ type: Array,
365
+ default: () => {
366
+ return []
367
+ }
368
+ },
369
+ //是否开启选中
370
+ isCheck: {
371
+ type: Boolean,
372
+ default: () => {
373
+ return false
374
+ }
375
+ },
376
+ // 弹出模式时需传的列表滚动高度
377
+ scrollHeight: {
378
+ type: String,
379
+ default: '',
380
+ },
381
+ // 选中的值的 必传[{[keyValue]:value}]
382
+ checkList: {
383
+ type: Array,
384
+ default: () => []
385
+ },
386
+ searchIf: {
387
+ type: Boolean,
388
+ default: () => true
389
+ },
390
+ // 默认key
391
+ keyValue: {
392
+ type: String,
393
+ default: 'id',
394
+ },
395
+ props: {
396
+ type: Object,
397
+ default: () => {
398
+ return {
399
+ label: 'name',
400
+ children: 'children',
401
+ multiple: false,
402
+ checkStrictly: false, //不关联
403
+ hasPath: false, //返回值是否都带路径
404
+ }
405
+ }
406
+ }
407
+ },
408
+ }