@humandialog/forms.svelte 1.7.9 → 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
package/operations.svelte CHANGED
@@ -61,7 +61,8 @@ function update(...args) {
61
61
  icon: operationsRoot.icon ?? FaEllipsisV,
62
62
  menu: allFlatOperations,
63
63
  tbr: operationsRoot.tbr,
64
- preAction: operationsRoot.preAction ?? void 0
64
+ preAction: operationsRoot.preAction ?? void 0,
65
+ disabled: operationsRoot.disabled
65
66
  };
66
67
  switch (operationsRoot.tbr) {
67
68
  case "A":
@@ -79,6 +80,7 @@ function update(...args) {
79
80
  }
80
81
  }
81
82
  operations.forEach((group) => {
83
+ let previousOperationGroupName = "";
82
84
  if (group.tbr) {
83
85
  const expandOperation = {
84
86
  caption: group.caption ?? "",
@@ -105,15 +107,32 @@ function update(...args) {
105
107
  group.operations.forEach((op) => {
106
108
  if (op.tbr) {
107
109
  const tbrOperation = {
108
- ...op
110
+ ...op,
111
+ group: group.caption
109
112
  };
110
113
  if (op.hideToolbarCaption)
111
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
+ };
112
127
  switch (op.tbr) {
113
128
  case "A":
129
+ if (shouldAddSeparator(AOperations, tbrOperation.group))
130
+ AOperations.push({ separator: true });
114
131
  AOperations.push(tbrOperation);
115
132
  break;
116
133
  case "B":
134
+ if (shouldAddSeparator(BOperations, group.caption))
135
+ BOperations.push({ separator: true });
117
136
  BOperations.push(tbrOperation);
118
137
  break;
119
138
  case "C":
@@ -205,7 +224,7 @@ function isOperationDisabled(operation) {
205
224
  on:mousedown={(e) => mousedown(e, operation)}
206
225
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
207
226
  {#if operation.icon}
208
- <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>
209
228
  {/if}
210
229
  {#if operation.caption}
211
230
  <span class="ml-1">{operation.caption}</span>
@@ -235,7 +254,7 @@ function isOperationDisabled(operation) {
235
254
  on:mousedown={(e) => mousedown(e, operation)}
236
255
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
237
256
  {#if operation.icon}
238
- <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>
239
258
  {/if}
240
259
  {#if operation.caption}
241
260
  <span class="ml-1">{operation.caption}</span>
@@ -243,7 +262,7 @@ function isOperationDisabled(operation) {
243
262
  </button>
244
263
  {/if}
245
264
  {:else}
246
- <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>
247
266
  <!--div class="border-l my-2"></div-->
248
267
  {/if}
249
268
  {/each}
@@ -277,7 +296,7 @@ function isOperationDisabled(operation) {
277
296
  on:mousedown={(e) => mousedown(e, operation)}
278
297
  on:click={(e) => {on_click(e, operation, isDisabled)}}>
279
298
  {#if operation.icon}
280
- <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>
281
300
  {/if}
282
301
  {#if operation.caption}
283
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.9",
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",