@hostlink/nuxt-light 1.1.2 → 1.1.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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.1.2"
4
+ "version": "1.1.4"
5
5
  }
@@ -188,6 +188,19 @@ const containerStyle = computed(() => {
188
188
  }
189
189
  })
190
190
 
191
+ const fullscreen = ref(document.fullscreenElement)
192
+
193
+ const onFullscreen = () => {
194
+ if (document.fullscreenElement) {
195
+ document.exitFullscreen();
196
+ fullscreen.value = false;
197
+ } else {
198
+ fullscreen.value = true;
199
+
200
+ document.documentElement.requestFullscreen();
201
+ }
202
+ }
203
+
191
204
  </script>
192
205
 
193
206
  <template>
@@ -205,6 +218,11 @@ const containerStyle = computed(() => {
205
218
 
206
219
  <q-space />
207
220
 
221
+ <q-btn :icon="fullscreen ? 'fullscreen_exit' : 'fullscreen'" round flat dense class="q-mr-sm"
222
+ @click="onFullscreen">
223
+
224
+ </q-btn>
225
+
208
226
  <q-btn v-if="languages.length > 1" rounded flat icon="language" :label="my.language" class="q-mr-sm">
209
227
  <q-menu>
210
228
  <q-list>
@@ -7,7 +7,14 @@ import { useI18n } from 'vue-i18n';
7
7
 
8
8
  const { t } = useI18n();
9
9
 
10
- export interface LDatePickerProps extends QDateProps {
10
+ interface DateRange {
11
+ from: string,
12
+ to: string
13
+ }
14
+
15
+
16
+ export interface LDatePickerProps {
17
+ modelValue?: string | DateRange
11
18
  label?: string
12
19
  required?: boolean
13
20
  hideBottomSpace?: boolean
@@ -18,7 +25,9 @@ export interface LDatePickerProps extends QDateProps {
18
25
  dense?: boolean
19
26
  square?: boolean
20
27
  stackLabel?: boolean
21
- rules?: any[]
28
+ rules?: any[],
29
+ range?: boolean,
30
+ mask?: string
22
31
  }
23
32
 
24
33
  const props = withDefaults(defineProps<LDatePickerProps>(), {
@@ -33,27 +42,66 @@ const props = withDefaults(defineProps<LDatePickerProps>(), {
33
42
  mask: "YYYY-MM-DD",
34
43
  })
35
44
 
45
+
36
46
  const light = useLight();
37
47
 
38
- const emit = defineEmits(["update:modelValue"]);
39
- const popup = ref(null);
48
+ const emit = defineEmits<{
49
+ (e: 'update:modelValue', value?: string | object): void
50
+ }>();
51
+
52
+ const popup = ref<any>(null);
40
53
  const localValue = computed({
41
54
  get: () => {
42
- if (props.range) {
43
- if (props.modelValue) {
55
+ //if is object
56
+ if (props.modelValue) {
57
+ if (typeof props.modelValue == "object") {
44
58
  return props.modelValue.from + " - " + props.modelValue.to
45
59
  }
46
60
  }
61
+
47
62
  return props.modelValue
48
63
  },
49
64
  set: (value) => {
50
- if (popup.value) {
51
- popup.value.hide();
65
+ if (value == null) {
66
+ emit('update:modelValue', value)
67
+ return;
68
+ }
69
+
70
+ //is object
71
+ if (typeof value == "object") {
72
+ emit('update:modelValue', value)
73
+ return;
74
+ }
75
+
76
+ if (props.range) {
77
+
78
+ //try to split
79
+ const parts = value.split(" - ");
80
+ if (parts.length == 2) {
81
+ const from = parts[0];
82
+ const to = parts[1];
83
+ if (from.match(/^\d{4}-\d{2}-\d{2}$/) && to.match(/^\d{4}-\d{2}-\d{2}$/)) {
84
+ emit('update:modelValue', { from, to })
85
+ return;
86
+ }
87
+ }
52
88
  }
53
89
 
54
90
  emit('update:modelValue', value)
55
91
  }
92
+ });
56
93
 
94
+ const dateValue = computed({
95
+ get: () => {
96
+ return props.modelValue
97
+ },
98
+ set: (value) => {
99
+ if (popup.value) {
100
+ popup.value.hide();
101
+ }
102
+ (localValue as any).value = value;
103
+ emit('update:modelValue', value)
104
+ }
57
105
  });
58
106
 
59
107
  const rules: any = [];
@@ -78,25 +126,22 @@ if (!props.range) {
78
126
  }
79
127
 
80
128
  const input_attrs = computed(() => {
81
- const attrs: any = {
82
- label: props.label,
83
- rules: rules,
84
- hideBottomSpace: props.hideBottomSpace,
85
- mask: props.range ? "####-##-## - ####-##-##" : "####-##-##"
86
- }
87
-
88
- if (props.filled == undefined) attrs.filled = light.getStyle("inputFilled");
89
- if (props.outlined == undefined) attrs.outlined = light.getStyle("inputOutlined");
90
- if (props.standout == undefined) attrs.standout = light.getStyle("inputStandout");
91
- if (props.rounded == undefined) attrs.rounded = light.getStyle("inputRounded");
92
- if (props.dense == undefined) attrs.dense = light.getStyle("inputDense");
93
- if (props.square == undefined) attrs.square = light.getStyle("inputSquare");
94
- if (props.stackLabel == undefined) attrs.stackLabel = light.getStyle("inputStackLabel");
129
+ let a = { ...props }
130
+ a.rules = rules;
131
+ a.mask = props.range ? "####-##-## - ####-##-##" : "####-##-##"
132
+
133
+ if (props.filled == undefined) a.filled = light.getStyle("inputFilled");
134
+ if (props.outlined == undefined) a.outlined = light.getStyle("inputOutlined");
135
+ if (props.standout == undefined) a.standout = light.getStyle("inputStandout");
136
+ if (props.rounded == undefined) a.rounded = light.getStyle("inputRounded");
137
+ if (props.dense == undefined) a.dense = light.getStyle("inputDense");
138
+ if (props.square == undefined) a.square = light.getStyle("inputSquare");
139
+ if (props.stackLabel == undefined) a.stackLabel = light.getStyle("inputStackLabel");
95
140
 
96
141
  if (props.label) {
97
- attrs.label = t(props.label);
142
+ a.label = t(props.label);
98
143
  }
99
- return attrs;
144
+ return a;
100
145
  })
101
146
 
102
147
  const date_attrs = computed(() => {
@@ -111,7 +156,7 @@ const date_attrs = computed(() => {
111
156
  <template v-slot:prepend>
112
157
  <q-btn icon="sym_o_event" round dense flat>
113
158
  <q-popup-proxy cover transition-show="scale" transition-hide="scale" ref="popup">
114
- <q-date v-bind="date_attrs" v-model="localValue">
159
+ <q-date v-bind="date_attrs" v-model="dateValue">
115
160
  <div class="row items-center justify-end">
116
161
  <q-btn v-close-popup label="Close" color="primary" flat />
117
162
  </div>
@@ -4,8 +4,30 @@ import { type QEditorProps, useQuasar } from "quasar"
4
4
 
5
5
  const $q = useQuasar();
6
6
 
7
+ const editorRef = ref(null)
8
+ const textColorRef = ref(null)
9
+ const textHightlightRef = ref(null)
10
+
11
+ const highlight = ref('#ffff00aa')
12
+ const foreColor = ref('#000000')
13
+
14
+ const TextColorCMD = ((cmd, name) => {
15
+ const edit = editorRef.value
16
+ textColorRef.value.hide()
17
+ edit.caret.restore()
18
+ edit.runCmd(cmd, name)
19
+ edit.focus()
20
+ })
21
+
22
+ const TextHightlightCMD = ((cmd, name) => {
23
+ const edit = editorRef.value
24
+ textHightlightRef.value.hide()
25
+ edit.caret.restore()
26
+ edit.runCmd(cmd, name)
27
+ edit.focus()
28
+ })
29
+
7
30
  export interface LEditorProps extends QEditorProps {
8
-
9
31
  }
10
32
 
11
33
  const emit = defineEmits(["update:modelValue"]);
@@ -48,8 +70,9 @@ const newToolBar = [
48
70
  }
49
71
  ],
50
72
  ['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'],
51
- ['token', 'hr', 'link', 'custom_btn'],
52
- ['print', 'fullscreen'],
73
+ ['token', 'hr', 'link'],
74
+ //['print'],
75
+ ['fullscreen'],
53
76
  [
54
77
  {
55
78
  label: $q.lang.editor.formatting,
@@ -99,6 +122,9 @@ const newToolBar = [
99
122
  'verdana'
100
123
  ]
101
124
  },
125
+ 'textColor',
126
+ 'textHightlight',
127
+ 'custom_btn',
102
128
  'removeFormat'
103
129
  ],
104
130
  ['quote', 'unordered', 'ordered', 'outdent', 'indent'],
@@ -121,5 +147,66 @@ const newFonts = {
121
147
  </script>
122
148
 
123
149
  <template>
124
- <q-editor v-model="localValue" v-bind="attrs" />
150
+ <q-editor v-model="localValue" ref="editorRef" v-bind="attrs">
151
+ <template v-slot:textColor>
152
+ <q-btn-dropdown dense no-caps ref="textColorRef" no-wrap unelevated color="white" text-color="default"
153
+ label="Text Color" icon="sym_o_format_color_text" size="sm">
154
+ <q-item tag="label" clickable @click="TextColorCMD('foreColor', foreColor)">
155
+ <q-item-section side>
156
+ <q-icon name="sym_o_format_color_text" />
157
+ </q-item-section>
158
+ <q-item-section>
159
+ <q-color v-model="foreColor" no-header no-footer style="max-width: 250px;" />
160
+ <!-- :palette="[
161
+ '#ff0000',
162
+ '#ff8000',
163
+ '#ffff00',
164
+ '#00ff00',
165
+ '#00ff80',
166
+ '#00ffff',
167
+ '#0080ff',
168
+ '#0000ff',
169
+ '#8000ff',
170
+ '#ff00ff'
171
+ ]" -->
172
+ </q-item-section>
173
+ </q-item>
174
+ </q-btn-dropdown>
175
+ </template>
176
+ <template v-slot:textHightlight>
177
+ <q-btn-dropdown dense no-caps ref="textHightlightRef" no-wrap unelevated color="white" text-color="default"
178
+ label="Highlight" icon="sym_o_format_ink_highlighter" size="sm">
179
+
180
+ <q-item tag="label" clickable @click="TextHightlightCMD('backColor', highlight)">
181
+ <q-item-section side>
182
+ <q-icon name="sym_o_format_ink_highlighter" />
183
+ </q-item-section>
184
+ <q-item-section>
185
+ <q-color v-model="highlight" no-header no-footer default-view="palette" :palette="[
186
+ '#ffccccaa',
187
+ '#ffe6ccaa',
188
+ '#ffffccaa',
189
+ '#ccffccaa',
190
+ '#ccffe6aa',
191
+ '#ccffffaa',
192
+ '#cce6ffaa',
193
+ '#ccccffaa',
194
+ '#e6ccffaa',
195
+ '#ffccffaa',
196
+ '#ff0000aa',
197
+ '#ff8000aa',
198
+ '#ffff00aa',
199
+ '#00ff00aa',
200
+ '#00ff80aa',
201
+ '#00ffffaa',
202
+ '#0080ffaa',
203
+ '#0000ffaa',
204
+ '#8000ffaa',
205
+ '#ff00ffaa'
206
+ ]" style="max-width: 250px;" />
207
+ </q-item-section>
208
+ </q-item>
209
+ </q-btn-dropdown>
210
+ </template>
211
+ </q-editor>
125
212
  </template>
@@ -0,0 +1,40 @@
1
+ <script setup lang="ts">
2
+ import { computed } from "vue"
3
+
4
+ export interface LSmallBoxProps {
5
+ title: string;
6
+ subtitle: string;
7
+ icon: string;
8
+ color: 'red' | 'pink' | 'purple' | 'deep-purple' | 'indigo' | 'blue' | 'light-blue' | 'cyan' | 'teal' | 'green' | 'light-green' | 'lime' | 'yellow' | 'amber' | 'orange' | 'deep-orange' | 'brown' | 'grey' | 'blue-grey'
9
+ }
10
+
11
+ const props = withDefaults(defineProps<LSmallBoxProps>(), {
12
+ title: '',
13
+ subtitle: '',
14
+ icon: 'local_offer',
15
+ color: 'indigo'
16
+ });
17
+
18
+ const item_class = computed(() => {
19
+ return ["bg-" + props.color + "-4"]
20
+
21
+ })
22
+
23
+ const section_class = computed(() => {
24
+ return ["text-white", "bg-" + props.color]
25
+ })
26
+
27
+
28
+ </script>
29
+
30
+ <template>
31
+ <q-item :class="item_class" class="no-wrap q-pa-none text-white">
32
+ <q-item-section class="q-pa-lg q-mr-none text-white" :class="section_class" side>
33
+ <q-icon :name="icon" size="2rem" />
34
+ </q-item-section>
35
+ <q-item-section class="q-pa-md q-ml-none">
36
+ <q-item-label class="text-h6 text-white">{{ title }}</q-item-label>
37
+ <q-item-label caption class="text-white">{{ subtitle }}</q-item-label>
38
+ </q-item-section>
39
+ </q-item>
40
+ </template>
@@ -375,6 +375,8 @@ const getFilterValue = () => {
375
375
 
376
376
 
377
377
  const onFilters = () => {
378
+ console.log("onFilters",filters.value)
379
+
378
380
  //clone the filters
379
381
  onRequest({
380
382
  pagination: {
@@ -611,6 +613,7 @@ const localSelected = computed({
611
613
 
612
614
  </template>
613
615
 
616
+
614
617
  <template v-if="col.searchType == 'date'">
615
618
  <l-date-picker dense clearable filled square :outlined="false" hide-bottom-space
616
619
  v-model="filters[col.name]" @update:model-value="onFilters" range @clear="onFilters" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",