Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ModStart
ModStartCMS
提交
d425877c
ModStartCMS
项目概览
ModStart
/
ModStartCMS
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ModStartCMS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d425877c
编写于
12月 10, 2021
作者:
ModStart
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
develop
上级
8377c6d2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
153 addition
and
3 deletion
+153
-3
public/asset/layui/lay/ext/mstable.js
public/asset/layui/lay/ext/mstable.js
+1
-0
vendor/modstart/modstart/asset/layui/lay/ext/mstable.js
vendor/modstart/modstart/asset/layui/lay/ext/mstable.js
+1
-0
vendor/modstart/modstart/resources/asset/src/layui/lay/ext/mstable.js
...art/modstart/resources/asset/src/layui/lay/ext/mstable.js
+140
-0
vendor/modstart/modstart/src/Grid/Grid.php
vendor/modstart/modstart/src/Grid/Grid.php
+3
-1
vendor/modstart/modstart/views/core/grid/index.blade.php
vendor/modstart/modstart/views/core/grid/index.blade.php
+8
-2
未找到文件。
public/asset/layui/lay/ext/mstable.js
0 → 100644
浏览文件 @
d425877c
layui
.
define
([],
function
(
t
){
var
o
=
layui
.
$
,
i
=
{},
u
=
o
(
"
body
"
);
t
(
"
mstable
"
,{
render
:
function
(
t
){
i
[
t
.
id
]
=
t
;
var
e
=
this
;
layui
.
each
(
i
,
function
(){
!
function
(
d
,
l
){
var
t
=
o
(
l
.
elem
),
e
=
t
.
next
().
children
(
"
.layui-table-box
"
).
children
(
"
.layui-table-header
"
).
children
(
"
table
"
).
children
(
"
thead
"
).
children
(
"
tr
"
).
children
(
"
th
"
),
i
=
t
.
next
().
children
(
"
.layui-table-box
"
).
children
(
"
.layui-table-fixed
"
).
children
(
"
.layui-table-header
"
).
children
(
"
table
"
).
children
(
"
thead
"
).
children
(
"
tr
"
).
children
(
"
th
"
),
r
=
t
.
next
().
children
(
"
.layui-table-box
"
).
children
(
"
.layui-table-body
"
).
children
(
"
table
"
).
children
(
"
tbody
"
).
children
(
"
tr
"
),
c
=
t
.
next
().
children
(
"
.layui-table-total
"
).
find
(
"
tr
"
);
String
.
prototype
.
width
=
function
(
t
){
var
e
=
t
||
u
.
css
(
"
font
"
),
t
=
o
(
"
<div>
"
+
this
+
"
</div>
"
).
css
({
position
:
"
absolute
"
,
float
:
"
left
"
,
"
white-space
"
:
"
nowrap
"
,
visibility
:
"
hidden
"
,
font
:
e
}).
appendTo
(
u
),
e
=
t
.
width
();
return
t
.
remove
(),
e
},
e
.
add
(
i
).
on
(
"
dblclick
"
,
function
(
t
){
var
e
=
o
(
this
),
i
=
t
.
clientX
-
e
.
offset
().
left
,
t
=
e
.
attr
(
"
data-key
"
).
split
(
"
-
"
),
t
=
l
.
cols
[
t
[
1
]][
t
[
2
]];
s
(
0
,
e
,
0
<
e
.
parents
(
"
.layui-table-fixed-r
"
).
length
?
i
<=
10
:
e
.
width
()
-
i
<=
10
,
t
),
h
(
l
,
e
,
0
<
e
.
parents
(
"
.layui-table-fixed-r
"
).
length
?
i
<=
10
:
e
.
width
()
-
i
<=
10
,
t
)});
var
a
=
0
,
n
=
0
;
e
.
add
(
i
).
each
(
function
(
t
,
e
){
var
i
=
o
(
this
).
attr
(
"
data-key
"
).
split
(
"
-
"
),
i
=
l
.
cols
[
i
[
1
]][
i
[
2
]];
!
0
===
i
.
withAuto
&&
(
s
(
0
,
o
(
this
),
!
0
,
i
),
"
widthAutoSize
"
in
i
&&
"
widthAutoOld
"
in
i
&&
(
a
+=
i
.
widthAutoOld
,
a
-=
i
.
widthAutoSize
,
n
++
))}),
0
<
a
&&
0
<
n
&&
e
.
add
(
i
).
each
(
function
(
t
,
e
){
var
i
=
o
(
this
).
attr
(
"
data-key
"
).
split
(
"
-
"
),
i
=
l
.
cols
[
i
[
1
]][
i
[
2
]];
!
0
===
i
.
withAuto
&&
(
i
.
width
=
i
.
widthAutoSize
+
a
/
n
)});
function
h
(
t
,
e
,
i
,
l
){
var
a
=
e
.
data
(
"
key
"
),
n
=
a
.
split
(
"
-
"
);
3
===
n
.
length
&&
(
n
[
1
],
n
[
2
]);
1
<
e
.
attr
(
"
colspan
"
)
||
e
.
data
(
"
unresize
"
)
||
i
&&
d
.
getCssRule
(
t
,
a
,
function
(
t
){
t
.
style
.
width
=
l
.
width
+
"
px
"
})}
function
s
(
t
,
e
,
i
,
l
){
var
a
,
n
,
d
=
e
.
data
(
"
key
"
),
h
=
d
.
split
(
"
-
"
);
3
===
h
.
length
&&
(
h
[
1
],
h
[
2
]);
1
<
e
.
attr
(
"
colspan
"
)
||
e
.
data
(
"
unresize
"
)
||
i
&&
(
l
.
widthAutoOld
=
e
.
width
(),
a
=
e
.
text
().
width
(
e
.
css
(
"
font
"
))
+
21
,
n
=
e
.
css
(
"
font
"
),
r
.
children
(
'
td[data-key="
'
+
d
+
'
"]
'
).
each
(
function
(
t
,
e
){
var
i
=
0
;
o
(
this
).
children
().
children
()
&&
0
<
o
(
this
).
children
().
children
().
length
?
i
+=
o
(
this
).
children
().
html
().
width
(
n
):
i
=
o
(
this
).
text
().
width
(
n
),
a
<
i
&&
(
a
=
i
)}),
0
<
c
.
length
&&
(
d
=
c
.
children
(
'
td[data-key="
'
+
d
+
'
"]
'
).
text
().
width
(
n
),
a
<
d
&&
(
a
=
d
)),
a
+=
32
,
l
.
width
=
a
,
l
.
widthAutoSize
=
a
)}
e
.
add
(
i
).
each
(
function
(
t
,
e
){
var
i
=
o
(
this
).
attr
(
"
data-key
"
).
split
(
"
-
"
),
i
=
l
.
cols
[
i
[
1
]][
i
[
2
]];
!
0
===
i
.
withAuto
&&
h
(
l
,
o
(
this
),
!
0
,
i
)})}(
e
,
this
)})},
getCssRule
:
function
(
t
,
i
,
l
){
t
=
t
.
elem
.
next
().
find
(
"
style
"
)[
0
],
t
=
t
.
sheet
||
t
.
styleSheet
||
{},
t
=
t
.
cssRules
||
t
.
rules
;
layui
.
each
(
t
,
function
(
t
,
e
){
if
(
e
.
selectorText
===
"
.laytable-cell-
"
+
i
)
return
l
(
e
),
!
0
})}})});
\ No newline at end of file
vendor/modstart/modstart/asset/layui/lay/ext/mstable.js
0 → 100644
浏览文件 @
d425877c
layui
.
define
([],
function
(
t
){
var
o
=
layui
.
$
,
i
=
{},
u
=
o
(
"
body
"
);
t
(
"
mstable
"
,{
render
:
function
(
t
){
i
[
t
.
id
]
=
t
;
var
e
=
this
;
layui
.
each
(
i
,
function
(){
!
function
(
d
,
l
){
var
t
=
o
(
l
.
elem
),
e
=
t
.
next
().
children
(
"
.layui-table-box
"
).
children
(
"
.layui-table-header
"
).
children
(
"
table
"
).
children
(
"
thead
"
).
children
(
"
tr
"
).
children
(
"
th
"
),
i
=
t
.
next
().
children
(
"
.layui-table-box
"
).
children
(
"
.layui-table-fixed
"
).
children
(
"
.layui-table-header
"
).
children
(
"
table
"
).
children
(
"
thead
"
).
children
(
"
tr
"
).
children
(
"
th
"
),
r
=
t
.
next
().
children
(
"
.layui-table-box
"
).
children
(
"
.layui-table-body
"
).
children
(
"
table
"
).
children
(
"
tbody
"
).
children
(
"
tr
"
),
c
=
t
.
next
().
children
(
"
.layui-table-total
"
).
find
(
"
tr
"
);
String
.
prototype
.
width
=
function
(
t
){
var
e
=
t
||
u
.
css
(
"
font
"
),
t
=
o
(
"
<div>
"
+
this
+
"
</div>
"
).
css
({
position
:
"
absolute
"
,
float
:
"
left
"
,
"
white-space
"
:
"
nowrap
"
,
visibility
:
"
hidden
"
,
font
:
e
}).
appendTo
(
u
),
e
=
t
.
width
();
return
t
.
remove
(),
e
},
e
.
add
(
i
).
on
(
"
dblclick
"
,
function
(
t
){
var
e
=
o
(
this
),
i
=
t
.
clientX
-
e
.
offset
().
left
,
t
=
e
.
attr
(
"
data-key
"
).
split
(
"
-
"
),
t
=
l
.
cols
[
t
[
1
]][
t
[
2
]];
s
(
0
,
e
,
0
<
e
.
parents
(
"
.layui-table-fixed-r
"
).
length
?
i
<=
10
:
e
.
width
()
-
i
<=
10
,
t
),
h
(
l
,
e
,
0
<
e
.
parents
(
"
.layui-table-fixed-r
"
).
length
?
i
<=
10
:
e
.
width
()
-
i
<=
10
,
t
)});
var
a
=
0
,
n
=
0
;
e
.
add
(
i
).
each
(
function
(
t
,
e
){
var
i
=
o
(
this
).
attr
(
"
data-key
"
).
split
(
"
-
"
),
i
=
l
.
cols
[
i
[
1
]][
i
[
2
]];
!
0
===
i
.
withAuto
&&
(
s
(
0
,
o
(
this
),
!
0
,
i
),
"
widthAutoSize
"
in
i
&&
"
widthAutoOld
"
in
i
&&
(
a
+=
i
.
widthAutoOld
,
a
-=
i
.
widthAutoSize
,
n
++
))}),
0
<
a
&&
0
<
n
&&
e
.
add
(
i
).
each
(
function
(
t
,
e
){
var
i
=
o
(
this
).
attr
(
"
data-key
"
).
split
(
"
-
"
),
i
=
l
.
cols
[
i
[
1
]][
i
[
2
]];
!
0
===
i
.
withAuto
&&
(
i
.
width
=
i
.
widthAutoSize
+
a
/
n
)});
function
h
(
t
,
e
,
i
,
l
){
var
a
=
e
.
data
(
"
key
"
),
n
=
a
.
split
(
"
-
"
);
3
===
n
.
length
&&
(
n
[
1
],
n
[
2
]);
1
<
e
.
attr
(
"
colspan
"
)
||
e
.
data
(
"
unresize
"
)
||
i
&&
d
.
getCssRule
(
t
,
a
,
function
(
t
){
t
.
style
.
width
=
l
.
width
+
"
px
"
})}
function
s
(
t
,
e
,
i
,
l
){
var
a
,
n
,
d
=
e
.
data
(
"
key
"
),
h
=
d
.
split
(
"
-
"
);
3
===
h
.
length
&&
(
h
[
1
],
h
[
2
]);
1
<
e
.
attr
(
"
colspan
"
)
||
e
.
data
(
"
unresize
"
)
||
i
&&
(
l
.
widthAutoOld
=
e
.
width
(),
a
=
e
.
text
().
width
(
e
.
css
(
"
font
"
))
+
21
,
n
=
e
.
css
(
"
font
"
),
r
.
children
(
'
td[data-key="
'
+
d
+
'
"]
'
).
each
(
function
(
t
,
e
){
var
i
=
0
;
o
(
this
).
children
().
children
()
&&
0
<
o
(
this
).
children
().
children
().
length
?
i
+=
o
(
this
).
children
().
html
().
width
(
n
):
i
=
o
(
this
).
text
().
width
(
n
),
a
<
i
&&
(
a
=
i
)}),
0
<
c
.
length
&&
(
d
=
c
.
children
(
'
td[data-key="
'
+
d
+
'
"]
'
).
text
().
width
(
n
),
a
<
d
&&
(
a
=
d
)),
a
+=
32
,
l
.
width
=
a
,
l
.
widthAutoSize
=
a
)}
e
.
add
(
i
).
each
(
function
(
t
,
e
){
var
i
=
o
(
this
).
attr
(
"
data-key
"
).
split
(
"
-
"
),
i
=
l
.
cols
[
i
[
1
]][
i
[
2
]];
!
0
===
i
.
withAuto
&&
h
(
l
,
o
(
this
),
!
0
,
i
)})}(
e
,
this
)})},
getCssRule
:
function
(
t
,
i
,
l
){
t
=
t
.
elem
.
next
().
find
(
"
style
"
)[
0
],
t
=
t
.
sheet
||
t
.
styleSheet
||
{},
t
=
t
.
cssRules
||
t
.
rules
;
layui
.
each
(
t
,
function
(
t
,
e
){
if
(
e
.
selectorText
===
"
.laytable-cell-
"
+
i
)
return
l
(
e
),
!
0
})}})});
\ No newline at end of file
vendor/modstart/modstart/resources/asset/src/layui/lay/ext/mstable.js
0 → 100644
浏览文件 @
d425877c
layui
.
define
([],
function
(
exports
)
{
var
$
=
layui
.
$
,
tables
=
{},
_BODY
=
$
(
'
body
'
);
var
mod
=
{
render
:
function
(
myTable
)
{
tables
[
myTable
.
id
]
=
myTable
var
_this
=
this
;
layui
.
each
(
tables
,
function
()
{
innerColumnWidth
(
_this
,
this
)
});
function
innerColumnWidth
(
_this
,
myTable
)
{
var
$table
=
$
(
myTable
.
elem
),
th
=
$table
.
next
().
children
(
'
.layui-table-box
'
).
children
(
'
.layui-table-header
'
).
children
(
'
table
'
).
children
(
'
thead
'
).
children
(
'
tr
'
).
children
(
'
th
'
),
fixTh
=
$table
.
next
().
children
(
'
.layui-table-box
'
).
children
(
'
.layui-table-fixed
'
).
children
(
'
.layui-table-header
'
).
children
(
'
table
'
).
children
(
'
thead
'
).
children
(
'
tr
'
).
children
(
'
th
'
),
$tableBodytr
=
$table
.
next
().
children
(
'
.layui-table-box
'
).
children
(
'
.layui-table-body
'
).
children
(
'
table
'
).
children
(
'
tbody
'
).
children
(
'
tr
'
),
$totalTr
=
$table
.
next
().
children
(
'
.layui-table-total
'
).
find
(
'
tr
'
);
String
.
prototype
.
width
=
function
(
font
)
{
var
f
=
font
||
_BODY
.
css
(
'
font
'
),
o
=
$
(
'
<div>
'
+
this
+
'
</div>
'
)
.
css
({
'
position
'
:
'
absolute
'
,
'
float
'
:
'
left
'
,
'
white-space
'
:
'
nowrap
'
,
'
visibility
'
:
'
hidden
'
,
'
font
'
:
f
})
.
appendTo
(
_BODY
),
w
=
o
.
width
();
o
.
remove
();
return
w
;
}
th
.
add
(
fixTh
).
on
(
'
dblclick
'
,
function
(
e
)
{
var
othis
=
$
(
this
),
pLeft
=
e
.
clientX
-
othis
.
offset
().
left
;
var
colKey
=
othis
.
attr
(
'
data-key
'
).
split
(
'
-
'
)
var
config
=
myTable
.
cols
[
colKey
[
1
]][
colKey
[
2
]];
computeColumnWidth
(
myTable
,
othis
,
othis
.
parents
(
'
.layui-table-fixed-r
'
).
length
>
0
?
pLeft
<=
10
:
othis
.
width
()
-
pLeft
<=
10
,
config
);
setColumnWidth
(
myTable
,
othis
,
othis
.
parents
(
'
.layui-table-fixed-r
'
).
length
>
0
?
pLeft
<=
10
:
othis
.
width
()
-
pLeft
<=
10
,
config
);
});
// 初始化表格后,自动调整所有列宽
var
widthLeft
=
0
;
var
widthAutoJustCount
=
0
;
th
.
add
(
fixTh
).
each
(
function
(
e
,
i
)
{
var
colKey
=
$
(
this
).
attr
(
'
data-key
'
).
split
(
'
-
'
)
var
config
=
myTable
.
cols
[
colKey
[
1
]][
colKey
[
2
]];
if
(
config
.
withAuto
===
true
)
{
computeColumnWidth
(
myTable
,
$
(
this
),
true
,
config
);
if
((
'
widthAutoSize
'
in
config
)
&&
(
'
widthAutoOld
'
in
config
))
{
widthLeft
+=
config
.
widthAutoOld
;
widthLeft
-=
config
.
widthAutoSize
;
widthAutoJustCount
++
;
}
}
});
if
(
widthLeft
>
0
&&
widthAutoJustCount
>
0
)
{
th
.
add
(
fixTh
).
each
(
function
(
e
,
i
)
{
var
colKey
=
$
(
this
).
attr
(
'
data-key
'
).
split
(
'
-
'
);
var
config
=
myTable
.
cols
[
colKey
[
1
]][
colKey
[
2
]];
if
(
config
.
withAuto
===
true
)
{
config
.
width
=
config
.
widthAutoSize
+
widthLeft
/
widthAutoJustCount
;
}
});
}
th
.
add
(
fixTh
).
each
(
function
(
e
,
i
)
{
var
colKey
=
$
(
this
).
attr
(
'
data-key
'
).
split
(
'
-
'
)
var
config
=
myTable
.
cols
[
colKey
[
1
]][
colKey
[
2
]];
if
(
config
.
withAuto
===
true
)
{
setColumnWidth
(
myTable
,
$
(
this
),
true
,
config
);
}
});
function
setColumnWidth
(
myTable
,
othis
,
isHandle
,
config
)
{
var
key
=
othis
.
data
(
'
key
'
)
,
keyArray
=
key
.
split
(
'
-
'
)
,
curKey
=
keyArray
.
length
===
3
?
keyArray
[
1
]
+
'
-
'
+
keyArray
[
2
]
:
''
if
(
othis
.
attr
(
'
colspan
'
)
>
1
||
othis
.
data
(
'
unresize
'
))
{
return
;
}
if
(
isHandle
)
{
_this
.
getCssRule
(
myTable
,
key
,
function
(
item
)
{
item
.
style
.
width
=
config
.
width
+
'
px
'
});
}
}
function
computeColumnWidth
(
myTable
,
othis
,
isHandle
,
config
)
{
var
key
=
othis
.
data
(
'
key
'
)
,
keyArray
=
key
.
split
(
'
-
'
)
,
curKey
=
keyArray
.
length
===
3
?
keyArray
[
1
]
+
'
-
'
+
keyArray
[
2
]
:
''
if
(
othis
.
attr
(
'
colspan
'
)
>
1
||
othis
.
data
(
'
unresize
'
))
{
return
;
}
if
(
isHandle
)
{
config
.
widthAutoOld
=
othis
.
width
();
var
maxWidth
=
othis
.
text
().
width
(
othis
.
css
(
'
font
'
))
+
21
,
font
=
othis
.
css
(
'
font
'
);
$tableBodytr
.
children
(
'
td[data-key="
'
+
key
+
'
"]
'
).
each
(
function
(
index
,
elem
)
{
var
curWidth
=
0
if
(
$
(
this
).
children
().
children
()
&&
$
(
this
).
children
().
children
().
length
>
0
)
{
curWidth
+=
$
(
this
).
children
().
html
().
width
(
font
)
}
else
{
curWidth
=
$
(
this
).
text
().
width
(
font
);
}
if
(
maxWidth
<
curWidth
)
{
maxWidth
=
curWidth
}
})
if
(
$totalTr
.
length
>
0
)
{
var
curWidth
=
$totalTr
.
children
(
'
td[data-key="
'
+
key
+
'
"]
'
).
text
().
width
(
font
)
if
(
maxWidth
<
curWidth
)
{
maxWidth
=
curWidth
}
}
maxWidth
+=
32
;
config
.
width
=
maxWidth
;
config
.
widthAutoSize
=
maxWidth
;
}
}
}
},
getCssRule
:
function
(
that
,
key
,
callback
)
{
var
style
=
that
.
elem
.
next
().
find
(
'
style
'
)[
0
]
,
sheet
=
style
.
sheet
||
style
.
styleSheet
||
{}
,
rules
=
sheet
.
cssRules
||
sheet
.
rules
;
layui
.
each
(
rules
,
function
(
i
,
item
)
{
if
(
item
.
selectorText
===
(
'
.laytable-cell-
'
+
key
))
{
return
callback
(
item
),
true
;
}
});
}
};
exports
(
'
mstable
'
,
mod
);
});
\ No newline at end of file
vendor/modstart/modstart/src/Grid/Grid.php
浏览文件 @
d425877c
...
...
@@ -425,8 +425,10 @@ class Grid
'title'
=>
$field
->
label
(),
'sort'
=>
$field
->
sortable
(),
];
if
(
$field
->
width
())
{
if
(
$field
->
width
()
!==
''
)
{
$record
[
'width'
]
=
$field
->
width
();
}
else
{
$record
[
'withAuto'
]
=
true
;
}
$head
[]
=
$record
;
}
...
...
vendor/modstart/modstart/views/core/grid/index.blade.php
浏览文件 @
d425877c
...
...
@@ -88,7 +88,10 @@
}
return
items
;
};
layui
.
use
([
'
table
'
,
'
laypage
'
],
function
()
{
layui
.
extend
({
mstable
:
window
.
__msCDN
+
'
asset/layui/lay/ext/mstable
'
});
layui
.
use
([
'
table
'
,
'
laypage
'
,
'
mstable
'
],
function
()
{
var
table
=
layui
.
table
.
render
({
id
:
'
{{$id}}Table
'
,
elem
:
'
#{{$id}}Table
'
,
...
...
@@ -105,7 +108,10 @@
loading
:
true
,
cellMinWidth
:
100
,
cols
:
[[]],
data
:
[]
data
:
[],
done
:
function
()
{
layui
.
mstable
.
render
(
this
);
}
});
layui
.
table
.
on
(
'
sort({{$id}}Table)
'
,
function
(
obj
)
{
if
(
null
==
obj
.
type
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录