From 8298b189029cf45d773b5cef04fb216a6d0f24de Mon Sep 17 00:00:00 2001 From: Jed Date: Mon, 13 Jan 2025 17:39:57 +0100 Subject: [PATCH 01/18] updates color input UI for inline and micro --- .../@apostrophecms/asset/lib/globalIcons.js | 3 +- .../ui/apos/components/AposInputColor.vue | 43 ++++++++------ .../color-field/ui/apos/lib/AposColorInfo.vue | 59 +++++++++++++++++++ .../ui/apos/logic/AposInputColor.js | 7 +++ 4 files changed, 92 insertions(+), 20 deletions(-) create mode 100644 modules/@apostrophecms/color-field/ui/apos/lib/AposColorInfo.vue diff --git a/modules/@apostrophecms/asset/lib/globalIcons.js b/modules/@apostrophecms/asset/lib/globalIcons.js index 709f2ce368..9b6c5334ae 100644 --- a/modules/@apostrophecms/asset/lib/globalIcons.js +++ b/modules/@apostrophecms/asset/lib/globalIcons.js @@ -61,8 +61,8 @@ module.exports = { 'format-list-numbered-icon': 'FormatListNumbered', 'format-quote-close-icon': 'FormatQuoteClose', 'format-strikethrough-variant-icon': 'FormatStrikethroughVariant', - 'format-superscript-icon': 'FormatSuperscript', 'format-subscript-icon': 'FormatSubscript', + 'format-superscript-icon': 'FormatSuperscript', 'format-text-icon': 'FormatText', 'format-underline-icon': 'FormatUnderline', 'help-circle-icon': 'HelpCircle', @@ -122,5 +122,6 @@ module.exports = { 'unfold-more-horizontal-icon': 'UnfoldMoreHorizontal', 'video-icon': 'Video', 'view-column-icon': 'ViewColumn', + 'water-off-icon': 'WaterOff', 'web-icon': 'Web' }; diff --git a/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue b/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue index 8ec6be5dbd..b4dd410a78 100644 --- a/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue +++ b/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue @@ -8,6 +8,13 @@ > @@ -42,8 +45,13 @@ @@ -54,16 +62,13 @@ export default { align-items: center; } - .apos-input-color__clear { - margin-left: 10px; - } - .apos-input-color__info { - @include type-base; + margin-left: 15px; - & { - margin-left: 15px; - color: var(--a-text-primary); + &--inline { + margin-right: 10px; + margin-left: 0; } } + diff --git a/modules/@apostrophecms/color-field/ui/apos/lib/AposColorInfo.vue b/modules/@apostrophecms/color-field/ui/apos/lib/AposColorInfo.vue new file mode 100644 index 0000000000..5a283df9f6 --- /dev/null +++ b/modules/@apostrophecms/color-field/ui/apos/lib/AposColorInfo.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/modules/@apostrophecms/color-field/ui/apos/logic/AposInputColor.js b/modules/@apostrophecms/color-field/ui/apos/logic/AposInputColor.js index d294107d50..e280df8f63 100644 --- a/modules/@apostrophecms/color-field/ui/apos/logic/AposInputColor.js +++ b/modules/@apostrophecms/color-field/ui/apos/logic/AposInputColor.js @@ -16,6 +16,12 @@ export default { }; }, computed: { + isMicro() { + return this.modifiers.includes('micro'); + }, + isInline() { + return this.modifiers.includes('inline'); + }, pickerValue() { return this.next || this.defaultValue; }, @@ -48,6 +54,7 @@ export default { } }, mounted() { + console.log('this.modifiers', this.modifiers); if (!this.next) { this.next = ''; } From f476f1fab426a7c3f88ade674d1a00a05e8563ce Mon Sep 17 00:00:00 2001 From: Jed Date: Mon, 13 Jan 2025 18:02:34 +0100 Subject: [PATCH 02/18] less space between clear icon and the swatch --- .../color-field/ui/apos/components/AposInputColor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue b/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue index b4dd410a78..e2ae055dfa 100644 --- a/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue +++ b/modules/@apostrophecms/color-field/ui/apos/components/AposInputColor.vue @@ -66,7 +66,7 @@ export default { margin-left: 15px; &--inline { - margin-right: 10px; + margin-right: 5px; margin-left: 0; } } From c1794ecdf57c686be7b8cdcd0ab705def9340d64 Mon Sep 17 00:00:00 2001 From: Jed Date: Mon, 13 Jan 2025 18:03:24 +0100 Subject: [PATCH 03/18] in inline mode, field info has no witdth limit, just a margin right to not end up to close to right elem --- .../schema/ui/apos/components/AposInputWrapper.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue b/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue index 2fd2ce1e4a..5635c00785 100644 --- a/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue +++ b/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue @@ -240,13 +240,8 @@ export default { margin-bottom: 0; } - .apos-field__info, - .apos-input-wrapper { - width: 48%; - } - .apos-field__info { - margin-right: 4%; + margin-right: 30px; } &.apos-field--range { From 60974e83e7533294b5a42a43ecd507953c319c23 Mon Sep 17 00:00:00 2001 From: Jed Date: Tue, 14 Jan 2025 17:52:56 +0100 Subject: [PATCH 04/18] adds fieldModifiers prop to AposSchema for field type specific modifiers --- .../schema/ui/apos/logic/AposSchema.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/@apostrophecms/schema/ui/apos/logic/AposSchema.js b/modules/@apostrophecms/schema/ui/apos/logic/AposSchema.js index 076e69e4c0..9341dd8097 100644 --- a/modules/@apostrophecms/schema/ui/apos/logic/AposSchema.js +++ b/modules/@apostrophecms/schema/ui/apos/logic/AposSchema.js @@ -53,12 +53,18 @@ export default { return getConditionTypesObject(); } }, + // Modifiers applied to all fields modifiers: { type: Array, default() { return []; } }, + // Modifiers applied to specified field types + fieldModifiers: { + type: Object, + default: () => ({}) + }, triggerValidation: Boolean, utilityRail: { type: Boolean, @@ -128,10 +134,7 @@ export default { data: this.modelValue.data[item.name] }, serverError: this.serverErrors && this.serverErrors[item.name], - modifiers: [ - ...(this.modifiers || []), - ...(item.modifiers || []) - ] + modifiers: this.computeModifiers(item) } }; }, {}); @@ -339,6 +342,10 @@ export default { generateItemUniqueKey(field) { return `${field.name}:${field._id ?? ''}:${this.modelValue?.data?._id ?? ''}`; + }, + computeModifiers(field) { + const fieldModifiers = this.fieldModifiers[field.type] || this.modifiers; + return [ ...new Set(fieldModifiers.concat(field.modifiers || [])) ]; } } }; From d3afe1c56566fa59c103f0b3571d4f0ab5cc3ef9 Mon Sep 17 00:00:00 2001 From: Jed Date: Tue, 14 Jan 2025 17:53:49 +0100 Subject: [PATCH 05/18] adds new slot info on input wrapper --- .../ui/apos/components/AposInputWrapper.vue | 58 ++++++++++--------- .../schema/ui/apos/logic/AposInputWrapper.js | 3 + 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue b/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue index 5635c00785..d1c95f490d 100644 --- a/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue +++ b/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue @@ -37,9 +37,7 @@ data-apos-test="field-tag" /> @@ -64,27 +62,32 @@ /> - - - - - +
+
+ +
+ + + + + +

- @@ -104,7 +106,7 @@ {{ getTranslatedErrorMessage(errorMessage) }} - + @@ -190,6 +192,10 @@ export default { } } +.apos-field__label-meta:empty { + display: none; +} + .apos-field__help { @include type-base; diff --git a/modules/@apostrophecms/schema/ui/apos/logic/AposInputWrapper.js b/modules/@apostrophecms/schema/ui/apos/logic/AposInputWrapper.js index 7b286fdc16..d642a72781 100644 --- a/modules/@apostrophecms/schema/ui/apos/logic/AposInputWrapper.js +++ b/modules/@apostrophecms/schema/ui/apos/logic/AposInputWrapper.js @@ -143,6 +143,9 @@ export default { data: meta[namespace] || {} }; }); + }, + hasExtraInfo() { + return this.$slots.info; } }, mounted: function () { From 3e5a92d26819a864d653b272ce82037125d46725 Mon Sep 17 00:00:00 2001 From: Jed Date: Tue, 14 Jan 2025 18:17:00 +0100 Subject: [PATCH 06/18] adds input range UI field style for micro --- .../ui/apos/components/AposInputRange.vue | 53 +++++++++++++++++-- .../schema/ui/apos/logic/AposInputRange.js | 3 ++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/modules/@apostrophecms/schema/ui/apos/components/AposInputRange.vue b/modules/@apostrophecms/schema/ui/apos/components/AposInputRange.vue index 1dffca0090..31dd5087fe 100644 --- a/modules/@apostrophecms/schema/ui/apos/components/AposInputRange.vue +++ b/modules/@apostrophecms/schema/ui/apos/components/AposInputRange.vue @@ -6,6 +6,24 @@ :uid="uid" :display-options="displayOptions" > +