@vuetify/nightly 2.6.10-master-20220908.0 → 2.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,9 +10,6 @@ import ripple from '../../../directives/ripple'
10
10
  // Mixins
11
11
  import CalendarBase from './calendar-base'
12
12
 
13
- // Helpers
14
- import { escapeHTML } from '../../../util/helpers'
15
-
16
13
  // Util
17
14
  import props from '../util/props'
18
15
  import {
@@ -116,7 +113,7 @@ export default CalendarBase.extend({
116
113
  eventNameFunction (): CalendarEventNameFunction {
117
114
  return typeof this.eventName === 'function'
118
115
  ? this.eventName
119
- : (event, timedEvent) => escapeHTML(event.input[this.eventName as string] as string || '')
116
+ : (event, timedEvent) => event.input[this.eventName as string] as string || ''
120
117
  },
121
118
  eventModeFunction (): CalendarEventOverlapMode {
122
119
  return typeof this.eventOverlapMode === 'function'
@@ -303,16 +300,23 @@ export default CalendarBase.extend({
303
300
  const eventSummary = () => {
304
301
  const name = this.eventNameFunction(event, timedEvent)
305
302
  if (event.start.hasTime) {
306
- const eventSummaryClass = 'v-event-summary'
307
303
  if (timedEvent) {
308
304
  const time = timeSummary()
309
- const delimiter = singline ? ', ' : '<br>'
305
+ const delimiter = singline ? ', ' : this.$createElement('br')
310
306
 
311
- return `<span class="${eventSummaryClass}"><strong>${name}</strong>${delimiter}${time}</span>`
307
+ return this.$createElement('span', { staticClass: 'v-event-summary' }, [
308
+ this.$createElement('strong', [name]),
309
+ delimiter,
310
+ time,
311
+ ])
312
312
  } else {
313
313
  const time = formatTime(event.start, true)
314
314
 
315
- return `<span class="${eventSummaryClass}"><strong>${time}</strong> ${name}</span>`
315
+ return this.$createElement('span', { staticClass: 'v-event-summary' }, [
316
+ this.$createElement('strong', [time]),
317
+ ' ',
318
+ name,
319
+ ])
316
320
  }
317
321
  }
318
322
 
@@ -345,13 +349,10 @@ export default CalendarBase.extend({
345
349
  : [this.genName(eventSummary)]
346
350
  )
347
351
  },
348
- genName (eventSummary: () => string): VNode {
352
+ genName (eventSummary: () => string | VNode): VNode {
349
353
  return this.$createElement('div', {
350
354
  staticClass: 'pl-1',
351
- domProps: {
352
- innerHTML: eventSummary(),
353
- },
354
- })
355
+ }, [eventSummary()])
355
356
  },
356
357
  genPlaceholder (day: CalendarTimestamp): VNode {
357
358
  const height = this.eventHeight + this.eventMarginBottom
@@ -234,8 +234,8 @@ export default baseMixins.extend({
234
234
  // So we must have focused something outside the dialog and its children
235
235
  ) {
236
236
  // Find and focus the first available element inside the dialog
237
- const focusable = this.$refs.dialog.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
238
- const el = [...focusable].find(el => !el.hasAttribute('disabled')) as HTMLElement | undefined
237
+ const focusable = this.$refs.dialog.querySelectorAll('button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])')
238
+ const el = [...focusable].find(el => !el.hasAttribute('disabled') && !el.matches('[tabindex="-1"]')) as HTMLElement | undefined
239
239
  el && el.focus()
240
240
  }
241
241
  },
@@ -18,10 +18,7 @@ import Colorable from '../../mixins/colorable'
18
18
  import Themeable from '../../mixins/themeable'
19
19
 
20
20
  // Helpers
21
- import {
22
- escapeHTML,
23
- getPropertyFromItem,
24
- } from '../../util/helpers'
21
+ import { getPropertyFromItem } from '../../util/helpers'
25
22
 
26
23
  // Types
27
24
  import mixins from '../../util/mixins'
@@ -113,17 +110,17 @@ export default mixins(Colorable, Themeable).extend({
113
110
  genFilteredText (text: string) {
114
111
  text = text || ''
115
112
 
116
- if (!this.searchInput || this.noFilter) return escapeHTML(text)
113
+ if (!this.searchInput || this.noFilter) return text
117
114
 
118
115
  const { start, middle, end } = this.getMaskedCharacters(text)
119
116
 
120
- return `${escapeHTML(start)}${this.genHighlight(middle)}${escapeHTML(end)}`
117
+ return [start, this.genHighlight(middle), end]
121
118
  },
122
119
  genHeader (props: { [key: string]: any }): VNode {
123
120
  return this.$createElement(VSubheader, { props }, props.header)
124
121
  },
125
- genHighlight (text: string): string {
126
- return `<span class="v-list-item__mask">${escapeHTML(text)}</span>`
122
+ genHighlight (text: string) {
123
+ return this.$createElement('span', { staticClass: 'v-list-item__mask' }, text)
127
124
  },
128
125
  getMaskedCharacters (text: string): {
129
126
  start: string
@@ -202,13 +199,11 @@ export default mixins(Colorable, Themeable).extend({
202
199
  : scopedSlot
203
200
  },
204
201
  genTileContent (item: any, index = 0): VNode {
205
- const innerHTML = this.genFilteredText(this.getText(item))
206
-
207
- return this.$createElement(VListItemContent,
208
- [this.$createElement(VListItemTitle, {
209
- domProps: { innerHTML },
210
- })]
211
- )
202
+ return this.$createElement(VListItemContent, [
203
+ this.$createElement(VListItemTitle, [
204
+ this.genFilteredText(this.getText(item)),
205
+ ]),
206
+ ])
212
207
  },
213
208
  hasItem (item: object) {
214
209
  return this.parsedItems.indexOf(this.getValue(item)) > -1
@@ -162,16 +162,6 @@ export function getZIndex (el?: Element | null): number {
162
162
  return index
163
163
  }
164
164
 
165
- const tagsToReplace = {
166
- '&': '&amp;',
167
- '<': '&lt;',
168
- '>': '&gt;',
169
- } as any
170
-
171
- export function escapeHTML (str: string): string {
172
- return str.replace(/[&<>]/g, tag => tagsToReplace[tag] || tag)
173
- }
174
-
175
165
  export function filterObjectOnKeys<T, K extends keyof T> (obj: T, keys: K[]): { [N in K]: T[N] } {
176
166
  const filtered = {} as { [N in K]: T[N] }
177
167
 
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Vue, { Component, PluginFunction, VueConstructor, DirectiveOptions } from 'vue'
1
+ import Vue, { Component, PluginFunction, VueConstructor, DirectiveOptions, VNode } from 'vue'
2
2
  import './lib'
3
3
  import './alacarte'
4
4
  import './colors'
@@ -275,7 +275,7 @@ export type CalendarEventTimedFunction = (event: CalendarEvent) => boolean
275
275
 
276
276
  export type CalendarEventCategoryFunction = (event: CalendarEvent) => string
277
277
 
278
- export type CalendarEventNameFunction = (event: CalendarEventParsed, timedEvent: boolean) => string
278
+ export type CalendarEventNameFunction = (event: CalendarEventParsed, timedEvent: boolean) => string | VNode
279
279
 
280
280
  export type DataTableFilterFunction = (value: any, search: string | null, item: any) => boolean
281
281