@mythpe/quasar-ui-qui 0.1.88 → 0.1.90
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
|
@@ -131,7 +131,7 @@ const toUrl = (data?: any) => {
|
|
|
131
131
|
const hasSrc = computed(() => !!modelValue.value || !!url.value)
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
* Check if blob value is a File & not image
|
|
134
|
+
* Check if the blob value is a File & not image
|
|
135
135
|
*/
|
|
136
136
|
const isFile = computed(() => {
|
|
137
137
|
if (!(modelValue.value instanceof File)) {
|
|
@@ -154,6 +154,15 @@ const isImage = computed(() => {
|
|
|
154
154
|
})
|
|
155
155
|
const isFileNotImage = computed(() => hasSrc.value && !isImage.value)
|
|
156
156
|
const getAvatarText = computed<string | undefined>(() => props.avatarText ? props.avatarText.slice(0, 1).toUpperCase() : undefined)
|
|
157
|
+
const getRequired = computed(() => {
|
|
158
|
+
if (!props.required) {
|
|
159
|
+
return !1
|
|
160
|
+
}
|
|
161
|
+
if (hasSrc.value) {
|
|
162
|
+
return !1
|
|
163
|
+
}
|
|
164
|
+
return !0
|
|
165
|
+
})
|
|
157
166
|
const loadingSrc = ref(!1)
|
|
158
167
|
const onClick = (e?: Event) => {
|
|
159
168
|
if (props.readonly) {
|
|
@@ -242,7 +251,7 @@ defineOptions({
|
|
|
242
251
|
>
|
|
243
252
|
{{ label ? __(label) : label }}
|
|
244
253
|
<span
|
|
245
|
-
v-if="
|
|
254
|
+
v-if="getRequired && !readonly"
|
|
246
255
|
class="text-negative"
|
|
247
256
|
>*</span>
|
|
248
257
|
</div>
|
|
@@ -272,7 +281,7 @@ defineOptions({
|
|
|
272
281
|
type="QAvatar"
|
|
273
282
|
/>
|
|
274
283
|
<q-avatar
|
|
275
|
-
v-
|
|
284
|
+
v-if="!loading"
|
|
276
285
|
:color="errorMessage ? 'negative' : ((!isLoaded || !hasSrc || isFile || isFileNotImage) ? emptyColor : undefined)"
|
|
277
286
|
:icon="isFileNotImage && !url ? 'o_description' : undefined"
|
|
278
287
|
:rounded="rounded"
|
|
@@ -310,13 +319,25 @@ defineOptions({
|
|
|
310
319
|
v-if="loading"
|
|
311
320
|
type="QBtn"
|
|
312
321
|
/>
|
|
322
|
+
<MTransition>
|
|
323
|
+
<div
|
|
324
|
+
v-if="!loading && !!modelValue"
|
|
325
|
+
key="uploaded-text"
|
|
326
|
+
class="text-center q-mb-lg text-positive"
|
|
327
|
+
>
|
|
328
|
+
<q-icon name="ion-checkmark" />
|
|
329
|
+
{{ __('labels.uploaded') }}
|
|
330
|
+
</div>
|
|
331
|
+
</MTransition>
|
|
313
332
|
<MBtn
|
|
314
|
-
v-
|
|
333
|
+
v-if="!loading"
|
|
315
334
|
:color="undefined"
|
|
316
335
|
:disable="!isLoaded && !!url"
|
|
317
|
-
:
|
|
336
|
+
:icon="`ion-${hasSrc ? (required ? 'cloud-upload' : 'ios-trash') : 'cloud-upload'}`"
|
|
337
|
+
:label="'labels.' + ( clearable ? ( hasSrc ? 'remove' : btnLabel ) : ( required ? ( hasSrc ? 'change' : btnLabel ) : (
|
|
338
|
+
hasSrc ? 'remove' : btnLabel
|
|
339
|
+
) ) )"
|
|
318
340
|
:loading="loadingSrc"
|
|
319
|
-
icon="ion-ios-images"
|
|
320
341
|
outline
|
|
321
342
|
@click="onClick"
|
|
322
343
|
/>
|
|
@@ -335,7 +356,7 @@ defineOptions({
|
|
|
335
356
|
>
|
|
336
357
|
<MBtn
|
|
337
358
|
:color="undefined"
|
|
338
|
-
icon="ion-
|
|
359
|
+
icon="ion-cloud-download"
|
|
339
360
|
label="labels.download"
|
|
340
361
|
outline
|
|
341
362
|
@click="openWindow(url)"
|
|
@@ -360,7 +381,7 @@ defineOptions({
|
|
|
360
381
|
:accept="accepts.join(',')"
|
|
361
382
|
:clearable="clearable"
|
|
362
383
|
:name="name || ''"
|
|
363
|
-
:required="
|
|
384
|
+
:required="getRequired"
|
|
364
385
|
:rules="rules"
|
|
365
386
|
class="hidden"
|
|
366
387
|
/>
|
|
@@ -3,6 +3,7 @@ import { computed, ref, toValue, useAttrs } from 'vue'
|
|
|
3
3
|
import { useI18n } from 'vue-i18n'
|
|
4
4
|
import { useMyth } from './useMyth'
|
|
5
5
|
import type { MythComponentsProps as UiOpt } from '../types/plugin-props-option'
|
|
6
|
+
import { biRadar } from '@quasar/extras/bootstrap-icons'
|
|
6
7
|
|
|
7
8
|
type G = { name: string; [k: string]: any };
|
|
8
9
|
type OptsContext = { choose?: boolean; };
|
|
@@ -213,6 +214,10 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
|
|
|
213
214
|
mainFor: for (const c of cases) {
|
|
214
215
|
for (const b of [attributes, props]) {
|
|
215
216
|
if (c in b && (b[c] === !0 || b[c] === '')) {
|
|
217
|
+
if (key === 'avatarViewer' && c === 'required') {
|
|
218
|
+
// eslint-disable-next-line no-labels
|
|
219
|
+
break mainFor
|
|
220
|
+
}
|
|
216
221
|
rules[snakeCase(k)] = b[c] === !0 || b[c] === '' ? !0 : b[c]
|
|
217
222
|
// eslint-disable-next-line no-labels
|
|
218
223
|
break mainFor
|
|
@@ -175,9 +175,11 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
|
|
|
175
175
|
return __('show_details')
|
|
176
176
|
})
|
|
177
177
|
const getFormTitle = computed(() => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
let name = ''
|
|
179
|
+
if (serviceName.value && typeof serviceName.value !== 'function') {
|
|
180
|
+
const s = serviceName.value?.toString()?.split('/').pop() ?? ''
|
|
181
|
+
name = __(`choice.${pascalCase(pluralize(s))}`, 1)
|
|
182
|
+
}
|
|
181
183
|
return __(`replace.${formMode.value}`, { name })
|
|
182
184
|
})
|
|
183
185
|
const isGrid = computed(() => {
|
package/src/utils/Str.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
// import { plural as pluralCase, singular as singularCase } from '__pluralize'
|
|
10
|
-
import __pluralize from './copy_pluralize'
|
|
10
|
+
// import __pluralize from './copy_pluralize'
|
|
11
|
+
import __pluralize from 'pluralize'
|
|
11
12
|
import { camelCase, capitalCase, dotCase, kebabCase, pascalCase, snakeCase } from 'change-case'
|
|
12
13
|
// console.log(__pluralize.plural())
|
|
13
14
|
export const Str = {
|