@mouseless/baked 1.6.1 → 1.6.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.6.1",
4
+ "version": "1.6.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -6,6 +6,7 @@
6
6
  :label="l(label)"
7
7
  :rounded
8
8
  :severity
9
+ :size
9
10
  :variant
10
11
  @click="$emit('submit')"
11
12
  />
@@ -21,6 +22,6 @@ const { schema } = defineProps({
21
22
  ready: { type: Boolean, default: true }
22
23
  });
23
24
  defineEmits(["submit"]);
24
- const { icon, label, rounded, severity = "secondary", variant } = schema;
25
+ const { icon, label, rounded, severity = "secondary", size, variant } = schema;
25
26
  const executing = context.injectExecuting();
26
27
  </script>
@@ -7,19 +7,36 @@
7
7
  "
8
8
  >
9
9
  <div
10
- v-if="inputs.length > 0"
11
- class="
12
- py-2 px-4
13
- bg-transparent
14
- rounded-none text-sm
15
- flex gap-2 items-center justify-end
16
- "
10
+ v-if="actions.length || inputs.length"
11
+ class="w-full flex justify-between py-2 px-4"
17
12
  >
18
- <Inputs
19
- :inputs="inputs"
20
- @ready="onReady"
21
- @changed="onChanged"
22
- />
13
+ <div
14
+ class="
15
+ min-w-min flex gap-2 row-span-2 items-end text-nowrap
16
+ max-xs:text-xs max-md:text-sm
17
+ md:max-md:items-center
18
+ "
19
+ >
20
+ <Bake
21
+ v-for="action in actions"
22
+ :key="action.schema.name"
23
+ :name="`actions/${action.schema.name}`"
24
+ :descriptor="action"
25
+ />
26
+ </div>
27
+ <div
28
+ class="
29
+ bg-transparent
30
+ rounded-none text-sm
31
+ flex gap-2 items-center justify-end
32
+ "
33
+ >
34
+ <Inputs
35
+ :inputs="inputs"
36
+ @ready="onReady"
37
+ @changed="onChanged"
38
+ />
39
+ </div>
23
40
  </div>
24
41
  <div
25
42
  class="p-4 [contain:inline-size]"
@@ -49,7 +66,7 @@ const { localize: lc } = useLocalization({ group: "DataContainer" });
49
66
  const { schema } = defineProps({
50
67
  schema: { type: null, required: true }
51
68
  });
52
- const { content, inputs } = schema;
69
+ const { actions = [], content, inputs } = schema;
53
70
  const contextData = context.injectContextData();
54
71
  const loaded = ref(true);
55
72
  const ready = ref(inputs.length === 0);
@@ -68,5 +85,5 @@ function onChanged(event) {
68
85
  </script>
69
86
 
70
87
  <style>
71
- .p-panel-content:has(.b-component--DataContainer) .b-component--DataContainer{@apply border-none rounded-none}.b-component--DataContainer div{@apply [&:has(.p-datatable)]:p-0}
88
+ .p-panel-content:has(.b-component--DataContainer) .b-component--DataContainer{@apply border-none rounded-none}.b-component--DataContainer div{@apply [&:has(.p-datatable)]:p-0}.b-component--DataContainer .p-button{@apply self-stretch}.b-component--DataContainer .p-button .p-button-icon+.p-button-label{@apply max-sm:hidden}
72
89
  </style>
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <div
3
- class="b-message grid"
3
+ class="
4
+ b-message
5
+ grid grid-cols-[1fr_auto] gap-2
6
+ items-center
7
+ "
4
8
  :class="[`message-${severity}`, `message-${variant}`]"
5
9
  >
6
10
  <div class="min-h-0">
@@ -25,18 +29,27 @@
25
29
  <slot name="content" />
26
30
  </div>
27
31
  </div>
32
+ <div
33
+ v-if="action"
34
+ class="b-message-action px-2"
35
+ >
36
+ <Bake
37
+ name="action"
38
+ :descriptor="{ ...action, schema: { ...action.schema, severity } }"
39
+ />
40
+ </div>
28
41
  </div>
29
42
  </template>
30
43
 
31
44
  <script setup>
32
45
  import { computed, useLocalization } from "#imports";
33
- import { AwaitLoading } from "#components";
46
+ import { AwaitLoading, Bake } from "#components";
34
47
  const { localize: l } = useLocalization();
35
48
  const { schema, data } = defineProps({
36
49
  schema: { type: null, required: true },
37
50
  data: { type: null, required: true }
38
51
  });
39
- const { icon, localizeMessage, severity = "info", size, variant = "outlined" } = schema;
52
+ const { action, icon, localizeMessage, severity = "info", size, variant = "outlined" } = schema;
40
53
  const sizeClass = computed(() => {
41
54
  switch (size) {
42
55
  case "small":
@@ -50,7 +63,7 @@ const sizeClass = computed(() => {
50
63
  </script>
51
64
 
52
65
  <style scoped>
53
- .message-outlined{@apply border rounded-md}.message-outlined .b-message-body{@apply py-[0.50rem] px-[0.75rem] min-w-[10rem] min-h-[1.5rem]}.message-simple{@apply !bg-transparent}.message-simple .b-message-body{@apply px-0}.message-info{@apply bg-blue-50/95 text-blue-600 border-blue-200
66
+ .message-outlined{@apply border rounded-md}.message-outlined .b-message-body{@apply py-[0.50rem] px-[0.75rem] min-w-[10rem] min-h-[1.5rem]}.message-simple{@apply !bg-transparent}.message-simple .b-message-icon{@apply text-sm}.message-simple .b-message-body{@apply px-0}.message-info{@apply bg-blue-50/95 text-blue-600 border-blue-200
54
67
  dark:bg-blue-950/95 dark:text-blue-500 dark:border-blue-700/65}.message-error{@apply bg-red-50/95 text-red-600 border-red-200
55
68
  dark:bg-red-950/95 dark:text-red-500 dark:border-red-700/65}.message-warn{@apply bg-yellow-50/95 text-yellow-600 border-yellow-200
56
69
  dark:bg-yellow-950/95 dark:text-yellow-500 dark:border-yellow-700/65}.message-success{@apply bg-green-50/95 text-green-600 border-green-200
@@ -55,12 +55,16 @@
55
55
  <template v-else>
56
56
  <div
57
57
  v-bind="$attrs"
58
- class="flex flex-col gap-8"
58
+ class="flex flex-col gap-4"
59
+ :class="{ 'gap-8': !horizontal }"
59
60
  >
60
- <h1 class="font-bold text-xl truncate">
61
+ <h2 class="font-bold text-xl truncate">
61
62
  {{ l(title) }}
62
- </h1>
63
- <div class="flex flex-col gap-4">
63
+ </h2>
64
+ <div
65
+ class="flex gap-4"
66
+ :class="{ 'flex-col': !horizontal }"
67
+ >
64
68
  <Inputs
65
69
  v-if="inputs"
66
70
  :inputs
@@ -69,21 +73,23 @@
69
73
  @ready="onReady"
70
74
  @changed="onChanged"
71
75
  />
76
+ <Button
77
+ ref="submitRef"
78
+ v-tooltip.top="{
79
+ disabled: !showValidationSummary,
80
+ value: messages,
81
+ pt: { text: 'text-sm' }
82
+ }"
83
+ :schema="submit"
84
+ :ready
85
+ class="min-w-min"
86
+ :class="{ 'mt-4': !horizontal && inputs.length }"
87
+ @submit="$emit('submit', model)"
88
+ />
89
+ <ErrorPopover ref="errorPopoverRef">
90
+ <InlineError :error />
91
+ </ErrorPopover>
72
92
  </div>
73
- <Button
74
- ref="submitRef"
75
- v-tooltip.top="{
76
- disabled: !showValidationSummary,
77
- value: messages,
78
- pt: { text: 'text-sm' }
79
- }"
80
- :schema="submit"
81
- :ready
82
- @submit="$emit('submit', model)"
83
- />
84
- <ErrorPopover ref="errorPopoverRef">
85
- <InlineError :error />
86
- </ErrorPopover>
87
93
  </div>
88
94
  </template>
89
95
  </template>
@@ -100,7 +106,7 @@ const { schema } = defineProps({
100
106
  schema: { type: null, required: true }
101
107
  });
102
108
  const emit = defineEmits(["submit"]);
103
- const { dialogOptions, inputs, submit, title, validations = [], showValidationSummary = false } = schema;
109
+ const { dialogOptions, inputs, horizontal, submit, title, validations = [], showValidationSummary = false } = schema;
104
110
  const model = ref({});
105
111
  const readyData = ref({});
106
112
  const submitted = ref(false);
@@ -14,10 +14,13 @@
14
14
  >
15
15
  <Message
16
16
  v-if="message"
17
+ :key="`${severity}:${icon}`"
18
+ icon="pi pi-info-circle"
17
19
  :schema="{
18
- severity: severity,
20
+ severity,
19
21
  variant: 'simple',
20
- size: 'small'
22
+ size: 'small',
23
+ icon
21
24
  }"
22
25
  :data="message || ''"
23
26
  class="ml-3"
@@ -45,4 +48,5 @@ const message = computed(() => {
45
48
  return null;
46
49
  });
47
50
  const severity = computed(() => mutableValidation?.value.severity || validation?.value.severity);
51
+ const icon = computed(() => mutableValidation?.value.icon || validation?.value.icon);
48
52
  </script>
@@ -74,7 +74,8 @@ function On({ evaluate, eventId, events }) {
74
74
 
75
75
  function When({ contextData, evaluate }) {
76
76
  function bind({ trigger, react }) {
77
- watch(() => contextData.page[trigger.when], async value => {
77
+ watch(() => contextData[trigger.key ?? "page"][trigger.when], async value => {
78
+ react(false);
78
79
  react(await evaluate(trigger.constraint, value));
79
80
  }, { immediate: true });
80
81
 
@@ -11,5 +11,9 @@ export default function _default(): {
11
11
  injectMutable: () => {
12
12
  clear: () => void;
13
13
  setError: (message: any) => void;
14
+ setMessage: (message: any, { persist, severity, icon }?: {
15
+ persist?: boolean | undefined;
16
+ severity?: string | undefined;
17
+ }) => void;
14
18
  } | null;
15
19
  };
@@ -38,7 +38,7 @@ export default function() {
38
38
 
39
39
  const messages = computed(() =>
40
40
  [...Object.values(validations.value), ...Object.values(mutableValidations).map(v => v.value)]
41
- .filter(v => v.message)
41
+ .filter(v => v.message && v.severity === "error")
42
42
  .map((v, i) => `${i > 0 ? "\n" : ""} - ${v.message}`)
43
43
  .join("")
44
44
  );
@@ -67,13 +67,20 @@ function MutableValidation(ref) {
67
67
  }
68
68
 
69
69
  function setError(message) {
70
- ref.value.valid = false;
70
+ setMessage(message, { persist: true, severity: "error" });
71
+ }
72
+
73
+ function setMessage(message, { persist = false, severity = "secondary", icon } = {}) {
74
+ ref.value.valid = severity !== "error";
71
75
  ref.value.message = message;
72
- ref.value.severity = "error";
76
+ ref.value.persist = persist;
77
+ ref.value.severity = severity;
78
+ ref.value.icon = icon;
73
79
  }
74
80
 
75
81
  return {
76
82
  clear,
77
- setError
83
+ setError,
84
+ setMessage
78
85
  };
79
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
- "version": "1.6.1",
3
+ "version": "1.6.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",
@@ -47,6 +47,7 @@
47
47
  "@nuxtjs/tailwindcss": "6.14.0",
48
48
  "@primeuix/themes": "2.0.3",
49
49
  "async-mutex": "0.5.0",
50
+ "playwright": "^1.60.0",
50
51
  "primeicons": "7.0.0",
51
52
  "primevue": "4.5.5"
52
53
  },
@@ -71,4 +72,4 @@
71
72
  "@oxc-parser/binding-linux-x64-musl": "0.133.0",
72
73
  "@oxc-parser/binding-win32-x64-msvc": "0.133.0"
73
74
  }
74
- }
75
+ }