@qtoggle/qui 0.0.0

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 (202) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +492 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  5. package/.github/ISSUE_TEMPLATE/improvement_proposal.md +20 -0
  6. package/.github/workflows/main.yml +74 -0
  7. package/.pre-commit-config.yaml +8 -0
  8. package/LICENSE.txt +177 -0
  9. package/README.md +4 -0
  10. package/font/dejavusans-bold.woff +0 -0
  11. package/font/dejavusans-bolditalic.woff +0 -0
  12. package/font/dejavusans-italic.woff +0 -0
  13. package/font/dejavusans-regular.woff +0 -0
  14. package/img/qui-icons.svg +1937 -0
  15. package/js/base/base.js +47 -0
  16. package/js/base/condition-variable.js +92 -0
  17. package/js/base/errors.js +36 -0
  18. package/js/base/i18n.js +20 -0
  19. package/js/base/mixwith.js +135 -0
  20. package/js/base/require-js-compat.js +78 -0
  21. package/js/base/signal.js +91 -0
  22. package/js/base/singleton.js +66 -0
  23. package/js/base/timer.js +126 -0
  24. package/js/config.js +184 -0
  25. package/js/forms/common-fields/check-field.js +42 -0
  26. package/js/forms/common-fields/choice-buttons-field.js +30 -0
  27. package/js/forms/common-fields/color-combo-field.js +37 -0
  28. package/js/forms/common-fields/combo-field.js +108 -0
  29. package/js/forms/common-fields/common-fields.js +23 -0
  30. package/js/forms/common-fields/composite-field.js +132 -0
  31. package/js/forms/common-fields/custom-html-field.js +51 -0
  32. package/js/forms/common-fields/email-field.js +30 -0
  33. package/js/forms/common-fields/file-picker-field.js +46 -0
  34. package/js/forms/common-fields/jquery-ui-field.js +111 -0
  35. package/js/forms/common-fields/labels-field.js +69 -0
  36. package/js/forms/common-fields/numeric-field.js +39 -0
  37. package/js/forms/common-fields/password-field.js +28 -0
  38. package/js/forms/common-fields/phone-field.js +26 -0
  39. package/js/forms/common-fields/progress-disk-field.js +69 -0
  40. package/js/forms/common-fields/push-button-field.js +138 -0
  41. package/js/forms/common-fields/slider-field.js +51 -0
  42. package/js/forms/common-fields/text-area-field.js +34 -0
  43. package/js/forms/common-fields/text-field.js +89 -0
  44. package/js/forms/common-fields/up-down-field.js +85 -0
  45. package/js/forms/common-forms/common-forms.js +16 -0
  46. package/js/forms/common-forms/options-form.js +77 -0
  47. package/js/forms/common-forms/page-form.js +115 -0
  48. package/js/forms/form-button.js +202 -0
  49. package/js/forms/form-field.js +1183 -0
  50. package/js/forms/form.js +1181 -0
  51. package/js/forms/forms.js +68 -0
  52. package/js/global-glass.js +100 -0
  53. package/js/icons/default-stock.js +173 -0
  54. package/js/icons/icon.js +64 -0
  55. package/js/icons/icons.js +16 -0
  56. package/js/icons/multi-state-sprites-icon.js +362 -0
  57. package/js/icons/stock-icon.js +219 -0
  58. package/js/icons/stock.js +98 -0
  59. package/js/icons/stocks.js +57 -0
  60. package/js/index.js +232 -0
  61. package/js/lib/jquery.longpress.js +79 -0
  62. package/js/lib/jquery.module.js +4 -0
  63. package/js/lib/logger.module.js +4 -0
  64. package/js/lib/pep.module.js +4 -0
  65. package/js/lists/common-items/common-items.js +5 -0
  66. package/js/lists/common-items/icon-label-list-item.js +86 -0
  67. package/js/lists/common-lists/common-lists.js +5 -0
  68. package/js/lists/common-lists/page-list.js +53 -0
  69. package/js/lists/list-item.js +147 -0
  70. package/js/lists/list.js +636 -0
  71. package/js/lists/lists.js +26 -0
  72. package/js/main-ui/main-ui.js +64 -0
  73. package/js/main-ui/menu-bar.js +144 -0
  74. package/js/main-ui/options-bar.js +181 -0
  75. package/js/main-ui/status.js +185 -0
  76. package/js/main-ui/top-bar.js +59 -0
  77. package/js/messages/common-message-forms/common-message-forms.js +7 -0
  78. package/js/messages/common-message-forms/confirm-message-form.js +81 -0
  79. package/js/messages/common-message-forms/simple-message-form.js +67 -0
  80. package/js/messages/common-message-forms/sticky-simple-message-form.js +27 -0
  81. package/js/messages/message-form.js +107 -0
  82. package/js/messages/messages.js +21 -0
  83. package/js/messages/sticky-modal-page.js +98 -0
  84. package/js/messages/sticky-modal-progress-message.js +27 -0
  85. package/js/messages/toast.js +164 -0
  86. package/js/navigation.js +654 -0
  87. package/js/pages/breadcrumbs.js +124 -0
  88. package/js/pages/common-pages/common-pages.js +6 -0
  89. package/js/pages/common-pages/modal-progress-page.js +83 -0
  90. package/js/pages/common-pages/structured-page.js +46 -0
  91. package/js/pages/page.js +1018 -0
  92. package/js/pages/pages-context.js +154 -0
  93. package/js/pages/pages.js +252 -0
  94. package/js/pwa.js +337 -0
  95. package/js/sections/section.js +612 -0
  96. package/js/sections/sections.js +300 -0
  97. package/js/tables/common-cells/common-cells.js +7 -0
  98. package/js/tables/common-cells/icon-label-table-cell.js +68 -0
  99. package/js/tables/common-cells/push-button-table-cell.js +133 -0
  100. package/js/tables/common-cells/simple-table-cell.js +37 -0
  101. package/js/tables/common-tables/common-tables.js +5 -0
  102. package/js/tables/common-tables/page-table.js +55 -0
  103. package/js/tables/table-cell.js +198 -0
  104. package/js/tables/table-row.js +126 -0
  105. package/js/tables/table.js +492 -0
  106. package/js/tables/tables.js +36 -0
  107. package/js/theme.js +304 -0
  108. package/js/utils/ajax.js +126 -0
  109. package/js/utils/array.js +194 -0
  110. package/js/utils/colors.js +445 -0
  111. package/js/utils/cookies.js +65 -0
  112. package/js/utils/crypto.js +439 -0
  113. package/js/utils/css.js +234 -0
  114. package/js/utils/date.js +300 -0
  115. package/js/utils/files.js +27 -0
  116. package/js/utils/gestures.js +165 -0
  117. package/js/utils/html.js +76 -0
  118. package/js/utils/misc.js +81 -0
  119. package/js/utils/object.js +324 -0
  120. package/js/utils/promise.js +49 -0
  121. package/js/utils/string.js +192 -0
  122. package/js/utils/url.js +187 -0
  123. package/js/utils/utils.js +3 -0
  124. package/js/utils/visibility-manager.js +211 -0
  125. package/js/views/common-views/common-views.js +7 -0
  126. package/js/views/common-views/icon-label-view.js +210 -0
  127. package/js/views/common-views/progress-view.js +89 -0
  128. package/js/views/common-views/structured-view.js +368 -0
  129. package/js/views/view.js +467 -0
  130. package/js/views/views.js +3 -0
  131. package/js/widgets/base-widget.js +23 -0
  132. package/js/widgets/common-widgets/check-button.js +109 -0
  133. package/js/widgets/common-widgets/choice-buttons.js +322 -0
  134. package/js/widgets/common-widgets/color-combo.js +104 -0
  135. package/js/widgets/common-widgets/combo.js +645 -0
  136. package/js/widgets/common-widgets/common-widgets.js +17 -0
  137. package/js/widgets/common-widgets/email-input.js +7 -0
  138. package/js/widgets/common-widgets/file-picker.js +133 -0
  139. package/js/widgets/common-widgets/labels.js +132 -0
  140. package/js/widgets/common-widgets/numeric-input.js +49 -0
  141. package/js/widgets/common-widgets/password-input.js +91 -0
  142. package/js/widgets/common-widgets/phone-input.js +7 -0
  143. package/js/widgets/common-widgets/progress-disk.js +174 -0
  144. package/js/widgets/common-widgets/push-button.js +155 -0
  145. package/js/widgets/common-widgets/slider.js +455 -0
  146. package/js/widgets/common-widgets/text-area.js +52 -0
  147. package/js/widgets/common-widgets/text-input.js +174 -0
  148. package/js/widgets/common-widgets/up-down.js +351 -0
  149. package/js/widgets/widgets.js +57 -0
  150. package/js/window.js +557 -0
  151. package/jsdoc.conf.json +20 -0
  152. package/less/base.less +123 -0
  153. package/less/forms/common-fields.less +101 -0
  154. package/less/forms/common-forms.less +5 -0
  155. package/less/forms/form-button.less +21 -0
  156. package/less/forms/form-field.less +266 -0
  157. package/less/forms/form.less +131 -0
  158. package/less/global-glass.less +64 -0
  159. package/less/icon-label-view.less +82 -0
  160. package/less/icons.less +144 -0
  161. package/less/lists.less +105 -0
  162. package/less/main-ui.less +328 -0
  163. package/less/messages.less +189 -0
  164. package/less/no-effects.less +24 -0
  165. package/less/pages/breadcrumbs.less +98 -0
  166. package/less/pages/common-pages.less +36 -0
  167. package/less/pages/page.less +70 -0
  168. package/less/progress-view.less +51 -0
  169. package/less/stock-icons.less +43 -0
  170. package/less/structured-view.less +245 -0
  171. package/less/tables.less +84 -0
  172. package/less/theme-dark.less +133 -0
  173. package/less/theme-light.less +132 -0
  174. package/less/theme.less +419 -0
  175. package/less/visibility-manager.less +11 -0
  176. package/less/widgets/check-button.less +96 -0
  177. package/less/widgets/choice-buttons.less +160 -0
  178. package/less/widgets/color-combo.less +33 -0
  179. package/less/widgets/combo.less +230 -0
  180. package/less/widgets/common-buttons.less +120 -0
  181. package/less/widgets/common.less +24 -0
  182. package/less/widgets/input.less +258 -0
  183. package/less/widgets/labels.less +81 -0
  184. package/less/widgets/progress-disk.less +70 -0
  185. package/less/widgets/slider.less +199 -0
  186. package/less/widgets/updown.less +115 -0
  187. package/less/widgets/various.less +36 -0
  188. package/package.json +47 -0
  189. package/pyproject.toml +45 -0
  190. package/qui/__init__.py +110 -0
  191. package/qui/constants.py +1 -0
  192. package/qui/exceptions.py +2 -0
  193. package/qui/j2template.py +71 -0
  194. package/qui/settings.py +60 -0
  195. package/qui/templates/manifest.json +25 -0
  196. package/qui/templates/qui.html +126 -0
  197. package/qui/templates/service-worker.js +188 -0
  198. package/qui/web/__init__.py +0 -0
  199. package/qui/web/tornado.py +220 -0
  200. package/scripts/postinstall.sh +10 -0
  201. package/webpack/webpack-adjust-css-urls-loader.js +36 -0
  202. package/webpack/webpack-common.js +384 -0
@@ -0,0 +1,85 @@
1
+
2
+ import JQueryUIField from './jquery-ui-field.js'
3
+
4
+
5
+ /**
6
+ * A field backed by an up-down (spinner) widget. The value data type is `Number`.
7
+ * @alias qui.forms.commonfields.UpDownField
8
+ * @extends qui.forms.commonfields.JQueryUIField
9
+ */
10
+ class UpDownField extends JQueryUIField {
11
+
12
+ static WIDGET_CLASS = 'updown'
13
+
14
+
15
+ // TODO add setters and getters for widget properties
16
+
17
+ /**
18
+ * @constructs
19
+ * @param {Number} [min] the minimum value (defaults to `0`)
20
+ * @param {Number} [max] the maximum value (defaults to `100`)
21
+ * @param {Number} [step] the step value (defaults to `1`)
22
+ * @param {Number} [fastFactor] determines the increment value when in fast mode (defaults to `10`)
23
+ * @param {Number} [decimals] the number of decimals to display (defaults to `0`)
24
+ * @param {Boolean} [continuousChange] set to `false` to prevent triggering `change` events with each value
25
+ * modification when losing focus
26
+ * @param {...*} args parent class parameters
27
+ */
28
+ constructor({
29
+ min = 0,
30
+ max = 100,
31
+ step = 1,
32
+ fastFactor = 10,
33
+ decimals = 0,
34
+ continuousChange = true,
35
+ ...args
36
+ }) {
37
+ super({
38
+ widgetAttrs: {
39
+ min: min,
40
+ max: max,
41
+ step: step,
42
+ fastFactor: fastFactor,
43
+ decimals: decimals,
44
+ continuousChange: continuousChange
45
+ },
46
+ ...args
47
+ })
48
+ }
49
+
50
+ /**
51
+ * Return the minimum value.
52
+ * @returns {Number}
53
+ */
54
+ getMin() {
55
+ return this._widgetCall('option', 'min')
56
+ }
57
+
58
+ /**
59
+ * Update the minimum value.
60
+ * @param {Number} min
61
+ */
62
+ setMin(min) {
63
+ this._widgetCall('option', {min: min})
64
+ }
65
+
66
+ /**
67
+ * Return the maximum value.
68
+ * @returns {Number}
69
+ */
70
+ getMax() {
71
+ return this._widgetCall('option', 'max')
72
+ }
73
+
74
+ /**
75
+ * Update the maximum value.
76
+ * @param {Number} max
77
+ */
78
+ setMax(max) {
79
+ this._widgetCall('option', {max: max})
80
+ }
81
+
82
+ }
83
+
84
+
85
+ export default UpDownField
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @namespace qui.forms.commonforms
3
+ */
4
+
5
+ import OptionsForm from './options-form.js'
6
+ import PageForm from './page-form.js'
7
+
8
+
9
+ export {default as OptionsForm} from './options-form.js'
10
+ export {default as PageForm} from './page-form.js'
11
+
12
+
13
+ export function init() {
14
+ OptionsForm.init()
15
+ PageForm.init()
16
+ }
@@ -0,0 +1,77 @@
1
+
2
+ import * as OptionsBar from '$qui/main-ui/options-bar.js'
3
+ import {getCurrentPage} from '$qui/pages/pages.js'
4
+ import * as ObjectUtils from '$qui/utils/object.js'
5
+
6
+ import Form from '../form.js'
7
+
8
+
9
+ /**
10
+ * A form ready to be used with {@link qui.pages.PageMixin#makeOptionsBarContent}.
11
+ * @alias qui.forms.commonforms.OptionsForm
12
+ * @extends qui.forms.Form
13
+ */
14
+ class OptionsForm extends Form {
15
+
16
+ /**
17
+ * @constructs
18
+ * @param {qui.pages.PageMixin} page the page associated to this options form
19
+ * @param {...*} args parent class parameters
20
+ */
21
+ constructor({page, ...args}) {
22
+ ObjectUtils.assignDefault(args, {
23
+ compact: true,
24
+ width: 'auto',
25
+ largeTop: false,
26
+ noBackground: true,
27
+ topless: true,
28
+ continuousValidation: true
29
+ })
30
+
31
+ super(args)
32
+
33
+ this._page = page
34
+ }
35
+
36
+ onChangeValid(data, fieldName) {
37
+ this._page.onOptionsChange(data)
38
+ }
39
+
40
+ /**
41
+ * Called when the options bar is opened or closed with this form.
42
+ * @param {Boolean} opened `true` if opened, `false` otherwise
43
+ */
44
+ onOptionsBarOpenClose(opened) {
45
+ }
46
+
47
+ proceed() {
48
+ /* Options form has no proceed implementation by default. It makes use of the continuous validation */
49
+ }
50
+
51
+ /**
52
+ * Return the associated page
53
+ * @returns {qui.pages.PageMixin}
54
+ */
55
+ getPage() {
56
+ return this._page
57
+ }
58
+
59
+ static init() {
60
+ OptionsBar.openCloseSignal.connect(function (opened) {
61
+ let currentPage = getCurrentPage()
62
+ if (!currentPage) {
63
+ return
64
+ }
65
+
66
+ /* If OptionsForm class has been used for current options bar content, call a handler */
67
+ let optionsBarContent = currentPage.getOptionsBarContent()
68
+ if (optionsBarContent instanceof OptionsForm) {
69
+ optionsBarContent.onOptionsBarOpenClose(opened)
70
+ }
71
+ })
72
+ }
73
+
74
+ }
75
+
76
+
77
+ export default OptionsForm
@@ -0,0 +1,115 @@
1
+
2
+ import {gettext} from '$qui/base/i18n.js'
3
+ import {mix} from '$qui/base/mixwith.js'
4
+ import StockIcon from '$qui/icons/stock-icon.js'
5
+ import PageMixin from '$qui/pages/page.js'
6
+ import * as Sections from '$qui/sections/sections.js'
7
+ import * as ObjectUtils from '$qui/utils/object.js'
8
+ import * as Window from '$qui/window.js'
9
+
10
+ import Form from '../form.js'
11
+
12
+
13
+ /**
14
+ * A form that can be used as a page.
15
+ * @alias qui.forms.commonforms.PageForm
16
+ * @extends qui.forms.Form
17
+ * @mixes qui.pages.PageMixin
18
+ */
19
+ class PageForm extends mix(Form).with(PageMixin) {
20
+
21
+ /**
22
+ * @constructs
23
+ * @param {Boolean} [preventUnappliedClose] if set to `true`, the form will try to prevent losing unapplied data
24
+ * when closed, by asking the user for confirmation
25
+ * @param {...*} args parent class parameters
26
+ */
27
+ constructor({preventUnappliedClose = false, ...args} = {}) {
28
+ ObjectUtils.setDefault(args, 'transparent', !Window.isSmallScreen())
29
+ super(args)
30
+
31
+ this._preventUnappliedClose = preventUnappliedClose
32
+ }
33
+
34
+ prepareIcon(icon) {
35
+ /* Popup page views should normally have the default foreground icon color, even on small screens */
36
+ if (this.isPopup() && (icon instanceof StockIcon)) {
37
+ icon = icon.alterDefault({variant: 'foreground'})
38
+ }
39
+
40
+ return super.prepareIcon(icon)
41
+ }
42
+
43
+ canClose() {
44
+ if (!this._preventUnappliedClose) {
45
+ return super.canClose()
46
+ }
47
+
48
+ let changedFields = this.getChangedFieldNames()
49
+ if (!changedFields.length) {
50
+ return super.canClose()
51
+ }
52
+
53
+ /* Dynamically import common-message-forms.js here, because it depends itself on PageForm */
54
+ return import('$qui/messages/common-message-forms/common-message-forms.js').then(function (CommonMessageForms) {
55
+ let message = gettext('Discard changes?')
56
+ return new CommonMessageForms.ConfirmMessageForm({message: message}).show().asPromise()
57
+ })
58
+ }
59
+
60
+ handleBecomeCurrent() {
61
+ super.handleBecomeCurrent()
62
+ this._updateVertScroll()
63
+ }
64
+
65
+ handleVertScroll() {
66
+ super.handleVertScroll()
67
+ this._updateVertScroll()
68
+ }
69
+
70
+ handleResize() {
71
+ super.handleResize()
72
+ this._updateVertScroll()
73
+ }
74
+
75
+ _updateVertScroll() {
76
+ let params = this.getVertScrollParams()
77
+ let fixedBottom = (params.maxOffset > 0) && Window.isSmallScreen()
78
+ let fullyScrolled = (params.maxOffset - params.offset <= 1) && Window.isSmallScreen()
79
+
80
+ /* Place progress widget in the viewport by pushing it down a bit */
81
+ this.getProgressWidget().css('margin-top', `${params.offset}px`)
82
+
83
+ /* Make form buttons always visible */
84
+ this.getHTML().toggleClass('fixed-bottom', fixedBottom)
85
+ this.getHTML().toggleClass('fully-scrolled', fullyScrolled)
86
+ }
87
+
88
+ static init() {
89
+ Window.closeSignal.connect(function () {
90
+ /* Go through all current pages and collect page forms. Then see if they have changed fields and, if any of
91
+ * them does and has preventUnappliedClose flag set, try to prevent navigating away from the page */
92
+
93
+ let currentSection = Sections.getCurrent()
94
+ if (!currentSection) {
95
+ return
96
+ }
97
+
98
+ let context = currentSection.getPagesContext()
99
+ if (!context) {
100
+ return
101
+ }
102
+
103
+ let pages = context.getPages()
104
+ let pageForms = pages.filter(p => p instanceof PageForm)
105
+
106
+ if (pageForms.some(f => f.getChangedFieldNames().length > 0 && f._preventUnappliedClose)) {
107
+ return false
108
+ }
109
+ })
110
+ }
111
+
112
+ }
113
+
114
+
115
+ export default PageForm
@@ -0,0 +1,202 @@
1
+
2
+ import $ from '$qui/lib/jquery.module.js'
3
+
4
+ import {mix} from '$qui/base/mixwith.js'
5
+ import ViewMixin from '$qui/views/view.js'
6
+
7
+
8
+ /**
9
+ * A form button.
10
+ * @alias qui.forms.FormButton
11
+ * @mixes qui.views.ViewMixin
12
+ */
13
+ class FormButton extends mix().with(ViewMixin) {
14
+
15
+ /**
16
+ * @constructs
17
+ * @param {String} id button identifier
18
+ * @param {String} caption button caption
19
+ * @param {String} [style] button style:
20
+ * * `"foreground"`
21
+ * * `"interactive"`
22
+ * * `"highlight"`
23
+ * * `"danger"`
24
+ * * `"colored"`
25
+ * @param {String} [backgroundColor] custom background color (ignored unless `style` is `"colored"`)
26
+ * @param {String} [backgroundActiveColor] custom background active color (ignored unless `style` is `"colored"`)
27
+ * @param {String} [foregroundColor] custom foreground color (ignored unless `style` is `"colored"`)
28
+ * @param {qui.icons.Icon} [icon] an optional button icon
29
+ * @param {Boolean} [def] indicates that the button is the default form button (defaults to `false`)
30
+ * @param {Boolean} [cancel] indicates that the button is the cancel form button (defaults to `false`)
31
+ * @param {Function} [callback] called when button is pressed; will be called with the form as argument
32
+ * @param {...*} args parent class parameters
33
+ */
34
+ constructor({
35
+ id,
36
+ caption,
37
+ style = null,
38
+ backgroundColor = '@interactive-color',
39
+ backgroundActiveColor = '@interactive-active-color',
40
+ foregroundColor = '@foreground-interactive-color',
41
+ icon = null,
42
+ def = false,
43
+ cancel = false,
44
+ callback = null,
45
+ ...args
46
+ }) {
47
+ super(args)
48
+
49
+ this._id = id
50
+ this._caption = caption
51
+ this._style = style
52
+ this._backgroundColor = backgroundColor
53
+ this._backgroundActiveColor = backgroundActiveColor
54
+ this._foregroundColor = foregroundColor
55
+ this._icon = icon
56
+ this._def = def
57
+ this._cancel = cancel
58
+ this._callback = callback
59
+
60
+ this._form = null
61
+ }
62
+
63
+ makeHTML() {
64
+ if (!this._style) {
65
+ if (this._def) {
66
+ this._style = 'highlight'
67
+ }
68
+ else if (this._cancel) {
69
+ this._style = 'foreground'
70
+ }
71
+ else {
72
+ this._style = 'interactive'
73
+ }
74
+ }
75
+
76
+ let attrs = {
77
+ caption: this._caption,
78
+ style: this._style,
79
+ backgroundColor: this._backgroundColor,
80
+ backgroundActiveColor: this._backgroundActiveColor,
81
+ foregroundColor: this._foregroundColor,
82
+ icon: this._icon
83
+ }
84
+
85
+ let html = $('<div></div>', {class: 'qui-form-button'}).pushbutton(attrs)
86
+
87
+ html.on('click', function () {
88
+ this.handlePressed(this._form)
89
+ }.bind(this))
90
+
91
+ return html
92
+ }
93
+
94
+ /**
95
+ * Button press handler.
96
+ * @param {qui.forms.Form} form
97
+ */
98
+ handlePressed(form) {
99
+ if (this._callback) {
100
+ this._callback(form)
101
+ }
102
+ else {
103
+ /* Default button callback */
104
+
105
+ if (this.isDefault()) {
106
+ this._form.defaultAction()
107
+ }
108
+ else if (this.isCancel()) {
109
+ this._form.cancelAction()
110
+ }
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Return the button identifier.
116
+ * @returns {String}
117
+ */
118
+ getId() {
119
+ return this._id
120
+ }
121
+
122
+ /**
123
+ * Enable the button.
124
+ */
125
+ enable() {
126
+ this.getHTML().pushbutton({disabled: false})
127
+ }
128
+
129
+ /**
130
+ * Disable the button.
131
+ */
132
+ disable() {
133
+ this.getHTML().pushbutton({disabled: true})
134
+ }
135
+
136
+ /**
137
+ * Tell if the button is focused or not.
138
+ * @returns {Boolean}
139
+ */
140
+ isFocused() {
141
+ return this.getHTML().is(':focus')
142
+ }
143
+
144
+ /**
145
+ * Focus the button.
146
+ */
147
+ focus() {
148
+ this.getHTML().focus()
149
+ }
150
+
151
+ /**
152
+ * Return the button caption.
153
+ * @returns {String}
154
+ */
155
+ getCaption() {
156
+ return this._caption
157
+ }
158
+
159
+ /**
160
+ * Update the button caption.
161
+ * @param {String} caption
162
+ */
163
+ setCaption(caption) {
164
+ this._caption = caption
165
+ this.getHTML().pushbutton({caption: caption})
166
+ }
167
+
168
+ /**
169
+ * Tell if the button is the default form button.
170
+ * @returns {Boolean}
171
+ */
172
+ isDefault() {
173
+ return this._def
174
+ }
175
+
176
+ /**
177
+ * Tell if the button is the form cancel button.
178
+ * @returns {Boolean}
179
+ */
180
+ isCancel() {
181
+ return this._cancel
182
+ }
183
+
184
+ /**
185
+ * Return the owning form.
186
+ * @returns {qui.forms.Form}
187
+ */
188
+ getForm() {
189
+ return this._form
190
+ }
191
+
192
+ /**
193
+ * Set the owning form.
194
+ * @param {qui.forms.Form} form
195
+ */
196
+ setForm(form) {
197
+ this._form = form
198
+ }
199
+
200
+ }
201
+
202
+ export default FormButton