or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

api-services.mdbase-classes.mdcomposables.mdconfiguration.mdindex.mdutilities.md

api-services.mddocs/

0

# API Services

1

2

Core API services providing data filtering capabilities, UI icon constants, and message severity levels. These services form the foundation for data-driven PrimeVue components.

3

4

## Capabilities

5

6

### FilterService

7

8

Provides comprehensive data filtering functionality with support for various filter modes and localization.

9

10

```typescript { .api }

11

declare namespace FilterService {

12

/**

13

* Filter an array of data based on field values and filter criteria

14

* @param value - Array of data to filter

15

* @param fields - Array of field names to search in

16

* @param filterValue - Value to filter by

17

* @param filterMatchMode - Type of filter to apply (from FilterMatchMode)

18

* @param filterLocale - Optional locale for string comparisons

19

* @returns Filtered array

20

*/

21

function filter(

22

value: any[],

23

fields: string[],

24

filterValue: any,

25

filterMatchMode: string,

26

filterLocale?: string

27

): any[];

28

29

/**

30

* Register a custom filter function

31

* @param rule - Name of the custom filter

32

* @param fn - Filter function implementation

33

*/

34

function register(rule: string, fn: (...arg: any[]) => boolean): void;

35

36

interface filters {

37

startsWith(value: any, filter: string, filterLocale?: string): boolean;

38

contains(value: any, filter: string, filterLocale?: string): boolean;

39

notContains(value: any, filter: string, filterLocale?: string): boolean;

40

endsWith(value: any, filter: string, filterLocale?: string): boolean;

41

equals(value: any, filter: string, filterLocale?: string): boolean;

42

notEquals(value: any, filter: string, filterLocale?: string): boolean;

43

in(value: any, filter: string): boolean;

44

between(value: any, filter: string): boolean;

45

lt(value: any, filter: string): boolean;

46

lte(value: any, filter: string): boolean;

47

gt(value: any, filter: string): boolean;

48

gte(value: any, filter: string): boolean;

49

dateIs(value: any, filter: string): boolean;

50

dateIsNot(value: any, filter: string): boolean;

51

dateBefore(value: any, filter: string): boolean;

52

dateAfter(value: any, filter: string): boolean;

53

}

54

}

55

```

56

57

**Usage Examples:**

58

59

```typescript

60

import { FilterService, FilterMatchMode } from '@primevue/core/api';

61

62

// Filter users by name containing 'john'

63

const users = [

64

{ name: 'John Doe', email: 'john@example.com' },

65

{ name: 'Jane Smith', email: 'jane@example.com' },

66

{ name: 'Johnny Cash', email: 'johnny@example.com' }

67

];

68

69

const filtered = FilterService.filter(

70

users,

71

['name'],

72

'john',

73

FilterMatchMode.CONTAINS

74

);

75

// Result: [{ name: 'John Doe', ... }, { name: 'Johnny Cash', ... }]

76

77

// Register custom filter

78

FilterService.register('customMatch', (value, filter) => {

79

return value.toLowerCase().includes(filter.toLowerCase());

80

});

81

```

82

83

### FilterMatchMode

84

85

Constants defining available filter matching modes for use with FilterService.

86

87

```typescript { .api }

88

interface FilterMatchModeOptions {

89

readonly STARTS_WITH: string; // 'startsWith'

90

readonly CONTAINS: string; // 'contains'

91

readonly NOT_CONTAINS: string; // 'notContains'

92

readonly ENDS_WITH: string; // 'endsWith'

93

readonly EQUALS: string; // 'equals'

94

readonly NOT_EQUALS: string; // 'notEquals'

95

readonly IN: string; // 'in'

96

readonly LESS_THAN: string; // 'lt'

97

readonly LESS_THAN_OR_EQUAL_TO: string; // 'lte'

98

readonly GREATER_THAN: string; // 'gt'

99

readonly GREATER_THAN_OR_EQUAL_TO: string; // 'gte'

100

readonly BETWEEN: string; // 'between'

101

readonly DATE_IS: string; // 'dateIs'

102

readonly DATE_IS_NOT: string; // 'dateIsNot'

103

readonly DATE_BEFORE: string; // 'dateBefore'

104

readonly DATE_AFTER: string; // 'dateAfter'

105

}

106

107

declare const FilterMatchMode: FilterMatchModeOptions;

108

```

109

110

### FilterOperator

111

112

Logical operators for combining multiple filter conditions.

113

114

```typescript { .api }

115

interface FilterOperatorOptions {

116

readonly AND: string; // 'and'

117

readonly OR: string; // 'or'

118

}

119

120

declare const FilterOperator: FilterOperatorOptions;

121

```

122

123

### PrimeIcons

124

125

Comprehensive set of icon constants for PrimeVue UI components (280+ icons).

126

127

```typescript { .api }

128

interface PrimeIconsOptions {

129

// Navigation icons (selection)

130

readonly ANGLE_DOWN: string; // 'pi pi-angle-down'

131

readonly ANGLE_UP: string; // 'pi pi-angle-up'

132

readonly ANGLE_LEFT: string; // 'pi pi-angle-left'

133

readonly ANGLE_RIGHT: string; // 'pi pi-angle-right'

134

readonly ARROW_DOWN: string; // 'pi pi-arrow-down'

135

readonly ARROW_UP: string; // 'pi pi-arrow-up'

136

readonly ARROW_LEFT: string; // 'pi pi-arrow-left'

137

readonly ARROW_RIGHT: string; // 'pi pi-arrow-right'

138

readonly CHEVRON_DOWN: string; // 'pi pi-chevron-down'

139

readonly CHEVRON_UP: string; // 'pi pi-chevron-up'

140

readonly CHEVRON_LEFT: string; // 'pi pi-chevron-left'

141

readonly CHEVRON_RIGHT: string; // 'pi pi-chevron-right'

142

143

// Action icons (selection)

144

readonly CHECK: string; // 'pi pi-check'

145

readonly TIMES: string; // 'pi pi-times'

146

readonly PLUS: string; // 'pi pi-plus'

147

readonly MINUS: string; // 'pi pi-minus'

148

readonly PENCIL: string; // 'pi pi-pencil'

149

readonly TRASH: string; // 'pi pi-trash'

150

readonly SAVE: string; // 'pi pi-save'

151

readonly COPY: string; // 'pi pi-copy'

152

readonly DOWNLOAD: string; // 'pi pi-download'

153

readonly UPLOAD: string; // 'pi pi-upload'

154

readonly REFRESH: string; // 'pi pi-refresh'

155

readonly SEARCH: string; // 'pi pi-search'

156

readonly FILTER: string; // 'pi pi-filter'

157

readonly SORT: string; // 'pi pi-sort'

158

159

// UI element icons (selection)

160

readonly BARS: string; // 'pi pi-bars'

161

readonly COG: string; // 'pi pi-cog'

162

readonly HOME: string; // 'pi pi-home'

163

readonly USER: string; // 'pi pi-user'

164

readonly CALENDAR: string; // 'pi pi-calendar'

165

readonly CLOCK: string; // 'pi pi-clock'

166

readonly ENVELOPE: string; // 'pi pi-envelope'

167

readonly PHONE: string; // 'pi pi-phone'

168

readonly GLOBE: string; // 'pi pi-globe'

169

readonly INFO: string; // 'pi pi-info'

170

readonly QUESTION: string; // 'pi pi-question'

171

readonly EXCLAMATION_TRIANGLE: string; // 'pi pi-exclamation-triangle'

172

readonly EXCLAMATION_CIRCLE: string; // 'pi pi-exclamation-circle'

173

174

// Media control icons (selection)

175

readonly PLAY: string; // 'pi pi-play'

176

readonly PAUSE: string; // 'pi pi-pause'

177

readonly STOP: string; // 'pi pi-stop'

178

readonly FORWARD: string; // 'pi pi-forward'

179

readonly BACKWARD: string; // 'pi pi-backward'

180

readonly FAST_FORWARD: string; // 'pi pi-fast-forward'

181

readonly FAST_BACKWARD: string; // 'pi pi-fast-backward'

182

readonly STEP_FORWARD: string; // 'pi pi-step-forward'

183

readonly STEP_BACKWARD: string; // 'pi pi-step-backward'

184

readonly VOLUME_UP: string; // 'pi pi-volume-up'

185

readonly VOLUME_DOWN: string; // 'pi pi-volume-down'

186

readonly VOLUME_OFF: string; // 'pi pi-volume-off'

187

188

// Social media icons (selection)

189

readonly FACEBOOK: string; // 'pi pi-facebook'

190

readonly TWITTER: string; // 'pi pi-twitter'

191

readonly LINKEDIN: string; // 'pi pi-linkedin'

192

readonly GITHUB: string; // 'pi pi-github'

193

readonly GOOGLE: string; // 'pi pi-google'

194

readonly INSTAGRAM: string; // 'pi pi-instagram'

195

readonly YOUTUBE: string; // 'pi pi-youtube'

196

readonly DISCORD: string; // 'pi pi-discord'

197

readonly SLACK: string; // 'pi pi-slack'

198

199

// And 230+ more icon constants including:

200

// Business: BRIEFCASE, BUILDING, CALCULATOR, CHART_BAR, CHART_LINE, CHART_PIE

201

// File operations: FILE, FILE_EDIT, FILE_EXCEL, FILE_PDF, FILE_WORD, FOLDER

202

// Shopping: SHOPPING_CART, SHOPPING_BAG, CART_PLUS, MONEY_BILL

203

// Communication: COMMENTS, MICROPHONE, BELL, ENVELOPE

204

// Technology: DESKTOP, MOBILE, TABLET, WIFI, CODE, DATABASE

205

// And many more organized by category

206

}

207

208

declare const PrimeIcons: PrimeIconsOptions;

209

```

210

211

**Usage Examples:**

212

213

```typescript

214

import { PrimeIcons } from '@primevue/core/api';

215

216

// Use in templates

217

const searchIcon = PrimeIcons.SEARCH; // 'pi pi-search'

218

const saveIcon = PrimeIcons.SAVE; // 'pi pi-save'

219

220

// Common usage in Vue components

221

<template>

222

<button>

223

<i :class="PrimeIcons.SEARCH"></i>

224

Search

225

</button>

226

</template>

227

```

228

229

### ToastSeverity

230

231

Severity level constants for toast notifications and alert messages.

232

233

```typescript { .api }

234

interface ToastSeverityOptions {

235

readonly SUCCESS: string; // 'success'

236

readonly INFO: string; // 'info'

237

readonly WARN: string; // 'warn'

238

readonly ERROR: string; // 'error'

239

}

240

241

declare const ToastSeverity: ToastSeverityOptions;

242

```

243

244

**Usage Examples:**

245

246

```typescript

247

import { ToastSeverity } from '@primevue/core/api';

248

249

// Use with toast service

250

toast.add({

251

severity: ToastSeverity.SUCCESS,

252

summary: 'Success',

253

detail: 'Operation completed successfully'

254

});

255

256

toast.add({

257

severity: ToastSeverity.ERROR,

258

summary: 'Error',

259

detail: 'Something went wrong'

260

});

261

```

262

263

## Import Patterns

264

265

```typescript

266

// Named imports from main package

267

import { FilterService, FilterMatchMode, PrimeIcons, ToastSeverity } from '@primevue/core';

268

269

// Modular imports (recommended)

270

import { FilterService, FilterMatchMode, FilterOperator, PrimeIcons, ToastSeverity } from '@primevue/core/api';

271

272

// Individual imports

273

import FilterService from '@primevue/core/api/FilterService';

274

import FilterMatchMode from '@primevue/core/api/FilterMatchMode';

275

```