-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix editonclick bug * build assets * build assets
- Loading branch information
1 parent
8e93f2a
commit ea76f9f
Showing
6 changed files
with
143 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"/powergrid.js": "/powergrid.js?id=377a2e5641b0803a4bcc836ddc46270d", | ||
"/powergrid.js": "/powergrid.js?id=65133044a69064bc2c32606995a58abe", | ||
"/bootstrap5.css": "/bootstrap5.css?id=a27af22343149104b2aa3283d8fd502b", | ||
"/tailwind.css": "/tailwind.css?id=924477e2afcb2cb56aa392e266ee56ca" | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
document.addEventListener('alpine:init', () => { | ||
window.Alpine.store('pgBulkActions', { | ||
selected: [], | ||
init() { | ||
window.addEventListener('pgBulkActions::addMore', (event) => { | ||
const params = event.__livewire.params[0] | ||
|
||
if(typeof this.selected[params.tableName] == 'undefined') { | ||
this.selected[params.tableName] = [] | ||
} | ||
|
||
this.selected[params.tableName].push(params.value) | ||
}) | ||
window.addEventListener('pgBulkActions::clear', (event) => { | ||
this.clear(event.detail); | ||
}) | ||
window.addEventListener('pgBulkActions::clearAll', () => { | ||
this.clearAll(); | ||
}) | ||
}, | ||
|
||
add(value, tableName) { | ||
if(typeof this.selected[tableName] == 'undefined') { | ||
this.selected[tableName] = [] | ||
} | ||
|
||
if(!this.selected[tableName].includes(value)) { | ||
this.selected[tableName].push(value) | ||
|
||
return; | ||
} | ||
|
||
this.remove(value, tableName) | ||
}, | ||
|
||
remove(value, tableName) { | ||
const index = this.selected[tableName].indexOf(value); | ||
if (index > -1) { | ||
this.selected[tableName].splice(index, 1); | ||
} | ||
}, | ||
|
||
get(tableName) { | ||
return this.selected[tableName] ?? '' | ||
}, | ||
|
||
count(tableName) { | ||
if(typeof this.selected[tableName] == 'undefined') { | ||
return 0; | ||
} | ||
|
||
return this.selected[tableName].length | ||
}, | ||
|
||
clear(tableName) { | ||
this.selected[tableName] = [] | ||
}, | ||
|
||
clearAll() { | ||
this.selected = [] | ||
} | ||
}) | ||
|
||
window.pgBulkActions = window.Alpine.store('pgBulkActions') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
document.addEventListener('alpine:init', () => { | ||
window.Alpine.store('editOnClickValidation', { | ||
pending: [], | ||
|
||
set(value, textContent) { | ||
this.pending = this.pending.filter(item => item.value !== value); | ||
this.pending.push({ value, textContent }); | ||
}, | ||
|
||
has(value) { | ||
return this.pending.some(item => item.value === value); | ||
}, | ||
|
||
get(value) { | ||
return this.pending.find(item => item.value === value); | ||
}, | ||
|
||
notContains(value) { | ||
return this.pending.length > 0 && !this.has(value); | ||
}, | ||
|
||
clear() { | ||
this.pending = []; | ||
}, | ||
|
||
getTextContent(value) { | ||
const item = this.pending.find(item => item.value === value); | ||
return item ? item.textContent : null; | ||
} | ||
}); | ||
|
||
window.editOnClickValidation = window.Alpine.store('editOnClickValidation') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,2 @@ | ||
document.addEventListener('alpine:init', () => { | ||
window.Alpine.store('editablePending', { | ||
pending: [], | ||
set(value) { | ||
this.pending.push(value) | ||
}, | ||
has(value) { | ||
return this.pending.includes(value) | ||
}, | ||
notContains(value) { | ||
return this.pending.length > 0 && !this.pending.includes(value) | ||
}, | ||
clear() { | ||
this.pending = [] | ||
}, | ||
isNotEmpty() { | ||
return this.pending.length > 0 | ||
}, | ||
}); | ||
|
||
window.Alpine.store('pgBulkActions', { | ||
selected: [], | ||
init() { | ||
window.addEventListener('pgBulkActions::addMore', (event) => { | ||
const params = event.__livewire.params[0] | ||
|
||
if(typeof this.selected[params.tableName] == 'undefined') { | ||
this.selected[params.tableName] = [] | ||
} | ||
|
||
this.selected[params.tableName].push(params.value) | ||
}) | ||
window.addEventListener('pgBulkActions::clear', (event) => { | ||
this.clear(event.detail); | ||
}) | ||
window.addEventListener('pgBulkActions::clearAll', () => { | ||
this.clearAll(); | ||
}) | ||
}, | ||
add(value, tableName) { | ||
if(typeof this.selected[tableName] == 'undefined') { | ||
this.selected[tableName] = [] | ||
} | ||
|
||
if(!this.selected[tableName].includes(value)) { | ||
this.selected[tableName].push(value) | ||
|
||
return; | ||
} | ||
|
||
this.remove(value, tableName) | ||
}, | ||
remove(value, tableName) { | ||
const index = this.selected[tableName].indexOf(value); | ||
if (index > -1) { | ||
this.selected[tableName].splice(index, 1); | ||
} | ||
}, | ||
get(tableName) { | ||
return this.selected[tableName] ?? '' | ||
}, | ||
count(tableName) { | ||
if(typeof this.selected[tableName] == 'undefined') { | ||
return 0; | ||
} | ||
|
||
return this.selected[tableName].length | ||
}, | ||
clear(tableName) { | ||
this.selected[tableName] = [] | ||
}, | ||
clearAll() { | ||
this.selected = [] | ||
} | ||
}) | ||
|
||
window.editablePending = window.Alpine.store('editablePending') | ||
window.pgBulkActions = window.Alpine.store('pgBulkActions') | ||
}) | ||
import './edit-on-click' | ||
import './bulk-actions' |