quasar-ui-danx 0.0.33 → 0.0.35

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -57,7 +57,9 @@
57
57
  >
58
58
  <RenderComponent
59
59
  v-if="rowProps.col.component"
60
- :row-props="rowProps"
60
+ :params="[rowProps.row]"
61
+ :component="rowProps.col.component"
62
+ :text="rowProps.value"
61
63
  @action="$emit('action', $event)"
62
64
  />
63
65
  <div v-else-if="rowProps.col.fieldList">
@@ -87,16 +87,21 @@ function toQDateValue(val) {
87
87
  }
88
88
 
89
89
  const dateRangeValue = computed(() => {
90
- let range = dateRange.value;
90
+ let range;
91
91
 
92
- if (typeof range === 'string') {
92
+ if (typeof dateRange.value === 'string') {
93
93
  range = {
94
- from: range,
95
- to: range
94
+ from: dateRange.value,
95
+ to: dateRange.value
96
+ };
97
+ } else if (dateRange.value) {
98
+ range = {
99
+ from: dateRange.value.from,
100
+ to: dateRange.value.to
96
101
  };
97
102
  }
98
103
 
99
- if (range?.from && range?.to && props.withTime) {
104
+ if (range?.from && range?.to && props.withTime && !range.from.includes('00:00:00')) {
100
105
  range.from += ' 00:00:00';
101
106
  range.to += ' 23:59:59';
102
107
  }
@@ -1,22 +1,37 @@
1
1
  <template>
2
2
  <Component
3
- :is="component.is"
4
- v-bind="component.props"
5
- @action="$emit('action', $event)"
6
- >{{ component.value || component.props?.text || rowProps.value }}</Component>
3
+ :is="resolvedComponent.is"
4
+ v-bind="{...resolvedComponent.props, ...overrideProps}"
5
+ @action="$emit('action', $event)"
6
+ >{{ resolvedComponent.value || resolvedComponent.props?.text || text }}</Component>
7
7
  </template>
8
8
  <script setup>
9
- import { computed } from "vue";
9
+ import { computed } from 'vue';
10
10
 
11
- defineEmits(["action"]);
11
+ defineEmits(['action']);
12
12
  const props = defineProps({
13
- rowProps: {
14
- type: Object,
13
+ component: {
14
+ type: [Function, Object],
15
15
  required: true
16
+ },
17
+ params: {
18
+ type: Array,
19
+ default: () => []
20
+ },
21
+ text: {
22
+ type: String,
23
+ default: ''
24
+ },
25
+ overrideProps: {
26
+ type: Object,
27
+ default: () => ({})
16
28
  }
17
29
  });
18
30
 
19
- const component = computed(() => {
20
- return props.rowProps.col.component(props.rowProps.row);
31
+ const resolvedComponent = computed(() => {
32
+ if (typeof props.component === 'function') {
33
+ return props.component(...props.params);
34
+ }
35
+ return props.component;
21
36
  });
22
37
  </script>