Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
T
TrainSys
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
苏州培训方案
TrainSys
提交
b1e1c6b3
提交
b1e1c6b3
编写于
3月 05, 2025
作者:
jlj05024111@163.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 更新开关编辑器
上级
3cc25775
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
122 行增加
和
0 行删除
+122
-0
app-register.ts
app_Web/src/app-register.ts
+2
-0
index.ts
app_Web/src/components/editor/index.ts
+1
-0
grid-switch.tsx
.../src/components/editor/switch/grid-switch/grid-switch.tsx
+47
-0
index.ts
app_Web/src/components/editor/switch/index.ts
+1
-0
switch.tsx
app_Web/src/components/editor/switch/switch/switch.tsx
+46
-0
index.ts
app_Web/src/provider/editor/index.ts
+3
-0
switch-provider.ts
app_Web/src/provider/editor/switch-provider.ts
+22
-0
未找到文件。
app_Web/src/app-register.ts
浏览文件 @
b1e1c6b3
...
...
@@ -119,6 +119,7 @@ import {
IBizGridRadio
,
IBizGridPicker
,
GridEditor
,
IBizSwitch
,
}
from
'./components/editor'
;
export
const
AppRegister
=
{
...
...
@@ -229,6 +230,7 @@ export const AppRegister = {
v
.
component
(
'IBizImageUpload'
,
IBizImageUpload
);
v
.
component
(
'QuickSearch'
,
QuickSearch
);
v
.
component
(
'NotSupportedEditor'
,
NotSupportedEditor
);
v
.
component
(
'IBizSwitch'
,
IBizSwitch
);
// 注册表格编辑器
v
.
component
(
'IBizGridInput'
,
IBizGridInput
);
v
.
component
(
'IBizGridSpan'
,
IBizGridSpan
);
...
...
app_Web/src/components/editor/index.ts
浏览文件 @
b1e1c6b3
...
...
@@ -9,3 +9,4 @@ export * from './data-picker';
export
*
from
'./upload'
;
export
*
from
'./date-range'
;
export
{
NotSupportedEditor
}
from
'./not-supported-editor/not-supported-editor'
;
export
*
from
'./switch'
;
app_Web/src/components/editor/switch/grid-switch/grid-switch.tsx
0 → 100644
浏览文件 @
b1e1c6b3
import
{
getGridSwitchProps
,
useGridCellEditor
,
useNamespace
,
}
from
'@ibiz-template/vue-util'
;
import
{
defineComponent
,
h
}
from
'vue'
;
export
const
IBizGridSwitch
=
defineComponent
({
name
:
'IBizGridSwitch'
,
props
:
getGridSwitchProps
(),
setup
(
props
,
{
emit
})
{
const
ns
=
useNamespace
(
'grid-switch'
);
const
{
isInfoMode
,
componentRef
,
autoFocus
,
onOperateChange
,
onChange
}
=
useGridCellEditor
(
props
,
{
emit
});
return
{
ns
,
isInfoMode
,
autoFocus
,
componentRef
,
onOperateChange
,
onChange
,
};
},
render
()
{
return
(
<
grid
-
editor
disabled=
{
this
.
disabled
}
readonly=
{
this
.
readonly
}
ref=
'componentRef'
class=
{
this
.
ns
.
b
()
}
>
{
h
(
'IBizSwitch'
,
{
props
:
{
...
this
.
$props
,
readonly
:
this
.
isInfoMode
,
disabled
:
this
.
disabled
,
autoFocus
:
this
.
autoFocus
,
},
on
:
{
change
:
this
.
onChange
,
operate
:
this
.
onOperateChange
,
},
})
}
</
grid
-
editor
>
);
},
});
app_Web/src/components/editor/switch/index.ts
0 → 100644
浏览文件 @
b1e1c6b3
export
{
IBizSwitch
}
from
'./switch/switch'
;
app_Web/src/components/editor/switch/switch/switch.tsx
0 → 100644
浏览文件 @
b1e1c6b3
import
{
getSwitchProps
,
useNamespace
}
from
'@ibiz-template/vue-util'
;
import
{
defineComponent
,
ref
,
watch
}
from
'vue'
;
export
const
IBizSwitch
=
defineComponent
({
name
:
'IBIzSwitch'
,
props
:
getSwitchProps
(),
setup
(
props
,
{
emit
})
{
const
ns
=
useNamespace
(
'switch'
);
const
currentVal
=
ref
(
false
);
watch
(
()
=>
props
.
value
,
(
newVal
,
oldVal
)
=>
{
if
(
newVal
!==
oldVal
)
{
if
(
!
newVal
)
{
currentVal
.
value
=
false
;
}
else
{
// eslint-disable-next-line eqeqeq
currentVal
.
value
=
props
.
value
==
1
;
}
}
},
{
immediate
:
true
},
);
const
onChange
=
(
value
:
boolean
)
=>
{
const
emitValue
=
value
===
true
?
1
:
0
;
emit
(
'change'
,
emitValue
);
};
return
{
ns
,
currentVal
,
onChange
,
};
},
render
()
{
return
(
<
div
class=
{
this
.
ns
.
b
()
}
>
<
i
-
switch
v
-
mode=
{
this
.
currentVal
}
onOn
-
change=
{
this
.
onChange
}
></
i
-
switch
>
</
div
>
);
},
});
app_Web/src/provider/editor/index.ts
浏览文件 @
b1e1c6b3
...
...
@@ -7,6 +7,7 @@ import { DatePickerEditorProvider } from './date-picker-provider';
import
{
FileUploaderEditorProvider
}
from
'./file-uploader-provider'
;
import
{
DataPickerEditorProvider
}
from
'./data-picker-provider'
;
import
{
DateRangeEditorProvider
}
from
'./date-range-provider'
;
import
{
SwitchProvider
}
from
'./switch-provider'
;
/**
* 预置默认的编辑器适配器
...
...
@@ -101,6 +102,7 @@ export function presetEditorProvider(): void {
'ADDRESSPICKUP_AC'
,
new
DataPickerEditorProvider
(
'ADDRESSPICKUP'
),
);
editorRegister
.
register
(
'SWITCH'
,
new
SwitchProvider
());
}
export
{
...
...
@@ -111,4 +113,5 @@ export {
DatePickerEditorProvider
,
FileUploaderEditorProvider
,
DataPickerEditorProvider
,
SwitchProvider
,
};
app_Web/src/provider/editor/switch-provider.ts
0 → 100644
浏览文件 @
b1e1c6b3
import
{
FormItemController
,
GridEditItemController
,
IEditorProvider
,
SwitchEditorController
,
}
from
'@ibiz-template/controller'
;
import
{
SwitchEditorModel
}
from
'@ibiz-template/model'
;
export
class
SwitchProvider
implements
IEditorProvider
{
formEditor
:
string
=
'IBizSwitch'
;
gridEditor
:
string
=
'IBizGridSwitch'
;
async
createController
(
editorModel
:
SwitchEditorModel
,
parentController
:
FormItemController
|
GridEditItemController
,
):
Promise
<
SwitchEditorController
>
{
const
c
=
new
SwitchEditorController
(
editorModel
,
parentController
);
await
c
.
init
();
return
c
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录