I have implemented a simple dialog initially to test the functionality. I have it working but for some reason it does not display the border or background. In fact, it appears to be missing all styles.
Its a dotnet CORE Aurelia project spun off from the CLI. I am running bootstrap 3.
Here is my view:
<template>
<ai-dialog>
<ai-dialog-body>
<h2>${message}</h2>
</ai-dialog-body>
<ai-dialog-footer>
<button click.trigger="controller.cancel()">Cancel</button>
<button click.trigger="controller.ok(message)">Ok</button>
</ai-dialog-footer>
</ai-dialog>
here is my viewmodel:
import { inject } from 'aurelia-framework';
import { DialogController } from 'aurelia-dialog';
@inject(DialogController)
export class ClientDeletePrompt {
public message: any;
constructor(private controller: DialogController, private answer: any) {
this.controller = controller;
this.answer = null;
controller.settings.centerHorizontalOnly = true;
}
activate(message: any) {
this.message = message;
}
}
Here is how I have added it to my project via “boot.ts” (note that bootstrap is added here as well):
import "isomorphic-fetch";
import { Aurelia, PLATFORM } from "aurelia-framework";
import {
Redirect,
NavigationInstruction,
Router,
RouterConfiguration,
Next,
PipelineProvider
} from "aurelia-router";
import { HttpClient } from "aurelia-fetch-client";
import "bootstrap/dist/css/bootstrap.css";
import "font-awesome/css/font-awesome.css";
import "bootstrap";
declare const IS_DEV_BUILD: boolean; // The value is supplied by Webpack during the build
import { AuthService } from "./services/auth/auth-service"
export function configure(aurelia: Aurelia, router: Router, ) {
aurelia.use
.standardConfiguration()
.plugin(PLATFORM.moduleName("aurelia-validation"))
.plugin(PLATFORM.moduleName("aurelia-event-aggregator"))
.plugin(PLATFORM.moduleName("aurelia-bootstrap"))
.plugin(PLATFORM.moduleName("au-table"))
.plugin(PLATFORM.moduleName("aurelia-mask/masked-input"))
.plugin(PLATFORM.moduleName('aurelia-dialog'));
Here is what I end up with:
Its suppose to have a border around the “Are you sure?”… and you can see the two buttoms below.
I had a quick look at the source and note that its suppose to also have CSS for this (eg for the “ai-dialog” tag) so I am unsure why, in my system etc its missing.
What am I missing and how do I get it to work as a normal dialog…
Any help much appreciated.
Simon
Dialog went through a breaking change and ai-dialog
should be ux-dialog
. Can you try that and see if it styles correctly ?
si2030
July 1, 2018, 12:41pm
3
Wow… yes it works… thank you…
si2030
July 2, 2018, 12:20am
4
I had a look at the source and noticed that the styles had not been updated for two years…
I have a question. It seems that the dialog is getting its styles from somewhere else other than bootstrap. I wonder if someone could tell me how the styles are working in dialog as I had a look at the source and noticed that the styles folder nothing had been updated for a couple of years… instead its using (I think a ux style?? given the tag name) - just curious.
The style/input.less
and style/output.css
are NOT in use for ages. They should be removed from the code base.
The real css is here.
'ux-dialog-header': PLATFORM.moduleName('./ux-dialog-header'),
'ux-dialog-body': PLATFORM.moduleName('./ux-dialog-body'),
'ux-dialog-footer': PLATFORM.moduleName('./ux-dialog-footer'),
'attach-focus': PLATFORM.moduleName('./attach-focus')
};
// tslint:disable-next-line:max-line-length
export type DialogResourceName = 'ux-dialog' | 'ux-dialog-header' | 'ux-dialog-body' | 'ux-dialog-footer' | 'attach-focus';
// tslint:disable-next-line:max-line-length
const defaultCSSText = `ux-dialog-container,ux-dialog-overlay{position:fixed;top:0;right:0;bottom:0;left:0}ux-dialog-container{display:block;padding:30px;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;min-width:300px;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto;outline:0;}ux-dialog{display:table;box-shadow:0 5px 15px rgba(0,0,0,.5);border:1px solid rgba(0,0,0,.2);border-radius:5px;padding:3px;min-width:300px;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;background:#fff}ux-dialog>ux-dialog-header{display:block;padding:16px;border-bottom:1px solid #e5e5e5}ux-dialog>ux-dialog-header>button{float:right;border:none;display:block;width:32px;height:32px;background:0 0;font-size:22px;line-height:16px;margin:-14px -16px 0 0;padding:0;cursor:pointer}ux-dialog>ux-dialog-body{display:block;padding:16px}ux-dialog>ux-dialog-footer{display:block;padding:6px;border-top:1px solid #e5e5e5;text-align:right}ux-dialog>ux-dialog-footer button{color:#333;background-color:#fff;padding:6px 12px;font-size:14px;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid #ccc;border-radius:4px;margin:5px 0 5px 5px}ux-dialog>ux-dialog-footer button:disabled{cursor:default;opacity:.45}ux-dialog>ux-dialog-footer button:hover:enabled{color:#333;background-color:#e6e6e6;border-color:#adadad}.ux-dialog-open{overflow:hidden}`;
/**
* A configuration builder for the dialog plugin.
*/
export class DialogConfiguration {
private fwConfig: FrameworkConfiguration;
private renderer: RendererStatic = defaultRenderer;
private cssText: string = defaultCSSText;
private resources: string[] = [];
1 Like