From c696989964a9cb50f3a81fe41e3e23467ef7dacf Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Wed, 27 Mar 2024 11:40:37 +0300 Subject: [PATCH 1/2] Fixed #5479 - Checkbox: new indeterminate state --- components/lib/checkbox/BaseCheckbox.vue | 4 +++ components/lib/checkbox/Checkbox.d.ts | 5 ++++ components/lib/checkbox/Checkbox.vue | 31 +++++++++++++++++++----- components/lib/tree/TreeNode.vue | 3 +-- components/lib/treetable/BodyCell.vue | 4 +-- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/components/lib/checkbox/BaseCheckbox.vue b/components/lib/checkbox/BaseCheckbox.vue index c113f27a6..82e049bbf 100644 --- a/components/lib/checkbox/BaseCheckbox.vue +++ b/components/lib/checkbox/BaseCheckbox.vue @@ -13,6 +13,10 @@ export default { type: String, default: null }, + indeterminate: { + type: Boolean, + default: false + }, trueValue: { type: null, default: true diff --git a/components/lib/checkbox/Checkbox.d.ts b/components/lib/checkbox/Checkbox.d.ts index 50217b5e3..7167a6ee7 100755 --- a/components/lib/checkbox/Checkbox.d.ts +++ b/components/lib/checkbox/Checkbox.d.ts @@ -111,6 +111,11 @@ export interface CheckboxProps { * @default false */ binary?: boolean; + /** + * When present, it specifies input state as indeterminate. + * @default false + */ + indeterminate?: boolean | undefined; /** * When present, it specifies that the component should have invalid state style. * @defaultValue false diff --git a/components/lib/checkbox/Checkbox.vue b/components/lib/checkbox/Checkbox.vue index d2ae54475..b68a9c8cb 100755 --- a/components/lib/checkbox/Checkbox.vue +++ b/components/lib/checkbox/Checkbox.vue @@ -1,5 +1,5 @@ - + diff --git a/components/lib/treetable/BodyCell.vue b/components/lib/treetable/BodyCell.vue index 86d557b5b..131dc5083 100644 --- a/components/lib/treetable/BodyCell.vue +++ b/components/lib/treetable/BodyCell.vue @@ -18,15 +18,13 @@ :class="cx('rowCheckbox')" @change="toggleCheckbox" :tabindex="-1" + :indeterminate="partialChecked" :unstyled="unstyled" :pt="getColumnCheckboxPT('rowCheckbox')" - :data-p-highlight="checked" - :data-p-checked="checked" :data-p-partialchecked="partialChecked" > From ecf4297bbd0fecafbec066c7ee8073387a04ba6e Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Wed, 27 Mar 2024 11:47:34 +0300 Subject: [PATCH 2/2] Indeterminate demo added --- doc/checkbox/IndeterminateDoc.vue | 54 +++++++++++++++++++++++++++++++ pages/checkbox/index.vue | 6 ++++ 2 files changed, 60 insertions(+) create mode 100644 doc/checkbox/IndeterminateDoc.vue diff --git a/doc/checkbox/IndeterminateDoc.vue b/doc/checkbox/IndeterminateDoc.vue new file mode 100644 index 000000000..63182ea3d --- /dev/null +++ b/doc/checkbox/IndeterminateDoc.vue @@ -0,0 +1,54 @@ + + + diff --git a/pages/checkbox/index.vue b/pages/checkbox/index.vue index 02ad4983d..3f64404db 100755 --- a/pages/checkbox/index.vue +++ b/pages/checkbox/index.vue @@ -18,6 +18,7 @@ import DynamicDoc from '@/doc/checkbox/DynamicDoc.vue'; import FilledDoc from '@/doc/checkbox/FilledDoc.vue'; import GroupDoc from '@/doc/checkbox/GroupDoc.vue'; import ImportDoc from '@/doc/checkbox/ImportDoc.vue'; +import IndeterminateDoc from '@/doc/checkbox/IndeterminateDoc.vue'; import InvalidDoc from '@/doc/checkbox/InvalidDoc.vue'; import PTComponent from '@/doc/checkbox/pt/index.vue'; import ThemingDoc from '@/doc/checkbox/theming/index.vue'; @@ -36,6 +37,11 @@ export default { label: 'Basic', component: BasicDoc }, + { + id: 'indeterminate', + label: 'Indeterminate', + component: IndeterminateDoc + }, { id: 'group', label: 'Group',