tao_ui 0.3.4 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tao_ui/components/tree/item_component.rb +20 -12
- data/lib/tao_ui/components/tree_component.rb +1 -1
- data/lib/tao_ui/engine.rb +0 -1
- data/lib/tao_ui/version.rb +1 -1
- data/lib/views/components/tao_ui/components/_dialog.html.erb +2 -2
- data/lib/views/components/tao_ui/components/_slide_box.html.erb +1 -1
- metadata +7 -157
- data/config/autoprefixer.yml +0 -7
- data/lib/assets/icons/Loading.svg +0 -19
- data/lib/assets/icons/close.svg +0 -12
- data/lib/assets/javascripts/tao/ui/dialog/confirm.coffee +0 -13
- data/lib/assets/javascripts/tao/ui/dialog/element.coffee +0 -115
- data/lib/assets/javascripts/tao/ui/dialog/index.coffee +0 -16
- data/lib/assets/javascripts/tao/ui/dialog/message.coffee +0 -13
- data/lib/assets/javascripts/tao/ui/icons/base.coffee +0 -5
- data/lib/assets/javascripts/tao/ui/icons/index.coffee +0 -20
- data/lib/assets/javascripts/tao/ui/index.coffee +0 -12
- data/lib/assets/javascripts/tao/ui/mobile/index.coffee +0 -6
- data/lib/assets/javascripts/tao/ui/mobile/slide_box/element.coffee +0 -7
- data/lib/assets/javascripts/tao/ui/mobile/slide_box/index.coffee +0 -2
- data/lib/assets/javascripts/tao/ui/popover/confirm.coffee +0 -23
- data/lib/assets/javascripts/tao/ui/popover/create.coffee +0 -18
- data/lib/assets/javascripts/tao/ui/popover/direction.coffee +0 -76
- data/lib/assets/javascripts/tao/ui/popover/element.coffee +0 -198
- data/lib/assets/javascripts/tao/ui/popover/index.coffee +0 -16
- data/lib/assets/javascripts/tao/ui/popover/position.coffee +0 -80
- data/lib/assets/javascripts/tao/ui/shared/slide_box/element/base.coffee +0 -118
- data/lib/assets/javascripts/tao/ui/shared/slide_box/export.coffee +0 -11
- data/lib/assets/javascripts/tao/ui/shared/ujs.coffee +0 -51
- data/lib/assets/javascripts/tao/ui/slide_box/element.coffee +0 -9
- data/lib/assets/javascripts/tao/ui/slide_box/index.coffee +0 -2
- data/lib/assets/javascripts/tao/ui/sortable.coffee +0 -147
- data/lib/assets/javascripts/tao/ui/table/element.coffee +0 -13
- data/lib/assets/javascripts/tao/ui/table/expandable.coffee +0 -62
- data/lib/assets/javascripts/tao/ui/table/index.coffee +0 -6
- data/lib/assets/javascripts/tao/ui/table/selectable.coffee +0 -52
- data/lib/assets/javascripts/tao/ui/tooltip.coffee +0 -5
- data/lib/assets/javascripts/tao/ui/tree/element.coffee +0 -58
- data/lib/assets/javascripts/tao/ui/tree/index.coffee +0 -5
- data/lib/assets/javascripts/tao/ui/tree/item.coffee +0 -93
- data/lib/assets/stylesheets/tao/ui/_custom.scss +0 -1
- data/lib/assets/stylesheets/tao/ui/_globals.scss +0 -3
- data/lib/assets/stylesheets/tao/ui/_mixins.scss +0 -2
- data/lib/assets/stylesheets/tao/ui/_variables.scss +0 -4
- data/lib/assets/stylesheets/tao/ui/basic.scss +0 -30
- data/lib/assets/stylesheets/tao/ui/buttons.scss +0 -8
- data/lib/assets/stylesheets/tao/ui/code.scss +0 -2
- data/lib/assets/stylesheets/tao/ui/dialog.scss +0 -117
- data/lib/assets/stylesheets/tao/ui/icons.scss +0 -2
- data/lib/assets/stylesheets/tao/ui/index.scss +0 -13
- data/lib/assets/stylesheets/tao/ui/mobile/_custom.scss +0 -1
- data/lib/assets/stylesheets/tao/ui/mobile/_globals.scss +0 -3
- data/lib/assets/stylesheets/tao/ui/mobile/_mixins.scss +0 -2
- data/lib/assets/stylesheets/tao/ui/mobile/_variables.scss +0 -3
- data/lib/assets/stylesheets/tao/ui/mobile/basic.scss +0 -24
- data/lib/assets/stylesheets/tao/ui/mobile/buttons.scss +0 -8
- data/lib/assets/stylesheets/tao/ui/mobile/code.scss +0 -2
- data/lib/assets/stylesheets/tao/ui/mobile/icons.scss +0 -2
- data/lib/assets/stylesheets/tao/ui/mobile/index.scss +0 -7
- data/lib/assets/stylesheets/tao/ui/mobile/slide_box.scss +0 -56
- data/lib/assets/stylesheets/tao/ui/mobile/tables.scss +0 -2
- data/lib/assets/stylesheets/tao/ui/mobile/variables/_base.scss +0 -10
- data/lib/assets/stylesheets/tao/ui/mobile/variables/_buttons.scss +0 -7
- data/lib/assets/stylesheets/tao/ui/popover.scss +0 -206
- data/lib/assets/stylesheets/tao/ui/shared/_basic.scss +0 -127
- data/lib/assets/stylesheets/tao/ui/shared/_buttons.scss +0 -65
- data/lib/assets/stylesheets/tao/ui/shared/_code.scss +0 -54
- data/lib/assets/stylesheets/tao/ui/shared/_icons.scss +0 -16
- data/lib/assets/stylesheets/tao/ui/shared/_slide_box.scss +0 -83
- data/lib/assets/stylesheets/tao/ui/shared/_tables.scss +0 -38
- data/lib/assets/stylesheets/tao/ui/shared/mixins/_base.scss +0 -6
- data/lib/assets/stylesheets/tao/ui/shared/mixins/_buttons.scss +0 -40
- data/lib/assets/stylesheets/tao/ui/shared/variables/_base.scss +0 -49
- data/lib/assets/stylesheets/tao/ui/shared/variables/_buttons.scss +0 -99
- data/lib/assets/stylesheets/tao/ui/shared/variables/_tables.scss +0 -4
- data/lib/assets/stylesheets/tao/ui/slide_box.scss +0 -39
- data/lib/assets/stylesheets/tao/ui/sortable.scss +0 -16
- data/lib/assets/stylesheets/tao/ui/tables.scss +0 -89
- data/lib/assets/stylesheets/tao/ui/tabs.scss +0 -23
- data/lib/assets/stylesheets/tao/ui/tooltip.scss +0 -147
- data/lib/assets/stylesheets/tao/ui/tree.scss +0 -128
- data/lib/assets/stylesheets/tao/ui/variables/_base.scss +0 -10
- data/lib/assets/stylesheets/tao/ui/variables/_tree.scss +0 -2
- data/lib/generators/tao/icons/USAGE +0 -8
- data/lib/generators/tao/icons/icons_generator.rb +0 -56
- data/lib/generators/tao/icons/templates/icons.coffee.erb +0 -3
- data/vendor/assets/stylesheets/normalize.css +0 -427
@@ -1,147 +0,0 @@
|
|
1
|
-
class Tao.Sortable extends TaoComponent
|
2
|
-
|
3
|
-
@tag 'tao-sortable'
|
4
|
-
|
5
|
-
@attribute 'groupSelector'
|
6
|
-
|
7
|
-
@attribute 'itemSelector', default: '[draggable="true"]'
|
8
|
-
|
9
|
-
@attribute 'axis', default: 'y'
|
10
|
-
|
11
|
-
_connected: ->
|
12
|
-
@on 'dragstart', @itemSelector, (e) =>
|
13
|
-
e.stopPropagation()
|
14
|
-
$item = $ e.currentTarget
|
15
|
-
itemRect = $item.get(0).getBoundingClientRect()
|
16
|
-
@_startDragging $item
|
17
|
-
|
18
|
-
e.originalEvent.dataTransfer.effectAllowed = 'move'
|
19
|
-
e.originalEvent.dataTransfer.setData 'text/plain', 'tao-sortable'
|
20
|
-
e.originalEvent.dataTransfer.setDragImage(
|
21
|
-
@_sortingItem.get(0),
|
22
|
-
e.clientX - itemRect.left,
|
23
|
-
e.clientY - itemRect.top
|
24
|
-
)
|
25
|
-
null
|
26
|
-
|
27
|
-
_disconnected: ->
|
28
|
-
@off()
|
29
|
-
$(document).off ".tao-sortable-#{@taoId}"
|
30
|
-
|
31
|
-
_startDragging: ($item) ->
|
32
|
-
@namespacedTrigger 'beforeSortStart', [$item]
|
33
|
-
@_sortingItem = $item
|
34
|
-
setTimeout -> $item.addClass('tao-sortable-sorting')
|
35
|
-
@namespacedTrigger 'sortStart', [@_sortingItem]
|
36
|
-
|
37
|
-
$(window).on "scroll.tao-sortable-#{@taoId}", _.throttle (e) =>
|
38
|
-
@_expireDimensionCache()
|
39
|
-
null
|
40
|
-
, 100
|
41
|
-
|
42
|
-
$(document).on "dragover.tao-sortable-#{@taoId}", _.throttle (e) =>
|
43
|
-
e.preventDefault()
|
44
|
-
@_performDragging x: e.clientX, y: e.clientY
|
45
|
-
e.originalEvent.dataTransfer.dropEffect = 'move'
|
46
|
-
null
|
47
|
-
, 100
|
48
|
-
|
49
|
-
$(document).on "dragend.tao-sortable-#{@taoId}", (e) =>
|
50
|
-
e.preventDefault()
|
51
|
-
@_stopDragging()
|
52
|
-
$(document).off ".tao-sortable-#{@taoId}"
|
53
|
-
$(window).off ".tao-sortable-#{@taoId}"
|
54
|
-
null
|
55
|
-
|
56
|
-
_performDragging: (mousePosition) ->
|
57
|
-
return unless @_sortingItem
|
58
|
-
item = @_findNearestItem mousePosition
|
59
|
-
return unless item && item.el.get(0) != @_sortingItem.get(0)
|
60
|
-
|
61
|
-
@_moveItem item, mousePosition
|
62
|
-
@_expireDimensionCache()
|
63
|
-
|
64
|
-
_stopDragging: ->
|
65
|
-
@_sortingItem.removeClass('tao-sortable-sorting')
|
66
|
-
@namespacedTrigger 'sortEnd', [@_sortingItem]
|
67
|
-
@_sortingItem = null
|
68
|
-
|
69
|
-
_findNearestItem: (mousePosition, dimensions = @_itemDimensions()) ->
|
70
|
-
minDistance = null
|
71
|
-
nearestItem = null
|
72
|
-
|
73
|
-
dimensions.forEach (item) =>
|
74
|
-
distance = @_getDistanceFromItem item, mousePosition
|
75
|
-
if _.isNil(minDistance) || minDistance > distance
|
76
|
-
minDistance = distance
|
77
|
-
nearestItem = item
|
78
|
-
|
79
|
-
if nearestItem.type == 'group' && nearestItem.items &&
|
80
|
-
nearestItem.items.length > 0
|
81
|
-
nearestItem = @_findNearestItem mousePosition, nearestItem.items
|
82
|
-
|
83
|
-
nearestItem
|
84
|
-
|
85
|
-
_moveItem: (item, mousePosition) ->
|
86
|
-
if item.type == 'group'
|
87
|
-
return if @triggerHandler('tao:sorting', [@_sortingItem, item]) == false
|
88
|
-
item.el.append @_sortingItem
|
89
|
-
else
|
90
|
-
method = if (@axis == 'y' && mousePosition.y > item.center.y) ||
|
91
|
-
(@axis == 'x' && mousePosition.x > item.center.x)
|
92
|
-
'after'
|
93
|
-
else
|
94
|
-
'before'
|
95
|
-
return if @triggerHandler('tao:sorting', [@_sortingItem, item, method]) == false
|
96
|
-
item.el[method] @_sortingItem
|
97
|
-
|
98
|
-
_itemDimensions: ->
|
99
|
-
@_dimentions ||= do =>
|
100
|
-
if @groupSelector
|
101
|
-
@jq.find(@groupSelector).map (i, groupEl) =>
|
102
|
-
@_getGroupDimension groupEl
|
103
|
-
.get()
|
104
|
-
else
|
105
|
-
@jq.find(@itemSelector).map (i, itemEl) =>
|
106
|
-
@_getItemDimension itemEl
|
107
|
-
.get()
|
108
|
-
|
109
|
-
_getGroupDimension: (groupEl) ->
|
110
|
-
$group = $ groupEl
|
111
|
-
dimension = $group.get(0).getBoundingClientRect()
|
112
|
-
|
113
|
-
type: 'group'
|
114
|
-
el: $group
|
115
|
-
dimension: dimension
|
116
|
-
center: @_getCenterPointOfDimension(dimension)
|
117
|
-
items: $group.find(@itemSelector).map (i, itemEl) =>
|
118
|
-
@_getItemDimension itemEl
|
119
|
-
.get()
|
120
|
-
|
121
|
-
_getItemDimension: (itemEl) ->
|
122
|
-
$item = $ itemEl
|
123
|
-
dimension = $item.get(0).getBoundingClientRect()
|
124
|
-
|
125
|
-
type: 'item'
|
126
|
-
el: $item
|
127
|
-
dimension: dimension
|
128
|
-
center: @_getCenterPointOfDimension(dimension)
|
129
|
-
|
130
|
-
_getCenterPointOfDimension: (dimension) ->
|
131
|
-
x: dimension.left + (dimension.width / 2)
|
132
|
-
y: dimension.top + (dimension.height / 2)
|
133
|
-
|
134
|
-
_getDistanceFromItem: (item, position) ->
|
135
|
-
rect = item.dimension
|
136
|
-
if position.x >= rect.left && position.x <= rect.right &&
|
137
|
-
position.y >= rect.top && position.y <= rect.bottom
|
138
|
-
0
|
139
|
-
else
|
140
|
-
deltaX = Math.min(Math.abs(position.x - rect.left), Math.abs(position.x - rect.right))
|
141
|
-
deltaY = Math.min(Math.abs(position.y - rect.top), Math.abs(position.y - rect.bottom))
|
142
|
-
Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2))
|
143
|
-
|
144
|
-
_expireDimensionCache: ->
|
145
|
-
@_dimentions = null
|
146
|
-
|
147
|
-
TaoComponent.register Tao.Sortable
|
@@ -1,62 +0,0 @@
|
|
1
|
-
Tao.Table.Expandable = ->
|
2
|
-
|
3
|
-
@attribute 'expandable', type: 'boolean'
|
4
|
-
|
5
|
-
_initExpandable: ->
|
6
|
-
@on 'click', 'tbody > tr.expandable', (e) =>
|
7
|
-
return if !@expandable || $(e.target).is('a, input')
|
8
|
-
$row = $ e.currentTarget
|
9
|
-
if $row.hasClass 'expanded'
|
10
|
-
@collapseRow $row
|
11
|
-
@namespacedTrigger 'expandRow', $row
|
12
|
-
else
|
13
|
-
@expandRow $row
|
14
|
-
@namespacedTrigger 'collapseRow', $row
|
15
|
-
null
|
16
|
-
|
17
|
-
expandRow: (row) ->
|
18
|
-
$row = $ row
|
19
|
-
return @ if $row.is('.disabled, .hidden, .expanded, .expanding')
|
20
|
-
|
21
|
-
$panel = $row.next('.expandable-panel')
|
22
|
-
return @ unless $panel.length > 0
|
23
|
-
$panelWrapper = $panel.find('> td > div:first')
|
24
|
-
|
25
|
-
$panel.show()
|
26
|
-
$panel[0].offsetHeight # force reflow
|
27
|
-
$panelWrapper.one 'transitionend', (e) ->
|
28
|
-
$row.removeClass 'expanding'
|
29
|
-
|
30
|
-
$row.addClass 'expanded expanding'
|
31
|
-
$panel.addClass 'expanded'
|
32
|
-
$panelWrapper.css 'height', $panelWrapper[0].scrollHeight
|
33
|
-
@_loadRemotePanel $panelWrapper
|
34
|
-
@
|
35
|
-
|
36
|
-
collapseRow: (row) ->
|
37
|
-
$row = $ row
|
38
|
-
return @ if $row.is('.disabled, .hidden, :not(.expanded), .collapsing')
|
39
|
-
|
40
|
-
$panel = $row.next('.expandable-panel')
|
41
|
-
return @ unless $panel.length > 0
|
42
|
-
$panelWrapper = $panel.find('> td > div:first')
|
43
|
-
|
44
|
-
$panelWrapper.one 'transitionend', (e) ->
|
45
|
-
$row.removeClass 'collapsing'
|
46
|
-
$panel.hide()
|
47
|
-
|
48
|
-
$row.removeClass 'expanded'
|
49
|
-
.addClass 'collapsing'
|
50
|
-
$panel.removeClass 'expanded'
|
51
|
-
$panelWrapper.css 'height', 0
|
52
|
-
@
|
53
|
-
|
54
|
-
_loadRemotePanel: ($panelWrapper) ->
|
55
|
-
return unless $panelWrapper.is('[data-url]')
|
56
|
-
$.ajax
|
57
|
-
url: $panelWrapper.data('url')
|
58
|
-
method: 'get'
|
59
|
-
dataType: 'script'
|
60
|
-
.done ->
|
61
|
-
$panelWrapper.removeAttr 'data-url'
|
62
|
-
$panelWrapper.css 'height', $panelWrapper[0].scrollHeight
|
@@ -1,52 +0,0 @@
|
|
1
|
-
Tao.Table.Selectable = ->
|
2
|
-
|
3
|
-
@attribute 'selectable', type: 'boolean'
|
4
|
-
|
5
|
-
@get 'selectedRows', ->
|
6
|
-
@jq.find('tbody > tr.selected')
|
7
|
-
|
8
|
-
_initSelectable: ->
|
9
|
-
@on 'tao:change', '.td-checkbox tao-check-box', (e) =>
|
10
|
-
cb = e.currentTarget
|
11
|
-
$row = cb.jq.closest('tr')
|
12
|
-
@toggleSelectRow $row, cb.checked
|
13
|
-
@namespacedTrigger 'selectedChange', [@selectedRows]
|
14
|
-
|
15
|
-
@on 'tao:change', '.th-checkbox tao-check-box', (e) =>
|
16
|
-
cb = e.currentTarget
|
17
|
-
if cb.checked
|
18
|
-
@selectAllRows()
|
19
|
-
else
|
20
|
-
@unselectAllRows()
|
21
|
-
@namespacedTrigger 'selectedChange', [@selectedRows]
|
22
|
-
|
23
|
-
toggleSelectRow: (row, selected) ->
|
24
|
-
return @ unless @selectable
|
25
|
-
|
26
|
-
$row = $ row
|
27
|
-
currentSelected = $row.hasClass('selected')
|
28
|
-
selected = !currentSelected if _.isNil selected
|
29
|
-
if $row.is('.disabled, .hidden, .expandable-panel')\
|
30
|
-
|| selected == currentSelected
|
31
|
-
return @
|
32
|
-
|
33
|
-
$row.toggleClass 'selected', selected
|
34
|
-
cb = $row.find('.td-checkbox tao-check-box').get(0)
|
35
|
-
cb.checked = selected if cb.checked != selected
|
36
|
-
@
|
37
|
-
|
38
|
-
selectRow: (row) ->
|
39
|
-
@toggleSelectRow row, true
|
40
|
-
|
41
|
-
unselectRow: (row) ->
|
42
|
-
@toggleSelectRow row, false
|
43
|
-
|
44
|
-
selectAllRows: ->
|
45
|
-
return @ unless @selectable
|
46
|
-
@jq.find('tbody > tr').each (i, row) => @selectRow(row)
|
47
|
-
@
|
48
|
-
|
49
|
-
unselectAllRows: ->
|
50
|
-
return @ unless @selectable
|
51
|
-
@jq.find('tbody > tr').each (i, row) => @unselectRow(row)
|
52
|
-
@
|
@@ -1,58 +0,0 @@
|
|
1
|
-
class Tao.Tree.Element extends TaoComponent
|
2
|
-
|
3
|
-
@tag 'tao-tree'
|
4
|
-
|
5
|
-
@attribute 'selectable', 'associatedSelect', type: 'boolean'
|
6
|
-
|
7
|
-
@get 'selectedItems', ->
|
8
|
-
if @associatedSelect
|
9
|
-
@_getAssociatedSelectedItems()
|
10
|
-
else
|
11
|
-
@jq.find('.tao-tree-item[selected]').get()
|
12
|
-
|
13
|
-
_connected: ->
|
14
|
-
@_bind()
|
15
|
-
|
16
|
-
_disconnected: ->
|
17
|
-
@off()
|
18
|
-
|
19
|
-
_bind: ->
|
20
|
-
@on 'tao-tree-item:selectedChange', '.tao-tree-item', (e) =>
|
21
|
-
item = e.currentTarget
|
22
|
-
return unless item == e.target
|
23
|
-
@_refreshAssociatedItems(item) if @associatedSelect
|
24
|
-
@namespacedTrigger 'selectedChange', [@selectedItems]
|
25
|
-
null
|
26
|
-
|
27
|
-
_refreshAssociatedItems: (item) ->
|
28
|
-
item.jq.find('.tao-tree-item').prop('selected', item.selected)
|
29
|
-
@_refreshAncestorItems(item)
|
30
|
-
|
31
|
-
_refreshAncestorItems: (item) ->
|
32
|
-
$parentItem = $(item).parent().closest('.tao-tree-item', @)
|
33
|
-
return unless $parentItem.length > 0
|
34
|
-
|
35
|
-
$items = $parentItem.find('> .tao-tree-list > .tao-tree-item')
|
36
|
-
if $items.filter('[selected], [indeterminate]').length == 0
|
37
|
-
$parentItem.prop 'selected', false
|
38
|
-
$parentItem.prop 'indeterminate', false
|
39
|
-
else if $items.filter(':not([selected])').length == 0
|
40
|
-
$parentItem.prop 'selected', true
|
41
|
-
$parentItem.prop 'indeterminate', false
|
42
|
-
else
|
43
|
-
$parentItem.prop 'selected', false
|
44
|
-
$parentItem.prop 'indeterminate', true
|
45
|
-
|
46
|
-
@_refreshAncestorItems $parentItem
|
47
|
-
|
48
|
-
_getAssociatedSelectedItems: ($list = @jq.find('> .tao-tree-list')) ->
|
49
|
-
selectedItems = []
|
50
|
-
$list.find('> .tao-tree-item').each (i, item) =>
|
51
|
-
if item.selected
|
52
|
-
selectedItems.push item
|
53
|
-
else if ($childList = item.jq.find('> .tao-tree-list')).length > 0
|
54
|
-
selectedItems = selectedItems.concat @_getAssociatedSelectedItems($childList)
|
55
|
-
selectedItems
|
56
|
-
|
57
|
-
|
58
|
-
TaoComponent.register Tao.Tree.Element
|
@@ -1,93 +0,0 @@
|
|
1
|
-
class Tao.Tree.Item extends TaoComponent
|
2
|
-
|
3
|
-
@tag 'tao-tree-item'
|
4
|
-
|
5
|
-
@attribute 'depth', type: 'number'
|
6
|
-
|
7
|
-
@attribute 'expandable', 'selectable', type: 'boolean'
|
8
|
-
|
9
|
-
@attribute 'expanded', 'selected', 'indeterminate', type: 'boolean', observe: true
|
10
|
-
|
11
|
-
@attribute 'remote', type: 'hash'
|
12
|
-
|
13
|
-
_connected: ->
|
14
|
-
@_initSelectable() if @selectable
|
15
|
-
@_initExpandable() if @expandable
|
16
|
-
|
17
|
-
_disconnected: ->
|
18
|
-
@off()
|
19
|
-
@checkbox?.off()
|
20
|
-
@checkbox = null
|
21
|
-
|
22
|
-
_initSelectable: ->
|
23
|
-
@checkbox = @findComponent '> .tao-tree-item-content tao-check-box', =>
|
24
|
-
@_selectedChanged() if @selected
|
25
|
-
|
26
|
-
@checkbox.on 'tao:change', (e) =>
|
27
|
-
@selected = e.currentTarget.checked
|
28
|
-
@namespacedTrigger 'selectedChange', [@selected]
|
29
|
-
null
|
30
|
-
|
31
|
-
_initExpandable: ->
|
32
|
-
@on 'click', '> .tao-tree-item-content > .link-toggle-item', (e) =>
|
33
|
-
return if @jq.hasClass('expanding')
|
34
|
-
@_toggleExpanded()
|
35
|
-
null
|
36
|
-
|
37
|
-
_beforeExpandedChanged: (expanded) ->
|
38
|
-
$list = @jq.find('> .tao-tree-list')
|
39
|
-
@jq.addClass 'expanding'
|
40
|
-
$list.css 'display', 'block'
|
41
|
-
$list.css 'height', if expanded then '0' else $list.get(0).scrollHeight
|
42
|
-
$list.one 'transitionend', => @_afterTransition()
|
43
|
-
@reflow()
|
44
|
-
null
|
45
|
-
|
46
|
-
_expandedChanged: ->
|
47
|
-
return unless @expandable
|
48
|
-
$list = @jq.find('> .tao-tree-list')
|
49
|
-
if @expanded
|
50
|
-
$list.css 'height', $list.get(0).scrollHeight
|
51
|
-
else
|
52
|
-
$list.css 'height', '0'
|
53
|
-
|
54
|
-
_selectedChanged: ->
|
55
|
-
return unless @selectable
|
56
|
-
@checkbox.checked = @selected
|
57
|
-
null
|
58
|
-
|
59
|
-
_indeterminateChanged: ->
|
60
|
-
return unless @selectable
|
61
|
-
@checkbox.indeterminate = @indeterminate
|
62
|
-
null
|
63
|
-
|
64
|
-
_afterTransition: ->
|
65
|
-
$list = @jq.find('> .tao-tree-list')
|
66
|
-
@jq.removeClass 'expanding'
|
67
|
-
if @expanded
|
68
|
-
$list.css 'height', 'auto'
|
69
|
-
if @remote && $list.find('> .tao-tree-loading').length > 0
|
70
|
-
@_requestList()
|
71
|
-
else
|
72
|
-
$list.hide()
|
73
|
-
|
74
|
-
_toggleExpanded: ->
|
75
|
-
@expanded = !@expanded
|
76
|
-
|
77
|
-
_requestList: ->
|
78
|
-
$.ajax
|
79
|
-
url: @remote.url
|
80
|
-
type: 'get'
|
81
|
-
data: _.extend {}, @remote.params,
|
82
|
-
tree_item_id: @taoId
|
83
|
-
depth: @depth
|
84
|
-
selectable: @selectable || undefined
|
85
|
-
selected: @selected || undefined
|
86
|
-
dataType: 'script'
|
87
|
-
|
88
|
-
updateList: ($newList) ->
|
89
|
-
@_afterTransition() if @jq.hasClass('expanding')
|
90
|
-
@jq.find('> .tao-tree-list').replaceWith($newList)
|
91
|
-
@namespacedTrigger 'listUpdate', [$newList]
|
92
|
-
|
93
|
-
TaoComponent.register Tao.Tree.Item
|
@@ -1 +0,0 @@
|
|
1
|
-
// override this file in project
|
@@ -1,30 +0,0 @@
|
|
1
|
-
@import 'tao/ui/globals';
|
2
|
-
@import 'tao/ui/shared/basic';
|
3
|
-
|
4
|
-
a {
|
5
|
-
&:hover {
|
6
|
-
color: $link-hover-color;
|
7
|
-
fill: $link-hover-color;
|
8
|
-
}
|
9
|
-
|
10
|
-
&.warn:hover {
|
11
|
-
color: lighten($red-color, 10%);
|
12
|
-
fill: lighten($red-color, 10%);
|
13
|
-
}
|
14
|
-
|
15
|
-
&.disabled:hover {
|
16
|
-
color: $lightest-grey-color;
|
17
|
-
fill: $lightest-grey-color;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
a:not([href]):not([tabindex]) {
|
22
|
-
&:hover {
|
23
|
-
color: inherit;
|
24
|
-
fill: inherit;
|
25
|
-
}
|
26
|
-
|
27
|
-
&:focus {
|
28
|
-
outline: 0;
|
29
|
-
}
|
30
|
-
}
|
@@ -1,117 +0,0 @@
|
|
1
|
-
@import 'tao/ui/globals';
|
2
|
-
|
3
|
-
.tao-dialog-active {
|
4
|
-
overflow: hidden;
|
5
|
-
}
|
6
|
-
|
7
|
-
.tao-dialog {
|
8
|
-
position: fixed;
|
9
|
-
top: 0;
|
10
|
-
right: 0;
|
11
|
-
bottom: 0;
|
12
|
-
left: 0;
|
13
|
-
z-index: $z-index-dialog;
|
14
|
-
display: none;
|
15
|
-
overflow: hidden;
|
16
|
-
|
17
|
-
&[modal] {
|
18
|
-
background-color: rgba(0, 0, 0, 0);
|
19
|
-
transition: background-color 300ms;
|
20
|
-
}
|
21
|
-
|
22
|
-
&[modal][active] {
|
23
|
-
background-color: rgba(0, 0, 0, 0.55);
|
24
|
-
}
|
25
|
-
|
26
|
-
&[active] .tao-dialog-wrapper {
|
27
|
-
transform: translate(0, 0);
|
28
|
-
opacity: 1;
|
29
|
-
}
|
30
|
-
|
31
|
-
.tao-dialog-wrapper {
|
32
|
-
position: relative;
|
33
|
-
width: 37.5rem;
|
34
|
-
min-height: 1em;
|
35
|
-
margin: 0 auto;
|
36
|
-
border-radius: 0 0 $border-radius-s $border-radius-s;
|
37
|
-
background-color: $white-color;
|
38
|
-
box-shadow: 0 0 4px 4px rgba(0,0,0,0.1);
|
39
|
-
transform: translate(0, -30%);
|
40
|
-
transition: transform 300ms, opacity 300ms;
|
41
|
-
opacity: 0;
|
42
|
-
|
43
|
-
.tao-dialog-content {
|
44
|
-
padding: 1rem 2rem;
|
45
|
-
|
46
|
-
h3:first-child,
|
47
|
-
.title:first-child {
|
48
|
-
margin-bottom: 2rem;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
.tao-dialog-buttons,
|
53
|
-
.tao-dialog-content .buttons,
|
54
|
-
.tao-dialog-content .form-buttons {
|
55
|
-
margin-left: 0;
|
56
|
-
margin-bottom: 1rem;
|
57
|
-
display: flex;
|
58
|
-
justify-content: center;
|
59
|
-
align-items: center;
|
60
|
-
|
61
|
-
.button, a {
|
62
|
-
margin: 0 0.75rem;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
.tao-dialog-buttons {
|
67
|
-
margin: 1.5rem 0 0 0;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
&.tao-confirm-dialog,
|
72
|
-
&.tao-message-dialog {
|
73
|
-
.tao-dialog-wrapper {
|
74
|
-
width: 32.5rem;
|
75
|
-
padding: 1.5rem 2rem;
|
76
|
-
|
77
|
-
.tao-dialog-content {
|
78
|
-
padding: 0;
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
&[size='l'] .tao-dialog-wrapper {
|
84
|
-
width: 53.75rem;
|
85
|
-
}
|
86
|
-
|
87
|
-
&[size='xl'] .tao-dialog-wrapper {
|
88
|
-
width: 71.25rem;
|
89
|
-
}
|
90
|
-
|
91
|
-
.tao-dialog-wrapper > .link-close {
|
92
|
-
display: none;
|
93
|
-
align-items: center;
|
94
|
-
justify-content: center;
|
95
|
-
width: 2rem;
|
96
|
-
height: 2rem;
|
97
|
-
position: absolute;
|
98
|
-
top: 0.625rem;
|
99
|
-
right: 0.625rem;
|
100
|
-
text-decoration: none;
|
101
|
-
fill: $lighter-grey-color;
|
102
|
-
|
103
|
-
&:hover {
|
104
|
-
fill: $grey-color;
|
105
|
-
}
|
106
|
-
|
107
|
-
.icon {
|
108
|
-
width: 1.25rem;
|
109
|
-
height: 1.25rem;
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
&[with-close-button] .tao-dialog-wrapper > .link-close {
|
114
|
-
display: flex;
|
115
|
-
}
|
116
|
-
|
117
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
//= require normalize
|
2
|
-
//= require ./icons
|
3
|
-
//= require ./basic
|
4
|
-
//= require ./code
|
5
|
-
//= require ./buttons
|
6
|
-
//= require ./tables
|
7
|
-
//= require ./slide_box
|
8
|
-
//= require ./popover
|
9
|
-
//= require ./tooltip
|
10
|
-
//= require ./dialog
|
11
|
-
//= require ./sortable
|
12
|
-
//= require ./tree
|
13
|
-
//= require ./tabs
|
@@ -1 +0,0 @@
|
|
1
|
-
// override this file in project
|