@marianmeres/stuic 1.88.0 → 1.90.0

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.
@@ -75,6 +75,7 @@ const _isFn = (v) => typeof v === "function";
75
75
  <script>const { ALERT, CONFIRM, PROMPT } = AlertConfirmPromptType;
76
76
  const clog = createClog("AlertConfirmPrompt");
77
77
  export let notifications = void 0;
78
+ export let notificationsRestProps = { forceAsHtml: true };
78
79
  export let notificationsPositionConfig = {};
79
80
  export let acp;
80
81
  export let forceAsHtml = void 0;
@@ -341,7 +342,11 @@ $:
341
342
  {/if}
342
343
 
343
344
  {#if notifications}
344
- <Notifications {notifications} {...notificationsPositionConfig || {}} />
345
+ <Notifications
346
+ {notifications}
347
+ {...notificationsRestProps || {}}
348
+ {...notificationsPositionConfig || {}}
349
+ />
345
350
  {/if}
346
351
  </dialog>
347
352
 
@@ -72,6 +72,7 @@ export declare class AlertConfirmPromptConfig {
72
72
  declare const __propDef: {
73
73
  props: {
74
74
  notifications?: ReturnType<typeof createNotificationsStore> | undefined;
75
+ notificationsRestProps?: any;
75
76
  notificationsPositionConfig?: Partial<{
76
77
  posX: NOTIFICATIONS_POSX;
77
78
  posXMobile: NOTIFICATIONS_POSX;
@@ -1,9 +1,10 @@
1
- <script context="module">import { createEventDispatcher } from "svelte";
1
+ <script context="module">import { createClog } from "@marianmeres/clog";
2
+ import { createEventDispatcher } from "svelte";
2
3
  import { slide } from "svelte/transition";
3
4
  import { twMerge } from "tailwind-merge";
4
5
  import {
5
- getId,
6
6
  Thc,
7
+ getId,
7
8
  validate as validateAction
8
9
  } from "../../index.js";
9
10
  const _emptyClasses = () => ({
@@ -72,7 +73,8 @@ export class FieldSelectConfig {
72
73
  }
73
74
  </script>
74
75
 
75
- <script>const dispatch = createEventDispatcher();
76
+ <script>const clog = createClog("FieldSelect");
77
+ const dispatch = createEventDispatcher();
76
78
  export let options = [];
77
79
  let _class = {};
78
80
  export { _class as class };
@@ -93,17 +95,24 @@ export let labelLeft = FieldSelectConfig.labelLeft;
93
95
  export let labelLeftWidth = FieldSelectConfig.labelLeftWidth;
94
96
  let validation;
95
97
  const setValidationResult = (res) => validation = res;
96
- let _options = [];
97
- $:
98
- _options = options.map((v) => {
99
- if (typeof v === "string") {
98
+ const _normalizeAndGroupOptions = (opts) => {
99
+ const groupped = /* @__PURE__ */ new Map();
100
+ opts.forEach((v) => {
101
+ if (typeof v === "string")
100
102
  v = { label: v };
101
- }
102
- if (v.value === void 0) {
103
+ if (v.value === void 0)
103
104
  v.value = v.label;
104
- }
105
- return v;
105
+ const optgLabel = v.optgroup || "";
106
+ if (!groupped.has(optgLabel))
107
+ groupped.set(optgLabel, []);
108
+ const optgroup = groupped.get(optgLabel);
109
+ optgroup.push(v);
106
110
  });
111
+ return groupped;
112
+ };
113
+ let _options;
114
+ $:
115
+ _options = _normalizeAndGroupOptions(options);
107
116
  let _inputEl;
108
117
  $:
109
118
  if (_inputEl)
@@ -202,8 +211,18 @@ $:
202
211
  on:mouseenter
203
212
  on:mouseleave
204
213
  >
205
- {#each _options as o, i}
206
- <option value={o.value}>{o.label}</option>
214
+ {#each _options as [_optgroup, _opts]}
215
+ {#if _optgroup}
216
+ <optgroup label={_optgroup}>
217
+ {#each _opts as o}
218
+ <option value={o.value}>{o.label}</option>
219
+ {/each}
220
+ </optgroup>
221
+ {:else}
222
+ {#each _opts as o}
223
+ <option value={o.value}>{o.label}</option>
224
+ {/each}
225
+ {/if}
207
226
  {/each}
208
227
  </select>
209
228
 
@@ -29,6 +29,7 @@ declare const __propDef: {
29
29
  options?: (string | {
30
30
  label: string;
31
31
  value?: string | undefined;
32
+ optgroup?: string | undefined;
32
33
  })[] | undefined;
33
34
  class?: FieldSelectConfigClasses | undefined;
34
35
  classBySize?: FieldSelectConfigClassesBySize | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "1.88.0",
3
+ "version": "1.90.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package && node ./scripts/date.js",