@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.
|
@@ -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
|
-
|
|
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
|
-
|
|
105
|
-
|
|
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>
|