From 1cbaf36aa0022b0f897b65b0f0f2b856bb694792 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Tue, 26 Mar 2024 13:45:13 +0300 Subject: [PATCH] Refactor #5476 - For DataViewLayoutOptions --- .../components/dataviewlayoutoptions.js | 35 ---- components/doc/codeeditor/templates.js | 2 - components/lib/config/PrimeVue.d.ts | 2 - components/lib/dataview/DataView.d.ts | 2 +- .../BaseDataViewLayoutOptions.vue | 18 -- .../DataViewLayoutOptions.d.ts | 185 ------------------ .../DataViewLayoutOptions.spec.js | 18 -- .../DataViewLayoutOptions.vue | 49 ----- .../lib/dataviewlayoutoptions/package.json | 9 - .../style/DataViewLayoutOptionsStyle.d.ts | 3 - .../style/DataViewLayoutOptionsStyle.js | 10 - .../dataviewlayoutoptions/style/package.json | 6 - doc/dataview/ImportDoc.vue | 1 - doc/dataview/LayoutDoc.vue | 34 +++- doc/dataview/LoadingDoc.vue | 29 ++- doc/dataview/pt/index.vue | 6 - .../runtime/core/components/index.js | 2 +- nuxt-vite.config.js | 1 - pages/dataview/index.vue | 2 +- rollup.config.js | 1 - 20 files changed, 52 insertions(+), 363 deletions(-) delete mode 100644 api-generator/components/dataviewlayoutoptions.js delete mode 100644 components/lib/dataviewlayoutoptions/BaseDataViewLayoutOptions.vue delete mode 100755 components/lib/dataviewlayoutoptions/DataViewLayoutOptions.d.ts delete mode 100644 components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js delete mode 100755 components/lib/dataviewlayoutoptions/DataViewLayoutOptions.vue delete mode 100644 components/lib/dataviewlayoutoptions/package.json delete mode 100644 components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.d.ts delete mode 100644 components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js delete mode 100644 components/lib/dataviewlayoutoptions/style/package.json diff --git a/api-generator/components/dataviewlayoutoptions.js b/api-generator/components/dataviewlayoutoptions.js deleted file mode 100644 index de107d347..000000000 --- a/api-generator/components/dataviewlayoutoptions.js +++ /dev/null @@ -1,35 +0,0 @@ -const DataViewLayoutOptionsProps = [ - { - name: 'modelValue', - type: 'string', - default: 'null', - description: 'Value of the component.' - }, - { - name: 'pt', - type: 'any', - default: 'null', - description: 'Used to pass attributes to DOM elements inside the component.' - } -]; - -const DataViewLayoutOptionsSlots = [ - { - name: 'listicon', - description: 'Custom list icon template.' - }, - { - name: 'gridicon', - description: 'Custom grid icon template.' - } -]; - -module.exports = { - dataviewlayoutoptions: { - name: 'DataViewLayoutOptions', - description: 'When both layout modes are enabled in DataView, a UI element would be necessary to let the user toggle between the view. DataViewLayoutOptions is a helper component to display a buttonset to choose the layout mode in DataView.', - 'doc-url': 'dataview', - props: DataViewLayoutOptionsProps, - slots: DataViewLayoutOptionsSlots - } -}; diff --git a/components/doc/codeeditor/templates.js b/components/doc/codeeditor/templates.js index bab0b1c44..c3a2d48b8 100644 --- a/components/doc/codeeditor/templates.js +++ b/components/doc/codeeditor/templates.js @@ -173,7 +173,6 @@ import ConfirmationService from 'primevue/confirmationservice'; import ContextMenu from 'primevue/contextmenu'; import DataTable from 'primevue/datatable'; import DataView from 'primevue/dataview'; -import DataViewLayoutOptions from 'primevue/dataviewlayoutoptions'; import DeferredContent from 'primevue/deferredcontent'; import Dialog from 'primevue/dialog'; import DialogService from 'primevue/dialogservice' @@ -294,7 +293,6 @@ app.component('ConfirmPopup', ConfirmPopup); app.component('ContextMenu', ContextMenu); app.component('DataTable', DataTable); app.component('DataView', DataView); -app.component('DataViewLayoutOptions', DataViewLayoutOptions); app.component('DeferredContent', DeferredContent); app.component('Dialog', Dialog); app.component('Divider', Divider); diff --git a/components/lib/config/PrimeVue.d.ts b/components/lib/config/PrimeVue.d.ts index 178295e11..e0d1ad714 100644 --- a/components/lib/config/PrimeVue.d.ts +++ b/components/lib/config/PrimeVue.d.ts @@ -26,7 +26,6 @@ import { ConfirmPopupPassThroughOptions } from '../confirmpopup'; import { ContextMenuPassThroughOptions } from '../contextmenu'; import { DataTablePassThroughOptions } from '../datatable'; import { DataViewPassThroughOptions } from '../dataview'; -import { DataViewLayoutOptionsPassThroughOptions } from '../dataviewlayoutoptions'; import { DeferredContentPassThroughOptions } from '../deferredcontent'; import { DialogPassThroughOptions } from '../dialog'; import { DividerPassThroughOptions } from '../divider'; @@ -148,7 +147,6 @@ export interface PrimeVuePTOptions { contextmenu?: DefaultPassThrough; datatable?: DefaultPassThrough; dataview?: DefaultPassThrough; - dataviewlayoutoptions?: DefaultPassThrough; deferredcontent?: DefaultPassThrough; divider?: DefaultPassThrough; dialog?: DefaultPassThrough; diff --git a/components/lib/dataview/DataView.d.ts b/components/lib/dataview/DataView.d.ts index a5967c9d7..2af9157d5 100755 --- a/components/lib/dataview/DataView.d.ts +++ b/components/lib/dataview/DataView.d.ts @@ -328,7 +328,7 @@ export interface DataViewEmits { } /** - * **PrimeVue - DataViewLayoutOptions** + * **PrimeVue - DataView** * * _DataView displays data in grid or list layout with pagination and sorting features._ * diff --git a/components/lib/dataviewlayoutoptions/BaseDataViewLayoutOptions.vue b/components/lib/dataviewlayoutoptions/BaseDataViewLayoutOptions.vue deleted file mode 100644 index 88cc9530a..000000000 --- a/components/lib/dataviewlayoutoptions/BaseDataViewLayoutOptions.vue +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.d.ts b/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.d.ts deleted file mode 100755 index 85d64a02c..000000000 --- a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.d.ts +++ /dev/null @@ -1,185 +0,0 @@ -/** - * - * The helper DataViewLayoutOptions component can be used to switch between the modes however this component is optional and you may use your own UI to switch modes as well. - * - * [Live Demo](https://www.primevue.org/dataview/) - * - * @module dataviewlayoutoptions - * - */ -import { VNode } from 'vue'; -import { ComponentHooks } from '../basecomponent'; -import { PassThroughOptions } from '../passthrough'; -import { SelectButtonPassThroughOptions } from '../selectbutton'; -import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers'; - -export declare type DataViewLayoutOptionsPassThroughOptionType = - | DataViewLayoutOptionsPassThroughAttributes - | ((options: DataViewLayoutOptionsPassThroughMethodOptions) => DataViewLayoutOptionsPassThroughAttributes | string) - | string - | null - | undefined; - -/** - * Custom passthrough(pt) option method. - */ -export interface DataViewLayoutOptionsPassThroughMethodOptions { - /** - * Defines instance. - */ - instance: any; - /** - * Defines valid properties. - */ - props: DataViewLayoutOptionsProps; - /** - * Defines current inline state. - */ - state: DataViewLayoutOptionsState; - /** - * Defines valid attributes. - */ - attrs: any; - /** - * Defines parent options. - */ - parent: any; - /** - * Defines passthrough(pt) options in global config. - */ - global: object | undefined; -} - -/** - * Custom passthrough(pt) options. - * @see {@link DataViewLayoutOptionsProps.pt} - */ -export interface DataViewLayoutOptionsPassThroughOptions { - /** - * Used to pass attributes to the root's DOM element. - * @see {@link SelectButtonPassThroughOptions} - */ - root?: SelectButtonPassThroughOptions; - /** - * Used to pass attributes to the root's DOM element. - * @see {@link SelectButtonPassThroughOptions} - */ - selectbutton?: SelectButtonPassThroughOptions; - /** - * Used to pass attributes to the list icon's DOM element. - */ - listIcon?: DataViewLayoutOptionsPassThroughOptionType; - /** - * Used to pass attributes to the grid icon's DOM element. - */ - gridIcon?: DataViewLayoutOptionsPassThroughOptionType; - /** - * Used to manage all lifecycle hooks. - * @see {@link BaseComponent.ComponentHooks} - */ - hooks?: ComponentHooks; -} - -/** - * Custom passthrough attributes for each DOM elements - */ -export interface DataViewLayoutOptionsPassThroughAttributes { - [key: string]: any; -} - -/** - * Defines current inline state in DataViewLayoutOptions component. - */ -export interface DataViewLayoutOptionsState { - /** - * Default options of the component. - * @defaultValue ['list', 'grid'] - */ - options: string[]; -} - -/** - * Custom shared passthrough(pt) option method. - */ -export interface DataViewLayoutOptionsSharedPassThroughMethodOptions { - /** - * Defines valid properties. - */ - props: DataViewLayoutOptionsProps; - /** - * Defines current inline state. - */ - state: DataViewLayoutOptionsState; -} - -/** - * Defines valid properties in DataViewLayoutOptions component. - */ -export interface DataViewLayoutOptionsProps { - /** - * Value of the component. - */ - modelValue?: string | undefined; - /** - * Used to pass attributes to DOM elements inside the component. - * @type {DataViewLayoutOptionsPassThroughOptions} - */ - pt?: PassThrough; - /** - * Used to configure passthrough(pt) options of the component. - * @type {PassThroughOptions} - */ - ptOptions?: PassThroughOptions; - /** - * When enabled, it removes component related styles in the core. - * @defaultValue false - */ - unstyled?: boolean; -} - -/** - * Defines valid slots in DataViewLayoutOptions component. - */ -export interface DataViewLayoutOptionsSlots { - /** - * Custom list icon template. - */ - listicon(): VNode[]; - /** - * Custom grid icon template. - */ - gridicon(): VNode[]; -} - -/** - * Defines valid emits in DataViewLayoutOptions component. - */ -export interface DataViewLayoutOptionsEmits { - /** - * Emitted when the value changes. - * @param {*} value - New value. - */ - 'update:modelValue'(value: string): void; -} - -/** - * **PrimeVue - DataViewLayoutOptions** - * - * _The helper DataViewLayoutOptions component can be used to switch between the modes however this component is optional and you may use your own UI to switch modes as well._ - * - * [Live Demo](https://www.primevue.org/dataview/) - * --- --- - * ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png) - * - * @group Component - * - */ -declare class DataViewLayoutOptions extends ClassComponent {} - -declare module 'vue' { - export interface GlobalComponents { - DataViewLayoutOptions: GlobalComponentConstructor; - } -} - -export default DataViewLayoutOptions; diff --git a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js b/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js deleted file mode 100644 index 6d8c70d4d..000000000 --- a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js +++ /dev/null @@ -1,18 +0,0 @@ -import { mount } from '@vue/test-utils'; -import DataViewLayoutOptions from './DataViewLayoutOptions.vue'; - -describe('DataViewLayoutOptions.vue', () => { - it('should exist', async () => { - const wrapper = mount(DataViewLayoutOptions, { - props: { - modelValue: 'grid' - } - }); - - expect(wrapper.find('.p-dataview-layout-options').exists()).toBe(true); - - wrapper.vm.$emit('update:modelValue', 'list'); - - expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['list']); - }); -}); diff --git a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.vue b/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.vue deleted file mode 100755 index 6c8ad6554..000000000 --- a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - diff --git a/components/lib/dataviewlayoutoptions/package.json b/components/lib/dataviewlayoutoptions/package.json deleted file mode 100644 index 3b647bf26..000000000 --- a/components/lib/dataviewlayoutoptions/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "main": "./dataviewlayoutoptions.cjs.js", - "module": "./dataviewlayoutoptions.esm.js", - "unpkg": "./dataviewlayoutoptions.min.js", - "types": "./DataViewLayoutOptions.d.ts", - "browser": { - "./sfc": "./DataViewLayoutOptions.vue" - } -} diff --git a/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.d.ts b/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.d.ts deleted file mode 100644 index 7a110117f..000000000 --- a/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { BaseStyle } from '../../base/style'; - -export interface DataViewLayoutOptionsStyle extends BaseStyle {} diff --git a/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js b/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js deleted file mode 100644 index 1ce569e3d..000000000 --- a/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js +++ /dev/null @@ -1,10 +0,0 @@ -import BaseStyle from 'primevue/base/style'; - -const classes = { - root: 'p-dataview-layout-options' -}; - -export default BaseStyle.extend({ - name: 'dataviewlayoutoptions', - classes -}); diff --git a/components/lib/dataviewlayoutoptions/style/package.json b/components/lib/dataviewlayoutoptions/style/package.json deleted file mode 100644 index 33c6700e4..000000000 --- a/components/lib/dataviewlayoutoptions/style/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "main": "./dataviewlayoutoptionsstyle.cjs.js", - "module": "./dataviewlayoutoptionsstyle.esm.js", - "unpkg": "./dataviewlayoutoptionsstyle.min.js", - "types": "./DataViewLayoutOptionsStyle.d.ts" -} diff --git a/doc/dataview/ImportDoc.vue b/doc/dataview/ImportDoc.vue index 84539ad17..ac8c94c70 100644 --- a/doc/dataview/ImportDoc.vue +++ b/doc/dataview/ImportDoc.vue @@ -10,7 +10,6 @@ export default { code: { basic: ` import DataView from 'primevue/dataview'; -import DataViewLayoutOptions from 'primevue/dataviewlayoutoptions' // optional ` } }; diff --git a/doc/dataview/LayoutDoc.vue b/doc/dataview/LayoutDoc.vue index feea4dc18..bce10e22e 100644 --- a/doc/dataview/LayoutDoc.vue +++ b/doc/dataview/LayoutDoc.vue @@ -1,15 +1,16 @@