@mouseless/baked 1.5.1 → 1.5.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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
3
  "configKey": "baked",
4
- "version": "1.5.1",
4
+ "version": "1.5.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -36,5 +36,5 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
36
36
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
37
37
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
38
38
  type __VLS_Slots = {
39
- default?: ((props: {}) => any) | undefined;
39
+ [x: string]: ((props: any) => any) | undefined;
40
40
  };
@@ -6,7 +6,15 @@
6
6
  :class="classes"
7
7
  v-bind="getComponentProps()"
8
8
  >
9
- <slot v-if="$slots.default" />
9
+ <template
10
+ v-for="(_, slotName) in $slots"
11
+ #[slotName]="slotProps"
12
+ >
13
+ <slot
14
+ :name="slotName"
15
+ v-bind="slotProps ?? {}"
16
+ />
17
+ </template>
10
18
  </component>
11
19
  </template>
12
20
 
@@ -26,25 +34,29 @@ const { name, descriptor } = defineProps({
26
34
  const model = defineModel({ type: null });
27
35
  const emit = defineEmits(["loaded"]);
28
36
  const parentPath = context.injectPath();
37
+ const parentLoading = context.injectLoading();
29
38
  const path = parentPath && parentPath !== "" ? `${parentPath}/${name}` : name;
30
39
  const events = context.injectEvents();
31
40
  const contextData = context.injectContextData();
32
41
  const componentTemplate = componentResolver.resolve(descriptor.type, "MissingComponent");
33
42
  const componentProps = buildComponentProps();
34
43
  const data = ref(dataFetcher.get({ data: descriptor.data, contextData }));
35
- const shouldLoad = dataFetcher.shouldLoad(descriptor.data);
44
+ const shouldLoad = !parentLoading.value && dataFetcher.shouldLoad(descriptor.data);
36
45
  const loading = ref(shouldLoad);
37
- const executing = ref(false);
46
+ let executing = null;
38
47
  const visible = ref(true);
39
48
  const classes = [`b-component--${descriptor.type}`, ...asClasses(name)];
40
49
  let reactions = null;
41
50
  context.providePath(path);
42
51
  context.provideDataDescriptor(descriptor.data);
43
52
  context.provideParentContext({ ...contextData.parent, data });
44
- context.provideExecuting(executing);
45
53
  if (shouldLoad) {
46
54
  context.provideLoading(loading);
47
55
  }
56
+ if (descriptor.action) {
57
+ executing = ref(false);
58
+ context.provideExecuting(executing);
59
+ }
48
60
  if (descriptor.reactions) {
49
61
  reactions = reactionHandler.create(`${path}:bake`, {
50
62
  reload(success) {
@@ -91,6 +103,7 @@ function buildComponentProps() {
91
103
  }
92
104
  return result;
93
105
  }
106
+ let __BIND_COUNT__ = 0;
94
107
  function getComponentProps() {
95
108
  const result = { ...componentProps };
96
109
  if (descriptor.data) {
@@ -98,7 +111,10 @@ function getComponentProps() {
98
111
  }
99
112
  if (componentTemplate.props?.modelValue) {
100
113
  result.modelValue = model.value;
101
- nextTick(() => onModelUpdate(model.value));
114
+ if (__BIND_COUNT__ < 2) {
115
+ __BIND_COUNT__++;
116
+ nextTick(() => onModelUpdate(model.value));
117
+ }
102
118
  }
103
119
  return result;
104
120
  }
@@ -36,5 +36,5 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
36
36
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
37
37
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
38
38
  type __VLS_Slots = {
39
- default?: ((props: {}) => any) | undefined;
39
+ [x: string]: ((props: any) => any) | undefined;
40
40
  };
@@ -1,25 +1,59 @@
1
1
  <template>
2
2
  <div
3
- class="b-Contents w-full grid grid-cols-1 gap-4 lg:grid-cols-2 items-start"
3
+ class="
4
+ b-Contents w-full flex gap-8
5
+ max-md:flex-col
6
+ "
4
7
  :class="{ 'max-w-screen-xl 3xl:max-w-screen-2xl': !fullScreen }"
5
8
  >
6
- <slot v-if="$slots.default" />
7
- <Bake
8
- v-for="content in contents"
9
- :key="`content-${content.key}`"
10
- :name="`${mergedNamePrefix}/${content.key}`"
11
- :descriptor="content.component"
12
- :class="{ 'lg:col-span-2': !content.narrow }"
13
- />
9
+ <div
10
+ class="
11
+ w-full
12
+ grid grid-cols-1 items-start gap-4
13
+ lg:grid-cols-2
14
+ "
15
+ >
16
+ <slot v-if="$slots.default" />
17
+ <Bake
18
+ v-for="content in mainContents"
19
+ :key="`content-${content.key}`"
20
+ :name="`${mergedNamePrefix}/${content.key}`"
21
+ :descriptor="content.component"
22
+ :class="{ 'lg:col-span-2': !content.narrow }"
23
+ />
24
+ </div>
25
+ <div
26
+ v-if="sideContents.length"
27
+ class="
28
+ w-[30rem] gap-2 flex flex-col
29
+ max-md:w-full
30
+ max-lg:w-80
31
+ "
32
+ >
33
+ <template
34
+ v-for="(content, i) in sideContents"
35
+ :key="`content-${content.key}`"
36
+ >
37
+ <Divider v-if="i > 0" />
38
+ <Bake
39
+ :name="`${mergedNamePrefix}/${content.key}`"
40
+ :descriptor="content.component"
41
+ />
42
+ </template>
43
+ </div>
14
44
  </div>
15
45
  </template>
16
46
 
17
47
  <script setup>
48
+ import { computed } from "vue";
49
+ import { Divider } from "primevue";
18
50
  import { Bake } from "#components";
19
- const { namePrefix } = defineProps({
51
+ const { contents, namePrefix } = defineProps({
20
52
  contents: { type: Array, default: () => [] },
21
53
  namePrefix: { type: String, default: null },
22
54
  fullScreen: { type: Boolean, default: false }
23
55
  });
24
56
  const mergedNamePrefix = namePrefix ? `${namePrefix}/contents` : "contents";
57
+ const mainContents = computed(() => contents.filter((c) => !c.side));
58
+ const sideContents = computed(() => contents.filter((c) => c.side));
25
59
  </script>
@@ -1,28 +1,30 @@
1
1
  <template>
2
2
  <div
3
3
  class="
4
- block bg-transparent
5
- border rounded border-1
6
- border-slate-200 dark:border-slate-700
4
+ bg-transparent dark:bg-zinc-900
5
+ border rounded-md border-1
6
+ border-slate-200 dark:border-zinc-700
7
7
  "
8
8
  >
9
9
  <div
10
+ v-if="inputs.length > 0"
10
11
  class="
11
- px-2 py-4
12
- bg-transparent border-b
13
- dark:bg-zinc-900 dark:border-zinc-800
12
+ py-2 px-4
13
+ bg-transparent
14
14
  rounded-none text-sm
15
- flex gap-4 items-center justify-end
15
+ flex gap-2 items-center justify-end
16
16
  "
17
17
  >
18
18
  <Inputs
19
- v-if="inputs.length > 0"
20
19
  :inputs="inputs"
21
20
  @ready="onReady"
22
21
  @changed="onChanged"
23
22
  />
24
23
  </div>
25
- <div class="pt-0 [contain:inline-size]">
24
+ <div
25
+ class="p-4 [contain:inline-size]"
26
+ :class="{ 'pt-0': inputs.length }"
27
+ >
26
28
  <Bake
27
29
  v-if="loaded && ready"
28
30
  :key="uniqueKey"
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div class="flex flex-col gap-8">
3
- <PageTitle :schema="title">
3
+ <Bake
4
+ name="title"
5
+ :descriptor="title"
6
+ >
4
7
  <template
5
8
  v-if="sections.length > 0"
6
9
  #actions
@@ -11,7 +14,7 @@
11
14
  @submit="onSubmit"
12
15
  />
13
16
  </template>
14
- </PageTitle>
17
+ </Bake>
15
18
  <div class="flex justify-center">
16
19
  <Contents
17
20
  v-focustrap
@@ -78,7 +81,7 @@
78
81
  <script setup>
79
82
  import { computed, ref } from "vue";
80
83
  import { useLocalization } from "#imports";
81
- import { Button, Contents, Inputs, PageTitle } from "#components";
84
+ import { Button, Contents, Inputs } from "#components";
82
85
  const { localize: l } = useLocalization();
83
86
  const { schema } = defineProps({
84
87
  schema: { type: null, required: true }
@@ -22,7 +22,7 @@
22
22
  </template>
23
23
 
24
24
  <script setup>
25
- import { ref } from "vue";
25
+ import { ref, watch } from "vue";
26
26
  import { InputText, Skeleton } from "primevue";
27
27
  import { useContext } from "#imports";
28
28
  import { AwaitLoading, Labeler } from "#components";
@@ -34,6 +34,9 @@ const model = defineModel({ type: null, required: true });
34
34
  const { label, labelMode, labelVariant, targetProp } = schema;
35
35
  const path = context.injectPath();
36
36
  const input = ref("");
37
+ watch(model, (newValue) => {
38
+ input.value = newValue;
39
+ }, { immediate: true });
37
40
  function onUpdate(value) {
38
41
  input.value = value;
39
42
  model.value = value && targetProp ? { [targetProp]: value } : value || void 0;
@@ -7,7 +7,7 @@ type __VLS_WithSlots<T, S> = T & (new () => {
7
7
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
8
  label: {
9
9
  type: StringConstructor;
10
- required: true;
10
+ default: null;
11
11
  };
12
12
  path: {
13
13
  type: StringConstructor;
@@ -32,7 +32,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
32
32
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
33
33
  label: {
34
34
  type: StringConstructor;
35
- required: true;
35
+ default: null;
36
36
  };
37
37
  path: {
38
38
  type: StringConstructor;
@@ -55,6 +55,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
55
55
  default: () => void;
56
56
  };
57
57
  }>> & Readonly<{}>, {
58
+ label: string;
58
59
  variant: string;
59
60
  dt: Record<string, any>;
60
61
  pt: Record<string, any>;
@@ -24,7 +24,7 @@ import { FloatLabel, IftaLabel } from "primevue";
24
24
  import { useLocalization } from "#imports";
25
25
  const { localize: l } = useLocalization();
26
26
  const { label, mode } = defineProps({
27
- label: { type: String, required: true },
27
+ label: { type: String, default: null },
28
28
  path: { type: String, required: true },
29
29
  mode: { type: String, default: null },
30
30
  variant: { type: String, default: "on" },
@@ -7,7 +7,7 @@ type __VLS_WithSlots<T, S> = T & (new () => {
7
7
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
8
  label: {
9
9
  type: StringConstructor;
10
- required: true;
10
+ default: null;
11
11
  };
12
12
  path: {
13
13
  type: StringConstructor;
@@ -32,7 +32,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
32
32
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
33
33
  label: {
34
34
  type: StringConstructor;
35
- required: true;
35
+ default: null;
36
36
  };
37
37
  path: {
38
38
  type: StringConstructor;
@@ -55,6 +55,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
55
55
  default: () => void;
56
56
  };
57
57
  }>> & Readonly<{}>, {
58
+ label: string;
58
59
  variant: string;
59
60
  dt: Record<string, any>;
60
61
  pt: Record<string, any>;
@@ -9,20 +9,26 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
9
9
  type: null;
10
10
  required: true;
11
11
  };
12
+ data: {
13
+ type: null;
14
+ required: true;
15
+ };
12
16
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
17
  schema: {
14
18
  type: null;
15
19
  required: true;
16
20
  };
21
+ data: {
22
+ type: null;
23
+ required: true;
24
+ };
17
25
  }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
18
26
  type __VLS_Slots = {
19
- inputs?: ((props: {}) => any) | undefined;
20
- } & {
21
27
  actions?: ((props: {}) => any) | undefined;
22
28
  } & {
23
29
  inputs?: ((props: {}) => any) | undefined;
24
30
  } & {
25
- actions?: ((props: {}) => any) | undefined;
31
+ inputs?: ((props: {}) => any) | undefined;
26
32
  } & {
27
33
  extra?: ((props: {}) => any) | undefined;
28
34
  };
@@ -1,83 +1,87 @@
1
1
  <template>
2
2
  <div
3
3
  id="page-title"
4
- class="
5
- sticky -top-1 z-10 space-y-4 bg-body
6
- max-md:space-y-0 max-lg:space-y-2
7
- "
4
+ class="sticky -top-1 z-10 space-y-4 bg-body"
8
5
  >
9
- <div
10
- class="
11
- flex gap-2 items-start
12
- md:max-xl:items-center
13
- "
14
- >
6
+ <div class="flex justify-between items-center gap-2">
15
7
  <div
16
8
  class="
17
- w-full mt-1
18
- flex flex-row gap-2
19
- items-baseline justify-start
20
- xl:flex-col xl:mt-2
9
+ w-full flex justify-between
10
+ max-2xs:flex-col gap-2
21
11
  "
12
+ :class="{
13
+ 'max-2xs:flex-col': actions.length < earlyWrapActionsAt,
14
+ 'max-xs:flex-col': actions.length >= earlyWrapActionsAt
15
+ }"
22
16
  >
23
- <div class="grid">
24
- <h1 class="font-bold text-xl truncate">
25
- {{ l(title) }}
26
- </h1>
27
- </div>
28
- <div class="relative">
17
+ <div class="flex gap-4 items-center">
18
+ <Bake
19
+ v-if="icon"
20
+ name="icon"
21
+ :descriptor="icon"
22
+ class="min-w-16 max-md:hidden"
23
+ />
29
24
  <div
30
- data-testid="description"
31
25
  class="
32
- text-sm text-gray-600 dark:text-gray-400
33
- text-nowrap overflow-hidden
34
- hidden xl:grid
26
+ w-full mt-1
27
+ flex flex-row
28
+ items-center justify-start
29
+ md:flex-col md:items-start md:mt-2
30
+ max-md:gap-2
35
31
  "
36
32
  >
37
- <span class="truncate">
38
- {{ l(description) || '&nbsp;' }}
39
- </span>
33
+ <AwaitLoading
34
+ :skeleton="{
35
+ width: '15rem',
36
+ height: '1.75rem',
37
+ class: 'max-xs:max-w-[5rem]'
38
+ }"
39
+ >
40
+ <div class="grid">
41
+ <h1 class="font-bold text-xl truncate">
42
+ {{ title }}
43
+ </h1>
44
+ </div>
45
+ </AwaitLoading>
46
+ <PageTitleDescription
47
+ :info-fields
48
+ :description
49
+ />
40
50
  </div>
41
- <Button
42
- v-if="description"
43
- v-tooltip.focus.bottom="{ value: l(description) }"
44
- class="xl:hidden"
45
- icon="pi pi-info-circle"
46
- variant="text"
47
- size="small"
48
- rounded
51
+ </div>
52
+ <div
53
+ v-if="actions.length || $slots.actions"
54
+ class="
55
+ actions
56
+ min-w-min flex gap-2 row-span-2 items-end text-nowrap
57
+ max-xs:text-xs max-md:text-sm
58
+ md:max-md:items-center md:pt-6
59
+ "
60
+ >
61
+ <Bake
62
+ v-for="action in actions"
63
+ :key="action.schema.name"
64
+ :name="`actions/${action.schema.name}`"
65
+ :descriptor="action"
49
66
  />
67
+ <slot name="actions" />
50
68
  </div>
51
69
  </div>
52
70
  <div
71
+ v-if="$slots.inputs"
53
72
  v-focustrap
54
73
  class="
55
74
  min-w-min flex gap-2 row-span-2 items-end text-nowrap
56
- max-lg:text-sm md:max-xl:items-center xl:pt-6
75
+ max-md:text-sm md:max-md:items-center md:pt-6
57
76
  "
58
77
  >
59
- <template v-if="isMd">
60
- <slot
61
- v-if="$slots.inputs"
62
- name="inputs"
63
- />
64
- <Bake
65
- v-for="action in actions"
66
- :key="action.schema.name"
67
- :name="`actions/${action.schema.name}`"
68
- :descriptor="action"
69
- />
70
- <slot
71
- v-if="$slots.actions"
72
- name="actions"
73
- />
78
+ <template v-if="isLg">
79
+ <slot name="inputs" />
74
80
  </template>
75
81
  <template v-else>
76
82
  <Button
77
- v-if="$slots.inputs"
78
83
  variant="text"
79
84
  icon="pi pi-filter"
80
- class="lg:hidden"
81
85
  rounded
82
86
  @click="togglePopoverInputs"
83
87
  />
@@ -87,44 +91,12 @@
87
91
  >
88
92
  <div
89
93
  class="
90
- flex flex-col flex-start
91
- justify-between w-full
92
- gap-4 text-sm px-2 py-2"
93
- >
94
- <slot
95
- v-if="$slots.inputs"
96
- name="inputs"
97
- />
98
- </div>
99
- </PersistentPopover>
100
- <Button
101
- v-if="$slots.actions || actions?.length > 0"
102
- variant="text"
103
- icon="pi pi-ellipsis-h"
104
- class="lg:hidden"
105
- rounded
106
- @click="togglePopoverActions"
107
- />
108
- <PersistentPopover
109
- ref="popoverActions"
110
- fixed
111
- >
112
- <div
113
- class="
114
- flex flex-col flex-start
115
- justify-between w-full min-w-52
116
- gap-4 text-sm px-2 py-2"
94
+ flex flex-col flex-start
95
+ justify-between w-full
96
+ gap-4 text-sm px-2 py-2
97
+ "
117
98
  >
118
- <Bake
119
- v-for="action in actions"
120
- :key="action.schema.name"
121
- :name="`actions/${action.schema.name}`"
122
- :descriptor="action"
123
- />
124
- <slot
125
- v-if="$slots.actions"
126
- name="actions"
127
- />
99
+ <slot name="inputs" />
128
100
  </div>
129
101
  </PersistentPopover>
130
102
  </template>
@@ -140,15 +112,17 @@ import { Button } from "primevue";
140
112
  import { useRuntimeConfig } from "#app";
141
113
  import { useBreakpoints, useHead, useLocalization } from "#imports";
142
114
  import { Bake, PersistentPopover } from "#components";
143
- const { isMd } = useBreakpoints();
115
+ const { isLg } = useBreakpoints();
144
116
  const { localize: l } = useLocalization();
145
117
  const { public: { components } } = useRuntimeConfig();
146
- const { schema } = defineProps({
147
- schema: { type: null, required: true }
118
+ const { schema, data } = defineProps({
119
+ schema: { type: null, required: true },
120
+ data: { type: null, required: true }
148
121
  });
149
- const { title, description, actions } = schema;
122
+ const { actions, description, earlyWrapActionsAt = 4, icon, infoFields, localizeTitle, titleProp } = schema;
123
+ const titleData = titleProp ? data?.[titleProp] : data;
124
+ const title = titleData ? localizeTitle ? l(titleData) : titleData : "...";
150
125
  const popoverInputs = ref();
151
- const popoverActions = ref();
152
126
  useHead({
153
127
  title: components?.Page?.title ? `${components.Page.title} - ${title}` : title
154
128
  });
@@ -163,16 +137,15 @@ onMounted(() => {
163
137
  e.target,
164
138
  e.intersectionRatio < 1,
165
139
  [
140
+ "sticked",
166
141
  "-mx-4",
167
- "px-4",
168
- "pb-4",
142
+ "-mb-4",
143
+ "p-4",
169
144
  "border-b",
170
145
  "border-slate-300",
171
146
  "dark:border-zinc-800",
172
147
  "drop-shadow",
173
- "z-[9]",
174
- "md:max-xl:pt-4",
175
- "max-md:pt-2"
148
+ "z-[9]"
176
149
  ]
177
150
  );
178
151
  },
@@ -192,11 +165,12 @@ function toggleClasses(element, toggle, classes) {
192
165
  function togglePopoverInputs(event) {
193
166
  popoverInputs.value.toggle(event);
194
167
  }
195
- function togglePopoverActions(event) {
196
- popoverActions.value.toggle(event);
197
- }
198
168
  </script>
199
169
 
200
170
  <style scoped>
201
171
  .sticky{top:-1px}
202
172
  </style>
173
+
174
+ <style>
175
+ .b-component--PageTitle .p-button{@apply self-stretch}.b-component--PageTitle .p-button .p-button-icon+.p-button-label{@apply max-sm:hidden}
176
+ </style>
@@ -9,20 +9,26 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
9
9
  type: null;
10
10
  required: true;
11
11
  };
12
+ data: {
13
+ type: null;
14
+ required: true;
15
+ };
12
16
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
17
  schema: {
14
18
  type: null;
15
19
  required: true;
16
20
  };
21
+ data: {
22
+ type: null;
23
+ required: true;
24
+ };
17
25
  }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
18
26
  type __VLS_Slots = {
19
- inputs?: ((props: {}) => any) | undefined;
20
- } & {
21
27
  actions?: ((props: {}) => any) | undefined;
22
28
  } & {
23
29
  inputs?: ((props: {}) => any) | undefined;
24
30
  } & {
25
- actions?: ((props: {}) => any) | undefined;
31
+ inputs?: ((props: {}) => any) | undefined;
26
32
  } & {
27
33
  extra?: ((props: {}) => any) | undefined;
28
34
  };
@@ -0,0 +1,24 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ description: {
5
+ type: StringConstructor;
6
+ default: null;
7
+ };
8
+ infoFields: {
9
+ type: ArrayConstructor;
10
+ default: () => never[];
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ description: {
14
+ type: StringConstructor;
15
+ default: null;
16
+ };
17
+ infoFields: {
18
+ type: ArrayConstructor;
19
+ default: () => never[];
20
+ };
21
+ }>> & Readonly<{}>, {
22
+ description: string;
23
+ infoFields: unknown[];
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div
3
+ class="
4
+ relative h-8 flex items-center gap-2
5
+ text-sm text-gray-600 dark:text-gray-400
6
+ "
7
+ >
8
+ <AwaitLoading :skeleton="{ width: '10rem' }">
9
+ <div
10
+ v-for="field in infoFields"
11
+ :key="field.key"
12
+ class="flex gap-1 items-center text-nowrap max-xs:hidden"
13
+ >
14
+ <span class="max-md:hidden">{{ l(field.label) }}:</span>
15
+ <Bake
16
+ :name="`fields-${field.key}`"
17
+ :descriptor="field.component"
18
+ class="lg:font-bold"
19
+ />
20
+ </div>
21
+ </AwaitLoading>
22
+ <template v-if="description">
23
+ <div
24
+ class="flex gap-2 items-center"
25
+ :class="{
26
+ 'max-md:hidden': !infoFields.length,
27
+ 'max-xl:hidden ml-2': infoFields.length
28
+ }"
29
+ >
30
+ <i
31
+ v-if="infoFields.length"
32
+ class="text-sm pi pi-info-circle"
33
+ />
34
+ <div
35
+ data-testid="description"
36
+ class="grid text-nowrap overflow-hidden"
37
+ >
38
+ <span class="truncate">
39
+ {{ l(description) }}
40
+ </span>
41
+ </div>
42
+ </div>
43
+ <Button
44
+ v-tooltip.focus.bottom="{ value: l(description) }"
45
+ :class="{
46
+ 'md:hidden': !infoFields.length,
47
+ 'xl:hidden': infoFields.length
48
+ }"
49
+ icon="pi pi-info-circle"
50
+ variant="text"
51
+ size="small"
52
+ rounded
53
+ />
54
+ </template>
55
+ </div>
56
+ </template>
57
+
58
+ <script setup>
59
+ import { useLocalization } from "#imports";
60
+ import { Button } from "primevue";
61
+ const { localize: l } = useLocalization();
62
+ const { description, infoFields } = defineProps({
63
+ description: { type: String, default: null },
64
+ infoFields: { type: Array, default: () => [] }
65
+ });
66
+ </script>
@@ -0,0 +1,24 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ description: {
5
+ type: StringConstructor;
6
+ default: null;
7
+ };
8
+ infoFields: {
9
+ type: ArrayConstructor;
10
+ default: () => never[];
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ description: {
14
+ type: StringConstructor;
15
+ default: null;
16
+ };
17
+ infoFields: {
18
+ type: ArrayConstructor;
19
+ default: () => never[];
20
+ };
21
+ }>> & Readonly<{}>, {
22
+ description: string;
23
+ infoFields: unknown[];
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -27,17 +27,15 @@
27
27
  <script setup>
28
28
  import { computed } from "vue";
29
29
  import { Button } from "primevue";
30
- import { useContext, useLocalization } from "#imports";
30
+ import { useContext, useLocalization, useUiStates } from "#imports";
31
31
  import { AwaitLoading } from "#components";
32
32
  const context = useContext();
33
33
  const { localize: lc } = useLocalization({ group: "Paginator" });
34
+ const { value: { paginatorStates } } = useUiStates();
34
35
  const { data } = defineProps({
35
36
  data: { type: null, required: true }
36
37
  });
37
38
  const model = defineModel({ type: null, required: true });
38
- const path = context.injectPath();
39
- const takeStateKey = path + ".take";
40
- const contextData = context.injectContextData();
41
39
  const allowPrevious = computed(() => !Number.isNaN(page.value) && page.value > 1);
42
40
  const allowNext = computed(() => !Number.isNaN(page.value) && data.length >= data.take);
43
41
  const page = computed({
@@ -46,8 +44,12 @@ const page = computed({
46
44
  model.value = (value - 1) * Number(data.take);
47
45
  }
48
46
  });
49
- if (data && contextData.page[takeStateKey] !== data.take) {
50
- contextData.page[takeStateKey] = data.take;
51
- page.value = 1;
47
+ const path = context.injectPath();
48
+ const previousTake = paginatorStates[`${path}.previousTake`];
49
+ if (data && data.take && previousTake !== data.take) {
50
+ paginatorStates[`${path}.previousTake`] = data.take;
51
+ if (previousTake) {
52
+ page.value = 1;
53
+ }
52
54
  }
53
55
  </script>
@@ -25,9 +25,7 @@
25
25
  class="w-full"
26
26
  >
27
27
  <template #value="slotProps">
28
- <span>
29
- {{ getValueLabel(slotProps) }}
30
- </span>
28
+ <span>{{ getValueLabel(slotProps) }}</span>
31
29
  </template>
32
30
  <template #option="slotProps">
33
31
  <span>{{ getOptionLabel(slotProps) }}</span>
@@ -71,7 +69,7 @@ function getOptionLabel(slotProps) {
71
69
  }
72
70
  function getValueLabel(slotProps) {
73
71
  const result = slotProps.value?.[optionLabel] ?? slotProps.value ?? label;
74
- return localizeLabel ? l(result) : result;
72
+ return (localizeLabel ? l(result) : result) ?? "\xA0";
75
73
  }
76
74
  function getModel() {
77
75
  return targetProp ? model.value?.[targetProp] : model.value;
@@ -107,5 +107,5 @@ function setSelected(value) {
107
107
  </style>
108
108
 
109
109
  <style scoped>
110
- &:has(.p-iftalabel) .p-iftalabel{@apply mt-2}
110
+ &:has(.p-iftalabel) .p-iftalabel{@apply mt-2}.grid .flex .b-component--SelectButton{@apply self-end}
111
111
  </style>
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div class="flex flex-col gap-4">
3
- <PageTitle :schema="title">
3
+ <Bake
4
+ name="title"
5
+ :descriptor="title"
6
+ >
4
7
  <template
5
8
  v-if="inputs?.length > 0"
6
9
  #inputs
@@ -34,7 +37,7 @@
34
37
  </TabList>
35
38
  </Tabs>
36
39
  </template>
37
- </PageTitle>
40
+ </Bake>
38
41
  <Message
39
42
  v-if="showRequiredMessage"
40
43
  severity="info"
@@ -69,7 +72,7 @@
69
72
  import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue";
70
73
  import { Message, Tab, TabList, Tabs } from "primevue";
71
74
  import { useContext, useLocalization, useReactionHandler } from "#imports";
72
- import { Bake, Contents, DeferredTabContent, Inputs, PageTitle } from "#components";
75
+ import { Bake, Contents, DeferredTabContent, Inputs } from "#components";
73
76
  const context = useContext();
74
77
  const { localize: l } = useLocalization();
75
78
  const { localize: lc } = useLocalization({ group: "TabbedPage" });
@@ -1,9 +1,11 @@
1
1
  export default function _default(): import("vue").Ref<{
2
2
  panelStates: {};
3
+ paginatorStates: {};
3
4
  selectStates: {};
4
5
  selectButtonStates: {};
5
6
  }, {
6
7
  panelStates: {};
8
+ paginatorStates: {};
7
9
  selectStates: {};
8
10
  selectButtonStates: {};
9
11
  }>;
@@ -3,6 +3,7 @@ import { useState } from "#imports";
3
3
  export default function() {
4
4
  return useState("uiStates", () => ({
5
5
  panelStates: { },
6
+ paginatorStates: { },
6
7
  selectStates: { },
7
8
  selectButtonStates: { }
8
9
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Baked is an opinionated framework for .NET and Vue. This is the UI package of Baked project.",
5
5
  "keywords": [
6
6
  "baked",