@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.
- package/.eslintignore +2 -0
- package/.eslintrc.json +492 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- package/.github/ISSUE_TEMPLATE/improvement_proposal.md +20 -0
- package/.github/workflows/main.yml +74 -0
- package/.pre-commit-config.yaml +8 -0
- package/LICENSE.txt +177 -0
- package/README.md +4 -0
- package/font/dejavusans-bold.woff +0 -0
- package/font/dejavusans-bolditalic.woff +0 -0
- package/font/dejavusans-italic.woff +0 -0
- package/font/dejavusans-regular.woff +0 -0
- package/img/qui-icons.svg +1937 -0
- package/js/base/base.js +47 -0
- package/js/base/condition-variable.js +92 -0
- package/js/base/errors.js +36 -0
- package/js/base/i18n.js +20 -0
- package/js/base/mixwith.js +135 -0
- package/js/base/require-js-compat.js +78 -0
- package/js/base/signal.js +91 -0
- package/js/base/singleton.js +66 -0
- package/js/base/timer.js +126 -0
- package/js/config.js +184 -0
- package/js/forms/common-fields/check-field.js +42 -0
- package/js/forms/common-fields/choice-buttons-field.js +30 -0
- package/js/forms/common-fields/color-combo-field.js +37 -0
- package/js/forms/common-fields/combo-field.js +108 -0
- package/js/forms/common-fields/common-fields.js +23 -0
- package/js/forms/common-fields/composite-field.js +132 -0
- package/js/forms/common-fields/custom-html-field.js +51 -0
- package/js/forms/common-fields/email-field.js +30 -0
- package/js/forms/common-fields/file-picker-field.js +46 -0
- package/js/forms/common-fields/jquery-ui-field.js +111 -0
- package/js/forms/common-fields/labels-field.js +69 -0
- package/js/forms/common-fields/numeric-field.js +39 -0
- package/js/forms/common-fields/password-field.js +28 -0
- package/js/forms/common-fields/phone-field.js +26 -0
- package/js/forms/common-fields/progress-disk-field.js +69 -0
- package/js/forms/common-fields/push-button-field.js +138 -0
- package/js/forms/common-fields/slider-field.js +51 -0
- package/js/forms/common-fields/text-area-field.js +34 -0
- package/js/forms/common-fields/text-field.js +89 -0
- package/js/forms/common-fields/up-down-field.js +85 -0
- package/js/forms/common-forms/common-forms.js +16 -0
- package/js/forms/common-forms/options-form.js +77 -0
- package/js/forms/common-forms/page-form.js +115 -0
- package/js/forms/form-button.js +202 -0
- package/js/forms/form-field.js +1183 -0
- package/js/forms/form.js +1181 -0
- package/js/forms/forms.js +68 -0
- package/js/global-glass.js +100 -0
- package/js/icons/default-stock.js +173 -0
- package/js/icons/icon.js +64 -0
- package/js/icons/icons.js +16 -0
- package/js/icons/multi-state-sprites-icon.js +362 -0
- package/js/icons/stock-icon.js +219 -0
- package/js/icons/stock.js +98 -0
- package/js/icons/stocks.js +57 -0
- package/js/index.js +232 -0
- package/js/lib/jquery.longpress.js +79 -0
- package/js/lib/jquery.module.js +4 -0
- package/js/lib/logger.module.js +4 -0
- package/js/lib/pep.module.js +4 -0
- package/js/lists/common-items/common-items.js +5 -0
- package/js/lists/common-items/icon-label-list-item.js +86 -0
- package/js/lists/common-lists/common-lists.js +5 -0
- package/js/lists/common-lists/page-list.js +53 -0
- package/js/lists/list-item.js +147 -0
- package/js/lists/list.js +636 -0
- package/js/lists/lists.js +26 -0
- package/js/main-ui/main-ui.js +64 -0
- package/js/main-ui/menu-bar.js +144 -0
- package/js/main-ui/options-bar.js +181 -0
- package/js/main-ui/status.js +185 -0
- package/js/main-ui/top-bar.js +59 -0
- package/js/messages/common-message-forms/common-message-forms.js +7 -0
- package/js/messages/common-message-forms/confirm-message-form.js +81 -0
- package/js/messages/common-message-forms/simple-message-form.js +67 -0
- package/js/messages/common-message-forms/sticky-simple-message-form.js +27 -0
- package/js/messages/message-form.js +107 -0
- package/js/messages/messages.js +21 -0
- package/js/messages/sticky-modal-page.js +98 -0
- package/js/messages/sticky-modal-progress-message.js +27 -0
- package/js/messages/toast.js +164 -0
- package/js/navigation.js +654 -0
- package/js/pages/breadcrumbs.js +124 -0
- package/js/pages/common-pages/common-pages.js +6 -0
- package/js/pages/common-pages/modal-progress-page.js +83 -0
- package/js/pages/common-pages/structured-page.js +46 -0
- package/js/pages/page.js +1018 -0
- package/js/pages/pages-context.js +154 -0
- package/js/pages/pages.js +252 -0
- package/js/pwa.js +337 -0
- package/js/sections/section.js +612 -0
- package/js/sections/sections.js +300 -0
- package/js/tables/common-cells/common-cells.js +7 -0
- package/js/tables/common-cells/icon-label-table-cell.js +68 -0
- package/js/tables/common-cells/push-button-table-cell.js +133 -0
- package/js/tables/common-cells/simple-table-cell.js +37 -0
- package/js/tables/common-tables/common-tables.js +5 -0
- package/js/tables/common-tables/page-table.js +55 -0
- package/js/tables/table-cell.js +198 -0
- package/js/tables/table-row.js +126 -0
- package/js/tables/table.js +492 -0
- package/js/tables/tables.js +36 -0
- package/js/theme.js +304 -0
- package/js/utils/ajax.js +126 -0
- package/js/utils/array.js +194 -0
- package/js/utils/colors.js +445 -0
- package/js/utils/cookies.js +65 -0
- package/js/utils/crypto.js +439 -0
- package/js/utils/css.js +234 -0
- package/js/utils/date.js +300 -0
- package/js/utils/files.js +27 -0
- package/js/utils/gestures.js +165 -0
- package/js/utils/html.js +76 -0
- package/js/utils/misc.js +81 -0
- package/js/utils/object.js +324 -0
- package/js/utils/promise.js +49 -0
- package/js/utils/string.js +192 -0
- package/js/utils/url.js +187 -0
- package/js/utils/utils.js +3 -0
- package/js/utils/visibility-manager.js +211 -0
- package/js/views/common-views/common-views.js +7 -0
- package/js/views/common-views/icon-label-view.js +210 -0
- package/js/views/common-views/progress-view.js +89 -0
- package/js/views/common-views/structured-view.js +368 -0
- package/js/views/view.js +467 -0
- package/js/views/views.js +3 -0
- package/js/widgets/base-widget.js +23 -0
- package/js/widgets/common-widgets/check-button.js +109 -0
- package/js/widgets/common-widgets/choice-buttons.js +322 -0
- package/js/widgets/common-widgets/color-combo.js +104 -0
- package/js/widgets/common-widgets/combo.js +645 -0
- package/js/widgets/common-widgets/common-widgets.js +17 -0
- package/js/widgets/common-widgets/email-input.js +7 -0
- package/js/widgets/common-widgets/file-picker.js +133 -0
- package/js/widgets/common-widgets/labels.js +132 -0
- package/js/widgets/common-widgets/numeric-input.js +49 -0
- package/js/widgets/common-widgets/password-input.js +91 -0
- package/js/widgets/common-widgets/phone-input.js +7 -0
- package/js/widgets/common-widgets/progress-disk.js +174 -0
- package/js/widgets/common-widgets/push-button.js +155 -0
- package/js/widgets/common-widgets/slider.js +455 -0
- package/js/widgets/common-widgets/text-area.js +52 -0
- package/js/widgets/common-widgets/text-input.js +174 -0
- package/js/widgets/common-widgets/up-down.js +351 -0
- package/js/widgets/widgets.js +57 -0
- package/js/window.js +557 -0
- package/jsdoc.conf.json +20 -0
- package/less/base.less +123 -0
- package/less/forms/common-fields.less +101 -0
- package/less/forms/common-forms.less +5 -0
- package/less/forms/form-button.less +21 -0
- package/less/forms/form-field.less +266 -0
- package/less/forms/form.less +131 -0
- package/less/global-glass.less +64 -0
- package/less/icon-label-view.less +82 -0
- package/less/icons.less +144 -0
- package/less/lists.less +105 -0
- package/less/main-ui.less +328 -0
- package/less/messages.less +189 -0
- package/less/no-effects.less +24 -0
- package/less/pages/breadcrumbs.less +98 -0
- package/less/pages/common-pages.less +36 -0
- package/less/pages/page.less +70 -0
- package/less/progress-view.less +51 -0
- package/less/stock-icons.less +43 -0
- package/less/structured-view.less +245 -0
- package/less/tables.less +84 -0
- package/less/theme-dark.less +133 -0
- package/less/theme-light.less +132 -0
- package/less/theme.less +419 -0
- package/less/visibility-manager.less +11 -0
- package/less/widgets/check-button.less +96 -0
- package/less/widgets/choice-buttons.less +160 -0
- package/less/widgets/color-combo.less +33 -0
- package/less/widgets/combo.less +230 -0
- package/less/widgets/common-buttons.less +120 -0
- package/less/widgets/common.less +24 -0
- package/less/widgets/input.less +258 -0
- package/less/widgets/labels.less +81 -0
- package/less/widgets/progress-disk.less +70 -0
- package/less/widgets/slider.less +199 -0
- package/less/widgets/updown.less +115 -0
- package/less/widgets/various.less +36 -0
- package/package.json +47 -0
- package/pyproject.toml +45 -0
- package/qui/__init__.py +110 -0
- package/qui/constants.py +1 -0
- package/qui/exceptions.py +2 -0
- package/qui/j2template.py +71 -0
- package/qui/settings.py +60 -0
- package/qui/templates/manifest.json +25 -0
- package/qui/templates/qui.html +126 -0
- package/qui/templates/service-worker.js +188 -0
- package/qui/web/__init__.py +0 -0
- package/qui/web/tornado.py +220 -0
- package/scripts/postinstall.sh +10 -0
- package/webpack/webpack-adjust-css-urls-loader.js +36 -0
- package/webpack/webpack-common.js +384 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
|
|
2
|
+
import $ from '$qui/lib/jquery.module.js'
|
|
3
|
+
import Logger from '$qui/lib/logger.module.js'
|
|
4
|
+
|
|
5
|
+
import Config from '$qui/config.js'
|
|
6
|
+
import * as MenuBar from '$qui/main-ui/menu-bar.js'
|
|
7
|
+
import * as OptionsBar from '$qui/main-ui/options-bar.js'
|
|
8
|
+
import * as TopBar from '$qui/main-ui/top-bar.js'
|
|
9
|
+
import * as Navigation from '$qui/navigation.js'
|
|
10
|
+
import * as ArrayUtils from '$qui/utils/array.js'
|
|
11
|
+
import * as HTML from '$qui/utils/html.js'
|
|
12
|
+
import * as Window from '$qui/window.js'
|
|
13
|
+
|
|
14
|
+
import * as Pages from './pages.js'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const MAX_BREADCRUMBS = 10
|
|
18
|
+
const logger = Logger.get('qui.pages')
|
|
19
|
+
|
|
20
|
+
let breadcrumbsContainer = null
|
|
21
|
+
let menuButton = null
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export function update() {
|
|
25
|
+
let currentContext = Pages.getCurrentContext()
|
|
26
|
+
|
|
27
|
+
breadcrumbsContainer.children('div.qui-breadcrumb').removeClass('used selected back last first-used')
|
|
28
|
+
|
|
29
|
+
currentContext.getPages().forEach(function (page, i) {
|
|
30
|
+
if (!page.getTitle()) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let breadcrumb = breadcrumbsContainer.children(`div.qui-breadcrumb:eq(${i})`)
|
|
35
|
+
breadcrumb.addClass('used')
|
|
36
|
+
breadcrumb.html(page.getTitle())
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
breadcrumbsContainer.children('div.qui-breadcrumb.used:first').addClass('first-used')
|
|
40
|
+
|
|
41
|
+
let lastIndex = 0
|
|
42
|
+
currentContext.getPages().forEach(function (page, i) {
|
|
43
|
+
if (!page.getTitle()) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let breadcrumb = breadcrumbsContainer.children(`div.qui-breadcrumb:eq(${i})`)
|
|
48
|
+
breadcrumb.toggleClass('selected', i === currentContext.getSize() - 1)
|
|
49
|
+
breadcrumb.toggleClass('back', (i === currentContext.getSize() - 2) && (i >= 0) && Window.isSmallScreen())
|
|
50
|
+
|
|
51
|
+
lastIndex = i
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
let breadcrumb = breadcrumbsContainer.children(`div.qui-breadcrumb:eq(${lastIndex})`)
|
|
55
|
+
breadcrumb.addClass('last')
|
|
56
|
+
|
|
57
|
+
/* Update window title */
|
|
58
|
+
let windowTitle = Config.appDisplayName
|
|
59
|
+
let currentPageTitle = null
|
|
60
|
+
if (currentContext.getSize()) {
|
|
61
|
+
let currentPage = currentContext.getCurrentPage()
|
|
62
|
+
if (currentPage.getTitle()) {
|
|
63
|
+
currentPageTitle = currentPage.getTitle()
|
|
64
|
+
windowTitle += ` - ${currentPageTitle}`
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Set menu button visibility */
|
|
69
|
+
let menuButtonVisible = true
|
|
70
|
+
if (Window.isSmallScreen() && currentContext.getSize() > 1) {
|
|
71
|
+
menuButtonVisible = false
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
menuButton.toggleClass('hidden', !menuButtonVisible)
|
|
75
|
+
|
|
76
|
+
/* Update top bar title */
|
|
77
|
+
TopBar.setTitle(currentPageTitle)
|
|
78
|
+
|
|
79
|
+
/* Update document title */
|
|
80
|
+
document.title = HTML.plainText(windowTitle)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function init() {
|
|
84
|
+
breadcrumbsContainer = $('div.qui-breadcrumbs-container')
|
|
85
|
+
menuButton = $('div.qui-top-bar > div.qui-menu-button')
|
|
86
|
+
|
|
87
|
+
/* Create placeholders for breadcrumbs */
|
|
88
|
+
ArrayUtils.range(0, MAX_BREADCRUMBS).forEach(function (i) {
|
|
89
|
+
let breadcrumb = $('<div></div>', {class: 'qui-base-button qui-breadcrumb'})
|
|
90
|
+
breadcrumb.attr('data-index', i)
|
|
91
|
+
breadcrumbsContainer.append(breadcrumb)
|
|
92
|
+
|
|
93
|
+
breadcrumb.on('click', function () {
|
|
94
|
+
let currentContext = Pages.getCurrentContext()
|
|
95
|
+
|
|
96
|
+
/* Close menu and option bars when clicking on a breadcrumb */
|
|
97
|
+
MenuBar.close()
|
|
98
|
+
OptionsBar.close()
|
|
99
|
+
|
|
100
|
+
if (currentContext.getSize() <= i + 1) {
|
|
101
|
+
return /* Already there */
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let state = Navigation.getCurrentHistoryEntryState()
|
|
105
|
+
let isBackButton = breadcrumb.hasClass('back')
|
|
106
|
+
|
|
107
|
+
/* Close all pages following the page associated to clicked breadcrumb */
|
|
108
|
+
let page = currentContext.getPageAt(i + 1)
|
|
109
|
+
if (page) {
|
|
110
|
+
if ((Navigation.getBackMode() === Navigation.BACK_MODE_CLOSE) && isBackButton) {
|
|
111
|
+
window.history.back()
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
page.close().then(function () {
|
|
115
|
+
Navigation.addHistoryEntry(state)
|
|
116
|
+
Navigation.updateHistoryEntry()
|
|
117
|
+
}).catch(function () {
|
|
118
|
+
logger.debug('breadcrumb navigation cancelled by rejected page close')
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
import $ from '$qui/lib/jquery.module.js'
|
|
3
|
+
|
|
4
|
+
import {mix} from '$qui/base/mixwith.js'
|
|
5
|
+
import * as ObjectUtils from '$qui/utils/object.js'
|
|
6
|
+
|
|
7
|
+
import PageMixin from '../page.js'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A modal page with a progress widget and an optional message.
|
|
12
|
+
* @alias qui.pages.commonpages.ModalProgressPage
|
|
13
|
+
* @mixes qui.pages.PageMixin
|
|
14
|
+
*/
|
|
15
|
+
class ModalProgressPage extends mix().with(PageMixin) {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @constructs
|
|
19
|
+
* @param {String} [message] an optional progress message
|
|
20
|
+
* @param {Number} [progressPercent] initial progress percent (defaults to `-1`)
|
|
21
|
+
* @param {Object} [progressOptions] extra options for the progress widget
|
|
22
|
+
* @param {...*} args parent class parameters
|
|
23
|
+
*/
|
|
24
|
+
constructor({message = null, progressPercent = -1, progressOptions = {}, ...args} = {}) {
|
|
25
|
+
args.modal = true
|
|
26
|
+
|
|
27
|
+
super(args)
|
|
28
|
+
|
|
29
|
+
this._progressPercent = progressPercent
|
|
30
|
+
this._progressOptions = progressOptions
|
|
31
|
+
this._message = message
|
|
32
|
+
|
|
33
|
+
this._progressWidget = null
|
|
34
|
+
this._messageContainer = null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
makeHTML() {
|
|
38
|
+
let panelDiv = $('<div></div>', {class: 'qui-modal-progress-page-panel'})
|
|
39
|
+
let containerDiv = $('<div></div>', {class: 'qui-modal-progress-page-container'})
|
|
40
|
+
containerDiv.append(panelDiv)
|
|
41
|
+
|
|
42
|
+
let progressOptions = ObjectUtils.copy(this._progressOptions)
|
|
43
|
+
ObjectUtils.setDefault(progressOptions, 'radius', '2em')
|
|
44
|
+
this._progressWidget = $('<div></div>', {class: 'qui-modal-progress-page-progress-widget'})
|
|
45
|
+
this._progressWidget.progressdisk(progressOptions)
|
|
46
|
+
this._progressWidget.progressdisk('setValue', this._progressPercent)
|
|
47
|
+
|
|
48
|
+
this._messageContainer = $('<div></div>', {class: 'qui-modal-progress-page-message'})
|
|
49
|
+
this._messageContainer.html(this._message)
|
|
50
|
+
this._messageContainer.toggleClass('empty', !this._message)
|
|
51
|
+
|
|
52
|
+
panelDiv.append(this._progressWidget).append(this._messageContainer)
|
|
53
|
+
|
|
54
|
+
return containerDiv
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Update the percent value of the progress widget.
|
|
59
|
+
* @param {Number} percent
|
|
60
|
+
*/
|
|
61
|
+
setProgressPercent(percent) {
|
|
62
|
+
this.getPageHTML() /* Ensure all HTML elements are created */
|
|
63
|
+
|
|
64
|
+
this._progressPercent = percent
|
|
65
|
+
this._progressWidget.progressdisk('setValue', percent)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Set or clear the progress message.
|
|
70
|
+
* @param {?String} message the message to set, or `null` to clear the existing message
|
|
71
|
+
*/
|
|
72
|
+
setMessage(message) {
|
|
73
|
+
this.getPageHTML() /* Ensure all HTML elements are created */
|
|
74
|
+
|
|
75
|
+
this._message = message
|
|
76
|
+
this._messageContainer.html(message || '')
|
|
77
|
+
this._messageContainer.toggleClass('empty', !this._message)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export default ModalProgressPage
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
import {Mixin} from '$qui/base/mixwith.js'
|
|
3
|
+
import {mix} from '$qui/base/mixwith.js'
|
|
4
|
+
import StockIcon from '$qui/icons/stock-icon.js'
|
|
5
|
+
import {StructuredViewMixin} from '$qui/views/common-views/common-views.js'
|
|
6
|
+
|
|
7
|
+
import PageMixin from '../page.js'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/** @lends qui.pages.commonpages.StructuredPageMixin */
|
|
11
|
+
const StructuredPageMixin = Mixin((superclass = Object) => {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A mixin that combines {@link qui.views.commonviews.StructuredViewMixin} and {@link qui.pages.PageMixin}.
|
|
15
|
+
* @alias qui.pages.commonpages.StructuredPageMixin
|
|
16
|
+
* @mixin
|
|
17
|
+
* @extends qui.views.commonviews.StructuredViewMixin
|
|
18
|
+
* @mixes qui.pages.PageMixin
|
|
19
|
+
*/
|
|
20
|
+
class StructuredPageMixin extends mix(StructuredViewMixin(superclass)).with(PageMixin) {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @constructs
|
|
24
|
+
* @param {...*} args parent class parameters
|
|
25
|
+
*/
|
|
26
|
+
constructor({...args} = {}) {
|
|
27
|
+
super(args)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
prepareIcon(icon) {
|
|
31
|
+
/* Popup page views should normally have the default foreground icon color, even on small screens */
|
|
32
|
+
if (this.isPopup() && (icon instanceof StockIcon)) {
|
|
33
|
+
icon = icon.alterDefault({variant: 'foreground'})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return super.prepareIcon(icon)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return StructuredPageMixin
|
|
42
|
+
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export default StructuredPageMixin
|