@sparqjs/schema-ui-element-plus 0.2.6 → 0.2.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-tree-select.d.ts","sourceRoot":"","sources":["../src/lazy-tree-select.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"lazy-tree-select.d.ts","sourceRoot":"","sources":["../src/lazy-tree-select.ts"],"names":[],"mappings":"AACA,OAAO,EAA6D,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAA;AAC9F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAc5D,eAAO,MAAM,cAAc;;cAKA,QAAQ,CAAC,qBAAqB,EAAE,CAAC;;;;;;;cAAjC,QAAQ,CAAC,qBAAqB,EAAE,CAAC;;;iGA4B1D,CAAA"}
|
package/dist/lazy-tree-select.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ElTreeSelect } from 'element-plus';
|
|
2
|
-
import {
|
|
2
|
+
import { defineComponent, h, onMounted, ref, watch } from 'vue';
|
|
3
|
+
function rootOptions(options) {
|
|
4
|
+
return options.map((option) => ({ ...option, children: undefined }));
|
|
5
|
+
}
|
|
6
|
+
function optionKey(option) {
|
|
7
|
+
return `${typeof option.value}:${JSON.stringify(option.value)}`;
|
|
8
|
+
}
|
|
3
9
|
export const LazyTreeSelect = defineComponent({
|
|
4
10
|
name: 'SparqLazyTreeSelect',
|
|
5
11
|
inheritAttrs: false,
|
|
@@ -10,12 +16,23 @@ export const LazyTreeSelect = defineComponent({
|
|
|
10
16
|
},
|
|
11
17
|
},
|
|
12
18
|
setup(props, { attrs, slots }) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const treeSelect = ref();
|
|
20
|
+
const initialRoots = rootOptions(props.data);
|
|
21
|
+
const knownRoots = new Set(initialRoots.map(optionKey));
|
|
22
|
+
function appendRoots(options) {
|
|
23
|
+
if (!treeSelect.value)
|
|
24
|
+
return;
|
|
25
|
+
for (const option of rootOptions(options)) {
|
|
26
|
+
const key = optionKey(option);
|
|
27
|
+
if (knownRoots.has(key))
|
|
28
|
+
continue;
|
|
29
|
+
knownRoots.add(key);
|
|
30
|
+
treeSelect.value.append(option);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
onMounted(() => appendRoots(props.data));
|
|
34
|
+
watch(() => props.data, (options) => appendRoots(options), { deep: true });
|
|
35
|
+
return () => h(ElTreeSelect, { ...attrs, ref: treeSelect, lazy: true, data: initialRoots }, slots);
|
|
19
36
|
},
|
|
20
37
|
});
|
|
21
38
|
//# sourceMappingURL=lazy-tree-select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-tree-select.js","sourceRoot":"","sources":["../src/lazy-tree-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"lazy-tree-select.js","sourceRoot":"","sources":["../src/lazy-tree-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAiC,MAAM,KAAK,CAAA;AAO9F,SAAS,WAAW,CAAC,OAAgC;IACjD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AACxE,CAAC;AAED,SAAS,SAAS,CAAC,MAA6B;IAC5C,OAAO,GAAG,OAAO,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC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