bugfix
This commit is contained in:
parent
1aceb6d429
commit
9f28289bb6
@ -52,9 +52,9 @@ bricks.UiAudioText = class extends bricks.UiType {
|
|||||||
"upload_url"
|
"upload_url"
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
static uitype = 'audiotext';
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype = 'audiotext';
|
||||||
this.recorder = new bricks.AudioRecorder({
|
this.recorder = new bricks.AudioRecorder({
|
||||||
icon_rate:2,
|
icon_rate:2,
|
||||||
upload_url:opts.upload_url
|
upload_url:opts.upload_url
|
||||||
@ -83,15 +83,14 @@ bricks.UiAudioText = class extends bricks.UiType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiHide = class extends bricks.UiType {
|
bricks.UiHide = class extends bricks.UiType {
|
||||||
static uitype = 'hide';
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype = 'hide';
|
||||||
this.set_style('display', 'none');
|
this.set_style('display', 'none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiStr =class extends bricks.UiType {
|
bricks.UiStr =class extends bricks.UiType {
|
||||||
static uitype='str';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
name:
|
name:
|
||||||
@ -108,6 +107,7 @@ bricks.UiStr =class extends bricks.UiType {
|
|||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='str';
|
||||||
this.rate = this.opts.rate || 1;
|
this.rate = this.opts.rate || 1;
|
||||||
this.dynsize = this.opts.dynsize || true;
|
this.dynsize = this.opts.dynsize || true;
|
||||||
this.cfontsize = this.opts.cfontsize || 1;
|
this.cfontsize = this.opts.cfontsize || 1;
|
||||||
@ -204,7 +204,6 @@ bricks.UiStr =class extends bricks.UiType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiPassword =class extends bricks.UiStr {
|
bricks.UiPassword =class extends bricks.UiStr {
|
||||||
static uitype='password';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
name:
|
name:
|
||||||
@ -221,11 +220,11 @@ bricks.UiPassword =class extends bricks.UiStr {
|
|||||||
constructor(opts){
|
constructor(opts){
|
||||||
opts.dynsize = opts.dynsize || true;
|
opts.dynsize = opts.dynsize || true;
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='password';
|
||||||
this.dom_element.type = 'password';
|
this.dom_element.type = 'password';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bricks.UiInt =class extends bricks.UiStr {
|
bricks.UiInt =class extends bricks.UiStr {
|
||||||
static uitype='int';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
length:
|
length:
|
||||||
@ -233,6 +232,7 @@ bricks.UiInt =class extends bricks.UiStr {
|
|||||||
*/
|
*/
|
||||||
constructor(options){
|
constructor(options){
|
||||||
super(options);
|
super(options);
|
||||||
|
this.uitype='int';
|
||||||
this.dom_element.style.textAlign = 'right';
|
this.dom_element.style.textAlign = 'right';
|
||||||
this.dom_element.type = 'number';
|
this.dom_element.type = 'number';
|
||||||
this.pattern = '\\d*';
|
this.pattern = '\\d*';
|
||||||
@ -249,7 +249,6 @@ bricks.UiInt =class extends bricks.UiStr {
|
|||||||
|
|
||||||
}
|
}
|
||||||
bricks.UiFloat =class extends bricks.UiInt {
|
bricks.UiFloat =class extends bricks.UiInt {
|
||||||
static uitype='float';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
dec_len:
|
dec_len:
|
||||||
@ -257,6 +256,7 @@ bricks.UiFloat =class extends bricks.UiInt {
|
|||||||
*/
|
*/
|
||||||
constructor(options){
|
constructor(options){
|
||||||
super(options);
|
super(options);
|
||||||
|
this.uitype='float';
|
||||||
this.pattern = '\\d*\\.?\\d+';
|
this.pattern = '\\d*\\.?\\d+';
|
||||||
var dec_len = this.opts.dec_len || 2;
|
var dec_len = this.opts.dec_len || 2;
|
||||||
var step = 1;
|
var step = 1;
|
||||||
@ -275,7 +275,6 @@ bricks.UiFloat =class extends bricks.UiInt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bricks.UiTel =class extends bricks.UiStr {
|
bricks.UiTel =class extends bricks.UiStr {
|
||||||
static uitype='tel';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -284,6 +283,7 @@ bricks.UiTel =class extends bricks.UiStr {
|
|||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='tel';
|
||||||
this.dom_element.type = 'tel';
|
this.dom_element.type = 'tel';
|
||||||
if (this.opts.pattern)
|
if (this.opts.pattern)
|
||||||
this.dom_element.pattern = this.opts.pattern;
|
this.dom_element.pattern = this.opts.pattern;
|
||||||
@ -292,13 +292,13 @@ bricks.UiTel =class extends bricks.UiStr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiEmail =class extends bricks.UiStr {
|
bricks.UiEmail =class extends bricks.UiStr {
|
||||||
static uitype='email';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='email';
|
||||||
this.dom_element.type = 'email';
|
this.dom_element.type = 'email';
|
||||||
if (this.opts.pattern)
|
if (this.opts.pattern)
|
||||||
this.dom_element.pattern = this.opts.pattern;
|
this.dom_element.pattern = this.opts.pattern;
|
||||||
@ -308,7 +308,6 @@ bricks.UiEmail =class extends bricks.UiStr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiFile =class extends bricks.UiStr {
|
bricks.UiFile =class extends bricks.UiStr {
|
||||||
static uitype='file';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
accept:
|
accept:
|
||||||
@ -318,6 +317,7 @@ bricks.UiFile =class extends bricks.UiStr {
|
|||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='file';
|
||||||
this.dom_element.type = 'file';
|
this.dom_element.type = 'file';
|
||||||
if (this.opts.accept)
|
if (this.opts.accept)
|
||||||
this.dom_element.accept = this.opts.accept;
|
this.dom_element.accept = this.opts.accept;
|
||||||
@ -340,10 +340,10 @@ bricks.UiFile =class extends bricks.UiStr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiImage =class extends bricks.VBox {
|
bricks.UiImage =class extends bricks.VBox {
|
||||||
static uitype='image';
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
opts.name = opts.name || 'image';
|
opts.name = opts.name || 'image';
|
||||||
super(options);
|
super(options);
|
||||||
|
this.uitype='image';
|
||||||
this.bind('drop', this.dropHandle.bind(this));
|
this.bind('drop', this.dropHandle.bind(this));
|
||||||
this.input = document.createElement('input');
|
this.input = document.createElement('input');
|
||||||
this.input.type = 'file';
|
this.input.type = 'file';
|
||||||
@ -388,9 +388,9 @@ bricks.UiImage =class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiCheck =class extends bricks.UiType {
|
bricks.UiCheck =class extends bricks.UiType {
|
||||||
static uitype = 'check';
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype = 'check';
|
||||||
bricks.extend(bricks.UiCheck.prototype, bricks.Layout.prototype);
|
bricks.extend(bricks.UiCheck.prototype, bricks.Layout.prototype);
|
||||||
this.add_widget = bricks.Layout.prototype.add_widget.bind(this);
|
this.add_widget = bricks.Layout.prototype.add_widget.bind(this);
|
||||||
this.dom_element.style.width = 'auto';
|
this.dom_element.style.width = 'auto';
|
||||||
@ -440,7 +440,6 @@ bricks.UiCheck =class extends bricks.UiType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiCheckBox =class extends bricks.UiType {
|
bricks.UiCheckBox =class extends bricks.UiType {
|
||||||
static uitype='checkbox';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
name:
|
name:
|
||||||
@ -464,6 +463,7 @@ bricks.UiCheckBox =class extends bricks.UiType {
|
|||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='checkbox';
|
||||||
this.valueField = opts.valueField || 'value';
|
this.valueField = opts.valueField || 'value';
|
||||||
this.textField = opts.textField || 'text';
|
this.textField = opts.textField || 'text';
|
||||||
this.value = this.opts.value || this.opts.defaultValue||[];
|
this.value = this.opts.value || this.opts.defaultValue||[];
|
||||||
@ -577,7 +577,6 @@ bricks.UiCheckBox =class extends bricks.UiType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiDate =class extends bricks.UiStr {
|
bricks.UiDate =class extends bricks.UiStr {
|
||||||
static uitype='date';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
max_date:
|
max_date:
|
||||||
@ -586,6 +585,7 @@ bricks.UiDate =class extends bricks.UiStr {
|
|||||||
*/
|
*/
|
||||||
constructor(options){
|
constructor(options){
|
||||||
super(options);
|
super(options);
|
||||||
|
this.uitype='date';
|
||||||
this.opts_setup();
|
this.opts_setup();
|
||||||
}
|
}
|
||||||
opts_setup(){
|
opts_setup(){
|
||||||
@ -601,7 +601,6 @@ bricks.UiDate =class extends bricks.UiStr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiText =class extends bricks.UiType {
|
bricks.UiText =class extends bricks.UiType {
|
||||||
static uitype='text';
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
name:
|
name:
|
||||||
@ -618,6 +617,7 @@ bricks.UiText =class extends bricks.UiType {
|
|||||||
opts.dynsize = opts.dynsize || true;
|
opts.dynsize = opts.dynsize || true;
|
||||||
opts.cfontsize = opts.cfontsize || 1;
|
opts.cfontsize = opts.cfontsize || 1;
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='text';
|
||||||
this.build();
|
this.build();
|
||||||
this.charsize_sizing();
|
this.charsize_sizing();
|
||||||
}
|
}
|
||||||
@ -669,11 +669,11 @@ bricks.UiCode =class extends bricks.UiType {
|
|||||||
method:
|
method:
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
static uitype='code';
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
opts.cfontsize = opts.cfontsize||1;
|
opts.cfontsize = opts.cfontsize||1;
|
||||||
opts.dynsize = opts.dynsize || true;
|
opts.dynsize = opts.dynsize || true;
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype='code';
|
||||||
this.data = this.opts.data;
|
this.data = this.opts.data;
|
||||||
this.build();
|
this.build();
|
||||||
}
|
}
|
||||||
@ -764,33 +764,28 @@ bricks._Input = class {
|
|||||||
this.uitypes = [];
|
this.uitypes = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
register(name, Klass){
|
register(name, uitype,Klass){
|
||||||
if (! Klass){
|
if (! Klass){
|
||||||
bricks.debug('Klass not defined', name);
|
bricks.debug('Klass not defined', name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (! Klass.uitype){
|
|
||||||
bricks.debug('uitype of Klass not defined', name);
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
bricks.Factory.register(name, Klass);
|
bricks.Factory.register(name, Klass);
|
||||||
this.uitypes[Klass.uitype] = Klass;
|
this.uitypes[uitype] = Klass;
|
||||||
}
|
}
|
||||||
factory(options){
|
factory(options){
|
||||||
var klass = objget(this.uitypes, options.uitype);
|
var klass = this.uitypes[options.uitype];
|
||||||
if (klass){
|
if (klass){
|
||||||
return new klass(options);
|
return new klass(options);
|
||||||
}
|
}
|
||||||
bricks.debug('create input for:', options.uitype, 'failed');
|
bricks.debug('create input for:', options.uitype, 'failed', this.uitypes);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bricks.UiAudio =class extends bricks.UiStr {
|
bricks.UiAudio =class extends bricks.UiStr {
|
||||||
static uitype = 'audio';
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype = 'audio';
|
||||||
this.autoplay = opts.autoplay;
|
this.autoplay = opts.autoplay;
|
||||||
this.readonly = opts.readonly;
|
this.readonly = opts.readonly;
|
||||||
this.icon = new bricks.Icon({
|
this.icon = new bricks.Icon({
|
||||||
@ -823,9 +818,9 @@ bricks.UiAudio =class extends bricks.UiStr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bricks.UiVideo =class extends bricks.UiStr {
|
bricks.UiVideo =class extends bricks.UiStr {
|
||||||
static uitype = 'video';
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.uitype = 'video';
|
||||||
this.autoplay = opts.autoplay;
|
this.autoplay = opts.autoplay;
|
||||||
this.readonly = opts.readonly;
|
this.readonly = opts.readonly;
|
||||||
this.icon = new bricks.Icon({
|
this.icon = new bricks.Icon({
|
||||||
@ -858,20 +853,20 @@ bricks.UiVideo =class extends bricks.UiStr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var Input = new bricks._Input();
|
var Input = new bricks._Input();
|
||||||
Input.register('UiStr', bricks.UiStr);
|
Input.register('UiStr', 'str', bricks.UiStr);
|
||||||
Input.register('UiHide', bricks.UiHide);
|
Input.register('UiHide', 'hide', bricks.UiHide);
|
||||||
Input.register('UiTel', bricks.UiTel);
|
Input.register('UiTel', 'tel', bricks.UiTel);
|
||||||
Input.register('UiDate', bricks.UiDate);
|
Input.register('UiDate', 'date', bricks.UiDate);
|
||||||
Input.register('UiInt', bricks.UiInt);
|
Input.register('UiInt', 'int', bricks.UiInt);
|
||||||
Input.register('UiFloat', bricks.UiFloat);
|
Input.register('UiFloat', 'float', bricks.UiFloat);
|
||||||
Input.register('UiCheck', bricks.UiCheck);
|
Input.register('UiCheck', 'check', bricks.UiCheck);
|
||||||
Input.register('UiCheckBox', bricks.UiCheckBox);
|
Input.register('UiCheckBox', 'checkbox', bricks.UiCheckBox);
|
||||||
Input.register('UiEmail', bricks.UiEmail);
|
Input.register('UiEmail', 'email', bricks.UiEmail);
|
||||||
Input.register('UiFile', bricks.UiFile);
|
Input.register('UiFile', 'file', bricks.UiFile);
|
||||||
Input.register('UiImage', bricks.UiImage);
|
Input.register('UiImage', 'image', bricks.UiImage);
|
||||||
Input.register('UiCode', bricks.UiCode);
|
Input.register('UiCode', 'code', bricks.UiCode);
|
||||||
Input.register('UiText', bricks.UiText);
|
Input.register('UiText', 'text', bricks.UiText);
|
||||||
Input.register('UiPassword', bricks.UiPassword);
|
Input.register('UiPassword', 'password', bricks.UiPassword);
|
||||||
Input.register('UiAudio', bricks.UiAudio);
|
Input.register('UiAudio', 'audio', bricks.UiAudio);
|
||||||
Input.register('UiVideo', bricks.UiVideo);
|
Input.register('UiVideo', 'video', bricks.UiVideo);
|
||||||
Input.register('UiAudioText', bricks.UiAudioText);
|
Input.register('UiAudioText', 'audiotext', bricks.UiAudioText);
|
||||||
|
@ -140,7 +140,7 @@ bricks.MarkdownViewer = class extends bricks.VBox {
|
|||||||
async build(){
|
async build(){
|
||||||
await this._build(this.opts.md_url);
|
await this._build(this.opts.md_url);
|
||||||
}
|
}
|
||||||
assync _build(md_url){
|
async _build(md_url){
|
||||||
var md_content = await (bricks.tget(md_url));
|
var md_content = await (bricks.tget(md_url));
|
||||||
this.md_el.innerHTML = marked.parse(md_content);
|
this.md_el.innerHTML = marked.parse(md_content);
|
||||||
// this.md_el.baseURI = md_url;
|
// this.md_el.baseURI = md_url;
|
||||||
|
Loading…
Reference in New Issue
Block a user