diff --git a/docs/src/routes/components/jsdocs.json b/docs/src/routes/components/jsdocs.json index 44b3994..e38a426 100644 --- a/docs/src/routes/components/jsdocs.json +++ b/docs/src/routes/components/jsdocs.json @@ -2369,6 +2369,11 @@ "description": "选择改变事件", "name": "change", "values": "" + },{ + "isEvent": true, + "description": "改变完成事件", + "name": "changeEnd", + "values": "" } ], "Slider": [ diff --git a/src/components/ColorPicker/Alpha.svelte b/src/components/ColorPicker/Alpha.svelte index e9a9851..977d692 100755 --- a/src/components/ColorPicker/Alpha.svelte +++ b/src/components/ColorPicker/Alpha.svelte @@ -36,6 +36,6 @@
- console.log(event.detail)} /> + console.log()} />
\ No newline at end of file diff --git a/src/components/ColorPicker/Chrome.svelte b/src/components/ColorPicker/Chrome.svelte index baefbb7..f6de36b 100755 --- a/src/components/ColorPicker/Chrome.svelte +++ b/src/components/ColorPicker/Chrome.svelte @@ -1,25 +1,126 @@ - + - - +
- -
- update({h, s: event.detail.s, v: event.detail.v, a})} /> + +
+ update({ h, s: event.detail.s, v: event.detail.v, a })} />
- +
- +
-
- update({h: event.detail, s, v, a})} /> +
+ update({ h: event.detail, s, v, a })} />
{#if !disableAlpha} -
- +
+
{/if}
- +
{#if fieldsIndex === 0}
- update(event.target.value)} - /> + on:keypress={onlyChars('#0123456789abcdefABCFDEF')} + on:input={event => update(event.target.value)} />
{:else if fieldsIndex === 1} @@ -281,8 +286,7 @@ value={r} maxlength={3} on:keypress={onlyNumbers} - on:input={event => update({r: parseInt(event.target.value), g, b, a})} - /> + on:input={event => update({ r: parseInt(event.target.value), g, b, a })} />
@@ -292,18 +296,17 @@ value={g} maxlength={3} on:keypress={onlyNumbers} - on:input={event => update({r, g: parseInt(event.target.value), b, a})} - /> + on:input={event => update({ r, g: parseInt(event.target.value), b, a })} />
- update({r, g, b: parseInt(event.target.value), a})} - /> + on:input={event => update({ r, g, b: parseInt(event.target.value), a })} />
{#if !disableAlpha} @@ -314,8 +317,7 @@ value={Math.round(a * 100) / 100} maxlength={4} on:keypress={onlyNumbersAndDot} - on:input={event => updateAlpha(parseFloat(event.target.value))} - /> + on:input={event => updateAlpha(parseFloat(event.target.value))} />
{/if} @@ -323,13 +325,13 @@ {:else if fieldsIndex === 2}
- update({h: parseInt(event.target.value), s, l, a})} - /> + on:input={event => update({ h: parseInt(event.target.value), s, l, a })} />
@@ -339,8 +341,7 @@ type="text" maxlength={4} on:keypress={onlyNumbers} - on:input={event => update({h, s: parseFloat(event.target.value) / 100, l, a})} - /> + on:input={event => update({ h, s: parseFloat(event.target.value) / 100, l, a })} />
@@ -350,8 +351,7 @@ type="text" maxlength={4} on:keypress={onlyNumbers} - on:input={event => update({h, s, l: parseFloat(event.target.value) / 100, a})} - /> + on:input={event => update({ h, s, l: parseFloat(event.target.value) / 100, a })} />
{#if !disableAlpha} @@ -362,8 +362,7 @@ type="text" maxlength={4} on:keypress={onlyNumbersAndDot} - on:input={event => updateAlpha(parseFloat(event.target.value))} - /> + on:input={event => updateAlpha(parseFloat(event.target.value))} />
{/if} @@ -372,9 +371,9 @@
-
fieldsIndex = (fieldsIndex === 0 ? 2 : (fieldsIndex - 1) % 3)}>
-
fieldsIndex = (fieldsIndex + 1) % 3}>
+
(fieldsIndex = fieldsIndex === 0 ? 2 : (fieldsIndex - 1) % 3)} /> +
(fieldsIndex = (fieldsIndex + 1) % 3)} />
-
\ No newline at end of file +
diff --git a/src/components/ColorPicker/ColorPicker.svelte b/src/components/ColorPicker/ColorPicker.svelte index fcff9a5..9e55bc8 100644 --- a/src/components/ColorPicker/ColorPicker.svelte +++ b/src/components/ColorPicker/ColorPicker.svelte @@ -1,38 +1,49 @@ - -{#if mode === 1} -
- - {#if active} -
- -
- {/if} -
-{:else} - -{/if} + +{#if mode === 1} +
+ focusStatus = false} value={color} style="background: {color};" readonly /> + {#if active} +
+ +
+ {/if} +
+{:else} + +{/if}