From 6b605f6b57d67ef3ae32e0dc326b7011ddf90bd0 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Tue, 9 Apr 2024 17:11:00 +0300 Subject: [PATCH] Refactor #5553 - For Inplace --- api-generator/components/inplace.js | 12 +------ components/lib/inplace/BaseInplace.vue | 12 ------- components/lib/inplace/Inplace.d.ts | 29 +++++------------ components/lib/inplace/Inplace.vue | 33 ++++--------------- components/lib/inplace/style/InplaceStyle.js | 2 +- doc/inplace/AccessibilityDoc.vue | 34 -------------------- 6 files changed, 17 insertions(+), 105 deletions(-) diff --git a/api-generator/components/inplace.js b/api-generator/components/inplace.js index 155c8009e..07e8d3316 100644 --- a/api-generator/components/inplace.js +++ b/api-generator/components/inplace.js @@ -6,13 +6,7 @@ const InplaceProps = [ description: 'Whether the content is displayed or not.' }, { - name: 'closable', - type: 'boolean', - default: 'false', - description: 'Displays a button to switch back to display mode.' - }, - { - name: 'diabled', + name: 'disabled', type: 'boolean', default: 'false', description: 'When present, it specifies that the element should be disabled.' @@ -64,10 +58,6 @@ const InplaceSlots = [ { name: 'content', description: 'Custom content template.' - }, - { - name: 'closeicon', - description: 'Custom close icon template.' } ]; diff --git a/components/lib/inplace/BaseInplace.vue b/components/lib/inplace/BaseInplace.vue index f27a3080a..ff0b7d926 100644 --- a/components/lib/inplace/BaseInplace.vue +++ b/components/lib/inplace/BaseInplace.vue @@ -6,10 +6,6 @@ export default { name: 'BaseInplace', extends: BaseComponent, props: { - closable: { - type: Boolean, - default: false - }, active: { type: Boolean, default: false @@ -18,17 +14,9 @@ export default { type: Boolean, default: false }, - closeIcon: { - type: String, - default: undefined - }, displayProps: { type: null, default: null - }, - closeButtonProps: { - type: null, - default: null } }, style: InplaceStyle, diff --git a/components/lib/inplace/Inplace.d.ts b/components/lib/inplace/Inplace.d.ts index bb3f85523..cb5f3caca 100755 --- a/components/lib/inplace/Inplace.d.ts +++ b/components/lib/inplace/Inplace.d.ts @@ -8,9 +8,8 @@ * */ -import { ButtonHTMLAttributes, HTMLAttributes, VNode } from 'vue'; +import { HTMLAttributes, VNode } from 'vue'; import { ComponentHooks } from '../basecomponent'; -import { ButtonPassThroughOptions } from '../button'; import { PassThroughOptions } from '../passthrough'; import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers'; @@ -77,11 +76,6 @@ export interface InplacePassThroughOptions { * Used to pass attributes to the content's DOM element. */ content?: InplacePassThroughOptionType; - /** - * Used to pass attributes to the Button component. - * @see {@link ButtonPassThroughOptions} - */ - closeButton?: ButtonPassThroughOptions; /** * Used to manage all lifecycle hooks. * @see {@link BaseComponent.ComponentHooks} @@ -111,11 +105,6 @@ export interface InplaceState { * Defines valid properties in Inplace component. */ export interface InplaceProps { - /** - * Displays a button to switch back to display mode. - * @defaultValue false - */ - closable?: boolean | undefined; /** * Whether the content is displayed or not. * @defaultValue false @@ -135,10 +124,6 @@ export interface InplaceProps { * Used to pass all properties of the HTMLDivElement to display container. */ displayProps?: HTMLAttributes | undefined; - /** - * Used to pass all properties of the HTMLButtonElement to the close button. - */ - closeButtonProps?: ButtonHTMLAttributes | undefined; /** * It generates scoped CSS variables using design tokens for the component. */ @@ -170,12 +155,14 @@ export interface InplaceSlots { display(): VNode[]; /** * Custom content template. + * @param {Object} scope - container slot's params. */ - content(): VNode[]; - /** - * Custom close icon template. - */ - closeicon(): VNode[]; + content(scope: { + /** + * Close message function. + */ + closeCallback: () => void; + }): VNode[]; } /** diff --git a/components/lib/inplace/Inplace.vue b/components/lib/inplace/Inplace.vue index e97f60318..6fec99378 100755 --- a/components/lib/inplace/Inplace.vue +++ b/components/lib/inplace/Inplace.vue @@ -1,25 +1,15 @@ diff --git a/components/lib/inplace/style/InplaceStyle.js b/components/lib/inplace/style/InplaceStyle.js index 2e54ed5b5..dbdd39a3e 100644 --- a/components/lib/inplace/style/InplaceStyle.js +++ b/components/lib/inplace/style/InplaceStyle.js @@ -1,7 +1,7 @@ import BaseStyle from 'primevue/base/style'; const classes = { - root: ({ props }) => 'p-inplace p-component', + root: 'p-inplace p-component', display: ({ props }) => ['p-inplace-display', { 'p-disabled': props.disabled }], content: 'p-inplace-content' }; diff --git a/doc/inplace/AccessibilityDoc.vue b/doc/inplace/AccessibilityDoc.vue index 5ad47ae7e..5a3bc964a 100644 --- a/doc/inplace/AccessibilityDoc.vue +++ b/doc/inplace/AccessibilityDoc.vue @@ -2,14 +2,6 @@

Screen Reader

Inplace component defines aria-live as "polite" by default, since any valid attribute is passed to the main container aria roles and attributes of the root element can be customized easily.

-

- Display element uses button role in view mode by default, displayProps can be used for customizations like adding aria-label or aria-labelledby attributes to describe the content of the view mode or even - overriding the default role. -

-

- Closable inplace components displays a button with an aria-label that refers to the aria.close property of the locale API by default, you may use closeButtonProps to - customize the element and override the default aria-label. -

View Mode Keyboard Support

@@ -30,31 +22,5 @@
- -

Close Button Keyboard Support

-
- - - - - - - - - - - - - - - - - -
KeyFunction
- enter - Switches to display.
- space - Switches to display.
-