Skip to content

Commit 53f92a4

Browse files
committed
update
1 parent 9056d82 commit 53f92a4

File tree

30 files changed

+1068
-451
lines changed

30 files changed

+1068
-451
lines changed

.github/workflows/publish.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,18 @@ jobs:
2222
- uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消此区域注释
2323
with:
2424
version: 9
25-
- name: Setup Node
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version: 22
29-
cache: pnpm # 或 pnpm / yarn
25+
- name: Setup bun
26+
uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
3027
# 安装依赖
3128
- name: Install dependencies
32-
run: pnpm install
29+
run: bun install
3330

3431
- name: Create Release Pull Request or Publish to npm
3532
id: changesets
3633
uses: changesets/action@v1
3734
with:
3835
# This expects you to have a script called release which does a build for your packages and calls changeset publish
39-
publish: pnpm publish:all
36+
publish: bun run publish:all
4037
env:
4138
# this doesn't work but semantic-release works
4239
# see https://github.com/sonofmagic/npm-lib-rollup-template/blob/main/.github/workflows/release.yml#L46

.github/workflows/website.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,15 @@ jobs:
3535
- name: Checkout
3636
uses: actions/checkout@v4
3737
with:
38-
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
39-
- uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消此区域注释
40-
with:
41-
version: 9
42-
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
43-
- name: Setup Node
44-
uses: actions/setup-node@v4
45-
with:
46-
node-version: 22
47-
cache: pnpm # 或 pnpm / yarn
48-
- name: Setup Pages
49-
uses: actions/configure-pages@v4
38+
fetch-depth: 0
39+
- name: Setup bun
40+
uses: oven-sh/setup-bun@v1
5041
- name: Install dependencies
51-
run: pnpm install # 或 pnpm install / yarn install / bun install
42+
run: bun install
43+
- name: Setup Pages
44+
uses: actions/configure-pages@v4
5245
- name: Build with VitePress
53-
run: pnpm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
46+
run: bun run docs:build
5447
- name: Upload artifact
5548
uses: actions/upload-pages-artifact@v3
5649
with:

bun.lock

Lines changed: 202 additions & 34 deletions
Large diffs are not rendered by default.

bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[install]
2+
linker = "isolated"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>AutoStore</title>
8+
<link rel="stylesheet" href="/autostore/autoform.dark.css" />
9+
<link rel="stylesheet" href="/autostore/autoform.light.css" />
10+
<script src="/autostore/autostore.js"></script>
11+
<script src="/autostore/autoform.js"></script>
12+
</head>
13+
14+
<body style="overflow: hidden; padding: 1em 0px">
15+
<div style="display: flex; flex-direction: column; postion: relative; min-height: 500px">
16+
<auto-form dark id="form"></auto-form>
17+
<div id="viewer" style="padding: 1em; border: 1px solid #ccc; margin-top: 1em"></div>
18+
</div>
19+
<script>
20+
const { AutoStore, configurable } = AutoStoreSpaces;
21+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
22+
const store = new AutoStore({
23+
products: configurable(['电脑'], {
24+
label: '产品',
25+
onValidate: (value) => {
26+
return value.length > 2;
27+
},
28+
widget: 'select',
29+
multiple: true,
30+
valueKey: 'label',
31+
labelKey: 'label',
32+
help: '多选',
33+
invalidTips: '至少选择两个产品',
34+
renderItem: '<span>{label}</span><span style="color:red;">{price}</span>',
35+
maxOptionsVisible: 5,
36+
showResults: true,
37+
select: async () => {
38+
await delay(5000);
39+
return [
40+
{ id: 1, label: '手机', price: 1000, icon: 'phone' },
41+
{ id: 2, label: '电脑', price: 2000, icon: 'laptop' },
42+
{ id: 3, label: '手表', price: 3000, icon: 'watch' },
43+
{ id: 4, label: '耳机', price: 4000, icon: 'headphones' },
44+
{ id: 5, label: '鼠标', price: 5000, icon: 'mouse' },
45+
{ id: 6, label: '键盘', price: 6000, icon: 'keyboard' },
46+
{ id: 7, label: '鼠标垫', price: 7000, icon: 'mousepad' },
47+
{ id: 8, label: 'U盘', price: 8000, icon: 'usb' },
48+
{ id: 9, label: '硬盘', price: 9000, icon: 'hdd' },
49+
{ id: 10, label: '内存', price: 10000, icon: 'memory' },
50+
{ id: 14, label: '显卡', price: 14000, icon: 'gpu' },
51+
{ id: 15, label: '蓝牙耳机', price: 15000, icon: 'bluetooth' },
52+
{ id: 16, label: '电视', price: 16000, icon: 'tv' },
53+
{ id: 17, label: '空调', price: 17000, icon: 'air-conditioner' },
54+
{ id: 18, label: '冰箱', price: 18000, icon: 'fridge' },
55+
{ id: 19, label: '洗衣机', price: 19000, icon: 'washing-machine' },
56+
{ id: 20, label: '微波炉', price: 20000, icon: 'microwave-oven' },
57+
{ id: 21, label: '电饭煲', price: 21000, icon: 'rice-cooker' },
58+
{ id: 22, label: '电风扇', price: 22000, icon: 'fan' },
59+
{ id: 23, label: '电吹风', price: 23000, icon: 'hair-dryer' },
60+
{ id: 24, label: '吸尘器', price: 24000, icon: 'vacuum-cleaner' },
61+
];
62+
},
63+
actions: [
64+
{
65+
label: '计算总价',
66+
pos: 'before',
67+
onClick: (value, ctx) => {
68+
alert(value);
69+
},
70+
},
71+
{
72+
label: '产品主页',
73+
onClick: (value, ctx) => {},
74+
},
75+
],
76+
}),
77+
});
78+
const form = document.querySelector('#form');
79+
form.bind(store);
80+
const refreshViewer = () => {
81+
const jsonViewer = document.getElementById('viewer');
82+
jsonViewer.innerHTML = JSON.stringify(store.state);
83+
};
84+
store.watch(refreshViewer);
85+
refreshViewer();
86+
</script>
87+
</body>
88+
</html>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>AutoStore</title>
8+
<link rel="stylesheet" href="/autostore/autoform.dark.css" />
9+
<link rel="stylesheet" href="/autostore/autoform.light.css" />
10+
<script src="/autostore/autostore.js"></script>
11+
<script src="/autostore/autoform.js"></script>
12+
</head>
13+
14+
<body style="overflow: hidden; padding: 1em 0px">
15+
<div style="display: flex; flex-direction: column; postion: relative; min-height: 500px">
16+
<auto-form id="form"></auto-form>
17+
<div id="viewer" style="padding: 1em; border: 1px solid #ccc; margin-top: 1em"></div>
18+
</div>
19+
<script>
20+
const { AutoStore, configurable } = AutoStoreSpaces;
21+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
22+
const orgTree = {
23+
id: 1,
24+
label: '集团公司',
25+
children: [
26+
{
27+
id: 1,
28+
label: '研发中心',
29+
children: [
30+
{ id: 11, label: '工程部' },
31+
{ id: 12, label: '产品部' },
32+
{ id: 13, label: '测试部' },
33+
{ id: 14, label: '运维部' },
34+
{ id: 15, label: '系统部' },
35+
],
36+
},
37+
{
38+
id: 2,
39+
label: '营销中心',
40+
selected: true,
41+
children: [
42+
{ id: 21, label: '销售部' },
43+
{ id: 22, label: '市场部' },
44+
{ id: 23, label: '客服部' },
45+
],
46+
},
47+
{
48+
id: 3,
49+
label: '生产中心',
50+
children: [
51+
{ id: 31, label: '生产部' },
52+
{ id: 32, label: '采购部' },
53+
{ id: 33, label: '仓储部' },
54+
{ id: 34, label: '质检部' },
55+
],
56+
},
57+
],
58+
};
59+
60+
const store = new AutoStore({
61+
depts: configurable(['产品部'], {
62+
label: '部门',
63+
widget: 'tree-select',
64+
multiple: true,
65+
valueKey: 'label',
66+
help: '多选',
67+
onlySelectLeaf: false,
68+
items: async () => {
69+
await delay(3000);
70+
return orgTree;
71+
},
72+
}),
73+
deptIds: configurable([], {
74+
label: '部门编码',
75+
widget: 'tree-select',
76+
multiple: true,
77+
valueKey: 'id',
78+
help: '多选',
79+
onlySelectLeaf: false,
80+
items: async () => {
81+
await delay(3000);
82+
return orgTree;
83+
},
84+
}),
85+
admin: configurable('', {
86+
label: '部门',
87+
widget: 'tree-select',
88+
valueKey: 'label',
89+
help: '单选且只能选择叶子节点',
90+
onlySelectLeaf: true,
91+
items: async () => {
92+
await delay(3000);
93+
return orgTree;
94+
},
95+
}),
96+
});
97+
const form = document.querySelector('#form');
98+
form.bind(store);
99+
const refreshViewer = () => {
100+
const jsonViewer = document.getElementById('viewer');
101+
jsonViewer.innerHTML = JSON.stringify(store.state);
102+
};
103+
store.watch(refreshViewer);
104+
refreshViewer();
105+
</script>
106+
</body>
107+
</html>

docs/public/autoform.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)