quasar-ui-danx 0.3.28 → 0.3.30

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.3.28",
3
+ "version": "0.3.30",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -69,74 +69,74 @@ import { ContentDrawer } from "../../../Utility";
69
69
 
70
70
  const emit = defineEmits(["update:modelValue"]);
71
71
  const props = defineProps({
72
- modelValue: {
73
- type: [Object, String, Array, null],
74
- required: true
75
- },
76
- options: {
77
- type: Array,
78
- default: () => []
79
- },
80
- multiple: Boolean,
81
- label: {
82
- type: String,
83
- default: "Select"
84
- },
85
- placeholder: {
86
- type: String,
87
- default: "All"
88
- }
72
+ modelValue: {
73
+ type: [Object, String, Array, null],
74
+ required: true
75
+ },
76
+ options: {
77
+ type: Array,
78
+ default: () => []
79
+ },
80
+ multiple: Boolean,
81
+ label: {
82
+ type: String,
83
+ default: "Select"
84
+ },
85
+ placeholder: {
86
+ type: String,
87
+ default: "All"
88
+ }
89
89
  });
90
90
 
91
91
  const showDrawer = ref(false);
92
92
  const formattedOptions = computed(() =>
93
- props.options.map((opt) =>
94
- typeof opt === "string"
95
- ? {
96
- label: opt,
97
- value: opt
98
- }
99
- : opt
100
- )
93
+ props.options.map((opt) =>
94
+ typeof opt === "string"
95
+ ? {
96
+ label: opt,
97
+ value: opt
98
+ }
99
+ : opt
100
+ )
101
101
  );
102
102
 
103
103
  function getOptionValue(option) {
104
- return option.value === undefined ? option : option.value;
104
+ return option.value === undefined ? option : option.value;
105
105
  }
106
106
 
107
107
  function getOptionLabel(value) {
108
- return formattedOptions.value.find((opt) => opt.value === value).label;
108
+ return formattedOptions.value.find((opt) => opt.value === value)?.label;
109
109
  }
110
110
 
111
111
  function isSelected(option) {
112
- const optionValue = getOptionValue(option);
112
+ const optionValue = getOptionValue(option);
113
113
 
114
- if (props.multiple) {
115
- return props.modelValue.includes(optionValue);
116
- } else {
117
- return props.modelValue === optionValue;
118
- }
114
+ if (props.multiple) {
115
+ return props.modelValue.includes(optionValue);
116
+ } else {
117
+ return props.modelValue === optionValue;
118
+ }
119
119
  }
120
120
 
121
121
  function toggleSelect(option) {
122
- let optionValue = getOptionValue(option);
122
+ let optionValue = getOptionValue(option);
123
123
 
124
- let selection = optionValue;
124
+ let selection = optionValue;
125
125
 
126
- if (props.multiple) {
127
- selection = [...props.modelValue];
128
- if (isSelected(optionValue)) {
129
- selection = selection.filter((opt) => opt !== optionValue);
130
- } else {
131
- selection.push(optionValue);
132
- }
133
- } else {
134
- // Allow deselection on single select
135
- if (selection === props.modelValue) {
136
- selection = null;
137
- }
138
- }
126
+ if (props.multiple) {
127
+ selection = [...props.modelValue];
128
+ if (isSelected(optionValue)) {
129
+ selection = selection.filter((opt) => opt !== optionValue);
130
+ } else {
131
+ selection.push(optionValue);
132
+ }
133
+ } else {
134
+ // Allow deselection on single select
135
+ if (selection === props.modelValue) {
136
+ selection = null;
137
+ }
138
+ }
139
139
 
140
- emit("update:modelValue", selection);
140
+ emit("update:modelValue", selection);
141
141
  }
142
142
  </script>
@@ -12,6 +12,7 @@
12
12
  :input-class="inputClass"
13
13
  :class="parentClass"
14
14
  stack-label
15
+ :rows="rows"
15
16
  :type="type"
16
17
  :model-value="modelValue"
17
18
  :debounce="debounce"
@@ -42,41 +43,45 @@ import LabelValueBlock from "./LabelValueBlock";
42
43
 
43
44
  defineEmits(["update:model-value", "submit"]);
44
45
  defineProps({
45
- modelValue: {
46
- type: [String, Number],
47
- default: ""
48
- },
49
- field: {
50
- type: Object,
51
- default: null
52
- },
53
- type: {
54
- type: String,
55
- default: "text"
56
- },
57
- label: {
58
- type: String,
59
- default: null
60
- },
61
- labelClass: {
62
- type: String,
63
- default: "text-sm text-gray-700"
64
- },
65
- parentClass: {
66
- type: String,
67
- default: ""
68
- },
69
- inputClass: {
70
- type: String,
71
- default: ""
72
- },
73
- noLabel: Boolean,
74
- showName: Boolean,
75
- disabled: Boolean,
76
- readonly: Boolean,
77
- debounce: {
78
- type: [String, Number],
79
- default: 0
80
- }
46
+ modelValue: {
47
+ type: [String, Number],
48
+ default: ""
49
+ },
50
+ field: {
51
+ type: Object,
52
+ default: null
53
+ },
54
+ type: {
55
+ type: String,
56
+ default: "text"
57
+ },
58
+ label: {
59
+ type: String,
60
+ default: null
61
+ },
62
+ labelClass: {
63
+ type: String,
64
+ default: "text-sm text-gray-700"
65
+ },
66
+ parentClass: {
67
+ type: String,
68
+ default: ""
69
+ },
70
+ inputClass: {
71
+ type: String,
72
+ default: ""
73
+ },
74
+ rows: {
75
+ type: Number,
76
+ default: 3
77
+ },
78
+ noLabel: Boolean,
79
+ showName: Boolean,
80
+ disabled: Boolean,
81
+ readonly: Boolean,
82
+ debounce: {
83
+ type: [String, Number],
84
+ default: 0
85
+ }
81
86
  });
82
87
  </script>