x4js 2.0.33 → 2.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "2.0.33",
3
+ "version": "2.0.34",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -28,6 +28,7 @@
28
28
  position: absolute !important;
29
29
  background-color: white;
30
30
  border: 1px solid var( --border-dark );
31
+ max-width: 99vw;
31
32
 
32
33
  &> .caption {
33
34
  padding: 8px;
@@ -92,38 +92,55 @@
92
92
 
93
93
 
94
94
  .x4progressionbox {
95
- width: 640px;
96
- height: 200px;
95
+ min-height: 200px;
96
+ min-width: 500px;
97
+
97
98
  &> .x4form {
98
99
  min-height: unset;
99
100
  }
100
101
 
101
- & > .caption,
102
- & > #btnbar {
103
- display: none;
104
- }
105
-
106
102
  & .x4form {
107
103
  min-width: 400px;
104
+ gap: 8px;
105
+
106
+ &> .x4hbox {
107
+ flex-grow: 1;
108
+ align-items: stretch;
109
+ .right {
110
+ flex-grow: 1;
111
+ gap: 8px;
112
+ display: grid;
113
+ grid-template-rows: auto auto 1fr;
114
+ }
115
+ }
116
+
108
117
  .x4icon {
109
118
  height: 64px;
110
119
  animation: rotating 3s linear infinite;
111
120
  fill: var(--accent-background);
121
+ align-self: center;
112
122
  }
113
123
 
114
- .x4label,
115
- .x4simpletext {
116
- padding: 16px 16px 0 16px;
124
+ #title {
125
+ padding: 4px 16px;
117
126
  line-height: 1.8em;
118
127
  }
119
128
 
120
129
  .x4progress {
121
- margin-left: 16px;
130
+ margin: 0 16px;
122
131
  }
123
132
 
124
133
  #sub-text {
125
- max-height: 140px;
126
- overflow-y: auto;
134
+ flex-grow: 1;
135
+ max-height: 400px;
136
+ overflow: auto;
137
+ background-color: #f5f5f5;
138
+ padding: 4px 8px;
139
+ margin: 0 16px;
140
+
141
+ .x4simpletext {
142
+ white-space: nowrap;
143
+ }
127
144
  }
128
145
  }
129
146
  }
@@ -240,12 +240,13 @@ export class PromptBox extends Dialog<DialogProps>
240
240
  @class_ns( "x4" )
241
241
  export class ProgressionBox extends Dialog {
242
242
 
243
- #log: (string | UnsafeHtml)[];
243
+ #has_errors = false;
244
244
 
245
245
  constructor( title: string ) {
246
246
  super( {
247
247
  modal: true,
248
248
  title: null,
249
+ sizable: true,
249
250
  movable: true,
250
251
  form: new Form( {
251
252
  content: [
@@ -255,26 +256,48 @@ export class ProgressionBox extends Dialog {
255
256
  new VBox( { flex: 1, cls: "right", content: [
256
257
  new SimpleText( { id: "title", text: title } ),
257
258
  new Progress( { id:"prog", min: 0, max: 100, value: 0 } ),
258
- new SimpleText( { id: "sub-text", text: "" } ),
259
+ new VBox( { id: "sub-text" } ),
259
260
  ]})
260
261
  ]
261
262
  }),
262
263
  ]
263
264
  }),
264
- buttons: [ "ok.outline.default","cancel.outline" ]
265
+ buttons: [ "ok.outline.default" ]
265
266
  });
266
267
 
267
- this.#log = [];
268
+ this.query("#btnbar").show( false );
269
+
270
+ this.on("btnclick", ( ) => this.show( false ) );
271
+ }
272
+
273
+ addText( text: string | UnsafeHtml, perc: number ) {
274
+ this.query<Label>( "#sub-text").appendContent( new SimpleText( { text } ) );
275
+ this.query<Progress>( "#prog").setValue( perc );
276
+ }
277
+
278
+ addError( text: string | UnsafeHtml, perc: number ) {
279
+ this.query<Label>( "#sub-text").appendContent( new SimpleText( { cls:"error", text } ) );
280
+ this.query<Progress>( "#prog").setValue( perc );
281
+
282
+ this.#has_errors = true;
268
283
  }
269
284
 
270
285
  setText( text: string | UnsafeHtml, perc: number ) {
271
- this.#log.push( text );
272
- this.query<Label>( "#sub-text").setText( unsafeHtml(this.#log.join("<br/>")) );
286
+ this.query<Label>( "#sub-text").setContent( new SimpleText( { text } ) );
273
287
  this.query<Progress>( "#prog").setValue( perc );
274
288
  }
275
289
 
276
- clearText( ) {
277
- this.#log = [];
278
- this.query<Label>( "#sub-text").setText( '' );
290
+ clear( ) {
291
+ this.#has_errors = true;
292
+ this.query<Label>( "#sub-text").clearContent( );
293
+ }
294
+
295
+ done( ) {
296
+ if( this.#has_errors ) {
297
+ this.query("#btnbar").show( true );
298
+ }
299
+ else {
300
+ this.setTimeout( "close", 5000, ( ) => { this.show(false);} );
301
+ }
279
302
  }
280
303
  }