@mythpe/quasar-ui-qui 0.2.60 → 0.2.61

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": "@mythpe/quasar-ui-qui",
3
- "version": "0.2.60",
3
+ "version": "0.2.61",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -47,6 +47,7 @@ interface P {
47
47
  prependIconProps?: Props['prependIconProps'];
48
48
  appendIcon?: Props['appendIcon'];
49
49
  appendIconProps?: Props['appendIconProps'];
50
+ copy?: Props['copy'];
50
51
  }
51
52
 
52
53
  const props = withDefaults(defineProps<P>(), {
@@ -65,7 +66,7 @@ const props = withDefaults(defineProps<P>(), {
65
66
  help: undefined,
66
67
  required: undefined,
67
68
  rules: undefined,
68
- viewMode: !1,
69
+ viewMode: undefined,
69
70
  viewModeValue: undefined,
70
71
  autocomplete: undefined,
71
72
  topLabel: undefined,
@@ -74,14 +75,15 @@ const props = withDefaults(defineProps<P>(), {
74
75
  mobile: undefined,
75
76
  email: undefined,
76
77
  float: undefined,
77
- sar: !1,
78
+ sar: undefined,
78
79
  prependIcon: undefined,
79
80
  prependIconProps: undefined,
80
81
  appendIcon: undefined,
81
- appendIconProps: undefined
82
+ appendIconProps: undefined,
83
+ copy: undefined
82
84
  })
83
85
  defineModel<Props['modelValue']>({ required: !1, default: undefined })
84
- const { __, props: pluginOptions, formatMoney } = useMyth()
86
+ const { __, props: pluginOptions, formatMoney, copyText } = useMyth()
85
87
  const helper = useBindInput<Props>(() => props, 'input')
86
88
  const { theme, hasTopLabel, getLabel, getPlaceholder, getAutocompleteAttribute, inputRules } = helper
87
89
  const inputScope = useField<Props['modelValue']>(() => props.name, inputRules, {
@@ -115,6 +117,7 @@ const sarValue = computed<string | null>(() => {
115
117
  return '0.00'
116
118
  }
117
119
  })
120
+ const computedViewModeValue = computed<any>(() => props.viewModeValue ?? value.value)
118
121
  defineExpose<typeof scopes & { input: typeof input }>({ input, ...scopes })
119
122
  defineOptions({
120
123
  name: 'MInput',
@@ -208,6 +211,23 @@ defineOptions({
208
211
  >
209
212
  <MSarIcon />
210
213
  </template>
214
+ <template
215
+ v-else-if="copy && !!computedViewModeValue"
216
+ #append
217
+ >
218
+ <q-btn
219
+ flat
220
+ icon="ion-copy"
221
+ round
222
+ size="sm"
223
+ @click="copyText(computedViewModeValue)"
224
+ >
225
+ <q-tooltip v-if="!!computedViewModeValue">
226
+ {{ __('labels.copy') }}
227
+ </q-tooltip>
228
+ </q-btn>
229
+ </template>
230
+
211
231
  <template
212
232
  v-if="viewMode"
213
233
  #control
@@ -219,7 +239,7 @@ defineOptions({
219
239
  :text="sarValue"
220
240
  />
221
241
  <template v-else>
222
- {{ viewModeValue ?? value }}
242
+ {{ computedViewModeValue }}
223
243
  </template>
224
244
  </MInputFieldControl>
225
245
  </slot>
@@ -154,6 +154,11 @@ export interface MInputProps extends Omit<QInputProps, 'rules' | 'name' | 'model
154
154
  prependIconProps?: Partial<QIconProps>;
155
155
  appendIcon?: string;
156
156
  appendIconProps?: Partial<QIconProps>;
157
+ /**
158
+ * Show copy button.
159
+ * Default: false.
160
+ */
161
+ copy?: boolean;
157
162
  }
158
163
 
159
164
  export type MInputSlots = QInputSlots & QFieldSlots & BaseInputsSlots