@ticatec/uniface-element 0.1.24 → 0.1.31
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/accordion/Accordion.svelte +9 -1
- package/dist/accordion/AccordionItemView.svelte +14 -4
- package/dist/accordion/AccordionItemView.svelte.d.ts +1 -0
- package/dist/app-top-bar/AppTopBar.svelte +9 -13
- package/dist/app-top-bar/AppTopBar.svelte.d.ts +1 -1
- package/dist/breadcrumbs/Breadcrumb.d.ts +4 -0
- package/dist/breadcrumbs/Breadcrumbs.svelte +21 -0
- package/dist/breadcrumbs/Breadcrumbs.svelte.d.ts +24 -0
- package/dist/breadcrumbs/index.d.ts +4 -0
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/button/Button.svelte +2 -2
- package/dist/card/Card.svelte +3 -1
- package/dist/card/Card.svelte.d.ts +1 -0
- package/dist/card/CommonCardActionBar.svelte +4 -2
- package/dist/card/CommonCardActionBar.svelte.d.ts +1 -0
- package/dist/color-picker/ColorPicker.svelte +59 -0
- package/dist/color-picker/ColorPicker.svelte.d.ts +29 -0
- package/dist/color-picker/ColorPickerPanel.svelte +179 -0
- package/dist/color-picker/ColorPickerPanel.svelte.d.ts +23 -0
- package/dist/color-picker/index.d.ts +2 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/common/CommonPicker.svelte +6 -3
- package/dist/common/Popover.svelte +9 -2
- package/dist/common-editor/CommonEditor.svelte +8 -7
- package/dist/common-range-editor/CommonRangeEditor.svelte +1 -5
- package/dist/data-table/DataTable.svelte +2 -1
- package/dist/data-table/DataTable.svelte.d.ts +1 -0
- package/dist/data-table/lib/ActionsColumn.d.ts +4 -0
- package/dist/data-table/parts/ActionsPanel.svelte +1 -1
- package/dist/data-table/parts/ActionsRow.svelte +4 -3
- package/dist/data-table/parts/ActionsRow.svelte.d.ts +1 -0
- package/dist/date-picker/DatePicker.svelte +2 -2
- package/dist/date-picker/DateTimePicker.svelte +1 -1
- package/dist/date-range/DateRangeEditor.svelte +1 -1
- package/dist/drawer/Drawer.svelte +9 -17
- package/dist/drawer/Drawer.svelte.d.ts +3 -7
- package/dist/i18n_resources/uniface_cn_resource.d.ts +1 -0
- package/dist/i18n_resources/uniface_cn_resource.js +2 -1
- package/dist/i18n_resources/uniface_en_resource.d.ts +2 -0
- package/dist/i18n_resources/uniface_en_resource.js +3 -1
- package/dist/memo-editor/MemoEditor.svelte +1 -1
- package/dist/nav-menu/MenuItem.d.ts +1 -1
- package/dist/options-multi-select/OptionsMultiSelect.svelte +1 -1
- package/dist/options-select/OptionsSelect.svelte +2 -2
- package/dist/prompts-text-editor/PromptsTextEditor.svelte +9 -9
- package/dist/tabs/Tabs.svelte +2 -2
- package/dist/tag/Tag.svelte +1 -1
- package/dist/ticatec-uniface-web.css +178 -93
- package/dist/unit-number-editor/UnitNumberEditor.svelte +6 -5
- package/package.json +6 -2
- package/dist/data-table/lib/AdvColumn.d.ts +0 -36
- /package/dist/{data-table/lib/AdvColumn.js → breadcrumbs/Breadcrumb.js} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type AccordionItem from "./AccordionItem";
|
|
4
4
|
import Accordion from "./AccordionItemView.svelte";
|
|
5
|
+
import {onMount} from "svelte";
|
|
5
6
|
|
|
6
7
|
export let style: string = '';
|
|
7
8
|
export {className as class};
|
|
@@ -14,6 +15,13 @@
|
|
|
14
15
|
|
|
15
16
|
let openSet: Set<AccordionItem> = new Set();
|
|
16
17
|
|
|
18
|
+
onMount(() => {
|
|
19
|
+
if (exclusive && activeItem == null) {
|
|
20
|
+
openSet.add(accordions[0]);
|
|
21
|
+
accordions = [...accordions];
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
17
25
|
const handleAccordionClick = (accordion: AccordionItem) => (event: MouseEvent) => {
|
|
18
26
|
if (exclusive) {
|
|
19
27
|
if (activeItem != accordion) {
|
|
@@ -36,7 +44,7 @@
|
|
|
36
44
|
|
|
37
45
|
<div class="uniface-accordion-panel {className}" {style} class:compact>
|
|
38
46
|
{#each accordions as accordion}
|
|
39
|
-
<Accordion title={accordion.title} isOpen={openSet.has(accordion)} onClick={handleAccordionClick(accordion)}>
|
|
47
|
+
<Accordion title={accordion.title} isOpen={openSet.has(accordion)} {exclusive} onClick={handleAccordionClick(accordion)}>
|
|
40
48
|
<svelte:component this={accordion.component} {...accordion.params}/>
|
|
41
49
|
</Accordion>
|
|
42
50
|
{/each}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
export let onClick: MouseClickHandler = null as unknown as MouseClickHandler;
|
|
7
7
|
export let header: any = null;
|
|
8
8
|
|
|
9
|
+
export let exclusive: boolean;
|
|
10
|
+
|
|
9
11
|
</script>
|
|
10
12
|
|
|
11
13
|
<style>
|
|
@@ -16,14 +18,22 @@
|
|
|
16
18
|
<div class="accordion">
|
|
17
19
|
<div class="header" aria-hidden="true" on:click={onClick}>
|
|
18
20
|
{#if header}
|
|
19
|
-
<svelte:component this={header} {title} {isOpen}/>
|
|
21
|
+
<svelte:component this={header} {title} {isOpen}/> <!-- TODO 自定义每个条目的标题 -->
|
|
20
22
|
{:else}
|
|
21
|
-
<div style="flex: 0 0 auto; padding-right: 8px">
|
|
22
|
-
<i class="{isOpen ? 'uniface-icon-chevron-down' : 'uniface-icon-chevron-right'}"></i>
|
|
23
|
-
</div>
|
|
24
23
|
<div style="flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
|
|
25
24
|
<span>{title}</span>
|
|
26
25
|
</div>
|
|
26
|
+
{#if exclusive}
|
|
27
|
+
{#if isOpen}
|
|
28
|
+
<div style="flex: 0 0 auto;">
|
|
29
|
+
<i class="icon_google_folder_open"></i>
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
32
|
+
{:else}
|
|
33
|
+
<div style="flex: 0 0 auto;">
|
|
34
|
+
<i class="{isOpen ? 'icon_google_keyboard_arrow_up' : 'icon_google_keyboard_arrow_down'}"></i>
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
27
37
|
{/if}
|
|
28
38
|
</div>
|
|
29
39
|
{#if isOpen}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
export let title: string
|
|
2
|
+
export let title: string;
|
|
3
3
|
export let style: string = '';
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<div class="uniface-
|
|
6
|
+
<div class="uniface-top-bar" {style}>
|
|
7
7
|
{#if $$slots['home']}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
<div class="bar-home">
|
|
9
|
+
<slot name="home">
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
</slot>
|
|
12
|
+
</div>
|
|
13
13
|
{/if}
|
|
14
|
-
<div class="
|
|
14
|
+
<div class="main-content">
|
|
15
15
|
<slot>
|
|
16
16
|
<span>{title}</span>
|
|
17
17
|
</slot>
|
|
18
18
|
</div>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<slot name="right">
|
|
22
|
-
</slot>
|
|
23
|
-
</div>
|
|
24
|
-
{/if}
|
|
19
|
+
<slot name="right">
|
|
20
|
+
</slot>
|
|
25
21
|
</div>
|
|
@@ -17,7 +17,7 @@ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
|
17
17
|
children?: any;
|
|
18
18
|
} : {});
|
|
19
19
|
declare const AppTopBar: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
|
-
title
|
|
20
|
+
title: string;
|
|
21
21
|
style?: string;
|
|
22
22
|
}, {
|
|
23
23
|
home: {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// 定义组件属性
|
|
3
|
+
import type Breadcrumb from "./Breadcrumb";
|
|
4
|
+
|
|
5
|
+
export let items: Array<Breadcrumb> = []; //
|
|
6
|
+
export let separator: string = "/"; // 分隔符
|
|
7
|
+
export let onItemClick: (item: any) => (event: MouseEvent) => void;
|
|
8
|
+
|
|
9
|
+
export let style: string = '';
|
|
10
|
+
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
<div class="uniface-breadcrumbs" {style}>
|
|
15
|
+
{#each items as item, idx}
|
|
16
|
+
<div>
|
|
17
|
+
<span>{separator}</span>
|
|
18
|
+
<span aria-hidden="true" class="breadcrumb" on:click={idx==items.length-1 ? null : onItemClick(item.data)}>{item.label}</span>
|
|
19
|
+
</div>
|
|
20
|
+
{/each}
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type Breadcrumb from "./Breadcrumb";
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Breadcrumbs: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
items?: Array<Breadcrumb>;
|
|
17
|
+
separator?: string;
|
|
18
|
+
onItemClick: (item: any) => (event: MouseEvent) => void;
|
|
19
|
+
style?: string;
|
|
20
|
+
}, {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
}, {}, {}, string>;
|
|
23
|
+
type Breadcrumbs = InstanceType<typeof Breadcrumbs>;
|
|
24
|
+
export default Breadcrumbs;
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
<div {style} class="uniface-button common-button {variant} {size} {type}" aria-hidden="true" class:disabled
|
|
31
31
|
on:click={handleClick}>
|
|
32
32
|
{#if icon != null}
|
|
33
|
-
<i
|
|
33
|
+
<i class={icon}></i>
|
|
34
34
|
{/if}
|
|
35
35
|
<slot>
|
|
36
36
|
{#if label != null && label.length > 0}
|
|
37
|
-
<span>{label}</span>
|
|
37
|
+
<span style="flex: 1 1 auto">{label}</span>
|
|
38
38
|
{/if}
|
|
39
39
|
</slot>
|
|
40
40
|
</div>
|
package/dist/card/Card.svelte
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
export let actions: Array<CardAction> = [];
|
|
10
10
|
export let variant: 'plain' | '3d' = 'plain';
|
|
11
11
|
|
|
12
|
+
export let iconColor: string | null = null;
|
|
13
|
+
|
|
12
14
|
</script>
|
|
13
15
|
|
|
14
16
|
<div class="uniface-card" class:shadowBox={variant=='3d'}>
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
<slot/>
|
|
27
29
|
</div>
|
|
28
30
|
{#if actions && actions.length > 0}
|
|
29
|
-
<CommonCardActionBar {actions}/>
|
|
31
|
+
<CommonCardActionBar color={iconColor} {actions}/>
|
|
30
32
|
{:else }
|
|
31
33
|
{#if $$slots['action-bar']}
|
|
32
34
|
<div class="card-action-bar">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import utils from "../common/utils";
|
|
4
4
|
|
|
5
5
|
export let actions: Array<CardAction>;
|
|
6
|
-
|
|
6
|
+
export let color: string | null = null;
|
|
7
7
|
|
|
8
8
|
let clickEnable = true;
|
|
9
9
|
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
$: fontColor = color ? `color: ${color}` : '';
|
|
20
|
+
|
|
19
21
|
</script>
|
|
20
22
|
|
|
21
|
-
<div class="card-action-bar simple">
|
|
23
|
+
<div class="card-action-bar simple" style="{fontColor}">
|
|
22
24
|
{#each actions as action}
|
|
23
25
|
<div class:disabled={action.disabled} class="action-item">
|
|
24
26
|
{#if action.icon}
|
|
@@ -14,6 +14,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
14
14
|
}
|
|
15
15
|
declare const CommonCardActionBar: $$__sveltets_2_IsomorphicComponent<{
|
|
16
16
|
actions: Array<CardAction>;
|
|
17
|
+
color?: string | null;
|
|
17
18
|
}, {
|
|
18
19
|
[evt: string]: CustomEvent<any>;
|
|
19
20
|
}, {}, {}, string>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import {DisplayMode} from "../common/DisplayMode";
|
|
5
|
+
import type {OnChangeHandler} from "../common/OnChangeHandler";
|
|
6
|
+
import CommonPicker from "../common/CommonPicker.svelte";
|
|
7
|
+
|
|
8
|
+
type OnActionHandler = () => void;
|
|
9
|
+
|
|
10
|
+
export let showHex = true;
|
|
11
|
+
export let showRgb = false;
|
|
12
|
+
|
|
13
|
+
export let variant: '' | 'plain' | 'outlined' | 'filled' = '';
|
|
14
|
+
export let disabled: boolean = false;
|
|
15
|
+
export let readonly: boolean = false;
|
|
16
|
+
export let compact: boolean = false;
|
|
17
|
+
export let value: any = "#ff3e00";
|
|
18
|
+
export let style: string = '';
|
|
19
|
+
export let onChange: OnChangeHandler<any> = null as unknown as OnChangeHandler<any>;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
let oldValue = value;
|
|
23
|
+
|
|
24
|
+
$: if (oldValue != value) {
|
|
25
|
+
oldValue = value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let editor: any;
|
|
29
|
+
|
|
30
|
+
const clean = () => {
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const handleActionIconClick = () => {
|
|
35
|
+
editor.click();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function handleColorChange(event) {
|
|
39
|
+
selectedColor = event.target.value;
|
|
40
|
+
rgbValues = hexToRgb(selectedColor);
|
|
41
|
+
console.log(selectedColor, rgbValues);
|
|
42
|
+
// dispatch('change', {
|
|
43
|
+
// hex: selectedColor,
|
|
44
|
+
// rgb: rgbValues
|
|
45
|
+
// });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<CommonPicker displayMode={DisplayMode.Edit} {variant} {style} {compact} className="multiple" dropDownIcon="icon_google_color_lens"
|
|
51
|
+
canClean={false} autoFit {clean} textValue={value} {readonly} {disabled} iconClickHandler={handleActionIconClick}>
|
|
52
|
+
<!-- <div style="flex: 1 1 auto; width: 50%; height: 60%; border-radius: 4px; background-color: {value}"></div>-->
|
|
53
|
+
<div style="width: 100%; display: flex; overflow: hidden; flex-direction: row; align-items: center; height: 100%; gap: 8px">
|
|
54
|
+
<input bind:this={editor} style="flex: 0 0 auto; width: 40%; height: 80%; border-radius: 8px;" type="color" bind:value on:change={handleColorChange}/>
|
|
55
|
+
<input style="flex: 0 0 auto; width: 50%; text-align: center" class="text-editor" readonly value={value??''} {disabled}/>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</CommonPicker>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { OnChangeHandler } from "../common/OnChangeHandler";
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const ColorPicker: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
showHex?: boolean;
|
|
17
|
+
showRgb?: boolean;
|
|
18
|
+
variant?: "" | "plain" | "outlined" | "filled";
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
compact?: boolean;
|
|
22
|
+
value?: any;
|
|
23
|
+
style?: string;
|
|
24
|
+
onChange?: OnChangeHandler<any>;
|
|
25
|
+
}, {
|
|
26
|
+
[evt: string]: CustomEvent<any>;
|
|
27
|
+
}, {}, {}, string>;
|
|
28
|
+
type ColorPicker = InstanceType<typeof ColorPicker>;
|
|
29
|
+
export default ColorPicker;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// Define props with default values
|
|
5
|
+
import i18n from "@ticatec/i18n";
|
|
6
|
+
import langRes from "../i18n_resources/uniface_en_resource";
|
|
7
|
+
|
|
8
|
+
export let initialColor = "#ffffff";
|
|
9
|
+
export let showHex = true;
|
|
10
|
+
export let showRgb = false;
|
|
11
|
+
export let swatches = [];
|
|
12
|
+
|
|
13
|
+
let selectedColor = initialColor;
|
|
14
|
+
let rgbValues = hexToRgb(initialColor);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// Convert hex to RGB
|
|
18
|
+
function hexToRgb(hex) {
|
|
19
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
20
|
+
return result ? {
|
|
21
|
+
r: parseInt(result[1], 16),
|
|
22
|
+
g: parseInt(result[2], 16),
|
|
23
|
+
b: parseInt(result[3], 16)
|
|
24
|
+
} : { r: 0, g: 0, b: 0 };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Emit change event when color changes
|
|
28
|
+
function handleColorChange(event) {
|
|
29
|
+
selectedColor = event.target.value;
|
|
30
|
+
rgbValues = hexToRgb(selectedColor);
|
|
31
|
+
dispatch('change', {
|
|
32
|
+
hex: selectedColor,
|
|
33
|
+
rgb: rgbValues
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Select a swatch
|
|
38
|
+
function selectSwatch(color) {
|
|
39
|
+
selectedColor = color;
|
|
40
|
+
rgbValues = hexToRgb(selectedColor);
|
|
41
|
+
// dispatch('change', {
|
|
42
|
+
// hex: selectedColor,
|
|
43
|
+
// rgb: rgbValues
|
|
44
|
+
// });
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<div class="color-picker">
|
|
49
|
+
<label for="color-input">
|
|
50
|
+
{i18n.getText('uniface.pickupColor', langRes.uniface.colorPicker)
|
|
51
|
+
}
|
|
52
|
+
</label>
|
|
53
|
+
|
|
54
|
+
<div class="color-input-group">
|
|
55
|
+
<input
|
|
56
|
+
id="color-input"
|
|
57
|
+
type="color"
|
|
58
|
+
bind:value={selectedColor}
|
|
59
|
+
on:change={handleColorChange}
|
|
60
|
+
/>
|
|
61
|
+
<div
|
|
62
|
+
class="color-preview"
|
|
63
|
+
style="background-color: {selectedColor};"
|
|
64
|
+
></div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
{#if showHex}
|
|
68
|
+
<div class="color-value">
|
|
69
|
+
<span>HEX:</span> {selectedColor}
|
|
70
|
+
</div>
|
|
71
|
+
{/if}
|
|
72
|
+
|
|
73
|
+
{#if showRgb}
|
|
74
|
+
<div class="color-value">
|
|
75
|
+
<span>RGB:</span> rgb({rgbValues.r}, {rgbValues.g}, {rgbValues.b})
|
|
76
|
+
</div>
|
|
77
|
+
{/if}
|
|
78
|
+
|
|
79
|
+
{#if swatches && swatches.length > 0}
|
|
80
|
+
<div class="swatches">
|
|
81
|
+
{#each swatches as swatch}
|
|
82
|
+
<button
|
|
83
|
+
class="swatch"
|
|
84
|
+
style="background-color: {swatch};"
|
|
85
|
+
on:click={() => selectSwatch(swatch)}
|
|
86
|
+
aria-label={`Select color ${swatch}`}
|
|
87
|
+
class:selected={selectedColor === swatch}
|
|
88
|
+
></button>
|
|
89
|
+
{/each}
|
|
90
|
+
</div>
|
|
91
|
+
{/if}
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<style>
|
|
95
|
+
.color-picker {
|
|
96
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
97
|
+
padding: 16px;
|
|
98
|
+
border-radius: 8px;
|
|
99
|
+
background-color: #f8f9fa;
|
|
100
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
101
|
+
width: 100%;
|
|
102
|
+
max-width: 300px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
label {
|
|
106
|
+
display: block;
|
|
107
|
+
margin-bottom: 8px;
|
|
108
|
+
font-weight: 500;
|
|
109
|
+
color: #333;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.color-input-group {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
margin-bottom: 12px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
input[type="color"] {
|
|
119
|
+
-webkit-appearance: none;
|
|
120
|
+
width: 40px;
|
|
121
|
+
height: 40px;
|
|
122
|
+
border: none;
|
|
123
|
+
padding: 0;
|
|
124
|
+
background: none;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
input[type="color"]::-webkit-color-swatch-wrapper {
|
|
129
|
+
padding: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
input[type="color"]::-webkit-color-swatch {
|
|
133
|
+
border: 1px solid #ddd;
|
|
134
|
+
border-radius: 4px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.color-preview {
|
|
138
|
+
width: 40px;
|
|
139
|
+
height: 40px;
|
|
140
|
+
margin-left: 12px;
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
border: 1px solid #ddd;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.color-value {
|
|
146
|
+
margin-bottom: 8px;
|
|
147
|
+
font-size: 14px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.color-value span {
|
|
151
|
+
font-weight: 600;
|
|
152
|
+
margin-right: 4px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.swatches {
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-wrap: wrap;
|
|
158
|
+
gap: 8px;
|
|
159
|
+
margin-top: 12px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.swatch {
|
|
163
|
+
width: 24px;
|
|
164
|
+
height: 24px;
|
|
165
|
+
border-radius: 50%;
|
|
166
|
+
border: 1px solid #ddd;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
transition: transform 0.2s ease;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.swatch:hover {
|
|
172
|
+
transform: scale(1.1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.swatch.selected {
|
|
176
|
+
border: 2px solid #333;
|
|
177
|
+
box-shadow: 0 0 0 2px white inset;
|
|
178
|
+
}
|
|
179
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
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: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const ColorPickerPanel: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
initialColor?: string;
|
|
16
|
+
showHex?: boolean;
|
|
17
|
+
showRgb?: boolean;
|
|
18
|
+
swatches?: any[];
|
|
19
|
+
}, {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
}, {}, {}, string>;
|
|
22
|
+
type ColorPickerPanel = InstanceType<typeof ColorPickerPanel>;
|
|
23
|
+
export default ColorPickerPanel;
|
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
</script>
|
|
30
30
|
{#if displayMode === DisplayMode.View}
|
|
31
31
|
<div class="uniface-display-field">
|
|
32
|
-
<
|
|
32
|
+
<div class="content">
|
|
33
|
+
<span>{textValue}</span>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
33
36
|
</div>
|
|
34
37
|
{:else}
|
|
35
38
|
<div bind:this={editorElement} class="uniface-common-editor {variant} uniface-common-picker {className}" tabindex="-1" class:compact
|
|
@@ -37,11 +40,11 @@
|
|
|
37
40
|
{#if readonly || disabled}
|
|
38
41
|
<input style="width: 100%" class="readonly" class:disabled readonly {disabled} value={textValue}/>
|
|
39
42
|
{:else}
|
|
40
|
-
<div style="flex: 1 1 auto; position: relative; height: 100%">
|
|
43
|
+
<div style="flex: 1 1 auto; position: relative; overflow: hidden; height: 100%">
|
|
41
44
|
<slot></slot>
|
|
42
45
|
{#if canClean && textValue && textValue.length > 0}
|
|
43
46
|
<div class="uniface-editor-clean-icon">
|
|
44
|
-
<i class="
|
|
47
|
+
<i class="icon_google_clear clickable " aria-hidden="true" on:click={clean}></i>
|
|
45
48
|
</div>
|
|
46
49
|
{/if}
|
|
47
50
|
</div>
|
|
@@ -74,9 +74,16 @@
|
|
|
74
74
|
window.addEventListener("resize", updatePosition);
|
|
75
75
|
document.addEventListener("scroll", updatePosition, {passive: false});
|
|
76
76
|
const interval = setInterval(checkPosition, 10); // 每 100ms 检测一次
|
|
77
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
78
|
+
for (let entry of entries) {
|
|
79
|
+
updatePosition();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
resizeObserver.observe(contentPanel);
|
|
77
83
|
return () => {
|
|
78
84
|
window.removeEventListener("resize", updatePosition);
|
|
79
85
|
document.removeEventListener("scroll", updatePosition);
|
|
86
|
+
resizeObserver.disconnect();
|
|
80
87
|
clearInterval(interval);
|
|
81
88
|
};
|
|
82
89
|
});
|
|
@@ -95,8 +102,8 @@
|
|
|
95
102
|
</script>
|
|
96
103
|
<svelte:window bind:innerWidth={w} bind:innerHeight={h}/>
|
|
97
104
|
<Portal target="body">
|
|
98
|
-
<div class="uniface-popover-wrapper" class:hidden style="{vertPos}; left: {position.left-margin}px; width: {position.width}px; ">
|
|
99
|
-
<div class="uniface-popover"
|
|
105
|
+
<div class="uniface-popover-wrapper" class:hidden style="{vertPos}; height: auto; left: {position.left-margin}px; width: {position.width}px; ">
|
|
106
|
+
<div class="uniface-popover" use:clickOutside
|
|
100
107
|
on:outerClick={close}>
|
|
101
108
|
<div bind:this={contentPanel} style="{horzPos}">
|
|
102
109
|
<div class="contents" style="{style}">
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
{:else}
|
|
44
44
|
<div class:compact class="uniface-common-editor {variant} {className}" tabindex="-1"
|
|
45
45
|
style="{style}">
|
|
46
|
-
{#if
|
|
47
|
-
<div class="editor-prefix" tabindex="-1" style="flex: 0 0 auto;">
|
|
48
|
-
<span>{prefix}</span>
|
|
49
|
-
</div>
|
|
50
|
-
{:else if $$slots['leading-icon'] && hasLeadingIcon}
|
|
46
|
+
{#if $$slots['leading-icon'] && hasLeadingIcon}
|
|
51
47
|
<div class="editor-embed-icon" style="flex: 0 0 auto;">
|
|
52
48
|
<slot name="leading-icon"/>
|
|
53
49
|
</div>
|
|
50
|
+
{:else if !utils.isEmpty(prefix)}
|
|
51
|
+
<div class="editor-prefix" tabindex="-1" style="flex: 0 0 auto;">
|
|
52
|
+
<span>{prefix}</span>
|
|
53
|
+
</div>
|
|
54
54
|
{/if}
|
|
55
55
|
{#if disabled || readonly}
|
|
56
56
|
<input style="flex: 1 1 auto" {value} {disabled} {readonly} {placeholder}>
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
<div style="position: relative; flex: 1 1 auto">
|
|
59
59
|
<slot/>
|
|
60
60
|
<div class="uniface-editor-clean-icon {showActionIcon ? '' : 'hidden'}">
|
|
61
|
-
<i class="
|
|
61
|
+
<i class="icon_google_clear clickable" aria-hidden="true" on:click={clean}></i>
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
{/if}
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
<div class="editor-suffix" style="flex: 0 0 auto;">
|
|
67
67
|
<span>{suffix}</span>
|
|
68
68
|
</div>
|
|
69
|
-
{
|
|
69
|
+
{/if}
|
|
70
|
+
{#if $$slots['trailing-icon'] && hasTrailingIcon}
|
|
70
71
|
<div class="editor-embed-icon" style="flex: 0 0 auto;">
|
|
71
72
|
<slot name="trailing-icon"/>
|
|
72
73
|
</div>
|