Events on elements now are emitted after component linking
This commit is contained in:
parent
a190100cae
commit
0034991251
|
@ -31,6 +31,7 @@ export default class Autocomplete extends Input {
|
|||
}
|
||||
|
||||
$postLink() {
|
||||
super.$postLink();
|
||||
this.assignDropdownProps();
|
||||
this.showField = this.$.dropDown.showField;
|
||||
this.valueField = this.$.dropDown.valueField;
|
||||
|
|
|
@ -30,6 +30,7 @@ export default class DropDown extends Component {
|
|||
}
|
||||
|
||||
$postLink() {
|
||||
super.$postLink();
|
||||
this.input = this.element.querySelector('.search input');
|
||||
this.ul = this.element.querySelector('ul');
|
||||
this.list = this.element.querySelector('.list');
|
||||
|
|
|
@ -19,6 +19,7 @@ export default class Popover extends Component {
|
|||
}
|
||||
|
||||
$postLink() {
|
||||
super.$postLink();
|
||||
this.$element.addClass('vn-popover');
|
||||
|
||||
this.docKeyDownHandler = e => this.onDocKeyDown(e);
|
||||
|
|
|
@ -4,9 +4,10 @@ import {kebabToCamel} from './string';
|
|||
* Implemented by all those classes that emit events.
|
||||
*/
|
||||
export default class EventEmitter {
|
||||
constructor($element, $scope) {
|
||||
if (!$element) return;
|
||||
let attrs = $element[0].attributes;
|
||||
$postLink() {
|
||||
if (!this.$element) return;
|
||||
let attrs = this.$element[0].attributes;
|
||||
let $scope = this.$;
|
||||
for (let attr of attrs) {
|
||||
if (attr.name.substr(0, 2) !== 'on') continue;
|
||||
let eventName = kebabToCamel(attr.name.substr(3));
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
icon="warning">
|
||||
</vn-icon>
|
||||
</vn-td>
|
||||
<vn-td number>{{::ticket.ticketFk}}</vn-td>
|
||||
<vn-td number>{{::ticket.id}}</vn-td>
|
||||
<vn-td>{{::ticket.salesPerson | dashIfEmpty}}</vn-td>
|
||||
<vn-td>{{::ticket.shipped | dateTime: 'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td>{{::ticket.shipped | dateTime: 'HH:mm'}}</vn-td>
|
||||
|
|
|
@ -31,10 +31,9 @@ module.exports = Self => {
|
|||
|
||||
stmt = new ParameterizedSQL(
|
||||
`CREATE TEMPORARY TABLE tmp.filter
|
||||
(PRIMARY KEY (ticketFk)) ENGINE = MEMORY
|
||||
(INDEX (id)) ENGINE = MEMORY
|
||||
SELECT
|
||||
t.id,
|
||||
t.id AS ticketFk,
|
||||
t.shipped,
|
||||
t.nickname,
|
||||
t.refFk,
|
||||
|
@ -49,8 +48,7 @@ module.exports = Self => {
|
|||
w.name AS warehouse,
|
||||
am.name AS agencyMode,
|
||||
st.name AS state,
|
||||
wk.name AS salesPerson,
|
||||
CAST(0 AS DECIMAL(10, 2)) AS total
|
||||
wk.name AS salesPerson
|
||||
FROM ticket t
|
||||
LEFT JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN province p ON p.id = a.provinceFk
|
||||
|
@ -66,29 +64,26 @@ module.exports = Self => {
|
|||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticket');
|
||||
stmts.push(`
|
||||
CREATE TEMPORARY TABLE tmp.ticket
|
||||
(PRIMARY KEY (ticketFk)) ENGINE = MEMORY
|
||||
SELECT ticketFk FROM tmp.filter`);
|
||||
(INDEX (ticketFk)) ENGINE = MEMORY
|
||||
SELECT id ticketFk FROM tmp.filter`);
|
||||
stmts.push('CALL ticketGetTotal()');
|
||||
|
||||
stmts.push(`
|
||||
UPDATE tmp.filter f
|
||||
JOIN tmp.ticketTotal tt ON f.ticketFk = tt.ticketFk
|
||||
SET f.total = tt.total`);
|
||||
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems');
|
||||
stmts.push(`
|
||||
CREATE TEMPORARY TABLE tmp.ticketGetProblems
|
||||
(PRIMARY KEY (ticketFk)) ENGINE = MEMORY
|
||||
SELECT ticketFk, clientFk, warehouseFk, shipped
|
||||
(INDEX (ticketFk)) ENGINE = MEMORY
|
||||
SELECT id ticketFk, clientFk, warehouseFk, shipped
|
||||
FROM tmp.filter`);
|
||||
stmts.push('CALL ticketGetProblems()');
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT
|
||||
f.*,
|
||||
f.*,
|
||||
tt.total,
|
||||
tp.problem
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.ticketFk`);
|
||||
LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = f.id
|
||||
LEFT JOIN tmp.ticketTotal tt ON tt.ticketFk = f.id`);
|
||||
stmt.merge(Self.buildOrderBy(filter));
|
||||
let ticketsIndex = stmts.push(stmt) - 1;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('ticket filter()', () => {
|
|||
it('should call the filter method', async() => {
|
||||
let filter = {order: 'shipped DESC'};
|
||||
let result = await app.models.Ticket.filter(filter);
|
||||
let ticketId = result[0].ticketFk;
|
||||
let ticketId = result[0].id;
|
||||
|
||||
expect(ticketId).toEqual(15);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue