Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikolaï Krol
erp5
Commits
517764ea
Commit
517764ea
authored
Aug 04, 2020
by
Mikolaï Krol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_jexcel_editor: changing type in toolbar on mobile
parent
a0744903
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
6 deletions
+97
-6
bt5/erp5_jexcel_editor/SkinTemplateItem/portal_skins/erp5_jexcel_editor/jexcel.gadget.js.js
...eItem/portal_skins/erp5_jexcel_editor/jexcel.gadget.js.js
+97
-6
No files found.
bt5/erp5_jexcel_editor/SkinTemplateItem/portal_skins/erp5_jexcel_editor/jexcel.gadget.js.js
View file @
517764ea
/*jslint nomen: true, indent: 2, maxlen: 80 */
/*global window, rJS, RSVP, jexcel, domsugar, document, alert, prompt, confirm*/
(
function
(
window
,
rJS
,
jexcel
,
domsugar
,
document
,
alert
,
prompt
,
confirm
)
{
/*global window, rJS, RSVP, jexcel, domsugar, document, alert, prompt, confirm,
navigator*/
(
function
(
window
,
rJS
,
jexcel
,
domsugar
,
document
,
alert
,
prompt
,
confirm
,
navigator
)
{
"
use strict
"
;
function
isMobileDevice
()
{
return
(
window
.
orientation
!==
undefined
)
||
(
navigator
.
userAgent
.
indexOf
(
'
IEMobile
'
)
!==
-
1
);
}
function
format
(
node
,
level
)
{
var
indentBefore
=
new
Array
(
level
+
2
).
join
(
'
'
),
indentAfter
,
...
...
@@ -426,6 +433,12 @@
return
gadget
.
triggerChangeType
(
"
checkbox
"
,
child
);
}
});
items
.
push
({
title
:
"
Set column type: Calendar
"
,
onclick
:
function
()
{
return
gadget
.
triggerChangeType
(
"
calendar
"
);
}
});
items
.
push
({
title
:
"
Set column type: Color
"
,
onclick
:
function
()
{
...
...
@@ -460,6 +473,53 @@
toolbar_dict
.
color_picker
)
{
list
.
push
(
dict
.
text_color
,
dict
.
background_color
);
}
if
(
isMobileDevice
())
{
list
.
push
({
type
:
"
i
"
,
content
:
"
photo_library
"
,
onclick
:
function
(
sheet
,
instance
)
{
return
gadget
.
triggerChangeTypeInToolbar
(
sheet
,
instance
,
"
image
"
);
}
});
list
.
push
({
type
:
"
i
"
,
content
:
"
format_size
"
,
onclick
:
function
(
sheet
,
instance
)
{
return
gadget
.
triggerChangeTypeInToolbar
(
sheet
,
instance
,
"
text
"
);
}
});
list
.
push
({
type
:
"
i
"
,
content
:
"
format_paint
"
,
onclick
:
function
(
sheet
,
instance
)
{
return
gadget
.
triggerChangeTypeInToolbar
(
sheet
,
instance
,
"
color
"
,
null
,
"
square
"
);
}
});
list
.
push
({
type
:
"
i
"
,
content
:
"
format_list_bulleted
"
,
onclick
:
function
(
sheet
,
instance
)
{
return
gadget
.
triggerChangeTypeInToolbar
(
sheet
,
instance
,
"
html
"
);
}
});
list
.
push
({
type
:
"
i
"
,
content
:
"
calendar_today
"
,
onclick
:
function
(
sheet
,
instance
)
{
return
gadget
.
triggerChangeTypeInToolbar
(
sheet
,
instance
,
"
calendar
"
);
}
});
list
.
push
({
type
:
"
i
"
,
content
:
"
check_box
"
,
onclick
:
function
(
sheet
,
instance
)
{
var
child
=
domsugar
(
"
input
"
,
{
type
:
"
checkbox
"
});
return
gadget
.
triggerChangeTypeInToolbar
(
sheet
,
instance
,
"
checkbox
"
,
child
);
}
});
}
if
(
toolbar_dict
.
hasOwnProperty
(
"
add_delete_row_column
"
)
&&
toolbar_dict
.
add_delete_row_column
)
{
list
.
push
(
dict
.
add_row
,
dict
.
delete_row
,
...
...
@@ -496,7 +556,7 @@
add_delete_row_column
:
true
},
options
:
{
minDimensions
:
[
15
,
3
0
],
minDimensions
:
[
26
,
10
0
],
defaultColWidth
:
100
,
defaultColAlign
:
"
left
"
,
allowExport
:
true
,
...
...
@@ -596,7 +656,6 @@
return
setupTable
(
gadget
,
tab
);
});
}
else
{
delete
toolbar_config
.
minDimensions
;
gadget
.
state
.
tables
=
[];
nodes
=
createElementFromHTML
(
gadget
.
state
.
value
);
for
(
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
...
...
@@ -748,7 +807,7 @@
}
});
setHistoryType
(
state
.
obj
,
"
endChangeType
"
,
Number
(
x
)
,
x
,
state
.
obj
.
options
.
columns
[
x
].
type
,
type
);
state
.
obj
.
options
.
columns
[
x
].
type
=
type
;
...
...
@@ -759,6 +818,38 @@
}
})
.
declareJob
(
"
triggerChangeTypeInToolbar
"
,
function
(
sheet
,
instance
,
type
,
child
,
render
)
{
var
cell
=
sheet
.
querySelector
(
"
td.highlight-selected
"
),
x
=
parseInt
(
cell
.
dataset
.
x
,
10
),
column
,
array
;
if
(
cell
&&
instance
.
options
.
columns
[
x
].
type
!==
type
)
{
column
=
sheet
.
querySelectorAll
(
"
td[data-x='
"
+
x
+
"
']
"
);
array
=
[...
column
];
array
.
shift
();
setHistoryType
(
instance
,
"
beginChangeType
"
,
x
,
instance
.
options
.
columns
[
x
].
type
,
type
);
array
.
forEach
(
function
(
cell
)
{
instance
.
setValue
(
getCoordinatesFromCell
(
cell
),
""
);
cell
.
innerHTML
=
""
;
if
(
child
)
{
cell
.
appendChild
(
child
.
cloneNode
());
}
});
setHistoryType
(
instance
,
"
endChangeType
"
,
x
,
instance
.
options
.
columns
[
x
].
type
,
type
);
instance
.
options
.
columns
[
x
].
type
=
type
;
if
(
render
)
{
instance
.
options
.
columns
[
x
].
render
=
render
;
}
fireDoubleClick
(
cell
);
}
})
.
declareJob
(
"
triggerNewDimensions
"
,
function
(
sheet
,
instance
)
{
var
r
=
prompt
(
"
Number of rows :
"
,
instance
.
options
.
data
.
length
);
var
c
=
prompt
(
"
Number of columns :
"
,
instance
.
options
.
columns
.
length
);
...
...
@@ -1019,4 +1110,4 @@
}
},
false
,
false
);
}(
window
,
rJS
,
jexcel
,
domsugar
,
document
,
alert
,
prompt
,
confirm
));
\ No newline at end of file
}(
window
,
rJS
,
jexcel
,
domsugar
,
document
,
alert
,
prompt
,
confirm
,
navigator
));
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment