@ticatec/uniface-element 0.1.51 → 0.1.53

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.
@@ -22,8 +22,8 @@
22
22
 
23
23
  </script>
24
24
 
25
- <div style="width: 100%; height: 100%; box-sizing: border-box; display: flex; flex-direction: row">
26
- {#if $$slots[sidebar]}
25
+ <div style="width: 100%; height: 100%; box-sizing: border-box; display: flex; flex-direction: row; gap: 8px">
26
+ {#if $$slots["sidebar"]}
27
27
  <div bind:this={sidebar}
28
28
  style="height: 100%; flex: 0 0 auto; overflow: auto; border-right: 1px solid var(--uniface-plain-border-color, #f0f0f0); width: {sidebarWidth}; {maxWidth} {minWidth}">
29
29
  <slot name="sidebar"></slot>
@@ -26,6 +26,9 @@ declare const langRes: {
26
26
  actions: string;
27
27
  emptyDataSet: string;
28
28
  };
29
+ transfer: {
30
+ selectIndicator: string;
31
+ };
29
32
  };
30
33
  };
31
34
  export default langRes;
@@ -33,6 +33,9 @@ const langRes = {
33
33
  rowNo: "Row#",
34
34
  actions: "Actions",
35
35
  emptyDataSet: 'Empty dataset'
36
+ },
37
+ transfer: {
38
+ selectIndicator: "Selected: {{selected}}/{{total}}"
36
39
  }
37
40
  }
38
41
  };
@@ -188,7 +188,7 @@
188
188
  {#each filteredList as item}
189
189
  {#if selectMode === "multiple"}
190
190
  <div class="listview-item" style="display: flex; flex-direction: row; align-items: center; gap: 8px">
191
- <CheckBox style="flex: 0 0 auto" {readonly} value={selectedList.indexOf(item) > -1}
191
+ <CheckBox style="flex: 0 0 auto; margin-left: 8px" {readonly} value={selectedList.indexOf(item) > -1}
192
192
  onChange={handleSelectionChanged(item)}/>
193
193
  <div style="flex: 1 1 auto; cursor: pointer" aria-hidden="true" on:click={handleSelectionChanged(item)}>
194
194
  <svelte:component this={itemRender} {readonly} {item} {...item$props}/>
@@ -2736,25 +2736,30 @@ root {
2736
2736
  padding-left: 1em;
2737
2737
  }
2738
2738
 
2739
- .container {
2739
+ .uniface-transfer-container {
2740
2740
  height: 100%;
2741
2741
  width: 100%;
2742
- display: flex;
2743
- flex-direction: row;
2742
+ display: grid;
2743
+ grid-auto-columns: 1fr 60px 1fr;
2744
+ column-gap: 16px;
2744
2745
  }
2745
- .container .header-container {
2746
+ .uniface-transfer-container .header-container {
2746
2747
  margin: 10px auto 10px 10px;
2747
2748
  }
2748
- .container .list-container {
2749
- height: 300px;
2750
- width: 220px;
2751
- overflow: auto;
2752
- border: 1px solid #eadcdc;
2749
+ .uniface-transfer-container .list-container {
2750
+ height: 100%;
2751
+ flex: 1 1 auto;
2752
+ overflow: hidden;
2753
+ border: 1px solid var(--uniface-inside-border-color);
2753
2754
  box-sizing: border-box;
2754
- border-radius: 20px;
2755
+ border-radius: 8px;
2755
2756
  }
2756
- .container .icon-button-container {
2757
- margin: auto 20px;
2757
+ .uniface-transfer-container .icon-button-container {
2758
+ display: flex;
2759
+ row-gap: 24px;
2760
+ flex-direction: column;
2761
+ justify-content: center;
2762
+ align-items: center;
2758
2763
  }
2759
2764
 
2760
2765
  :root {
@@ -0,0 +1,65 @@
1
+ <script lang="ts">
2
+ import ListBox from "../list-box";
3
+ import IconButton from "../button/IconButton.svelte";
4
+
5
+ import type {FunFilter} from "../list-box";
6
+ import type {TransferData} from "./types";
7
+ import i18n from "@ticatec/i18n";
8
+
9
+
10
+
11
+ export let style: string = '';
12
+ export let sourceList:Array<any>;
13
+ export let sourceTitle: string;
14
+ export let targetList:Array<any>;
15
+ export let targetTitle: string;
16
+
17
+ export let itemRender: any = null;
18
+ export let filter: FunFilter = null;
19
+ export let transferData: TransferData = null;
20
+ export let header$style: string = '';
21
+ export let footer$style: string = 'width: 100%; background-color: #f0f0f0; padding: 2px 6px; text-align: right; box-sizing: border-box';
22
+
23
+
24
+ let sourceSelectedList = [];
25
+ let targetSelectedList = [];
26
+
27
+ const moveToTarget = async () => {
28
+ if (sourceSelectedList.length > 0 && await transferData?.(sourceSelectedList, "right")) {
29
+ targetList = [...targetList, ...sourceSelectedList];
30
+ sourceList = sourceList.filter(item => sourceSelectedList.indexOf(item) === -1);
31
+ sourceSelectedList = [];
32
+ }
33
+ }
34
+
35
+ const moveToSource = async () => {
36
+ if (targetSelectedList.length > 0 && await transferData?.(targetSelectedList, "left")) {
37
+ sourceList = [...sourceList, ...targetSelectedList];
38
+ targetList = targetList.filter(item => targetSelectedList.indexOf(item) === -1);
39
+ targetSelectedList = [];
40
+ }
41
+ }
42
+ </script>
43
+
44
+ <div class="uniface-transfer-container">
45
+ <ListBox class="list-container" title={sourceTitle} {filter} style="{style}; grid-column: 1/2" list={sourceList} selectMode="multiple"
46
+ bind:selectedList={sourceSelectedList} {itemRender}>
47
+ <div slot="footer" style={footer$style}>
48
+ <span>{i18n.getText('uniface.transfer.selectIndicator', {selected: sourceSelectedList.length, total: sourceList.length})}</span>
49
+ </div>
50
+ </ListBox>
51
+ <div class="icon-button-container" style="grid-column: 2/3;">
52
+ <IconButton onClick={moveToSource} type="primary" disabled={targetSelectedList.length === 0}>
53
+ <i class="icon_google_navigate_before"></i>
54
+ </IconButton>
55
+ <IconButton onClick={moveToTarget} type="primary" disabled={sourceSelectedList.length === 0}>
56
+ <i class="icon_google_navigate_next"></i>
57
+ </IconButton>
58
+ </div>
59
+ <ListBox class="list-container" title={targetTitle} style="{style}; grid-column: 3/4" {filter} list={targetList} selectMode="multiple"
60
+ bind:selectedList={targetSelectedList} {itemRender} }>
61
+ <div slot="footer" style={footer$style}>
62
+ <span>{i18n.getText('uniface.transfer.selectIndicator', {selected: targetSelectedList.length, total: targetList.length})}</span>
63
+ </div>
64
+ </ListBox>
65
+ </div>
@@ -1,5 +1,5 @@
1
- import { SvelteComponent } from "svelte";
2
- import type { FunFilter } from "./types";
1
+ import type { FunFilter } from "../list-box";
2
+ import type { TransferData } from "./types";
3
3
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
4
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
5
  $$bindings?: Bindings;
@@ -13,24 +13,19 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
13
13
  };
14
14
  z_$$bindings?: Bindings;
15
15
  }
16
- declare const TransferField: $$__sveltets_2_IsomorphicComponent<{
17
- height?: string;
18
- width?: string;
16
+ declare const Transfer: $$__sveltets_2_IsomorphicComponent<{
19
17
  style?: string;
20
- sourceList?: any[];
21
- disabled?: boolean;
22
- itemRender?: SvelteComponent;
18
+ sourceList: Array<any>;
19
+ sourceTitle: string;
20
+ targetList: Array<any>;
21
+ targetTitle: string;
22
+ itemRender?: any;
23
23
  filter?: FunFilter;
24
- sourceSelectedList?: any[];
24
+ transferData?: TransferData;
25
25
  header$style?: string;
26
26
  footer$style?: string;
27
- echoValue?: any[];
28
- echoData: () => void;
29
27
  }, {
30
28
  [evt: string]: CustomEvent<any>;
31
- }, {
32
- sourceHeader: {};
33
- targetHeader: {};
34
- }, {}, string>;
35
- type TransferField = InstanceType<typeof TransferField>;
36
- export default TransferField;
29
+ }, {}, {}, string>;
30
+ type Transfer = InstanceType<typeof Transfer>;
31
+ export default Transfer;
@@ -0,0 +1,4 @@
1
+ import Transfer from "./Transfer.svelte";
2
+ import type { TransferData } from "./types";
3
+ export default Transfer;
4
+ export type { TransferData };
@@ -0,0 +1,2 @@
1
+ import Transfer from "./Transfer.svelte";
2
+ export default Transfer;
@@ -0,0 +1 @@
1
+ export type TransferData = (list: Array<any>, direction: "left" | "right") => Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "description": "uniface web elements",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -320,6 +320,10 @@
320
320
  "types": "./dist/time-editor/index.d.ts",
321
321
  "import": "./dist/time-editor/index.js"
322
322
  },
323
+ "./Transfer": {
324
+ "types": "./dist/transfer/index.d.ts",
325
+ "import": "./dist/transfer/index.js"
326
+ },
323
327
  "./UnitNumberEditor": {
324
328
  "types": "./dist/unit-number-editor/index.d.ts",
325
329
  "import": "./dist/unit-number-editor/index.js"
@@ -1,91 +0,0 @@
1
- <script lang="ts">
2
- import ListBox from "../list-box";
3
- import IconButton from "../button";
4
- import {onMount, SvelteComponent} from "svelte";
5
- import type {FunFilter} from "./types";
6
-
7
- export let height: string = '';
8
- export let width: string = '';
9
- export let style: string = '';
10
- export let sourceList = [];
11
- export let disabled: boolean = false;
12
- export let itemRender: SvelteComponent = null;
13
- export let filter: FunFilter = null;
14
- export let sourceSelectedList = [];
15
- export let header$style: string = '';
16
- export let footer$style: string = 'width: 100%; background-color: #f0f0f0; padding: 2px 6px; text-align: right; box-sizing: border-box';
17
- export let echoValue = [];
18
- export let echoData: () => void;
19
-
20
- let targetList = [];
21
- let targetSelectedList = [];
22
- let sourceSelectedItem = null;
23
- let targetSelectedItem = null;
24
-
25
- const moveToTarget = () => {
26
- if (sourceSelectedList.length > 0) {
27
- targetList = [...targetList, ...sourceSelectedList];
28
- sourceList = sourceList.filter(item => sourceSelectedList.indexOf(item) === -1);
29
- sourceSelectedList = [];
30
- } else if (sourceSelectedItem) {
31
- targetList = [...targetList, sourceSelectedItem];
32
- sourceList = sourceList.filter(item => item !== sourceSelectedItem);
33
- sourceSelectedItem = null;
34
- }
35
- }
36
-
37
- const moveToSource = () => {
38
- if (targetSelectedList.length > 0) {
39
- sourceList = [...sourceList, ...targetSelectedList];
40
- targetList = targetList.filter(item => targetSelectedList.indexOf(item) === -1);
41
- targetSelectedList = [];
42
- } else if (targetSelectedItem) {
43
- sourceList = [...sourceList, targetSelectedItem];
44
- targetList = targetList.filter(item => item !== targetSelectedItem);
45
- targetSelectedItem = null;
46
- }
47
- }
48
-
49
- onMount(() => {
50
- if (echoValue.length > 0) {
51
- targetList = [...targetList, ...echoValue];
52
- sourceList = sourceList.filter(item => echoValue.indexOf(item) === -1);
53
- }
54
- })
55
-
56
- $: {
57
- if (echoData) {
58
- echoData();
59
- }
60
- }
61
-
62
- </script>
63
-
64
- <div class="container" style="height: {height}px; width: {width}px">
65
- <ListBox class="list-container" {filter} {style} list={sourceList} selectMode="multiple" bind:selectedList={sourceSelectedList}
66
- {itemRender} bind:selectedItem={sourceSelectedItem}>
67
- <div slot="header" style={header$style}>
68
- <slot name="sourceHeader"></slot>
69
- </div>
70
- <div slot="footer" style={footer$style}>
71
- <span>选中:{sourceSelectedList.length}/{sourceList.length}</span>
72
- </div>
73
- </ListBox>
74
- <div class="icon-button-container">
75
- <IconButton on:click={moveToSource} type="primary" disabled={targetSelectedList.length === 0}>
76
- <i class="uniface-icon-chevron-left"></i>
77
- </IconButton>
78
- <IconButton on:click={moveToTarget} type="primary" disabled={sourceSelectedList.length === 0}>
79
- <i class="uniface-icon-chevron-right"></i>
80
- </IconButton>
81
- </div>
82
- <ListBox class="list-container" {style} {filter} list={targetList} selectMode="multiple" bind:selectedList={targetSelectedList}
83
- {itemRender} bind:selectedItem={targetSelectedItem}>
84
- <div slot="header" style={header$style}>
85
- <slot name="targetHeader"></slot>
86
- </div>
87
- <div slot="footer" style={footer$style}>
88
- <span>选中:{targetSelectedList.length}/{targetList.length}</span>
89
- </div>
90
- </ListBox>
91
- </div>
@@ -1,2 +0,0 @@
1
- import TransferField from "./TransferField.svelte";
2
- export default TransferField;
@@ -1,2 +0,0 @@
1
- import TransferField from "./TransferField.svelte";
2
- export default TransferField;
@@ -1,6 +0,0 @@
1
- export interface LoadResult {
2
- hasMore: boolean;
3
- list: Array<any>;
4
- }
5
- export type FunFilter = (item: any, text: string) => boolean;
6
- export type LazyLoader = (text: string) => Promise<LoadResult>;
File without changes
File without changes