mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Fixed #5292 - New ButtonSet component
This commit is contained in:
parent
1bb4f67536
commit
f2921594eb
8 changed files with 172 additions and 0 deletions
15
components/lib/buttonset/BaseButtonSet.vue
Normal file
15
components/lib/buttonset/BaseButtonSet.vue
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<script>
|
||||||
|
import BaseComponent from 'primevue/basecomponent';
|
||||||
|
import ButtonSetStyle from 'primevue/buttonset/style';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'BaseButtonSet',
|
||||||
|
extends: BaseComponent,
|
||||||
|
style: ButtonSetStyle,
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
$parentInstance: this
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
113
components/lib/buttonset/ButtonSet.d.ts
vendored
Normal file
113
components/lib/buttonset/ButtonSet.d.ts
vendored
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* A set of Buttons can be displayed together using the ButtonSet component.
|
||||||
|
*
|
||||||
|
* [Live Demo](https://www.primevue.org/button/)
|
||||||
|
*
|
||||||
|
* @module buttonset
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
import { VNode } from 'vue';
|
||||||
|
import { ComponentHooks } from '../basecomponent';
|
||||||
|
import { PassThroughOptions } from '../passthrough';
|
||||||
|
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
||||||
|
|
||||||
|
export declare type ButtonSetPassThroughOptionType = ButtonSetPassThroughAttributes | ((options: ButtonSetPassThroughMethodOptions) => ButtonSetPassThroughAttributes | string) | string | null | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) option method.
|
||||||
|
*/
|
||||||
|
export interface ButtonSetPassThroughMethodOptions {
|
||||||
|
/**
|
||||||
|
* Defines instance.
|
||||||
|
*/
|
||||||
|
instance: any;
|
||||||
|
/**
|
||||||
|
* Defines valid properties.
|
||||||
|
*/
|
||||||
|
props: ButtonSetProps;
|
||||||
|
/**
|
||||||
|
* Defines passthrough(pt) options in global config.
|
||||||
|
*/
|
||||||
|
global: object | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) options.
|
||||||
|
* @see {@link ButtonSetProps.pt}
|
||||||
|
*/
|
||||||
|
export interface ButtonSetPassThroughOptions {
|
||||||
|
/**
|
||||||
|
* Used to pass attributes to the root's DOM element.
|
||||||
|
*/
|
||||||
|
root?: ButtonSetPassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Used to manage all lifecycle hooks.
|
||||||
|
* @see {@link BaseComponent.ComponentHooks}
|
||||||
|
*/
|
||||||
|
hooks?: ComponentHooks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough attributes for each DOM elements
|
||||||
|
*/
|
||||||
|
export interface ButtonSetPassThroughAttributes {
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines valid properties in ButtonSet component.
|
||||||
|
*/
|
||||||
|
export interface ButtonSetProps {
|
||||||
|
/**
|
||||||
|
* Used to pass attributes to DOM elements inside the component.
|
||||||
|
* @type {ButtonSetPassThroughOptions}
|
||||||
|
*/
|
||||||
|
pt?: PassThrough<ButtonSetPassThroughOptions>;
|
||||||
|
/**
|
||||||
|
* 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 ButtonSet component.
|
||||||
|
*/
|
||||||
|
export interface ButtonSetSlots {
|
||||||
|
/**
|
||||||
|
* Default slot to detect Button components.
|
||||||
|
*/
|
||||||
|
default(): VNode[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines valid emits in ButtonSet component.
|
||||||
|
*/
|
||||||
|
export interface ButtonSetEmits {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* **PrimeVue - ButtonSet**
|
||||||
|
*
|
||||||
|
* _A set of Buttons can be displayed together using the ButtonSet component._
|
||||||
|
*
|
||||||
|
* [Live Demo](https://www.primevue.org/button/)
|
||||||
|
* --- ---
|
||||||
|
* 
|
||||||
|
*
|
||||||
|
* @group Component
|
||||||
|
*/
|
||||||
|
declare class ButtonSet extends ClassComponent<ButtonSetProps, ButtonSetSlots, ButtonSetEmits> {}
|
||||||
|
|
||||||
|
declare module '@vue/runtime-core' {
|
||||||
|
interface GlobalComponents {
|
||||||
|
ButtonSet: GlobalComponentConstructor<ButtonSet>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ButtonSet;
|
15
components/lib/buttonset/ButtonSet.vue
Normal file
15
components/lib/buttonset/ButtonSet.vue
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<template>
|
||||||
|
<span :class="cx('root')" v-bind="ptmi('root')">
|
||||||
|
<slot />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseButtonSet from './BaseButtonSet.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ButtonSet',
|
||||||
|
extends: BaseButtonSet,
|
||||||
|
inheritAttrs: false
|
||||||
|
};
|
||||||
|
</script>
|
9
components/lib/buttonset/package.json
Normal file
9
components/lib/buttonset/package.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"main": "./buttonset.cjs.js",
|
||||||
|
"module": "./buttonset.esm.js",
|
||||||
|
"unpkg": "./buttonset.min.js",
|
||||||
|
"types": "./ButtonSet.d.ts",
|
||||||
|
"browser": {
|
||||||
|
"./sfc": "./ButtonSet.vue"
|
||||||
|
}
|
||||||
|
}
|
3
components/lib/buttonset/style/ButtonSetStyle.d.ts
vendored
Normal file
3
components/lib/buttonset/style/ButtonSetStyle.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import { BaseStyle } from '../../base/style';
|
||||||
|
|
||||||
|
export interface ButtonStyle extends BaseStyle {}
|
10
components/lib/buttonset/style/ButtonSetStyle.js
Normal file
10
components/lib/buttonset/style/ButtonSetStyle.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import BaseStyle from 'primevue/base/style';
|
||||||
|
|
||||||
|
const classes = {
|
||||||
|
root: 'p-buttonset p-component'
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BaseStyle.extend({
|
||||||
|
name: 'buttonset',
|
||||||
|
classes
|
||||||
|
});
|
6
components/lib/buttonset/style/package.json
Normal file
6
components/lib/buttonset/style/package.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"main": "./buttonsetstyle.cjs.js",
|
||||||
|
"module": "./buttonsetstyle.esm.js",
|
||||||
|
"unpkg": "./buttonsetstyle.min.js",
|
||||||
|
"types": "./ButtonSetStyle.d.ts"
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ const STYLE_ALIAS = {
|
||||||
'primevue/blockui/style': path.resolve(__dirname, './components/lib/blockui/style/BlockUIStyle.js'),
|
'primevue/blockui/style': path.resolve(__dirname, './components/lib/blockui/style/BlockUIStyle.js'),
|
||||||
'primevue/breadcrumb/style': path.resolve(__dirname, './components/lib/breadcrumb/style/BreadcrumbStyle.js'),
|
'primevue/breadcrumb/style': path.resolve(__dirname, './components/lib/breadcrumb/style/BreadcrumbStyle.js'),
|
||||||
'primevue/button/style': path.resolve(__dirname, './components/lib/button/style/ButtonStyle.js'),
|
'primevue/button/style': path.resolve(__dirname, './components/lib/button/style/ButtonStyle.js'),
|
||||||
|
'primevue/buttonset/style': path.resolve(__dirname, './components/lib/buttonset/style/ButtonSetStyle.js'),
|
||||||
'primevue/calendar/style': path.resolve(__dirname, './components/lib/calendar/style/CalendarStyle.js'),
|
'primevue/calendar/style': path.resolve(__dirname, './components/lib/calendar/style/CalendarStyle.js'),
|
||||||
'primevue/card/style': path.resolve(__dirname, './components/lib/card/style/CardStyle.js'),
|
'primevue/card/style': path.resolve(__dirname, './components/lib/card/style/CardStyle.js'),
|
||||||
'primevue/carousel/style': path.resolve(__dirname, './components/lib/carousel/style/CarouselStyle.js'),
|
'primevue/carousel/style': path.resolve(__dirname, './components/lib/carousel/style/CarouselStyle.js'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue