@hostlink/nuxt-light 1.27.5 → 1.27.7
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 +1 -1
- package/dist/runtime/components/l-bar.vue +5 -8
- package/dist/runtime/components/l-btn.vue +43 -0
- package/dist/runtime/components/l-checkbox.vue +9 -0
- package/dist/runtime/components/l-select.vue +22 -29
- package/dist/runtime/components/l-table.vue +2 -1
- package/package.json +1 -1
- package/dist/runtime/components/l-btn.d.ts +0 -7
- package/dist/runtime/components/l-btn.js +0 -44
- package/dist/runtime/components/l-btn.vue.bak +0 -46
- package/dist/runtime/components/l-checkbox.d.ts +0 -12
- package/dist/runtime/components/l-checkbox.js +0 -23
package/dist/module.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useLight } from '#imports';
|
|
3
3
|
import { QBar } from 'quasar';
|
|
4
4
|
import type { QBarProps } from 'quasar';
|
|
5
|
-
import {
|
|
5
|
+
import { computed } from 'vue';
|
|
6
6
|
export interface LBarProps extends QBarProps {
|
|
7
7
|
color?: string;
|
|
8
8
|
textColor?: string;
|
|
@@ -10,7 +10,7 @@ export interface LBarProps extends QBarProps {
|
|
|
10
10
|
|
|
11
11
|
const props = withDefaults(defineProps<LBarProps>(), {
|
|
12
12
|
color: undefined,
|
|
13
|
-
textColor: "white"
|
|
13
|
+
textColor: "white",
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const light = useLight();
|
|
@@ -20,12 +20,9 @@ const barClass = computed(() => {
|
|
|
20
20
|
c.push(`bg-${color}`);
|
|
21
21
|
return c;
|
|
22
22
|
});
|
|
23
|
-
|
|
24
|
-
const root = h(QBar, {
|
|
25
|
-
...props,
|
|
26
|
-
}, useSlots()) as any;
|
|
27
23
|
</script>
|
|
28
|
-
|
|
29
24
|
<template>
|
|
30
|
-
<
|
|
25
|
+
<q-bar :class="barClass">
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</q-bar>
|
|
31
28
|
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useQuasar, QBtn } from "quasar";
|
|
3
|
+
import type { QBtnProps } from "quasar";
|
|
4
|
+
|
|
5
|
+
export interface LBtnProps extends QBtnProps {
|
|
6
|
+
permission?: string;
|
|
7
|
+
confirmMessage?: string;
|
|
8
|
+
confirmTitle?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<LBtnProps>(), {
|
|
12
|
+
permission: "",
|
|
13
|
+
confirmMessage: "",
|
|
14
|
+
confirmTitle: "Confirm",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const $q = useQuasar();
|
|
18
|
+
|
|
19
|
+
//filter out the onClick from the props
|
|
20
|
+
const { onClick, ...filteredProps } = props;
|
|
21
|
+
|
|
22
|
+
const handleClick = function () {
|
|
23
|
+
const args = arguments;
|
|
24
|
+
if (props.confirmMessage) {
|
|
25
|
+
$q.dialog({
|
|
26
|
+
title: props.confirmTitle,
|
|
27
|
+
message: props.confirmMessage,
|
|
28
|
+
ok: "Yes",
|
|
29
|
+
cancel: "No",
|
|
30
|
+
}).onOk(() => {
|
|
31
|
+
onClick?.apply(null, args as any);
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
onClick?.apply(null, args as any);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
<template>
|
|
39
|
+
<q-btn v-if="$light.isGranted($props.permission)" @click="handleClick"
|
|
40
|
+
v-bind="$light.getButtonProps(filteredProps)">
|
|
41
|
+
<slot></slot>
|
|
42
|
+
</q-btn>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type QCheckboxProps } from "quasar"
|
|
3
|
+
defineProps<QCheckboxProps>()
|
|
4
|
+
</script>
|
|
5
|
+
<template>
|
|
6
|
+
<q-checkbox v-bind="$props" :color="color || $light.color" :label="label ? $t(label) : undefined">
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</q-checkbox>
|
|
9
|
+
</template>
|
|
@@ -1,37 +1,31 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
console.log(QSelect);
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import type { QSelectProps } from "quasar";
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
stackLabel: { type: Boolean, default: undefined },
|
|
21
|
-
optionLabel: { type: [String, Function], default: 'label' },
|
|
22
|
-
optionValue: { type: String, default: 'value' },
|
|
23
|
-
inputDebounce: { type: [Number, String], default: 0 },
|
|
5
|
+
const props = withDefaults(defineProps<QSelectProps>(), {
|
|
6
|
+
emitValue: true,
|
|
7
|
+
mapOptions: true,
|
|
8
|
+
hideBottomSpace: true,
|
|
9
|
+
filled: undefined,
|
|
10
|
+
outlined: undefined,
|
|
11
|
+
standout: undefined,
|
|
12
|
+
rounded: undefined,
|
|
13
|
+
dense: undefined,
|
|
14
|
+
square: undefined,
|
|
15
|
+
stackLabel: undefined,
|
|
16
|
+
optionLabel: 'label',
|
|
17
|
+
optionValue: 'value',
|
|
18
|
+
inputDebounce: 0,
|
|
24
19
|
})
|
|
25
20
|
|
|
26
|
-
|
|
27
21
|
// 將 normalizeOptions 拆分為更小的函數
|
|
28
|
-
const normalizeOption = (option
|
|
22
|
+
const normalizeOption = (option: any) => {
|
|
29
23
|
if (typeof option === 'string' || typeof option === 'number') {
|
|
30
24
|
return { label: String(option), value: String(option) };
|
|
31
25
|
}
|
|
32
26
|
if (typeof option === 'object') {
|
|
33
27
|
if ('group' in option) {
|
|
34
|
-
option.options = normalizeOptions(option.options || []
|
|
28
|
+
option.options = normalizeOptions(option.options || []);
|
|
35
29
|
return option;
|
|
36
30
|
} else if ('value' in option && typeof option.value !== 'string') {
|
|
37
31
|
Object.assign(option, { value: option.value });
|
|
@@ -40,9 +34,9 @@ const normalizeOption = (option, i) => {
|
|
|
40
34
|
return option;
|
|
41
35
|
};
|
|
42
36
|
|
|
43
|
-
const normalizeOptions = (options
|
|
37
|
+
const normalizeOptions = (options: any) => {
|
|
44
38
|
if (Array.isArray(options)) {
|
|
45
|
-
return options.map(option => normalizeOption(option
|
|
39
|
+
return options.map(option => normalizeOption(option));
|
|
46
40
|
}
|
|
47
41
|
return Object.keys(options).map(value => ({
|
|
48
42
|
label: options[value],
|
|
@@ -79,6 +73,5 @@ const filterFn = (val, update, abort) => {
|
|
|
79
73
|
|
|
80
74
|
</script>
|
|
81
75
|
<template>
|
|
82
|
-
<q-select v-bind="$light.getInputProps($props)" :options="select_options" @filter="filterFn"
|
|
83
|
-
:model-value="modelValue" @update:model-value="$emit('update:modelValue', $event)" />
|
|
76
|
+
<q-select v-bind="$light.getInputProps($props)" :options="select_options" @filter="filterFn" />
|
|
84
77
|
</template>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useQuasar, QTable,
|
|
2
|
+
import { useQuasar, QTable, Dialog } from 'quasar';
|
|
3
|
+
import type { QTableColumn, QTableProps } from 'quasar';
|
|
3
4
|
|
|
4
5
|
import { ref, computed, onMounted, useSlots, watch, } from "vue";
|
|
5
6
|
import { useLight, GQLFieldBuilder, model } from '../';
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { h } from "vue";
|
|
2
|
-
import { useQuasar, QBtn } from "quasar";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: "LBtn",
|
|
6
|
-
inheritAttrs:false,
|
|
7
|
-
props: {
|
|
8
|
-
...QBtn.props,
|
|
9
|
-
permission: { type: String, default: "" },
|
|
10
|
-
confirmTitle: { type: String, default: "Confirm" },
|
|
11
|
-
confirmMessage: { type: String, default: undefined },
|
|
12
|
-
},
|
|
13
|
-
render() {
|
|
14
|
-
const $q = useQuasar();
|
|
15
|
-
|
|
16
|
-
// 從 $attrs 中提取 onClick,並過濾掉它
|
|
17
|
-
const { onClick, ...filteredAttrs } = this.$attrs;
|
|
18
|
-
|
|
19
|
-
const handleClick = (...args) => {
|
|
20
|
-
if (this.$props.confirmMessage) {
|
|
21
|
-
$q.dialog({
|
|
22
|
-
color: this.$props.color || "primary",
|
|
23
|
-
title: this.$props.confirmTitle,
|
|
24
|
-
message: this.$props.confirmMessage,
|
|
25
|
-
ok: "Yes",
|
|
26
|
-
cancel: "No",
|
|
27
|
-
}).onOk(() => {
|
|
28
|
-
onClick?.(...args); // 執行傳入的 onClick
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
onClick?.(...args); // 直接執行傳入的 onClick
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const root = h(QBtn, {
|
|
36
|
-
...this.$props, // 傳遞 props
|
|
37
|
-
...this.$light.getButtonProps(this.$props), // 傳遞按鈕屬性
|
|
38
|
-
...filteredAttrs, // 傳遞過濾後的 attrs
|
|
39
|
-
onClick: handleClick, // 明確綁定 handleClick
|
|
40
|
-
}, this.$slots);
|
|
41
|
-
|
|
42
|
-
return this.$light.isGranted(this.$props.permission) ? root : null;
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { h, useSlots } from "vue";
|
|
3
|
-
import { useQuasar, QBtn } from "quasar";
|
|
4
|
-
import { useLight } from "#imports";
|
|
5
|
-
import type { QBtnProps } from "quasar";
|
|
6
|
-
|
|
7
|
-
export interface LBtnProps extends QBtnProps {
|
|
8
|
-
permission?: string;
|
|
9
|
-
confirmMessage?: string;
|
|
10
|
-
confirmTitle?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const props = withDefaults(defineProps<LBtnProps>(), {
|
|
14
|
-
permission: "",
|
|
15
|
-
confirmMessage: "",
|
|
16
|
-
confirmTitle: "Confirm",
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const $light = useLight();
|
|
20
|
-
const $q = useQuasar();
|
|
21
|
-
const slots = useSlots() as ReturnType<typeof useSlots>;
|
|
22
|
-
|
|
23
|
-
const root = h(QBtn, {
|
|
24
|
-
...props,
|
|
25
|
-
...$light.getButtonProps(props),
|
|
26
|
-
onClick: function () {
|
|
27
|
-
const args = arguments;
|
|
28
|
-
if (props.confirmMessage) {
|
|
29
|
-
$q.dialog({
|
|
30
|
-
title: props.confirmTitle,
|
|
31
|
-
message: props.confirmMessage,
|
|
32
|
-
ok: "Yes",
|
|
33
|
-
cancel: "No",
|
|
34
|
-
}).onOk(() => {
|
|
35
|
-
props.onClick?.apply(null, args as any);
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
props.onClick?.apply(null, args as any);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
}, slots);
|
|
42
|
-
|
|
43
|
-
</script>
|
|
44
|
-
<template>
|
|
45
|
-
<component :is="root" v-if="$light.isGranted($props.permission)"/>
|
|
46
|
-
</template>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
let name: string;
|
|
3
|
-
let props: any;
|
|
4
|
-
let emits: any;
|
|
5
|
-
function setup(props: any, { slots, emit }: {
|
|
6
|
-
slots: any;
|
|
7
|
-
emit: any;
|
|
8
|
-
}): () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}>;
|
|
11
|
-
}
|
|
12
|
-
export default _default;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { QCheckbox } from "quasar";
|
|
2
|
-
import { h } from "vue";
|
|
3
|
-
import { useLight } from "#imports";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
name: "LCheckbox",
|
|
9
|
-
props: QCheckbox.props,
|
|
10
|
-
emits: QCheckbox.emits,
|
|
11
|
-
setup(props, { slots, emit }) {
|
|
12
|
-
return () => {
|
|
13
|
-
const $light = useLight();
|
|
14
|
-
const $t = useI18n().t;
|
|
15
|
-
return h(QCheckbox, {
|
|
16
|
-
...props,
|
|
17
|
-
color: props.color || $light.color,
|
|
18
|
-
label: props.label ? $t(props.label) : null,
|
|
19
|
-
'onUpdate:modelValue': emit.bind(this, 'update:modelValue'),
|
|
20
|
-
}, slots);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|