Skip to content

Commit

Permalink
Hide Text Attribute for components that doesn't contain text
Browse files Browse the repository at this point in the history
[Issue] Samsung#265
[Problem] All attributes have beem shown regardless of the selected
component
[Solution] Components that have textEditable property are granted access
to Text attribute

Signed-off-by: Hubert Siwkin <h.siwkin@samsung.com>
  • Loading branch information
Hubert Siwkin authored and hsiwkin committed Sep 3, 2019
1 parent 1aff2cd commit e74970c
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 20 deletions.
1 change: 1 addition & 0 deletions closet-component-packages/components/image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "img.ui-picture",
"attachable": true,
"type": "standalone-component",
"textEditable": false,
"displayOrderWeight": 200,
"template": "<img class=\"ui-picture\" src=\"#\" alt=\"\" style=\"height: 100px; width: 100px; display:block; background:#cacaca\">",
"resizable": true,
Expand Down
1 change: 1 addition & 0 deletions closet-component-packages/components/page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"js": "./page.js",
"css": "./page.css"
},
"textEditable": false,
"attributes": {},
"behaviors": {
"events": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"baseElementSelector": "input[type=number]",
"attachable": true,
"displayOrderWeight": 800,
"textEditable": false,
"type": "standalone-component",
"resources": {
"css": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"baseElementSelector": "input[type=password]",
"attachable": true,
"displayOrderWeight": 1000,
"textEditable": true,
"type": "standalone-component",
"resources": {
"css": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"attachable": true,
"displayOrderWeight": 900,
"type": "standalone-component",
"textEditable": true,
"resources": {
"css": [
"./styles/input-text.css"
Expand Down
1 change: 1 addition & 0 deletions contents/src/components/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"js": "button.js",
"css": "button.css"
},
"textEditable": true,
"attributes": {
"button-text": {
"label": "Text",
Expand Down
1 change: 1 addition & 0 deletions contents/src/components/image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "img.ui-picture",
"attachable": true,
"type": "standalone-component",
"textEditable": false,
"displayOrderWeight": 200,
"template": "<img class=\"ui-picture\" src=\"#\" alt=\"\" style=\"height: 100px; width: 100px; display:block; background:#cacaca\">",
"resizable": true,
Expand Down
1 change: 1 addition & 0 deletions contents/src/components/tau-circle-progress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"attachable": false,
"type": "standalone-component",
"altSelector": true,
"textEditable": false,
"resources": {
"js": "tau-circle-progress.js",
"css": "./tau-circle-progress.css",
Expand Down
25 changes: 18 additions & 7 deletions design-editor/src/panel/property/attribute/attribute-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,43 +196,54 @@ class Attribute extends DressElement {
.getElement(_selectedElementId);
iframeElement = designEditor._getElementById(_selectedElementId);
this._computedStyle = window.getComputedStyle(iframeElement[0]);
if (modelElement.component && modelElement.component.name === 'i3d') {

const { component } = modelElement;
if (component && component.name === 'i3d') {
$el.find('.closet-interactive-element').show();
interactiveElement.setData(modelElement);
} else {
$el.find('.closet-interactive-element').hide();
}

if (modelElement.component && modelElement.component.name === 'coverflow') {
if (component && component.name === 'coverflow') {
$el.find('.closet-coverflow-element').show();
} else {
$el.find('.closet-coverflow-element').hide();
}

if (modelElement.component && modelElement.component.name === 'closet-image') {
if (component && component.name === 'closet-image') {
$el.find('.closet-image-element').show();
self._imageElement.setData(iframeElement);
} else {
$el.find('.closet-image-element').hide();
}
if (modelElement.component && modelElement.component.name === 'checkbox') {

if (component && component.options.textEditable) {
$el.find('.closet-text-element').show();
} else {
$el.find('.closet-text-element').hide();
}

if (component && component.name === 'checkbox') {
$el.find('.closet-checkbox-element').show();
self._checkboxElement.setData(iframeElement, modelElement);
} else {
$el.find('.closet-checkbox-element').hide();
}
if (modelElement.component && !(['text', 'title'].includes(modelElement.component.name))) {

if (component && !(['text', 'title'].includes(component.name))) {
self.expand('closet-additional-attribute', self._expandable);
} else {
self.unexpand('closet-additional-attribute', self._expandable);
}
if (modelElement.component && modelElement.component.options.options) {

if (component && component.options.options) {
$el.find('.closet-property-widget-option').show();
} else {
$el.find('.closet-property-widget-option').hide();
}

attributes = modelElement.component && modelElement.component.getAttributes();
attributes = component && component.getAttributes();

if (attributes) {
attributes.forEach((attributeObject) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</div>
</div>
<ul class="closet-attribute-element-list closet-property-list closet-property-list-close"></ul>

<!-- smart things -->
<div class="panel-heading closet-property-list-title">
<div class="closet-property-header">
Expand All @@ -33,7 +33,7 @@
</div>
</div>
<ul class="closet-attribute-element-smartthings closet-property-list closet-property-list-close"></ul>

<!-- box model -->
<div class="panel-heading closet-property-list-title">
<div class="closet-property-header">
Expand Down Expand Up @@ -78,16 +78,18 @@
</div>
<ul class="closet-attribute-flex-list closet-property-list closet-property-list-close"></ul>

<!-- text -->
<div class="panel-heading closet-property-list-title">
<div class="closet-property-header">
<div class="closet-property-anchor">
<span class="fa fa-caret-right closet-property-list-title-icon"></span>
<span class="title">Text</span>
</div>
</div>
</div>
<ul class="closet-text-element-list closet-property-list closet-property-list-close"></ul>
<!-- text -->
<div class="panel-draggable closet-text-element">
<div class="panel-heading closet-property-list-title">
<div class="closet-property-header">
<div class="closet-property-anchor">
<span class="fa fa-caret-right closet-property-list-title-icon"></span>
<span class="title">Text</span>
</div>
</div>
</div>
<ul class="closet-text-element-list closet-property-list closet-property-list-close"></ul>
</div>

<!-- image -->
<div class="panel-draggable closet-image-element">
Expand Down
1 change: 1 addition & 0 deletions tau-component-packages/components/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"options": {}
}
},
"textEditable": true,
"resources": {
"css": [
"../../tau/theme/tau.min.css",
Expand Down
1 change: 1 addition & 0 deletions tau-component-packages/components/checkbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": ":not(.ui-toggleswitch) > input[type=checkbox]:not(.ui-slider-switch-input):not([data-role=toggleswitch]):not(.ui-toggleswitch), input[type=checkbox]:not(.ui-toggleswitch)",
"attachable": true,
"type": "standalone-component",
"textEditable": false,
"displayOrderWeight": 400,
"resources": {
"css": [
Expand Down
1 change: 1 addition & 0 deletions tau-component-packages/components/progress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"attachable": true,
"type": "standalone-component",
"displayOrderWeight": 1500,
"textEditable": false,
"resources": {
"css": [
"../../tau/theme/tau.min.css",
Expand Down
1 change: 1 addition & 0 deletions tau-component-packages/components/radio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"selector": "input[type=radio]",
"attachable": true,
"type": "standalone-component",
"textEditable": false,
"displayOrderWeight": 500,
"resources": {
"css": [
Expand Down
1 change: 1 addition & 0 deletions tau-component-packages/components/slider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"attachable": true,
"type": "standalone-component",
"displayOrderWeight": 700,
"textEditable": false,
"resources": {
"css": [
"../../tau/theme/tau.min.css",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"baseElementSelector": "input.ui-toggle-switch",
"attachable": true,
"type": "standalone-component",
"textEditable": false,
"displayOrderWeight": 600,
"resources": {
"css": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"js": "button.js",
"css": "button.css"
},
"textEditable": true,
"attributes": {
"button-text": {
"label": "Text",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"selector": "img.ui-picture",
"attachable": true,
"type": "standalone-component",
"textEditable": false,
"displayOrderWeight": 200,
"template": "<img class=\"ui-picture\" src=\"\" alt=\"\" style=\"height: 100px;\">",
"template": "<img class=\"ui-picture\" src=\"#\" alt=\"\" style=\"height: 100px; width: 100px; display:block; background:#cacaca\">",
"resizable": true,
"draggable": true,
"resources": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"attachable": false,
"type": "standalone-component",
"altSelector": true,
"textEditable": false,
"resources": {
"js": "tau-circle-progress.js",
"css": "./tau-circle-progress.css",
Expand Down

0 comments on commit e74970c

Please sign in to comment.