@simsustech/quasar-components 0.10.0 → 0.10.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @simsustech/quasar-components
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e15c306: feat: add type prop to QSubmitButton
8
+
9
+ ## 0.10.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 4ef557b: fix(ResourcePage): fix error on empty type
14
+
3
15
  ## 0.10.0
4
16
 
5
17
  ### Minor Changes
@@ -1,10 +1,11 @@
1
1
  import { useQuasar, debounce, QBtn } from "quasar";
2
- import { ref, defineComponent, useAttrs, watch, openBlock, createBlock, mergeProps, unref, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
2
+ import { ref, defineComponent, toRefs, useAttrs, watch, computed, openBlock, createBlock, mergeProps, unref, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
3
3
  const lang$1 = {
4
4
  isoName: "en-US",
5
5
  submit: "Submit",
6
6
  next: "Next",
7
- back: "Back"
7
+ back: "Back",
8
+ send: "Send"
8
9
  };
9
10
  const enUS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10
11
  __proto__: null,
@@ -14,7 +15,7 @@ var define_import_meta_env_default = { BASE_URL: "/", MODE: "production", DEV: f
14
15
  const lang = ref(lang$1);
15
16
  const locales = /* @__PURE__ */ Object.assign({
16
17
  "./en-US.ts": () => Promise.resolve().then(() => enUS),
17
- "./nl.ts": () => import("./nl-vB00g7s2.js")
18
+ "./nl.ts": () => import("./nl-CLymTRkb.js")
18
19
  });
19
20
  const useLang = () => {
20
21
  return lang;
@@ -45,24 +46,16 @@ const __default__ = {
45
46
  const _sfc_main = /* @__PURE__ */ defineComponent({
46
47
  ...__default__,
47
48
  props: {
48
- loading: {
49
- type: Boolean,
50
- default: void 0
51
- },
52
- useForm: {
53
- type: Boolean
54
- },
55
- isNextButton: {
56
- type: Boolean
57
- },
58
- color: {
59
- type: String,
60
- default: "primary"
61
- }
49
+ loading: { type: Boolean },
50
+ useForm: { type: Boolean },
51
+ type: { default: "submit" },
52
+ isNextButton: { type: Boolean },
53
+ color: { default: "primary" }
62
54
  },
63
55
  emits: ["submit"],
64
56
  setup(__props, { emit: __emit }) {
65
57
  const props = __props;
58
+ const { type, isNextButton } = toRefs(props);
66
59
  const attrs = useAttrs();
67
60
  const emit = __emit;
68
61
  const $q = useQuasar();
@@ -87,17 +80,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
87
80
  1e3,
88
81
  true
89
82
  );
83
+ const label = computed(() => {
84
+ const labels = {
85
+ submit: lang2.value.submit,
86
+ send: lang2.value.send,
87
+ next: lang2.value.next
88
+ };
89
+ return isNextButton.value ? lang2.value.next : labels[type.value];
90
+ });
90
91
  return (_ctx, _cache) => {
91
92
  const _component_q_btn = QBtn;
92
93
  return openBlock(), createBlock(_component_q_btn, mergeProps(unref(attrs), {
93
- color: __props.color,
94
- loading: __props.loading || unref(loadingInternal),
94
+ color: _ctx.color,
95
+ loading: _ctx.loading || unref(loadingInternal),
95
96
  type: "submit",
96
97
  onClick: unref(submit)
97
98
  }), {
98
99
  default: withCtx(() => [
99
100
  renderSlot(_ctx.$slots, "default", {}, () => [
100
- createTextVNode(toDisplayString(__props.isNextButton ? unref(lang2).next : unref(lang2).submit), 1)
101
+ createTextVNode(toDisplayString(label.value), 1)
101
102
  ])
102
103
  ]),
103
104
  _: 3
@@ -1,6 +1,6 @@
1
1
  import { useQuasar, QForm, QInput, QStep, QStepperNavigation, QStepper, QIcon, QBtn, QSlider, QItemSection, QItem, QList, QMenu, QTable, QTh, QTr, QSelect, QTd, QItemLabel } from "quasar";
2
2
  import { ref, defineComponent, watch, computed, openBlock, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, toRef, createCommentVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, toRefs, createElementVNode } from "vue";
3
- import { _ as _sfc_main$d } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-DAnZaTMl.js";
3
+ import { _ as _sfc_main$d } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-Dh9w-oNX.js";
4
4
  const lang$1 = {
5
5
  isoName: "en-US",
6
6
  myAccount: "Account",
package/dist/general.js CHANGED
@@ -1,6 +1,6 @@
1
- import { l as loadLang, u as useLang, _ as _sfc_main$5 } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-DAnZaTMl.js";
1
+ import { l as loadLang, u as useLang, _ as _sfc_main$5 } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-Dh9w-oNX.js";
2
2
  import { useQuasar, QCard, QCardSection, QCardActions, QDialog, QBtn, QToolbarTitle, QToolbar, QHeader, QPage, QPageContainer, QLayout, QPageSticky, QSelect, QItemSection, QItemLabel, QItem, QList } from "quasar";
3
- import { defineComponent, watch, ref, openBlock, createBlock, unref, withCtx, renderSlot, createVNode, createElementVNode, normalizeProps, guardReactiveProps, normalizeClass, createCommentVNode, useSlots, toRefs, useAttrs, computed, mergeProps, createTextVNode, toDisplayString } from "vue";
3
+ import { defineComponent, watch, ref, openBlock, createBlock, unref, withCtx, renderSlot, createVNode, createElementVNode, normalizeProps, guardReactiveProps, normalizeClass, createCommentVNode, toRefs, useAttrs, computed, mergeProps, createTextVNode, toDisplayString } from "vue";
4
4
  import { e as enUs, n as nl } from "./en-US-BEeILC7o.js";
5
5
  const _hoisted_1$1 = { class: "text-h6" };
6
6
  const _hoisted_2 = { class: "text-subtitle2" };
@@ -84,7 +84,8 @@ const __default__$1 = {
84
84
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
85
85
  ...__default__$1,
86
86
  props: {
87
- display: { type: Boolean }
87
+ display: { type: Boolean },
88
+ buttonType: {}
88
89
  },
89
90
  emits: ["submit"],
90
91
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -172,8 +173,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
172
173
  !_ctx.display ? (openBlock(), createBlock(_sfc_main$5, {
173
174
  key: 0,
174
175
  color: "accent",
176
+ type: _ctx.buttonType,
175
177
  onSubmit: submit
176
- })) : createCommentVNode("", true)
178
+ }, null, 8, ["type"])) : createCommentVNode("", true)
177
179
  ]),
178
180
  _: 3
179
181
  })
@@ -211,8 +213,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
211
213
  disabled: { type: Boolean }
212
214
  },
213
215
  emits: ["create", "update"],
214
- setup(__props, { expose: __expose, emit: __emit }) {
215
- const slots = useSlots();
216
+ setup(__props, { emit: __emit }) {
216
217
  const props = __props;
217
218
  const emit = __emit;
218
219
  const $q = useQuasar();
@@ -223,23 +224,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
223
224
  loadLang($q.lang.isoName);
224
225
  });
225
226
  const { type, disabled } = toRefs(props);
226
- if (!type.value && !slots.fab)
227
- type.value = "create";
228
227
  const done = () => "";
229
- const create = (evt) => disabled.value ? () => {
230
- } : emit("create", { done });
231
- const update = (evt) => disabled.value ? () => {
232
- } : emit("update", { done });
233
- const variables = ref({
234
- // header: lang.value.some.nested.prop
235
- });
236
- const functions = ref({
237
- // submit
238
- });
239
- __expose({
240
- variables,
241
- functions
242
- });
228
+ const create = (evt) => emit("create", { done });
229
+ const update = (evt) => emit("update", { done });
243
230
  return (_ctx, _cache) => {
244
231
  const _component_q_btn = QBtn;
245
232
  const _component_q_toolbar_title = QToolbarTitle;
@@ -2,7 +2,8 @@ const lang = {
2
2
  isoName: "nl",
3
3
  submit: "Opslaan",
4
4
  next: "Volgende",
5
- back: "Vorige"
5
+ back: "Vorige",
6
+ send: "Versturen"
6
7
  };
7
8
  export {
8
9
  lang as default
@@ -1,60 +1,52 @@
1
1
  export interface Props {
2
2
  loading?: boolean;
3
3
  useForm?: boolean;
4
+ type?: 'submit' | 'send' | 'next';
4
5
  isNextButton?: boolean;
5
6
  color?: string;
6
7
  }
7
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
8
- loading: {
9
- type: BooleanConstructor;
10
- default: undefined;
11
- };
12
- useForm: {
13
- type: BooleanConstructor;
14
- };
15
- isNextButton: {
16
- type: BooleanConstructor;
17
- };
18
- color: {
19
- type: StringConstructor;
20
- default: string;
21
- };
22
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
9
+ type: string;
10
+ color: string;
11
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
12
  submit: (args_0: {
24
13
  value?: string | undefined;
25
14
  done: () => void;
26
15
  }) => void;
27
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
28
- loading: {
29
- type: BooleanConstructor;
30
- default: undefined;
31
- };
32
- useForm: {
33
- type: BooleanConstructor;
34
- };
35
- isNextButton: {
36
- type: BooleanConstructor;
37
- };
38
- color: {
39
- type: StringConstructor;
40
- default: string;
41
- };
42
- }>> & {
16
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
17
+ type: string;
18
+ color: string;
19
+ }>>> & {
43
20
  onSubmit?: ((args_0: {
44
21
  value?: string | undefined;
45
22
  done: () => void;
46
23
  }) => any) | undefined;
47
24
  }, {
25
+ type: "submit" | "next" | "send";
48
26
  color: string;
49
- loading: boolean;
50
- useForm: boolean;
51
- isNextButton: boolean;
52
27
  }, {}>, {
53
28
  default?(_: {}): any;
54
29
  }>;
55
30
  export default _default;
31
+ type __VLS_WithDefaults<P, D> = {
32
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
33
+ default: D[K];
34
+ }> : P[K];
35
+ };
36
+ type __VLS_Prettify<T> = {
37
+ [K in keyof T]: T[K];
38
+ } & {};
56
39
  type __VLS_WithTemplateSlots<T, S> = T & {
57
40
  new (): {
58
41
  $slots: S;
59
42
  };
60
43
  };
44
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
45
+ type __VLS_TypePropsToOption<T> = {
46
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
47
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
48
+ } : {
49
+ type: import('vue').PropType<T[K]>;
50
+ required: true;
51
+ };
52
+ };
@@ -2,10 +2,7 @@ export interface Props {
2
2
  type?: 'create' | 'update';
3
3
  disabled?: boolean;
4
4
  }
5
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {
6
- variables: import("vue").Ref<{}>;
7
- functions: import("vue").Ref<{}>;
8
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
6
  create: (args_0: {
10
7
  data?: unknown;
11
8
  done: (success?: boolean) => void;
@@ -1,5 +1,6 @@
1
1
  export interface Props {
2
2
  display?: boolean;
3
+ buttonType?: 'submit' | 'send';
3
4
  }
4
5
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {
5
6
  variables: import("vue").Ref<{}>;
@@ -3,6 +3,7 @@ export interface Language {
3
3
  submit: string;
4
4
  next: string;
5
5
  back: string;
6
+ send: string;
6
7
  }
7
8
  import type { Ref } from 'vue';
8
9
  export declare const lang: Ref<{
@@ -10,6 +11,7 @@ export declare const lang: Ref<{
10
11
  submit: string;
11
12
  next: string;
12
13
  back: string;
14
+ send: string;
13
15
  }>;
14
16
  export declare const defineLang: (lang: Language) => Language;
15
17
  export declare const useLang: () => Ref<Language>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simsustech/quasar-components",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "author": "Stefan van Herwijnen",
5
5
  "description": "High level components for Quasar Framework",
6
6
  "license": "MIT",
@@ -7,7 +7,7 @@
7
7
  @click="submit"
8
8
  >
9
9
  <slot>
10
- {{ isNextButton ? lang.next : lang.submit }}
10
+ {{ label }}
11
11
  </slot>
12
12
  </q-btn>
13
13
  </template>
@@ -20,31 +20,23 @@ export default {
20
20
  </script>
21
21
 
22
22
  <script setup lang="ts">
23
- import { ref, watch, useAttrs } from 'vue'
23
+ import { ref, watch, useAttrs, computed, toRefs } from 'vue'
24
24
  import { useQuasar, debounce } from 'quasar'
25
25
  import { useLang, loadLang } from './lang'
26
26
  export interface Props {
27
27
  loading?: boolean
28
28
  useForm?: boolean
29
+ type?: 'submit' | 'send' | 'next'
29
30
  isNextButton?: boolean
30
31
  color?: string
31
32
  }
32
- const props = defineProps({
33
- loading: {
34
- type: Boolean,
35
- default: undefined
36
- },
37
- useForm: {
38
- type: Boolean
39
- },
40
- isNextButton: {
41
- type: Boolean
42
- },
43
- color: {
44
- type: String,
45
- default: 'primary'
46
- }
33
+ const props = withDefaults(defineProps<Props>(), {
34
+ type: 'submit',
35
+ color: 'primary'
47
36
  })
37
+
38
+ const { type, isNextButton } = toRefs(props)
39
+
48
40
  const attrs = useAttrs()
49
41
  const emit = defineEmits<{
50
42
  (
@@ -79,4 +71,13 @@ const submit = debounce(
79
71
  1000,
80
72
  true
81
73
  )
74
+
75
+ const label = computed(() => {
76
+ const labels = {
77
+ submit: lang.value.submit,
78
+ send: lang.value.send,
79
+ next: lang.value.next
80
+ }
81
+ return isNextButton.value ? lang.value.next : labels[type.value]
82
+ })
82
83
  </script>
@@ -49,7 +49,7 @@ export default {
49
49
  </script>
50
50
 
51
51
  <script setup lang="ts">
52
- import { ref, toRefs, watch, useSlots } from 'vue'
52
+ import { toRefs, watch } from 'vue'
53
53
  import { useQuasar } from 'quasar'
54
54
  import { useLang, loadLang } from './lang'
55
55
 
@@ -57,7 +57,6 @@ export interface Props {
57
57
  type?: 'create' | 'update'
58
58
  disabled?: boolean
59
59
  }
60
- const slots = useSlots()
61
60
  const props = defineProps<Props>()
62
61
 
63
62
  const emit = defineEmits<{
@@ -91,30 +90,7 @@ watch($q.lang, (val) => {
91
90
 
92
91
  const { type, disabled } = toRefs(props)
93
92
 
94
- if (!type.value && !slots.fab) type.value = 'create'
95
-
96
93
  const done = () => ''
97
- const create = (evt: unknown) =>
98
- disabled.value
99
- ? () => {
100
- //
101
- }
102
- : emit('create', { done })
103
- const update = (evt: unknown) =>
104
- disabled.value
105
- ? () => {
106
- //
107
- }
108
- : emit('update', { done })
109
-
110
- const variables = ref({
111
- // header: lang.value.some.nested.prop
112
- })
113
- const functions = ref({
114
- // submit
115
- })
116
- defineExpose({
117
- variables,
118
- functions
119
- })
94
+ const create = (evt: unknown) => emit('create', { done })
95
+ const update = (evt: unknown) => emit('update', { done })
120
96
  </script>
@@ -15,6 +15,7 @@
15
15
  <q-submit-button
16
16
  v-if="!display"
17
17
  color="accent"
18
+ :type="buttonType"
18
19
  @submit="submit"
19
20
  ></q-submit-button>
20
21
  </q-toolbar>
@@ -43,6 +44,7 @@ import QSubmitButton from './QSubmitButton.vue'
43
44
 
44
45
  export interface Props {
45
46
  display?: boolean
47
+ buttonType?: 'submit' | 'send'
46
48
  }
47
49
  defineProps<Props>()
48
50
  // const attrs = useAttrs();
@@ -4,7 +4,8 @@ const lang: Language = {
4
4
  isoName: 'en-US',
5
5
  submit: 'Submit',
6
6
  next: 'Next',
7
- back: 'Back'
7
+ back: 'Back',
8
+ send: 'Send'
8
9
  }
9
10
 
10
11
  export default lang
@@ -3,6 +3,7 @@ export interface Language {
3
3
  submit: string
4
4
  next: string
5
5
  back: string
6
+ send: string
6
7
  }
7
8
 
8
9
  import type { Ref } from 'vue'
@@ -4,7 +4,8 @@ const lang: Language = {
4
4
  isoName: 'nl',
5
5
  submit: 'Opslaan',
6
6
  next: 'Volgende',
7
- back: 'Vorige'
7
+ back: 'Vorige',
8
+ send: 'Versturen'
8
9
  }
9
10
 
10
11
  export default lang