@mythpe/quasar-ui-qui 0.2.3 → 0.2.4

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.3",
3
+ "version": "0.2.4",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -84,7 +84,7 @@ const props = withDefaults(defineProps<P>(), {
84
84
  rules: () => ({}),
85
85
  contentClass: 'items-center',
86
86
  emptyColor: 'grey-2',
87
- btnLabel: 'choose_file'
87
+ btnLabel: 'pick'
88
88
  })
89
89
  type Emits = {
90
90
  (e: 'click', evt?: Event): void;
@@ -78,25 +78,25 @@ const props = withDefaults(defineProps<P>(), {
78
78
  stackLabel: undefined,
79
79
  required: undefined,
80
80
  rules: undefined,
81
- viewMode: () => !1,
81
+ viewMode: !1,
82
82
  viewModeValue: undefined,
83
83
  autocomplete: undefined,
84
84
  topLabel: undefined,
85
85
  behavior: undefined,
86
- emitValue: () => !0,
87
- useInput: () => !0,
88
- mapOptions: () => !0,
86
+ emitValue: !0,
87
+ useInput: !0,
88
+ mapOptions: !0,
89
89
  loading: undefined,
90
90
  noLoading: !1,
91
91
  multiple: undefined,
92
92
  options: () => ([]),
93
- optionLabel: () => 'label',
94
- optionValue: () => 'value',
93
+ optionLabel: 'label',
94
+ optionValue: 'value',
95
95
  noFilter: undefined,
96
96
  hideEmptyList: undefined,
97
97
  readonly: undefined,
98
98
  useChips: undefined,
99
- searchLength: () => 1,
99
+ searchLength: 1,
100
100
  axiosMode: undefined,
101
101
  hideSelected: undefined,
102
102
  onFilter: undefined,
@@ -169,6 +169,18 @@ const listeners = {
169
169
  }
170
170
  const input = useTemplateRef<InstanceType<typeof QSelect> | InstanceType<typeof QField>>('input')
171
171
  const scopes = reactive(inputScope)
172
+ const getViewModeValue = computed(() => {
173
+ if (props.viewModeValue === undefined) {
174
+ const i = getOptions.value.find(e => e.value === value.value)
175
+ if (i) {
176
+ if (typeof props.optionLabel === 'function') {
177
+ return props.optionLabel(i)
178
+ }
179
+ return i[props.optionLabel]
180
+ }
181
+ }
182
+ return props.viewModeValue || value.value
183
+ })
172
184
  defineExpose<typeof scopes & {
173
185
  input: typeof input,
174
186
  onDoneOptions: typeof onDoneOptions
@@ -334,7 +346,7 @@ defineOptions({
334
346
  >
335
347
  <slot name="control">
336
348
  <MInputFieldControl>
337
- {{ viewModeValue ?? value }}
349
+ {{ getViewModeValue ?? viewModeValue ?? value }}
338
350
  </MInputFieldControl>
339
351
  </slot>
340
352
  </template>