@ticatec/uniface-element 0.1.11 → 0.1.13
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.
- package/dist/app-layout/ClassicLayout.svelte +1 -1
- package/dist/box/Box.svelte +8 -0
- package/dist/box/Box.svelte.d.ts +3 -0
- package/dist/card/Card.svelte +3 -2
- package/dist/card/CardAction.d.ts +1 -0
- package/dist/card/CommonCardActionBar.svelte +3 -3
- package/dist/checkbox/CheckBox.svelte +1 -1
- package/dist/common/FullscreenOverlay.svelte +1 -1
- package/dist/data-table/parts/ContentPanel.svelte +1 -1
- package/dist/data-table/parts/FixedRow.svelte +1 -1
- package/dist/date-picker/DatePicker.svelte +5 -0
- package/dist/date-picker/DateTimePicker.svelte +6 -1
- package/dist/dialog/Dialog.svelte +0 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/list-box/index.d.ts +1 -2
- package/dist/message-box/IMessageBox.d.ts +4 -4
- package/dist/message-box/IMessageBox.js +10 -10
- package/dist/message-box/MessageBoxBoard.svelte +3 -3
- package/dist/message-box/index.d.ts +2 -2
- package/dist/message-box/index.js +2 -2
- package/dist/number-range/NumberRange.svelte +3 -2
- package/dist/number-range/NumberRange.svelte.d.ts +1 -0
- package/dist/options-multi-select/OptionsMultiSelect.svelte +19 -3
- package/dist/options-multi-select/OptionsMultiSelect.svelte.d.ts +1 -0
- package/dist/options-select/OptionsSelect.svelte +8 -2
- package/dist/split/Split.svelte +14 -2
- package/dist/split/Split.svelte.d.ts +1 -0
- package/dist/text-editor/TextEditor.svelte +8 -2
- package/dist/text-editor/TextEditor.svelte.d.ts +1 -0
- package/dist/ticatec-uniface-web.css +30 -0
- package/dist/tree-view/TreeNode.d.ts +8 -0
- package/dist/tree-view/TreeUtils.d.ts +5 -9
- package/dist/tree-view/TreeUtils.js +45 -28
- package/dist/tree-view/index.d.ts +4 -4
- package/dist/tree-view/index.js +2 -2
- package/package.json +2 -2
- package/dist/list-box/ListViewItem.svelte +0 -6
- package/dist/list-box/ListViewItem.svelte.d.ts +0 -18
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
</div>
|
|
61
61
|
{#if $$slots['right-sidebar']}
|
|
62
62
|
{#if sidebarResize}
|
|
63
|
-
<Split direction="vertical" bindingPanel={rightBar}/>
|
|
63
|
+
<Split direction="vertical" bindingPanel={rightBar} reverse/>
|
|
64
64
|
{/if}
|
|
65
65
|
<div bind:this={rightBar} style="width: 100%; flex: 0 0 auto; overflow: auto; width: {rightBarWidth}; {rightMinWidth} {rightMaxWidth}">
|
|
66
66
|
<slot name="right-sidebar"></slot>
|
package/dist/box/Box.svelte
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export let round: boolean = false;
|
|
6
6
|
|
|
7
7
|
export let content$style: string = '';
|
|
8
|
+
export let fonter$style: string = '';
|
|
8
9
|
|
|
9
10
|
</script>
|
|
10
11
|
|
|
@@ -21,4 +22,11 @@
|
|
|
21
22
|
<div class="box-content" style={content$style}>
|
|
22
23
|
<slot></slot>
|
|
23
24
|
</div>
|
|
25
|
+
{#if $$slots['footer']}
|
|
26
|
+
<div class="box-footer" style={fonter$style}>
|
|
27
|
+
<slot name="footer">
|
|
28
|
+
|
|
29
|
+
</slot>
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
24
32
|
</div>
|
package/dist/box/Box.svelte.d.ts
CHANGED
|
@@ -21,14 +21,17 @@ declare const Box: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithCh
|
|
|
21
21
|
title?: string;
|
|
22
22
|
round?: boolean;
|
|
23
23
|
content$style?: string;
|
|
24
|
+
fonter$style?: string;
|
|
24
25
|
}, {
|
|
25
26
|
header: {};
|
|
26
27
|
default: {};
|
|
28
|
+
footer: {};
|
|
27
29
|
}>, {
|
|
28
30
|
[evt: string]: CustomEvent<any>;
|
|
29
31
|
}, {
|
|
30
32
|
header: {};
|
|
31
33
|
default: {};
|
|
34
|
+
footer: {};
|
|
32
35
|
}, {}, string>;
|
|
33
36
|
type Box = InstanceType<typeof Box>;
|
|
34
37
|
export default Box;
|
package/dist/card/Card.svelte
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
|
|
3
|
-
import CardHeader from "./CardHeader.svelte";
|
|
4
3
|
import type CardAction from "./CardAction";
|
|
5
4
|
import CommonCardActionBar from "./CommonCardActionBar.svelte";
|
|
6
5
|
|
|
@@ -15,7 +14,9 @@
|
|
|
15
14
|
<div class="uniface-card" class:shadowBox={variant=='3d'}>
|
|
16
15
|
<div {style}>
|
|
17
16
|
{#if title}
|
|
18
|
-
<
|
|
17
|
+
<div class="card-header simple">
|
|
18
|
+
<span>{title}</span>
|
|
19
|
+
</div>
|
|
19
20
|
{:else if $$slots['header-bar']}
|
|
20
21
|
<div class="card-header">
|
|
21
22
|
<slot name="header-bar"/>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
let clickEnable = true;
|
|
9
9
|
|
|
10
10
|
const handleActionClick = (action: CardAction) => async (e: MouseEvent) => {
|
|
11
|
-
if (clickEnable) {
|
|
11
|
+
if (clickEnable && !action.disabled) {
|
|
12
12
|
clickEnable = false;
|
|
13
13
|
action.callback?.();
|
|
14
14
|
await utils.sleep(0.5);
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
<div class="card-action-bar simple">
|
|
22
22
|
{#each actions as action}
|
|
23
|
-
<div class="action-item">
|
|
24
|
-
<i class={action.icon} on:click={handleActionClick(action)}></i>
|
|
23
|
+
<div class:disabled={action.disabled} class="action-item">
|
|
24
|
+
<i class={action.icon} aria-hidden="true" on:click={handleActionClick(action)}></i>
|
|
25
25
|
</div>
|
|
26
26
|
{/each}
|
|
27
27
|
</div>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
</script>
|
|
43
43
|
<div class="uniface-checkbox" class:disabled class:compact {style}>
|
|
44
|
-
<label on:click={handleClickEvent}
|
|
44
|
+
<label on:click={handleClickEvent} >
|
|
45
45
|
<input bind:this={checkbox} type="checkbox" bind:checked={value} {readonly} {disabled}/>
|
|
46
46
|
<span>{label}</span>
|
|
47
47
|
</label>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{#if visible}
|
|
10
10
|
<Portal target="body">
|
|
11
11
|
<div class="uniface-mask-overlay">
|
|
12
|
-
<div style="position: relative; width: 100%; height: 100%;"
|
|
12
|
+
<div style="position: relative; width: 100%; height: 100%; overflow: hidden"
|
|
13
13
|
on:click={()=>{visible = false}} aria-hidden="true">
|
|
14
14
|
<slot></slot>
|
|
15
15
|
</div>
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
let textValue: string;
|
|
29
29
|
let editor: any;
|
|
30
30
|
let oldValue: Date = dateUtils.toDayjs(value)?.toDate();
|
|
31
|
-
let currentValue
|
|
31
|
+
let currentValue: dayjs.Dayjs;
|
|
32
32
|
|
|
33
33
|
const dateFmts = {
|
|
34
34
|
"H": "YYYY-MM-DD HH:mm",
|
|
@@ -64,6 +64,11 @@
|
|
|
64
64
|
if (e.key == 'Backspace' || e.key == 'Delete') {
|
|
65
65
|
value = null;
|
|
66
66
|
showPopup = false;
|
|
67
|
+
} else if (e.key == 'Tab') {
|
|
68
|
+
if (showPopup) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
}
|
|
67
72
|
} else if (e.key == 'Escape') {
|
|
68
73
|
showPopup = false;
|
|
69
74
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import type {DialogCloseConfirm} from "./DialogCloseConfirm";
|
|
5
5
|
import ActionBar, {type ButtonActions} from "../action-bar";
|
|
6
6
|
import i18n from "../i18nContext";
|
|
7
|
-
import type ButtonAction from "../action-bar/ButtonAction";
|
|
8
7
|
import {onMount} from "svelte";
|
|
9
8
|
|
|
10
9
|
export let title: string = null as unknown as string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DateContext } from "./base-calendar";
|
|
2
2
|
import type CardAction from "./card/CardAction";
|
|
3
3
|
import type { DialogCloseConfirm, IDialog } from './dialog';
|
|
4
|
-
import { type IMessageBox,
|
|
4
|
+
import { type IMessageBox, ModalResult } from "./message-box";
|
|
5
5
|
import type { Toast } from "./toast";
|
|
6
6
|
import type { Indicator } from "./indicator";
|
|
7
7
|
import type { UnitOption } from "./unit-number-editor";
|
|
@@ -10,7 +10,7 @@ import type { FunFilter, LazyLoader, LoadResult } from "./list-box";
|
|
|
10
10
|
import type { ActionsColumn, FormatCell, CellHint, IndicatorColumn, RowAction, GetRowActions, ActionFunction, DataColumn } from "./data-table";
|
|
11
11
|
import type { ContextMenuItem, OnContextMenu, ActionCallback } from "./context-menu";
|
|
12
12
|
import type { MouseClickHandler } from "./common/MouseClickHandler";
|
|
13
|
-
export { DateContext,
|
|
13
|
+
export { DateContext, ModalResult, DisplayMode };
|
|
14
14
|
declare global {
|
|
15
15
|
interface Window {
|
|
16
16
|
Indicator: Indicator;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DateContext } from "./base-calendar";
|
|
2
|
-
import {
|
|
2
|
+
import { ModalResult } from "./message-box";
|
|
3
3
|
import { DisplayMode } from "./common/DisplayMode.js";
|
|
4
|
-
export { DateContext,
|
|
4
|
+
export { DateContext, ModalResult, DisplayMode };
|
package/dist/list-box/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ListBox from "./ListBox.svelte";
|
|
2
|
-
import type { FunFilter } from "./types";
|
|
3
|
-
import type { LazyLoader, LoadResult } from "./types";
|
|
2
|
+
import type { LazyLoader, LoadResult, FunFilter } from "./types";
|
|
4
3
|
export default ListBox;
|
|
5
4
|
export type { LazyLoader, FunFilter, LoadResult };
|
|
@@ -4,7 +4,7 @@ export default interface IMessageBox {
|
|
|
4
4
|
showInfo: ShowFun;
|
|
5
5
|
showConfirm: ShowConfirmFun;
|
|
6
6
|
}
|
|
7
|
-
declare enum
|
|
7
|
+
declare enum ModalResult {
|
|
8
8
|
MR_OK = 1,
|
|
9
9
|
MR_CANCEL = 2,
|
|
10
10
|
MR_CLOSE = 3
|
|
@@ -12,12 +12,12 @@ declare enum ModuleResult {
|
|
|
12
12
|
declare const InfoButtons: {
|
|
13
13
|
label: string;
|
|
14
14
|
type: string;
|
|
15
|
-
result:
|
|
15
|
+
result: ModalResult;
|
|
16
16
|
}[];
|
|
17
17
|
declare const ConfirmButtons: {
|
|
18
18
|
label: string;
|
|
19
19
|
type: string;
|
|
20
|
-
result:
|
|
20
|
+
result: ModalResult;
|
|
21
21
|
}[];
|
|
22
22
|
declare const initialize: (showInfo: any, showConfirm: any) => void;
|
|
23
|
-
export { initialize,
|
|
23
|
+
export { initialize, ModalResult, InfoButtons, ConfirmButtons };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import i18n from "../i18nContext";
|
|
2
2
|
;
|
|
3
|
-
var
|
|
4
|
-
(function (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})(
|
|
3
|
+
var ModalResult;
|
|
4
|
+
(function (ModalResult) {
|
|
5
|
+
ModalResult[ModalResult["MR_OK"] = 1] = "MR_OK";
|
|
6
|
+
ModalResult[ModalResult["MR_CANCEL"] = 2] = "MR_CANCEL";
|
|
7
|
+
ModalResult[ModalResult["MR_CLOSE"] = 3] = "MR_CLOSE";
|
|
8
|
+
})(ModalResult || (ModalResult = {}));
|
|
9
9
|
const InfoButtons = [
|
|
10
|
-
{ label: i18n.getText('uniface.btnClose', 'Close'), type: 'primary', result:
|
|
10
|
+
{ label: i18n.getText('uniface.btnClose', 'Close'), type: 'primary', result: ModalResult.MR_OK }
|
|
11
11
|
];
|
|
12
12
|
const ConfirmButtons = [
|
|
13
|
-
{ label: i18n.getText('uniface.btnCancel', 'Cancel'), type: 'default', result:
|
|
14
|
-
{ label: i18n.getText('uniface.btnConfirm', 'OK'), type: 'primary', result:
|
|
13
|
+
{ label: i18n.getText('uniface.btnCancel', 'Cancel'), type: 'default', result: ModalResult.MR_CANCEL },
|
|
14
|
+
{ label: i18n.getText('uniface.btnConfirm', 'OK'), type: 'primary', result: ModalResult.MR_OK }
|
|
15
15
|
];
|
|
16
16
|
const initialize = (showInfo, showConfirm) => {
|
|
17
17
|
window.MessageBox = {
|
|
@@ -19,4 +19,4 @@ const initialize = (showInfo, showConfirm) => {
|
|
|
19
19
|
showConfirm
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
export { initialize,
|
|
22
|
+
export { initialize, ModalResult, InfoButtons, ConfirmButtons };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
|
|
3
3
|
import {onDestroy, onMount} from "svelte";
|
|
4
|
-
import {initialize, ConfirmButtons,
|
|
4
|
+
import {initialize, ConfirmButtons, ModalResult} from "./IMessageBox";
|
|
5
5
|
import Button from "../button";
|
|
6
6
|
import {fade} from "svelte/transition";
|
|
7
7
|
import utils from "../common/utils";
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
startMove = false;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const handleButtonClick = (mr:
|
|
83
|
+
const handleButtonClick = (mr: ModalResult) => (e: MouseEvent) => {
|
|
84
84
|
if (resolve != null) {
|
|
85
85
|
resolve(mr);
|
|
86
86
|
resolve = null;
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
|
|
91
91
|
const handleCloseClick = (e: MouseEvent) => {
|
|
92
92
|
if (resolve != null) {
|
|
93
|
-
resolve(
|
|
93
|
+
resolve(ModalResult.MR_CANCEL);
|
|
94
94
|
resolve = null;
|
|
95
95
|
visible = false;
|
|
96
96
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MessageBoxBoard from "./MessageBoxBoard.svelte";
|
|
2
2
|
import type IMessageBox from "./IMessageBox";
|
|
3
|
-
import {
|
|
3
|
+
import { ModalResult } from "./IMessageBox";
|
|
4
4
|
export default MessageBoxBoard;
|
|
5
|
-
export {
|
|
5
|
+
export { ModalResult, type IMessageBox };
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let max: number | null = null;
|
|
12
12
|
export let fromValue: number = null as unknown as number;
|
|
13
13
|
export let toValue: number = null as unknown as number;
|
|
14
|
+
export let allowNegative: boolean = false;
|
|
14
15
|
|
|
15
16
|
let className: string = '';
|
|
16
17
|
let showActionIcon: boolean = true;
|
|
@@ -27,9 +28,9 @@
|
|
|
27
28
|
</script>
|
|
28
29
|
<CommonRangeEditor {compact} class="{className}" {style} {variant} {showActionIcon} clean={cleanValue}>
|
|
29
30
|
<svelte:fragment slot="from">
|
|
30
|
-
<NumberInput bind:this={editor} style="width: 100%; text-align: center" placeholder="" {min} max={toValue} bind:value={fromValue}/>
|
|
31
|
+
<NumberInput bind:this={editor} style="width: 100%; text-align: center" {allowNegative} placeholder="" {min} max={toValue} bind:value={fromValue}/>
|
|
31
32
|
</svelte:fragment>
|
|
32
33
|
<svelte:fragment slot="to">
|
|
33
|
-
<NumberInput style="width: 100%; text-align: center" placeholder="" {max} min={fromValue} bind:value={toValue}/>
|
|
34
|
+
<NumberInput style="width: 100%; text-align: center" {allowNegative} placeholder="" {max} min={fromValue} bind:value={toValue}/>
|
|
34
35
|
</svelte:fragment>
|
|
35
36
|
</CommonRangeEditor>
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
export let keyField: string = "code";
|
|
20
20
|
export let textField: string = "text";
|
|
21
21
|
export let placeholder: string = '';
|
|
22
|
+
export let emptyText: string = '';
|
|
22
23
|
export let disableOptions: Array<string> = [];
|
|
23
24
|
export let hideOptions: Array<string> = [];
|
|
24
25
|
export let displayMode: DisplayMode = DisplayMode.Edit;
|
|
@@ -43,7 +44,9 @@
|
|
|
43
44
|
} else {
|
|
44
45
|
removeSelectCode(key);
|
|
45
46
|
}
|
|
46
|
-
onChange?.(selectedList)
|
|
47
|
+
onChange?.(selectedList);
|
|
48
|
+
editor.focus();
|
|
49
|
+
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
const getOptionItem = (code: string) => {
|
|
@@ -76,6 +79,12 @@
|
|
|
76
79
|
e.preventDefault();
|
|
77
80
|
}
|
|
78
81
|
|
|
82
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
83
|
+
if (event.key=='Tab') {
|
|
84
|
+
showPopup = false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
79
88
|
const cleanData = () => {
|
|
80
89
|
value = '';
|
|
81
90
|
onChange?.([])
|
|
@@ -87,21 +96,28 @@
|
|
|
87
96
|
$: mh = `height: ${menu$height > 0 ? menu$height + 'px' : 'auto'}`;
|
|
88
97
|
$: textValue = generateTextValue(selectedList);
|
|
89
98
|
|
|
99
|
+
let editor: any;
|
|
100
|
+
|
|
101
|
+
$: if (showPopup) {
|
|
102
|
+
editor.focus();
|
|
103
|
+
}
|
|
104
|
+
|
|
90
105
|
</script>
|
|
91
106
|
|
|
92
107
|
<CommonPicker {displayMode} {variant} {style} {compact} className="multiple" dropDownIcon="uniface-icon-chevron-down"
|
|
93
108
|
bind:showPopup canClean={value!=null} autoFit clean={cleanData} {textValue} {readonly} {disabled}>
|
|
94
109
|
|
|
95
110
|
<div class="option-field" aria-hidden="true" on:click={()=>{showPopup = true}}>
|
|
111
|
+
<input bind:this={editor} style="position: absolute; left: 1px; width: 1px" on:keydown={handleKeyDown}/>
|
|
96
112
|
<div style="width: 100%; overflow: hidden; display: flex; flex-direction: row; gap: 6px">
|
|
97
113
|
{#if selectedList.length > 0 }
|
|
98
114
|
{#each selectedList as code}
|
|
99
115
|
<Tag style="flex-shrink: 0" color={tagColor} variant={tagVariant} text={getOptionItem(code)}
|
|
100
116
|
removable={!readonly && !disabled} removeHandler={removeOption(code)}/>
|
|
101
117
|
{/each}
|
|
102
|
-
{:else if placeholder != null}
|
|
118
|
+
{:else if emptyText != null || placeholder != null}
|
|
103
119
|
<div class:readonly={readonly || disabled}>
|
|
104
|
-
<span
|
|
120
|
+
<span>{emptyText ?? placeholder}</span>
|
|
105
121
|
</div>
|
|
106
122
|
{/if}
|
|
107
123
|
</div>
|
|
@@ -66,13 +66,19 @@
|
|
|
66
66
|
editor.focus();
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
70
|
+
if (event.key=='Tab') {
|
|
71
|
+
showPopup = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
</script>
|
|
70
76
|
|
|
71
77
|
<CommonPicker {displayMode} {variant} {style} {compact} dropDownIcon="uniface-icon-chevron-down"
|
|
72
78
|
bind:showPopup canClean={!mandatory && value!=null} autoFit clean={cleanData} {textValue} {readonly} {disabled}>
|
|
73
79
|
|
|
74
|
-
<input style="width: 100%" bind:this={editor} on:click={openPopup} {placeholder}
|
|
75
|
-
class="text-editor" bind:value={textValue} on:blur on:focus/>
|
|
80
|
+
<input style="width: 100%" bind:this={editor} on:click={openPopup} {placeholder} readonly
|
|
81
|
+
class="text-editor" bind:value={textValue} on:blur on:focus on:keydown={handleKeyDown}/>
|
|
76
82
|
|
|
77
83
|
<div class="options-popover" style={mh} slot="popup-panel">
|
|
78
84
|
{#each options as op}
|
package/dist/split/Split.svelte
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
export let width: number = 2;
|
|
5
5
|
export let bindingPanel: any = null;
|
|
6
6
|
|
|
7
|
+
export let reverse: boolean = false;
|
|
8
|
+
|
|
7
9
|
let fixed: boolean = true;
|
|
8
10
|
|
|
9
11
|
let style: string;
|
|
@@ -18,24 +20,34 @@
|
|
|
18
20
|
isDragging = true;
|
|
19
21
|
document.addEventListener("mousemove", onDrag);
|
|
20
22
|
document.addEventListener("mouseup", stopDrag);
|
|
23
|
+
document.body.style.cursor = direction == "horizontal" ? 'row-resize' : 'col-resize'
|
|
21
24
|
} else {
|
|
22
25
|
event.preventDefault();
|
|
23
26
|
event.stopPropagation();
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
const calculateHeight = (event: MouseEvent) => {
|
|
31
|
+
reverse ? Math.max(5, bindingPanel.clientHeight - event.movementY) : Math.max(5, bindingPanel.clientHeight + event.movementY)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const calculateWidth = (event: MouseEvent) => {
|
|
35
|
+
return reverse ? Math.max(5, bindingPanel.clientWidth - event.movementX) : Math.max(5, bindingPanel.clientWidth + event.movementX)
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
const onDrag = (event: MouseEvent) => {
|
|
28
39
|
if (isDragging && bindingPanel) {
|
|
29
40
|
if (direction === "horizontal") {
|
|
30
|
-
bindingPanel.style.height = `${
|
|
41
|
+
bindingPanel.style.height = `${calculateHeight(event)}px`;
|
|
31
42
|
} else {
|
|
32
|
-
bindingPanel.style.width = `${
|
|
43
|
+
bindingPanel.style.width = `${calculateWidth(event)}px`;
|
|
33
44
|
}
|
|
34
45
|
}
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
const stopDrag = () => {
|
|
38
49
|
isDragging = false;
|
|
50
|
+
document.body.style.cursor = 'default';
|
|
39
51
|
document.removeEventListener("mousemove", onDrag);
|
|
40
52
|
document.removeEventListener("mouseup", stopDrag);
|
|
41
53
|
}
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
export let displayMode: DisplayMode = DisplayMode.Edit;
|
|
20
20
|
export let onChange: ((value: string) => void) | undefined = undefined;
|
|
21
21
|
|
|
22
|
+
export let autoFocus: boolean = false;
|
|
23
|
+
|
|
22
24
|
let className: string = '';
|
|
23
25
|
let input$: any;
|
|
24
26
|
let editor: any;
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
|
|
32
34
|
const clean = () => {
|
|
33
35
|
value = '';
|
|
34
|
-
editor.
|
|
36
|
+
editor.focus();
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
$: if (oldValue != value) {
|
|
@@ -39,9 +41,13 @@
|
|
|
39
41
|
oldValue = value;
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
$: if (editor && autoFocus) {
|
|
45
|
+
editor.focus();
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
</script>
|
|
43
49
|
<CommonEditor {displayMode} {style} {value} {suffix} {prefix} {readonly} {disabled} {variant} {compact}
|
|
44
|
-
showActionIcon={!readonly && !disabled && removable && value?.length > 0}
|
|
50
|
+
showActionIcon={!readonly && !disabled && removable && value?.length > 0} placeholder={input$['placeholder']}
|
|
45
51
|
class={className} clean={clean}>
|
|
46
52
|
<svelte:fragment slot="leading-icon">
|
|
47
53
|
{#if $$slots['leading-icon']}
|
|
@@ -26,6 +26,7 @@ declare const TextEditor: $$__sveltets_2_IsomorphicComponent<{
|
|
|
26
26
|
removable?: boolean | undefined;
|
|
27
27
|
displayMode?: DisplayMode | undefined;
|
|
28
28
|
onChange?: ((value: string) => void) | undefined | undefined;
|
|
29
|
+
autoFocus?: boolean | undefined;
|
|
29
30
|
}, {
|
|
30
31
|
blur: FocusEvent;
|
|
31
32
|
focus: FocusEvent;
|
|
@@ -201,6 +201,9 @@
|
|
|
201
201
|
--uniface-popup-hint-color: #374151;
|
|
202
202
|
--uniface-context-menu-bg: #ffffff;
|
|
203
203
|
--uniface-context-menu-box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
|
|
204
|
+
--uniface-box-header-bg: #F8FAFC;
|
|
205
|
+
--uniface-box-footer-bg: #F8FAFC;
|
|
206
|
+
--uniface-box-border-radius: 8px;
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
.uniface-common-picker {
|
|
@@ -1564,6 +1567,17 @@
|
|
|
1564
1567
|
position: relative;
|
|
1565
1568
|
top: 1px;
|
|
1566
1569
|
}
|
|
1570
|
+
.uniface-card > div .card-action-bar.simple .action-item.disabled i {
|
|
1571
|
+
cursor: default;
|
|
1572
|
+
color: var(--uniface-disabled-button-text-color, #B3BCCA);
|
|
1573
|
+
}
|
|
1574
|
+
.uniface-card > div .card-action-bar.simple .action-item.disabled i:hover {
|
|
1575
|
+
color: var(--uniface-disabled-button-text-color, #B3BCCA);
|
|
1576
|
+
}
|
|
1577
|
+
.uniface-card > div .card-action-bar.simple .action-item.disabled i:active {
|
|
1578
|
+
position: relative;
|
|
1579
|
+
top: 0;
|
|
1580
|
+
}
|
|
1567
1581
|
.uniface-card > div .card-content {
|
|
1568
1582
|
overflow: hidden;
|
|
1569
1583
|
}
|
|
@@ -3024,6 +3038,16 @@
|
|
|
3024
3038
|
flex-direction: row;
|
|
3025
3039
|
align-items: center;
|
|
3026
3040
|
}
|
|
3041
|
+
.uniface-box .box-footer {
|
|
3042
|
+
width: 100%;
|
|
3043
|
+
background-color: var(--uniface-box-footer-bg, #F8FAFC);
|
|
3044
|
+
flex: 0 0 auto;
|
|
3045
|
+
position: relative;
|
|
3046
|
+
box-sizing: border-box;
|
|
3047
|
+
display: flex;
|
|
3048
|
+
flex-direction: row;
|
|
3049
|
+
align-items: center;
|
|
3050
|
+
}
|
|
3027
3051
|
.uniface-box .box-content {
|
|
3028
3052
|
flex: 1 1 auto;
|
|
3029
3053
|
position: relative;
|
|
@@ -4068,3 +4092,9 @@
|
|
|
4068
4092
|
visibility: hidden;
|
|
4069
4093
|
opacity: 0;
|
|
4070
4094
|
}
|
|
4095
|
+
|
|
4096
|
+
.uniface-vertical-middle-block {
|
|
4097
|
+
position: relative;
|
|
4098
|
+
top: 50%;
|
|
4099
|
+
transform: translateY(-50%);
|
|
4100
|
+
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type TreeNode from "./TreeNode";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @param parentField
|
|
8
|
-
* @param rootParentCode
|
|
9
|
-
*/
|
|
10
|
-
export declare const buildTree: (arr: Array<any>, keyField: string, textField: string, parentField: string, rootParentCode?: string | null) => Array<TreeNode>;
|
|
2
|
+
import type { NodeLevelCompare, RootDetermine } from "./TreeNode";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
buildTreeNode: (list: Array<any>, idKey: string, joinKey: string, textField: string, valueField?: string, isRoot?: RootDetermine, sortFun?: NodeLevelCompare) => Array<TreeNode>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -1,36 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
2
|
+
* 将一个数组转换成树状结构
|
|
3
|
+
* @param list 待转换的数组
|
|
4
|
+
* @param idKey 元素的主键
|
|
5
|
+
* @param joinKey 父子间连接字段
|
|
6
|
+
* @param valueField 取值的字段
|
|
7
|
+
* @param textField 显示文字的字段
|
|
8
|
+
* @param isRoot 判断是否是根节点,如果函数不存在,通过连接字段查询,无法获取到父节点就是根节点
|
|
9
|
+
* @param sortFun 比较函数,用于曾经排序
|
|
9
10
|
*/
|
|
10
|
-
const
|
|
11
|
+
const buildTreeNode = (list, idKey, joinKey, textField, valueField, isRoot, sortFun) => {
|
|
12
|
+
if (sortFun != null) {
|
|
13
|
+
list = list.sort(sortFun);
|
|
14
|
+
}
|
|
11
15
|
let nodes = [];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
let map = new Map();
|
|
17
|
+
list.forEach(item => {
|
|
18
|
+
let node = { value: item[valueField ?? idKey], text: item[textField], data: item };
|
|
19
|
+
if (isRoot != null) {
|
|
20
|
+
if (isRoot(item)) {
|
|
21
|
+
nodes.push(node);
|
|
22
|
+
map.set(item[idKey], node);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
let parent = map.get(item[joinKey]);
|
|
26
|
+
if (parent != null) {
|
|
27
|
+
parent.children = [...parent.children, node];
|
|
28
|
+
node.parent = parent;
|
|
29
|
+
map.set(item[idKey], node);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.warn('Isolated node:', item);
|
|
33
|
+
}
|
|
20
34
|
}
|
|
21
|
-
nodes.push(node);
|
|
22
35
|
}
|
|
23
|
-
|
|
36
|
+
else {
|
|
37
|
+
let parent = map.get(item[joinKey]);
|
|
38
|
+
if (parent != null) {
|
|
39
|
+
parent.children = [...parent.children, item];
|
|
40
|
+
node.parent = parent;
|
|
41
|
+
map.set(item[idKey], node);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
nodes.push(node);
|
|
45
|
+
map.set(item[idKey], node);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
24
49
|
return nodes;
|
|
25
50
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* @param arr
|
|
29
|
-
* @param keyField
|
|
30
|
-
* @param textField
|
|
31
|
-
* @param parentField
|
|
32
|
-
* @param rootParentCode
|
|
33
|
-
*/
|
|
34
|
-
export const buildTree = (arr, keyField, textField, parentField, rootParentCode = null) => {
|
|
35
|
-
return convertArrayToTree(arr, keyField, textField, parentField, rootParentCode);
|
|
51
|
+
export default {
|
|
52
|
+
buildTreeNode
|
|
36
53
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import TreeView from "./TreeView.svelte";
|
|
2
2
|
import type TreeNode from "./TreeNode";
|
|
3
|
-
import type { LazyLoader, NodeVisibleFun, OnNodeSelectionChange, CheckBranchFun, LoadChildrenFun } from "./TreeNode";
|
|
4
|
-
import
|
|
3
|
+
import type { LazyLoader, NodeVisibleFun, OnNodeSelectionChange, CheckBranchFun, LoadChildrenFun, NodeLevelCompare, RootDetermine } from "./TreeNode";
|
|
4
|
+
import treeUtils from "./TreeUtils";
|
|
5
5
|
export default TreeView;
|
|
6
|
-
export {
|
|
7
|
-
export type { TreeNode, LazyLoader, NodeVisibleFun, OnNodeSelectionChange, CheckBranchFun, LoadChildrenFun };
|
|
6
|
+
export { treeUtils };
|
|
7
|
+
export type { TreeNode, LazyLoader, NodeVisibleFun, OnNodeSelectionChange, CheckBranchFun, LoadChildrenFun, NodeLevelCompare, RootDetermine };
|
package/dist/tree-view/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ticatec/uniface-element",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "uniface web elements",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"types": "./dist/checkbox/index.d.ts",
|
|
97
97
|
"import": "./dist/checkbox/index.js"
|
|
98
98
|
},
|
|
99
|
-
"./
|
|
99
|
+
"./FullScreenOverlay": {
|
|
100
100
|
"types": "./dist/common/FullscreenOverlay.svelte.d.ts",
|
|
101
101
|
"import": "./dist/common/FullscreenOverlay.svelte"
|
|
102
102
|
},
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
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> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const ListViewItem: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type ListViewItem = InstanceType<typeof ListViewItem>;
|
|
18
|
-
export default ListViewItem;
|