quasar-ui-sellmate-ui-kit 3.2.4 → 3.2.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-sellmate-ui-kit",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "author": "Sellmate Dev Team <dev@sellmate.co.kr>",
5
5
  "description": "Sellmate UI Kit",
6
6
  "license": "MIT",
@@ -11,9 +11,7 @@
11
11
  map-options
12
12
  autocomplete="country"
13
13
  color="positive"
14
- :popup-content-class="
15
- ['s-select-checkbox-opts', popupContentClass].join(' ')
16
- "
14
+ :popup-content-class="['s-select-checkbox-opts', popupContentClass].join(' ')"
17
15
  class="s-select-checkbox"
18
16
  :option-label="optionLabel"
19
17
  :option-value="optionValue"
@@ -28,7 +26,7 @@
28
26
  ref="sSelectRef"
29
27
  >
30
28
  <!-- TODO: 아무것도 선택되지 않았을 때 props 값으로 표기 해줘야함 기본 값은 "전체" -->
31
- <template v-slot:before-options>
29
+ <template #before-options>
32
30
  <div class="search-input-form-container">
33
31
  <form class="select-search-input-form">
34
32
  <q-icon :name="searchIcon" size="20px" />
@@ -38,7 +36,7 @@
38
36
  class="select-search-input"
39
37
  :placeholder="searchPlaceholder"
40
38
  @input="
41
- (data) => {
39
+ data => {
42
40
  onSearch(data.target.value);
43
41
  }
44
42
  "
@@ -46,36 +44,28 @@
46
44
  </form>
47
45
  </div>
48
46
  </template>
49
- <template v-slot:option="{ itemProps, opt, selected, toggleOption }">
47
+ <template #option="{ itemProps, opt, selected, toggleOption }">
50
48
  <q-item v-bind="itemProps" class="custom-select-options">
51
49
  <q-item-section side v-if="!opt.disable">
52
- <s-checkbox
53
- :modelValue="selected"
54
- @update:modelValue="toggleOption(opt)"
55
- />
50
+ <s-checkbox :modelValue="selected" @update:modelValue="toggleOption(opt)" />
56
51
  </q-item-section>
57
52
  <q-item-section v-if="opt[optionGroup]" class="text-Grey_Darken-4">
58
53
  {{ opt[optionGroup] }}
59
54
  </q-item-section>
60
55
  <q-item-section avatar v-if="opt.logo">
61
- <q-img
62
- class="q-pa-none bg-Grey_Lighten-5"
63
- :src="opt.logo"
64
- width="60px"
65
- height="22px"
66
- />
56
+ <q-img class="q-pa-none bg-Grey_Lighten-5" :src="opt.logo" width="60px" height="22px" />
67
57
  </q-item-section>
68
58
  <q-item-section>
69
59
  {{ opt[optionLabel] }}
70
60
  </q-item-section>
71
61
  </q-item>
72
62
  </template>
73
- <template v-if="useAll && model[0] === ''" v-slot:selected>
63
+ <template v-if="useAll && (model[0] === '' || model.includes(''))" #selected>
74
64
  <div>
75
65
  {{ placeholder }}
76
66
  </div>
77
67
  </template>
78
- <template v-slot:no-option>
68
+ <template #no-option>
79
69
  <div class="search-input-form-container">
80
70
  <form class="select-search-input-form">
81
71
  <q-icon :name="searchIcon" size="20px" />
@@ -85,7 +75,7 @@
85
75
  class="select-search-input"
86
76
  :placeholder="searchPlaceholder"
87
77
  @input="
88
- (data) => {
78
+ data => {
89
79
  onSearch(data.target.value);
90
80
  }
91
81
  "
@@ -100,257 +90,255 @@
100
90
  </template>
101
91
 
102
92
  <script>
103
- import {
104
- QIcon, QImg, QItem, QItemSection, QSelect, debounce,
105
- } from 'quasar';
106
- import {
107
- defineComponent, nextTick, onBeforeMount, ref, watch,
108
- } from 'vue';
109
- import { searchIcon, selectDownArrowIcon } from '../assets/icons';
93
+ import { QIcon, QImg, QItem, QItemSection, QSelect, debounce } from 'quasar';
94
+ import { defineComponent, nextTick, onBeforeMount, ref, watch } from 'vue';
95
+ import { searchIcon, selectDownArrowIcon } from '../assets/icons';
110
96
 
111
- export default defineComponent({
112
- name: 'SSelectSearchCheckbox',
113
- emits: ['update:modelValue'],
114
- components: {
115
- QSelect,
116
- QItem,
117
- QItemSection,
118
- QImg,
119
- QIcon,
120
- // QInput,
121
- },
122
- props: {
123
- searchPlaceholder: { type: String, default: '검색' },
124
- options: {
125
- type: Array,
126
- required: true,
127
- },
128
- modelValue: {
129
- type: Array,
130
- required: true,
131
- },
132
- optionLabel: {
133
- type: [String, Function],
134
- default: 'label',
135
- },
136
- optionValue: {
137
- type: String,
138
- default: 'value',
139
- },
140
- optionGroup: {
141
- type: String,
142
- default: 'group',
143
- },
144
- useAll: {
145
- type: Boolean,
146
- default: false,
147
- },
148
- placeholder: {
149
- type: String,
150
- default: '전체',
97
+ export default defineComponent({
98
+ name: 'SSelectSearchCheckbox',
99
+ emits: ['update:modelValue'],
100
+ components: {
101
+ QSelect,
102
+ QItem,
103
+ QItemSection,
104
+ QImg,
105
+ QIcon,
151
106
  },
152
- checkboxSearch: {
153
- type: String,
154
- default: '',
155
- },
156
- noData: {
157
- type: String,
158
- default: '데이터 없음',
159
- },
160
- popupContentClass: {
161
- type: String,
107
+ props: {
108
+ searchPlaceholder: { type: String, default: '검색' },
109
+ options: {
110
+ type: Array,
111
+ required: true,
112
+ },
113
+ modelValue: {
114
+ type: Array,
115
+ required: true,
116
+ },
117
+ optionLabel: {
118
+ type: [String, Function],
119
+ default: 'label',
120
+ },
121
+ optionValue: {
122
+ type: String,
123
+ default: 'value',
124
+ },
125
+ optionGroup: {
126
+ type: String,
127
+ default: 'group',
128
+ },
129
+ useAll: {
130
+ type: Boolean,
131
+ default: false,
132
+ },
133
+ placeholder: {
134
+ type: String,
135
+ default: '전체',
136
+ },
137
+ checkboxSearch: {
138
+ type: String,
139
+ default: '',
140
+ },
141
+ noData: {
142
+ type: String,
143
+ default: '데이터 없음',
144
+ },
145
+ popupContentClass: {
146
+ type: String,
147
+ },
162
148
  },
163
- },
164
- setup(props, { emit }) {
165
- const model = ref(props.modelValue);
166
- const filteredOptions = ref(props.options);
167
- const searchInput = ref(null);
168
- const search = ref('');
169
- const isDisable = props.options.find((v) => Boolean(v.disable));
149
+ setup(props, { emit }) {
150
+ const model = ref(props.modelValue);
151
+ const filteredOptions = ref(props.options);
152
+ const searchInput = ref(null);
153
+ const search = ref('');
154
+ const isDisable = props.options.find(v => Boolean(v.disable));
170
155
 
171
- function onRemoveChecked(detail) {
172
- const idx = model.value.findIndex((v) => v === '');
173
- if (detail[props.optionValue] === '') {
174
- nextTick(() => {
175
- model.value = [];
176
- });
177
- } else if (idx >= 0) {
178
- nextTick(() => {
179
- model.value.splice(idx, 1);
180
- });
181
- }
182
- }
183
- function onAddChecked(detail) {
184
- if (detail[props.optionValue] === '') {
185
- nextTick(() => {
186
- model.value = props.options
187
- .filter((v) => !v.category)
188
- .map((option) => option[props.optionValue]);
189
- });
190
- } else {
191
- nextTick(() => {
192
- if (model.value.length === props.options.length - 1) {
193
- model.value = props.options
194
- .filter((v) => !v.category)
195
- .map((option) => option[props.optionValue]);
196
- }
197
- });
156
+ function onRemoveChecked(detail) {
157
+ const idx = model.value.findIndex(v => v === '');
158
+ if (detail[props.optionValue] === '') {
159
+ nextTick(() => {
160
+ model.value = [];
161
+ });
162
+ } else if (idx >= 0) {
163
+ nextTick(() => {
164
+ model.value.splice(idx, 1);
165
+ });
166
+ }
198
167
  }
199
- }
200
168
 
201
- const onSearch = debounce((val) => {
202
- if (val === '') {
203
- filteredOptions.value = props.options;
204
- } else {
205
- filteredOptions.value = props.options.filter(
206
- (v) => (v[props.optionLabel] || v).toLowerCase().indexOf(val.toLowerCase()) > -1,
207
- );
169
+ function onAddChecked(detail) {
170
+ if (detail[props.optionValue] === '') {
171
+ nextTick(() => {
172
+ model.value = props.options
173
+ .filter(v => !v.category)
174
+ .map(option => option[props.optionValue]);
175
+ });
176
+ } else {
177
+ nextTick(() => {
178
+ if (model.value.length === props.options.length - 1) {
179
+ model.value = props.options
180
+ .filter(v => !v.category)
181
+ .map(option => option[props.optionValue]);
182
+ }
183
+ });
184
+ }
208
185
  }
209
- }, 200);
210
186
 
211
- watch(
212
- () => props.modelValue,
213
- (val) => {
214
- model.value = val;
215
-
216
- if (
217
- props.options.filter((opt) => opt[props.optionValue] && !opt.category)
218
- .length === model.value.length
219
- && model.value.length
220
- ) {
221
- model.value = props.options
222
- .filter((v) => !v.category)
223
- .map((option) => option[props.optionValue]);
187
+ const onSearch = debounce(val => {
188
+ if (val === '') {
189
+ filteredOptions.value = props.options;
190
+ } else {
191
+ filteredOptions.value = props.options.filter(
192
+ v => (v[props.optionLabel] || v).toLowerCase().indexOf(val.toLowerCase()) > -1,
193
+ );
224
194
  }
225
- },
226
- );
195
+ }, 200);
227
196
 
228
- watch(model, (val) => {
229
- emit('update:modelValue', val);
230
- });
197
+ watch(
198
+ () => props.modelValue,
199
+ val => {
200
+ model.value = val;
231
201
 
232
- watch(
233
- () => props.options,
234
- (val) => {
235
- filteredOptions.value = val;
236
- nextTick(() => {
237
- if (props.useAll && model.value.filter((v) => v).length < 1) {
202
+ if (
203
+ props.options.filter(opt => opt[props.optionValue] && !opt.category).length ===
204
+ model.value.length &&
205
+ model.value.length
206
+ ) {
238
207
  model.value = props.options
239
- .filter((v) => !v.category)
240
- .map((option) => option[props.optionValue]);
208
+ .filter(v => !v.category)
209
+ .map(option => option[props.optionValue]);
241
210
  }
242
- });
243
- },
244
- );
211
+ },
212
+ );
245
213
 
246
- onBeforeMount(() => {
247
- if (props.useAll && model.value.filter((v) => v).length < 1) {
248
- model.value = props.options
249
- .filter((v) => !v.category)
250
- .map((option) => option[props.optionValue]);
251
- }
252
- });
214
+ watch(model, val => {
215
+ emit('update:modelValue', val);
216
+ });
217
+
218
+ const allSelectedModel = () => {
219
+ console.log('model.value', model.value, model.value.filter(v => v).length < 1);
220
+ if (props.useAll && model.value.filter(v => v).length < 1) {
221
+ model.value = props.options
222
+ .filter(v => !v.category)
223
+ .map(option => option[props.optionValue]);
224
+ }
225
+ };
253
226
 
254
- return {
255
- model,
256
- selectDownArrowIcon,
257
- onRemoveChecked,
258
- onAddChecked,
259
- onSearch,
260
- isDisable,
261
- filteredOptions,
262
- search,
263
- searchInput,
264
- searchIcon,
265
- sSelectRef: ref(null),
266
- };
267
- },
268
- });
227
+ watch(
228
+ () => props.options,
229
+ val => {
230
+ model.value = [];
231
+ filteredOptions.value = val;
232
+ nextTick(() => {
233
+ allSelectedModel();
234
+ });
235
+ },
236
+ );
237
+
238
+ onBeforeMount(() => {
239
+ allSelectedModel();
240
+ });
241
+
242
+ return {
243
+ model,
244
+ selectDownArrowIcon,
245
+ onRemoveChecked,
246
+ onAddChecked,
247
+ onSearch,
248
+ isDisable,
249
+ filteredOptions,
250
+ search,
251
+ searchInput,
252
+ searchIcon,
253
+ sSelectRef: ref(null),
254
+ };
255
+ },
256
+ });
269
257
  </script>
270
258
 
271
259
  <style lang="scss">
272
- @import "../css/quasar.variables.scss";
273
- @import "../css/extends.scss";
260
+ @import '../css/quasar.variables.scss';
261
+ @import '../css/extends.scss';
274
262
 
275
- .s-select-checkbox {
276
- @extend %select;
263
+ .s-select-checkbox {
264
+ @extend %select;
277
265
 
278
- .q-field__native {
279
- display: block;
280
- min-height: 0;
281
- height: $default-height;
282
- width: 100%;
283
- padding: $select-padding !important;
284
- color: $Grey_Darken-4;
285
- white-space: nowrap;
286
- overflow: hidden;
287
- text-overflow: ellipsis;
266
+ .q-field__native {
267
+ display: block;
268
+ min-height: 0;
269
+ height: $default-height;
270
+ width: 100%;
271
+ padding: $select-padding !important;
272
+ color: $Grey_Darken-4;
273
+ white-space: nowrap;
274
+ overflow: hidden;
275
+ text-overflow: ellipsis;
288
276
 
289
- > span {
290
- max-height: $default-height;
291
- }
277
+ > span {
278
+ max-height: $default-height;
279
+ }
292
280
 
293
- > .s-checkbox {
294
- margin-right: $default-icon-margin;
281
+ > .s-checkbox {
282
+ margin-right: $default-icon-margin;
283
+ }
295
284
  }
296
285
  }
297
- }
298
-
299
- .s-select-checkbox-opts {
300
- @extend %select-menu-list;
301
- }
302
286
 
303
- .custom-select-options {
304
- height: $default-height;
305
- }
287
+ .s-select-checkbox-opts {
288
+ @extend %select-menu-list;
289
+ }
306
290
 
307
- .disabled.s-select-checkbox-option {
308
- border: none;
309
- background: none !important;
310
- color: $Grey_Default !important;
311
- }
291
+ .custom-select-options {
292
+ height: $default-height;
293
+ }
312
294
 
313
- .select-search-input-form {
314
- height: 28px;
315
- display: flex;
316
- align-items: center;
317
- padding-left: 8px;
318
- position: relative;
319
- border-radius: 2px;
320
- border: 1px solid $Grey_Lighten-1;
321
- background-color: white;
322
- position: sticky;
323
- top: 0;
324
- z-index: 1;
325
- margin: 4px;
295
+ .disabled.s-select-checkbox-option {
296
+ border: none;
297
+ background: none !important;
298
+ color: $Grey_Default !important;
299
+ }
326
300
 
327
- &::after {
328
- content: "";
329
- position: absolute;
301
+ .select-search-input-form {
302
+ height: 28px;
303
+ display: flex;
304
+ align-items: center;
305
+ padding-left: 8px;
306
+ position: relative;
307
+ border-radius: 2px;
308
+ border: 1px solid $Grey_Lighten-1;
309
+ background-color: white;
310
+ position: sticky;
330
311
  top: 0;
331
- right: 0;
332
- bottom: 0;
333
- left: 0;
334
- pointer-events: none;
335
- border: 1px solid transparent;
336
- border-radius: inherit;
337
- }
312
+ z-index: 1;
313
+ margin: 4px;
338
314
 
339
- &:hover,
340
- &:focus-within {
341
315
  &::after {
342
- border-color: #0075ff;
343
- box-shadow: 0 0 4px #0075ff;
344
- transition: border-color 0.36s cubic-bezier(0.4, 0, 0.2, 1);
316
+ content: '';
317
+ position: absolute;
318
+ top: 0;
319
+ right: 0;
320
+ bottom: 0;
321
+ left: 0;
322
+ pointer-events: none;
323
+ border: 1px solid transparent;
324
+ border-radius: inherit;
345
325
  }
346
- }
347
326
 
348
- .select-search-input {
349
- font-size: 12px;
350
- margin-left: 8px;
351
- flex-grow: 1;
352
- border: none;
353
- outline: none;
327
+ &:hover,
328
+ &:focus-within {
329
+ &::after {
330
+ border-color: #0075ff;
331
+ box-shadow: 0 0 4px #0075ff;
332
+ transition: border-color 0.36s cubic-bezier(0.4, 0, 0.2, 1);
333
+ }
334
+ }
335
+
336
+ .select-search-input {
337
+ font-size: 12px;
338
+ margin-left: 8px;
339
+ flex-grow: 1;
340
+ border: none;
341
+ outline: none;
342
+ }
354
343
  }
355
- }
356
344
  </style>