@quasar/quasar-ui-qiconpicker 2.0.3 → 2.0.6

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.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/icon-set/bootstrap-icons.umd.js +3 -3
  3. package/dist/icon-set/eva-icons.umd.js +2 -2
  4. package/dist/icon-set/fontawesome-v5.umd.js +2 -2
  5. package/dist/icon-set/ionicons-v4.umd.js +2 -2
  6. package/dist/icon-set/line-awesome.umd.js +2 -2
  7. package/dist/icon-set/material-icons-outlined.umd.js +3 -3
  8. package/dist/icon-set/material-icons-round.umd.js +3 -3
  9. package/dist/icon-set/material-icons-sharp.umd.js +3 -3
  10. package/dist/icon-set/material-icons.umd.js +3 -3
  11. package/dist/icon-set/mdi-v4.umd.js +2 -2
  12. package/dist/icon-set/mdi-v5.umd.js +2 -2
  13. package/dist/icon-set/mdi-v6.umd.js +3 -3
  14. package/dist/icon-set/themify.umd.js +2 -2
  15. package/dist/{index.common.js → index.cjs.js} +128 -131
  16. package/dist/index.cjs.min.js +6 -0
  17. package/dist/index.css +2 -2
  18. package/dist/index.esm.js +128 -131
  19. package/dist/index.esm.min.js +3 -3
  20. package/dist/index.min.css +2 -2
  21. package/dist/index.rtl.css +2 -2
  22. package/dist/index.rtl.min.css +2 -2
  23. package/dist/index.umd.js +128 -131
  24. package/dist/index.umd.min.js +3 -3
  25. package/dist/types/index.d.ts +0 -1
  26. package/package.json +27 -27
  27. package/src/components/icon-set/bootstrap-icons.js +212 -1
  28. package/src/components/icon-set/material-icons-outlined.js +223 -14
  29. package/src/components/icon-set/material-icons-round.js +223 -14
  30. package/src/components/icon-set/material-icons-sharp.js +223 -14
  31. package/src/components/icon-set/material-icons.js +223 -14
  32. package/src/components/icon-set/mdi-v6.js +400 -0
  33. package/src/{index.common.js → index.cjs.js} +0 -0
  34. package/src/index.js +2 -2
  35. package/src/version.js +1 -0
  36. package/src/vue-plugin.js +1 -1
  37. package/dist/index.common.min.js +0 -6
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @quasar/quasar-ui-qiconpicker v2.0.3
3
- * (c) 2021 Jeff Galbraith <jeff@quasar.dev>
2
+ * @quasar/quasar-ui-qiconpicker v2.0.5
3
+ * (c) 2022 Jeff Galbraith <jeff@quasar.dev>
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
@@ -13,11 +13,11 @@
13
13
  /**
14
14
  * QIconPicker Properties
15
15
  */
16
- var useIconPickerProps = {
16
+ const useIconPickerProps = {
17
17
  modelValue: String,
18
18
  iconSet: {
19
19
  type: String,
20
- validator: function (v) { return [
20
+ validator: v => [
21
21
  'material-icons',
22
22
  'material-icons-outlined',
23
23
  'material-icons-round',
@@ -32,7 +32,7 @@
32
32
  'line-awesome',
33
33
  'bootstrap-icons',
34
34
  ''
35
- ].includes(v); },
35
+ ].includes(v),
36
36
  default: ''
37
37
  },
38
38
  icons: Array,
@@ -57,10 +57,10 @@
57
57
  },
58
58
  paginationProps: {
59
59
  type: Object,
60
- default: function () { return ({
60
+ default: () => ({
61
61
  maxPages: 5,
62
62
  input: true
63
- }); }
63
+ })
64
64
  },
65
65
  modelPagination: Object,
66
66
  animated: Boolean,
@@ -74,7 +74,7 @@
74
74
  }
75
75
  };
76
76
 
77
- var direction = {
77
+ const direction = {
78
78
  NEXT: 'next',
79
79
  PREV: 'prev'
80
80
  };
@@ -97,7 +97,7 @@
97
97
  // returns true if the pagination is the same,
98
98
  // otherwise returns false if it has changed
99
99
  function samePagination(oldPag, newPag) {
100
- for (var prop in newPag) {
100
+ for (const prop in newPag) {
101
101
  if (newPag[ prop ] !== oldPag[ prop ]) {
102
102
  return false
103
103
  }
@@ -105,19 +105,23 @@
105
105
  return true
106
106
  }
107
107
 
108
- var computedPagination = vue.computed(function () {
109
- return fixPagination(Object.assign({}, data.innerPagination,
110
- props.modelPagination))
108
+ const computedPagination = vue.computed(() => {
109
+ return fixPagination({
110
+ ...data.innerPagination,
111
+ ...props.modelPagination
112
+ })
111
113
  });
112
114
 
113
- var computedPagesNumber = vue.computed(function () {
115
+ const computedPagesNumber = vue.computed(() => {
114
116
  return computedPagination.value.itemsPerPage === 0 ? 1
115
117
  : Math.max(1, Math.ceil(computedFilteredIcons.value.length / computedPagination.value.itemsPerPage))
116
118
  });
117
119
 
118
120
  function setPagination(val) {
119
- var newPagination = fixPagination(Object.assign({}, computedPagination.value,
120
- val));
121
+ const newPagination = fixPagination({
122
+ ...computedPagination.value,
123
+ ...val
124
+ });
121
125
 
122
126
  if (!samePagination(data.innerPagination, newPagination)) {
123
127
  if (props.modelPagination) {
@@ -134,11 +138,11 @@
134
138
  }
135
139
 
136
140
  return {
137
- samePagination: samePagination,
138
- computedPagination: computedPagination,
139
- setPagination: setPagination,
140
- updatePagination: updatePagination,
141
- computedPagesNumber: computedPagesNumber
141
+ samePagination,
142
+ computedPagination,
143
+ setPagination,
144
+ updatePagination,
145
+ computedPagesNumber
142
146
  }
143
147
  }
144
148
 
@@ -152,29 +156,29 @@
152
156
  if (iconSet) {
153
157
  // detect if UMD version is installed
154
158
  if (window.QIconPicker) {
155
- var name = iconSet.replace(/-([a-z])/g, function (g) { return g[ 1 ].toUpperCase(); });
159
+ const name = iconSet.replace(/-([a-z])/g, g => g[ 1 ].toUpperCase());
156
160
  if (window.QIconPicker.iconSet && window.QIconPicker.iconSet[ name ]) {
157
161
  data.iconsList = window.QIconPicker.iconSet[ name ].icons;
158
162
  }
159
163
  else {
160
- console.error(("QIconPicker: no icon set loaded called " + iconSet));
164
+ console.error(`QIconPicker: no icon set loaded called ${ iconSet }`);
161
165
  console.error('Be sure to load the UMD version of the icon set in a script tag before using QIconPicker UMD version');
162
166
  }
163
167
  }
164
168
  else {
165
169
  try {
166
- data.iconsList = require(("@quasar/quasar-ui-qiconpicker/src/components/icon-set/" + iconSet + ".js")).default.icons;
170
+ data.iconsList = require(`@quasar/quasar-ui-qiconpicker/src/components/icon-set/${ iconSet }.js`).default.icons;
167
171
  }
168
172
  catch (e) {
169
- console.error(("QIconPicker: cannot find icon set found called " + iconSet));
173
+ console.error(`QIconPicker: cannot find icon set found called ${ iconSet }`);
170
174
  }
171
175
  }
172
176
  }
173
- console.info(("Loaded " + (data.iconsList.length) + " icons."));
177
+ console.info(`Loaded ${ data.iconsList.length } icons.`);
174
178
  }
175
179
 
176
- var computedDisplayedIcons = vue.computed(function () {
177
- var icons = [];
180
+ const computedDisplayedIcons = vue.computed(() => {
181
+ let icons = [];
178
182
  if (data.iconsList) {
179
183
  icons = computedFilteredIcons.value;
180
184
 
@@ -186,27 +190,27 @@
186
190
  return icons
187
191
  });
188
192
 
189
- var computedFilteredIcons = vue.computed(function () {
190
- var icons = data.iconsList;
193
+ const computedFilteredIcons = vue.computed(() => {
194
+ let icons = data.iconsList;
191
195
  if (icons) {
192
196
  if (props.tags !== void 0 && props.tags !== '' && props.tags !== null && props.tags.length > 0) {
193
- icons = icons.filter(function (icon) {
194
- return icon.tags.filter(function (tag) { return props.tags.includes(tag); }).length > 0
197
+ icons = icons.filter(icon => {
198
+ return icon.tags.filter(tag => props.tags.includes(tag)).length > 0
195
199
  });
196
200
  }
197
201
  if (props.filter !== void 0 && props.filter !== '' && props.filter !== null) {
198
- icons = icons.filter(function (icon) { return icon.name.includes(props.filter); });
202
+ icons = icons.filter(icon => icon.name.includes(props.filter));
199
203
  }
200
204
  }
201
205
  return icons
202
206
  });
203
207
 
204
208
  function categories() {
205
- var t = [];
206
- data.iconsList.forEach(function (icon) {
207
- var tags = icon.tags;
209
+ const t = [];
210
+ data.iconsList.forEach(icon => {
211
+ const tags = icon.tags;
208
212
  if (tags && tags.length > 0) {
209
- tags.forEach(function (tag) {
213
+ tags.forEach(tag => {
210
214
  if (t.includes(tag) !== true) {
211
215
  t.push(tag);
212
216
  }
@@ -219,10 +223,10 @@
219
223
  }
220
224
 
221
225
  return {
222
- loadIconSet: loadIconSet,
223
- computedDisplayedIcons: computedDisplayedIcons,
224
- computedFilteredIcons: computedFilteredIcons,
225
- categories: categories
226
+ loadIconSet,
227
+ computedDisplayedIcons,
228
+ computedFilteredIcons,
229
+ categories
226
230
  }
227
231
  }
228
232
 
@@ -231,9 +235,8 @@
231
235
  */
232
236
  function exposeIconPickerApi(data, expose, computedPagination, setPagination, computedFirstItemIndex, computedLastItemIndex, computedFilteredIcons, computedPagesNumber) {
233
237
  // goes to previous page
234
- var prevPage = function () {
235
- var ref = computedPagination.value;
236
- var page = ref.page;
238
+ const prevPage = () => {
239
+ const { page } = computedPagination.value;
237
240
  if (page > 1) {
238
241
  setPagination({ page: page - 1 });
239
242
  data.direction = direction.PREV;
@@ -241,10 +244,8 @@
241
244
  };
242
245
 
243
246
  // goes to next page
244
- var nextPage = function () {
245
- var ref = computedPagination.value;
246
- var page = ref.page;
247
- var itemsPerPage = ref.itemsPerPage;
247
+ const nextPage = () => {
248
+ const { page, itemsPerPage } = computedPagination.value;
248
249
  if (computedLastItemIndex.value > 0 && page * itemsPerPage < computedFilteredIcons.value.length) {
249
250
  setPagination({ page: page + 1 });
250
251
  data.direction = direction.NEXT;
@@ -252,17 +253,17 @@
252
253
  };
253
254
 
254
255
  // goes to last page
255
- var lastPage = function () {
256
+ const lastPage = () => {
256
257
  setPagination({ page: computedPagesNumber.value });
257
258
  };
258
259
 
259
260
  // goes to first page
260
- var firstPage = function () {
261
+ const firstPage = () => {
261
262
  setPagination({ page: 0 });
262
263
  };
263
264
 
264
265
  // checks if we are on the last page
265
- var isLastPage = vue.computed(function () {
266
+ const isLastPage = vue.computed(() => {
266
267
  return computedLastItemIndex.value === 0
267
268
  ? true
268
269
  : computedPagination.value.page >= computedPagesNumber.value
@@ -270,17 +271,17 @@
270
271
 
271
272
 
272
273
  // checks if we are on the first page
273
- var isFirstPage = vue.computed(function () {
274
+ const isFirstPage = vue.computed(() => {
274
275
  return computedPagination.value.page === 1
275
276
  });
276
277
 
277
278
  expose({
278
- prevPage: prevPage,
279
- nextPage: nextPage,
280
- lastPage: lastPage,
281
- firstPage: firstPage,
282
- isLastPage: isLastPage,
283
- isFirstPage: isFirstPage
279
+ prevPage,
280
+ nextPage,
281
+ lastPage,
282
+ firstPage,
283
+ isLastPage,
284
+ isFirstPage
284
285
  });
285
286
  }
286
287
 
@@ -288,7 +289,9 @@
288
289
  var QIconPicker = vue.defineComponent({
289
290
  name: 'QIconPicker',
290
291
 
291
- props: Object.assign({}, useIconPickerProps),
292
+ props: {
293
+ ...useIconPickerProps
294
+ },
292
295
 
293
296
  emits: [
294
297
  'update:model-value',
@@ -296,13 +299,9 @@
296
299
  'update:model-pagination'
297
300
  ],
298
301
 
299
- setup: function setup(props, ref$1) {
300
- var slots = ref$1.slots;
301
- var emit = ref$1.emit;
302
- var expose = ref$1.expose;
303
-
304
- var scrollAreaRef = vue.ref(null);
305
- var data = vue.reactive({
302
+ setup(props, { slots, emit, expose }) {
303
+ const scrollAreaRef = vue.ref(null);
304
+ const data = vue.reactive({
306
305
  iconsList: [],
307
306
  innerPagination: {
308
307
  page: 1,
@@ -316,37 +315,35 @@
316
315
  });
317
316
 
318
317
  // index of first item on a page
319
- var computedFirstItemIndex = vue.computed(function () {
320
- var ref = computedPagination.value;
321
- var page = ref.page;
322
- var itemsPerPage = ref.itemsPerPage;
318
+ const computedFirstItemIndex = vue.computed(() => {
319
+ const { page, itemsPerPage } = computedPagination.value;
323
320
  return (page - 1) * itemsPerPage
324
321
  });
325
322
 
326
323
  // index of last item on a page
327
- var computedLastItemIndex = vue.computed(function () {
328
- var ref = computedPagination.value;
329
- var page = ref.page;
330
- var itemsPerPage = ref.itemsPerPage;
324
+ const computedLastItemIndex = vue.computed(() => {
325
+ const { page, itemsPerPage } = computedPagination.value;
331
326
  return page * itemsPerPage
332
327
  });
333
328
 
334
- var ref$2 = useIconPickerIcons(data, props, computedFirstItemIndex, computedLastItemIndex);
335
- var loadIconSet = ref$2.loadIconSet;
336
- var computedDisplayedIcons = ref$2.computedDisplayedIcons;
337
- var computedFilteredIcons = ref$2.computedFilteredIcons;
338
- var categories = ref$2.categories;
339
-
340
- var ref$3 = useIconPickerPagination(data, props, emit, computedFilteredIcons);
341
- var samePagination = ref$3.samePagination;
342
- var computedPagination = ref$3.computedPagination;
343
- var setPagination = ref$3.setPagination;
344
- var updatePagination = ref$3.updatePagination;
345
- var computedPagesNumber = ref$3.computedPagesNumber;
329
+ const {
330
+ loadIconSet,
331
+ computedDisplayedIcons,
332
+ computedFilteredIcons,
333
+ categories
334
+ } = useIconPickerIcons(data, props, computedFirstItemIndex, computedLastItemIndex);
335
+
336
+ const {
337
+ samePagination,
338
+ computedPagination,
339
+ setPagination,
340
+ updatePagination,
341
+ computedPagesNumber
342
+ } = useIconPickerPagination(data, props, emit, computedFilteredIcons);
346
343
 
347
344
  exposeIconPickerApi(data, expose, computedPagination, setPagination, computedFirstItemIndex, computedLastItemIndex, computedFilteredIcons, computedPagesNumber);
348
345
 
349
- vue.onMounted(function () {
346
+ vue.onMounted(() => {
350
347
  if (props.iconSet) {
351
348
  loadIconSet(props.iconSet);
352
349
  }
@@ -357,14 +354,14 @@
357
354
  });
358
355
 
359
356
 
360
- vue.watch(function () { return props.iconSet; }, function (val) {
357
+ vue.watch(() => props.iconSet, (val) => {
361
358
  if (val) {
362
359
  loadIconSet(val);
363
360
  updatePagination();
364
- vue.nextTick(function () {
361
+ vue.nextTick(() => {
365
362
  // whenever the icon set changes, it resets pagination page to page 1
366
363
  setPagination({ page: 1 });
367
- }).catch(function (e) { return console.error(e); });
364
+ }).catch(e => console.error(e));
368
365
  // scroll to top of QScrollArea, if applicable
369
366
  if(scrollAreaRef.value) {
370
367
  scrollAreaRef.value.setScrollPosition(0);
@@ -372,35 +369,35 @@
372
369
  }
373
370
  });
374
371
 
375
- vue.watch(function () { return props.icons; }, function (val) {
372
+ vue.watch(() => props.icons, (val) => {
376
373
  if (props.icons !== void 0 && props.icons.length > 0) {
377
374
  data.iconsList = props.icons;
378
375
  }
379
376
  updatePagination();
380
- vue.nextTick(function () {
377
+ vue.nextTick(() => {
381
378
  // whenever the icon set changes, it resets pagination page to page 1
382
379
  setPagination({ page: 1 });
383
- }).catch(function (e) { return console.error(e); });
380
+ }).catch(e => console.error(e));
384
381
  // scroll to top of QScrollArea, if applicable
385
382
  if(scrollAreaRef.value) {
386
383
  scrollAreaRef.value.setScrollPosition(0);
387
384
  }
388
385
  });
389
386
 
390
- vue.watch(function () { return props.filter; }, function () {
387
+ vue.watch(() => props.filter, () => {
391
388
  // whenever the filter changes, it resets pagination page to page 1
392
389
  setPagination({ page: 1, totalPages: computedPagesNumber.value });
393
390
  updatePagination();
394
391
  });
395
392
 
396
- vue.watch(function () { return props.tags; }, function (val) {
393
+ vue.watch(() => props.tags, (val) => {
397
394
  // whenever the tags change, it resets pagination page to page 1
398
395
  setPagination({ page: 1, totalPages: computedPagesNumber.value });
399
396
  updatePagination();
400
397
  });
401
398
 
402
399
  if (props.modelPagination) {
403
- vue.watch(function () { return props.modelPagination; }, function (newVal, oldVal) {
400
+ vue.watch(() => props.modelPagination, (newVal, oldVal) => {
404
401
  if (!samePagination(oldVal, newVal)) {
405
402
  updatePagination();
406
403
  }
@@ -408,29 +405,28 @@
408
405
  }
409
406
 
410
407
  if (props.modelPagination) {
411
- vue.watch(function () { return props.modelPagination.itemsPerPage; }, function () {
408
+ vue.watch(() => props.modelPagination.itemsPerPage, () => {
412
409
  updatePagination();
413
410
  });
414
411
 
415
- vue.watch(function () { return props.modelPagination.page; }, function () {
412
+ vue.watch(() =>props.modelPagination.page, () => {
416
413
  updatePagination();
417
414
  });
418
415
  }
419
416
 
420
- return function () {
417
+ return () => {
421
418
 
422
419
  function renderPagination() {
423
- if (props.modelPagination && props.modelPagination.itemsPerPage === 0) { return '' }
424
- var slot = (slots.pagination && slots.pagination());
425
- var ref = computedPagination.value;
426
- var page = ref.page;
427
- var totalPages = ref.totalPages;
428
-
429
- return slot || vue.h(quasar.QPagination, Object.assign({}, {class: 'q-icon-picker__pagination'},
430
- props.paginationProps,
431
- {modelValue: page,
420
+ if (props.modelPagination && props.modelPagination.itemsPerPage === 0) return ''
421
+ const slot = (slots.pagination && slots.pagination());
422
+ const { page, totalPages } = computedPagination.value;
423
+
424
+ return slot || vue.h(quasar.QPagination, {
425
+ class: 'q-icon-picker__pagination',
426
+ ...props.paginationProps,
427
+ modelValue: page,
432
428
  max: totalPages,
433
- 'onUpdate:modelValue': function (value) {
429
+ 'onUpdate:modelValue': value => {
434
430
  if (props.animated) {
435
431
  if (value > page) {
436
432
  data.direction = direction.NEXT;
@@ -440,12 +436,13 @@
440
436
  }
441
437
  }
442
438
  setPagination({ page: value });
443
- }}))
439
+ }
440
+ })
444
441
  }
445
442
 
446
443
  function renderFooter() {
447
444
  if (props.noFooter !== true && props.modelPagination !== void 0) {
448
- var slot = (slots.footer && slots.footer());
445
+ const slot = (slots.footer && slots.footer());
449
446
 
450
447
  return vue.h('div', {
451
448
  class: 'q-icon-picker__footer flex flex-center'
@@ -457,20 +454,20 @@
457
454
 
458
455
  function renderTooltip(name) {
459
456
  if (props.tooltips === true) {
460
- return function () { return vue.h(quasar.QTooltip, {}, function () { return name; }); }
457
+ return () => vue.h(quasar.QTooltip, {}, () => name)
461
458
  }
462
459
  }
463
460
 
464
461
  function renderIcon(icon) {
465
- var name = (icon.prefix !== void 0 ? icon.prefix + ' ' + icon.name : icon.name);
462
+ const name = (icon.prefix !== void 0 ? icon.prefix + ' ' + icon.name : icon.name);
466
463
 
467
464
  if (slots.icon && slots.icon()) {
468
465
  return slots.icon(name)
469
466
  }
470
- var isSelected = name === props.modelValue;
471
- var textColor = isSelected ? props.selectedTextColor : undefined;
472
- var color = isSelected ? props.selectedColor : undefined;
473
- var size = props.size ? props.size : undefined;
467
+ const isSelected = name === props.modelValue;
468
+ const textColor = isSelected ? props.selectedTextColor : undefined;
469
+ const color = isSelected ? props.selectedColor : undefined;
470
+ const size = props.size ? props.size : undefined;
474
471
 
475
472
  return vue.h(quasar.QBtn, {
476
473
  id: name,
@@ -481,26 +478,26 @@
481
478
  textColor: textColor,
482
479
  color: color,
483
480
  icon: name,
484
- onClick: function () { return emit('update:model-value', name); },
481
+ onClick: () => emit('update:model-value', name),
485
482
  }, renderTooltip(name))
486
483
  }
487
484
 
488
485
  function renderIcons() {
489
- return computedDisplayedIcons.value.map(function (icon) { return renderIcon(icon); })
486
+ return computedDisplayedIcons.value.map(icon => renderIcon(icon))
490
487
  }
491
488
 
492
489
  function renderContainer() {
493
- var container = function () { return vue.h('div', {
490
+ const container = () => vue.h('div', {
494
491
  key: computedPagination.value.page,
495
492
  class: 'q-icon-picker__container col'
496
- }, [].concat( renderIcons() )); };
493
+ }, [...renderIcons()]);
497
494
 
498
495
  if (props.animated === true) {
499
- var transition = 'q-transition--' + (data.direction === 'prev' ? props.transitionPrev : props.transitionNext);
500
- return function () { return vue.h(vue.Transition, {
496
+ const transition = 'q-transition--' + (data.direction === 'prev' ? props.transitionPrev : props.transitionNext);
497
+ return () => vue.h(vue.Transition, {
501
498
  name: transition,
502
499
  appear: true
503
- }, container); }
500
+ }, container)
504
501
  }
505
502
 
506
503
  return container
@@ -523,7 +520,7 @@
523
520
  }, [
524
521
  renderScrollArea(),
525
522
  vue.h(quasar.QResizeObserver, {
526
- onResize: function (size) {
523
+ onResize: (size) => {
527
524
  data.width = size.width;
528
525
  data.height = size.height;
529
526
  }
@@ -531,31 +528,31 @@
531
528
  ])
532
529
  }
533
530
 
534
- var classes = [
531
+ const classes = [
535
532
  'q-icon-picker',
536
533
  'column'
537
534
  ];
538
- if (props.color) { classes.push('bg-' + props.color); }
539
- if (props.textColor) { classes.push('text-' + props.textColor); }
535
+ if (props.color) classes.push('bg-' + props.color);
536
+ if (props.textColor) classes.push('text-' + props.textColor);
540
537
 
541
- var picker = vue.h('div', {
538
+ const picker = vue.h('div', {
542
539
  class: classes.join(' ')
543
540
  }, [
544
541
  renderBody(),
545
542
  renderFooter()
546
543
  ]);
547
544
 
548
- vue.nextTick(function () {
545
+ vue.nextTick(() => {
549
546
  categories();
550
547
  emit('update:tags', data.categories);
551
- }).catch(function (e) { return console.error(e); });
548
+ }).catch(e => console.error(e));
552
549
 
553
550
  return picker
554
551
  }
555
552
  }
556
553
  });
557
554
 
558
- var version = '2.0.3';
555
+ const version = '2.0.5';
559
556
 
560
557
  function install (app) {
561
558
  app.component(QIconPicker.name, QIconPicker);
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @quasar/quasar-ui-qiconpicker v2.0.3
3
- * (c) 2021 Jeff Galbraith <jeff@quasar.dev>
2
+ * @quasar/quasar-ui-qiconpicker v2.0.5
3
+ * (c) 2022 Jeff Galbraith <jeff@quasar.dev>
4
4
  * Released under the MIT License.
5
5
  */
6
- (function(e,n){"object"===typeof exports&&"undefined"!==typeof module?n(exports,require("vue"),require("quasar")):"function"===typeof define&&define.amd?define(["exports","vue","quasar"],n):(e="undefined"!==typeof globalThis?globalThis:e||self,n(e.QIconPicker={},e.Vue,e.Quasar))})(this,function(e,h,x){"use strict";var n={modelValue:String,iconSet:{type:String,validator:function(e){return["material-icons","material-icons-outlined","material-icons-round","material-icons-sharp","ionicons-v4","mdi-v4","mdi-v5","mdi-v6","fontawesome-v5","eva-icons","themify","line-awesome","bootstrap-icons",""].includes(e)},default:""},icons:Array,filter:String,tags:Array,dense:Boolean,tooltips:Boolean,noFooter:Boolean,size:{type:String,default:"inherit"},color:String,textColor:String,selectedColor:{type:String,default:"primary"},selectedTextColor:{type:String,default:"grey-1"},paginationProps:{type:Object,default:function(){return{maxPages:5,input:!0}}},modelPagination:Object,animated:Boolean,transitionPrev:{type:String,default:"slide-right"},transitionNext:{type:String,default:"slide-left"}},y={NEXT:"next",PREV:"prev"};function w(n,t,i,e){function o(e){return e.page<1&&(e.page=1),(void 0===e.itemsPerPage||e.itemsPerPage<1)&&(e.itemsPerPage=0),e}function a(e,n){for(var t in n)if(n[t]!==e[t])return!1;return!0}var r=h.computed(function(){return o(Object.assign({},n.innerPagination,t.modelPagination))}),c=h.computed(function(){return 0===r.value.itemsPerPage?1:Math.max(1,Math.ceil(e.value.length/r.value.itemsPerPage))});function u(e){e=o(Object.assign({},r.value,e));a(n.innerPagination,e)||(t.modelPagination&&i("update:model-pagination",e),n.innerPagination=e)}function s(){void 0!==t.modelPagination&&u({total:e.value.length,totalPages:c.value})}return{samePagination:a,computedPagination:r,setPagination:u,updatePagination:s,computedPagesNumber:c}}function S(t,n,i,o){function e(n){if(t.iconsList=[],n)if(window.QIconPicker){var e=n.replace(/-([a-z])/g,function(e){return e[1].toUpperCase()});window.QIconPicker.iconSet&&window.QIconPicker.iconSet[e]?t.iconsList=window.QIconPicker.iconSet[e].icons:(console.error("QIconPicker: no icon set loaded called "+n),console.error("Be sure to load the UMD version of the icon set in a script tag before using QIconPicker UMD version"))}else try{t.iconsList=require("@quasar/quasar-ui-qiconpicker/src/components/icon-set/"+n+".js").default.icons}catch(e){console.error("QIconPicker: cannot find icon set found called "+n)}console.info("Loaded "+t.iconsList.length+" icons.")}var a=h.computed(function(){var e=[];return t.iconsList&&(e=r.value,n.modelPagination&&0!==n.modelPagination.itemsPerPage&&(e=e.slice(i.value,o.value))),e}),r=h.computed(function(){var e=t.iconsList;return e&&(void 0!==n.tags&&""!==n.tags&&null!==n.tags&&n.tags.length>0&&(e=e.filter(function(e){return e.tags.filter(function(e){return n.tags.includes(e)}).length>0})),void 0!==n.filter&&""!==n.filter&&null!==n.filter&&(e=e.filter(function(e){return e.name.includes(n.filter)}))),e});function c(){var n=[];return t.iconsList.forEach(function(e){e=e.tags;e&&e.length>0&&e.forEach(function(e){!0!==n.includes(e)&&n.push(e)})}),n.sort(),t.categories=n,!0}return{loadIconSet:e,computedDisplayedIcons:a,computedFilteredIcons:r,categories:c}}function k(t,e,i,o,n,a,r,c){var u=function(){var e=i.value,e=e.page;e>1&&(o({page:e-1}),t.direction=y.PREV)},s=function(){var e=i.value,n=e.page,e=e.itemsPerPage;a.value>0&&n*e<r.value.length&&(o({page:n+1}),t.direction=y.NEXT)},l=function(){o({page:c.value})},d=function(){o({page:0})},g=h.computed(function(){return 0===a.value||i.value.page>=c.value}),f=h.computed(function(){return 1===i.value.page});e({prevPage:u,nextPage:s,lastPage:l,firstPage:d,isLastPage:g,isFirstPage:f})}var t=h.defineComponent({name:"QIconPicker",props:Object.assign({},n),emits:["update:model-value","update:tags","update:model-pagination"],setup:function(s,e){var l=e.slots,d=e.emit,n=e.expose,g=h.ref(null),f=h.reactive({iconsList:[],innerPagination:{page:1,itemsPerPage:0,totalPages:0},categories:[],width:"100",height:"100",direction:""}),t=h.computed(function(){var e=m.value,n=e.page,e=e.itemsPerPage;return(n-1)*e}),i=h.computed(function(){var e=m.value,n=e.page,e=e.itemsPerPage;return n*e}),o=S(f,s,t,i),a=o.loadIconSet,p=o.computedDisplayedIcons,e=o.computedFilteredIcons,v=o.categories,o=w(f,s,d,e),r=o.samePagination,m=o.computedPagination,P=o.setPagination,c=o.updatePagination,u=o.computedPagesNumber;return k(f,n,m,P,t,i,e,u),h.onMounted(function(){s.iconSet?a(s.iconSet):void 0!==s.icons&&s.icons.length>0&&(f.iconsList=s.icons),c()}),h.watch(function(){return s.iconSet},function(e){e&&(a(e),c(),h.nextTick(function(){P({page:1})}).catch(function(e){return console.error(e)}),g.value&&g.value.setScrollPosition(0))}),h.watch(function(){return s.icons},function(e){void 0!==s.icons&&s.icons.length>0&&(f.iconsList=s.icons),c(),h.nextTick(function(){P({page:1})}).catch(function(e){return console.error(e)}),g.value&&g.value.setScrollPosition(0)}),h.watch(function(){return s.filter},function(){P({page:1,totalPages:u.value}),c()}),h.watch(function(){return s.tags},function(e){P({page:1,totalPages:u.value}),c()}),s.modelPagination&&h.watch(function(){return s.modelPagination},function(e,n){r(n,e)||c()}),s.modelPagination&&(h.watch(function(){return s.modelPagination.itemsPerPage},function(){c()}),h.watch(function(){return s.modelPagination.page},function(){c()})),function(){function n(){if(s.modelPagination&&0===s.modelPagination.itemsPerPage)return"";var e=l.pagination&&l.pagination(),n=m.value,t=n.page,n=n.totalPages;return e||h.h(x.QPagination,Object.assign({},{class:"q-icon-picker__pagination"},s.paginationProps,{modelValue:t,max:n,"onUpdate:modelValue":function(e){s.animated&&(f.direction=e>t?y.NEXT:y.PREV),P({page:e})}}))}function e(){if(!0!==s.noFooter&&void 0!==s.modelPagination){var e=l.footer&&l.footer();return h.h("div",{class:"q-icon-picker__footer flex flex-center"},[e?e(m.value):n()])}}function o(e){if(!0===s.tooltips)return function(){return h.h(x.QTooltip,{},function(){return e})}}function t(e){var n=void 0!==e.prefix?e.prefix+" "+e.name:e.name;if(l.icon&&l.icon())return l.icon(n);var t=n===s.modelValue,i=t?s.selectedTextColor:void 0,e=t?s.selectedColor:void 0,t=s.size||void 0;return h.h(x.QBtn,{id:n,unelevated:!0,dense:s.dense,noWrap:!0,size:t,textColor:i,color:e,icon:n,onClick:function(){return d("update:model-value",n)}},o(n))}function i(){return p.value.map(function(e){return t(e)})}function a(){var e=function(){return h.h("div",{key:m.value.page,class:"q-icon-picker__container col"},[].concat(i()))};if(!0!==s.animated)return e;var n="q-transition--"+("prev"===f.direction?s.transitionPrev:s.transitionNext);return function(){return h.h(h.Transition,{name:n,appear:!0},e)}}function r(){return h.h(x.QScrollArea,{ref:g,style:{width:f.width+"px",height:f.height+"px"}},a())}function c(){return h.h("div",{class:"q-icon-picker__body col column"},[r(),h.h(x.QResizeObserver,{onResize:function(e){f.width=e.width,f.height=e.height}})])}var u=["q-icon-picker","column"];s.color&&u.push("bg-"+s.color),s.textColor&&u.push("text-"+s.textColor);u=h.h("div",{class:u.join(" ")},[c(),e()]);return h.nextTick(function(){v(),d("update:tags",f.categories)}).catch(function(e){return console.error(e)}),u}}}),n="2.0.3";function i(e){e.component(t.name,t)}e.QIconPicker=t,e.install=i,e.version=n,Object.defineProperty(e,"__esModule",{value:!0})});
6
+ (function(e,t){"object"===typeof exports&&"undefined"!==typeof module?t(exports,require("vue"),require("quasar")):"function"===typeof define&&define.amd?define(["exports","vue","quasar"],t):(e="undefined"!==typeof globalThis?globalThis:e||self,t(e.QIconPicker={},e.Vue,e.Quasar))})(this,function(e,x,y){"use strict";const t={modelValue:String,iconSet:{type:String,validator:e=>["material-icons","material-icons-outlined","material-icons-round","material-icons-sharp","ionicons-v4","mdi-v4","mdi-v5","mdi-v6","fontawesome-v5","eva-icons","themify","line-awesome","bootstrap-icons",""].includes(e),default:""},icons:Array,filter:String,tags:Array,dense:Boolean,tooltips:Boolean,noFooter:Boolean,size:{type:String,default:"inherit"},color:String,textColor:String,selectedColor:{type:String,default:"primary"},selectedTextColor:{type:String,default:"grey-1"},paginationProps:{type:Object,default:()=>({maxPages:5,input:!0})},modelPagination:Object,animated:Boolean,transitionPrev:{type:String,default:"slide-right"},transitionNext:{type:String,default:"slide-left"}},w={NEXT:"next",PREV:"prev"};function s(n,o,i,e){function a(e){return e.page<1&&(e.page=1),(void 0===e.itemsPerPage||e.itemsPerPage<1)&&(e.itemsPerPage=0),e}function r(e,t){for(const n in t)if(t[n]!==e[n])return!1;return!0}const c=x.computed(()=>{return a({...n.innerPagination,...o.modelPagination})}),t=x.computed(()=>{return 0===c.value.itemsPerPage?1:Math.max(1,Math.ceil(e.value.length/c.value.itemsPerPage))});function s(e){const t=a({...c.value,...e});r(n.innerPagination,t)||(o.modelPagination&&i("update:model-pagination",t),n.innerPagination=t)}function l(){void 0!==o.modelPagination&&s({total:e.value.length,totalPages:t.value})}return{samePagination:r,computedPagination:c,setPagination:s,updatePagination:l,computedPagesNumber:t}}function l(o,t,n,i){function e(t){if(o.iconsList=[],t)if(window.QIconPicker){const e=t.replace(/-([a-z])/g,e=>e[1].toUpperCase());window.QIconPicker.iconSet&&window.QIconPicker.iconSet[e]?o.iconsList=window.QIconPicker.iconSet[e].icons:(console.error("QIconPicker: no icon set loaded called "+t),console.error("Be sure to load the UMD version of the icon set in a script tag before using QIconPicker UMD version"))}else try{o.iconsList=require(`@quasar/quasar-ui-qiconpicker/src/components/icon-set/${t}.js`).default.icons}catch(e){console.error("QIconPicker: cannot find icon set found called "+t)}console.info(`Loaded ${o.iconsList.length} icons.`)}const a=x.computed(()=>{let e=[];o.iconsList&&(e=r.value,t.modelPagination&&0!==t.modelPagination.itemsPerPage&&(e=e.slice(n.value,i.value)));return e}),r=x.computed(()=>{let e=o.iconsList;e&&(void 0!==t.tags&&""!==t.tags&&null!==t.tags&&t.tags.length>0&&(e=e.filter(e=>{return e.tags.filter(e=>t.tags.includes(e)).length>0})),void 0!==t.filter&&""!==t.filter&&null!==t.filter&&(e=e.filter(e=>e.name.includes(t.filter))));return e});function c(){const n=[];return o.iconsList.forEach(e=>{const t=e.tags;t&&t.length>0&&t.forEach(e=>{!0!==n.includes(e)&&n.push(e)})}),n.sort(),o.categories=n,!0}return{loadIconSet:e,computedDisplayedIcons:a,computedFilteredIcons:r,categories:c}}function S(n,e,o,i,t,a,r,c){const s=()=>{const e=o.value["page"];e>1&&(i({page:e-1}),n.direction=w.PREV)},l=()=>{const{page:e,itemsPerPage:t}=o.value;a.value>0&&e*t<r.value.length&&(i({page:e+1}),n.direction=w.NEXT)},u=()=>{i({page:c.value})},d=()=>{i({page:0})},g=x.computed(()=>{return 0===a.value||o.value.page>=c.value}),p=x.computed(()=>{return 1===o.value.page});e({prevPage:s,nextPage:l,lastPage:u,firstPage:d,isLastPage:g,isFirstPage:p})}var n=x.defineComponent({name:"QIconPicker",props:{...t},emits:["update:model-value","update:tags","update:model-pagination"],setup(u,{slots:d,emit:g,expose:e}){const p=x.ref(null),m=x.reactive({iconsList:[],innerPagination:{page:1,itemsPerPage:0,totalPages:0},categories:[],width:"100",height:"100",direction:""}),t=x.computed(()=>{const{page:e,itemsPerPage:t}=v.value;return(e-1)*t}),n=x.computed(()=>{const{page:e,itemsPerPage:t}=v.value;return e*t}),{loadIconSet:o,computedDisplayedIcons:P,computedFilteredIcons:i,categories:f}=l(m,u,t,n),{samePagination:a,computedPagination:v,setPagination:h,updatePagination:r,computedPagesNumber:c}=s(m,u,g,i);return S(m,e,v,h,t,n,i,c),x.onMounted(()=>{u.iconSet?o(u.iconSet):void 0!==u.icons&&u.icons.length>0&&(m.iconsList=u.icons);r()}),x.watch(()=>u.iconSet,e=>{e&&(o(e),r(),x.nextTick(()=>{h({page:1})}).catch(e=>console.error(e)),p.value&&p.value.setScrollPosition(0))}),x.watch(()=>u.icons,e=>{void 0!==u.icons&&u.icons.length>0&&(m.iconsList=u.icons);r();x.nextTick(()=>{h({page:1})}).catch(e=>console.error(e));p.value&&p.value.setScrollPosition(0)}),x.watch(()=>u.filter,()=>{h({page:1,totalPages:c.value});r()}),x.watch(()=>u.tags,e=>{h({page:1,totalPages:c.value});r()}),u.modelPagination&&x.watch(()=>u.modelPagination,(e,t)=>{a(t,e)||r()}),u.modelPagination&&(x.watch(()=>u.modelPagination.itemsPerPage,()=>{r()}),x.watch(()=>u.modelPagination.page,()=>{r()})),()=>{function t(){if(u.modelPagination&&0===u.modelPagination.itemsPerPage)return"";const e=d.pagination&&d.pagination(),{page:t,totalPages:n}=v.value;return e||x.h(y.QPagination,{class:"q-icon-picker__pagination",...u.paginationProps,modelValue:t,max:n,"onUpdate:modelValue":e=>{u.animated&&(e>t?m.direction=w.NEXT:m.direction=w.PREV);h({page:e})}})}function e(){if(!0!==u.noFooter&&void 0!==u.modelPagination){const e=d.footer&&d.footer();return x.h("div",{class:"q-icon-picker__footer flex flex-center"},[e?e(v.value):t()])}}function r(e){if(!0===u.tooltips)return()=>x.h(y.QTooltip,{},()=>e)}function n(e){const t=void 0!==e.prefix?e.prefix+" "+e.name:e.name;if(d.icon&&d.icon())return d.icon(t);const n=t===u.modelValue,o=n?u.selectedTextColor:void 0,i=n?u.selectedColor:void 0,a=u.size||void 0;return x.h(y.QBtn,{id:t,unelevated:!0,dense:u.dense,noWrap:!0,size:a,textColor:o,color:i,icon:t,onClick:()=>g("update:model-value",t)},r(t))}function o(){return P.value.map(e=>n(e))}function i(){const e=()=>x.h("div",{key:v.value.page,class:"q-icon-picker__container col"},[...o()]);if(!0!==u.animated)return e;{const t="q-transition--"+("prev"===m.direction?u.transitionPrev:u.transitionNext);return()=>x.h(x.Transition,{name:t,appear:!0},e)}}function a(){return x.h(y.QScrollArea,{ref:p,style:{width:m.width+"px",height:m.height+"px"}},i())}function c(){return x.h("div",{class:"q-icon-picker__body col column"},[a(),x.h(y.QResizeObserver,{onResize:e=>{m.width=e.width;m.height=e.height}})])}const s=["q-icon-picker","column"];u.color&&s.push("bg-"+u.color);u.textColor&&s.push("text-"+u.textColor);const l=x.h("div",{class:s.join(" ")},[c(),e()]);x.nextTick(()=>{f();g("update:tags",m.categories)}).catch(e=>console.error(e));return l}}});const o="2.0.5";function i(e){e.component(n.name,n)}e.QIconPicker=n,e.install=i,e.version=o,Object.defineProperty(e,"__esModule",{value:!0})});
@@ -107,7 +107,6 @@ export interface IconNameArray {
107
107
  name? : string
108
108
  }
109
109
 
110
- import { StringArray, Pagination, PaginationProps } from './types'
111
110
 
112
111
  declare module '@vue/runtime-core' {
113
112
  interface ComponentCustomProperties {