refs #5394 wip generate html code by javascript
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b167581be7
commit
f5f54e99dc
|
@ -213,25 +213,4 @@
|
|||
</vn-date-picker>
|
||||
</form>
|
||||
</vn-side-menu>
|
||||
<vn-worker-descriptor-popover vn-id="Worker">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-client-descriptor-popover vn-id="Client">
|
||||
</vn-client-descriptor-popover>
|
||||
<vn-entry-descriptor-popover vn-id="Entry">
|
||||
</vn-entry-descriptor-popover>
|
||||
<vn-item-descriptor-popover vn-id="Item">
|
||||
</vn-item-descriptor-popover>
|
||||
<vn-ticket-descriptor-popover vn-id="Ticket">
|
||||
</vn-ticket-descriptor-popover>
|
||||
<vn-zone-descriptor-popover vn-id="Zone">
|
||||
</vn-zone-descriptor-popover>
|
||||
<vn-travel-descriptor-popover vn-id="Travel">
|
||||
</vn-travel-descriptor-popover>
|
||||
<vn-supplier-descriptor-popover vn-id="Supplier">
|
||||
</vn-supplier-descriptor-popover>
|
||||
<vn-route-descriptor-popover vn-id="Route">
|
||||
</vn-route-descriptor-popover>
|
||||
<vn-invoice-out-descriptor-popover vn-id="InvoiceOut">
|
||||
</vn-invoice-out-descriptor-popover>
|
||||
<vn-invoice-in-descriptor-popover vn-id="InvoiceIn">
|
||||
</vn-invoice-in-descriptor-popover>
|
||||
<div id="descriptors"></div>
|
||||
|
|
|
@ -9,6 +9,7 @@ export default class Controller extends Section {
|
|||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.descriptors = new Map();
|
||||
this.activeDescriptors = [];
|
||||
this.hashToColor = hashToColor;
|
||||
this.actionsText = {
|
||||
insert: 'Creates',
|
||||
|
@ -93,10 +94,23 @@ export default class Controller extends Section {
|
|||
val: getVal(vals, prop),
|
||||
descriptor
|
||||
});
|
||||
if (descriptor && !this.activeDescriptors.includes(descriptor))
|
||||
this.activeDescriptors.push(descriptor);
|
||||
}
|
||||
log.props.sort(
|
||||
(a, b) => a.nameI18n.localeCompare(b.nameI18n));
|
||||
}
|
||||
let innerHTML = '';
|
||||
for (const descriptor of this.activeDescriptors)
|
||||
innerHTML += `<vn-${this.toKebabCase(descriptor)}-descriptor-popover vn-id="${descriptor}"></vn-${this.toKebabCase(descriptor)}-descriptor-popover>\n`;
|
||||
|
||||
document.getElementById('descriptors').innerHTML = innerHTML;
|
||||
}
|
||||
|
||||
toKebabCase(str) {
|
||||
return str.replace(/\s+/g, '-')
|
||||
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
||||
.toLowerCase();
|
||||
|
||||
function getVal(vals, prop) {
|
||||
let val; let id;
|
||||
|
@ -275,6 +289,8 @@ function firstUpper(str) {
|
|||
return str && str.charAt(0).toUpperCase() + str.substr(1);
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$compile'];
|
||||
|
||||
ngModule.vnComponent('vnLog', {
|
||||
controller: Controller,
|
||||
template: require('./index.html'),
|
||||
|
|
Loading…
Reference in New Issue