This repository has been archived by the owner on May 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from wilcorrea-forks/master
[revamp] Redistribute methods of components
- Loading branch information
Showing
25 changed files
with
679 additions
and
363 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
35 changes: 35 additions & 0 deletions
35
src/app/Prototype/Components/Buttons/PrototypeButtonDropdown.js
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,35 @@ | ||
/** | ||
* @typedef {PrototypeButtonDropdown} | ||
*/ | ||
export default { | ||
/** | ||
*/ | ||
methods: { | ||
/** | ||
* @param {Function} h | ||
* @param {Object} data | ||
* @returns {*} | ||
*/ | ||
renderButtonDropdown (h, data) { | ||
// TODO: implement dropdown items | ||
/* | ||
<q-list link> | ||
<q-item | ||
v-bind="button.attrs" | ||
v-for="(action, key) in button.actions" | ||
:key="key" | ||
v-close-overlay | ||
@click.native="action.native" | ||
> | ||
<q-item-main> | ||
<q-item-tile label>{{ action.label }}</q-item-tile> | ||
</q-item-main> | ||
</q-item> | ||
</q-list> | ||
*/ | ||
data.attrs.split = true | ||
|
||
return h('q-btn-dropdown', data) | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/app/Prototype/Components/Buttons/PrototypeButtonParse.js
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,50 @@ | ||
/** | ||
* @typedef {PrototypeButtonParse} | ||
*/ | ||
export default { | ||
/** | ||
*/ | ||
methods: { | ||
/** | ||
* @param {Object} button | ||
* @returns {Object} | ||
*/ | ||
parseAttrs (button) { | ||
return { ...button.attrs, ...this.override } | ||
}, | ||
/** | ||
* @param {Object} button | ||
* @returns {Object} | ||
*/ | ||
parseListeners (button) { | ||
if (typeof button.listeners !== 'object') { | ||
return button.listeners | ||
} | ||
let context = {} | ||
if (this.context) { | ||
context = this.$util.clone(this.context) | ||
} | ||
const reduce = (listeners, key) => { | ||
listeners[key] = ($event) => button.listeners[key]($event, { context }) | ||
return listeners | ||
} | ||
return Object.keys(button.listeners).reduce(reduce, {}) | ||
}, | ||
/** | ||
* @param {Object} button | ||
*/ | ||
parseButton (button) { | ||
let action = button | ||
if (button.configure && typeof button.configure === 'function') { | ||
const clone = this.$util.clone(button) | ||
const parameters = { context: this.context, position: this.position, scope: this.scope } | ||
action = button.configure.call(this, clone, parameters) | ||
} | ||
return { | ||
...action, | ||
attrs: this.parseAttrs(action), | ||
listeners: this.parseListeners(action) | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/app/Prototype/Components/Buttons/PrototypeButtonSingle.js
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,17 @@ | ||
/** | ||
* @typedef {PrototypeButtonSingle} | ||
*/ | ||
export default { | ||
/** | ||
*/ | ||
methods: { | ||
/** | ||
* @param {Function} h | ||
* @param {Object} data | ||
* @returns {*} | ||
*/ | ||
renderButtonSingle (h, data) { | ||
return h('q-btn', data) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.