@onereach/ui-components 6.4.6 → 6.4.7-beta.3444.0
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/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.js +13 -16
- package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrCheckboxTreeV3/utils/extractChildrenValues.d.ts +2 -0
- package/dist/bundled/v2/components/OrCheckboxTreeV3/utils/extractChildrenValues.js +19 -0
- package/dist/bundled/v3/{OrCheckboxGroup.vue_vue_type_script_lang-53b76d2d.js → OrCheckboxGroup.vue_vue_type_script_lang-7f9a7ed0.js} +1 -1
- package/dist/bundled/v3/{OrCheckboxTree.vue_vue_type_script_lang-c675ea9d.js → OrCheckboxTree.vue_vue_type_script_lang-c5288bf5.js} +13 -16
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +1 -1
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +1 -1
- package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +1 -1
- package/dist/bundled/v3/components/OrCheckboxTreeV3/utils/extractChildrenValues.d.ts +2 -0
- package/dist/bundled/v3/components/OrCheckboxTreeV3/utils/extractChildrenValues.js +19 -0
- package/dist/bundled/v3/components/index.js +2 -2
- package/dist/bundled/v3/index.js +2 -2
- package/dist/esm/v2/{OrCheckboxGroup-2df9d20b.js → OrCheckboxGroup-6f1bacb2.js} +1 -1
- package/dist/esm/v2/{OrCheckboxTree-52feda21.js → OrCheckboxTree-260748ff.js} +28 -15
- package/dist/esm/v2/components/index.js +2 -2
- package/dist/esm/v2/components/or-checkbox-group-v3/index.js +2 -2
- package/dist/esm/v2/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-checkbox-tree-v3/index.js +1 -1
- package/dist/esm/v2/components/or-checkbox-tree-v3/utils/extractChildrenValues.d.ts +2 -0
- package/dist/esm/v2/index.js +2 -2
- package/dist/esm/v3/{OrCheckboxGroup-53478516.js → OrCheckboxGroup-bcf1f5b0.js} +1 -1
- package/dist/esm/v3/{OrCheckboxTree-a065466b.js → OrCheckboxTree-d1f457da.js} +28 -15
- package/dist/esm/v3/components/index.js +2 -2
- package/dist/esm/v3/components/or-checkbox-group-v3/index.js +2 -2
- package/dist/esm/v3/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +1 -1
- package/dist/esm/v3/components/or-checkbox-tree-v3/index.js +1 -1
- package/dist/esm/v3/components/or-checkbox-tree-v3/utils/extractChildrenValues.d.ts +2 -0
- package/dist/esm/v3/index.js +2 -2
- package/package.json +2 -3
- package/src/components/or-checkbox-tree-v3/OrCheckboxTree.vue +9 -17
- package/src/components/or-checkbox-tree-v3/utils/extractChildrenValues.ts +19 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import flattenDeep from '../../utils/functions/flattenDeep.js';
|
|
1
|
+
import { defineComponent, toRefs, computed, watch } from 'vue-demi';
|
|
3
2
|
import { CheckboxTreeRoot, CheckboxTreeRootParent } from './styles.js';
|
|
3
|
+
import { extractChildrenValues } from './utils/extractChildrenValues.js';
|
|
4
4
|
import __vue_component__$1 from '../OrIconV3/OrIcon.js';
|
|
5
5
|
import __vue_component__$2 from '../OrCheckboxV3/OrCheckbox.js';
|
|
6
6
|
import __vue_component__$3 from '../OrButtonV3/OrButton.js';
|
|
@@ -44,20 +44,17 @@ var script = defineComponent({
|
|
|
44
44
|
emits: ['update:modelValue'],
|
|
45
45
|
setup(props, context) {
|
|
46
46
|
// State
|
|
47
|
-
const
|
|
47
|
+
const {
|
|
48
|
+
modelValue,
|
|
49
|
+
item,
|
|
50
|
+
expanded
|
|
51
|
+
} = toRefs(props);
|
|
52
|
+
const children = computed(() => item.value.children || []);
|
|
53
|
+
const hasChildren = computed(() => children.value.length > 0);
|
|
48
54
|
const childrenValues = computed(() => {
|
|
49
|
-
|
|
50
|
-
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
51
|
-
if (child.children) {
|
|
52
|
-
return getChildValues(child.children);
|
|
53
|
-
} else {
|
|
54
|
-
return child.value;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
return flattenDeep(getChildValues(props.item.children));
|
|
55
|
+
return hasChildren.value ? extractChildrenValues(children.value) : [];
|
|
59
56
|
});
|
|
60
|
-
const proxyModelValue = useProxyModelValue(
|
|
57
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
61
58
|
const isAnyChildrenSelected = computed(() => {
|
|
62
59
|
var _a;
|
|
63
60
|
return (_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.some(value => {
|
|
@@ -75,8 +72,8 @@ var script = defineComponent({
|
|
|
75
72
|
const isIntermediate = computed(() => {
|
|
76
73
|
return isAnyChildrenSelected.value && !isAllChildrenSelected.value;
|
|
77
74
|
});
|
|
78
|
-
const [isOpen, setIsOpen] = useToggle(
|
|
79
|
-
watch(
|
|
75
|
+
const [isOpen, setIsOpen] = useToggle(expanded.value);
|
|
76
|
+
watch(expanded, value => {
|
|
80
77
|
if (value !== undefined) {
|
|
81
78
|
setIsOpen(value);
|
|
82
79
|
}
|
|
@@ -3,7 +3,7 @@ import { CheckboxTreeNode } from './types';
|
|
|
3
3
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
4
|
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
5
5
|
parentStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
6
|
-
hasChildren: import("@vue/composition-api").ComputedRef<boolean
|
|
6
|
+
hasChildren: import("@vue/composition-api").ComputedRef<boolean>;
|
|
7
7
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string[]>;
|
|
8
8
|
isOpen: import("@vue/composition-api").Ref<boolean>;
|
|
9
9
|
setIsOpen: (value?: boolean | undefined) => boolean;
|
|
@@ -65,7 +65,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
65
65
|
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
66
66
|
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
67
67
|
parentStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
68
|
-
hasChildren: import("@vue/composition-api").ComputedRef<boolean
|
|
68
|
+
hasChildren: import("@vue/composition-api").ComputedRef<boolean>;
|
|
69
69
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string[]>;
|
|
70
70
|
isOpen: import("@vue/composition-api").Ref<boolean>;
|
|
71
71
|
setIsOpen: (value?: boolean | undefined) => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import flattenDeep from '../../../utils/functions/flattenDeep.js';
|
|
2
|
+
|
|
3
|
+
const getChildValues = children => {
|
|
4
|
+
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
5
|
+
if (child.disabled) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (child.children) {
|
|
9
|
+
return getChildValues(child.children);
|
|
10
|
+
} else {
|
|
11
|
+
return child.value;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
function extractChildrenValues(children) {
|
|
16
|
+
return flattenDeep(getChildValues(children)).filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { extractChildrenValues };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, toRef } from 'vue-demi';
|
|
2
2
|
import './components/OrCheckboxTreeV3/OrCheckboxTree.js';
|
|
3
|
-
import { s as script$1 } from './OrCheckboxTree.vue_vue_type_script_lang-
|
|
3
|
+
import { s as script$1 } from './OrCheckboxTree.vue_vue_type_script_lang-c5288bf5.js';
|
|
4
4
|
import './components/OrFormGroupV3/OrFormGroup.js';
|
|
5
5
|
import { s as script$2 } from './OrFormGroup.vue_vue_type_script_lang-7ef8a039.js';
|
|
6
6
|
import { FormGroupDirection } from './components/OrFormGroupV3/props.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import flattenDeep from './utils/functions/flattenDeep.js';
|
|
1
|
+
import { defineComponent, toRefs, computed, watch } from 'vue-demi';
|
|
3
2
|
import { CheckboxTreeRoot, CheckboxTreeRootParent } from './components/OrCheckboxTreeV3/styles.js';
|
|
3
|
+
import { extractChildrenValues } from './components/OrCheckboxTreeV3/utils/extractChildrenValues.js';
|
|
4
4
|
import './components/OrIconV3/OrIcon.js';
|
|
5
5
|
import './components/OrCheckboxV3/OrCheckbox.js';
|
|
6
6
|
import { s as script$2 } from './OrCheckbox.vue_vue_type_script_lang-4fa909d8.js';
|
|
@@ -46,20 +46,17 @@ var script = defineComponent({
|
|
|
46
46
|
emits: ['update:modelValue'],
|
|
47
47
|
setup(props, context) {
|
|
48
48
|
// State
|
|
49
|
-
const
|
|
49
|
+
const {
|
|
50
|
+
modelValue,
|
|
51
|
+
item,
|
|
52
|
+
expanded
|
|
53
|
+
} = toRefs(props);
|
|
54
|
+
const children = computed(() => item.value.children || []);
|
|
55
|
+
const hasChildren = computed(() => children.value.length > 0);
|
|
50
56
|
const childrenValues = computed(() => {
|
|
51
|
-
|
|
52
|
-
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
53
|
-
if (child.children) {
|
|
54
|
-
return getChildValues(child.children);
|
|
55
|
-
} else {
|
|
56
|
-
return child.value;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
return flattenDeep(getChildValues(props.item.children));
|
|
57
|
+
return hasChildren.value ? extractChildrenValues(children.value) : [];
|
|
61
58
|
});
|
|
62
|
-
const proxyModelValue = useProxyModelValue(
|
|
59
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
63
60
|
const isAnyChildrenSelected = computed(() => {
|
|
64
61
|
var _a;
|
|
65
62
|
return (_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.some(value => {
|
|
@@ -77,8 +74,8 @@ var script = defineComponent({
|
|
|
77
74
|
const isIntermediate = computed(() => {
|
|
78
75
|
return isAnyChildrenSelected.value && !isAllChildrenSelected.value;
|
|
79
76
|
});
|
|
80
|
-
const [isOpen, setIsOpen] = useToggle(
|
|
81
|
-
watch(
|
|
77
|
+
const [isOpen, setIsOpen] = useToggle(expanded.value);
|
|
78
|
+
watch(expanded, value => {
|
|
82
79
|
if (value !== undefined) {
|
|
83
80
|
setIsOpen(value);
|
|
84
81
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as script } from '../../OrCheckboxGroup.vue_vue_type_script_lang-
|
|
2
|
-
export { s as default } from '../../OrCheckboxGroup.vue_vue_type_script_lang-
|
|
1
|
+
import { s as script } from '../../OrCheckboxGroup.vue_vue_type_script_lang-7f9a7ed0.js';
|
|
2
|
+
export { s as default } from '../../OrCheckboxGroup.vue_vue_type_script_lang-7f9a7ed0.js';
|
|
3
3
|
import { resolveComponent, openBlock, createBlock, withCtx, renderSlot, createElementBlock, Fragment, renderList } from 'vue';
|
|
4
4
|
|
|
5
5
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { s as OrCheckboxGroupV3 } from '../../OrCheckboxGroup.vue_vue_type_script_lang-
|
|
1
|
+
export { s as OrCheckboxGroupV3 } from '../../OrCheckboxGroup.vue_vue_type_script_lang-7f9a7ed0.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as script } from '../../OrCheckboxTree.vue_vue_type_script_lang-
|
|
2
|
-
export { s as default } from '../../OrCheckboxTree.vue_vue_type_script_lang-
|
|
1
|
+
import { s as script } from '../../OrCheckboxTree.vue_vue_type_script_lang-c5288bf5.js';
|
|
2
|
+
export { s as default } from '../../OrCheckboxTree.vue_vue_type_script_lang-c5288bf5.js';
|
|
3
3
|
import { resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, createElementVNode, createBlock, withCtx, createVNode, createCommentVNode, renderList } from 'vue';
|
|
4
4
|
|
|
5
5
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -24,7 +24,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
24
24
|
}, {
|
|
25
25
|
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
26
26
|
parentStyles: import("vue-demi").ComputedRef<string[]>;
|
|
27
|
-
hasChildren: import("vue-demi").ComputedRef<boolean
|
|
27
|
+
hasChildren: import("vue-demi").ComputedRef<boolean>;
|
|
28
28
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string[]>;
|
|
29
29
|
isOpen: import("vue-demi").Ref<boolean>;
|
|
30
30
|
setIsOpen: (value?: boolean | undefined) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { s as OrCheckboxTreeV3 } from '../../OrCheckboxTree.vue_vue_type_script_lang-
|
|
1
|
+
export { s as OrCheckboxTreeV3 } from '../../OrCheckboxTree.vue_vue_type_script_lang-c5288bf5.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import flattenDeep from '../../../utils/functions/flattenDeep.js';
|
|
2
|
+
|
|
3
|
+
const getChildValues = children => {
|
|
4
|
+
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
5
|
+
if (child.disabled) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (child.children) {
|
|
9
|
+
return getChildValues(child.children);
|
|
10
|
+
} else {
|
|
11
|
+
return child.value;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
function extractChildrenValues(children) {
|
|
16
|
+
return flattenDeep(getChildValues(children)).filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { extractChildrenValues };
|
|
@@ -19,8 +19,8 @@ export { CardCollectionView, defaultViewModes, gridView, listView } from './OrCa
|
|
|
19
19
|
export { s as OrCardV3 } from '../OrCard.vue_vue_type_script_lang-5f887a5a.js';
|
|
20
20
|
export { CardPadding } from './OrCardV3/props.js';
|
|
21
21
|
export { s as OrCheckbox } from '../OrCheckbox.vue_vue_type_script_lang-de28fcaf.js';
|
|
22
|
-
export { s as OrCheckboxGroupV3 } from '../OrCheckboxGroup.vue_vue_type_script_lang-
|
|
23
|
-
export { s as OrCheckboxTreeV3 } from '../OrCheckboxTree.vue_vue_type_script_lang-
|
|
22
|
+
export { s as OrCheckboxGroupV3 } from '../OrCheckboxGroup.vue_vue_type_script_lang-7f9a7ed0.js';
|
|
23
|
+
export { s as OrCheckboxTreeV3 } from '../OrCheckboxTree.vue_vue_type_script_lang-c5288bf5.js';
|
|
24
24
|
export { s as OrCheckboxV3 } from '../OrCheckbox.vue_vue_type_script_lang-4fa909d8.js';
|
|
25
25
|
export { s as OrChip } from '../OrChip.vue_vue_type_script_lang-cacd81e5.js';
|
|
26
26
|
export { s as OrChips } from '../OrChips.vue_vue_type_script_lang-e1f37564.js';
|
package/dist/bundled/v3/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { s as OrCardCollectionV3 } from './OrCardCollection.vue_vue_type_script_
|
|
|
12
12
|
import './components/OrCardV3/OrCard.js';
|
|
13
13
|
export { s as OrCardV3 } from './OrCard.vue_vue_type_script_lang-5f887a5a.js';
|
|
14
14
|
import './components/OrCheckboxGroupV3/OrCheckboxGroup.js';
|
|
15
|
-
export { s as OrCheckboxGroupV3 } from './OrCheckboxGroup.vue_vue_type_script_lang-
|
|
15
|
+
export { s as OrCheckboxGroupV3 } from './OrCheckboxGroup.vue_vue_type_script_lang-7f9a7ed0.js';
|
|
16
16
|
import './components/OrChips/OrChips.js';
|
|
17
17
|
export { s as OrChips } from './OrChips.vue_vue_type_script_lang-e1f37564.js';
|
|
18
18
|
import './components/OrCode/OrCode.js';
|
|
@@ -152,7 +152,7 @@ export { CARD_COLLECTION_LAYOUT } from './components/OrCardCollection/constants.
|
|
|
152
152
|
export { CardCollectionView, defaultViewModes, gridView, listView } from './components/OrCardCollectionV3/props.js';
|
|
153
153
|
export { CardPadding } from './components/OrCardV3/props.js';
|
|
154
154
|
export { s as OrCheckbox } from './OrCheckbox.vue_vue_type_script_lang-de28fcaf.js';
|
|
155
|
-
export { s as OrCheckboxTreeV3 } from './OrCheckboxTree.vue_vue_type_script_lang-
|
|
155
|
+
export { s as OrCheckboxTreeV3 } from './OrCheckboxTree.vue_vue_type_script_lang-c5288bf5.js';
|
|
156
156
|
export { s as OrCheckboxV3 } from './OrCheckbox.vue_vue_type_script_lang-4fa909d8.js';
|
|
157
157
|
export { s as OrChip } from './OrChip.vue_vue_type_script_lang-cacd81e5.js';
|
|
158
158
|
export { OrCodeLanguages } from './components/OrCode/constants.js';
|
|
@@ -4,7 +4,7 @@ import './dom-aecadd9a.js';
|
|
|
4
4
|
import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
|
|
5
5
|
import '@onereach/styles/tailwind/plugins/core';
|
|
6
6
|
import '@onereach/styles/tailwind.config.json';
|
|
7
|
-
import { _ as __vue_component__$1 } from './OrCheckboxTree-
|
|
7
|
+
import { _ as __vue_component__$1 } from './OrCheckboxTree-260748ff.js';
|
|
8
8
|
import { _ as __vue_component__$2, F as FormGroupDirection } from './OrFormGroup-bed59f6c.js';
|
|
9
9
|
import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useToggle } from '@vueuse/core';
|
|
2
|
-
import { defineComponent,
|
|
2
|
+
import { defineComponent, toRefs, computed, watch } from 'vue-demi';
|
|
3
3
|
import './dom-aecadd9a.js';
|
|
4
4
|
import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
|
|
5
5
|
import '@onereach/styles/tailwind/plugins/core';
|
|
@@ -23,6 +23,22 @@ const CheckboxTreeRootParent = [
|
|
|
23
23
|
// Layout
|
|
24
24
|
'flex', 'flex-row', 'gap-xs'];
|
|
25
25
|
|
|
26
|
+
const getChildValues = children => {
|
|
27
|
+
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
28
|
+
if (child.disabled) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (child.children) {
|
|
32
|
+
return getChildValues(child.children);
|
|
33
|
+
} else {
|
|
34
|
+
return child.value;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
function extractChildrenValues(children) {
|
|
39
|
+
return flattenDeep(getChildValues(children)).filter(Boolean);
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
var script = defineComponent({
|
|
27
43
|
name: 'OrCheckboxTree',
|
|
28
44
|
components: {
|
|
@@ -59,20 +75,17 @@ var script = defineComponent({
|
|
|
59
75
|
emits: ['update:modelValue'],
|
|
60
76
|
setup(props, context) {
|
|
61
77
|
// State
|
|
62
|
-
const
|
|
78
|
+
const {
|
|
79
|
+
modelValue,
|
|
80
|
+
item,
|
|
81
|
+
expanded
|
|
82
|
+
} = toRefs(props);
|
|
83
|
+
const children = computed(() => item.value.children || []);
|
|
84
|
+
const hasChildren = computed(() => children.value.length > 0);
|
|
63
85
|
const childrenValues = computed(() => {
|
|
64
|
-
|
|
65
|
-
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
66
|
-
if (child.children) {
|
|
67
|
-
return getChildValues(child.children);
|
|
68
|
-
} else {
|
|
69
|
-
return child.value;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
return flattenDeep(getChildValues(props.item.children));
|
|
86
|
+
return hasChildren.value ? extractChildrenValues(children.value) : [];
|
|
74
87
|
});
|
|
75
|
-
const proxyModelValue = useProxyModelValue(
|
|
88
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
76
89
|
const isAnyChildrenSelected = computed(() => {
|
|
77
90
|
var _a;
|
|
78
91
|
return (_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.some(value => {
|
|
@@ -90,8 +103,8 @@ var script = defineComponent({
|
|
|
90
103
|
const isIntermediate = computed(() => {
|
|
91
104
|
return isAnyChildrenSelected.value && !isAllChildrenSelected.value;
|
|
92
105
|
});
|
|
93
|
-
const [isOpen, setIsOpen] = useToggle(
|
|
94
|
-
watch(
|
|
106
|
+
const [isOpen, setIsOpen] = useToggle(expanded.value);
|
|
107
|
+
watch(expanded, value => {
|
|
95
108
|
if (value !== undefined) {
|
|
96
109
|
setIsOpen(value);
|
|
97
110
|
}
|
|
@@ -11,8 +11,8 @@ export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from '../OrCardCol
|
|
|
11
11
|
export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollection-45c66d62.js';
|
|
12
12
|
export { C as CardPadding, _ as OrCardV3 } from '../OrCard-c5c725ed.js';
|
|
13
13
|
export { _ as OrCheckbox } from '../OrCheckbox-fcd6b64c.js';
|
|
14
|
-
export { _ as OrCheckboxGroupV3 } from '../OrCheckboxGroup-
|
|
15
|
-
export { _ as OrCheckboxTreeV3 } from '../OrCheckboxTree-
|
|
14
|
+
export { _ as OrCheckboxGroupV3 } from '../OrCheckboxGroup-6f1bacb2.js';
|
|
15
|
+
export { _ as OrCheckboxTreeV3 } from '../OrCheckboxTree-260748ff.js';
|
|
16
16
|
export { _ as OrCheckboxV3 } from '../OrCheckbox-a3bb500c.js';
|
|
17
17
|
export { _ as OrChip } from '../OrChip-6cae6dab.js';
|
|
18
18
|
export { _ as OrChips } from '../OrChips-dd82c2b6.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { _ as OrCheckboxGroupV3 } from '../../OrCheckboxGroup-
|
|
1
|
+
export { _ as OrCheckboxGroupV3 } from '../../OrCheckboxGroup-6f1bacb2.js';
|
|
2
2
|
import 'vue-demi';
|
|
3
3
|
import '@vueuse/core';
|
|
4
4
|
import '../../dom-aecadd9a.js';
|
|
@@ -7,7 +7,7 @@ import 'lodash/get';
|
|
|
7
7
|
import '../../useProxyModelValue-940010d2.js';
|
|
8
8
|
import '@onereach/styles/tailwind/plugins/core';
|
|
9
9
|
import '@onereach/styles/tailwind.config.json';
|
|
10
|
-
import '../../OrCheckboxTree-
|
|
10
|
+
import '../../OrCheckboxTree-260748ff.js';
|
|
11
11
|
import '../../OrButton-a23ee9f0.js';
|
|
12
12
|
import '../../OrLoader-b0c381f9.js';
|
|
13
13
|
import '../../normalize-component-6e8e3d80.js';
|
|
@@ -3,7 +3,7 @@ import { CheckboxTreeNode } from './types';
|
|
|
3
3
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
4
|
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
5
5
|
parentStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
6
|
-
hasChildren: import("@vue/composition-api").ComputedRef<boolean
|
|
6
|
+
hasChildren: import("@vue/composition-api").ComputedRef<boolean>;
|
|
7
7
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string[]>;
|
|
8
8
|
isOpen: import("@vue/composition-api").Ref<boolean>;
|
|
9
9
|
setIsOpen: (value?: boolean | undefined) => boolean;
|
|
@@ -65,7 +65,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
65
65
|
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
66
66
|
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
67
67
|
parentStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
68
|
-
hasChildren: import("@vue/composition-api").ComputedRef<boolean
|
|
68
|
+
hasChildren: import("@vue/composition-api").ComputedRef<boolean>;
|
|
69
69
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string[]>;
|
|
70
70
|
isOpen: import("@vue/composition-api").Ref<boolean>;
|
|
71
71
|
setIsOpen: (value?: boolean | undefined) => boolean;
|
package/dist/esm/v2/index.js
CHANGED
|
@@ -11,8 +11,8 @@ export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from './OrCardColl
|
|
|
11
11
|
export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-45c66d62.js';
|
|
12
12
|
export { C as CardPadding, _ as OrCardV3 } from './OrCard-c5c725ed.js';
|
|
13
13
|
export { _ as OrCheckbox } from './OrCheckbox-fcd6b64c.js';
|
|
14
|
-
export { _ as OrCheckboxGroupV3 } from './OrCheckboxGroup-
|
|
15
|
-
export { _ as OrCheckboxTreeV3 } from './OrCheckboxTree-
|
|
14
|
+
export { _ as OrCheckboxGroupV3 } from './OrCheckboxGroup-6f1bacb2.js';
|
|
15
|
+
export { _ as OrCheckboxTreeV3 } from './OrCheckboxTree-260748ff.js';
|
|
16
16
|
export { _ as OrCheckboxV3 } from './OrCheckbox-a3bb500c.js';
|
|
17
17
|
export { _ as OrChip } from './OrChip-6cae6dab.js';
|
|
18
18
|
export { _ as OrChips } from './OrChips-dd82c2b6.js';
|
|
@@ -4,7 +4,7 @@ import './dom-aecadd9a.js';
|
|
|
4
4
|
import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
|
|
5
5
|
import '@onereach/styles/tailwind/plugins/core';
|
|
6
6
|
import '@onereach/styles/tailwind.config.json';
|
|
7
|
-
import { s as script$1 } from './OrCheckboxTree-
|
|
7
|
+
import { s as script$1 } from './OrCheckboxTree-d1f457da.js';
|
|
8
8
|
import { s as script$2, F as FormGroupDirection } from './OrFormGroup-37f2b304.js';
|
|
9
9
|
import { resolveComponent, openBlock, createBlock, withCtx, renderSlot, createElementBlock, Fragment, renderList } from 'vue';
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useToggle } from '@vueuse/core';
|
|
2
|
-
import { defineComponent,
|
|
2
|
+
import { defineComponent, toRefs, computed, watch } from 'vue-demi';
|
|
3
3
|
import './dom-aecadd9a.js';
|
|
4
4
|
import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
|
|
5
5
|
import '@onereach/styles/tailwind/plugins/core';
|
|
@@ -23,6 +23,22 @@ const CheckboxTreeRootParent = [
|
|
|
23
23
|
// Layout
|
|
24
24
|
'flex', 'flex-row', 'gap-xs'];
|
|
25
25
|
|
|
26
|
+
const getChildValues = children => {
|
|
27
|
+
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
28
|
+
if (child.disabled) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (child.children) {
|
|
32
|
+
return getChildValues(child.children);
|
|
33
|
+
} else {
|
|
34
|
+
return child.value;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
function extractChildrenValues(children) {
|
|
39
|
+
return flattenDeep(getChildValues(children)).filter(Boolean);
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
var script = defineComponent({
|
|
27
43
|
name: 'OrCheckboxTree',
|
|
28
44
|
components: {
|
|
@@ -59,20 +75,17 @@ var script = defineComponent({
|
|
|
59
75
|
emits: ['update:modelValue'],
|
|
60
76
|
setup(props, context) {
|
|
61
77
|
// State
|
|
62
|
-
const
|
|
78
|
+
const {
|
|
79
|
+
modelValue,
|
|
80
|
+
item,
|
|
81
|
+
expanded
|
|
82
|
+
} = toRefs(props);
|
|
83
|
+
const children = computed(() => item.value.children || []);
|
|
84
|
+
const hasChildren = computed(() => children.value.length > 0);
|
|
63
85
|
const childrenValues = computed(() => {
|
|
64
|
-
|
|
65
|
-
return children === null || children === void 0 ? void 0 : children.map(child => {
|
|
66
|
-
if (child.children) {
|
|
67
|
-
return getChildValues(child.children);
|
|
68
|
-
} else {
|
|
69
|
-
return child.value;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
return flattenDeep(getChildValues(props.item.children));
|
|
86
|
+
return hasChildren.value ? extractChildrenValues(children.value) : [];
|
|
74
87
|
});
|
|
75
|
-
const proxyModelValue = useProxyModelValue(
|
|
88
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
76
89
|
const isAnyChildrenSelected = computed(() => {
|
|
77
90
|
var _a;
|
|
78
91
|
return (_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.some(value => {
|
|
@@ -90,8 +103,8 @@ var script = defineComponent({
|
|
|
90
103
|
const isIntermediate = computed(() => {
|
|
91
104
|
return isAnyChildrenSelected.value && !isAllChildrenSelected.value;
|
|
92
105
|
});
|
|
93
|
-
const [isOpen, setIsOpen] = useToggle(
|
|
94
|
-
watch(
|
|
106
|
+
const [isOpen, setIsOpen] = useToggle(expanded.value);
|
|
107
|
+
watch(expanded, value => {
|
|
95
108
|
if (value !== undefined) {
|
|
96
109
|
setIsOpen(value);
|
|
97
110
|
}
|
|
@@ -10,8 +10,8 @@ export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from '../OrCardCol
|
|
|
10
10
|
export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollection-64175d94.js';
|
|
11
11
|
export { C as CardPadding, s as OrCardV3 } from '../OrCard-a789e0d9.js';
|
|
12
12
|
export { s as OrCheckbox } from '../OrCheckbox-5666c954.js';
|
|
13
|
-
export { s as OrCheckboxGroupV3 } from '../OrCheckboxGroup-
|
|
14
|
-
export { s as OrCheckboxTreeV3 } from '../OrCheckboxTree-
|
|
13
|
+
export { s as OrCheckboxGroupV3 } from '../OrCheckboxGroup-bcf1f5b0.js';
|
|
14
|
+
export { s as OrCheckboxTreeV3 } from '../OrCheckboxTree-d1f457da.js';
|
|
15
15
|
export { s as OrCheckboxV3 } from '../OrCheckbox-a2017fa5.js';
|
|
16
16
|
export { s as OrChip } from '../OrChip-74e27265.js';
|
|
17
17
|
export { s as OrChips } from '../OrChips-348b13e4.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { s as OrCheckboxGroupV3 } from '../../OrCheckboxGroup-
|
|
1
|
+
export { s as OrCheckboxGroupV3 } from '../../OrCheckboxGroup-bcf1f5b0.js';
|
|
2
2
|
import 'vue-demi';
|
|
3
3
|
import '@vueuse/core';
|
|
4
4
|
import '../../dom-aecadd9a.js';
|
|
@@ -7,7 +7,7 @@ import 'lodash/get';
|
|
|
7
7
|
import '../../useProxyModelValue-940010d2.js';
|
|
8
8
|
import '@onereach/styles/tailwind/plugins/core';
|
|
9
9
|
import '@onereach/styles/tailwind.config.json';
|
|
10
|
-
import '../../OrCheckboxTree-
|
|
10
|
+
import '../../OrCheckboxTree-d1f457da.js';
|
|
11
11
|
import '../../OrButton-4a3c3e7b.js';
|
|
12
12
|
import '../../OrLoader-b79022da.js';
|
|
13
13
|
import 'vue';
|
|
@@ -24,7 +24,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
24
24
|
}, {
|
|
25
25
|
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
26
26
|
parentStyles: import("vue-demi").ComputedRef<string[]>;
|
|
27
|
-
hasChildren: import("vue-demi").ComputedRef<boolean
|
|
27
|
+
hasChildren: import("vue-demi").ComputedRef<boolean>;
|
|
28
28
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string[]>;
|
|
29
29
|
isOpen: import("vue-demi").Ref<boolean>;
|
|
30
30
|
setIsOpen: (value?: boolean | undefined) => boolean;
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -10,8 +10,8 @@ export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from './OrCardColl
|
|
|
10
10
|
export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-64175d94.js';
|
|
11
11
|
export { C as CardPadding, s as OrCardV3 } from './OrCard-a789e0d9.js';
|
|
12
12
|
export { s as OrCheckbox } from './OrCheckbox-5666c954.js';
|
|
13
|
-
export { s as OrCheckboxGroupV3 } from './OrCheckboxGroup-
|
|
14
|
-
export { s as OrCheckboxTreeV3 } from './OrCheckboxTree-
|
|
13
|
+
export { s as OrCheckboxGroupV3 } from './OrCheckboxGroup-bcf1f5b0.js';
|
|
14
|
+
export { s as OrCheckboxTreeV3 } from './OrCheckboxTree-d1f457da.js';
|
|
15
15
|
export { s as OrCheckboxV3 } from './OrCheckbox-a2017fa5.js';
|
|
16
16
|
export { s as OrChip } from './OrChip-74e27265.js';
|
|
17
17
|
export { s as OrChips } from './OrChips-348b13e4.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.7-beta.3444.0",
|
|
4
4
|
"npmUnpacked": "4.15.2",
|
|
5
5
|
"description": "Vue components library for v2/3",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -175,6 +175,5 @@
|
|
|
175
175
|
"default": "./dist/bundled/v3/components/*/index.js"
|
|
176
176
|
},
|
|
177
177
|
"./package.json": "./package.json"
|
|
178
|
-
}
|
|
179
|
-
"gitHead": "a7f7b937d888a11aaebd58c487dde34bb52ac271"
|
|
178
|
+
}
|
|
180
179
|
}
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
|
|
62
62
|
<script lang="ts">
|
|
63
63
|
import { useToggle } from '@vueuse/core';
|
|
64
|
-
import { computed, defineComponent, PropType,
|
|
64
|
+
import { computed, defineComponent, PropType, watch, toRefs } from 'vue-demi';
|
|
65
65
|
import { useProxyModelValue } from '../../hooks';
|
|
66
|
-
import flattenDeep from '../../utils/functions/flattenDeep';
|
|
67
66
|
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
68
67
|
import { OrCheckboxV3 as OrCheckbox } from '../or-checkbox-v3';
|
|
69
68
|
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
70
69
|
import { CheckboxTreeRoot, CheckboxTreeRootParent } from './styles';
|
|
71
70
|
import { CheckboxTreeNode } from './types';
|
|
71
|
+
import { extractChildrenValues } from './utils/extractChildrenValues';
|
|
72
72
|
|
|
73
73
|
export default defineComponent({
|
|
74
74
|
name: 'OrCheckboxTree',
|
|
@@ -112,23 +112,15 @@ export default defineComponent({
|
|
|
112
112
|
|
|
113
113
|
setup(props, context) {
|
|
114
114
|
// State
|
|
115
|
-
const
|
|
115
|
+
const { modelValue, item, expanded } = toRefs(props);
|
|
116
|
+
const children = computed(() => item.value.children || []);
|
|
117
|
+
const hasChildren = computed(() => children.value.length > 0);
|
|
116
118
|
|
|
117
119
|
const childrenValues = computed(() => {
|
|
118
|
-
|
|
119
|
-
return children?.map((child) => {
|
|
120
|
-
if (child.children) {
|
|
121
|
-
return getChildValues(child.children);
|
|
122
|
-
} else {
|
|
123
|
-
return child.value;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
return flattenDeep(getChildValues(props.item.children));
|
|
120
|
+
return hasChildren.value ? extractChildrenValues(children.value) : [];
|
|
129
121
|
});
|
|
130
122
|
|
|
131
|
-
const proxyModelValue = useProxyModelValue(
|
|
123
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
132
124
|
|
|
133
125
|
const isAnyChildrenSelected = computed(() => {
|
|
134
126
|
return proxyModelValue.value?.some((value) => childrenValues.value?.includes(value));
|
|
@@ -142,9 +134,9 @@ export default defineComponent({
|
|
|
142
134
|
return isAnyChildrenSelected.value && !isAllChildrenSelected.value;
|
|
143
135
|
});
|
|
144
136
|
|
|
145
|
-
const [isOpen, setIsOpen] = useToggle(
|
|
137
|
+
const [isOpen, setIsOpen] = useToggle(expanded.value);
|
|
146
138
|
|
|
147
|
-
watch(
|
|
139
|
+
watch(expanded, (value) => {
|
|
148
140
|
if (value !== undefined) {
|
|
149
141
|
setIsOpen(value);
|
|
150
142
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CheckboxTreeNode } from '../types';
|
|
2
|
+
import flattenDeep from '../../../utils/functions/flattenDeep';
|
|
3
|
+
|
|
4
|
+
const getChildValues = (children?: CheckboxTreeNode[]): any[] | undefined => {
|
|
5
|
+
return children?.map((child) => {
|
|
6
|
+
if (child.disabled) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
if (child.children) {
|
|
10
|
+
return getChildValues(child.children);
|
|
11
|
+
} else {
|
|
12
|
+
return child.value;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export function extractChildrenValues(children: CheckboxTreeNode[]): any[] {
|
|
17
|
+
return flattenDeep(getChildValues(children)).filter(Boolean);
|
|
18
|
+
}
|
|
19
|
+
|