@10yun/cv-mobile-ui 0.5.20 → 0.5.22
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/package.json +1 -1
- package/plugins/jumps.js +57 -12
- package/plugins/lbs.js +17 -8
- package/ui-cv/components/cv-grid-item/cv-grid-item.vue +1 -1
- package/uni-ui/lib/uni-badge/uni-badge.vue +150 -1
- package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +37 -1
- package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +83 -1
- package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +122 -1
- package/uni-ui/lib/uni-calendar/uni-calendar.vue +366 -1
- package/uni-ui/lib/uni-card/uni-card.vue +124 -1
- package/uni-ui/lib/uni-col/uni-col.vue +1 -1
- package/uni-ui/lib/uni-collapse/uni-collapse.vue +135 -1
- package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +266 -1
- package/uni-ui/lib/uni-combox/uni-combox.vue +1 -1
- package/uni-ui/lib/uni-countdown/uni-countdown.vue +239 -1
- package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +487 -1
- package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +530 -1
- package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +157 -150
- package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +166 -1
- package/uni-ui/lib/uni-data-select/uni-data-select.vue +289 -1
- package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +70 -1
- package/uni-ui/lib/uni-datetime-picker/calendar.vue +629 -1
- package/uni-ui/lib/uni-datetime-picker/time-picker.vue +741 -1
- package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +847 -1
- package/uni-ui/lib/uni-drawer/uni-drawer.vue +115 -1
- package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +515 -1
- package/uni-ui/lib/uni-fab/uni-fab.vue +257 -1
- package/uni-ui/lib/uni-fav/uni-fav.vue +123 -1
- package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +642 -1
- package/uni-ui/lib/uni-file-picker/upload-file.vue +177 -1
- package/uni-ui/lib/uni-file-picker/upload-image.vue +176 -1
- package/uni-ui/lib/uni-forms/uni-forms.vue +375 -1
- package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +429 -1
- package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +129 -1
- package/uni-ui/lib/uni-grid/uni-grid.vue +115 -1
- package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +78 -1
- package/uni-ui/lib/uni-group/uni-group.vue +85 -1
- package/uni-ui/lib/uni-icons/uni-icons.vue +85 -1
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +68 -1
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +294 -1
- package/uni-ui/lib/uni-list/uni-list.vue +81 -1
- package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +77 -1
- package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +294 -1
- package/uni-ui/lib/uni-list-item/uni-list-item.vue +346 -1
- package/uni-ui/lib/uni-load-more/uni-load-more.vue +172 -1
- package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +205 -1
- package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +18 -1
- package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +331 -1
- package/uni-ui/lib/uni-number-box/uni-number-box.vue +166 -1
- package/uni-ui/lib/uni-pagination/uni-pagination.vue +323 -1
- package/uni-ui/lib/uni-popup/uni-popup.vue +1 -1
- package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +173 -1
- package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +74 -1
- package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +106 -1
- package/uni-ui/lib/uni-rate/uni-rate.vue +322 -1
- package/uni-ui/lib/uni-row/uni-row.vue +1 -1
- package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +236 -1
- package/uni-ui/lib/uni-section/uni-section.vue +109 -1
- package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +103 -1
- package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +1 -1
- package/uni-ui/lib/uni-steps/uni-steps.vue +120 -1
- package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +226 -3
- package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +167 -1
- package/uni-ui/lib/uni-table/uni-table.vue +297 -1
- package/uni-ui/lib/uni-tag/uni-tag.vue +100 -1
- package/uni-ui/lib/uni-td/uni-td.vue +78 -1
- package/uni-ui/lib/uni-th/filter-dropdown.vue +1 -1
- package/uni-ui/lib/uni-th/uni-th.vue +224 -1
- package/uni-ui/lib/uni-thead/uni-thead.vue +77 -1
- package/uni-ui/lib/uni-tr/table-checkbox.vue +79 -1
- package/uni-ui/lib/uni-tr/uni-tr.vue +135 -1
|
@@ -2,14 +2,14 @@ export default {
|
|
|
2
2
|
props: {
|
|
3
3
|
localdata: {
|
|
4
4
|
type: [Array, Object],
|
|
5
|
-
default
|
|
6
|
-
return []
|
|
5
|
+
default() {
|
|
6
|
+
return [];
|
|
7
7
|
}
|
|
8
8
|
},
|
|
9
9
|
spaceInfo: {
|
|
10
10
|
type: Object,
|
|
11
|
-
default
|
|
12
|
-
return {}
|
|
11
|
+
default() {
|
|
12
|
+
return {};
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
collection: {
|
|
@@ -62,14 +62,14 @@ export default {
|
|
|
62
62
|
},
|
|
63
63
|
value: {
|
|
64
64
|
type: [Array, String, Number],
|
|
65
|
-
default
|
|
66
|
-
return []
|
|
65
|
+
default() {
|
|
66
|
+
return [];
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
modelValue: {
|
|
70
70
|
type: [Array, String, Number],
|
|
71
|
-
default
|
|
72
|
-
return []
|
|
71
|
+
default() {
|
|
72
|
+
return [];
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
preload: {
|
|
@@ -94,11 +94,11 @@ export default {
|
|
|
94
94
|
},
|
|
95
95
|
map: {
|
|
96
96
|
type: Object,
|
|
97
|
-
default
|
|
97
|
+
default() {
|
|
98
98
|
return {
|
|
99
|
-
text:
|
|
100
|
-
value:
|
|
101
|
-
}
|
|
99
|
+
text: 'text',
|
|
100
|
+
value: 'value'
|
|
101
|
+
};
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
},
|
|
@@ -119,7 +119,7 @@ export default {
|
|
|
119
119
|
size: this.pageSize,
|
|
120
120
|
count: 0
|
|
121
121
|
}
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
123
|
},
|
|
124
124
|
computed: {
|
|
125
125
|
isLocalData() {
|
|
@@ -129,60 +129,65 @@ export default {
|
|
|
129
129
|
return this.collection.length > 0;
|
|
130
130
|
},
|
|
131
131
|
isCloudDataList() {
|
|
132
|
-
return
|
|
132
|
+
return this.isCloudData && !this.parentField && !this.selfField;
|
|
133
133
|
},
|
|
134
134
|
isCloudDataTree() {
|
|
135
|
-
return
|
|
135
|
+
return this.isCloudData && this.parentField && this.selfField;
|
|
136
136
|
},
|
|
137
137
|
dataValue() {
|
|
138
|
-
let isModelValue = Array.isArray(this.modelValue)
|
|
139
|
-
this.modelValue
|
|
138
|
+
let isModelValue = Array.isArray(this.modelValue)
|
|
139
|
+
? this.modelValue.length > 0
|
|
140
|
+
: this.modelValue !== null || this.modelValue !== undefined;
|
|
140
141
|
return isModelValue ? this.modelValue : this.value;
|
|
141
142
|
},
|
|
142
143
|
hasValue() {
|
|
143
144
|
if (typeof this.dataValue === 'number') {
|
|
144
|
-
return true
|
|
145
|
+
return true;
|
|
145
146
|
}
|
|
146
|
-
return
|
|
147
|
+
return this.dataValue != null && this.dataValue.length > 0;
|
|
147
148
|
}
|
|
148
149
|
},
|
|
149
150
|
created() {
|
|
150
|
-
this.$watch(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
151
|
+
this.$watch(
|
|
152
|
+
() => {
|
|
153
|
+
var al = [];
|
|
154
|
+
[
|
|
155
|
+
'pageCurrent',
|
|
156
|
+
'pageSize',
|
|
157
|
+
'spaceInfo',
|
|
158
|
+
'value',
|
|
159
|
+
'modelValue',
|
|
160
|
+
'localdata',
|
|
161
|
+
'collection',
|
|
162
|
+
'action',
|
|
163
|
+
'field',
|
|
164
|
+
'orderby',
|
|
165
|
+
'where',
|
|
166
|
+
'getont',
|
|
167
|
+
'getcount',
|
|
168
|
+
'gettree'
|
|
169
|
+
].forEach((key) => {
|
|
170
|
+
al.push(this[key]);
|
|
171
|
+
});
|
|
172
|
+
return al;
|
|
173
|
+
},
|
|
174
|
+
(newValue, oldValue) => {
|
|
175
|
+
let needReset = false;
|
|
176
|
+
for (let i = 2; i < newValue.length; i++) {
|
|
177
|
+
if (newValue[i] != oldValue[i]) {
|
|
178
|
+
needReset = true;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
176
181
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this.page.size = this.pageSize
|
|
182
|
+
if (newValue[0] != oldValue[0]) {
|
|
183
|
+
this.page.current = this.pageCurrent;
|
|
184
|
+
}
|
|
185
|
+
this.page.size = this.pageSize;
|
|
182
186
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
this.onPropsChange();
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
this._treeData = [];
|
|
186
191
|
},
|
|
187
192
|
methods: {
|
|
188
193
|
onPropsChange() {
|
|
@@ -316,13 +321,13 @@ export default {
|
|
|
316
321
|
let where = [];
|
|
317
322
|
let whereField = this._getForeignKeyByField();
|
|
318
323
|
if (whereField) {
|
|
319
|
-
where.push(`${whereField} == '${this.dataValue}'`)
|
|
324
|
+
where.push(`${whereField} == '${this.dataValue}'`);
|
|
320
325
|
}
|
|
321
326
|
|
|
322
327
|
where = where.join(' || ');
|
|
323
328
|
|
|
324
329
|
if (this.where) {
|
|
325
|
-
where = `(${this.where}) && (${where})
|
|
330
|
+
where = `(${this.where}) && (${where})`;
|
|
326
331
|
}
|
|
327
332
|
|
|
328
333
|
return this.getCommand({
|
|
@@ -351,47 +356,50 @@ export default {
|
|
|
351
356
|
|
|
352
357
|
getCommand(options = {}) {
|
|
353
358
|
/* eslint-disable no-undef */
|
|
354
|
-
let db = uniCloud.database(this.spaceInfo)
|
|
359
|
+
let db = uniCloud.database(this.spaceInfo);
|
|
355
360
|
|
|
356
|
-
const action = options.action || this.action
|
|
361
|
+
const action = options.action || this.action;
|
|
357
362
|
if (action) {
|
|
358
|
-
db = db.action(action)
|
|
363
|
+
db = db.action(action);
|
|
359
364
|
}
|
|
360
365
|
|
|
361
|
-
const collection = options.collection || this.collection
|
|
362
|
-
db = db.collection(collection)
|
|
366
|
+
const collection = options.collection || this.collection;
|
|
367
|
+
db = db.collection(collection);
|
|
363
368
|
|
|
364
|
-
const where = options.where || this.where
|
|
369
|
+
const where = options.where || this.where;
|
|
365
370
|
if (!(!where || !Object.keys(where).length)) {
|
|
366
|
-
db = db.where(where)
|
|
371
|
+
db = db.where(where);
|
|
367
372
|
}
|
|
368
373
|
|
|
369
|
-
const field = options.field || this.field
|
|
374
|
+
const field = options.field || this.field;
|
|
370
375
|
if (field) {
|
|
371
|
-
db = db.field(field)
|
|
376
|
+
db = db.field(field);
|
|
372
377
|
}
|
|
373
378
|
|
|
374
|
-
const orderby = options.orderby || this.orderby
|
|
379
|
+
const orderby = options.orderby || this.orderby;
|
|
375
380
|
if (orderby) {
|
|
376
|
-
db = db.orderBy(orderby)
|
|
381
|
+
db = db.orderBy(orderby);
|
|
377
382
|
}
|
|
378
383
|
|
|
379
|
-
const current = options.pageCurrent !== undefined ? options.pageCurrent : this.page.current
|
|
380
|
-
const size = options.pageSize !== undefined ? options.pageSize : this.page.size
|
|
381
|
-
const getCount = options.getcount !== undefined ? options.getcount : this.getcount
|
|
382
|
-
const getTree = options.gettree !== undefined ? options.gettree : this.gettree
|
|
384
|
+
const current = options.pageCurrent !== undefined ? options.pageCurrent : this.page.current;
|
|
385
|
+
const size = options.pageSize !== undefined ? options.pageSize : this.page.size;
|
|
386
|
+
const getCount = options.getcount !== undefined ? options.getcount : this.getcount;
|
|
387
|
+
const getTree = options.gettree !== undefined ? options.gettree : this.gettree;
|
|
383
388
|
|
|
384
389
|
const getOptions = {
|
|
385
390
|
getCount,
|
|
386
391
|
getTree
|
|
387
|
-
}
|
|
392
|
+
};
|
|
388
393
|
if (options.getTreePath) {
|
|
389
|
-
getOptions.getTreePath = options.getTreePath
|
|
394
|
+
getOptions.getTreePath = options.getTreePath;
|
|
390
395
|
}
|
|
391
396
|
|
|
392
|
-
db = db
|
|
397
|
+
db = db
|
|
398
|
+
.skip(size * (current - 1))
|
|
399
|
+
.limit(size)
|
|
400
|
+
.get(getOptions);
|
|
393
401
|
|
|
394
|
-
return db
|
|
402
|
+
return db;
|
|
395
403
|
},
|
|
396
404
|
|
|
397
405
|
_cloudDataPostField() {
|
|
@@ -403,32 +411,32 @@ export default {
|
|
|
403
411
|
},
|
|
404
412
|
|
|
405
413
|
_cloudDataTreeWhere() {
|
|
406
|
-
let result = []
|
|
407
|
-
let selected = this.selected
|
|
408
|
-
let parentField = this.parentField
|
|
414
|
+
let result = [];
|
|
415
|
+
let selected = this.selected;
|
|
416
|
+
let parentField = this.parentField;
|
|
409
417
|
if (parentField) {
|
|
410
|
-
result.push(`${parentField} == null || ${parentField} == ""`)
|
|
418
|
+
result.push(`${parentField} == null || ${parentField} == ""`);
|
|
411
419
|
}
|
|
412
420
|
if (selected.length) {
|
|
413
421
|
for (var i = 0; i < selected.length - 1; i++) {
|
|
414
|
-
result.push(`${parentField} == '${selected[i].value}'`)
|
|
422
|
+
result.push(`${parentField} == '${selected[i].value}'`);
|
|
415
423
|
}
|
|
416
424
|
}
|
|
417
425
|
|
|
418
|
-
let where = []
|
|
426
|
+
let where = [];
|
|
419
427
|
if (this.where) {
|
|
420
|
-
where.push(`(${this.where})`)
|
|
428
|
+
where.push(`(${this.where})`);
|
|
421
429
|
}
|
|
422
430
|
|
|
423
431
|
if (result.length) {
|
|
424
|
-
where.push(`(${result.join(' || ')})`)
|
|
432
|
+
where.push(`(${result.join(' || ')})`);
|
|
425
433
|
}
|
|
426
434
|
|
|
427
|
-
return where.join(' && ')
|
|
435
|
+
return where.join(' && ');
|
|
428
436
|
},
|
|
429
437
|
|
|
430
438
|
_cloudDataNodeWhere() {
|
|
431
|
-
let where = []
|
|
439
|
+
let where = [];
|
|
432
440
|
let selected = this.selected;
|
|
433
441
|
if (selected.length) {
|
|
434
442
|
where.push(`${this.parentField} == '${selected[selected.length - 1].value}'`);
|
|
@@ -437,24 +445,24 @@ export default {
|
|
|
437
445
|
where = where.join(' || ');
|
|
438
446
|
|
|
439
447
|
if (this.where) {
|
|
440
|
-
return `(${this.where}) && (${where})
|
|
448
|
+
return `(${this.where}) && (${where})`;
|
|
441
449
|
}
|
|
442
450
|
|
|
443
|
-
return where
|
|
451
|
+
return where;
|
|
444
452
|
},
|
|
445
453
|
|
|
446
454
|
_getWhereByForeignKey() {
|
|
447
|
-
let result = []
|
|
455
|
+
let result = [];
|
|
448
456
|
let whereField = this._getForeignKeyByField();
|
|
449
457
|
if (whereField) {
|
|
450
|
-
result.push(`${whereField} == '${this.dataValue}'`)
|
|
458
|
+
result.push(`${whereField} == '${this.dataValue}'`);
|
|
451
459
|
}
|
|
452
460
|
|
|
453
461
|
if (this.where) {
|
|
454
|
-
return `(${this.where}) && (${result.join(' || ')})
|
|
462
|
+
return `(${this.where}) && (${result.join(' || ')})`;
|
|
455
463
|
}
|
|
456
464
|
|
|
457
|
-
return result.join(' || ')
|
|
465
|
+
return result.join(' || ');
|
|
458
466
|
},
|
|
459
467
|
|
|
460
468
|
_getForeignKeyByField() {
|
|
@@ -474,149 +482,148 @@ export default {
|
|
|
474
482
|
},
|
|
475
483
|
|
|
476
484
|
_updateBindData(node) {
|
|
477
|
-
const {
|
|
478
|
-
dataList,
|
|
479
|
-
hasNodes
|
|
480
|
-
} = this._filterData(this._treeData, this.selected)
|
|
485
|
+
const { dataList, hasNodes } = this._filterData(this._treeData, this.selected);
|
|
481
486
|
|
|
482
|
-
let isleaf = this._stepSearh === false && !hasNodes
|
|
487
|
+
let isleaf = this._stepSearh === false && !hasNodes;
|
|
483
488
|
|
|
484
489
|
if (node) {
|
|
485
|
-
node.isleaf = isleaf
|
|
490
|
+
node.isleaf = isleaf;
|
|
486
491
|
}
|
|
487
492
|
|
|
488
|
-
this.dataList = dataList
|
|
489
|
-
this.selectedIndex = dataList.length - 1
|
|
493
|
+
this.dataList = dataList;
|
|
494
|
+
this.selectedIndex = dataList.length - 1;
|
|
490
495
|
|
|
491
496
|
if (!isleaf && this.selected.length < dataList.length) {
|
|
492
497
|
this.selected.push({
|
|
493
498
|
value: null,
|
|
494
|
-
text:
|
|
495
|
-
})
|
|
499
|
+
text: '请选择'
|
|
500
|
+
});
|
|
496
501
|
}
|
|
497
502
|
|
|
498
503
|
return {
|
|
499
504
|
isleaf,
|
|
500
505
|
hasNodes
|
|
501
|
-
}
|
|
506
|
+
};
|
|
502
507
|
},
|
|
503
508
|
|
|
504
509
|
_updateSelected() {
|
|
505
|
-
let dl = this.dataList
|
|
506
|
-
let sl = this.selected
|
|
507
|
-
let textField = this.map.text
|
|
508
|
-
let valueField = this.map.value
|
|
510
|
+
let dl = this.dataList;
|
|
511
|
+
let sl = this.selected;
|
|
512
|
+
let textField = this.map.text;
|
|
513
|
+
let valueField = this.map.value;
|
|
509
514
|
for (let i = 0; i < sl.length; i++) {
|
|
510
|
-
let value = sl[i].value
|
|
511
|
-
let dl2 = dl[i]
|
|
515
|
+
let value = sl[i].value;
|
|
516
|
+
let dl2 = dl[i];
|
|
512
517
|
for (let j = 0; j < dl2.length; j++) {
|
|
513
|
-
let item2 = dl2[j]
|
|
518
|
+
let item2 = dl2[j];
|
|
514
519
|
if (item2[valueField] === value) {
|
|
515
|
-
sl[i].text = item2[textField]
|
|
516
|
-
break
|
|
520
|
+
sl[i].text = item2[textField];
|
|
521
|
+
break;
|
|
517
522
|
}
|
|
518
523
|
}
|
|
519
524
|
}
|
|
520
525
|
},
|
|
521
526
|
|
|
522
527
|
_filterData(data, paths) {
|
|
523
|
-
let dataList = []
|
|
524
|
-
let hasNodes = true
|
|
528
|
+
let dataList = [];
|
|
529
|
+
let hasNodes = true;
|
|
525
530
|
|
|
526
|
-
dataList.push(
|
|
527
|
-
|
|
528
|
-
|
|
531
|
+
dataList.push(
|
|
532
|
+
data.filter((item) => {
|
|
533
|
+
return item.parent_value === null || item.parent_value === undefined || item.parent_value === '';
|
|
534
|
+
})
|
|
535
|
+
);
|
|
529
536
|
for (let i = 0; i < paths.length; i++) {
|
|
530
|
-
let value = paths[i].value
|
|
537
|
+
let value = paths[i].value;
|
|
531
538
|
let nodes = data.filter((item) => {
|
|
532
|
-
return item.parent_value === value
|
|
533
|
-
})
|
|
539
|
+
return item.parent_value === value;
|
|
540
|
+
});
|
|
534
541
|
|
|
535
542
|
if (nodes.length) {
|
|
536
|
-
dataList.push(nodes)
|
|
543
|
+
dataList.push(nodes);
|
|
537
544
|
} else {
|
|
538
|
-
hasNodes = false
|
|
545
|
+
hasNodes = false;
|
|
539
546
|
}
|
|
540
547
|
}
|
|
541
548
|
|
|
542
549
|
return {
|
|
543
550
|
dataList,
|
|
544
551
|
hasNodes
|
|
545
|
-
}
|
|
552
|
+
};
|
|
546
553
|
},
|
|
547
554
|
|
|
548
555
|
_extractTree(nodes, result, parent_value) {
|
|
549
|
-
let list = result || []
|
|
550
|
-
let valueField = this.map.value
|
|
556
|
+
let list = result || [];
|
|
557
|
+
let valueField = this.map.value;
|
|
551
558
|
for (let i = 0; i < nodes.length; i++) {
|
|
552
|
-
let node = nodes[i]
|
|
559
|
+
let node = nodes[i];
|
|
553
560
|
|
|
554
|
-
let child = {}
|
|
561
|
+
let child = {};
|
|
555
562
|
for (let key in node) {
|
|
556
563
|
if (key !== 'children') {
|
|
557
|
-
child[key] = node[key]
|
|
564
|
+
child[key] = node[key];
|
|
558
565
|
}
|
|
559
566
|
}
|
|
560
567
|
if (parent_value !== null && parent_value !== undefined && parent_value !== '') {
|
|
561
|
-
child.parent_value = parent_value
|
|
568
|
+
child.parent_value = parent_value;
|
|
562
569
|
}
|
|
563
|
-
result.push(child)
|
|
570
|
+
result.push(child);
|
|
564
571
|
|
|
565
|
-
let children = node.children
|
|
572
|
+
let children = node.children;
|
|
566
573
|
if (children) {
|
|
567
|
-
this._extractTree(children, result, node[valueField])
|
|
574
|
+
this._extractTree(children, result, node[valueField]);
|
|
568
575
|
}
|
|
569
576
|
}
|
|
570
577
|
},
|
|
571
578
|
|
|
572
579
|
_extractTreePath(nodes, result) {
|
|
573
|
-
let list = result || []
|
|
580
|
+
let list = result || [];
|
|
574
581
|
for (let i = 0; i < nodes.length; i++) {
|
|
575
|
-
let node = nodes[i]
|
|
582
|
+
let node = nodes[i];
|
|
576
583
|
|
|
577
|
-
let child = {}
|
|
584
|
+
let child = {};
|
|
578
585
|
for (let key in node) {
|
|
579
586
|
if (key !== 'children') {
|
|
580
|
-
child[key] = node[key]
|
|
587
|
+
child[key] = node[key];
|
|
581
588
|
}
|
|
582
589
|
}
|
|
583
|
-
result.push(child)
|
|
590
|
+
result.push(child);
|
|
584
591
|
|
|
585
|
-
let children = node.children
|
|
592
|
+
let children = node.children;
|
|
586
593
|
if (children) {
|
|
587
|
-
this._extractTreePath(children, result)
|
|
594
|
+
this._extractTreePath(children, result);
|
|
588
595
|
}
|
|
589
596
|
}
|
|
590
597
|
},
|
|
591
598
|
|
|
592
599
|
_findNodePath(key, nodes, path = []) {
|
|
593
|
-
let textField = this.map.text
|
|
594
|
-
let valueField = this.map.value
|
|
600
|
+
let textField = this.map.text;
|
|
601
|
+
let valueField = this.map.value;
|
|
595
602
|
for (let i = 0; i < nodes.length; i++) {
|
|
596
|
-
let node = nodes[i]
|
|
597
|
-
let children = node.children
|
|
598
|
-
let text = node[textField]
|
|
599
|
-
let value = node[valueField]
|
|
603
|
+
let node = nodes[i];
|
|
604
|
+
let children = node.children;
|
|
605
|
+
let text = node[textField];
|
|
606
|
+
let value = node[valueField];
|
|
600
607
|
|
|
601
608
|
path.push({
|
|
602
609
|
value,
|
|
603
610
|
text
|
|
604
|
-
})
|
|
611
|
+
});
|
|
605
612
|
|
|
606
613
|
if (value === key) {
|
|
607
|
-
return path
|
|
614
|
+
return path;
|
|
608
615
|
}
|
|
609
616
|
|
|
610
617
|
if (children) {
|
|
611
|
-
const p = this._findNodePath(key, children, path)
|
|
618
|
+
const p = this._findNodePath(key, children, path);
|
|
612
619
|
if (p.length) {
|
|
613
|
-
return p
|
|
620
|
+
return p;
|
|
614
621
|
}
|
|
615
622
|
}
|
|
616
623
|
|
|
617
|
-
path.pop()
|
|
624
|
+
path.pop();
|
|
618
625
|
}
|
|
619
|
-
return []
|
|
626
|
+
return [];
|
|
620
627
|
}
|
|
621
628
|
}
|
|
622
|
-
}
|
|
629
|
+
};
|