@ticatec/uniface-element 0.1.31 → 0.1.32

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.
@@ -10,6 +10,14 @@ export default interface RowAction {
10
10
  *
11
11
  */
12
12
  label: string;
13
+ /**
14
+ *
15
+ */
16
+ type?: 'primary' | 'secondary' | 'third' | 'forth';
17
+ /**
18
+ *
19
+ */
20
+ icon?: string;
13
21
  /**
14
22
  *
15
23
  */
@@ -1,11 +1,12 @@
1
1
  <script lang="ts">
2
2
 
3
3
  import type RowAction from "../lib/RowAction";
4
- import {TextButton} from "../../button";
4
+ import {IconButton, TextButton} from "../../button";
5
5
  import type TableRow from "./TableRow";
6
6
  import {onDestroy, onMount, tick} from "svelte";
7
7
  import utils from "../../common/utils";
8
8
  import PopupMenu from "./PopupMenu.svelte";
9
+
9
10
  export let row: TableRow;
10
11
  export let actions: Array<RowAction>;
11
12
  export let alternative: boolean;
@@ -83,13 +84,20 @@
83
84
  checkOverflow();
84
85
  }
85
86
 
86
- $: style = rowHeight== null ? '' : `height: ${rowHeight}px`
87
+ $: style = rowHeight == null ? '' : `height: ${rowHeight}px`;
88
+
87
89
 
88
90
  </script>
89
- <div class="data-row" class:alternative style="position: relative; display: block; width: {width}px; {style}">
91
+ <div class="data-row" class:alternative style="position: relative; display: block; padding: 0 4px; width: {width}px; {style}">
90
92
  <div class="action-cell" bind:this={cell} style="{align=='center' ? 'margin: 0 auto' : ''}">
91
93
  {#each actionList as action}
92
- <TextButton style="flex-shrink: 0; top: 0" size="mini" type="primary" label={action.label} onClick={()=>action.callback(row.data)}/>
94
+ {#if action.icon}
95
+ <IconButton style="flex-shrink: 0; top: 0" size="mini" type="{action.type ?? 'primary'}" icon={action.icon}
96
+ onClick={()=>action.callback(row.data)}/>
97
+ {:else}
98
+ <TextButton style="flex-shrink: 0; top: 0" size="mini" type="{action.type ?? 'primary'}" label={action.label}
99
+ onClick={()=>action.callback(row.data)}/>
100
+ {/if}
93
101
  {/each}
94
102
  {#if popupList.length > 0}
95
103
  <TextButton size="mini" type="primary" style="flex-shrink: 0; top: 0" label="..." onClick={showPopupMenu}/>
@@ -99,10 +107,15 @@
99
107
  {#if showPopup}
100
108
  <PopupMenu {parentRect} closeCallback={()=>{showPopup = false}}>
101
109
  <div style="padding: 4px 6px; box-sizing: border-box; background-color: #ffffff;">
102
- {#each popupList as action}
103
- <div class="action-popover" style="padding: 4px 6px">
104
- <TextButton size="mini" type="primary" label={action.label}
105
- onClick={()=>{action.callback?.(row.data); showPopup=false}}/>
110
+ {#each popupList.reverse() as action}
111
+ <div class="action-popover" style="padding: 4px 6px; text-align: center">
112
+ {#if action.icon}
113
+ <IconButton style="flex-shrink: 0; top: 0" size="mini" type="{action.type ?? 'primary'}" icon={action.icon}
114
+ onClick={()=>{action.callback(row.data); showPopup=false}}/>
115
+ {:else}
116
+ <TextButton style="flex-shrink: 0; top: 0" size="mini" type="{action.type ?? 'primary'}" label={action.label}
117
+ onClick={()=>{action.callback(row.data); showPopup=false}}/>
118
+ {/if}
106
119
  </div>
107
120
  {/each}
108
121
  </div>
@@ -3892,6 +3892,7 @@
3892
3892
  .uniface-data-table .action-panel .data-row .action-cell {
3893
3893
  display: flex;
3894
3894
  flex-direction: row;
3895
+ gap: 4px;
3895
3896
  align-items: center;
3896
3897
  width: max-content;
3897
3898
  height: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "uniface web elements",
5
5
  "scripts": {
6
6
  "dev": "vite dev",