Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Monster
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Javascript
Monster
Commits
b64b8ac3
Verified
Commit
b64b8ac3
authored
3 months ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
feat: nullabel integer bind, add debug logging for save-button
parent
82840c03
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/components/datatable/save-button.mjs
+26
-0
26 additions, 0 deletions
source/components/datatable/save-button.mjs
source/dom/updater.mjs
+10
-0
10 additions, 0 deletions
source/dom/updater.mjs
source/text/formatter.mjs
+2
-0
2 additions, 0 deletions
source/text/formatter.mjs
with
38 additions
and
0 deletions
source/components/datatable/save-button.mjs
+
26
−
0
View file @
b64b8ac3
...
@@ -99,6 +99,8 @@ class SaveButton extends CustomElement {
...
@@ -99,6 +99,8 @@ class SaveButton extends CustomElement {
* @property {string} classes.badge The badge class
* @property {string} classes.badge The badge class
* @property {Array} ignoreChanges The ignore changes (regex)
* @property {Array} ignoreChanges The ignore changes (regex)
* @property {Array} data The data
* @property {Array} data The data
* @property {boolean} disabled The disabled state
* @property {string} logLevel The log level (off, debug)
* @return {Object}
* @return {Object}
*/
*/
get
defaults
()
{
get
defaults
()
{
...
@@ -125,6 +127,9 @@ class SaveButton extends CustomElement {
...
@@ -125,6 +127,9 @@ class SaveButton extends CustomElement {
data
:
{},
data
:
{},
disabled
:
false
,
disabled
:
false
,
logLevel
:
"
off
"
,
});
});
updateOptionsFromArguments
.
call
(
this
,
obj
);
updateOptionsFromArguments
.
call
(
this
,
obj
);
...
@@ -199,6 +204,27 @@ class SaveButton extends CustomElement {
...
@@ -199,6 +204,27 @@ class SaveButton extends CustomElement {
const
ignoreChanges
=
self
.
getOption
(
"
ignoreChanges
"
);
const
ignoreChanges
=
self
.
getOption
(
"
ignoreChanges
"
);
const
result
=
diff
(
self
[
originValuesSymbol
],
currentValues
);
const
result
=
diff
(
self
[
originValuesSymbol
],
currentValues
);
if
(
self
.
getOption
(
"
logLevel
"
)
===
"
debug
"
)
{
console
.
groupCollapsed
(
"
SaveButton
"
);
console
.
log
(
result
);
if
(
isArray
(
result
)
&&
result
.
length
>
0
)
{
const
formattedDiff
=
result
.
map
(
change
=>
({
Operator
:
change
?.
operator
,
Path
:
change
?.
path
?.
join
(
"
.
"
),
"
First Value
"
:
change
?.
first
?.
value
,
"
First Type
"
:
change
?.
first
?.
type
,
"
Second Value
"
:
change
?.
second
?.
value
,
"
Second Type
"
:
change
?.
second
?.
type
}));
console
.
table
(
formattedDiff
);
}
else
{
console
.
log
(
"
There are no changes to save
"
);
}
console
.
groupEnd
();
}
if
(
isArray
(
ignoreChanges
)
&&
ignoreChanges
.
length
>
0
)
{
if
(
isArray
(
ignoreChanges
)
&&
ignoreChanges
.
length
>
0
)
{
const
itemsToRemove
=
[];
const
itemsToRemove
=
[];
...
...
This diff is collapsed.
Click to expand it.
source/dom/updater.mjs
+
10
−
0
View file @
b64b8ac3
...
@@ -404,6 +404,16 @@ function retrieveAndSetValue(element) {
...
@@ -404,6 +404,16 @@ function retrieveAndSetValue(element) {
const
type
=
element
.
getAttribute
(
ATTRIBUTE_UPDATER_BIND_TYPE
);
const
type
=
element
.
getAttribute
(
ATTRIBUTE_UPDATER_BIND_TYPE
);
switch
(
type
)
{
switch
(
type
)
{
case
"
integer?
"
:
case
"
int?
"
:
case
"
number?
"
:
value
=
Number
(
value
);
if
(
isNaN
(
value
)
||
0
===
value
)
{
value
=
undefined
;
}
break
;
case
"
number
"
:
case
"
number
"
:
case
"
int
"
:
case
"
int
"
:
case
"
float
"
:
case
"
float
"
:
...
...
This diff is collapsed.
Click to expand it.
source/text/formatter.mjs
+
2
−
0
View file @
b64b8ac3
...
@@ -238,6 +238,8 @@ function format(text) {
...
@@ -238,6 +238,8 @@ function format(text) {
throw
new
Error
(
"
too deep nesting
"
);
throw
new
Error
(
"
too deep nesting
"
);
}
}
validateString
(
text
);
const
openMarker
=
const
openMarker
=
this
[
internalSymbol
][
"
marker
"
][
"
open
"
]?.[
this
[
markerOpenIndexSymbol
]];
this
[
internalSymbol
][
"
marker
"
][
"
open
"
]?.[
this
[
markerOpenIndexSymbol
]];
const
closeMarker
=
const
closeMarker
=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment