alchemy-chimera 1.1.1 → 1.2.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 1.2.1 (2022-12-23)
2
+
3
+ * Show field descriptions under the field title
4
+ * Prevent images inside al-field widget editor from being too tall
5
+ * Use `al-button` & `hawkejs_template` for the save button
6
+
7
+ ## 1.2.0 (2022-11-02)
8
+
9
+ * Update to `alchemy-form` v0.2.0
10
+
1
11
  ## 1.1.1 (2022-10-12)
2
12
 
3
13
  * Add more alchemy-field options
@@ -25,6 +25,9 @@ body {
25
25
  --color-active: #3699FF;
26
26
  --color-text: #475466;
27
27
  --color-input-border: #CCD7E6;
28
+
29
+ --alchemy-tab-button-border: var(--color-box-border);
30
+ --alchemy-tab-panel-border: var(--color-box-border);
28
31
  }
29
32
 
30
33
  .chimera-wrapper {
@@ -63,7 +66,7 @@ body {
63
66
  //filter: brightness(1.05);
64
67
  }
65
68
 
66
- al-ico {
69
+ al-icon {
67
70
  margin-right: 4px;
68
71
  }
69
72
  }
@@ -193,18 +196,22 @@ body {
193
196
  .chimera-editor-widgets {
194
197
  padding: 1rem;
195
198
 
196
- alchemy-widget[type="alchemy_field"] {
199
+ al-widget[type="alchemy_field"] {
197
200
  margin-bottom: 1rem;
198
201
  }
199
202
 
203
+ .form-field-info {
204
+ background-color: #F4F5F9;
205
+ }
206
+
200
207
  .form-field-info label,
201
- .form-field-info alchemy-label {
208
+ .form-field-info al-label {
202
209
  display: block;
203
210
  font-size: 1.2rem;
204
211
  }
205
212
  }
206
213
 
207
- alchemy-widgets-navigation {
214
+ al-widgets-navigation {
208
215
  --border-color: #333333;
209
216
 
210
217
  ul {
@@ -220,7 +227,7 @@ alchemy-widgets-navigation {
220
227
  }
221
228
  }
222
229
 
223
- alchemy-widget[type="link"] {
230
+ al-widget[type="link"] {
224
231
  width: 100%;
225
232
  height: 3rem;
226
233
  display: flex;
@@ -279,7 +286,7 @@ alchemy-widgets-navigation {
279
286
  color: white;
280
287
  }
281
288
 
282
- alchemy-field-translatable {
289
+ al-field-translatable {
283
290
  .prefix-buttons {
284
291
  width: 100%;
285
292
  border-bottom: 1px solid var(--color-box-border);
@@ -312,8 +319,8 @@ alchemy-field-translatable {
312
319
  }
313
320
  }
314
321
 
315
- alchemy-field[mode="inline"] {
316
- alchemy-field-translatable {
322
+ al-field[mode="inline"] {
323
+ al-field-translatable {
317
324
  .prefix-buttons {
318
325
  button {
319
326
  height: 2rem;
@@ -326,7 +333,7 @@ alchemy-field[mode="inline"] {
326
333
  }
327
334
  }
328
335
 
329
- alchemy-field-translatable-entry {
336
+ al-field-translatable-entry {
330
337
  display: block;
331
338
  padding: 9px;
332
339
  background: rgba(190,190,190,0.1);
@@ -337,19 +344,19 @@ alchemy-field[mode="inline"] {
337
344
  .default-form-editor,
338
345
  .chimera-wrapper {
339
346
 
340
- alchemy-table .aft-column-filters input {
347
+ al-table .aft-column-filters input {
341
348
  @extend .chimera-input-field;
342
349
  width: 100%;
343
350
  }
344
351
 
345
- alchemy-form {
352
+ al-form {
346
353
  .error-area:not(:empty) {
347
354
  @extend .error, .alert-box;
348
355
  margin-top: 0;
349
356
  }
350
357
  }
351
358
 
352
- alchemy-field {
359
+ al-field {
353
360
  .wrapped-inline {
354
361
  > .field {
355
362
  padding: 0 !important;
@@ -357,11 +364,11 @@ alchemy-field[mode="inline"] {
357
364
  }
358
365
  }
359
366
 
360
- alchemy-field[mode="inline"] {
367
+ al-field[mode="inline"] {
361
368
  border: none;
362
369
  }
363
370
 
364
- alchemy-field:not([mode="inline"]) {
371
+ al-field:not([mode="inline"]) {
365
372
  border: 1px solid var(--color-box-border);
366
373
  background-color: white;
367
374
  border-radius: 4px;
@@ -369,13 +376,25 @@ alchemy-field[mode="inline"] {
369
376
  // In case something goes wrong:
370
377
  min-height: 1rem;
371
378
 
372
- alchemy-label {
379
+ al-label {
373
380
  padding-left: 1rem;
374
381
  line-height: 3rem;
375
382
  font-size: 16px;
376
383
  font-weight: 500;
377
384
  color: var(--color-title);
378
385
  border-bottom: 1px solid var(--color-box-border);
386
+ display: flex;
387
+ flex-flow: column;
388
+
389
+ [data-he-name="field-description"] {
390
+ line-height: 1;
391
+ margin-bottom: 1rem;
392
+ color:gray;
393
+
394
+ &:empty {
395
+ display: none;
396
+ }
397
+ }
379
398
  }
380
399
 
381
400
  .field {
@@ -387,7 +406,7 @@ alchemy-field[mode="inline"] {
387
406
  flex: 10;
388
407
  }
389
408
 
390
- > alchemy-widget {
409
+ > al-widget {
391
410
  border: 1px solid var(--color-input-border);
392
411
  padding: 0 12px;
393
412
  }
@@ -417,7 +436,7 @@ alchemy-field[mode="inline"] {
417
436
  }
418
437
  }
419
438
 
420
- alchemy-field-array {
439
+ al-field-array {
421
440
  .add-entry {
422
441
  @extend .btn;
423
442
  margin: 1rem 0 0 1rem;
@@ -434,7 +453,7 @@ alchemy-field[mode="inline"] {
434
453
  margin-top: 0.5rem;
435
454
  }
436
455
 
437
- alchemy-field-array-entry:not(:last-of-type) {
456
+ al-field-array-entry:not(:last-of-type) {
438
457
  //border-bottom: 1px solid gray;
439
458
  position: relative;
440
459
 
@@ -451,18 +470,18 @@ alchemy-field[mode="inline"] {
451
470
  }
452
471
  }
453
472
 
454
- alchemy-field-array-entry:not(:first-of-type) {
473
+ al-field-array-entry:not(:first-of-type) {
455
474
  margin-top: 1rem;
456
475
  }
457
476
  }
458
477
 
459
478
  .chimera-editor-widgets {
460
479
 
461
- alchemy-widgets-column.toc-col {
480
+ al-widgets-column.toc-col {
462
481
  flex: 2 2;
463
482
  }
464
483
 
465
- table-of-contents[elements-selector="alchemy-field"] {
484
+ al-toc[elements-selector="al-field"] {
466
485
  align-self: start;
467
486
  top: 2rem;
468
487
  position: sticky;
@@ -490,21 +509,22 @@ alchemy-field[mode="inline"] {
490
509
  }
491
510
  }
492
511
 
493
- alchemy-field-schema {
494
- alchemy-field {
512
+ al-field-schema {
513
+ al-field {
495
514
  border: none;
496
515
  margin-bottom: 1rem;
497
516
  }
498
517
  }
499
518
 
500
519
  .aft-actions {
520
+ al-button,
501
521
  a {
502
522
  color: var(--button-text-color);
503
523
  background-color: var(--button-bg-color);
504
524
  padding: 0.5rem;
505
525
  border-radius: 6px;
506
526
  margin: 0.2rem;
507
- display: inline-block;
527
+ display: inline-flex;
508
528
 
509
529
  &:hover {
510
530
  background-color: var(--button-bg-hover-color);
@@ -532,7 +552,7 @@ alchemy-field[mode="inline"] {
532
552
  }
533
553
  }
534
554
 
535
- alchemy-password-input {
555
+ al-password-input {
536
556
  label:first-of-type {
537
557
  margin-bottom: 0;
538
558
  }
@@ -545,4 +565,13 @@ alchemy-field[mode="inline"] {
545
565
  background: initial;
546
566
  }
547
567
  }
568
+ }
569
+
570
+ al-field {
571
+ // Don't let images in widgets take up more then 1/4th of the screen height
572
+ al-widget {
573
+ img {
574
+ max-height: 25vh;
575
+ }
576
+ }
548
577
  }
package/config/routes.js CHANGED
@@ -12,7 +12,6 @@ chimera_section.add({
12
12
  paths : '/',
13
13
  handler : 'Chimera.Static#dashboard',
14
14
  });
15
-
16
15
  // Editor index action
17
16
  chimera_section.add({
18
17
  name : 'Chimera.Editor#index',
@@ -227,7 +227,7 @@ Editor.setAction(async function trash(conduit, model_name, pk_val) {
227
227
  *
228
228
  * @author Jelle De Loecker <jelle@elevenways.be>
229
229
  * @since 1.0.0
230
- * @version 1.1.1
230
+ * @version 1.2.0
231
231
  *
232
232
  * @param {Conduit} conduit
233
233
  * @param {String} model_name
@@ -254,6 +254,10 @@ Editor.setAction(async function records(conduit, model_name) {
254
254
  crit.select(fields);
255
255
  }
256
256
 
257
+ if (page_size && !page) {
258
+ page = 1;
259
+ }
260
+
257
261
  if (page) {
258
262
  crit.page(page, page_size);
259
263
  }
@@ -26,7 +26,7 @@ ChimeraStatic.setAction(function dashboard(conduit) {
26
26
  *
27
27
  * @author Jelle De Loecker <jelle@elevenways.be>
28
28
  * @since 1.0.0
29
- * @version 1.0.1
29
+ * @version 1.2.1
30
30
  *
31
31
  * @param {Conduit} conduit
32
32
  */
@@ -64,8 +64,11 @@ ChimeraStatic.setAction(function sidebar(conduit) {
64
64
  widgets.push({
65
65
  type : 'link',
66
66
  config : {
67
- href : entry.href,
68
- content: title
67
+ link_type : 'href',
68
+ link_settings : {
69
+ href : entry.href,
70
+ },
71
+ text: title
69
72
  }
70
73
  });
71
74
  } else {
@@ -73,11 +76,14 @@ ChimeraStatic.setAction(function sidebar(conduit) {
73
76
  widgets.push({
74
77
  type : 'link',
75
78
  config : {
76
- route : 'Chimera.Editor#index',
77
- parameters: [
78
- {name: 'model', value: model.constructor.type_name},
79
- ],
80
- content: title
79
+ link_type : 'route',
80
+ link_settings: {
81
+ route : 'Chimera.Editor#index',
82
+ parameters: [
83
+ {name: 'model', value: model.constructor.type_name},
84
+ ],
85
+ },
86
+ text: title
81
87
  }
82
88
  });
83
89
  }
@@ -65,7 +65,7 @@ Config.setMethod(function getFieldSet(name) {
65
65
  *
66
66
  * @author Jelle De Loecker <jelle@elevenways.be>
67
67
  * @since 1.0.0
68
- * @version 1.1.1
68
+ * @version 1.2.1
69
69
  *
70
70
  * @param {String} action
71
71
  * @param {Conduit} conduit
@@ -84,13 +84,21 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
84
84
  if (action == 'edit') {
85
85
  fieldset = this.getFieldSet('edit');
86
86
 
87
- let field_widgets = [];
88
-
87
+ let action_widgets = [];
89
88
  let field;
90
89
 
90
+ let groups = {
91
+ main : {
92
+ title : 'Main',
93
+ widgets : [],
94
+ },
95
+ };
96
+
91
97
  for (field of fieldset) {
92
98
 
93
- field_widgets.push({
99
+ let field_group = groups.main;
100
+
101
+ let field_widget ={
94
102
  type : 'alchemy_field',
95
103
  config : {
96
104
  field : field.name,
@@ -103,13 +111,71 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
103
111
  title : field.options.title,
104
112
  widget_settings : field.options.widget_settings || {},
105
113
  }
114
+ };
115
+
116
+ if (field.options.group) {
117
+ field_group = groups[field.options.group];
118
+
119
+ if (!field_group) {
120
+ field_group = {
121
+ widgets : [],
122
+ };
123
+
124
+ groups[field.options.group] = field_group;
125
+ }
126
+ }
127
+
128
+ field_group.widgets.push(field_widget);
129
+ }
130
+
131
+ if (Object.size(groups) == 1) {
132
+ action_widgets.include(groups.main.widgets);
133
+ } else {
134
+ let tabs = [];
135
+
136
+ for (let name in groups) {
137
+ let group = groups[name];
138
+
139
+ let tab = {
140
+ name : name,
141
+ title : name.titleize(),
142
+ contents : group.widgets,
143
+ };
144
+
145
+ tabs.push(tab);
146
+ }
147
+
148
+ action_widgets.push({
149
+ type : 'alchemy_tabs',
150
+ config : {
151
+ tabs : tabs,
152
+ }
106
153
  });
107
154
  }
108
155
 
109
- field_widgets.push({
110
- type : 'html',
156
+ action_widgets.push({
157
+ type : 'hawkejs_template',
111
158
  config : {
112
- html : '<button class="btn btn-submit" type="submit">Save</button>'
159
+ sourcecode : `
160
+ <al-button class="btn btn-submit" behaviour="submit">
161
+ <al-state state-name="default">
162
+ <al-icon icon-style="duotone" icon-name="floppy-disk"></al-icon>
163
+ {%t "save" %}
164
+ </al-state>
165
+ <al-state state-name="error">
166
+ <al-icon icon-style="duotone" icon-name="skull" icon-flags="shake"></al-icon>
167
+ {%t "error" action="save" %}
168
+ </al-state>
169
+ <al-state state-name="done">
170
+ <al-icon icon-style="duotone" icon-name="badge-check" icon-flags="beat"></al-icon>
171
+ {%t "saved" %}
172
+ </al-state>
173
+ <al-state state-name="busy">
174
+ <al-icon icon-style="duotone" icon-name="spinner" icon-flags="spin"></al-icon>
175
+ {%t "saving" %}
176
+ </al-state>
177
+ </al-button>
178
+ `
113
179
  }
114
180
  });
115
181
 
@@ -138,13 +204,13 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
138
204
  "config": {
139
205
  model : this.ModelClass.type_name,
140
206
  purpose : 'edit',
141
- widgets : field_widgets
207
+ widgets : action_widgets
142
208
  }
143
209
  }
144
210
  ]
145
211
  }
146
212
  },
147
- {
213
+ /*{
148
214
  type: 'column',
149
215
  config: {
150
216
  wrapper_class_names: 'toc-col',
@@ -152,14 +218,14 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
152
218
  {
153
219
  type: "table_of_contents",
154
220
  config: {
155
- parent_selector: 'alchemy-widgets-row',
156
- elements_selector: 'alchemy-field',
157
- title_selector: 'alchemy-label'
221
+ parent_selector: 'al-widgets-row',
222
+ elements_selector: 'al-field',
223
+ title_selector: 'al-label'
158
224
  }
159
225
  }
160
226
  ]
161
227
  }
162
- }
228
+ }*/
163
229
  ]
164
230
  }
165
231
  }
@@ -180,9 +246,10 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
180
246
  "type": "alchemy_table",
181
247
  "config": {
182
248
  fieldset : fieldset,
183
- page_size : 50,
249
+ page_size : 25,
184
250
  show_filters : true,
185
251
  id : 'aft-' + this.ModelClass.type_name,
252
+ use_url_pagination : true,
186
253
  recordsource : {
187
254
  route : 'Chimera.Editor#records',
188
255
  parameters : {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alchemy-chimera",
3
3
  "description": "Chimera plugin for Alchemy MVC",
4
- "version": "1.1.1",
4
+ "version": "1.2.1",
5
5
  "author": "Jelle De Loecker <jelle@elevenways.be>",
6
6
  "keywords": [
7
7
  "alchemy",
@@ -11,10 +11,10 @@
11
11
  ],
12
12
  "repository": "11ways/alchemy-chimera",
13
13
  "peerDependencies": {
14
- "alchemy-acl" : "~0.8.0",
15
- "alchemymvc" : "~1.2.4",
16
- "alchemy-form" : "~0.1.11",
17
- "alchemy-widget" : "~0.1.5"
14
+ "alchemy-acl" : "~0.8.3",
15
+ "alchemymvc" : ">=1.2.7",
16
+ "alchemy-form" : "~0.2.1",
17
+ "alchemy-widget" : "~0.2.1"
18
18
  },
19
19
  "license": "MIT",
20
20
  "engines": {
@@ -1,8 +1,7 @@
1
1
  {% extend "layouts/chimera_body" %}
2
2
 
3
3
  {% block "main" %}
4
- Dashboard Widgets:
5
- <alchemy-widgets>
4
+ <al-widgets>
6
5
 
7
- </alchemy-widgets>
6
+ </al-widgets>
8
7
  {% /block %}
@@ -1,11 +1,11 @@
1
1
  {% include "layouts/chimera_basics" %}
2
2
 
3
3
  {% block "main" %}
4
- <alchemy-widgets
4
+ <al-widgets
5
5
  class="main-widgets"
6
6
  #context_variables={% context_variables %}
7
7
  #value={% widget_config %}
8
- ></alchemy-widgets>
8
+ ></al-widgets>
9
9
  {% /block %}
10
10
 
11
11
  {% block "page-actions" %}
@@ -14,7 +14,7 @@
14
14
  #model={% model_name %}
15
15
  class="btn"
16
16
  >
17
- <al-ico type="plus"></al-ico>
17
+ <al-icon icon-name="plus"></al-icon>
18
18
  {%t "new" model=model_name %}
19
19
  </a>
20
20
  {% /block %}
@@ -15,7 +15,10 @@
15
15
  {%t "cancel" %}
16
16
  </a>
17
17
  <button class="btn danger">
18
- <al-ico type="trash" class="fas fa-trash"></al-ico>
18
+ <al-icon
19
+ icon-name="trash"
20
+ icon-style="duotone"
21
+ ></al-icon>
19
22
  {%t "delete" %}
20
23
  </button>
21
24
  </form>
@@ -28,7 +31,7 @@
28
31
  #model={% model_name %}
29
32
  class="btn"
30
33
  >
31
- <al-ico type="plus"></al-ico>
34
+ <al-icon icon-name="plus"></al-icon>
32
35
  {%t "new" model=model_name %}
33
36
  </a>
34
37
  {% /block %}
@@ -1,4 +1,4 @@
1
- <alchemy-widgets
1
+ <al-widgets
2
2
  class="sidebar-widgets"
3
3
  #value=<% navigation_widgets %>
4
- ></alchemy-widgets>
4
+ ></al-widgets>
@@ -1,8 +1,8 @@
1
1
  {% include "layouts/chimera_basics" %}
2
2
 
3
3
  {% block "main" %}
4
- <alchemy-widgets
4
+ <al-widgets
5
5
  #context_variables={% context_variables %}
6
6
  #value={% widget_config %}
7
- ></alchemy-widgets>
7
+ ></al-widgets>
8
8
  {% /block %}