alchemy-chimera 1.1.1 → 1.2.0

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,7 @@
1
+ ## 1.2.0 (2022-11-02)
2
+
3
+ * Update to `alchemy-form` v0.2.0
4
+
1
5
  ## 1.1.1 (2022-10-12)
2
6
 
3
7
  * 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,18 @@ 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
 
200
203
  .form-field-info label,
201
- .form-field-info alchemy-label {
204
+ .form-field-info al-label {
202
205
  display: block;
203
206
  font-size: 1.2rem;
204
207
  }
205
208
  }
206
209
 
207
- alchemy-widgets-navigation {
210
+ al-widgets-navigation {
208
211
  --border-color: #333333;
209
212
 
210
213
  ul {
@@ -220,7 +223,7 @@ alchemy-widgets-navigation {
220
223
  }
221
224
  }
222
225
 
223
- alchemy-widget[type="link"] {
226
+ al-widget[type="link"] {
224
227
  width: 100%;
225
228
  height: 3rem;
226
229
  display: flex;
@@ -279,7 +282,7 @@ alchemy-widgets-navigation {
279
282
  color: white;
280
283
  }
281
284
 
282
- alchemy-field-translatable {
285
+ al-field-translatable {
283
286
  .prefix-buttons {
284
287
  width: 100%;
285
288
  border-bottom: 1px solid var(--color-box-border);
@@ -312,8 +315,8 @@ alchemy-field-translatable {
312
315
  }
313
316
  }
314
317
 
315
- alchemy-field[mode="inline"] {
316
- alchemy-field-translatable {
318
+ al-field[mode="inline"] {
319
+ al-field-translatable {
317
320
  .prefix-buttons {
318
321
  button {
319
322
  height: 2rem;
@@ -326,7 +329,7 @@ alchemy-field[mode="inline"] {
326
329
  }
327
330
  }
328
331
 
329
- alchemy-field-translatable-entry {
332
+ al-field-translatable-entry {
330
333
  display: block;
331
334
  padding: 9px;
332
335
  background: rgba(190,190,190,0.1);
@@ -337,19 +340,19 @@ alchemy-field[mode="inline"] {
337
340
  .default-form-editor,
338
341
  .chimera-wrapper {
339
342
 
340
- alchemy-table .aft-column-filters input {
343
+ al-table .aft-column-filters input {
341
344
  @extend .chimera-input-field;
342
345
  width: 100%;
343
346
  }
344
347
 
345
- alchemy-form {
348
+ al-form {
346
349
  .error-area:not(:empty) {
347
350
  @extend .error, .alert-box;
348
351
  margin-top: 0;
349
352
  }
350
353
  }
351
354
 
352
- alchemy-field {
355
+ al-field {
353
356
  .wrapped-inline {
354
357
  > .field {
355
358
  padding: 0 !important;
@@ -357,11 +360,11 @@ alchemy-field[mode="inline"] {
357
360
  }
358
361
  }
359
362
 
360
- alchemy-field[mode="inline"] {
363
+ al-field[mode="inline"] {
361
364
  border: none;
362
365
  }
363
366
 
364
- alchemy-field:not([mode="inline"]) {
367
+ al-field:not([mode="inline"]) {
365
368
  border: 1px solid var(--color-box-border);
366
369
  background-color: white;
367
370
  border-radius: 4px;
@@ -369,7 +372,7 @@ alchemy-field[mode="inline"] {
369
372
  // In case something goes wrong:
370
373
  min-height: 1rem;
371
374
 
372
- alchemy-label {
375
+ al-label {
373
376
  padding-left: 1rem;
374
377
  line-height: 3rem;
375
378
  font-size: 16px;
@@ -387,7 +390,7 @@ alchemy-field[mode="inline"] {
387
390
  flex: 10;
388
391
  }
389
392
 
390
- > alchemy-widget {
393
+ > al-widget {
391
394
  border: 1px solid var(--color-input-border);
392
395
  padding: 0 12px;
393
396
  }
@@ -417,7 +420,7 @@ alchemy-field[mode="inline"] {
417
420
  }
418
421
  }
419
422
 
420
- alchemy-field-array {
423
+ al-field-array {
421
424
  .add-entry {
422
425
  @extend .btn;
423
426
  margin: 1rem 0 0 1rem;
@@ -434,7 +437,7 @@ alchemy-field[mode="inline"] {
434
437
  margin-top: 0.5rem;
435
438
  }
436
439
 
437
- alchemy-field-array-entry:not(:last-of-type) {
440
+ al-field-array-entry:not(:last-of-type) {
438
441
  //border-bottom: 1px solid gray;
439
442
  position: relative;
440
443
 
@@ -451,18 +454,18 @@ alchemy-field[mode="inline"] {
451
454
  }
452
455
  }
453
456
 
454
- alchemy-field-array-entry:not(:first-of-type) {
457
+ al-field-array-entry:not(:first-of-type) {
455
458
  margin-top: 1rem;
456
459
  }
457
460
  }
458
461
 
459
462
  .chimera-editor-widgets {
460
463
 
461
- alchemy-widgets-column.toc-col {
464
+ al-widgets-column.toc-col {
462
465
  flex: 2 2;
463
466
  }
464
467
 
465
- table-of-contents[elements-selector="alchemy-field"] {
468
+ al-toc[elements-selector="al-field"] {
466
469
  align-self: start;
467
470
  top: 2rem;
468
471
  position: sticky;
@@ -490,21 +493,22 @@ alchemy-field[mode="inline"] {
490
493
  }
491
494
  }
492
495
 
493
- alchemy-field-schema {
494
- alchemy-field {
496
+ al-field-schema {
497
+ al-field {
495
498
  border: none;
496
499
  margin-bottom: 1rem;
497
500
  }
498
501
  }
499
502
 
500
503
  .aft-actions {
504
+ al-button,
501
505
  a {
502
506
  color: var(--button-text-color);
503
507
  background-color: var(--button-bg-color);
504
508
  padding: 0.5rem;
505
509
  border-radius: 6px;
506
510
  margin: 0.2rem;
507
- display: inline-block;
511
+ display: inline-flex;
508
512
 
509
513
  &:hover {
510
514
  background-color: var(--button-bg-hover-color);
@@ -532,7 +536,7 @@ alchemy-field[mode="inline"] {
532
536
  }
533
537
  }
534
538
 
535
- alchemy-password-input {
539
+ al-password-input {
536
540
  label:first-of-type {
537
541
  margin-bottom: 0;
538
542
  }
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
  }
@@ -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.0
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,10 +111,49 @@ 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({
156
+ action_widgets.push({
110
157
  type : 'html',
111
158
  config : {
112
159
  html : '<button class="btn btn-submit" type="submit">Save</button>'
@@ -138,7 +185,7 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
138
185
  "config": {
139
186
  model : this.ModelClass.type_name,
140
187
  purpose : 'edit',
141
- widgets : field_widgets
188
+ widgets : action_widgets
142
189
  }
143
190
  }
144
191
  ]
@@ -152,9 +199,9 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
152
199
  {
153
200
  type: "table_of_contents",
154
201
  config: {
155
- parent_selector: 'alchemy-widgets-row',
156
- elements_selector: 'alchemy-field',
157
- title_selector: 'alchemy-label'
202
+ parent_selector: 'al-widgets-row',
203
+ elements_selector: 'al-field',
204
+ title_selector: 'al-label'
158
205
  }
159
206
  }
160
207
  ]
@@ -180,9 +227,10 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
180
227
  "type": "alchemy_table",
181
228
  "config": {
182
229
  fieldset : fieldset,
183
- page_size : 50,
230
+ page_size : 25,
184
231
  show_filters : true,
185
232
  id : 'aft-' + this.ModelClass.type_name,
233
+ use_url_pagination : true,
186
234
  recordsource : {
187
235
  route : 'Chimera.Editor#records',
188
236
  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.0",
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.0",
17
+ "alchemy-widget" : "~0.2.0"
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 %}