@humandialog/forms.svelte 1.7.8 → 1.7.10

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.
@@ -164,7 +164,7 @@ function on_click(e, operation) {
164
164
  else if (operation.toolbar)
165
165
  showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
166
166
  else if (operation.grid) {
167
- if (mobile)
167
+ if (false)
168
168
  showMenu(rect, operation.grid);
169
169
  else
170
170
  showGridMenu(rect, operation.grid);
@@ -121,7 +121,7 @@
121
121
  {@const col=col_span(operation.columns ?? 1)}
122
122
 
123
123
  <button class=" py-2.5 px-5 {col}
124
- text-base sm:text-xs font-medium text-stone-900 dark:text-stone-400 dark:hover:text-white
124
+ text-sm font-medium text-stone-900 dark:text-stone-400 dark:hover:text-white
125
125
  bg-stone-100 hover:bg-stone-200 dark:bg-stone-800 dark:hover:bg-stone-700 active:bg-stone-300 dark:active:bg-stone-600
126
126
  border rounded border-stone-200 dark:border-stone-600 focus:outline-none
127
127
  inline-flex items-center justify-center"
@@ -27,7 +27,7 @@ let menu_items = [];
27
27
  let submenus = [];
28
28
  let around_rect;
29
29
  let around_preference = 0;
30
- let css_position = "";
30
+ let css_position = "display: none";
31
31
  let closeButtonPos = "";
32
32
  $:
33
33
  display = visible ? "block" : "none";
@@ -308,7 +308,7 @@ function execute_action(e, operation, index) {
308
308
  if (operation.toolbar)
309
309
  showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
310
310
  else if (operation.grid) {
311
- if (mobile)
311
+ if (false)
312
312
  showMenu(rect, operation.grid);
313
313
  else
314
314
  showGridMenu(rect, operation.grid);
@@ -1181,8 +1181,11 @@ function getPaletteCommands() {
1181
1181
  on_choice: (range) => {
1182
1182
  if (range)
1183
1183
  editor.chain().focus().deleteRange(range).run();
1184
+ let stayFocused = false;
1184
1185
  if (exc.action)
1185
- exc.action();
1186
+ stayFocused = exc.action();
1187
+ if (!stayFocused)
1188
+ editor.commands.blur();
1186
1189
  },
1187
1190
  is_active: () => {
1188
1191
  if (exc.is_active)
@@ -1209,8 +1212,11 @@ function getPaletteCommands() {
1209
1212
  on_choice: (range) => {
1210
1213
  if (range)
1211
1214
  editor.chain().focus().deleteRange(range).run();
1215
+ let stayFocused = false;
1212
1216
  if (exc.action)
1213
- exc.action();
1217
+ stayFocused = exc.action();
1218
+ if (!stayFocused)
1219
+ editor.commands.blur();
1214
1220
  },
1215
1221
  is_active: () => {
1216
1222
  if (exc.is_active)
@@ -1233,8 +1239,11 @@ function getPaletteCommands() {
1233
1239
  on_choice: (range) => {
1234
1240
  if (range)
1235
1241
  editor.chain().focus().deleteRange(range).run();
1242
+ let stayFocused = false;
1236
1243
  if (exc.action)
1237
- exc.action();
1244
+ stayFocused = exc.action();
1245
+ if (!stayFocused)
1246
+ editor.commands.blur();
1238
1247
  },
1239
1248
  is_active: () => {
1240
1249
  if (exc.is_active)
@@ -1251,7 +1260,8 @@ function getPaletteCommands() {
1251
1260
 
1252
1261
 
1253
1262
 
1254
- <div bind:this={editorElement} />
1263
+ <div on:click
1264
+ bind:this={editorElement} />
1255
1265
 
1256
1266
  <Palette commands={getPaletteCommands()}
1257
1267
  bind:this={palette}
@@ -90,6 +90,8 @@ declare const __propDef: {
90
90
  hasChanged?: (() => boolean) | undefined;
91
91
  };
92
92
  events: {
93
+ click: MouseEvent;
94
+ } & {
93
95
  [evt: string]: CustomEvent<any>;
94
96
  };
95
97
  slots: {};
@@ -210,8 +210,9 @@ function showAttachementIcon() {
210
210
  {@const canOpen = isLinkLike || hasOpen}
211
211
  {@const openableClass = canOpen ? "sm:hover:cursor-pointer underline" : ""}
212
212
  {@const showIcon = showAttachementIcon()}
213
+ <!-- whitespace-nowrap overflow-clip -->
213
214
  <h3 class=" h3 text-base font-semibold pb-1
214
- whitespace-nowrap overflow-clip truncate w-full sm:flex-none
215
+ w-full sm:flex-none
215
216
  relative {openableClass}"
216
217
  use:editable={{
217
218
  action: (text) => onTitleChanged(text),
@@ -246,9 +247,10 @@ function showAttachementIcon() {
246
247
 
247
248
 
248
249
  {:else}
250
+ <!-- whitespace-nowrap overflow-clip -->
249
251
  <h3 class=" text-base font-semibold pb-1
250
252
  sm:text-base sm:font-semibold
251
- whitespace-nowrap overflow-clip truncate w-full sm:flex-none
253
+ w-full sm:flex-none
252
254
  relative">
253
255
  {item[definition.titleAttrib]}
254
256
 
@@ -31,9 +31,10 @@ async function onSummaryChanged(text) {
31
31
  <li class=" mx-2 pt-2 pb-4 px-1 rounded-md border border-transparent
32
32
  bg-stone-100 dark:bg-stone-700">
33
33
 
34
+ <!-- whitespace-nowrap overflow-clip -->
34
35
  <h3 class=" text-base font-semibold min-h-[1.75rem]
35
36
  sm:min-h-[1.25rem]
36
- whitespace-nowrap overflow-clip w-full sm:flex-none "
37
+ w-full sm:flex-none "
37
38
  use:editable={{
38
39
  action: (text) => onInsert(text, ''),
39
40
  active: false,
@@ -90,8 +90,9 @@ async function editTags(field, propIdx) {
90
90
 
91
91
  <section class="flex flex-row justify-between">
92
92
  {#each properties as prop, idx}
93
- {#if item[prop.a] || placeholder==prop.name}
94
- {#if prop.type == rList_property_type.Date}
93
+ {#if true}
94
+ {@const notEmpty = item[prop.a] || placeholder==prop.name}
95
+ {#if prop.type == rList_property_type.Date && notEmpty}
95
96
  <DatePicker
96
97
  self={item}
97
98
  a={prop.a}
@@ -99,7 +100,7 @@ async function editTags(field, propIdx) {
99
100
  s="sm"
100
101
  inContext="props"
101
102
  bind:this={propElements[idx]}/>
102
- {:else if prop.type == rList_property_type.Combo}
103
+ {:else if prop.type == rList_property_type.Combo && notEmpty}
103
104
  <Combo
104
105
  compact={true}
105
106
  inContext="props"
@@ -123,7 +124,7 @@ async function editTags(field, propIdx) {
123
124
  bind:this={propElements[idx]}>
124
125
  {item[prop.a]}
125
126
  </p>
126
- {:else if prop.type == rList_property_type.Tags}
127
+ {:else if prop.type == rList_property_type.Tags && notEmpty}
127
128
  <Tags
128
129
  class="mt-1"
129
130
  compact
@@ -19,7 +19,7 @@ import Icon from "../../icon.svelte";
19
19
  import Spinner from "../../delayed.spinner.svelte";
20
20
  import { rList_definition, rList_property_type } from "../List";
21
21
  import { push, link } from "svelte-spa-router";
22
- import { FaExternalLinkAlt, FaRegSquare, FaRegCheckSquare } from "svelte-icons/fa/";
22
+ import { FaExternalLinkAlt, FaRegCircle, FaRegCheckCircle } from "svelte-icons/fa/";
23
23
  import Tags from "../../tags.svelte";
24
24
  import { ext } from "../../../i18n";
25
25
  export let item;
@@ -299,7 +299,7 @@ async function onDownloadFile(e) {
299
299
  bind:this={rootElement}> <!-- on:contextmenu={on_contextmenu} -->
300
300
 
301
301
  {#if multiselect}
302
- {@const icon=is_row_active ? FaRegCheckSquare : FaRegSquare}
302
+ {@const icon=is_row_active ? FaRegCheckCircle : FaRegCircle}
303
303
  <Icon component={icon}
304
304
  class="flex-none h-4 w-4 text-stone-500 dark:text-stone-400 cursor-pointer mt-1 ml-2 mr-3 "
305
305
  on:click={onToggleMultiSelect}/>
@@ -2,7 +2,7 @@
2
2
  import { data_tick_store, contextItemsStore, contextTypesStore } from "../../stores";
3
3
  import { activateItem, getActive, clearActiveItem, parseWidthDirective, getPrev, getNext, swapElements, getLast, insertAfter, getActiveCount, addActiveItem } from "../../utils";
4
4
  import Icon from "../icon.svelte";
5
- import { FaRegSquare, FaRegCheckSquare } from "svelte-icons/fa/";
5
+ import { FaRegCircle, FaRegCheckCircle } from "svelte-icons/fa/";
6
6
  import { rList_definition } from "./List";
7
7
  import List_element from "./internal/list.element.svelte";
8
8
  import Inserter from "./internal/list.inserter.svelte";
@@ -348,7 +348,7 @@ export function toggleSelectAll(e) {
348
348
 
349
349
  {#if items && items.length > 0 }
350
350
  {#if false && multiselect}
351
- {@const icon = (multiselectionMode == SELECT_ALL) ? FaRegSquare : FaRegCheckSquare}
351
+ {@const icon = (multiselectionMode == SELECT_ALL) ? FaRegCircle : FaRegCheckCircle}
352
352
  <Icon component={icon} class="h-5 w-5 sm:h-4 sm:w-4 text-stone-500 dark:text-stone-400 cursor-pointer mt-2 sm:mt-1.5 ml-2 mr-3"
353
353
  on:click={toggleSelectAll}/>
354
354
  {/if}
package/operations.svelte CHANGED
@@ -31,16 +31,19 @@ function update(...args) {
31
31
  let AOperations = [];
32
32
  let BOperations = [];
33
33
  let COperations = [];
34
+ let DOperations = [];
34
35
  if (opVer == 1) {
35
36
  operations.forEach((group) => {
36
37
  if (group.operations && group.operations.length > 0) {
37
38
  AOperations = [...AOperations, ...group.operations.filter((o) => o.tbr == "A")];
38
39
  BOperations = [...BOperations, ...group.operations.filter((o) => o.tbr == "B")];
39
40
  COperations = [...COperations, ...group.operations.filter((o) => o.tbr == "C")];
41
+ DOperations = [...DOperations, ...group.operations.filter((o) => o.tbr == "D")];
40
42
  }
41
43
  });
42
44
  leftOperations = [...AOperations, ...BOperations];
43
45
  rightOperations = COperations.toReversed();
46
+ rightOperations = [...rightOperations, ...DOperations.toReversed()];
44
47
  } else if (opVer == 2) {
45
48
  if (operationsRoot && operationsRoot.tbr) {
46
49
  let allFlatOperations = [];
@@ -58,7 +61,8 @@ function update(...args) {
58
61
  icon: operationsRoot.icon ?? FaEllipsisV,
59
62
  menu: allFlatOperations,
60
63
  tbr: operationsRoot.tbr,
61
- preAction: operationsRoot.preAction ?? void 0
64
+ preAction: operationsRoot.preAction ?? void 0,
65
+ disabled: operationsRoot.disabled
62
66
  };
63
67
  switch (operationsRoot.tbr) {
64
68
  case "A":
@@ -70,9 +74,13 @@ function update(...args) {
70
74
  case "C":
71
75
  COperations.push(allOperationsMenu);
72
76
  break;
77
+ case "D":
78
+ DOperations.push(allOperationsMenu);
79
+ break;
73
80
  }
74
81
  }
75
82
  operations.forEach((group) => {
83
+ let previousOperationGroupName = "";
76
84
  if (group.tbr) {
77
85
  const expandOperation = {
78
86
  caption: group.caption ?? "",
@@ -91,31 +99,55 @@ function update(...args) {
91
99
  case "C":
92
100
  COperations.push(expandOperation);
93
101
  break;
102
+ case "D":
103
+ DOperations.push(expandOperation);
104
+ break;
94
105
  }
95
106
  }
96
107
  group.operations.forEach((op) => {
97
108
  if (op.tbr) {
98
109
  const tbrOperation = {
99
- ...op
110
+ ...op,
111
+ group: group.caption
100
112
  };
101
113
  if (op.hideToolbarCaption)
102
114
  tbrOperation.caption = "";
115
+ const shouldAddSeparator = (list, groupName) => {
116
+ if (!groupName)
117
+ return false;
118
+ if (list && list.length > 0) {
119
+ const last = list[list.length - 1];
120
+ if (last.group && last.group != groupName) {
121
+ return true;
122
+ } else
123
+ return false;
124
+ } else
125
+ return false;
126
+ };
103
127
  switch (op.tbr) {
104
128
  case "A":
129
+ if (shouldAddSeparator(AOperations, tbrOperation.group))
130
+ AOperations.push({ separator: true });
105
131
  AOperations.push(tbrOperation);
106
132
  break;
107
133
  case "B":
134
+ if (shouldAddSeparator(BOperations, group.caption))
135
+ BOperations.push({ separator: true });
108
136
  BOperations.push(tbrOperation);
109
137
  break;
110
138
  case "C":
111
139
  COperations.push(tbrOperation);
112
140
  break;
141
+ case "D":
142
+ DOperations.push(tbrOperation);
143
+ break;
113
144
  }
114
145
  }
115
146
  });
116
147
  });
117
148
  leftOperations = [...AOperations, ...BOperations];
118
149
  rightOperations = COperations.toReversed();
150
+ rightOperations = [...rightOperations, ...DOperations.toReversed()];
119
151
  } else {
120
152
  leftOperations = operations.filter((o) => !o.right);
121
153
  rightOperations = operations.filter((o) => o.right == true);
@@ -192,7 +224,7 @@ function isOperationDisabled(operation) {
192
224
  on:mousedown={(e) => mousedown(e, operation)}
193
225
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
194
226
  {#if operation.icon}
195
- <div class="w-5 h-5 mr-1"><svelte:component this={operation.icon}/></div>
227
+ <div class="w-4 h-4 mr-1"><svelte:component this={operation.icon}/></div>
196
228
  {/if}
197
229
  {#if operation.caption}
198
230
  <span class="ml-1">{operation.caption}</span>
@@ -222,7 +254,7 @@ function isOperationDisabled(operation) {
222
254
  on:mousedown={(e) => mousedown(e, operation)}
223
255
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
224
256
  {#if operation.icon}
225
- <div class="w-5 h-5 mr-1"><svelte:component this={operation.icon}/></div>
257
+ <div class="w-4 h-4 mr-1"><svelte:component this={operation.icon}/></div>
226
258
  {/if}
227
259
  {#if operation.caption}
228
260
  <span class="ml-1">{operation.caption}</span>
@@ -230,7 +262,7 @@ function isOperationDisabled(operation) {
230
262
  </button>
231
263
  {/if}
232
264
  {:else}
233
- <div class="border-l py-4"></div>
265
+ <div class="border border-l my-1.5 mx-2 border-stone-200 dark:border-stone-800"></div>
234
266
  <!--div class="border-l my-2"></div-->
235
267
  {/if}
236
268
  {/each}
@@ -264,7 +296,7 @@ function isOperationDisabled(operation) {
264
296
  on:mousedown={(e) => mousedown(e, operation)}
265
297
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
266
298
  {#if operation.icon}
267
- <div class="w-5 h-5 mr-1"><svelte:component this={operation.icon}/></div>
299
+ <div class="w-4 h-4 mr-1"><svelte:component this={operation.icon}/></div>
268
300
  {/if}
269
301
  {#if operation.caption}
270
302
  <span class="ml-1">{operation.caption}</span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.7.8",
3
+ "version": "1.7.10",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",