aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives/property-types/type-list/type-list-directive.html
blob: 2363f57d804c5811963940e3bc56ade2ed073bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!--
  ~ Copyright (C) 2018 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.
  -->
 
 
<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 ng-if="!readOnly" 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"></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>