rails_design 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/README.md +18 -0
  4. data/Rakefile +18 -0
  5. data/app/assets/images/image-square.png +0 -0
  6. data/app/assets/images/logo.png +0 -0
  7. data/app/assets/javascripts/default_form/datetime.js +31 -0
  8. data/app/assets/javascripts/default_form/default_valid.js +101 -0
  9. data/app/assets/javascripts/default_form/field.js +33 -0
  10. data/app/assets/javascripts/default_form/index.js +9 -0
  11. data/app/assets/javascripts/default_form/valid_weui.js +17 -0
  12. data/app/assets/javascripts/rails_design/attachment.js +295 -0
  13. data/app/assets/javascripts/rails_design/cable.js +3 -0
  14. data/app/assets/javascripts/rails_design/dataset.js +39 -0
  15. data/app/assets/javascripts/rails_design/index.js +4 -0
  16. data/app/assets/javascripts/rails_design/stimulus.js +19 -0
  17. data/app/assets/javascripts/rails_design/turbo.js +35 -0
  18. data/app/assets/javascripts/stimulus_com/checkbox.js +77 -0
  19. data/app/assets/javascripts/stimulus_com/choice.js +18 -0
  20. data/app/assets/javascripts/stimulus_com/common.js +52 -0
  21. data/app/assets/javascripts/stimulus_com/count_down.js +27 -0
  22. data/app/assets/javascripts/stimulus_com/former.js +26 -0
  23. data/app/assets/javascripts/stimulus_com/hover.js +40 -0
  24. data/app/assets/javascripts/stimulus_com/index.js +58 -0
  25. data/app/assets/javascripts/stimulus_com/input.js +36 -0
  26. data/app/assets/javascripts/stimulus_com/menu.js +34 -0
  27. data/app/assets/javascripts/stimulus_com/modal.js +85 -0
  28. data/app/assets/javascripts/stimulus_com/modal_show.js +16 -0
  29. data/app/assets/javascripts/stimulus_com/navbar.js +11 -0
  30. data/app/assets/javascripts/stimulus_com/notice.js +10 -0
  31. data/app/assets/javascripts/stimulus_com/picture.js +85 -0
  32. data/app/assets/javascripts/stimulus_com/show.js +26 -0
  33. data/app/assets/javascripts/stimulus_com/showcase.js +34 -0
  34. data/app/assets/javascripts/stimulus_com/slide.js +188 -0
  35. data/app/assets/javascripts/stimulus_com/slide_y.js +189 -0
  36. data/app/assets/javascripts/stimulus_com/sortable.js +41 -0
  37. data/app/assets/javascripts/stimulus_com/sticky.js +11 -0
  38. data/app/assets/javascripts/stimulus_com/swipe.js +78 -0
  39. data/app/assets/javascripts/stimulus_com/taxon.js +45 -0
  40. data/app/assets/javascripts/stimulus_com/time.js +19 -0
  41. data/app/assets/javascripts/stimulus_com/touch.js +83 -0
  42. data/app/assets/javascripts/stimulus_com/tree.js +34 -0
  43. data/app/assets/javascripts/stimulus_com/tree_remote.js +64 -0
  44. data/app/assets/javascripts/stimulus_com/typer.js +41 -0
  45. data/app/assets/javascripts/stimulus_com/visit.js +61 -0
  46. data/app/assets/javascripts/stimulus_phone/index.js +19 -0
  47. data/app/assets/javascripts/stimulus_phone/qq_map.js +29 -0
  48. data/app/assets/javascripts/stimulus_phone/search.js +37 -0
  49. data/app/assets/javascripts/stimulus_phone/wechat.js +80 -0
  50. data/app/assets/javascripts/stimulus_phone/weui-actionsheet.js +43 -0
  51. data/app/assets/javascripts/stimulus_phone/weui-datepicker.js +38 -0
  52. data/app/assets/javascripts/stimulus_phone/weui-dialog.js +24 -0
  53. data/app/assets/javascripts/stimulus_phone/weui-picker.js +54 -0
  54. data/app/assets/javascripts/stimulus_phone/wxpay.js +29 -0
  55. data/app/assets/stylesheets/app.scss +3 -0
  56. data/app/assets/stylesheets/ext_bulma/base/_all.scss +5 -0
  57. data/app/assets/stylesheets/ext_bulma/base/_choices.scss +3 -0
  58. data/app/assets/stylesheets/ext_bulma/base/_global.scss +19 -0
  59. data/app/assets/stylesheets/ext_bulma/base/_main.scss +15 -0
  60. data/app/assets/stylesheets/ext_bulma/components/_all.scss +10 -0
  61. data/app/assets/stylesheets/ext_bulma/components/_box.scss +15 -0
  62. data/app/assets/stylesheets/ext_bulma/components/_breadcrumb.scss +17 -0
  63. data/app/assets/stylesheets/ext_bulma/components/_card.scss +12 -0
  64. data/app/assets/stylesheets/ext_bulma/components/_level.scss +8 -0
  65. data/app/assets/stylesheets/ext_bulma/components/_media.scss +14 -0
  66. data/app/assets/stylesheets/ext_bulma/components/_menu.scss +76 -0
  67. data/app/assets/stylesheets/ext_bulma/components/_pagination.scss +9 -0
  68. data/app/assets/stylesheets/ext_bulma/components/_panel.scss +5 -0
  69. data/app/assets/stylesheets/ext_bulma/elements/_all.scss +7 -0
  70. data/app/assets/stylesheets/ext_bulma/elements/_button.scss +14 -0
  71. data/app/assets/stylesheets/ext_bulma/elements/_fa.scss +4 -0
  72. data/app/assets/stylesheets/ext_bulma/elements/_image.scss +38 -0
  73. data/app/assets/stylesheets/ext_bulma/elements/_table.scss +52 -0
  74. data/app/assets/stylesheets/ext_bulma/elements/_title.scss +9 -0
  75. data/app/assets/stylesheets/ext_bulma/expand/_all.scss +2 -0
  76. data/app/assets/stylesheets/ext_bulma/expand/_slide.scss +26 -0
  77. data/app/assets/stylesheets/ext_bulma/expand/_sortable.scss +4 -0
  78. data/app/assets/stylesheets/ext_bulma/form/_all.scss +34 -0
  79. data/app/assets/stylesheets/ext_bulma/form/_checkbox.scss +267 -0
  80. data/app/assets/stylesheets/ext_bulma/form/_file.scss +23 -0
  81. data/app/assets/stylesheets/ext_bulma/form/_select.scss +5 -0
  82. data/app/assets/stylesheets/ext_bulma/form/_tools.scss +30 -0
  83. data/app/assets/stylesheets/ext_bulma/grid/_all.scss +3 -0
  84. data/app/assets/stylesheets/ext_bulma/grid/_columns.scss +13 -0
  85. data/app/assets/stylesheets/ext_bulma/helpers/_all.scss +5 -0
  86. data/app/assets/stylesheets/ext_bulma/helpers/_dot.scss +11 -0
  87. data/app/assets/stylesheets/ext_bulma/helpers/_drawable.scss +3 -0
  88. data/app/assets/stylesheets/ext_bulma/helpers/_grid.scss +10 -0
  89. data/app/assets/stylesheets/ext_bulma/index.scss +22 -0
  90. data/app/assets/stylesheets/ext_bulma/layout/_all.scss +4 -0
  91. data/app/assets/stylesheets/ext_bulma/layout/_footer.scss +4 -0
  92. data/app/assets/stylesheets/ext_bulma/layout/_level.scss +1 -0
  93. data/app/assets/stylesheets/ext_choices/index.scss +16 -0
  94. data/app/assets/stylesheets/ext_font/index.scss +4 -0
  95. data/app/assets/stylesheets/ext_weui/index.scss +24 -0
  96. data/app/assets/stylesheets/ext_weui/widget/_actionsheet.scss +3 -0
  97. data/app/assets/stylesheets/ext_weui/widget/_article.scss +7 -0
  98. data/app/assets/stylesheets/ext_weui/widget/_button.scss +7 -0
  99. data/app/assets/stylesheets/ext_weui/widget/_cell.scss +17 -0
  100. data/app/assets/stylesheets/ext_weui/widget/_form.scss +3 -0
  101. data/app/assets/stylesheets/ext_weui/widget/_half_screen_dialog.scss +10 -0
  102. data/app/assets/stylesheets/ext_weui/widget/_icon.scss +9 -0
  103. data/app/assets/stylesheets/ext_weui/widget/_media.scss +43 -0
  104. data/app/assets/stylesheets/ext_weui/widget/_panel.scss +4 -0
  105. data/app/assets/stylesheets/ext_weui/widget/_preview.scss +5 -0
  106. data/app/assets/stylesheets/ext_weui/widget/_search.scss +5 -0
  107. data/app/assets/stylesheets/ext_weui/widget/_tab.scss +10 -0
  108. data/app/assets/stylesheets/ext_weui/widget/_tabbar.scss +12 -0
  109. data/app/assets/stylesheets/ext_weui/widget/_uploader.scss +14 -0
  110. data/app/assets/stylesheets/phone.scss +6 -0
  111. data/app/assets/stylesheets/slide/index.scss +208 -0
  112. data/app/assets/stylesheets/ui_tooltip/_mixins.scss +46 -0
  113. data/app/assets/stylesheets/ui_tooltip/_variables.scss +5 -0
  114. data/app/assets/stylesheets/ui_tooltip/index.scss +278 -0
  115. data/app/controllers/design/base_controller.rb +4 -0
  116. data/app/controllers/design/home_controller.rb +13 -0
  117. data/app/views/design/home/swipe.html.erb +7 -0
  118. data/app/views/layouts/ui/base.html.erb +5 -0
  119. data/config/routes.rb +11 -0
  120. data/lib/rails_design/config.rb +8 -0
  121. data/lib/rails_design/engine.rb +5 -0
  122. data/lib/rails_design.rb +2 -0
  123. metadata +181 -0
@@ -0,0 +1,24 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+
3
+ export default class extends Controller {
4
+ static targets = ['dialog']
5
+
6
+ connect() {
7
+ console.debug('connected:', this.identifier)
8
+ }
9
+
10
+ close() {
11
+ let ele = this.element
12
+ ele.style.display = 'none'
13
+ ele.style.opacity = 0
14
+ ele.style.transition = 'opacity 2s'
15
+ this.dialogTarget.classList.remove('weui-half-screen-dialog_show')
16
+ }
17
+
18
+ show() {
19
+ let ele = this.element
20
+ ele.style.display = 'block'
21
+ ele.style.opacity = 1
22
+ }
23
+
24
+ }
@@ -0,0 +1,54 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+ import weui from 'weui.js'
3
+
4
+ export default class extends Controller {
5
+ static values = {
6
+ id: String,
7
+ url: String
8
+ }
9
+
10
+ connect() {
11
+ console.debug('connected:', this.identifier)
12
+ }
13
+
14
+ // focus->weui-picker#getData
15
+ getData(event) {
16
+ document.activeElement.blur() // disable input
17
+ let ele = event.currentTarget
18
+
19
+ fetch(this.urlValue, {
20
+ method: 'GET',
21
+ headers: {
22
+ Accept: 'application/json'
23
+ }
24
+ }).then(response => {
25
+ return response.json()
26
+ }).then(body => {
27
+ this.picker(body, ele)
28
+ })
29
+ }
30
+
31
+ picker(data, ele) {
32
+ weui.picker(data.values, {
33
+ id: data.default.join('_'),
34
+ title: '多列选择器',
35
+ defaultValue: data.default,
36
+ depth: 3,
37
+ onChange: result => {
38
+ console.log('changed', result)
39
+ },
40
+ onConfirm: result => {
41
+ let val = result[result.length - 1]
42
+ let names = result.map(item => {
43
+ return item.label
44
+ })
45
+ console.debug('Val', val)
46
+ document.getElementById(this.idValue).value = val.value
47
+ ele.value = names.join(' ')
48
+ },
49
+ onClose: () => {
50
+ }
51
+ })
52
+ }
53
+
54
+ }
@@ -0,0 +1,29 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+
3
+ export default class extends Controller {
4
+ static values = {
5
+ params: Object
6
+ }
7
+ static targets = ['load']
8
+
9
+ connect() {
10
+ console.debug('connected:', this.identifier)
11
+ this.chooseWXPay()
12
+ }
13
+
14
+ chooseWXPay() {
15
+ wx.ready(() => {
16
+ wx.chooseWXPay({
17
+ ...this.paramsValue,
18
+ success: (res) => {
19
+ console.log(res)
20
+ this.loadTarget.style.removeProperty('display')
21
+ },
22
+ error: (e) => {
23
+ alert(e)
24
+ }
25
+ })
26
+ })
27
+ }
28
+
29
+ }
@@ -0,0 +1,3 @@
1
+ @import 'ext_bulma';
2
+ @import 'ext_choices';
3
+ @import 'ui_tooltip';
@@ -0,0 +1,5 @@
1
+ @charset "utf-8";
2
+
3
+ @import 'choices';
4
+ @import 'global';
5
+ @import 'main';
@@ -0,0 +1,3 @@
1
+ .choices {
2
+ width: 100%;
3
+ }
@@ -0,0 +1,19 @@
1
+ del {
2
+ color: red;
3
+ }
4
+
5
+ @include touch {
6
+ html {
7
+ overflow-y: auto;
8
+ }
9
+ }
10
+
11
+ iframe {
12
+ &.as-top {
13
+ width: 100%;
14
+ height: 100%;
15
+ border: none;
16
+ position: fixed;
17
+ top: 0
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ body {
2
+ min-height: 100vh;
3
+ display: flex;
4
+ flex-direction: column;
5
+ }
6
+
7
+ main {
8
+ flex-grow: 1;
9
+ }
10
+
11
+ .as-vertical-middle {
12
+ display: flex;
13
+ flex-direction: column;
14
+ align-items: center;
15
+ }
@@ -0,0 +1,10 @@
1
+ @charset "utf-8";
2
+
3
+ @import 'box';
4
+ @import 'breadcrumb';
5
+ @import 'card';
6
+ @import 'level';
7
+ @import 'media';
8
+ @import 'menu';
9
+ @import 'pagination';
10
+ @import 'panel';
@@ -0,0 +1,15 @@
1
+ .as-tooltip {
2
+ position: absolute;
3
+ bottom: 100%;
4
+ min-width: max-content;
5
+ z-index: 1;
6
+ .as-tooltip-arrow {
7
+ width: 0;
8
+ height: 0;
9
+ position: relative;
10
+ border-left: 7px solid transparent;
11
+ border-right: 7px solid transparent;
12
+ border-top: 7px solid #000;
13
+ box-shadow: 1px 1px;
14
+ }
15
+ }
@@ -0,0 +1,17 @@
1
+ .breadcrumb {
2
+ border-bottom: solid 1px rgba(34, 36, 38, .1);
3
+ padding-bottom: .5em;
4
+
5
+ &:not(:last-child) {
6
+ margin-bottom: 0.75em;
7
+ }
8
+
9
+ li {
10
+ &.is-active::before {
11
+ padding-right: 0.75em;
12
+ }
13
+ &:empty + li::before {
14
+ display: none;
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,12 @@
1
+ .cards {
2
+ display: grid;
3
+ grid-template-columns: repeat(4, 25%);
4
+
5
+ .card {
6
+ margin: 1rem;
7
+ }
8
+
9
+ .card + .card {
10
+ margin-top: 1rem;
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ .level {
2
+ &.is-underline {
3
+ padding-top: .5rem;
4
+ padding-bottom: .5rem;
5
+ margin-bottom: 0;
6
+ border-bottom: solid #eee 1px;
7
+ }
8
+ }
@@ -0,0 +1,14 @@
1
+ .media {
2
+ &.is-middle {
3
+ align-items: center;
4
+ }
5
+ }
6
+
7
+ @include mobile {
8
+ .media {
9
+ flex-direction: column;
10
+ .media-content {
11
+ margin-top: 2rem;
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,76 @@
1
+ .ex-accordion {
2
+ display: flex;
3
+ flex-direction: column;
4
+ padding: 0;
5
+ color: grey;
6
+ .menu-label {
7
+ order: 1;
8
+ font-size: 1em;
9
+ display: block;
10
+ margin-top: 0;
11
+ margin-bottom: 0;
12
+ padding: 1em 1.5em;
13
+ .dropdown {
14
+ float: right;
15
+ line-height: 1.5;
16
+ }
17
+ .dropdown:before {
18
+ content: '\f0d9';
19
+ }
20
+ }
21
+ .menu-list {
22
+ order: 2;
23
+ display: none;
24
+ padding-top: .5em;
25
+ padding-left: 1.5em;
26
+ a {
27
+ font-size: .9em;
28
+ }
29
+ a.is-active,
30
+ a:hover {
31
+ background-color: initial;
32
+ font-weight: bold;
33
+ }
34
+ &:empty + .menu-label {
35
+ display: none;
36
+ }
37
+ }
38
+ &.is-active {
39
+ .menu-label {
40
+ border-bottom: none;
41
+ padding-bottom: 0;
42
+ .dropdown:before {
43
+ content: '\f0d7';
44
+ }
45
+ }
46
+ .menu-list {
47
+ display: block;
48
+ border-bottom: solid 1px rgba(34, 36, 38, .1);
49
+ }
50
+ }
51
+ }
52
+
53
+ .menu {
54
+ @each $name, $pair in $colors {
55
+ $color: nth($pair, 1);
56
+ $color-invert: nth($pair, 2);
57
+ &.is-#{$name} {
58
+ background-color: $color;
59
+ .menu-label {
60
+ border-bottom: solid 1px $color;
61
+ color: $color-invert;
62
+ }
63
+ .menu-list {
64
+ a {
65
+ color: $color-invert;
66
+ }
67
+ &:hover {
68
+ color: $color-invert;
69
+ }
70
+ &.is-active {
71
+ color: $color-invert;
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,9 @@
1
+ @include mobile {
2
+ .pagination {
3
+ margin: 0;
4
+ }
5
+ .pagination-previous,
6
+ .pagination-next {
7
+ flex-grow: 0
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ .panel-block.is-flex-direction-column {
2
+ .control + .control {
3
+ padding-top: 1em;
4
+ }
5
+ }
@@ -0,0 +1,7 @@
1
+ @charset "utf-8";
2
+
3
+ @import 'button';
4
+ @import 'fa';
5
+ @import 'image';
6
+ @import 'table';
7
+ @import 'title';
@@ -0,0 +1,14 @@
1
+ .button {
2
+ &.as-corner {
3
+ position: absolute;
4
+ top: 0;
5
+ right: 0;
6
+ border-radius: 0;
7
+ border-width: 0;
8
+ z-index: 1;
9
+ }
10
+ &.is-borderless {
11
+ border-width: 0;
12
+ background: transparent;
13
+ }
14
+ }
@@ -0,0 +1,4 @@
1
+ .fas + span,
2
+ .fas + a {
3
+ padding-left: .25em;
4
+ }
@@ -0,0 +1,38 @@
1
+ .images {
2
+ .image + .image {
3
+ margin-left: 1em;
4
+ }
5
+ }
6
+
7
+ .image {
8
+ &.is-border {
9
+ border: solid 1px red;
10
+ }
11
+
12
+ &.is-flex-item {
13
+ display: inline-block;
14
+ vertical-align: middle;
15
+ }
16
+ }
17
+
18
+ figure.is-flex {
19
+ display: flex;
20
+ flex-flow: column;
21
+ margin: auto;
22
+ }
23
+
24
+ figure.image {
25
+ background-color: white;
26
+ opacity: 1;
27
+
28
+ figcaption {
29
+ background-color: #666;
30
+ color: #fff;
31
+ padding: 3px;
32
+ text-align: center;
33
+ }
34
+ img, video {
35
+ height: inherit;
36
+ object-fit: contain;
37
+ }
38
+ }
@@ -0,0 +1,52 @@
1
+ .table {
2
+ &.is-border {
3
+ border: solid 1px $border;
4
+ }
5
+
6
+ thead th, td {
7
+ border-bottom-width: 1px;
8
+ }
9
+ tfoot td, th {
10
+ border-top-width: 1px;
11
+ }
12
+
13
+ tbody + tbody {
14
+ tr:first-child td,
15
+ tr:last-child th {
16
+ border-top-width: 1px;
17
+ }
18
+ }
19
+
20
+ th, td {
21
+ vertical-align: middle;
22
+ }
23
+
24
+ &.as-show {
25
+ td:first-child {
26
+ width: 33%;
27
+ }
28
+ tbody td:first-child::after {
29
+ content: ':';
30
+ padding-left: .25em;
31
+ color: #888;
32
+ }
33
+ }
34
+ }
35
+
36
+ table.as-search {
37
+ th, td {
38
+ padding: 0 .5em .75em 0;
39
+ vertical-align: middle;
40
+ }
41
+ th {
42
+ text-align: right;
43
+ white-space: nowrap;
44
+ }
45
+ th::after {
46
+ content: ':';
47
+ color: #888;
48
+ }
49
+ td {
50
+ width: 100%;
51
+ }
52
+ }