aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/app/scripts/directives/property-types/type-list
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/app/scripts/directives/property-types/type-list')
-rw-r--r--catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.html57
-rw-r--r--catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.less85
-rw-r--r--catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.ts130
3 files changed, 0 insertions, 272 deletions
diff --git a/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.html b/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.html
deleted file mode 100644
index 410a24e62b..0000000000
--- a/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<div>
- <div data-ng-if="!isSchemaTypeDataType">
- <div class="i-sdc-form-item list-new-item" data-ng-class="{error:(parentFormObj['listNewItem'+fieldsPrefixName].$dirty && parentFormObj['listNewItem'+fieldsPrefixName].$invalid)}">
- <input class="i-sdc-form-input"
- data-tests-id="listNewItem{{fieldsPrefixName}}"
- ng-if="!((schemaProperty.simpleType||schemaProperty.type) == 'boolean')"
- data-ng-disabled="readOnly"
- data-ng-model="listNewItem.value"
- type="text"
- name="listNewItem{{fieldsPrefixName}}"
- data-ng-pattern="getValidationPattern((schemaProperty.simpleType||schemaProperty.type))"
- data-ng-model-options="{ debounce: 200 }"
- placeholder="Type a value and then click ADD"
- data-ng-maxlength="maxLength"
- maxlength="{{maxLength}}"
- sdc-keyboard-events="" key-enter="schemaProperty.type && !parentFormObj['listNewItem'+fieldsPrefixName].$invalid && listNewItem.value && addListItem"
- autofocus />
- <select class="i-sdc-form-select"
- data-tests-id="listNewItem{{fieldsPrefixName}}"
- ng-if="(schemaProperty.simpleType||schemaProperty.type) == 'boolean'"
- data-ng-disabled="readOnly"
- name="listNewItem{{fieldsPrefixName}}"
- data-ng-model="listNewItem.value">
- <option value="true">true</option>
- <option value="false">false</option>
- </select>
- <div class="input-error" data-ng-show="parentFormObj['listNewItem'+fieldsPrefixName].$dirty && parentFormObj['listNewItem'+fieldsPrefixName].$invalid">
- <span ng-show="parentFormObj['listNewItem'+fieldsPrefixName].$error.pattern" translate="PROPERTY_EDIT_PATTERN"></span>
- <span ng-show="parentFormObj['listNewItem'+fieldsPrefixName].$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '{{maxLength}}' }"></span>
- </div>
- </div>
- <div class="add-btn add-list-item" data-tests-id="add-list-item{{fieldsPrefixName}}"
- data-ng-class="{'disabled': readOnly || !schemaProperty.type || parentFormObj['listNewItem'+fieldsPrefixName].$invalid || !listNewItem.value}" data-ng-click="addListItem()">Add</div>
- <div class="list-value-items">
- <span class="list-value-item" data-ng-repeat="value in valueObjRef track by $index">
- {{value}}
- <span class="delete-list-item sprite-new small-x-button" data-ng-click="deleteListItem($index)"></span>
- </span>
- </div>
- </div>
- <div data-ng-if="isSchemaTypeDataType">
- <div class="dt-list">
- <div data-ng-repeat="value in valueObjRef track by $index" class="dt-list-item">
- <span class="delete-dt-list-item" data-ng-click="deleteListItem($index)"></span>
- <fields-structure value-obj-ref="valueObjRef[$index]"
- type-name="schemaProperty.type"
- parent-form-obj="parentFormObj"
- fields-prefix-name="fieldsPrefixName+''+$index"
- read-only="readOnly"
- types="types"></fields-structure>
- </div>
- <div class="add-btn add-list-item" data-tests-id="add-list-item"
- data-ng-class="{'disabled': readOnly}" data-ng-click="listNewItem.value='{}';addListItem();">Add</div>
- </div>
-
- </div>
-</div>
diff --git a/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.less b/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.less
deleted file mode 100644
index eb4214e135..0000000000
--- a/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.less
+++ /dev/null
@@ -1,85 +0,0 @@
-.list-new-item{
- float: left;
- width: 50%;
- min-width: 221px;
- margin-right: 15px;
- input{
- min-width: 221px;
- }
-}
-
-.list-value-items{
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px;
- border: 1px solid @main_color_o;
- padding-bottom: 10px;
- min-height: 100px;
- clear: both;
- background-color: white;
- .list-value-item{
- display: inline-block;
- background-color: @tlv_color_v;
- margin: 10px 0 0 10px;
- padding-left: 8px;
- .delete-list-item{
- margin: 0 6px 0 10px;
- .hand;
- }
- }
-}
-
-.add-btn {
- .f-color.a;
- .f-type._14_m;
- .hand;
-
- &.add-list-item {
- float: left;
- margin-top: 5px;
- width: 44px;
- }
-
- &:before {
- .sprite-new;
- .plus-icon;
- margin-right: 5px;
- content: "";
-
- }
- &:hover {
- .f-color.b;
- &:before {
- .sprite-new;
- .plus-icon-hover;
- }
- }
-
-}
-
-.dt-list{
- display: table-caption;
- .dt-list-item {
- border-radius: 3px;
- background-color: @tlv_color_v;
- display: inline-block;
- .delete-dt-list-item{
- float: right;
- position: relative;
- top: 5px;
- right: 5px;
- .sprite-new;
- .delete-icon;
- &:hover{
- .delete-icon-hover;
- }
- }
- .data-type-name{
- margin-right: 16px;
- }
- }
- &>.add-list-item{
- float:none;
- }
-}
-
diff --git a/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.ts b/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.ts
deleted file mode 100644
index ce5ee1ffa6..0000000000
--- a/catalog-ui/app/scripts/directives/property-types/type-list/type-list-directive.ts
+++ /dev/null
@@ -1,130 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-/**
- * Created by rcohen on 9/15/2016.
- */
-/// <reference path="../../../references"/>
-module Sdc.Directives {
- 'use strict';
- /// import Model = go.Model;
-
- export interface ITypeListScope extends ng.IScope {
- parentFormObj:ng.IFormController;
- schemaProperty:Models.SchemaProperty;
- isSchemaTypeDataType:boolean;
- valueObjRef:any;
- propertyNameValidationPattern: RegExp;
- fieldsPrefixName:string;
- readOnly:boolean;
- listDefaultValue:any;
- types:Models.DataTypesMap;
- listNewItem:any;
- maxLength:number;
-
- getValidationPattern(type:string):RegExp;
- validateIntRange(value:string):boolean;
- addListItem():void;
- deleteListItem(listItemIndex:number):void
- }
-
-
- export class TypeListDirective implements ng.IDirective {
-
- constructor(private $templateCache:ng.ITemplateCacheService,
- private DataTypesService:Sdc.Services.DataTypesService,
- private PropertyNameValidationPattern: RegExp,
- private ValidationUtils:Sdc.Utils.ValidationUtils) {
- }
-
- scope = {
- valueObjRef: '=',//ref to list object in the parent value object
- schemaProperty: '=',//get the schema.property object
- parentFormObj: '=',//ref to parent form (get angular form object)
- fieldsPrefixName: '=',//prefix for form fields names
- readOnly: '=',//is form read only
- defaultValue: '@',//this list default value
- types: '=',//data types list
- maxLength: '='
- };
-
- restrict = 'E';
- replace = true;
- template = ():string => {
- return this.$templateCache.get('/app/scripts/directives/property-types/type-list/type-list-directive.html');
- };
-
- link = (scope:ITypeListScope, element:any, $attr:any) => {
- scope.propertyNameValidationPattern = this.PropertyNameValidationPattern;
-
- //reset valueObjRef when schema type is changed
- scope.$watchCollection('schemaProperty.type', (newData:any):void => {
- scope.isSchemaTypeDataType = this.DataTypesService.isDataTypeForSchemaType(scope.schemaProperty,scope.types);
- //insert 1 empty item dt by default
- if(scope.isSchemaTypeDataType && (!scope.valueObjRef||!scope.valueObjRef.length)){
- scope.valueObjRef = scope.valueObjRef ||[];
- scope.valueObjRef.push({});
- }
- });
-
- //when user brows between properties in "edit property form"
- scope.$watchCollection('fieldsPrefixName', (newData:any):void => {
- scope.listNewItem={value:''};
-
- if($attr.defaultValue){
- scope.listDefaultValue = JSON.parse($attr.defaultValue);
- }
- });
-
- scope.getValidationPattern = (type:string):RegExp => {
- return this.ValidationUtils.getValidationPattern(type);
- };
-
- scope.validateIntRange = (value:string):boolean => {
- return !value || this.ValidationUtils.validateIntRange(value);
- };
-
- scope.addListItem = ():void => {
- scope.valueObjRef = scope.valueObjRef ||[];
- let newVal = ((scope.schemaProperty.simpleType||scope.schemaProperty.type)==Utils.Constants.PROPERTY_TYPES.STRING?scope.listNewItem.value:JSON.parse(scope.listNewItem.value));
- scope.valueObjRef.push(newVal);
- scope.listNewItem.value = "";
- };
-
- scope.deleteListItem = (listItemIndex:number):void => {
- scope.valueObjRef.splice(listItemIndex,1);
- if (!scope.valueObjRef.length) {
- if (scope.listDefaultValue ) {
- angular.copy(scope.listDefaultValue, scope.valueObjRef);
- }
- }
- };
- };
-
- public static factory = ($templateCache:ng.ITemplateCacheService,
- DataTypesService:Sdc.Services.DataTypesService,
- PropertyNameValidationPattern:RegExp,
- ValidationUtils:Sdc.Utils.ValidationUtils)=> {
- return new TypeListDirective($templateCache,DataTypesService,PropertyNameValidationPattern,ValidationUtils);
- };
- }
-
- TypeListDirective.factory.$inject = ['$templateCache','Sdc.Services.DataTypesService','PropertyNameValidationPattern','ValidationUtils'];
-}
-