@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.
- package/README.md +1 -1
- package/dist/icon-set/bootstrap-icons.umd.js +3 -3
- package/dist/icon-set/eva-icons.umd.js +2 -2
- package/dist/icon-set/fontawesome-v5.umd.js +2 -2
- package/dist/icon-set/ionicons-v4.umd.js +2 -2
- package/dist/icon-set/line-awesome.umd.js +2 -2
- package/dist/icon-set/material-icons-outlined.umd.js +3 -3
- package/dist/icon-set/material-icons-round.umd.js +3 -3
- package/dist/icon-set/material-icons-sharp.umd.js +3 -3
- package/dist/icon-set/material-icons.umd.js +3 -3
- package/dist/icon-set/mdi-v4.umd.js +2 -2
- package/dist/icon-set/mdi-v5.umd.js +2 -2
- package/dist/icon-set/mdi-v6.umd.js +3 -3
- package/dist/icon-set/themify.umd.js +2 -2
- package/dist/{index.common.js → index.cjs.js} +128 -131
- package/dist/index.cjs.min.js +6 -0
- package/dist/index.css +2 -2
- package/dist/index.esm.js +128 -131
- package/dist/index.esm.min.js +3 -3
- package/dist/index.min.css +2 -2
- package/dist/index.rtl.css +2 -2
- package/dist/index.rtl.min.css +2 -2
- package/dist/index.umd.js +128 -131
- package/dist/index.umd.min.js +3 -3
- package/dist/types/index.d.ts +0 -1
- package/package.json +27 -27
- package/src/components/icon-set/bootstrap-icons.js +212 -1
- package/src/components/icon-set/material-icons-outlined.js +223 -14
- package/src/components/icon-set/material-icons-round.js +223 -14
- package/src/components/icon-set/material-icons-sharp.js +223 -14
- package/src/components/icon-set/material-icons.js +223 -14
- package/src/components/icon-set/mdi-v6.js +400 -0
- package/src/{index.common.js → index.cjs.js} +0 -0
- package/src/index.js +2 -2
- package/src/version.js +1 -0
- package/src/vue-plugin.js +1 -1
- package/dist/index.common.min.js +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @quasar/quasar-ui-qiconpicker v2.0.
|
|
3
|
-
* (c)
|
|
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
|
(function(t,a){"object"===typeof exports&&"undefined"!==typeof module?module.exports=a():"function"===typeof define&&define.amd?define(a):(t="undefined"!==typeof globalThis?globalThis:t||self,t.QIconPicker=t.QIconPicker||{},t.QIconPicker.iconSet=t.QIconPicker.iconSet||{},t.QIconPicker.iconSet.themify=a())})(this,function(){"use strict";var t={name:"themify",icons:[{name:"ti-wand",tags:[]},{name:"ti-volume",tags:[]},{name:"ti-user",tags:[]},{name:"ti-unlock",tags:[]},{name:"ti-unlink",tags:[]},{name:"ti-trash",tags:[]},{name:"ti-thought",tags:[]},{name:"ti-target",tags:[]},{name:"ti-tag",tags:[]},{name:"ti-tablet",tags:[]},{name:"ti-star",tags:[]},{name:"ti-spray",tags:[]},{name:"ti-signal",tags:[]},{name:"ti-shopping-cart",tags:[]},{name:"ti-shopping-cart-full",tags:[]},{name:"ti-settings",tags:[]},{name:"ti-search",tags:[]},{name:"ti-zoom-in",tags:[]},{name:"ti-zoom-out",tags:[]},{name:"ti-cut",tags:[]},{name:"ti-ruler",tags:[]},{name:"ti-ruler-pencil",tags:[]},{name:"ti-ruler-alt",tags:[]},{name:"ti-bookmark",tags:[]},{name:"ti-bookmark-alt",tags:[]},{name:"ti-reload",tags:[]},{name:"ti-plus",tags:[]},{name:"ti-pin",tags:[]},{name:"ti-pencil",tags:[]},{name:"ti-pencil-alt",tags:[]},{name:"ti-paint-roller",tags:[]},{name:"ti-paint-bucket",tags:[]},{name:"ti-na",tags:[]},{name:"ti-mobile",tags:[]},{name:"ti-minus",tags:[]},{name:"ti-medall",tags:[]},{name:"ti-medall-alt",tags:[]},{name:"ti-marker",tags:[]},{name:"ti-marker-alt",tags:[]},{name:"ti-arrow-up",tags:[]},{name:"ti-arrow-right",tags:[]},{name:"ti-arrow-left",tags:[]},{name:"ti-arrow-down",tags:[]},{name:"ti-lock",tags:[]},{name:"ti-location-arrow",tags:[]},{name:"ti-link",tags:[]},{name:"ti-layout",tags:[]},{name:"ti-layers",tags:[]},{name:"ti-layers-alt",tags:[]},{name:"ti-key",tags:[]},{name:"ti-import",tags:[]},{name:"ti-image",tags:[]},{name:"ti-heart",tags:[]},{name:"ti-heart-broken",tags:[]},{name:"ti-hand-stop",tags:[]},{name:"ti-hand-open",tags:[]},{name:"ti-hand-drag",tags:[]},{name:"ti-folder",tags:[]},{name:"ti-flag",tags:[]},{name:"ti-flag-alt",tags:[]},{name:"ti-flag-alt-2",tags:[]},{name:"ti-eye",tags:[]},{name:"ti-export",tags:[]},{name:"ti-exchange-vertical",tags:[]},{name:"ti-desktop",tags:[]},{name:"ti-cup",tags:[]},{name:"ti-crown",tags:[]},{name:"ti-comments",tags:[]},{name:"ti-comment",tags:[]},{name:"ti-comment-alt",tags:[]},{name:"ti-close",tags:[]},{name:"ti-clip",tags:[]},{name:"ti-angle-up",tags:[]},{name:"ti-angle-right",tags:[]},{name:"ti-angle-left",tags:[]},{name:"ti-angle-down",tags:[]},{name:"ti-check",tags:[]},{name:"ti-check-box",tags:[]},{name:"ti-camera",tags:[]},{name:"ti-announcement",tags:[]},{name:"ti-brush",tags:[]},{name:"ti-briefcase",tags:[]},{name:"ti-bolt",tags:[]},{name:"ti-bolt-alt",tags:[]},{name:"ti-blackboard",tags:[]},{name:"ti-bag",tags:[]},{name:"ti-move",tags:[]},{name:"ti-arrows-vertical",tags:[]},{name:"ti-arrows-horizontal",tags:[]},{name:"ti-fullscreen",tags:[]},{name:"ti-arrow-top-right",tags:[]},{name:"ti-arrow-top-left",tags:[]},{name:"ti-arrow-circle-up",tags:[]},{name:"ti-arrow-circle-right",tags:[]},{name:"ti-arrow-circle-left",tags:[]},{name:"ti-arrow-circle-down",tags:[]},{name:"ti-angle-double-up",tags:[]},{name:"ti-angle-double-right",tags:[]},{name:"ti-angle-double-left",tags:[]},{name:"ti-angle-double-down",tags:[]},{name:"ti-zip",tags:[]},{name:"ti-world",tags:[]},{name:"ti-wheelchair",tags:[]},{name:"ti-view-list",tags:[]},{name:"ti-view-list-alt",tags:[]},{name:"ti-view-grid",tags:[]},{name:"ti-uppercase",tags:[]},{name:"ti-upload",tags:[]},{name:"ti-underline",tags:[]},{name:"ti-truck",tags:[]},{name:"ti-timer",tags:[]},{name:"ti-ticket",tags:[]},{name:"ti-thumb-up",tags:[]},{name:"ti-thumb-down",tags:[]},{name:"ti-text",tags:[]},{name:"ti-stats-up",tags:[]},{name:"ti-stats-down",tags:[]},{name:"ti-split-v",tags:[]},{name:"ti-split-h",tags:[]},{name:"ti-smallcap",tags:[]},{name:"ti-shine",tags:[]},{name:"ti-shift-right",tags:[]},{name:"ti-shift-left",tags:[]},{name:"ti-shield",tags:[]},{name:"ti-notepad",tags:[]},{name:"ti-server",tags:[]},{name:"ti-quote-right",tags:[]},{name:"ti-quote-left",tags:[]},{name:"ti-pulse",tags:[]},{name:"ti-printer",tags:[]},{name:"ti-power-off",tags:[]},{name:"ti-plug",tags:[]},{name:"ti-pie-chart",tags:[]},{name:"ti-paragraph",tags:[]},{name:"ti-panel",tags:[]},{name:"ti-package",tags:[]},{name:"ti-music",tags:[]},{name:"ti-music-alt",tags:[]},{name:"ti-mouse",tags:[]},{name:"ti-mouse-alt",tags:[]},{name:"ti-money",tags:[]},{name:"ti-microphone",tags:[]},{name:"ti-menu",tags:[]},{name:"ti-menu-alt",tags:[]},{name:"ti-map",tags:[]},{name:"ti-map-alt",tags:[]},{name:"ti-loop",tags:[]},{name:"ti-location-pin",tags:[]},{name:"ti-list",tags:[]},{name:"ti-light-bulb",tags:[]},{name:"ti-Italic",tags:[]},{name:"ti-info",tags:[]},{name:"ti-infinite",tags:[]},{name:"ti-id-badge",tags:[]},{name:"ti-hummer",tags:[]},{name:"ti-home",tags:[]},{name:"ti-help",tags:[]},{name:"ti-headphone",tags:[]},{name:"ti-harddrives",tags:[]},{name:"ti-harddrive",tags:[]},{name:"ti-gift",tags:[]},{name:"ti-game",tags:[]},{name:"ti-filter",tags:[]},{name:"ti-files",tags:[]},{name:"ti-file",tags:[]},{name:"ti-eraser",tags:[]},{name:"ti-envelope",tags:[]},{name:"ti-download",tags:[]},{name:"ti-direction",tags:[]},{name:"ti-direction-alt",tags:[]},{name:"ti-dashboard",tags:[]},{name:"ti-control-stop",tags:[]},{name:"ti-control-shuffle",tags:[]},{name:"ti-control-play",tags:[]},{name:"ti-control-pause",tags:[]},{name:"ti-control-forward",tags:[]},{name:"ti-control-backward",tags:[]},{name:"ti-cloud",tags:[]},{name:"ti-cloud-up",tags:[]},{name:"ti-cloud-down",tags:[]},{name:"ti-clipboard",tags:[]},{name:"ti-car",tags:[]},{name:"ti-calendar",tags:[]},{name:"ti-book",tags:[]},{name:"ti-bell",tags:[]},{name:"ti-basketball",tags:[]},{name:"ti-bar-chart",tags:[]},{name:"ti-bar-chart-alt",tags:[]},{name:"ti-back-right",tags:[]},{name:"ti-back-left",tags:[]},{name:"ti-arrows-corner",tags:[]},{name:"ti-archive",tags:[]},{name:"ti-anchor",tags:[]},{name:"ti-align-right",tags:[]},{name:"ti-align-left",tags:[]},{name:"ti-align-justify",tags:[]},{name:"ti-align-center",tags:[]},{name:"ti-alert",tags:[]},{name:"ti-alarm-clock",tags:[]},{name:"ti-agenda",tags:[]},{name:"ti-write",tags:[]},{name:"ti-window",tags:[]},{name:"ti-widgetized",tags:[]},{name:"ti-widget",tags:[]},{name:"ti-widget-alt",tags:[]},{name:"ti-wallet",tags:[]},{name:"ti-video-clapper",tags:[]},{name:"ti-video-camera",tags:[]},{name:"ti-vector",tags:[]},{name:"ti-themify-logo",tags:[]},{name:"ti-themify-favicon",tags:[]},{name:"ti-themify-favicon-alt",tags:[]},{name:"ti-support",tags:[]},{name:"ti-stamp",tags:[]},{name:"ti-split-v-alt",tags:[]},{name:"ti-slice",tags:[]},{name:"ti-shortcode",tags:[]},{name:"ti-shift-right-alt",tags:[]},{name:"ti-shift-left-alt",tags:[]},{name:"ti-ruler-alt-2",tags:[]},{name:"ti-receipt",tags:[]},{name:"ti-pin2",tags:[]},{name:"ti-pin-alt",tags:[]},{name:"ti-pencil-alt2",tags:[]},{name:"ti-palette",tags:[]},{name:"ti-more",tags:[]},{name:"ti-more-alt",tags:[]},{name:"ti-microphone-alt",tags:[]},{name:"ti-magnet",tags:[]},{name:"ti-line-double",tags:[]},{name:"ti-line-dotted",tags:[]},{name:"ti-line-dashed",tags:[]},{name:"ti-layout-width-full",tags:[]},{name:"ti-layout-width-default",tags:[]},{name:"ti-layout-width-default-alt",tags:[]},{name:"ti-layout-tab",tags:[]},{name:"ti-layout-tab-window",tags:[]},{name:"ti-layout-tab-v",tags:[]},{name:"ti-layout-tab-min",tags:[]},{name:"ti-layout-slider",tags:[]},{name:"ti-layout-slider-alt",tags:[]},{name:"ti-layout-sidebar-right",tags:[]},{name:"ti-layout-sidebar-none",tags:[]},{name:"ti-layout-sidebar-left",tags:[]},{name:"ti-layout-placeholder",tags:[]},{name:"ti-layout-menu",tags:[]},{name:"ti-layout-menu-v",tags:[]},{name:"ti-layout-menu-separated",tags:[]},{name:"ti-layout-menu-full",tags:[]},{name:"ti-layout-media-right-alt",tags:[]},{name:"ti-layout-media-right",tags:[]},{name:"ti-layout-media-overlay",tags:[]},{name:"ti-layout-media-overlay-alt",tags:[]},{name:"ti-layout-media-overlay-alt-2",tags:[]},{name:"ti-layout-media-left-alt",tags:[]},{name:"ti-layout-media-left",tags:[]},{name:"ti-layout-media-center-alt",tags:[]},{name:"ti-layout-media-center",tags:[]},{name:"ti-layout-list-thumb",tags:[]},{name:"ti-layout-list-thumb-alt",tags:[]},{name:"ti-layout-list-post",tags:[]},{name:"ti-layout-list-large-image",tags:[]},{name:"ti-layout-line-solid",tags:[]},{name:"ti-layout-grid4",tags:[]},{name:"ti-layout-grid3",tags:[]},{name:"ti-layout-grid2",tags:[]},{name:"ti-layout-grid2-thumb",tags:[]},{name:"ti-layout-cta-right",tags:[]},{name:"ti-layout-cta-left",tags:[]},{name:"ti-layout-cta-center",tags:[]},{name:"ti-layout-cta-btn-right",tags:[]},{name:"ti-layout-cta-btn-left",tags:[]},{name:"ti-layout-column4",tags:[]},{name:"ti-layout-column3",tags:[]},{name:"ti-layout-column2",tags:[]},{name:"ti-layout-accordion-separated",tags:[]},{name:"ti-layout-accordion-merged",tags:[]},{name:"ti-layout-accordion-list",tags:[]},{name:"ti-ink-pen",tags:[]},{name:"ti-info-alt",tags:[]},{name:"ti-help-alt",tags:[]},{name:"ti-headphone-alt",tags:[]},{name:"ti-hand-point-up",tags:[]},{name:"ti-hand-point-right",tags:[]},{name:"ti-hand-point-left",tags:[]},{name:"ti-hand-point-down",tags:[]},{name:"ti-gallery",tags:[]},{name:"ti-face-smile",tags:[]},{name:"ti-face-sad",tags:[]},{name:"ti-credit-card",tags:[]},{name:"ti-control-skip-forward",tags:[]},{name:"ti-control-skip-backward",tags:[]},{name:"ti-control-record",tags:[]},{name:"ti-control-eject",tags:[]},{name:"ti-comments-smiley",tags:[]},{name:"ti-brush-alt",tags:[]},{name:"ti-youtube",tags:[]},{name:"ti-vimeo",tags:[]},{name:"ti-twitter",tags:[]},{name:"ti-time",tags:[]},{name:"ti-tumblr",tags:[]},{name:"ti-skype",tags:[]},{name:"ti-share",tags:[]},{name:"ti-share-alt",tags:[]},{name:"ti-rocket",tags:[]},{name:"ti-pinterest",tags:[]},{name:"ti-new-window",tags:[]},{name:"ti-microsoft",tags:[]},{name:"ti-list-ol",tags:[]},{name:"ti-linkedin",tags:[]},{name:"ti-layout-sidebar-2",tags:[]},{name:"ti-layout-grid4-alt",tags:[]},{name:"ti-layout-grid3-alt",tags:[]},{name:"ti-layout-grid2-alt",tags:[]},{name:"ti-layout-column4-alt",tags:[]},{name:"ti-layout-column3-alt",tags:[]},{name:"ti-layout-column2-alt",tags:[]},{name:"ti-instagram",tags:[]},{name:"ti-google",tags:[]},{name:"ti-github",tags:[]},{name:"ti-flickr",tags:[]},{name:"ti-facebook",tags:[]},{name:"ti-dropbox",tags:[]},{name:"ti-dribbble",tags:[]},{name:"ti-apple",tags:[]},{name:"ti-android",tags:[]},{name:"ti-save",tags:[]},{name:"ti-save-alt",tags:[]},{name:"ti-yahoo",tags:[]},{name:"ti-wordpress",tags:[]},{name:"ti-vimeo-alt",tags:[]},{name:"ti-twitter-alt",tags:[]},{name:"ti-tumblr-alt",tags:[]},{name:"ti-trello",tags:[]},{name:"ti-stack-overflow",tags:[]},{name:"ti-soundcloud",tags:[]},{name:"ti-sharethis",tags:[]},{name:"ti-sharethis-alt",tags:[]},{name:"ti-reddit",tags:[]},{name:"ti-pinterest-alt",tags:[]},{name:"ti-microsoft-alt",tags:[]},{name:"ti-linux",tags:[]},{name:"ti-jsfiddle",tags:[]},{name:"ti-joomla",tags:[]},{name:"ti-html5",tags:[]},{name:"ti-flickr-alt",tags:[]},{name:"ti-email",tags:[]},{name:"ti-drupal",tags:[]},{name:"ti-dropbox-alt",tags:[]},{name:"ti-css3",tags:[]},{name:"ti-rss",tags:[]},{name:"ti-rss-alt",tags:[]}]};return t});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @quasar/quasar-ui-qiconpicker v2.0.
|
|
3
|
-
* (c)
|
|
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
|
|
|
@@ -14,11 +14,11 @@ var quasar = require('quasar');
|
|
|
14
14
|
/**
|
|
15
15
|
* QIconPicker Properties
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
const useIconPickerProps = {
|
|
18
18
|
modelValue: String,
|
|
19
19
|
iconSet: {
|
|
20
20
|
type: String,
|
|
21
|
-
validator:
|
|
21
|
+
validator: v => [
|
|
22
22
|
'material-icons',
|
|
23
23
|
'material-icons-outlined',
|
|
24
24
|
'material-icons-round',
|
|
@@ -33,7 +33,7 @@ var useIconPickerProps = {
|
|
|
33
33
|
'line-awesome',
|
|
34
34
|
'bootstrap-icons',
|
|
35
35
|
''
|
|
36
|
-
].includes(v)
|
|
36
|
+
].includes(v),
|
|
37
37
|
default: ''
|
|
38
38
|
},
|
|
39
39
|
icons: Array,
|
|
@@ -58,10 +58,10 @@ var useIconPickerProps = {
|
|
|
58
58
|
},
|
|
59
59
|
paginationProps: {
|
|
60
60
|
type: Object,
|
|
61
|
-
default:
|
|
61
|
+
default: () => ({
|
|
62
62
|
maxPages: 5,
|
|
63
63
|
input: true
|
|
64
|
-
})
|
|
64
|
+
})
|
|
65
65
|
},
|
|
66
66
|
modelPagination: Object,
|
|
67
67
|
animated: Boolean,
|
|
@@ -75,7 +75,7 @@ var useIconPickerProps = {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
const direction = {
|
|
79
79
|
NEXT: 'next',
|
|
80
80
|
PREV: 'prev'
|
|
81
81
|
};
|
|
@@ -98,7 +98,7 @@ function useIconPickerPagination(data, props, emit, computedFilteredIcons) {
|
|
|
98
98
|
// returns true if the pagination is the same,
|
|
99
99
|
// otherwise returns false if it has changed
|
|
100
100
|
function samePagination(oldPag, newPag) {
|
|
101
|
-
for (
|
|
101
|
+
for (const prop in newPag) {
|
|
102
102
|
if (newPag[ prop ] !== oldPag[ prop ]) {
|
|
103
103
|
return false
|
|
104
104
|
}
|
|
@@ -106,19 +106,23 @@ function useIconPickerPagination(data, props, emit, computedFilteredIcons) {
|
|
|
106
106
|
return true
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
return fixPagination(
|
|
111
|
-
|
|
109
|
+
const computedPagination = vue.computed(() => {
|
|
110
|
+
return fixPagination({
|
|
111
|
+
...data.innerPagination,
|
|
112
|
+
...props.modelPagination
|
|
113
|
+
})
|
|
112
114
|
});
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
const computedPagesNumber = vue.computed(() => {
|
|
115
117
|
return computedPagination.value.itemsPerPage === 0 ? 1
|
|
116
118
|
: Math.max(1, Math.ceil(computedFilteredIcons.value.length / computedPagination.value.itemsPerPage))
|
|
117
119
|
});
|
|
118
120
|
|
|
119
121
|
function setPagination(val) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
const newPagination = fixPagination({
|
|
123
|
+
...computedPagination.value,
|
|
124
|
+
...val
|
|
125
|
+
});
|
|
122
126
|
|
|
123
127
|
if (!samePagination(data.innerPagination, newPagination)) {
|
|
124
128
|
if (props.modelPagination) {
|
|
@@ -135,11 +139,11 @@ function useIconPickerPagination(data, props, emit, computedFilteredIcons) {
|
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
return {
|
|
138
|
-
samePagination
|
|
139
|
-
computedPagination
|
|
140
|
-
setPagination
|
|
141
|
-
updatePagination
|
|
142
|
-
computedPagesNumber
|
|
142
|
+
samePagination,
|
|
143
|
+
computedPagination,
|
|
144
|
+
setPagination,
|
|
145
|
+
updatePagination,
|
|
146
|
+
computedPagesNumber
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
|
|
@@ -153,29 +157,29 @@ function useIconPickerIcons(data, props, computedFirstItemIndex, computedLastIte
|
|
|
153
157
|
if (iconSet) {
|
|
154
158
|
// detect if UMD version is installed
|
|
155
159
|
if (window.QIconPicker) {
|
|
156
|
-
|
|
160
|
+
const name = iconSet.replace(/-([a-z])/g, g => g[ 1 ].toUpperCase());
|
|
157
161
|
if (window.QIconPicker.iconSet && window.QIconPicker.iconSet[ name ]) {
|
|
158
162
|
data.iconsList = window.QIconPicker.iconSet[ name ].icons;
|
|
159
163
|
}
|
|
160
164
|
else {
|
|
161
|
-
console.error(
|
|
165
|
+
console.error(`QIconPicker: no icon set loaded called ${ iconSet }`);
|
|
162
166
|
console.error('Be sure to load the UMD version of the icon set in a script tag before using QIconPicker UMD version');
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
169
|
else {
|
|
166
170
|
try {
|
|
167
|
-
data.iconsList = require(
|
|
171
|
+
data.iconsList = require(`@quasar/quasar-ui-qiconpicker/src/components/icon-set/${ iconSet }.js`).default.icons;
|
|
168
172
|
}
|
|
169
173
|
catch (e) {
|
|
170
|
-
console.error(
|
|
174
|
+
console.error(`QIconPicker: cannot find icon set found called ${ iconSet }`);
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
|
-
console.info(
|
|
178
|
+
console.info(`Loaded ${ data.iconsList.length } icons.`);
|
|
175
179
|
}
|
|
176
180
|
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
const computedDisplayedIcons = vue.computed(() => {
|
|
182
|
+
let icons = [];
|
|
179
183
|
if (data.iconsList) {
|
|
180
184
|
icons = computedFilteredIcons.value;
|
|
181
185
|
|
|
@@ -187,27 +191,27 @@ function useIconPickerIcons(data, props, computedFirstItemIndex, computedLastIte
|
|
|
187
191
|
return icons
|
|
188
192
|
});
|
|
189
193
|
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
const computedFilteredIcons = vue.computed(() => {
|
|
195
|
+
let icons = data.iconsList;
|
|
192
196
|
if (icons) {
|
|
193
197
|
if (props.tags !== void 0 && props.tags !== '' && props.tags !== null && props.tags.length > 0) {
|
|
194
|
-
icons = icons.filter(
|
|
195
|
-
return icon.tags.filter(
|
|
198
|
+
icons = icons.filter(icon => {
|
|
199
|
+
return icon.tags.filter(tag => props.tags.includes(tag)).length > 0
|
|
196
200
|
});
|
|
197
201
|
}
|
|
198
202
|
if (props.filter !== void 0 && props.filter !== '' && props.filter !== null) {
|
|
199
|
-
icons = icons.filter(
|
|
203
|
+
icons = icons.filter(icon => icon.name.includes(props.filter));
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
206
|
return icons
|
|
203
207
|
});
|
|
204
208
|
|
|
205
209
|
function categories() {
|
|
206
|
-
|
|
207
|
-
data.iconsList.forEach(
|
|
208
|
-
|
|
210
|
+
const t = [];
|
|
211
|
+
data.iconsList.forEach(icon => {
|
|
212
|
+
const tags = icon.tags;
|
|
209
213
|
if (tags && tags.length > 0) {
|
|
210
|
-
tags.forEach(
|
|
214
|
+
tags.forEach(tag => {
|
|
211
215
|
if (t.includes(tag) !== true) {
|
|
212
216
|
t.push(tag);
|
|
213
217
|
}
|
|
@@ -220,10 +224,10 @@ function useIconPickerIcons(data, props, computedFirstItemIndex, computedLastIte
|
|
|
220
224
|
}
|
|
221
225
|
|
|
222
226
|
return {
|
|
223
|
-
loadIconSet
|
|
224
|
-
computedDisplayedIcons
|
|
225
|
-
computedFilteredIcons
|
|
226
|
-
categories
|
|
227
|
+
loadIconSet,
|
|
228
|
+
computedDisplayedIcons,
|
|
229
|
+
computedFilteredIcons,
|
|
230
|
+
categories
|
|
227
231
|
}
|
|
228
232
|
}
|
|
229
233
|
|
|
@@ -232,9 +236,8 @@ function useIconPickerIcons(data, props, computedFirstItemIndex, computedLastIte
|
|
|
232
236
|
*/
|
|
233
237
|
function exposeIconPickerApi(data, expose, computedPagination, setPagination, computedFirstItemIndex, computedLastItemIndex, computedFilteredIcons, computedPagesNumber) {
|
|
234
238
|
// goes to previous page
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
var page = ref.page;
|
|
239
|
+
const prevPage = () => {
|
|
240
|
+
const { page } = computedPagination.value;
|
|
238
241
|
if (page > 1) {
|
|
239
242
|
setPagination({ page: page - 1 });
|
|
240
243
|
data.direction = direction.PREV;
|
|
@@ -242,10 +245,8 @@ function exposeIconPickerApi(data, expose, computedPagination, setPagination, co
|
|
|
242
245
|
};
|
|
243
246
|
|
|
244
247
|
// goes to next page
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var page = ref.page;
|
|
248
|
-
var itemsPerPage = ref.itemsPerPage;
|
|
248
|
+
const nextPage = () => {
|
|
249
|
+
const { page, itemsPerPage } = computedPagination.value;
|
|
249
250
|
if (computedLastItemIndex.value > 0 && page * itemsPerPage < computedFilteredIcons.value.length) {
|
|
250
251
|
setPagination({ page: page + 1 });
|
|
251
252
|
data.direction = direction.NEXT;
|
|
@@ -253,17 +254,17 @@ function exposeIconPickerApi(data, expose, computedPagination, setPagination, co
|
|
|
253
254
|
};
|
|
254
255
|
|
|
255
256
|
// goes to last page
|
|
256
|
-
|
|
257
|
+
const lastPage = () => {
|
|
257
258
|
setPagination({ page: computedPagesNumber.value });
|
|
258
259
|
};
|
|
259
260
|
|
|
260
261
|
// goes to first page
|
|
261
|
-
|
|
262
|
+
const firstPage = () => {
|
|
262
263
|
setPagination({ page: 0 });
|
|
263
264
|
};
|
|
264
265
|
|
|
265
266
|
// checks if we are on the last page
|
|
266
|
-
|
|
267
|
+
const isLastPage = vue.computed(() => {
|
|
267
268
|
return computedLastItemIndex.value === 0
|
|
268
269
|
? true
|
|
269
270
|
: computedPagination.value.page >= computedPagesNumber.value
|
|
@@ -271,17 +272,17 @@ function exposeIconPickerApi(data, expose, computedPagination, setPagination, co
|
|
|
271
272
|
|
|
272
273
|
|
|
273
274
|
// checks if we are on the first page
|
|
274
|
-
|
|
275
|
+
const isFirstPage = vue.computed(() => {
|
|
275
276
|
return computedPagination.value.page === 1
|
|
276
277
|
});
|
|
277
278
|
|
|
278
279
|
expose({
|
|
279
|
-
prevPage
|
|
280
|
-
nextPage
|
|
281
|
-
lastPage
|
|
282
|
-
firstPage
|
|
283
|
-
isLastPage
|
|
284
|
-
isFirstPage
|
|
280
|
+
prevPage,
|
|
281
|
+
nextPage,
|
|
282
|
+
lastPage,
|
|
283
|
+
firstPage,
|
|
284
|
+
isLastPage,
|
|
285
|
+
isFirstPage
|
|
285
286
|
});
|
|
286
287
|
}
|
|
287
288
|
|
|
@@ -289,7 +290,9 @@ function exposeIconPickerApi(data, expose, computedPagination, setPagination, co
|
|
|
289
290
|
var QIconPicker = vue.defineComponent({
|
|
290
291
|
name: 'QIconPicker',
|
|
291
292
|
|
|
292
|
-
props:
|
|
293
|
+
props: {
|
|
294
|
+
...useIconPickerProps
|
|
295
|
+
},
|
|
293
296
|
|
|
294
297
|
emits: [
|
|
295
298
|
'update:model-value',
|
|
@@ -297,13 +300,9 @@ var QIconPicker = vue.defineComponent({
|
|
|
297
300
|
'update:model-pagination'
|
|
298
301
|
],
|
|
299
302
|
|
|
300
|
-
setup
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
var expose = ref$1.expose;
|
|
304
|
-
|
|
305
|
-
var scrollAreaRef = vue.ref(null);
|
|
306
|
-
var data = vue.reactive({
|
|
303
|
+
setup(props, { slots, emit, expose }) {
|
|
304
|
+
const scrollAreaRef = vue.ref(null);
|
|
305
|
+
const data = vue.reactive({
|
|
307
306
|
iconsList: [],
|
|
308
307
|
innerPagination: {
|
|
309
308
|
page: 1,
|
|
@@ -317,37 +316,35 @@ var QIconPicker = vue.defineComponent({
|
|
|
317
316
|
});
|
|
318
317
|
|
|
319
318
|
// index of first item on a page
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
var page = ref.page;
|
|
323
|
-
var itemsPerPage = ref.itemsPerPage;
|
|
319
|
+
const computedFirstItemIndex = vue.computed(() => {
|
|
320
|
+
const { page, itemsPerPage } = computedPagination.value;
|
|
324
321
|
return (page - 1) * itemsPerPage
|
|
325
322
|
});
|
|
326
323
|
|
|
327
324
|
// index of last item on a page
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
var page = ref.page;
|
|
331
|
-
var itemsPerPage = ref.itemsPerPage;
|
|
325
|
+
const computedLastItemIndex = vue.computed(() => {
|
|
326
|
+
const { page, itemsPerPage } = computedPagination.value;
|
|
332
327
|
return page * itemsPerPage
|
|
333
328
|
});
|
|
334
329
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
330
|
+
const {
|
|
331
|
+
loadIconSet,
|
|
332
|
+
computedDisplayedIcons,
|
|
333
|
+
computedFilteredIcons,
|
|
334
|
+
categories
|
|
335
|
+
} = useIconPickerIcons(data, props, computedFirstItemIndex, computedLastItemIndex);
|
|
336
|
+
|
|
337
|
+
const {
|
|
338
|
+
samePagination,
|
|
339
|
+
computedPagination,
|
|
340
|
+
setPagination,
|
|
341
|
+
updatePagination,
|
|
342
|
+
computedPagesNumber
|
|
343
|
+
} = useIconPickerPagination(data, props, emit, computedFilteredIcons);
|
|
347
344
|
|
|
348
345
|
exposeIconPickerApi(data, expose, computedPagination, setPagination, computedFirstItemIndex, computedLastItemIndex, computedFilteredIcons, computedPagesNumber);
|
|
349
346
|
|
|
350
|
-
vue.onMounted(
|
|
347
|
+
vue.onMounted(() => {
|
|
351
348
|
if (props.iconSet) {
|
|
352
349
|
loadIconSet(props.iconSet);
|
|
353
350
|
}
|
|
@@ -358,14 +355,14 @@ var QIconPicker = vue.defineComponent({
|
|
|
358
355
|
});
|
|
359
356
|
|
|
360
357
|
|
|
361
|
-
vue.watch(
|
|
358
|
+
vue.watch(() => props.iconSet, (val) => {
|
|
362
359
|
if (val) {
|
|
363
360
|
loadIconSet(val);
|
|
364
361
|
updatePagination();
|
|
365
|
-
vue.nextTick(
|
|
362
|
+
vue.nextTick(() => {
|
|
366
363
|
// whenever the icon set changes, it resets pagination page to page 1
|
|
367
364
|
setPagination({ page: 1 });
|
|
368
|
-
}).catch(
|
|
365
|
+
}).catch(e => console.error(e));
|
|
369
366
|
// scroll to top of QScrollArea, if applicable
|
|
370
367
|
if(scrollAreaRef.value) {
|
|
371
368
|
scrollAreaRef.value.setScrollPosition(0);
|
|
@@ -373,35 +370,35 @@ var QIconPicker = vue.defineComponent({
|
|
|
373
370
|
}
|
|
374
371
|
});
|
|
375
372
|
|
|
376
|
-
vue.watch(
|
|
373
|
+
vue.watch(() => props.icons, (val) => {
|
|
377
374
|
if (props.icons !== void 0 && props.icons.length > 0) {
|
|
378
375
|
data.iconsList = props.icons;
|
|
379
376
|
}
|
|
380
377
|
updatePagination();
|
|
381
|
-
vue.nextTick(
|
|
378
|
+
vue.nextTick(() => {
|
|
382
379
|
// whenever the icon set changes, it resets pagination page to page 1
|
|
383
380
|
setPagination({ page: 1 });
|
|
384
|
-
}).catch(
|
|
381
|
+
}).catch(e => console.error(e));
|
|
385
382
|
// scroll to top of QScrollArea, if applicable
|
|
386
383
|
if(scrollAreaRef.value) {
|
|
387
384
|
scrollAreaRef.value.setScrollPosition(0);
|
|
388
385
|
}
|
|
389
386
|
});
|
|
390
387
|
|
|
391
|
-
vue.watch(
|
|
388
|
+
vue.watch(() => props.filter, () => {
|
|
392
389
|
// whenever the filter changes, it resets pagination page to page 1
|
|
393
390
|
setPagination({ page: 1, totalPages: computedPagesNumber.value });
|
|
394
391
|
updatePagination();
|
|
395
392
|
});
|
|
396
393
|
|
|
397
|
-
vue.watch(
|
|
394
|
+
vue.watch(() => props.tags, (val) => {
|
|
398
395
|
// whenever the tags change, it resets pagination page to page 1
|
|
399
396
|
setPagination({ page: 1, totalPages: computedPagesNumber.value });
|
|
400
397
|
updatePagination();
|
|
401
398
|
});
|
|
402
399
|
|
|
403
400
|
if (props.modelPagination) {
|
|
404
|
-
vue.watch(
|
|
401
|
+
vue.watch(() => props.modelPagination, (newVal, oldVal) => {
|
|
405
402
|
if (!samePagination(oldVal, newVal)) {
|
|
406
403
|
updatePagination();
|
|
407
404
|
}
|
|
@@ -409,29 +406,28 @@ var QIconPicker = vue.defineComponent({
|
|
|
409
406
|
}
|
|
410
407
|
|
|
411
408
|
if (props.modelPagination) {
|
|
412
|
-
vue.watch(
|
|
409
|
+
vue.watch(() => props.modelPagination.itemsPerPage, () => {
|
|
413
410
|
updatePagination();
|
|
414
411
|
});
|
|
415
412
|
|
|
416
|
-
vue.watch(
|
|
413
|
+
vue.watch(() =>props.modelPagination.page, () => {
|
|
417
414
|
updatePagination();
|
|
418
415
|
});
|
|
419
416
|
}
|
|
420
417
|
|
|
421
|
-
return
|
|
418
|
+
return () => {
|
|
422
419
|
|
|
423
420
|
function renderPagination() {
|
|
424
|
-
if (props.modelPagination && props.modelPagination.itemsPerPage === 0)
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
{modelValue: page,
|
|
421
|
+
if (props.modelPagination && props.modelPagination.itemsPerPage === 0) return ''
|
|
422
|
+
const slot = (slots.pagination && slots.pagination());
|
|
423
|
+
const { page, totalPages } = computedPagination.value;
|
|
424
|
+
|
|
425
|
+
return slot || vue.h(quasar.QPagination, {
|
|
426
|
+
class: 'q-icon-picker__pagination',
|
|
427
|
+
...props.paginationProps,
|
|
428
|
+
modelValue: page,
|
|
433
429
|
max: totalPages,
|
|
434
|
-
'onUpdate:modelValue':
|
|
430
|
+
'onUpdate:modelValue': value => {
|
|
435
431
|
if (props.animated) {
|
|
436
432
|
if (value > page) {
|
|
437
433
|
data.direction = direction.NEXT;
|
|
@@ -441,12 +437,13 @@ var QIconPicker = vue.defineComponent({
|
|
|
441
437
|
}
|
|
442
438
|
}
|
|
443
439
|
setPagination({ page: value });
|
|
444
|
-
}
|
|
440
|
+
}
|
|
441
|
+
})
|
|
445
442
|
}
|
|
446
443
|
|
|
447
444
|
function renderFooter() {
|
|
448
445
|
if (props.noFooter !== true && props.modelPagination !== void 0) {
|
|
449
|
-
|
|
446
|
+
const slot = (slots.footer && slots.footer());
|
|
450
447
|
|
|
451
448
|
return vue.h('div', {
|
|
452
449
|
class: 'q-icon-picker__footer flex flex-center'
|
|
@@ -458,20 +455,20 @@ var QIconPicker = vue.defineComponent({
|
|
|
458
455
|
|
|
459
456
|
function renderTooltip(name) {
|
|
460
457
|
if (props.tooltips === true) {
|
|
461
|
-
return
|
|
458
|
+
return () => vue.h(quasar.QTooltip, {}, () => name)
|
|
462
459
|
}
|
|
463
460
|
}
|
|
464
461
|
|
|
465
462
|
function renderIcon(icon) {
|
|
466
|
-
|
|
463
|
+
const name = (icon.prefix !== void 0 ? icon.prefix + ' ' + icon.name : icon.name);
|
|
467
464
|
|
|
468
465
|
if (slots.icon && slots.icon()) {
|
|
469
466
|
return slots.icon(name)
|
|
470
467
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
468
|
+
const isSelected = name === props.modelValue;
|
|
469
|
+
const textColor = isSelected ? props.selectedTextColor : undefined;
|
|
470
|
+
const color = isSelected ? props.selectedColor : undefined;
|
|
471
|
+
const size = props.size ? props.size : undefined;
|
|
475
472
|
|
|
476
473
|
return vue.h(quasar.QBtn, {
|
|
477
474
|
id: name,
|
|
@@ -482,26 +479,26 @@ var QIconPicker = vue.defineComponent({
|
|
|
482
479
|
textColor: textColor,
|
|
483
480
|
color: color,
|
|
484
481
|
icon: name,
|
|
485
|
-
onClick:
|
|
482
|
+
onClick: () => emit('update:model-value', name),
|
|
486
483
|
}, renderTooltip(name))
|
|
487
484
|
}
|
|
488
485
|
|
|
489
486
|
function renderIcons() {
|
|
490
|
-
return computedDisplayedIcons.value.map(
|
|
487
|
+
return computedDisplayedIcons.value.map(icon => renderIcon(icon))
|
|
491
488
|
}
|
|
492
489
|
|
|
493
490
|
function renderContainer() {
|
|
494
|
-
|
|
491
|
+
const container = () => vue.h('div', {
|
|
495
492
|
key: computedPagination.value.page,
|
|
496
493
|
class: 'q-icon-picker__container col'
|
|
497
|
-
}, [
|
|
494
|
+
}, [...renderIcons()]);
|
|
498
495
|
|
|
499
496
|
if (props.animated === true) {
|
|
500
|
-
|
|
501
|
-
return
|
|
497
|
+
const transition = 'q-transition--' + (data.direction === 'prev' ? props.transitionPrev : props.transitionNext);
|
|
498
|
+
return () => vue.h(vue.Transition, {
|
|
502
499
|
name: transition,
|
|
503
500
|
appear: true
|
|
504
|
-
}, container)
|
|
501
|
+
}, container)
|
|
505
502
|
}
|
|
506
503
|
|
|
507
504
|
return container
|
|
@@ -524,7 +521,7 @@ var QIconPicker = vue.defineComponent({
|
|
|
524
521
|
}, [
|
|
525
522
|
renderScrollArea(),
|
|
526
523
|
vue.h(quasar.QResizeObserver, {
|
|
527
|
-
onResize:
|
|
524
|
+
onResize: (size) => {
|
|
528
525
|
data.width = size.width;
|
|
529
526
|
data.height = size.height;
|
|
530
527
|
}
|
|
@@ -532,31 +529,31 @@ var QIconPicker = vue.defineComponent({
|
|
|
532
529
|
])
|
|
533
530
|
}
|
|
534
531
|
|
|
535
|
-
|
|
532
|
+
const classes = [
|
|
536
533
|
'q-icon-picker',
|
|
537
534
|
'column'
|
|
538
535
|
];
|
|
539
|
-
if (props.color)
|
|
540
|
-
if (props.textColor)
|
|
536
|
+
if (props.color) classes.push('bg-' + props.color);
|
|
537
|
+
if (props.textColor) classes.push('text-' + props.textColor);
|
|
541
538
|
|
|
542
|
-
|
|
539
|
+
const picker = vue.h('div', {
|
|
543
540
|
class: classes.join(' ')
|
|
544
541
|
}, [
|
|
545
542
|
renderBody(),
|
|
546
543
|
renderFooter()
|
|
547
544
|
]);
|
|
548
545
|
|
|
549
|
-
vue.nextTick(
|
|
546
|
+
vue.nextTick(() => {
|
|
550
547
|
categories();
|
|
551
548
|
emit('update:tags', data.categories);
|
|
552
|
-
}).catch(
|
|
549
|
+
}).catch(e => console.error(e));
|
|
553
550
|
|
|
554
551
|
return picker
|
|
555
552
|
}
|
|
556
553
|
}
|
|
557
554
|
});
|
|
558
555
|
|
|
559
|
-
|
|
556
|
+
const version = '2.0.5';
|
|
560
557
|
|
|
561
558
|
function install (app) {
|
|
562
559
|
app.component(QIconPicker.name, QIconPicker);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @quasar/quasar-ui-qiconpicker v2.0.5
|
|
3
|
+
* (c) 2022 Jeff Galbraith <jeff@quasar.dev>
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vue=require("vue"),quasar=require("quasar");const useIconPickerProps={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"}},direction={NEXT:"next",PREV:"prev"};function useIconPickerPagination(o,n,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 o in t)if(t[o]!==e[o])return!1;return!0}const c=vue.computed(()=>{return a({...o.innerPagination,...n.modelPagination})}),t=vue.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(o.innerPagination,t)||(n.modelPagination&&i("update:model-pagination",t),o.innerPagination=t)}function u(){void 0!==n.modelPagination&&s({total:e.value.length,totalPages:t.value})}return{samePagination:r,computedPagination:c,setPagination:s,updatePagination:u,computedPagesNumber:t}}function useIconPickerIcons(n,t,o,i){function e(t){if(n.iconsList=[],t)if(window.QIconPicker){const e=t.replace(/-([a-z])/g,e=>e[1].toUpperCase());window.QIconPicker.iconSet&&window.QIconPicker.iconSet[e]?n.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{n.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 ${n.iconsList.length} icons.`)}const a=vue.computed(()=>{let e=[];n.iconsList&&(e=r.value,t.modelPagination&&0!==t.modelPagination.itemsPerPage&&(e=e.slice(o.value,i.value)));return e}),r=vue.computed(()=>{let e=n.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 o=[];return n.iconsList.forEach(e=>{const t=e.tags;t&&t.length>0&&t.forEach(e=>{!0!==o.includes(e)&&o.push(e)})}),o.sort(),n.categories=o,!0}return{loadIconSet:e,computedDisplayedIcons:a,computedFilteredIcons:r,categories:c}}function exposeIconPickerApi(o,e,n,i,t,a,r,c){const s=()=>{const e=n.value["page"];e>1&&(i({page:e-1}),o.direction=direction.PREV)},u=()=>{const{page:e,itemsPerPage:t}=n.value;a.value>0&&e*t<r.value.length&&(i({page:e+1}),o.direction=direction.NEXT)},l=()=>{i({page:c.value})},d=()=>{i({page:0})},g=vue.computed(()=>{return 0===a.value||n.value.page>=c.value}),p=vue.computed(()=>{return 1===n.value.page});e({prevPage:s,nextPage:u,lastPage:l,firstPage:d,isLastPage:g,isFirstPage:p})}var QIconPicker=vue.defineComponent({name:"QIconPicker",props:{...useIconPickerProps},emits:["update:model-value","update:tags","update:model-pagination"],setup(l,{slots:d,emit:g,expose:e}){const p=vue.ref(null),v=vue.reactive({iconsList:[],innerPagination:{page:1,itemsPerPage:0,totalPages:0},categories:[],width:"100",height:"100",direction:""}),t=vue.computed(()=>{const{page:e,itemsPerPage:t}=f.value;return(e-1)*t}),o=vue.computed(()=>{const{page:e,itemsPerPage:t}=f.value;return e*t}),{loadIconSet:n,computedDisplayedIcons:P,computedFilteredIcons:i,categories:m}=useIconPickerIcons(v,l,t,o),{samePagination:a,computedPagination:f,setPagination:h,updatePagination:r,computedPagesNumber:c}=useIconPickerPagination(v,l,g,i);return exposeIconPickerApi(v,e,f,h,t,o,i,c),vue.onMounted(()=>{l.iconSet?n(l.iconSet):void 0!==l.icons&&l.icons.length>0&&(v.iconsList=l.icons);r()}),vue.watch(()=>l.iconSet,e=>{e&&(n(e),r(),vue.nextTick(()=>{h({page:1})}).catch(e=>console.error(e)),p.value&&p.value.setScrollPosition(0))}),vue.watch(()=>l.icons,e=>{void 0!==l.icons&&l.icons.length>0&&(v.iconsList=l.icons);r();vue.nextTick(()=>{h({page:1})}).catch(e=>console.error(e));p.value&&p.value.setScrollPosition(0)}),vue.watch(()=>l.filter,()=>{h({page:1,totalPages:c.value});r()}),vue.watch(()=>l.tags,e=>{h({page:1,totalPages:c.value});r()}),l.modelPagination&&vue.watch(()=>l.modelPagination,(e,t)=>{a(t,e)||r()}),l.modelPagination&&(vue.watch(()=>l.modelPagination.itemsPerPage,()=>{r()}),vue.watch(()=>l.modelPagination.page,()=>{r()})),()=>{function t(){if(l.modelPagination&&0===l.modelPagination.itemsPerPage)return"";const e=d.pagination&&d.pagination(),{page:t,totalPages:o}=f.value;return e||vue.h(quasar.QPagination,{class:"q-icon-picker__pagination",...l.paginationProps,modelValue:t,max:o,"onUpdate:modelValue":e=>{l.animated&&(e>t?v.direction=direction.NEXT:v.direction=direction.PREV);h({page:e})}})}function e(){if(!0!==l.noFooter&&void 0!==l.modelPagination){const e=d.footer&&d.footer();return vue.h("div",{class:"q-icon-picker__footer flex flex-center"},[e?e(f.value):t()])}}function r(e){if(!0===l.tooltips)return()=>vue.h(quasar.QTooltip,{},()=>e)}function o(e){const t=void 0!==e.prefix?e.prefix+" "+e.name:e.name;if(d.icon&&d.icon())return d.icon(t);const o=t===l.modelValue,n=o?l.selectedTextColor:void 0,i=o?l.selectedColor:void 0,a=l.size||void 0;return vue.h(quasar.QBtn,{id:t,unelevated:!0,dense:l.dense,noWrap:!0,size:a,textColor:n,color:i,icon:t,onClick:()=>g("update:model-value",t)},r(t))}function n(){return P.value.map(e=>o(e))}function i(){const e=()=>vue.h("div",{key:f.value.page,class:"q-icon-picker__container col"},[...n()]);if(!0!==l.animated)return e;{const t="q-transition--"+("prev"===v.direction?l.transitionPrev:l.transitionNext);return()=>vue.h(vue.Transition,{name:t,appear:!0},e)}}function a(){return vue.h(quasar.QScrollArea,{ref:p,style:{width:v.width+"px",height:v.height+"px"}},i())}function c(){return vue.h("div",{class:"q-icon-picker__body col column"},[a(),vue.h(quasar.QResizeObserver,{onResize:e=>{v.width=e.width;v.height=e.height}})])}const s=["q-icon-picker","column"];l.color&&s.push("bg-"+l.color);l.textColor&&s.push("text-"+l.textColor);const u=vue.h("div",{class:s.join(" ")},[c(),e()]);vue.nextTick(()=>{m();g("update:tags",v.categories)}).catch(e=>console.error(e));return u}}});const version="2.0.5";function install(e){e.component(QIconPicker.name,QIconPicker)}exports.QIconPicker=QIconPicker,exports.install=install,exports.version=version;
|
package/dist/index.css
CHANGED