@mouseless/baked 1.8.4 → 1.8.5

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.8.4",
4
+ "version": "1.8.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
@@ -3,7 +3,7 @@
3
3
  dark:bg-red-950/95 dark:text-red-500 dark:border-red-700/65}.b-component--Message.message-warn{@apply bg-yellow-50/95 text-yellow-600 border-yellow-200
4
4
  dark:bg-yellow-950/95 dark:text-yellow-500 dark:border-yellow-700/65}.b-component--Message.message-success{@apply bg-green-50/95 text-green-600 border-green-200
5
5
  dark:bg-green-950/95 dark:text-green-500 dark:border-green-700/65}.b-component--Message.message-secondary{@apply bg-transparent text-slate-500 border-slate-500
6
- dark:text-slate-400 dark:border-slate-400}.b-component--Message.message-contrast{@apply bg-transparent text-slate-950 border-slate-950
6
+ dark:text-zinc-400 dark:border-zinc-400}.b-component--Message.message-contrast{@apply bg-transparent text-slate-950 border-slate-950
7
7
  dark:text-white dark:border-white}.c--missing-component-dialog code:not(:has(pre)){@apply rounded p-1 text-xs bg-zinc-50 text-orange-700
8
8
  dark:bg-zinc-950 dark:text-orange-400}.c--missing-component-dialog pre{@apply block rounded-lg overflow-auto max-h-[20em]
9
9
  bg-zinc-950 p-4 text-xs text-sky-300}.c--missing-component-dialog pre .c--code-comment{@apply text-green-800}.c--missing-component-dialog pre .c--code-string{@apply text-orange-400}.c--missing-component-dialog pre .c--code-keyword{@apply text-purple-400}.c--missing-component-dialog pre .c--code-symbol{@apply text-gray-100}.c--missing-component-dialog pre .c--code-type{@apply text-blue-400}.c--missing-component-dialog pre .c--code-method{@apply text-yellow-100}.p-scrolltop{@apply right-6 bottom-6 max-md:bottom-24 py-icon-only-width}.b-component--Select .p-placeholder{@apply opacity-0}.b-component--Select .p-select-label{@apply text-[length:inherit]}.p-popover-content .b-component--Select{@apply max-md:w-full}.b-component--SelectButton .p-togglebutton-content{@apply whitespace-nowrap}.p-popover-content .b-component--SelectButton .p-selectbutton,.p-popover-content .b-component--SelectButton.p-selectbutton{@apply max-sm:flex max-sm:flex-col}.p-popover-content .b-component--SelectButton .p-selectbutton .p-togglebutton:first-child,.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:first-child{@apply max-sm:rounded-t-lg max-sm:rounded-es-none}.p-popover-content .b-component--SelectButton .p-selectbutton .p-togglebutton:last-child,.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:last-child{@apply max-sm:rounded-b-lg max-sm:rounded-se-none}.b-component--SimpleForm.horizontal :has(.p-iftalabel) .p-button[data-p=large]{@apply mt-1}.b-component--SimpleForm.horizontal :has(.p-iftalabel) .p-button:not([data-p=large]){@apply mt-2}.b-component--PageSize .p-select-label{@apply text-[length:inherit]}.b-component--PageTitle .p-button{@apply self-stretch}.b-component--PageTitle .p-button .p-button-icon+.p-button-label{@apply max-sm:hidden}.p-popover-content>div{@apply max-sm:p-0}}
@@ -164,6 +164,9 @@ async function executeAction(newModel) {
164
164
  if (!descriptor.action) {
165
165
  return;
166
166
  }
167
+ if (descriptor.actionSkipsEmptyModel && isEmpty(newModel)) {
168
+ return;
169
+ }
167
170
  try {
168
171
  executing.value = true;
169
172
  await actionExecuter.execute({
@@ -180,4 +183,16 @@ async function executeAction(newModel) {
180
183
  executing.value = false;
181
184
  }
182
185
  }
186
+ function isEmpty(value) {
187
+ if (value === null || value === void 0) {
188
+ return true;
189
+ }
190
+ if (typeof value === "string" && value.trim() === "") {
191
+ return true;
192
+ }
193
+ if (Array.isArray(value) && value.length === 0) {
194
+ return true;
195
+ }
196
+ return false;
197
+ }
183
198
  </script>
@@ -2,12 +2,19 @@
2
2
  <div
3
3
  class="
4
4
  b-message
5
- grid grid-cols-[1fr_auto] gap-2
5
+ grid grid-cols-[1fr_auto]
6
6
  items-center
7
+ md:gap-2
8
+ max-md:flex max-md:flex-col max-md:space-between
7
9
  "
8
10
  :class="[`message-${severity}`, `message-${variant}`]"
9
11
  >
10
- <div class="min-h-0">
12
+ <div
13
+ class="
14
+ min-h-0
15
+ max-md:w-full
16
+ "
17
+ >
11
18
  <div
12
19
  :class="sizeClass"
13
20
  class="
@@ -31,10 +38,14 @@
31
38
  </div>
32
39
  <div
33
40
  v-if="action"
34
- class="b-message-action p-2"
41
+ class="
42
+ b-message-action p-2
43
+ max-md:w-full
44
+ "
35
45
  >
36
46
  <Bake
37
47
  name="action"
48
+ class="max-md:w-full"
38
49
  :descriptor="{ ...action, schema: { ...action.schema, severity } }"
39
50
  />
40
51
  </div>
@@ -1,5 +1,5 @@
1
1
  import { useRuntimeConfig } from "#app";
2
- import { useComposableResolver, useDataFetcher, usePathBuilder, useUnref } from "#imports";
2
+ import { useComposableResolver, useContext, useDataFetcher, usePathBuilder, useUnref, useValidation } from "#imports";
3
3
  import { bfetch } from "../utils/bfetch.js";
4
4
 
5
5
  export default function() {
@@ -36,9 +36,14 @@ function Composite({ actionExecuter }) {
36
36
  function Local() {
37
37
  const composableResolver = useComposableResolver();
38
38
  const dataFetcher = useDataFetcher();
39
+ const validation = useValidation();
40
+ const context = useContext();
41
+
42
+ const mutableValidation = validation.injectMutable();
43
+ const events = context.injectEvents();
39
44
 
40
45
  async function execute({ action, contextData }) {
41
- const composable = composableResolver.resolve(action.composable).default();
46
+ const composable = composableResolver.resolve(action.composable).default({ mutableValidation, events });
42
47
 
43
48
  if(composable.run) {
44
49
  const options = action.options ? await dataFetcher.fetch({ data: action.options, contextData }) : { };
@@ -106,4 +111,4 @@ function Remote({ actionExecuter }) {
106
111
  return {
107
112
  execute
108
113
  };
109
- }
114
+ }
@@ -11,7 +11,7 @@ export default function _default(): {
11
11
  handle?: boolean | undefined;
12
12
  }) => import("vue").Ref<{}, {}>;
13
13
  provideError: (error: any) => import("vue").Ref<boolean, boolean>;
14
- injectEvents: () => any;
14
+ injectEvents: () => null;
15
15
  provideEvents: (value: any) => void;
16
16
  injectExecuting: () => import("vue").Ref<boolean, boolean>;
17
17
  provideExecuting: (value: any) => void;
@@ -48,7 +48,7 @@ export default function() {
48
48
  }
49
49
 
50
50
  function injectEvents() {
51
- return inject("__bake_events");
51
+ return inject("__bake_events", null);
52
52
  }
53
53
 
54
54
  function provideEvents(value) {
@@ -20,7 +20,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
20
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
-
24
23
  */
25
24
 
26
25
  import { isRef, unref } from "vue";
@@ -29,7 +28,7 @@ const isObject = val => val !== null && typeof val === "object";
29
28
  const isArray = Array.isArray;
30
29
 
31
30
  /**
32
- * Deeply unref a value, recursing into objects and arrays.
31
+ * Deeply unref a value, recursing into objects, plain object and arrays.
33
32
  *
34
33
  * @param {Mixed} val - The value to deeply unref.
35
34
  *
@@ -38,7 +37,7 @@ const isArray = Array.isArray;
38
37
  const deepUnref = val => {
39
38
  const checkedVal = isRef(val) ? unref(val) : val;
40
39
 
41
- if(! isObject(checkedVal)) {
40
+ if(!isObject(checkedVal)) {
42
41
  return checkedVal;
43
42
  }
44
43
 
@@ -46,9 +45,26 @@ const deepUnref = val => {
46
45
  return unrefArray(checkedVal);
47
46
  }
48
47
 
48
+ if(!isPlainObject(checkedVal)) {
49
+ return checkedVal;
50
+ }
51
+
49
52
  return unrefObject(checkedVal);
50
53
  };
51
54
 
55
+ /**
56
+ * Is this value a plain object?
57
+ *
58
+ * @param {Object} val - The object to check.
59
+ *
60
+ * @return {Boolean}
61
+ */
62
+ const isPlainObject = val => {
63
+ const proto = Object.getPrototypeOf(val);
64
+
65
+ return proto === Object.prototype || proto === null;
66
+ };
67
+
52
68
  /**
53
69
  * Unref a value, recursing into it if it's an object.
54
70
  *
@@ -58,7 +74,7 @@ const deepUnref = val => {
58
74
  */
59
75
  const smartUnref = val => {
60
76
  // Non-ref object? Go deeper!
61
- if(val !== null && ! isRef(val) && typeof val === "object") {
77
+ if(val !== null && !isRef(val) && typeof val === "object") {
62
78
  return deepUnref(val);
63
79
  }
64
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
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",