@simsustech/quasar-components 0.8.0 → 0.8.1

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,14 @@
1
1
  # @simsustech/quasar-components
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b24daf: feat: add fab slot to ResourcePage
8
+ - 92a0c62: feat(components): add header-side slot to ResourcePage
9
+ - c750af3: fix: fix DateInput label
10
+ - 572c7e5: feat: add label to LocaleSelect
11
+
3
12
  ## 0.8.0
4
13
 
5
14
  ### Minor Changes
package/dist/form.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref, defineComponent, useAttrs, withAsyncContext, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, computed, useSlots, renderSlot, createCommentVNode, toRefs, resolveDirective, createElementBlock, Fragment, renderList, resolveDynamicComponent, createElementVNode, withDirectives, createSlots } from "vue";
1
+ import { ref, defineComponent, useAttrs, withAsyncContext, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, computed, useSlots, renderSlot, createCommentVNode, toRefs, resolveDirective, createElementBlock, Fragment, renderList, resolveDynamicComponent, createElementVNode, withDirectives, onMounted, createSlots } from "vue";
2
2
  import { useQuasar, QSelect, QItem, QItemSection, QItemLabel, QInput, QDate, QIcon, QTooltip, QBtn, QPopupProxy, QField, QEditor } from "quasar";
3
3
  import { e as enUs, n as nl, u as useLang$1 } from "./en-US-BEeILC7o.js";
4
4
  const lang$1 = {
@@ -37,6 +37,7 @@ const lang$1 = {
37
37
  }
38
38
  },
39
39
  datePicker: {
40
+ date: "Date",
40
41
  placeholder: "YYYY/MM/DD",
41
42
  YYYY: "YYYY",
42
43
  MM: "MM",
@@ -49,6 +50,9 @@ const lang$1 = {
49
50
  currency: "Currency",
50
51
  EUR: "Euro",
51
52
  USD: "USD"
53
+ },
54
+ locale: {
55
+ locale: "Locale"
52
56
  }
53
57
  };
54
58
  const enUS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -59,7 +63,7 @@ var define_import_meta_env_default = { BASE_URL: "/", MODE: "production", DEV: f
59
63
  const lang = ref(lang$1);
60
64
  const locales = /* @__PURE__ */ Object.assign({
61
65
  "./en-US.ts": () => Promise.resolve().then(() => enUS),
62
- "./nl.ts": () => import("./nl-CZsfRA99.js")
66
+ "./nl.ts": () => import("./nl-DvM_wB4u.js")
63
67
  });
64
68
  const useLang = () => {
65
69
  return lang;
@@ -485,14 +489,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
485
489
  "model-value": unref(modelValue),
486
490
  "bottom-slots": "",
487
491
  rules: validations.value,
488
- label: _ctx.label,
492
+ label: `${_ctx.label}${_ctx.required ? "*" : ""}`,
489
493
  "stack-label": ""
490
494
  }, {
491
495
  control: withCtx(() => [
492
496
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(format).split("-"), (part, index) => {
493
497
  return openBlock(), createBlock(resolveDynamicComponent(unref(QInput)), mergeProps({
494
498
  key: part,
495
- borderless: ""
499
+ borderless: "",
500
+ ref_for: true
496
501
  }, dateProps.value[part]), {
497
502
  after: withCtx(() => [
498
503
  index < 2 ? (openBlock(), createElementBlock("a", _hoisted_1$1, "-")) : createCommentVNode("", true)
@@ -794,12 +799,14 @@ const _hoisted_2 = { key: 1 };
794
799
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
795
800
  __name: "LocaleSelect",
796
801
  props: {
797
- modelValue: {}
802
+ modelValue: {},
803
+ required: { type: Boolean }
798
804
  },
799
805
  setup(__props) {
800
806
  const props = __props;
801
807
  const { modelValue } = toRefs(props);
802
808
  const attrs = useAttrs();
809
+ const lang2 = useLang();
803
810
  const flagsLang = useLang$1();
804
811
  const languageOptions = [
805
812
  {
@@ -818,6 +825,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
818
825
  return openBlock(), createBlock(unref(QSelect), mergeProps(unref(attrs), {
819
826
  options: languageOptions,
820
827
  "model-value": unref(modelValue),
828
+ label: `${unref(lang2).locale.locale}${_ctx.required ? "*" : ""}`,
821
829
  "emit-value": "",
822
830
  "map-options": ""
823
831
  }), {
@@ -878,7 +886,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
878
886
  }, 1040)) : createCommentVNode("", true)
879
887
  ]),
880
888
  _: 1
881
- }, 16, ["model-value"]);
889
+ }, 16, ["model-value", "label"]);
882
890
  };
883
891
  }
884
892
  });
@@ -890,7 +898,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
890
898
  props: {
891
899
  modelValue: {},
892
900
  labelKey: {},
901
+ labelFunction: { type: Function },
893
902
  valueKey: {},
903
+ extraFields: {},
894
904
  filteredOptions: {},
895
905
  required: { type: Boolean },
896
906
  onFilter: {},
@@ -904,14 +914,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
904
914
  const attrs = useAttrs();
905
915
  const emit = __emit;
906
916
  const lang2 = useLang();
907
- const { modelValue, onFilter, filteredOptions, labelKey, valueKey } = toRefs(props);
917
+ const {
918
+ modelValue,
919
+ onFilter,
920
+ filteredOptions,
921
+ labelKey,
922
+ valueKey,
923
+ labelFunction,
924
+ extraFields
925
+ } = toRefs(props);
908
926
  const options = computed(() => {
909
927
  var _a;
910
928
  if (filteredOptions.value.length) {
911
- return (_a = filteredOptions.value) == null ? void 0 : _a.map((option) => ({
912
- label: option[labelKey.value],
913
- value: option[valueKey.value || "id"]
914
- }));
929
+ return (_a = filteredOptions.value) == null ? void 0 : _a.map((option) => {
930
+ var _a2;
931
+ return {
932
+ label: labelFunction.value ? labelFunction.value(option) : option[labelKey.value],
933
+ value: option[valueKey.value || "id"],
934
+ extraFields: (_a2 = extraFields.value) == null ? void 0 : _a2.reduce(
935
+ (result, key) => {
936
+ if (option.hasOwnProperty(key)) {
937
+ result[key] = option[key];
938
+ }
939
+ return result;
940
+ },
941
+ {}
942
+ )
943
+ };
944
+ });
915
945
  }
916
946
  return [];
917
947
  });
@@ -947,6 +977,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
947
977
  }
948
978
  });
949
979
  });
980
+ onMounted(() => {
981
+ if (!options.value.length)
982
+ emit("filter", {
983
+ ids: selectedIds.value,
984
+ searchPhrase: "",
985
+ done: () => {
986
+ }
987
+ });
988
+ });
950
989
  return (_ctx, _cache) => {
951
990
  return openBlock(), createBlock(unref(QSelect), mergeProps({
952
991
  ref_key: "selectRef",
@@ -973,11 +1012,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
973
1012
  ]),
974
1013
  _: 2
975
1014
  }, [
976
- renderList(Object.keys(_ctx.$slots), (slot, index) => {
1015
+ renderList(_ctx.$slots, (_, slot) => {
977
1016
  return {
978
1017
  name: slot,
979
1018
  fn: withCtx((scope) => [
980
- renderSlot(_ctx.$slots, slot, { scope })
1019
+ renderSlot(_ctx.$slots, slot, normalizeProps(guardReactiveProps(scope || {})))
981
1020
  ])
982
1021
  };
983
1022
  })
package/dist/general.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { l as loadLang, u as useLang, _ as _sfc_main$5 } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-DAnZaTMl.js";
2
- import { useQuasar, QCard, QCardSection, QCardActions, QDialog, QBtn, QToolbarTitle, QToolbar, QHeader, QPage, QPageContainer, QLayout, QSpace, QPageSticky, QSelect, QItemSection, QItemLabel, QItem, QList } from "quasar";
3
- import { defineComponent, watch, ref, openBlock, createBlock, unref, withCtx, renderSlot, createVNode, createElementVNode, normalizeProps, guardReactiveProps, normalizeClass, createCommentVNode, toRefs, useAttrs, computed, mergeProps, createTextVNode, toDisplayString } from "vue";
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";
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" };
@@ -207,11 +207,12 @@ const __default__ = {
207
207
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
208
208
  ...__default__,
209
209
  props: {
210
- type: { default: "create" },
211
- disabled: { type: Boolean, default: false }
210
+ type: {},
211
+ disabled: { type: Boolean }
212
212
  },
213
213
  emits: ["create", "update"],
214
214
  setup(__props, { expose: __expose, emit: __emit }) {
215
+ const slots = useSlots();
215
216
  const props = __props;
216
217
  const emit = __emit;
217
218
  const $q = useQuasar();
@@ -221,7 +222,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
221
222
  watch($q.lang, (val) => {
222
223
  loadLang($q.lang.isoName);
223
224
  });
224
- const { disabled } = toRefs(props);
225
+ const { type, disabled } = toRefs(props);
226
+ if (!type.value && !slots.fab)
227
+ type.value = "create";
225
228
  const done = () => "";
226
229
  const create = (evt) => disabled.value ? () => {
227
230
  } : emit("create", { done });
@@ -240,7 +243,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
240
243
  return (_ctx, _cache) => {
241
244
  const _component_q_btn = QBtn;
242
245
  const _component_q_toolbar_title = QToolbarTitle;
243
- const _component_q_space = QSpace;
244
246
  const _component_q_toolbar = QToolbar;
245
247
  const _component_q_page_sticky = QPageSticky;
246
248
  const _component_q_page = QPage;
@@ -258,7 +260,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
258
260
  class: normalizeClass(["shadow-2", { "bg-dark": unref($q).dark.isActive, "bg-white": !unref($q).dark.isActive }])
259
261
  }, {
260
262
  default: withCtx(() => [
261
- _ctx.type === "create" ? (openBlock(), createBlock(_component_q_btn, {
263
+ renderSlot(_ctx.$slots, "fab"),
264
+ unref(type) === "create" ? (openBlock(), createBlock(_component_q_btn, {
262
265
  key: 0,
263
266
  disable: unref(disabled),
264
267
  flat: "",
@@ -269,7 +272,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
269
272
  icon: "add",
270
273
  class: "q-mr-sm bg-primary text-white",
271
274
  onClick: create
272
- }, null, 8, ["disable"])) : (openBlock(), createBlock(_component_q_btn, {
275
+ }, null, 8, ["disable"])) : unref(type) === "update" ? (openBlock(), createBlock(_component_q_btn, {
273
276
  key: 1,
274
277
  disable: unref(disabled),
275
278
  flat: "",
@@ -280,14 +283,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
280
283
  icon: "edit",
281
284
  class: "q-mr-sm bg-primary text-white",
282
285
  onClick: update
283
- }, null, 8, ["disable"])),
284
- createVNode(_component_q_toolbar_title, { shrink: "" }, {
286
+ }, null, 8, ["disable"])) : createCommentVNode("", true),
287
+ createVNode(_component_q_toolbar_title, null, {
285
288
  default: withCtx(() => [
286
289
  renderSlot(_ctx.$slots, "header")
287
290
  ]),
288
291
  _: 3
289
292
  }),
290
- createVNode(_component_q_space)
293
+ renderSlot(_ctx.$slots, "header-side")
291
294
  ]),
292
295
  _: 3
293
296
  }, 8, ["class"])
@@ -34,6 +34,7 @@ const lang = {
34
34
  }
35
35
  },
36
36
  datePicker: {
37
+ date: "Datum",
37
38
  placeholder: "JJJJ/MM/DD",
38
39
  YYYY: "JJJJ",
39
40
  MM: "MM",
@@ -46,6 +47,9 @@ const lang = {
46
47
  currency: "Valuta",
47
48
  EUR: "Euro",
48
49
  USD: "USD"
50
+ },
51
+ locale: {
52
+ locale: "Land"
49
53
  }
50
54
  };
51
55
  export {
@@ -18,6 +18,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Pr
18
18
  functions: import("vue").Ref<{}>;
19
19
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>>, {}, {}>;
20
20
  export default _default;
21
+
21
22
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
22
23
  type __VLS_TypePropsToOption<T> = {
23
24
  [K in keyof T]-?: {} extends Pick<T, K> ? {
@@ -25,8 +25,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
25
25
  }, {
26
26
  label: string;
27
27
  date: Partial<QDateProps>;
28
- format: "YYYY-MM-DD" | "DD-MM-YYYY" | "MM-DD-YYYY";
29
28
  locale: keyof import("quasar").QuasarLanguageCodesHolder;
29
+ format: "YYYY-MM-DD" | "DD-MM-YYYY" | "MM-DD-YYYY";
30
30
  }, {}>;
31
31
  export default _default;
32
32
  type __VLS_WithDefaults<P, D> = {
@@ -4,10 +4,10 @@ export interface Period {
4
4
  type: 'unavailable';
5
5
  }
6
6
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
7
- modelValue: string | null | undefined | {
7
+ modelValue: string | {
8
8
  from: string;
9
9
  to: string;
10
- };
10
+ } | null | undefined;
11
11
  periods?: Period[] | undefined;
12
12
  range?: boolean | undefined;
13
13
  options?: ((date: string) => boolean) | undefined;
@@ -17,10 +17,10 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
17
17
  to: string;
18
18
  }) => void;
19
19
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
20
- modelValue: string | null | undefined | {
20
+ modelValue: string | {
21
21
  from: string;
22
22
  to: string;
23
- };
23
+ } | null | undefined;
24
24
  periods?: Period[] | undefined;
25
25
  range?: boolean | undefined;
26
26
  options?: ((date: string) => boolean) | undefined;
@@ -2,25 +2,25 @@ declare const _default: <T extends {
2
2
  [key: string]: unknown;
3
3
  id: number;
4
4
  }>(__VLS_props: {
5
- label?: string | undefined;
6
- required?: boolean | undefined;
7
- modelValue?: number | number[] | null | undefined;
8
- hint?: string | undefined;
9
- multiple?: boolean | undefined;
10
5
  onFilter?: ((args_0: {
11
6
  ids: number[];
12
7
  searchPhrase: string;
13
8
  done: (success?: boolean) => void;
14
9
  }) => any) | undefined;
15
10
  "onUpdate:model-value"?: ((id: number) => any) | undefined;
11
+ modelValue?: number | number[] | null | undefined;
16
12
  labelKey: string;
13
+ labelFunction?: ((option: unknown) => string) | undefined;
17
14
  valueKey?: string | undefined;
15
+ extraFields?: string[] | undefined;
18
16
  filteredOptions: T[];
17
+ required?: boolean | undefined;
18
+ multiple?: boolean | undefined;
19
+ label?: string | undefined;
20
+ hint?: string | undefined;
19
21
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
20
22
  attrs: any;
21
- slots: Partial<Record<string, (_: {
22
- scope: any;
23
- }) => any>>;
23
+ slots: Partial<Record<NonNullable<string | number>, (_: any) => any>>;
24
24
  emit: {
25
25
  (e: 'update:model-value', id: number): void;
26
26
  (e: 'filter', { ids, searchPhrase, done }: {
@@ -31,26 +31,26 @@ declare const _default: <T extends {
31
31
  };
32
32
  } | undefined, __VLS_expose?: ((exposed: import('vue').ShallowUnwrapRef<{}>) => void) | undefined, __VLS_setup?: Promise<{
33
33
  props: {
34
- label?: string | undefined;
35
- required?: boolean | undefined;
36
- modelValue?: number | number[] | null | undefined;
37
- hint?: string | undefined;
38
- multiple?: boolean | undefined;
39
34
  onFilter?: ((args_0: {
40
35
  ids: number[];
41
36
  searchPhrase: string;
42
37
  done: (success?: boolean) => void;
43
38
  }) => any) | undefined;
44
39
  "onUpdate:model-value"?: ((id: number) => any) | undefined;
40
+ modelValue?: number | number[] | null | undefined;
45
41
  labelKey: string;
42
+ labelFunction?: ((option: unknown) => string) | undefined;
46
43
  valueKey?: string | undefined;
44
+ extraFields?: string[] | undefined;
47
45
  filteredOptions: T[];
46
+ required?: boolean | undefined;
47
+ multiple?: boolean | undefined;
48
+ label?: string | undefined;
49
+ hint?: string | undefined;
48
50
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
49
51
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
50
52
  attrs: any;
51
- slots: Partial<Record<string, (_: {
52
- scope: any;
53
- }) => any>>;
53
+ slots: Partial<Record<NonNullable<string | number>, (_: any) => any>>;
54
54
  emit: {
55
55
  (e: 'update:model-value', id: number): void;
56
56
  (e: 'filter', { ids, searchPhrase, done }: {
@@ -64,26 +64,26 @@ declare const _default: <T extends {
64
64
  }> & {
65
65
  __ctx?: {
66
66
  props: {
67
- label?: string | undefined;
68
- required?: boolean | undefined;
69
- modelValue?: number | number[] | null | undefined;
70
- hint?: string | undefined;
71
- multiple?: boolean | undefined;
72
67
  onFilter?: ((args_0: {
73
68
  ids: number[];
74
69
  searchPhrase: string;
75
70
  done: (success?: boolean) => void;
76
71
  }) => any) | undefined;
77
72
  "onUpdate:model-value"?: ((id: number) => any) | undefined;
73
+ modelValue?: number | number[] | null | undefined;
78
74
  labelKey: string;
75
+ labelFunction?: ((option: unknown) => string) | undefined;
79
76
  valueKey?: string | undefined;
77
+ extraFields?: string[] | undefined;
80
78
  filteredOptions: T[];
79
+ required?: boolean | undefined;
80
+ multiple?: boolean | undefined;
81
+ label?: string | undefined;
82
+ hint?: string | undefined;
81
83
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
82
84
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
83
85
  attrs: any;
84
- slots: Partial<Record<string, (_: {
85
- scope: any;
86
- }) => any>>;
86
+ slots: Partial<Record<NonNullable<string | number>, (_: any) => any>>;
87
87
  emit: {
88
88
  (e: 'update:model-value', id: number): void;
89
89
  (e: 'filter', { ids, searchPhrase, done }: {
@@ -95,7 +95,6 @@ declare const _default: <T extends {
95
95
  } | undefined;
96
96
  };
97
97
  export default _default;
98
- type __VLS_OmitKeepDiscriminatedUnion<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
99
98
  type __VLS_Prettify<T> = {
100
99
  [K in keyof T]: T[K];
101
100
  } & {};
@@ -1,5 +1,6 @@
1
1
  export interface Props {
2
2
  modelValue?: string | null;
3
+ required?: boolean;
3
4
  }
4
5
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>>, {}, {}>;
5
6
  export default _default;
@@ -34,6 +34,7 @@ export interface Language {
34
34
  };
35
35
  };
36
36
  datePicker: {
37
+ date: string;
37
38
  placeholder: string;
38
39
  YYYY: string;
39
40
  MM: string;
@@ -47,6 +48,9 @@ export interface Language {
47
48
  EUR: string;
48
49
  USD: string;
49
50
  };
51
+ locale: {
52
+ locale: string;
53
+ };
50
54
  }
51
55
  import type { Ref } from 'vue';
52
56
  export declare const lang: Ref<{
@@ -85,6 +89,7 @@ export declare const lang: Ref<{
85
89
  };
86
90
  };
87
91
  datePicker: {
92
+ date: string;
88
93
  placeholder: string;
89
94
  YYYY: string;
90
95
  MM: string;
@@ -98,6 +103,9 @@ export declare const lang: Ref<{
98
103
  EUR: string;
99
104
  USD: string;
100
105
  };
106
+ locale: {
107
+ locale: string;
108
+ };
101
109
  }>;
102
110
  export declare const defineLang: (lang: Language) => Language;
103
111
  export declare const useLang: () => Ref<Language>;
@@ -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_WithDefaults<__VLS_TypePropsToOption<Props>, {
6
- type: string;
7
- disabled: boolean;
8
- }>, {
5
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {
9
6
  variables: import("vue").Ref<{}>;
10
7
  functions: import("vue").Ref<{}>;
11
8
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -17,10 +14,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
17
14
  data?: unknown;
18
15
  done: (success?: boolean) => void;
19
16
  }) => void;
20
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
21
- type: string;
22
- disabled: boolean;
23
- }>>> & {
17
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>> & {
24
18
  onUpdate?: ((args_0: {
25
19
  data?: unknown;
26
20
  done: (success?: boolean) => void;
@@ -29,22 +23,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
29
23
  data?: unknown;
30
24
  done: (success?: boolean) => void;
31
25
  }) => any) | undefined;
32
- }, {
33
- type: "update" | "create";
34
- disabled: boolean;
35
- }, {}>, {
26
+ }, {}, {}>, {
36
27
  default?(_: {}): any;
28
+ fab?(_: {}): any;
37
29
  header?(_: {}): any;
30
+ "header-side"?(_: {}): any;
38
31
  }>;
39
32
  export default _default;
40
- type __VLS_WithDefaults<P, D> = {
41
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
42
- default: D[K];
43
- }> : P[K];
44
- };
45
- type __VLS_Prettify<T> = {
46
- [K in keyof T]: T[K];
47
- } & {};
48
33
  type __VLS_WithTemplateSlots<T, S> = T & {
49
34
  new (): {
50
35
  $slots: S;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simsustech/quasar-components",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "author": "Stefan van Herwijnen",
5
5
  "description": "High level components for Quasar Framework",
6
6
  "license": "MIT",
@@ -3,7 +3,7 @@
3
3
  :model-value="modelValue"
4
4
  bottom-slots
5
5
  :rules="validations"
6
- :label="label"
6
+ :label="`${label}${required ? '*' : ''}`"
7
7
  stack-label
8
8
  >
9
9
  <template #control>
@@ -19,12 +19,8 @@
19
19
  @update:model-value="$emit('update:model-value', $event)"
20
20
  >
21
21
  <template #hint> {{ hint }} </template>
22
- <template
23
- v-for="(slot, index) of Object.keys($slots)"
24
- :key="index"
25
- #[slot]="scope"
26
- >
27
- <slot :scope="scope" :name="slot"></slot>
22
+ <template v-for="(_, slot) in $slots" v-slot:[slot]="scope">
23
+ <slot :name="slot" v-bind="scope || {}" />
28
24
  </template>
29
25
  </q-select>
30
26
  </template>
@@ -41,13 +37,15 @@ export default {
41
37
  generic="T extends { id: number; [key: string]: unknown }"
42
38
  >
43
39
  import { QSelect } from 'quasar'
44
- import { computed, ref, toRefs, useAttrs, watch } from 'vue'
40
+ import { computed, ref, toRefs, useAttrs, watch, onMounted } from 'vue'
45
41
  import { useLang } from './lang/index.js'
46
42
 
47
43
  interface Props {
48
44
  modelValue?: number | number[] | null
49
45
  labelKey: string
46
+ labelFunction?: (option: unknown) => string
50
47
  valueKey?: string
48
+ extraFields?: string[]
51
49
  filteredOptions: T[]
52
50
  required?: boolean
53
51
  onFilter?: unknown
@@ -76,13 +74,32 @@ const emit = defineEmits<{
76
74
 
77
75
  const lang = useLang()
78
76
 
79
- const { modelValue, onFilter, filteredOptions, labelKey, valueKey } =
80
- toRefs(props)
77
+ const {
78
+ modelValue,
79
+ onFilter,
80
+ filteredOptions,
81
+ labelKey,
82
+ valueKey,
83
+ labelFunction,
84
+ extraFields
85
+ } = toRefs(props)
86
+
81
87
  const options = computed(() => {
82
88
  if (filteredOptions.value.length) {
83
89
  return filteredOptions.value?.map((option) => ({
84
- label: option[labelKey.value],
85
- value: option[valueKey.value || 'id']
90
+ label: labelFunction.value
91
+ ? labelFunction.value(option)
92
+ : option[labelKey.value],
93
+ value: option[valueKey.value || 'id'],
94
+ extraFields: extraFields.value?.reduce(
95
+ (result, key) => {
96
+ if (option.hasOwnProperty(key)) {
97
+ result[key] = option[key]
98
+ }
99
+ return result
100
+ },
101
+ {} as Record<string, unknown>
102
+ )
86
103
  }))
87
104
  }
88
105
  return []
@@ -122,4 +139,13 @@ watch(modelValue, () => {
122
139
  done: () => {}
123
140
  })
124
141
  })
142
+
143
+ onMounted(() => {
144
+ if (!options.value.length)
145
+ emit('filter', {
146
+ ids: selectedIds.value,
147
+ searchPhrase: '',
148
+ done: () => {}
149
+ })
150
+ })
125
151
  </script>
@@ -3,6 +3,7 @@
3
3
  v-bind="attrs"
4
4
  :options="languageOptions"
5
5
  :model-value="modelValue"
6
+ :label="`${lang.locale.locale}${required ? '*' : ''}`"
6
7
  emit-value
7
8
  map-options
8
9
  >
@@ -42,13 +43,17 @@ import { useAttrs, toRefs } from 'vue'
42
43
  import { QSelect } from 'quasar'
43
44
  import { nl, enUs } from '../flags/index.js'
44
45
  import { useLang as useFlagsLang } from '../flags/lang/index.js'
46
+ import { useLang } from './lang/index.js'
47
+
45
48
  export interface Props {
46
49
  modelValue?: string | null
50
+ required?: boolean
47
51
  }
48
52
  const props = defineProps<Props>()
49
53
  const { modelValue } = toRefs(props)
50
54
  const attrs = useAttrs()
51
55
 
56
+ const lang = useLang()
52
57
  const flagsLang = useFlagsLang()
53
58
  const languageOptions = [
54
59
  {
@@ -36,6 +36,7 @@ const lang: Language = {
36
36
  }
37
37
  },
38
38
  datePicker: {
39
+ date: 'Date',
39
40
  placeholder: 'YYYY/MM/DD',
40
41
  YYYY: 'YYYY',
41
42
  MM: 'MM',
@@ -48,6 +49,9 @@ const lang: Language = {
48
49
  currency: 'Currency',
49
50
  EUR: 'Euro',
50
51
  USD: 'USD'
52
+ },
53
+ locale: {
54
+ locale: 'Locale'
51
55
  }
52
56
  }
53
57
 
@@ -34,6 +34,7 @@ export interface Language {
34
34
  }
35
35
  }
36
36
  datePicker: {
37
+ date: string
37
38
  placeholder: string
38
39
  YYYY: string
39
40
  MM: string
@@ -47,6 +48,9 @@ export interface Language {
47
48
  EUR: string
48
49
  USD: string
49
50
  }
51
+ locale: {
52
+ locale: string
53
+ }
50
54
  }
51
55
 
52
56
  import type { Ref } from 'vue'
@@ -36,6 +36,7 @@ const lang: Language = {
36
36
  }
37
37
  },
38
38
  datePicker: {
39
+ date: 'Datum',
39
40
  placeholder: 'JJJJ/MM/DD',
40
41
  YYYY: 'JJJJ',
41
42
  MM: 'MM',
@@ -48,6 +49,9 @@ const lang: Language = {
48
49
  currency: 'Valuta',
49
50
  EUR: 'Euro',
50
51
  USD: 'USD'
52
+ },
53
+ locale: {
54
+ locale: 'Land'
51
55
  }
52
56
  }
53
57
 
@@ -8,6 +8,7 @@
8
8
  class="shadow-2"
9
9
  :class="{ 'bg-dark': $q.dark.isActive, 'bg-white': !$q.dark.isActive }"
10
10
  >
11
+ <slot name="fab" />
11
12
  <q-btn
12
13
  v-if="type === 'create'"
13
14
  :disable="disabled"
@@ -21,7 +22,7 @@
21
22
  @click="create"
22
23
  />
23
24
  <q-btn
24
- v-else
25
+ v-else-if="type === 'update'"
25
26
  :disable="disabled"
26
27
  flat
27
28
  style="margin-bottom: -50px; z-index: 5"
@@ -32,10 +33,10 @@
32
33
  class="q-mr-sm bg-primary text-white"
33
34
  @click="update"
34
35
  />
35
- <q-toolbar-title shrink>
36
+ <q-toolbar-title>
36
37
  <slot name="header" />
37
38
  </q-toolbar-title>
38
- <q-space />
39
+ <slot name="header-side" />
39
40
  </q-toolbar>
40
41
  </q-page-sticky>
41
42
  </q-page>
@@ -48,7 +49,7 @@ export default {
48
49
  </script>
49
50
 
50
51
  <script setup lang="ts">
51
- import { ref, toRefs, watch } from 'vue'
52
+ import { ref, toRefs, watch, useSlots } from 'vue'
52
53
  import { useQuasar } from 'quasar'
53
54
  import { useLang, loadLang } from './lang'
54
55
 
@@ -56,13 +57,9 @@ export interface Props {
56
57
  type?: 'create' | 'update'
57
58
  disabled?: boolean
58
59
  }
59
- // const props = defineProps<Props>()
60
- const props = withDefaults(defineProps<Props>(), {
61
- type: 'create',
62
- disabled: false
63
- })
60
+ const slots = useSlots()
61
+ const props = defineProps<Props>()
64
62
 
65
- // const attrs = useAttrs();
66
63
  const emit = defineEmits<{
67
64
  (
68
65
  e: 'create',
@@ -92,7 +89,9 @@ watch($q.lang, (val) => {
92
89
  loadLang($q.lang.isoName)
93
90
  })
94
91
 
95
- const { disabled } = toRefs(props)
92
+ const { type, disabled } = toRefs(props)
93
+
94
+ if (!type.value && !slots.fab) type.value = 'create'
96
95
 
97
96
  const done = () => ''
98
97
  const create = (evt: unknown) =>