From 2470ee96ecb8d5abadfe00ccae35e0fa36f69e29 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 24 Feb 2021 14:25:03 +0100 Subject: [PATCH] init doc type with tabs prototype --- src/Umbraco.Web.UI.Client/.eslintrc | 2 +- .../umbcontenttypegroup.component.js | 36 ++++ ...mbcontenttypegroupplaceholder.component.js | 33 ++++ .../umbcontenttypegroups.component.js | 23 +++ .../umbcontenttypeproperty.component.js | 28 ++++ ...ontenttypepropertyplaceholder.component.js | 33 ++++ .../components/umbgroupsbuilder.directive.js | 75 +++++++++ .../less/components/umb-group-builder.less | 103 +++++++++++- .../umb-content-type-group-placeholder.html | 3 + .../contenttype/umb-content-type-group.html | 67 ++++++++ .../contenttype/umb-content-type-groups.html | 1 + ...umb-content-type-property-placeholder.html | 11 ++ .../umb-content-type-property.html | 155 ++++++++++++++++++ .../views/components/umb-groups-builder.html | 111 ++++++++++++- 14 files changed, 670 insertions(+), 11 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js create mode 100644 src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroupplaceholder.component.js create mode 100644 src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroups.component.js create mode 100644 src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js create mode 100644 src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypepropertyplaceholder.component.js create mode 100644 src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group-placeholder.html create mode 100644 src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html create mode 100644 src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-groups.html create mode 100644 src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property-placeholder.html create mode 100644 src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html diff --git a/src/Umbraco.Web.UI.Client/.eslintrc b/src/Umbraco.Web.UI.Client/.eslintrc index a4010917fb..b3e410109e 100644 --- a/src/Umbraco.Web.UI.Client/.eslintrc +++ b/src/Umbraco.Web.UI.Client/.eslintrc @@ -8,7 +8,7 @@ }, "parserOptions": { - "ecmaVersion": 6 + "ecmaVersion": 2018 }, "globals": { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js new file mode 100644 index 0000000000..44c1aed3c2 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroup.component.js @@ -0,0 +1,36 @@ +(function () { + 'use strict'; + + /** + * A component to render the content type group + */ + + function umbContentTypeGroupController() { + + const vm = this; + + vm.updateName = updateName; + + function updateName (group) { + if (vm.onUpdateName) { + vm.onUpdateName({ group }); + } + } + + } + + const umbContentTypeGroupComponent = { + templateUrl: 'views/components/contenttype/umb-content-type-group.html', + controllerAs: 'vm', + transclude: true, + bindings: { + group: "<", + allowName: "<", + onUpdateName: "&" + }, + controller: umbContentTypeGroupController + }; + + angular.module('umbraco.directives').component('umbContentTypeGroup', umbContentTypeGroupComponent); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroupplaceholder.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroupplaceholder.component.js new file mode 100644 index 0000000000..f59915ae05 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroupplaceholder.component.js @@ -0,0 +1,33 @@ +(function () { + 'use strict'; + + /** + * A component to render the content type group placeholder + */ + + function umbContentTypeGroupPlaceholderController() { + + const vm = this; + + vm.click = click; + + function click () { + if (vm.onClick) { + vm.onClick(); + } + } + + } + + const umbContentTypeGroupPlaceholderComponent = { + templateUrl: 'views/components/contenttype/umb-content-type-group-placeholder.html', + controllerAs: 'vm', + bindings: { + onClick: '&' + }, + controller: umbContentTypeGroupPlaceholderController + }; + + angular.module('umbraco.directives').component('umbContentTypeGroupPlaceholder', umbContentTypeGroupPlaceholderComponent); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroups.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroups.component.js new file mode 100644 index 0000000000..90c83b1a39 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypegroups.component.js @@ -0,0 +1,23 @@ +(function () { + 'use strict'; + + /** + * A component to render the content type groups + */ + + function umbContentTypeGroupsController() { + + const vm = this; + + } + + const umbContentTypeGroupsComponent = { + templateUrl: 'views/components/contenttype/umb-content-type-groups.html', + controllerAs: 'vm', + transclude: true, + controller: umbContentTypeGroupsController + }; + + angular.module('umbraco.directives').component('umbContentTypeGroups', umbContentTypeGroupsComponent); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js new file mode 100644 index 0000000000..b1af89fe73 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypeproperty.component.js @@ -0,0 +1,28 @@ +(function () { + 'use strict'; + + /** + * A component to render the content type property + */ + + function umbContentTypePropertyController() { + + const vm = this; + + + + } + + const umbContentTypePropertyComponent = { + templateUrl: 'views/components/contenttype/umb-content-type-property.html', + bindings: { + property: "<", + compact: "<" + }, + controllerAs: 'vm', + controller: umbContentTypePropertyController + }; + + angular.module('umbraco.directives').component('umbContentTypeProperty', umbContentTypePropertyComponent); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypepropertyplaceholder.component.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypepropertyplaceholder.component.js new file mode 100644 index 0000000000..aeadf64cce --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/contenttype/umbcontenttypepropertyplaceholder.component.js @@ -0,0 +1,33 @@ +(function () { + 'use strict'; + + /** + * A component to render the content type property + */ + + function umbContentTypePropertyPlaceholderController() { + + const vm = this; + + vm.click = click; + + function click ($event) { + if (vm.onClick) { + vm.onClick({$event}) + } + } + + } + + const umbContentTypePropertyPlaceholderComponent = { + templateUrl: 'views/components/contenttype/umb-content-type-property-placeholder.html', + bindings: { + onClick: "&" + }, + controllerAs: 'vm', + controller: umbContentTypePropertyPlaceholderController + }; + + angular.module('umbraco.directives').component('umbContentTypePropertyPlaceholder', umbContentTypePropertyPlaceholderComponent); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js index 06e1c61f1e..99f6dbc251 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js @@ -387,6 +387,81 @@ }; + /* ---------- TABS ---------- */ + + scope.model.hasTabs = true; + scope.openTabIndex = 0; + + scope.changeTab = function (index) { + scope.openTabIndex = index; + }; + + scope.addTab = function (tab) { + scope.addGroup(tab); + scope.openTabIndex = scope.model.groups.length - 2; + }; + + scope.addFieldset = function () { + const activeTab = scope.model.groups[scope.openTabIndex]; + + if (!activeTab) { + return + } + + if (!scope.model.fieldsets) { + scope.model.fieldsets = []; + } + + const fieldset = { + groupId: activeTab.id, + id: scope.model.fieldsets.length + 1, // temp id + name: "" + }; + + scope.model.fieldsets = [...scope.model.fieldsets, fieldset]; + }; + + scope.addNewProperty = function (group, fieldset) { + let newProperty = { + label: null, + alias: null, + propertyState: "init", + validation: { + mandatory: false, + mandatoryMessage: null, + pattern: null, + patternMessage: null + }, + labelOnTop: false + }; + + const propertySettings = { + title: "Property settings", + property: newProperty, + contentType: scope.contentType, + contentTypeName: scope.model.name, + contentTypeAllowCultureVariant: scope.model.allowCultureVariant, + contentTypeAllowSegmentVariant: scope.model.allowSegmentVariant, + view: "views/common/infiniteeditors/propertysettings/propertysettings.html", + size: "small", + submit: function (model) { + + newProperty = {...model.property}; + newProperty.fieldsetId = fieldset ? fieldset.id : null; + newProperty.propertyState = "active"; + + group.properties.push(newProperty); + + editorService.close(); + }, + close: function () { + editorService.close(); + } + }; + + editorService.open(propertySettings); + }; + /* ---------- GROUPS ---------- */ scope.addGroup = function (group) { diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less index 87e46f5d85..e96d09bd72 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-group-builder.less @@ -1,3 +1,98 @@ +/* ---------- TABS ---------- */ + +.umb-group-builder__tabs { + list-style: none; + margin: 0; + padding: 0; + display: flex; + align-items: center; + background-color: @white; + height: 70px; + border-bottom: 1px solid @gray-9; + margin-bottom: 20px; + + li { + height: 100%; + } +} + +.umb-group-builder__tab { + position: relative; + padding: 0 50px 0 20px; + display: flex; + align-items: center; + justify-content: center; + height: 100%; + border-right: 1px solid @gray-9; + + &:hover { + cursor: pointer; + + .umb-group-builder__tab-remove { + display: block; + } + } + + &::before { + content: ""; + position: absolute; + height: 0px; + left: 10px; + right: 10px; + background-color: @ui-light-active-border; + bottom: 0; + border-radius: @baseBorderRadius @baseBorderRadius 0 0; + opacity: 0; + transition: all .2s linear; + } + + &.is-active { + color: @ui-light-active-type !important; + + .umb-group-builder__tab-remove { + display: block; + } + + &::before { + opacity: 1; + height: 4px; + } + } + + &.is-inherited { + .umb-group-builder__group-title-input { + padding: 0; + } + } +} + +.umb-group-builder__tab-remove { + position: absolute; + right: 20px; + display: none; +} + +.umb-group-builder__tab-name { + font-weight: bold; +} + +.umb-group-builder__tab--placeholder { + border: 1px dashed @gray-7; + border-bottom: none; + border-top: none; + padding-right: 20px; +} + +.umb-group-builder__tab-inherited-label { + font-size: 12px; + color: @gray-6; + + button { + font-size: 12px; + color: @gray-6; + } +} + /* ---------- GROUPS ---------- */ .umb-group-builder__groups { @@ -14,6 +109,7 @@ background-color: @white; position: relative; box-shadow: 0 1px 1px 0 rgba(0,0,0,0.16); + margin-bottom: 20px; } .umb-group-builder__group.-inherited { @@ -137,12 +233,9 @@ input.umb-group-builder__group-title-input:disabled:hover { } .umb-group-builder__group-add-property { - - width: calc(100% - 315px); - margin-left: 270px; + width: 100%; min-height: 46px; - border-radius: 3px; - + border-radius: @baseBorderRadius; display: flex; justify-content: center; align-items: center; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group-placeholder.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group-placeholder.html new file mode 100644 index 0000000000..aa6f450609 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group-placeholder.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html new file mode 100644 index 0000000000..acf46e54e0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-group.html @@ -0,0 +1,67 @@ +
+ +
+ + +
+ + + +
+
{{groupNameForm.groupName.errorMsg}}
+
+
+
+
+ +
+ + : {{ vm.group.inheritedFromName }} + + + , + +
+ + +
+ + + +
+
+
+
+
+
+ +
+ + + +
+ +
+ + + +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-groups.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-groups.html new file mode 100644 index 0000000000..0b73daa4bb --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-groups.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property-placeholder.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property-placeholder.html new file mode 100644 index 0000000000..9a86923af0 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property-placeholder.html @@ -0,0 +1,11 @@ +
+ +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html new file mode 100644 index 0000000000..34735bfc64 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/components/contenttype/umb-content-type-property.html @@ -0,0 +1,155 @@ +
+ + +
+ + +
+ +
{{ vm.property.alias }}
+ + + +
+ + +
+
{{propertyTypeForm.groupName.errorMsg}}
+
+
+ +
+ +
+ +
+
+
+ +
+ + {{ vm.property.label }} + ({{ vm.property.alias }}) + +
+ +
+ + +
+ +
+ + + {{vm.property.dataTypeName}} + + + +
+ * + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ + + {{vm.property.contentTypeName}} +
+ +
+ + +
+ +
+ + + + + + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+ +
+ +
+ +
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html index 2fdef77928..15b5ec1fd9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-groups-builder.html @@ -4,6 +4,11 @@ +
+
Use Tabs
+ +
+ -
    + +
    +
      +
    • +
      +
      +
      + : {{ tab.inheritedFromName }} + + + , + +
      +
      {{ tab.name }}
      + +
      +
      + + + +
      +
      + +
    • +
    + + +
      +
    • + + + + + +
    • +
    +
    + + + + +
      +
    • + + +
    • +
    • + + +
    • +
    +
    +
    + + + +
    + + +
    • - + - +
      @@ -289,8 +392,6 @@
      -
      -