bkui-vue 0.0.2-beta.93 → 0.0.2-beta.94
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/dist/index.cjs.js +28 -28
- package/dist/index.esm.js +4874 -4808
- package/dist/index.umd.js +28 -28
- package/lib/plugin-popover/index.js +277 -93
- package/lib/popover/index.js +277 -93
- package/lib/shared/index.js +275 -91
- package/lib/table/components/table-column.d.ts +1 -0
- package/lib/table/index.d.ts +50 -0
- package/lib/table/index.js +300 -104
- package/lib/table-column/index.d.ts +150 -0
- package/lib/table-column/index.js +15 -6
- package/lib/tree/index.d.ts +9 -15
- package/lib/tree/index.js +297 -102
- package/lib/tree/props.d.ts +2 -4
- package/lib/tree/tree.d.ts +5 -9
- package/lib/tree/util.d.ts +1 -0
- package/package.json +1 -1
package/lib/tree/index.js
CHANGED
@@ -6,8 +6,274 @@ import * as __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__ from "vue-types";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__exception_12c197e0__ from "../exception";
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__checkbox_a57bcb84__ from "../checkbox";
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__ from "../icon";
|
9
|
-
/******/
|
10
|
-
|
9
|
+
/******/ var __webpack_modules__ = ({
|
10
|
+
|
11
|
+
/***/ 8022:
|
12
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
13
|
+
|
14
|
+
var v1 = __webpack_require__(4481);
|
15
|
+
var v4 = __webpack_require__(6426);
|
16
|
+
|
17
|
+
var uuid = v4;
|
18
|
+
uuid.v1 = v1;
|
19
|
+
uuid.v4 = v4;
|
20
|
+
|
21
|
+
module.exports = uuid;
|
22
|
+
|
23
|
+
|
24
|
+
/***/ }),
|
25
|
+
|
26
|
+
/***/ 8725:
|
27
|
+
/***/ ((module) => {
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
31
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
32
|
+
*/
|
33
|
+
var byteToHex = [];
|
34
|
+
for (var i = 0; i < 256; ++i) {
|
35
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
36
|
+
}
|
37
|
+
|
38
|
+
function bytesToUuid(buf, offset) {
|
39
|
+
var i = offset || 0;
|
40
|
+
var bth = byteToHex;
|
41
|
+
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
42
|
+
return ([
|
43
|
+
bth[buf[i++]], bth[buf[i++]],
|
44
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
45
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
46
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
47
|
+
bth[buf[i++]], bth[buf[i++]], '-',
|
48
|
+
bth[buf[i++]], bth[buf[i++]],
|
49
|
+
bth[buf[i++]], bth[buf[i++]],
|
50
|
+
bth[buf[i++]], bth[buf[i++]]
|
51
|
+
]).join('');
|
52
|
+
}
|
53
|
+
|
54
|
+
module.exports = bytesToUuid;
|
55
|
+
|
56
|
+
|
57
|
+
/***/ }),
|
58
|
+
|
59
|
+
/***/ 9157:
|
60
|
+
/***/ ((module) => {
|
61
|
+
|
62
|
+
// Unique ID creation requires a high quality random # generator. In the
|
63
|
+
// browser this is a little complicated due to unknown quality of Math.random()
|
64
|
+
// and inconsistent support for the `crypto` API. We do the best we can via
|
65
|
+
// feature-detection
|
66
|
+
|
67
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto
|
68
|
+
// implementation. Also, find the complete implementation of crypto on IE11.
|
69
|
+
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
|
70
|
+
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
|
71
|
+
|
72
|
+
if (getRandomValues) {
|
73
|
+
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
|
74
|
+
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
|
75
|
+
|
76
|
+
module.exports = function whatwgRNG() {
|
77
|
+
getRandomValues(rnds8);
|
78
|
+
return rnds8;
|
79
|
+
};
|
80
|
+
} else {
|
81
|
+
// Math.random()-based (RNG)
|
82
|
+
//
|
83
|
+
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
84
|
+
// quality.
|
85
|
+
var rnds = new Array(16);
|
86
|
+
|
87
|
+
module.exports = function mathRNG() {
|
88
|
+
for (var i = 0, r; i < 16; i++) {
|
89
|
+
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
90
|
+
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
91
|
+
}
|
92
|
+
|
93
|
+
return rnds;
|
94
|
+
};
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
/***/ }),
|
99
|
+
|
100
|
+
/***/ 4481:
|
101
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
102
|
+
|
103
|
+
var rng = __webpack_require__(9157);
|
104
|
+
var bytesToUuid = __webpack_require__(8725);
|
105
|
+
|
106
|
+
// **`v1()` - Generate time-based UUID**
|
107
|
+
//
|
108
|
+
// Inspired by https://github.com/LiosK/UUID.js
|
109
|
+
// and http://docs.python.org/library/uuid.html
|
110
|
+
|
111
|
+
var _nodeId;
|
112
|
+
var _clockseq;
|
113
|
+
|
114
|
+
// Previous uuid creation time
|
115
|
+
var _lastMSecs = 0;
|
116
|
+
var _lastNSecs = 0;
|
117
|
+
|
118
|
+
// See https://github.com/uuidjs/uuid for API details
|
119
|
+
function v1(options, buf, offset) {
|
120
|
+
var i = buf && offset || 0;
|
121
|
+
var b = buf || [];
|
122
|
+
|
123
|
+
options = options || {};
|
124
|
+
var node = options.node || _nodeId;
|
125
|
+
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
126
|
+
|
127
|
+
// node and clockseq need to be initialized to random values if they're not
|
128
|
+
// specified. We do this lazily to minimize issues related to insufficient
|
129
|
+
// system entropy. See #189
|
130
|
+
if (node == null || clockseq == null) {
|
131
|
+
var seedBytes = rng();
|
132
|
+
if (node == null) {
|
133
|
+
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
134
|
+
node = _nodeId = [
|
135
|
+
seedBytes[0] | 0x01,
|
136
|
+
seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
|
137
|
+
];
|
138
|
+
}
|
139
|
+
if (clockseq == null) {
|
140
|
+
// Per 4.2.2, randomize (14 bit) clockseq
|
141
|
+
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
146
|
+
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
147
|
+
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
148
|
+
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
149
|
+
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
|
150
|
+
|
151
|
+
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
152
|
+
// cycle to simulate higher resolution clock
|
153
|
+
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
154
|
+
|
155
|
+
// Time since last uuid creation (in msecs)
|
156
|
+
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
157
|
+
|
158
|
+
// Per 4.2.1.2, Bump clockseq on clock regression
|
159
|
+
if (dt < 0 && options.clockseq === undefined) {
|
160
|
+
clockseq = clockseq + 1 & 0x3fff;
|
161
|
+
}
|
162
|
+
|
163
|
+
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
164
|
+
// time interval
|
165
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
166
|
+
nsecs = 0;
|
167
|
+
}
|
168
|
+
|
169
|
+
// Per 4.2.1.2 Throw error if too many uuids are requested
|
170
|
+
if (nsecs >= 10000) {
|
171
|
+
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
172
|
+
}
|
173
|
+
|
174
|
+
_lastMSecs = msecs;
|
175
|
+
_lastNSecs = nsecs;
|
176
|
+
_clockseq = clockseq;
|
177
|
+
|
178
|
+
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
179
|
+
msecs += 12219292800000;
|
180
|
+
|
181
|
+
// `time_low`
|
182
|
+
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
183
|
+
b[i++] = tl >>> 24 & 0xff;
|
184
|
+
b[i++] = tl >>> 16 & 0xff;
|
185
|
+
b[i++] = tl >>> 8 & 0xff;
|
186
|
+
b[i++] = tl & 0xff;
|
187
|
+
|
188
|
+
// `time_mid`
|
189
|
+
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
190
|
+
b[i++] = tmh >>> 8 & 0xff;
|
191
|
+
b[i++] = tmh & 0xff;
|
192
|
+
|
193
|
+
// `time_high_and_version`
|
194
|
+
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
195
|
+
b[i++] = tmh >>> 16 & 0xff;
|
196
|
+
|
197
|
+
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
198
|
+
b[i++] = clockseq >>> 8 | 0x80;
|
199
|
+
|
200
|
+
// `clock_seq_low`
|
201
|
+
b[i++] = clockseq & 0xff;
|
202
|
+
|
203
|
+
// `node`
|
204
|
+
for (var n = 0; n < 6; ++n) {
|
205
|
+
b[i + n] = node[n];
|
206
|
+
}
|
207
|
+
|
208
|
+
return buf ? buf : bytesToUuid(b);
|
209
|
+
}
|
210
|
+
|
211
|
+
module.exports = v1;
|
212
|
+
|
213
|
+
|
214
|
+
/***/ }),
|
215
|
+
|
216
|
+
/***/ 6426:
|
217
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
218
|
+
|
219
|
+
var rng = __webpack_require__(9157);
|
220
|
+
var bytesToUuid = __webpack_require__(8725);
|
221
|
+
|
222
|
+
function v4(options, buf, offset) {
|
223
|
+
var i = buf && offset || 0;
|
224
|
+
|
225
|
+
if (typeof(options) == 'string') {
|
226
|
+
buf = options === 'binary' ? new Array(16) : null;
|
227
|
+
options = null;
|
228
|
+
}
|
229
|
+
options = options || {};
|
230
|
+
|
231
|
+
var rnds = options.random || (options.rng || rng)();
|
232
|
+
|
233
|
+
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
234
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
235
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
236
|
+
|
237
|
+
// Copy bytes to buffer, if provided
|
238
|
+
if (buf) {
|
239
|
+
for (var ii = 0; ii < 16; ++ii) {
|
240
|
+
buf[i + ii] = rnds[ii];
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
return buf || bytesToUuid(rnds);
|
245
|
+
}
|
246
|
+
|
247
|
+
module.exports = v4;
|
248
|
+
|
249
|
+
|
250
|
+
/***/ })
|
251
|
+
|
252
|
+
/******/ });
|
253
|
+
/************************************************************************/
|
254
|
+
/******/ // The module cache
|
255
|
+
/******/ var __webpack_module_cache__ = {};
|
256
|
+
/******/
|
257
|
+
/******/ // The require function
|
258
|
+
/******/ function __webpack_require__(moduleId) {
|
259
|
+
/******/ // Check if module is in cache
|
260
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
261
|
+
/******/ if (cachedModule !== undefined) {
|
262
|
+
/******/ return cachedModule.exports;
|
263
|
+
/******/ }
|
264
|
+
/******/ // Create a new module (and put it into the cache)
|
265
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
266
|
+
/******/ // no module.id needed
|
267
|
+
/******/ // no module.loaded needed
|
268
|
+
/******/ exports: {}
|
269
|
+
/******/ };
|
270
|
+
/******/
|
271
|
+
/******/ // Execute the module function
|
272
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
273
|
+
/******/
|
274
|
+
/******/ // Return the exports of the module
|
275
|
+
/******/ return module.exports;
|
276
|
+
/******/ }
|
11
277
|
/******/
|
12
278
|
/************************************************************************/
|
13
279
|
/******/ /* webpack/runtime/define property getters */
|
@@ -29,6 +295,8 @@ import * as __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__ from "../icon";
|
|
29
295
|
/******/
|
30
296
|
/************************************************************************/
|
31
297
|
var __webpack_exports__ = {};
|
298
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
299
|
+
(() => {
|
32
300
|
|
33
301
|
// EXPORTS
|
34
302
|
__webpack_require__.d(__webpack_exports__, {
|
@@ -317,7 +585,7 @@ var treeProps = {
|
|
317
585
|
/**
|
318
586
|
* 是否支持多选
|
319
587
|
*/
|
320
|
-
showCheckbox: external_shared_namespaceObject.PropTypes.bool.def(false),
|
588
|
+
showCheckbox: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.bool, external_shared_namespaceObject.PropTypes.func]).def(false),
|
321
589
|
checked: external_shared_namespaceObject.PropTypes.arrayOf(external_shared_namespaceObject.PropTypes.any).def([]),
|
322
590
|
/**
|
323
591
|
* 是否显示节点类型Icon
|
@@ -905,6 +1173,12 @@ var resolvePropIsMatched = function resolvePropIsMatched(node, prop, id) {
|
|
905
1173
|
}
|
906
1174
|
return node === prop;
|
907
1175
|
};
|
1176
|
+
var showCheckbox = function showCheckbox(props, node) {
|
1177
|
+
if (typeof props.showCheckbox === 'function') {
|
1178
|
+
return props.showCheckbox(node);
|
1179
|
+
}
|
1180
|
+
return props.showCheckbox;
|
1181
|
+
};
|
908
1182
|
;// CONCATENATED MODULE: ../../packages/tree/src/use-node-async.tsx
|
909
1183
|
|
910
1184
|
/*
|
@@ -1220,7 +1494,7 @@ var use_node_action_this = undefined;
|
|
1220
1494
|
return isNodeChecked(item) && getNodeAttr(item, NODE_ATTRIBUTES.IS_INDETERMINATE);
|
1221
1495
|
};
|
1222
1496
|
var getCheckboxRender = function getCheckboxRender(item) {
|
1223
|
-
if (!props
|
1497
|
+
if (!showCheckbox(props, extendNodeScopedData(item))) {
|
1224
1498
|
return null;
|
1225
1499
|
}
|
1226
1500
|
return (0,external_vue_namespaceObject.createVNode)("span", {
|
@@ -1847,94 +2121,8 @@ var use_search_this = undefined;
|
|
1847
2121
|
showChildNodes: showChildNodes
|
1848
2122
|
};
|
1849
2123
|
});
|
1850
|
-
|
1851
|
-
|
1852
|
-
/* harmony default export */ const esm_browser_native = ({
|
1853
|
-
randomUUID
|
1854
|
-
});
|
1855
|
-
;// CONCATENATED MODULE: ../../node_modules/uuid/dist/esm-browser/rng.js
|
1856
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
1857
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
1858
|
-
// generators (like Math.random()).
|
1859
|
-
let getRandomValues;
|
1860
|
-
const rnds8 = new Uint8Array(16);
|
1861
|
-
function rng() {
|
1862
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
1863
|
-
if (!getRandomValues) {
|
1864
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
1865
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
1866
|
-
|
1867
|
-
if (!getRandomValues) {
|
1868
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
1869
|
-
}
|
1870
|
-
}
|
1871
|
-
|
1872
|
-
return getRandomValues(rnds8);
|
1873
|
-
}
|
1874
|
-
;// CONCATENATED MODULE: ../../node_modules/uuid/dist/esm-browser/stringify.js
|
1875
|
-
|
1876
|
-
/**
|
1877
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
1878
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
1879
|
-
*/
|
1880
|
-
|
1881
|
-
const byteToHex = [];
|
1882
|
-
|
1883
|
-
for (let i = 0; i < 256; ++i) {
|
1884
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
1885
|
-
}
|
1886
|
-
|
1887
|
-
function unsafeStringify(arr, offset = 0) {
|
1888
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
1889
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
1890
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
1891
|
-
}
|
1892
|
-
|
1893
|
-
function stringify(arr, offset = 0) {
|
1894
|
-
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
|
1895
|
-
// of the following:
|
1896
|
-
// - One or more input array values don't map to a hex octet (leading to
|
1897
|
-
// "undefined" in the uuid)
|
1898
|
-
// - Invalid input values for the RFC `version` or `variant` fields
|
1899
|
-
|
1900
|
-
if (!validate(uuid)) {
|
1901
|
-
throw TypeError('Stringified UUID is invalid');
|
1902
|
-
}
|
1903
|
-
|
1904
|
-
return uuid;
|
1905
|
-
}
|
1906
|
-
|
1907
|
-
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
|
1908
|
-
;// CONCATENATED MODULE: ../../node_modules/uuid/dist/esm-browser/v4.js
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
function v4(options, buf, offset) {
|
1914
|
-
if (esm_browser_native.randomUUID && !buf && !options) {
|
1915
|
-
return esm_browser_native.randomUUID();
|
1916
|
-
}
|
1917
|
-
|
1918
|
-
options = options || {};
|
1919
|
-
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
1920
|
-
|
1921
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
1922
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
1923
|
-
|
1924
|
-
if (buf) {
|
1925
|
-
offset = offset || 0;
|
1926
|
-
|
1927
|
-
for (let i = 0; i < 16; ++i) {
|
1928
|
-
buf[offset + i] = rnds[i];
|
1929
|
-
}
|
1930
|
-
|
1931
|
-
return buf;
|
1932
|
-
}
|
1933
|
-
|
1934
|
-
return unsafeStringify(rnds);
|
1935
|
-
}
|
1936
|
-
|
1937
|
-
/* harmony default export */ const esm_browser_v4 = (v4);
|
2124
|
+
// EXTERNAL MODULE: ../../node_modules/uuid/index.js
|
2125
|
+
var uuid = __webpack_require__(8022);
|
1938
2126
|
;// CONCATENATED MODULE: ../../packages/tree/src/use-tree-init.tsx
|
1939
2127
|
|
1940
2128
|
|
@@ -2012,9 +2200,9 @@ var use_tree_init_this = undefined;
|
|
2012
2200
|
function getUid(item) {
|
2013
2201
|
var uid = null;
|
2014
2202
|
if (typeof props.nodeKey === 'string') {
|
2015
|
-
uid = item[props.nodeKey] ||
|
2203
|
+
uid = item[props.nodeKey] || (0,uuid.v4)();
|
2016
2204
|
}
|
2017
|
-
return uid || item[NODE_ATTRIBUTES.UUID] ||
|
2205
|
+
return uid || item[NODE_ATTRIBUTES.UUID] || (0,uuid.v4)();
|
2018
2206
|
}
|
2019
2207
|
/**
|
2020
2208
|
* 默认设置
|
@@ -2089,8 +2277,12 @@ var use_tree_init_this = undefined;
|
|
2089
2277
|
var isParentOpened = treeSchema.has(parent) ? (_treeSchema$get = treeSchema.get(parent)) === null || _treeSchema$get === void 0 ? void 0 : _treeSchema$get[NODE_ATTRIBUTES.IS_OPEN] : true;
|
2090
2278
|
return isItemOpened && isParentOpened;
|
2091
2279
|
}
|
2092
|
-
function isCheckedNode(node, uuid) {
|
2093
|
-
|
2280
|
+
function isCheckedNode(node, uuid, attributes) {
|
2281
|
+
var isChecked = showCheckbox(props, {
|
2282
|
+
data: node,
|
2283
|
+
attributes: attributes
|
2284
|
+
});
|
2285
|
+
if (!isChecked) {
|
2094
2286
|
return false;
|
2095
2287
|
}
|
2096
2288
|
var isMatch = resolvePropIsMatched(node, props.checked, uuid);
|
@@ -2118,7 +2310,7 @@ var use_tree_init_this = undefined;
|
|
2118
2310
|
flatten(item, depth, parent, path);
|
2119
2311
|
} else {
|
2120
2312
|
if (_typeof(item) === 'object' && item !== null) {
|
2121
|
-
var
|
2313
|
+
var _attributes;
|
2122
2314
|
var currentPath = path !== null ? "".concat(path, "-").concat(i) : "".concat(i);
|
2123
2315
|
var uuid = "".concat(getUid(item));
|
2124
2316
|
var hasChildren = !!(item[children] || []).length;
|
@@ -2140,13 +2332,14 @@ var use_tree_init_this = undefined;
|
|
2140
2332
|
*/
|
2141
2333
|
isOpened = isNodeOpend(uuid, item, parent);
|
2142
2334
|
}
|
2143
|
-
var
|
2144
|
-
|
2335
|
+
var attributes = (_attributes = {}, _defineProperty(_attributes, NODE_ATTRIBUTES.DEPTH, depth), _defineProperty(_attributes, NODE_ATTRIBUTES.INDEX, i), _defineProperty(_attributes, NODE_ATTRIBUTES.UUID, uuid), _defineProperty(_attributes, NODE_ATTRIBUTES.PARENT, parent), _defineProperty(_attributes, NODE_ATTRIBUTES.HAS_CHILD, hasChildren), _defineProperty(_attributes, NODE_ATTRIBUTES.PATH, currentPath), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_ROOT, parent === null), _defineProperty(_attributes, NODE_ATTRIBUTES.ORDER, order), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_SELECTED, isCachedTreeNodeSelected(uuid, item)), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_MATCH, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_MATCH)), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_OPEN, isOpened), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_CHECKED, undefined), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_CACHED, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_CACHED)), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_ASYNC, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_ASYNC)), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_LOADING, getCachedTreeNodeAttr(uuid, item, NODE_ATTRIBUTES.IS_LOADING)), _defineProperty(_attributes, NODE_ATTRIBUTES.IS_INDETERMINATE, false), _attributes);
|
2336
|
+
attributes[NODE_ATTRIBUTES.IS_CHECKED] = isCheckedNode(item, uuid, attributes);
|
2337
|
+
if (attributes[NODE_ATTRIBUTES.IS_CHECKED]) {
|
2145
2338
|
checkedList.push(item);
|
2146
2339
|
}
|
2147
|
-
treeSchema.set(item,
|
2148
|
-
order += 1;
|
2340
|
+
treeSchema.set(item, attributes);
|
2149
2341
|
outputData.push(item);
|
2342
|
+
order += 1;
|
2150
2343
|
if (Object.prototype.hasOwnProperty.call(item, children)) {
|
2151
2344
|
flatten(item[children] || [], depth + 1, item, currentPath);
|
2152
2345
|
}
|
@@ -2155,7 +2348,7 @@ var use_tree_init_this = undefined;
|
|
2155
2348
|
}
|
2156
2349
|
}
|
2157
2350
|
flatten(treeData !== null && treeData !== void 0 ? treeData : data);
|
2158
|
-
if (props.showCheckbox) {
|
2351
|
+
if (props.showCheckbox !== false) {
|
2159
2352
|
checkedList === null || checkedList === void 0 ? void 0 : checkedList.forEach(function (value) {
|
2160
2353
|
loopUpdateNodeAttr(value, NODE_ATTRIBUTES.IS_CHECKED, true, loopUpdateCheckedEvent);
|
2161
2354
|
});
|
@@ -2514,5 +2707,7 @@ var use_tree_init_this = undefined;
|
|
2514
2707
|
|
2515
2708
|
var BkTree = (0,external_shared_namespaceObject.withInstall)(tree);
|
2516
2709
|
/* harmony default export */ const src = (BkTree);
|
2710
|
+
})();
|
2711
|
+
|
2517
2712
|
var __webpack_exports__default = __webpack_exports__.Z;
|
2518
2713
|
export { __webpack_exports__default as default };
|
package/lib/tree/props.d.ts
CHANGED
@@ -150,10 +150,8 @@ export declare const treeProps: {
|
|
150
150
|
/**
|
151
151
|
* 是否支持多选
|
152
152
|
*/
|
153
|
-
showCheckbox: import("vue-types").
|
154
|
-
default:
|
155
|
-
} & {
|
156
|
-
default: boolean;
|
153
|
+
showCheckbox: import("vue-types").VueTypeDef<any> & {
|
154
|
+
default: any;
|
157
155
|
};
|
158
156
|
checked: import("vue-types").VueTypeDef<any[]> & {
|
159
157
|
default: () => any[];
|
package/lib/tree/tree.d.ts
CHANGED
@@ -81,10 +81,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
81
81
|
} & {
|
82
82
|
default: boolean;
|
83
83
|
};
|
84
|
-
showCheckbox: import("vue-types").
|
85
|
-
default:
|
86
|
-
} & {
|
87
|
-
default: boolean;
|
84
|
+
showCheckbox: import("vue-types").VueTypeDef<any> & {
|
85
|
+
default: any;
|
88
86
|
};
|
89
87
|
checked: import("vue-types").VueTypeDef<any[]> & {
|
90
88
|
default: () => any[];
|
@@ -212,10 +210,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
212
210
|
} & {
|
213
211
|
default: boolean;
|
214
212
|
};
|
215
|
-
showCheckbox: import("vue-types").
|
216
|
-
default:
|
217
|
-
} & {
|
218
|
-
default: boolean;
|
213
|
+
showCheckbox: import("vue-types").VueTypeDef<any> & {
|
214
|
+
default: any;
|
219
215
|
};
|
220
216
|
checked: import("vue-types").VueTypeDef<any[]> & {
|
221
217
|
default: () => any[];
|
@@ -285,7 +281,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
285
281
|
dragSort: boolean;
|
286
282
|
selectable: any;
|
287
283
|
disabledFolderSelectable: boolean;
|
288
|
-
showCheckbox:
|
284
|
+
showCheckbox: any;
|
289
285
|
showNodeTypeIcon: boolean;
|
290
286
|
autoCheckChildren: any;
|
291
287
|
autoOpenParentNode: boolean;
|
package/lib/tree/util.d.ts
CHANGED
@@ -71,3 +71,4 @@ export declare const updateTreeNode: (path: string, treeData: any[], childKey: s
|
|
71
71
|
export declare const assignTreeNode: (path: string, treeData: any[], childKey: string, assignVal: any) => void;
|
72
72
|
export declare const resolveNodeItem: (node: any) => any;
|
73
73
|
export declare const resolvePropIsMatched: (node: any, prop: any, id: any) => any;
|
74
|
+
export declare const showCheckbox: (props: TreePropTypes, node?: any) => any;
|