修复显示bug

This commit is contained in:
DLLCNX 2023-02-14 15:45:59 +08:00
parent 9137cddca7
commit af32edaa54
12 changed files with 22254 additions and 6128 deletions

View File

@ -29,73 +29,13 @@
$ npm install --save bulma svelma-pro $ npm install --save bulma svelma-pro
#### scss ### 3. scss支持
$ npm install --save-dev svelte-preprocess autoprefixer node-sass sass 因为组件库使用了sass样式扩展所以需要项目可以编译sass语法。如果没有集成可以参考此文档。
### 3. config
在你的rollup或者webpack配置文件中添加scss支持:
```js [svelte-sass-template](https://github.com/KeiferJu/svelte-sass-template)
// rollup配置 rollup.config.js
import sveltePreprocess from 'svelte-preprocess';
// ...
const preprocess = sveltePreprocess({
scss: {
includePaths: ['src'],
},
postcss: {
plugins: [require('autoprefixer')],
},
});
export default {
// ...
plugins: [
svelte({
// ...
preprocess: preprocess,
})
]
}
```
```js
// webpack配置 webpack.config.js
import sveltePreprocess from 'svelte-preprocess';
// ...
const preprocess = sveltePreprocess({
scss: {
includePaths: ['src'],
},
postcss: {
plugins: [require('autoprefixer')],
},
});
module.export = {
// ...
module: {
rules: [
{
test: /.(svelte|html)$/,
use: {
loader: 'svelte-loader',
options: {
preprocess,
// ...
}
}
},
]
},
]
}
```
### 4. 引入Bulma的CSS样式和svelma-pro组件 ### 4. 引入Bulma的CSS样式和svelma-pro组件
@ -116,14 +56,4 @@ module.export = {
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"></link> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"></link>
``` ```
...或者通过npm包: ...或者下载`fontawesome-free`包,引入到静态资产目录通过html引入.
$ npm install --save @fortawesome/fontawesome-free
```html
<!-- main.js or client.js(sapper) -->
<script>
import 'bulma/css/bulma.css'
import '@fortawesome/fontawesome-free/css/all.css'
</script>
```

11902
docs/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
"chokidar": "^3.0.1", "chokidar": "^3.0.1",
"codesandbox": "^2.1.6", "codesandbox": "^2.1.6",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^1.0.0", "rollup": "^2.3.4",
"rollup-plugin-babel": "^4.0.2", "rollup-plugin-babel": "^4.0.2",
"rollup-plugin-commonjs": "^9.1.6", "rollup-plugin-commonjs": "^9.1.6",
"rollup-plugin-includepaths": "^0.2.3", "rollup-plugin-includepaths": "^0.2.3",
@ -35,8 +35,8 @@
"rollup-plugin-node-resolve": "^4.0.0", "rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-replace": "^2.0.0", "rollup-plugin-replace": "^2.0.0",
"rollup-plugin-scss": "^1.0.1", "rollup-plugin-scss": "^1.0.1",
"rollup-plugin-svelte": "^5.0.1", "rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^4.0.4", "rollup-plugin-terser": "^7.0.0",
"sapper": "^0.27.4" "sapper": "^0.27.4"
} }
} }

View File

@ -36,9 +36,14 @@ export default {
}), }),
// scss(), // scss(),
svelte({ svelte({
compilerOptions:{
// enable run-time checks when not in production
dev, dev,
// generate: production ? 'dom' : 'ssr',
hydratable: true, hydratable: true,
emitCss: true, emitCss: true,
},
preprocess: autoPreprocess({ preprocess: autoPreprocess({
postcss: { postcss: {
plugins: [require('autoprefixer')()], plugins: [require('autoprefixer')()],

View File

@ -2640,6 +2640,24 @@
"name": "slot", "name": "slot",
"values": "default,left,right" "values": "default,left,right"
}, },
{
"description": "显示气泡",
"type": [
"Boolean"
],
"defaultvalue": "false",
"name": "tip",
"values": "default,true,false"
},
{
"description": "气泡显示值进行处理,例如:(e)=> e+1",
"type": [
"Function"
],
"defaultvalue": "value",
"name": "tipRender",
"values": "value"
},
{ {
"isEvent": true, "isEvent": true,
"description": "选择改变事件", "description": "选择改变事件",

12784
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
"postcss": "^7.0.17", "postcss": "^7.0.17",
"prettier": "^1.17.1", "prettier": "^1.17.1",
"prettier-plugin-svelte": "^0.5.1", "prettier-plugin-svelte": "^0.5.1",
"rollup": "^1.2.2", "rollup": "^2.3.4",
"rollup-plugin-alias": "^1.5.1", "rollup-plugin-alias": "^1.5.1",
"rollup-plugin-analyzer": "^3.0.1", "rollup-plugin-analyzer": "^3.0.1",
"rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-bundle-size": "^1.0.3",
@ -53,8 +53,8 @@
"rollup-plugin-livereload": "^1.0.4", "rollup-plugin-livereload": "^1.0.4",
"rollup-plugin-node-resolve": "^4.0.1", "rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-scss": "^1.0.1", "rollup-plugin-scss": "^1.0.1",
"rollup-plugin-svelte": "^5.0.3", "rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^4.0.4", "rollup-plugin-terser": "^7.0.0",
"sirv-cli": "^0.3.1", "sirv-cli": "^0.3.1",
"standard-version": "^6.0.1", "standard-version": "^6.0.1",
"svelte": "^3.9.2", "svelte": "^3.9.2",

View File

@ -29,10 +29,13 @@ export default {
], ],
plugins: [ plugins: [
svelte({ svelte({
compilerOptions:{
// enable run-time checks when not in production // enable run-time checks when not in production
dev: !production, dev: !production,
// generate: production ? 'dom' : 'ssr', // generate: production ? 'dom' : 'ssr',
hydratable: true, hydratable: true,
},
preprocess: autoPreprocess({ preprocess: autoPreprocess({
postcss: { postcss: {

View File

@ -3,6 +3,7 @@
import { omit } from '../utils' import { omit } from '../utils'
import Icon from './Icon.svelte' import Icon from './Icon.svelte'
export let customClass = '';
/** Binding value /** Binding value
* @svelte-prop {String|Number} [value] * @svelte-prop {String|Number} [value]
* */ * */
@ -154,7 +155,7 @@
{...props} {...props}
type={newType} type={newType}
{value} {value}
class="input {statusType} class="input {statusType} {customClass}
{size} {size}
{$$props.class || ''}" {$$props.class || ''}"
bind:this={input} bind:this={input}
@ -168,7 +169,7 @@
<textarea <textarea
{...props} {...props}
{value} {value}
class="textarea {statusType} class="textarea {statusType} {customClass}
{size}" {size}"
bind:this={input} bind:this={input}
on:input={onInput} on:input={onInput}

View File

@ -14,6 +14,7 @@
export let active = false; export let active = false;
export let order = false; export let order = false;
export let tip = false; export let tip = false;
export let tipRender;
$: if (active) setValue(pos); $: if (active) setValue(pos);
$: if (!active) setPos(value); $: if (!active) setPos(value);
@ -119,7 +120,7 @@
<div <div
class="progress-sli" class="progress-sli"
style={progress}/> style={progress}/>
<Thumb bind:pos={pos[0]} on:active={({ detail: v }) => active = v} on:dragEnd value={value[0]} {tip}> <Thumb bind:pos={pos[0]} on:active={({ detail: v }) => active = v} on:dragEnd value={value[0]} {tip} {tipRender}>
<slot name="left"> <slot name="left">
<slot> <slot>
<div class="thumb"/> <div class="thumb"/>
@ -127,7 +128,7 @@
</slot> </slot>
</Thumb> </Thumb>
{#if range} {#if range}
<Thumb bind:pos={pos[1]} on:active={({ detail: v }) => active = v} on:dragEnd value={value[1]} {tip}> <Thumb bind:pos={pos[1]} on:active={({ detail: v }) => active = v} on:dragEnd value={value[1]} {tip} {tipRender}>
<slot name="right"> <slot name="right">
<slot> <slot>
<div class="thumb"/> <div class="thumb"/>

View File

@ -7,6 +7,7 @@
export let pos; export let pos;
export let value; export let value;
export let tip; export let tip;
export let tipRender = (e)=> e;
function dragstart() { function dragstart() {
active = true; active = true;
@ -55,6 +56,7 @@
width: fit-content; width: fit-content;
height: fit-content; height: fit-content;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
cursor: pointer;
} }
.thumb-content::before { .thumb-content::before {
@ -81,7 +83,7 @@
on:dragend={dragend} on:dragend={dragend}
on:drag={({ detail: v }) => (pos = v)}> on:drag={({ detail: v }) => (pos = v)}>
{#if tip} {#if tip}
<div class="sli-tip">{value}</div> <div class="sli-tip">{tipRender(value)}</div>
{/if} {/if}
<div class="thumb-content" class:active> <div class="thumb-content" class:active>
<slot/> <slot/>

3532
yarn.lock

File diff suppressed because it is too large Load Diff