@wirenboard/json-editor 2.5.3-wb13
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/.env-dist +2 -0
- package/.eslintrc +7 -0
- package/.gitattributes +1 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +9 -0
- package/.github/issue_template +25 -0
- package/.github/workflows/build.yml +58 -0
- package/.travis.yml +70 -0
- package/CHANGELOG.md +915 -0
- package/CONTRIBUTING.md +92 -0
- package/LICENSE +20 -0
- package/Makefile +26 -0
- package/README.md +1646 -0
- package/README_ADDON.md +573 -0
- package/UPGRADING.md +46 -0
- package/build/CssToJson.js +55 -0
- package/codecept.conf.js +35 -0
- package/config/.eslintrc +7 -0
- package/config/codeceptjs_helpers.js +139 -0
- package/config/helpers.js +10 -0
- package/config/karma.conf.js +93 -0
- package/config/readme.md +31 -0
- package/config/webpack.common.js +75 -0
- package/config/webpack.dev.js +15 -0
- package/config/webpack.nonmin.js +19 -0
- package/config/webpack.prod.js +25 -0
- package/dist/jsoneditor.js +14 -0
- package/dist/nonmin/jsoneditor.js +29097 -0
- package/dist/nonmin/jsoneditor.js.map +1 -0
- package/docs/ace_editor.html +56 -0
- package/docs/advanced.html +136 -0
- package/docs/basic.html +63 -0
- package/docs/basic_person.json +26 -0
- package/docs/choices.html +86 -0
- package/docs/cleave.html +132 -0
- package/docs/colorpicker.html +194 -0
- package/docs/css_integration.html +135 -0
- package/docs/datetime.html +305 -0
- package/docs/describedby.html +161 -0
- package/docs/enumsource.html +67 -0
- package/docs/images/categoriesDemo.png +0 -0
- package/docs/images/inheritance_tree.png +0 -0
- package/docs/images/jsoneditor.png +0 -0
- package/docs/imask.html +192 -0
- package/docs/index.html +579 -0
- package/docs/materialize_css.html +164 -0
- package/docs/meta_schema.json +705 -0
- package/docs/multiple_upload_base64.html +65 -0
- package/docs/person.json +73 -0
- package/docs/polyfills/assign.js +29 -0
- package/docs/radio.html +156 -0
- package/docs/recursive.html +170 -0
- package/docs/select2.html +99 -0
- package/docs/selectize.html +100 -0
- package/docs/signature.html +42 -0
- package/docs/starrating.html +137 -0
- package/docs/upload.html +131 -0
- package/docs/uuid.html +70 -0
- package/docs/wysiwyg.html +56 -0
- package/jasmine.json +11 -0
- package/json-editor-json-editor-2.5.3-wb13.tgz +0 -0
- package/package.json +100 -0
- package/release-notes.md +88 -0
- package/src/core.js +412 -0
- package/src/defaults.js +402 -0
- package/src/editor.js +707 -0
- package/src/editors/ace.js +89 -0
- package/src/editors/array/choices.js +103 -0
- package/src/editors/array/select2.js +110 -0
- package/src/editors/array/selectize.js +103 -0
- package/src/editors/array.css +9 -0
- package/src/editors/array.css.js +3 -0
- package/src/editors/array.js +818 -0
- package/src/editors/autocomplete.js +58 -0
- package/src/editors/base64.js +157 -0
- package/src/editors/button.js +97 -0
- package/src/editors/checkbox.js +95 -0
- package/src/editors/choices.css +3 -0
- package/src/editors/choices.css.js +3 -0
- package/src/editors/choices.js +69 -0
- package/src/editors/colorpicker.js +103 -0
- package/src/editors/datetime.js +141 -0
- package/src/editors/describedby.js +188 -0
- package/src/editors/enum.js +136 -0
- package/src/editors/hidden.js +127 -0
- package/src/editors/index.js +81 -0
- package/src/editors/info.js +20 -0
- package/src/editors/integer.js +19 -0
- package/src/editors/ip.js +36 -0
- package/src/editors/jodit.js +64 -0
- package/src/editors/multiple.js +409 -0
- package/src/editors/multiselect.js +218 -0
- package/src/editors/null.js +18 -0
- package/src/editors/number.js +51 -0
- package/src/editors/object.css +41 -0
- package/src/editors/object.css.js +3 -0
- package/src/editors/object.js +1290 -0
- package/src/editors/radio.js +111 -0
- package/src/editors/sceditor.js +72 -0
- package/src/editors/select.js +370 -0
- package/src/editors/select2.js +110 -0
- package/src/editors/selectize.js +112 -0
- package/src/editors/signature.js +113 -0
- package/src/editors/simplemde.js +100 -0
- package/src/editors/starrating.css +52 -0
- package/src/editors/starrating.css.js +3 -0
- package/src/editors/starrating.js +135 -0
- package/src/editors/stepper.js +27 -0
- package/src/editors/string.js +372 -0
- package/src/editors/table.js +516 -0
- package/src/editors/upload.js +321 -0
- package/src/editors/uuid.js +56 -0
- package/src/iconlib.js +24 -0
- package/src/iconlibs/bootstrap2.js +28 -0
- package/src/iconlibs/bootstrap3.js +28 -0
- package/src/iconlibs/fontawesome3.js +28 -0
- package/src/iconlibs/fontawesome4.js +28 -0
- package/src/iconlibs/fontawesome5.js +28 -0
- package/src/iconlibs/foundation2.js +24 -0
- package/src/iconlibs/foundation3.js +28 -0
- package/src/iconlibs/index.js +25 -0
- package/src/iconlibs/jqueryui.js +28 -0
- package/src/iconlibs/materialicons.js +49 -0
- package/src/iconlibs/openiconic.js +28 -0
- package/src/iconlibs/spectre.js +28 -0
- package/src/resolvers.js +128 -0
- package/src/schemaloader.js +408 -0
- package/src/style.css +150 -0
- package/src/style.css.js +3 -0
- package/src/templates/default.js +52 -0
- package/src/templates/ejs.js +13 -0
- package/src/templates/handlebars.js +1 -0
- package/src/templates/hogan.js +10 -0
- package/src/templates/index.js +21 -0
- package/src/templates/lodash.js +9 -0
- package/src/templates/markup.js +9 -0
- package/src/templates/mustache.js +9 -0
- package/src/templates/swig.js +1 -0
- package/src/templates/underscore.js +9 -0
- package/src/theme.js +659 -0
- package/src/themes/barebones.css +35 -0
- package/src/themes/barebones.css.js +3 -0
- package/src/themes/barebones.js +28 -0
- package/src/themes/bootstrap2.js +319 -0
- package/src/themes/bootstrap3.css +0 -0
- package/src/themes/bootstrap3.css.js +3 -0
- package/src/themes/bootstrap3.js +315 -0
- package/src/themes/bootstrap4.css +89 -0
- package/src/themes/bootstrap4.css.js +3 -0
- package/src/themes/bootstrap4.js +690 -0
- package/src/themes/bootstrap5.css.js +3 -0
- package/src/themes/foundation.js +569 -0
- package/src/themes/html.css +60 -0
- package/src/themes/html.css.js +3 -0
- package/src/themes/html.js +71 -0
- package/src/themes/index.js +28 -0
- package/src/themes/jqueryui.js +198 -0
- package/src/themes/materialize.js +426 -0
- package/src/themes/spectre.css +208 -0
- package/src/themes/spectre.css.js +3 -0
- package/src/themes/spectre.js +406 -0
- package/src/themes/tailwind.css +249 -0
- package/src/themes/tailwind.css.js +3 -0
- package/src/themes/tailwind.js +443 -0
- package/src/utilities.js +138 -0
- package/src/validator.js +877 -0
- package/src/validators/ip-validator.js +51 -0
- package/tests/Dockerfile +3 -0
- package/tests/README.md +48 -0
- package/tests/codeceptjs/codecept.json +42 -0
- package/tests/codeceptjs/constrains/if-then-else_test.js +143 -0
- package/tests/codeceptjs/core_test.js +217 -0
- package/tests/codeceptjs/editors/advanced_test.js +13 -0
- package/tests/codeceptjs/editors/array_any_of_test.js +50 -0
- package/tests/codeceptjs/editors/array_test.js +900 -0
- package/tests/codeceptjs/editors/button_test.js +35 -0
- package/tests/codeceptjs/editors/checkbox_test.js +21 -0
- package/tests/codeceptjs/editors/colorpicker_test.js +27 -0
- package/tests/codeceptjs/editors/datetime_test.js +33 -0
- package/tests/codeceptjs/editors/inheritance_test.js +11 -0
- package/tests/codeceptjs/editors/integer_test.js +84 -0
- package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +32 -0
- package/tests/codeceptjs/editors/jodit_test.js +24 -0
- package/tests/codeceptjs/editors/multiselect_test.js +8 -0
- package/tests/codeceptjs/editors/number_test.js +82 -0
- package/tests/codeceptjs/editors/object_test.js +204 -0
- package/tests/codeceptjs/editors/option-no_default_values_test.js +42 -0
- package/tests/codeceptjs/editors/programmatic-changes_test.js +20 -0
- package/tests/codeceptjs/editors/radio_test.js +10 -0
- package/tests/codeceptjs/editors/rating_test.js +13 -0
- package/tests/codeceptjs/editors/select_test.js +22 -0
- package/tests/codeceptjs/editors/stepper_test.js +27 -0
- package/tests/codeceptjs/editors/string_test.js +118 -0
- package/tests/codeceptjs/editors/table-confirm-delete_test.js +67 -0
- package/tests/codeceptjs/editors/tabs_test.js +14 -0
- package/tests/codeceptjs/editors/uuid_test.js +21 -0
- package/tests/codeceptjs/editors/validation_test.js +14 -0
- package/tests/codeceptjs/meta-schema_test.js +17 -0
- package/tests/codeceptjs/schemaloader_test.js +13 -0
- package/tests/codeceptjs/steps.d.ts +13 -0
- package/tests/codeceptjs/steps_file.js +12 -0
- package/tests/codeceptjs/themes_test.js +519 -0
- package/tests/docker-compose.yml +34 -0
- package/tests/fixtures/basic_person.json +26 -0
- package/tests/fixtures/nested_object.json +26 -0
- package/tests/fixtures/person.json +55 -0
- package/tests/fixtures/recursive.json +8 -0
- package/tests/fixtures/some_types.json +32 -0
- package/tests/fixtures/string.json +3 -0
- package/tests/fixtures/validation.json +1140 -0
- package/tests/pages/_demo.html +475 -0
- package/tests/pages/advanced.html +137 -0
- package/tests/pages/anyof.html +80 -0
- package/tests/pages/array-anyof.html +142 -0
- package/tests/pages/array-checkboxes.html +41 -0
- package/tests/pages/array-choices.html +45 -0
- package/tests/pages/array-integers.html +37 -0
- package/tests/pages/array-move-events.html +61 -0
- package/tests/pages/array-multiselects.html +42 -0
- package/tests/pages/array-nested-arrays.html +40 -0
- package/tests/pages/array-numbers.html +37 -0
- package/tests/pages/array-objects.html +42 -0
- package/tests/pages/array-ratings.html +40 -0
- package/tests/pages/array-selectize.html +51 -0
- package/tests/pages/array-selects.html +36 -0
- package/tests/pages/array-strings.html +36 -0
- package/tests/pages/array.html +42 -0
- package/tests/pages/assets/pages.css +130 -0
- package/tests/pages/button-callbacks.html +77 -0
- package/tests/pages/checkbox-labels.html +114 -0
- package/tests/pages/colorpicker-no-3rd-party.html +43 -0
- package/tests/pages/colorpicker-use-vanilla-picker.html +50 -0
- package/tests/pages/core.html +118 -0
- package/tests/pages/datetime.html +76 -0
- package/tests/pages/form-name.html +108 -0
- package/tests/pages/grid-strict.html +311 -0
- package/tests/pages/grid.html +284 -0
- package/tests/pages/if-then-else-allOf.html +117 -0
- package/tests/pages/inheritance.html +76 -0
- package/tests/pages/integer.html +68 -0
- package/tests/pages/issues/_template.html +50 -0
- package/tests/pages/issues/issue-gh-812.html +110 -0
- package/tests/pages/issues/issue-gh-823-meta-schema.html +35 -0
- package/tests/pages/issues/issue-gh-848.html +81 -0
- package/tests/pages/meta_schema.json +705 -0
- package/tests/pages/number.html +89 -0
- package/tests/pages/object-no-additional-properties.html +65 -0
- package/tests/pages/object-no-duplicated-id.html +68 -0
- package/tests/pages/object-required-properties.html +236 -0
- package/tests/pages/object-with-dependencies-array.html +46 -0
- package/tests/pages/object-with-dependencies.html +60 -0
- package/tests/pages/object.html +79 -0
- package/tests/pages/oneof.html +103 -0
- package/tests/pages/option-no_default_values.html +58 -0
- package/tests/pages/programmatic-changes.html +120 -0
- package/tests/pages/read-only.html +105 -0
- package/tests/pages/select.html +41 -0
- package/tests/pages/stepper.html +59 -0
- package/tests/pages/string-ace-editor.html +52 -0
- package/tests/pages/string-cleave.html +46 -0
- package/tests/pages/string-custom-attributes.html +62 -0
- package/tests/pages/string-formats.html +52 -0
- package/tests/pages/string-formats2.html +57 -0
- package/tests/pages/string-jodit-editor.html +49 -0
- package/tests/pages/string-sceditor.html +62 -0
- package/tests/pages/table-move-events.html +56 -0
- package/tests/pages/table.html +46 -0
- package/tests/pages/tabs.html +131 -0
- package/tests/pages/themes.html +527 -0
- package/tests/pages/translate-property.html +247 -0
- package/tests/pages/urn.html +93 -0
- package/tests/pages/uuid.html +72 -0
- package/tests/pages/validation.html +99 -0
- package/tests/unit/.eslintrc +8 -0
- package/tests/unit/core.spec.js +309 -0
- package/tests/unit/defaults.spec.js +40 -0
- package/tests/unit/editor.spec.js +160 -0
- package/tests/unit/editors/array.spec.js +86 -0
- package/tests/unit/editors/object.spec.js +79 -0
- package/tests/unit/editors/table.spec.js +91 -0
- package/tests/unit/readme.md +35 -0
- package/tests/unit/schemaloader.spec.js +498 -0
- package/tests/unit/validator.spec.js +94 -0
- package/tests/unit/validators/ip-validator.spec.js +62 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { AbstractEditor } from '../editor.js'
|
|
2
|
+
import { extend } from '../utilities.js'
|
|
3
|
+
|
|
4
|
+
export class UploadEditor extends AbstractEditor {
|
|
5
|
+
getNumColumns () {
|
|
6
|
+
return 4
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
build () {
|
|
10
|
+
if (!this.options.compact) this.header = this.label = this.theme.getFormInputLabel(this.getTitle(), this.isRequired())
|
|
11
|
+
if (this.schema.description) this.description = this.theme.getFormInputDescription(this.translateProperty(this.schema.description))
|
|
12
|
+
if (this.options.infoText) this.infoButton = this.theme.getInfoButton(this.translateProperty(this.options.infoText))
|
|
13
|
+
|
|
14
|
+
/* Editor options */
|
|
15
|
+
this.options = this.expandCallbacks('upload', extend({}, {
|
|
16
|
+
title: 'Browse',
|
|
17
|
+
icon: '',
|
|
18
|
+
auto_upload: false, /* Trigger file upload button automatically */
|
|
19
|
+
hide_input: false, /* Hide the Browse button and name display (Only works if 'enable_drag_drop' is true) */
|
|
20
|
+
enable_drag_drop: false, /* Enable Drag&Drop uploading */
|
|
21
|
+
drop_zone_text: 'Drag & Drop file here', /* Text displayed in dropzone box */
|
|
22
|
+
drop_zone_top: false, /* Position of dropzone. true=before button input, false=after button input */
|
|
23
|
+
alt_drop_zone: '', /* Alternate DropZone DOM selector (Can be created inside another property) */
|
|
24
|
+
mime_type: '', /* If set, restricts to mime type(s). Can be either a string or an array */
|
|
25
|
+
max_upload_size: 0, /* Maximum file size allowed. 0 = no limit */
|
|
26
|
+
upload_handler: (jseditor, type, file, cbs) => {
|
|
27
|
+
/* Default dummy test upload handler */
|
|
28
|
+
window.alert(`No upload_handler defined for "${jseditor.path}". You must create your own handler to enable upload to server`)
|
|
29
|
+
}
|
|
30
|
+
}, this.defaults.options.upload || {}, this.options.upload || {}))
|
|
31
|
+
|
|
32
|
+
this.options.mime_type = this.options.mime_type ? [].concat(this.options.mime_type) : []
|
|
33
|
+
|
|
34
|
+
/* Input that holds the base64 string */
|
|
35
|
+
this.input = this.theme.getFormInputField('hidden')
|
|
36
|
+
this.container.appendChild(this.input)
|
|
37
|
+
|
|
38
|
+
/* Don't show uploader if this is readonly */
|
|
39
|
+
if (!this.schema.readOnly && !this.schema.readonly) {
|
|
40
|
+
if (typeof this.options.upload_handler !== 'function') throw new Error('Upload handler required for upload editor')
|
|
41
|
+
|
|
42
|
+
/* File uploader */
|
|
43
|
+
this.uploader = this.theme.getFormInputField('file')
|
|
44
|
+
this.uploader.style.display = 'none'
|
|
45
|
+
if (this.options.mime_type.length) this.uploader.setAttribute('accept', this.options.mime_type)
|
|
46
|
+
|
|
47
|
+
if (!(this.options.enable_drag_drop === true && this.options.hide_input === true)) {
|
|
48
|
+
/* Pass click to this.uploader element */
|
|
49
|
+
this.clickHandler = (e) => {
|
|
50
|
+
this.uploader.dispatchEvent(new window.MouseEvent('click', {
|
|
51
|
+
view: window,
|
|
52
|
+
bubbles: true,
|
|
53
|
+
cancelable: false
|
|
54
|
+
}))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Browse button */
|
|
58
|
+
this.browseButton = this.getButton(this.options.title, this.options.icon, this.options.title)
|
|
59
|
+
this.browseButton.addEventListener('click', this.clickHandler)
|
|
60
|
+
|
|
61
|
+
/* Display field */
|
|
62
|
+
this.fileDisplay = this.theme.getFormInputField('input')
|
|
63
|
+
this.fileDisplay.setAttribute('readonly', true)
|
|
64
|
+
this.fileDisplay.value = 'No file selected.'
|
|
65
|
+
this.fileDisplay.addEventListener('dblclick', this.clickHandler)
|
|
66
|
+
|
|
67
|
+
this.fileUploadGroup = this.theme.getInputGroup(this.fileDisplay, [this.browseButton])
|
|
68
|
+
if (!this.fileUploadGroup) {
|
|
69
|
+
/* Themes that doesn't support input grouping */
|
|
70
|
+
this.fileUploadGroup = document.createElement('div')
|
|
71
|
+
this.fileUploadGroup.appendChild(this.fileDisplay)
|
|
72
|
+
this.fileUploadGroup.appendChild(this.browseButton)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Drag&Drop upload enabled */
|
|
77
|
+
if (this.options.enable_drag_drop === true) {
|
|
78
|
+
/* Alternate DropZone defined */
|
|
79
|
+
if (this.options.alt_drop_zone !== '') {
|
|
80
|
+
this.altDropZone = document.querySelector(this.options.alt_drop_zone)
|
|
81
|
+
if (this.altDropZone) this.dropZone = this.altDropZone
|
|
82
|
+
else throw new Error(`Error: alt_drop_zone selector "${this.options.alt_drop_zone}" not found!`)
|
|
83
|
+
} else this.dropZone = this.theme.getDropZone(this.options.drop_zone_text)
|
|
84
|
+
|
|
85
|
+
if (this.dropZone) {
|
|
86
|
+
this.dropZone.classList.add('upload-dropzone')
|
|
87
|
+
this.dropZone.addEventListener('dblclick', this.clickHandler)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Triggered after file have been selected */
|
|
92
|
+
this.uploadHandler = (e) => {
|
|
93
|
+
e.preventDefault()
|
|
94
|
+
e.stopPropagation()
|
|
95
|
+
const files = e.target.files || e.dataTransfer.files
|
|
96
|
+
if (files && files.length) {
|
|
97
|
+
if (this.options.max_upload_size !== 0 && files[0].size > this.options.max_upload_size) {
|
|
98
|
+
this.theme.addInputError(this.uploader, `Filesize too large. Max size is ${this.options.max_upload_size}`)
|
|
99
|
+
} else if (this.options.mime_type.length !== 0 && !this.isValidMimeType(files[0].type, this.options.mime_type)) {
|
|
100
|
+
this.theme.addInputError(this.uploader, `Wrong file format. Allowed format(s): ${this.options.mime_type.toString()}`)
|
|
101
|
+
} else {
|
|
102
|
+
if (this.fileDisplay) this.fileDisplay.value = files[0].name
|
|
103
|
+
let fr = new window.FileReader()
|
|
104
|
+
fr.onload = (evt) => {
|
|
105
|
+
this.preview_value = evt.target.result
|
|
106
|
+
this.refreshPreview(files)
|
|
107
|
+
this.onChange(true)
|
|
108
|
+
fr = null
|
|
109
|
+
}
|
|
110
|
+
fr.readAsDataURL(files[0])
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
this.uploader.addEventListener('change', this.uploadHandler)
|
|
116
|
+
|
|
117
|
+
/* Drag&Drop Event Handler */
|
|
118
|
+
this.dragHandler = e => {
|
|
119
|
+
const files = e.dataTransfer.items || e.dataTransfer.files
|
|
120
|
+
const validType = files && files.length && (this.options.mime_type.length === 0 || this.isValidMimeType(files[0].type, this.options.mime_type))
|
|
121
|
+
const validZone = e.currentTarget.classList && e.currentTarget.classList.contains('upload-dropzone') && validType
|
|
122
|
+
switch ((e.currentTarget === window ? 'w_' : 'e_') + e.type) {
|
|
123
|
+
case 'w_drop':
|
|
124
|
+
case 'w_dragover':
|
|
125
|
+
/* prevent default browser action if dropped outside dropzone */
|
|
126
|
+
if (!validZone) e.dataTransfer.dropEffect = 'none'
|
|
127
|
+
break
|
|
128
|
+
case 'e_dragenter': {
|
|
129
|
+
if (validZone) {
|
|
130
|
+
this.dropZone.classList.add('valid-dropzone')
|
|
131
|
+
e.dataTransfer.dropEffect = 'copy'
|
|
132
|
+
} else this.dropZone.classList.add('invalid-dropzone')
|
|
133
|
+
break
|
|
134
|
+
}
|
|
135
|
+
case 'e_dragover': {
|
|
136
|
+
if (validZone) e.dataTransfer.dropEffect = 'copy'
|
|
137
|
+
break
|
|
138
|
+
}
|
|
139
|
+
case 'e_dragleave':
|
|
140
|
+
this.dropZone.classList.remove('valid-dropzone', 'invalid-dropzone')
|
|
141
|
+
break
|
|
142
|
+
case 'e_drop': {
|
|
143
|
+
this.dropZone.classList.remove('valid-dropzone', 'invalid-dropzone')
|
|
144
|
+
if (validZone) this.uploadHandler(e)
|
|
145
|
+
break
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!validZone) e.preventDefault()
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Set Drag'n'Drop handlers */
|
|
152
|
+
if (this.options.enable_drag_drop === true) {
|
|
153
|
+
['dragover', 'drop'].forEach((ev) => {
|
|
154
|
+
window.addEventListener(ev, this.dragHandler, true)
|
|
155
|
+
});
|
|
156
|
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach((ev) => {
|
|
157
|
+
this.dropZone.addEventListener(ev, this.dragHandler, true)
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
this.preview = document.createElement('div')
|
|
163
|
+
|
|
164
|
+
this.control = this.input.controlgroup = this.theme.getFormControl(this.label, this.uploader || this.input, this.description, this.infoButton)
|
|
165
|
+
if (this.uploader) this.uploader.controlgroup = this.control
|
|
166
|
+
const inputNode = this.uploader || this.input
|
|
167
|
+
const elements = document.createElement('div')
|
|
168
|
+
|
|
169
|
+
if (this.dropZone && !this.altDropZone && this.options.drop_zone_top === true) elements.appendChild(this.dropZone)
|
|
170
|
+
if (this.fileUploadGroup) elements.appendChild(this.fileUploadGroup)
|
|
171
|
+
if (this.dropZone && !this.altDropZone && this.options.drop_zone_top !== true) elements.appendChild(this.dropZone)
|
|
172
|
+
elements.appendChild(this.preview)
|
|
173
|
+
inputNode.parentNode.insertBefore(elements, inputNode.nextSibling)
|
|
174
|
+
|
|
175
|
+
this.container.appendChild(this.control)
|
|
176
|
+
|
|
177
|
+
/* Any special formatting that needs to happen after the input is added to the dom */
|
|
178
|
+
window.requestAnimationFrame(() => {
|
|
179
|
+
this.afterInputReady()
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
afterInputReady () {
|
|
184
|
+
if (this.value) {
|
|
185
|
+
const img = document.createElement('img')
|
|
186
|
+
img.style.maxWidth = '100%'
|
|
187
|
+
img.style.maxHeight = '100px'
|
|
188
|
+
img.onload = (event) => {
|
|
189
|
+
this.preview.appendChild(img)
|
|
190
|
+
}
|
|
191
|
+
img.onerror = error => {
|
|
192
|
+
// eslint-disable-next-line no-console
|
|
193
|
+
console.error('upload error', error, error.currentTarget)
|
|
194
|
+
}
|
|
195
|
+
img.src = this.container.querySelector('a').href
|
|
196
|
+
}
|
|
197
|
+
this.theme.afterInputReady(this.input)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
refreshPreview (files) {
|
|
201
|
+
if (this.last_preview === this.preview_value) return
|
|
202
|
+
this.last_preview = this.preview_value
|
|
203
|
+
|
|
204
|
+
this.preview.innerHTML = ''
|
|
205
|
+
|
|
206
|
+
if (!this.preview_value) return
|
|
207
|
+
|
|
208
|
+
const file = files[0]
|
|
209
|
+
|
|
210
|
+
/* mime type extracted from file data. More exact than the one in the file object */
|
|
211
|
+
const mime = this.preview_value.match(/^data:([^;,]+)[;,]/)
|
|
212
|
+
file.mimeType = mime ? mime[1] : 'unknown'
|
|
213
|
+
|
|
214
|
+
if (file.size > 0) {
|
|
215
|
+
/* Format bytes as KB/MB etc. with 2 decimals */
|
|
216
|
+
const i = Math.floor(Math.log(file.size) / Math.log(1024))
|
|
217
|
+
file.formattedSize = `${parseFloat((file.size / (1024 ** i)).toFixed(2))} ${['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'][i]}`
|
|
218
|
+
} else file.formattedSize = '0 Bytes'
|
|
219
|
+
|
|
220
|
+
const uploadButton = this.getButton('button_upload', 'upload', 'button_upload')
|
|
221
|
+
uploadButton.addEventListener('click', (event) => {
|
|
222
|
+
event.preventDefault()
|
|
223
|
+
|
|
224
|
+
uploadButton.setAttribute('disabled', 'disabled')
|
|
225
|
+
this.theme.removeInputError(this.uploader)
|
|
226
|
+
|
|
227
|
+
if (this.theme.getProgressBar) {
|
|
228
|
+
this.progressBar = this.theme.getProgressBar()
|
|
229
|
+
this.preview.appendChild(this.progressBar)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this.options.upload_handler(this.path, file, {
|
|
233
|
+
success: (url) => {
|
|
234
|
+
this.setValue(url)
|
|
235
|
+
|
|
236
|
+
if (this.parent) this.parent.onChildEditorChange(this)
|
|
237
|
+
else this.jsoneditor.onChange()
|
|
238
|
+
|
|
239
|
+
if (this.progressBar) this.preview.removeChild(this.progressBar)
|
|
240
|
+
uploadButton.removeAttribute('disabled')
|
|
241
|
+
},
|
|
242
|
+
failure: (error) => {
|
|
243
|
+
this.theme.addInputError(this.uploader, error)
|
|
244
|
+
if (this.progressBar) this.preview.removeChild(this.progressBar)
|
|
245
|
+
uploadButton.removeAttribute('disabled')
|
|
246
|
+
},
|
|
247
|
+
updateProgress: (progress) => {
|
|
248
|
+
if (this.progressBar) {
|
|
249
|
+
if (progress) this.theme.updateProgressBar(this.progressBar, progress)
|
|
250
|
+
else this.theme.updateProgressBarUnknown(this.progressBar)
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
this.preview.appendChild(this.theme.getUploadPreview(file, uploadButton, this.preview_value))
|
|
257
|
+
|
|
258
|
+
if (this.options.auto_upload) {
|
|
259
|
+
uploadButton.dispatchEvent(new window.MouseEvent('click'))
|
|
260
|
+
this.preview.removeChild(uploadButton)
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
enable () {
|
|
265
|
+
if (!this.always_disabled) {
|
|
266
|
+
if (this.uploader) this.uploader.disabled = false
|
|
267
|
+
super.enable()
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
disable (alwaysDisabled) {
|
|
272
|
+
if (alwaysDisabled) this.always_disabled = true
|
|
273
|
+
if (this.uploader) this.uploader.disabled = true
|
|
274
|
+
super.disable()
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
setValue (val) {
|
|
278
|
+
if (this.value !== val) {
|
|
279
|
+
this.value = val
|
|
280
|
+
this.input.value = this.value
|
|
281
|
+
this.onChange()
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
destroy () {
|
|
286
|
+
/* Remove Drag'n'Drop handlers */
|
|
287
|
+
if (this.options.enable_drag_drop === true) {
|
|
288
|
+
['dragover', 'drop'].forEach((ev) => {
|
|
289
|
+
window.removeEventListener(ev, this.dragHandler, true)
|
|
290
|
+
});
|
|
291
|
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach((ev) => {
|
|
292
|
+
this.dropZone.removeEventListener(ev, this.dragHandler, true)
|
|
293
|
+
})
|
|
294
|
+
this.dropZone.removeEventListener('dblclick', this.clickHandler)
|
|
295
|
+
if (this.dropZone && this.dropZone.parentNode) this.dropZone.parentNode.removeChild(this.dropZone)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (this.uploader && this.uploader.parentNode) {
|
|
299
|
+
this.uploader.removeEventListener('change', this.uploadHandler)
|
|
300
|
+
this.uploader.parentNode.removeChild(this.uploader)
|
|
301
|
+
}
|
|
302
|
+
if (this.browseButton && this.browseButton.parentNode) {
|
|
303
|
+
this.browseButton.removeEventListener('click', this.clickHandler)
|
|
304
|
+
this.browseButton.parentNode.removeChild(this.browseButton)
|
|
305
|
+
}
|
|
306
|
+
if (this.fileDisplay && this.fileDisplay.parentNode) {
|
|
307
|
+
this.fileDisplay.removeEventListener('dblclick', this.clickHandler)
|
|
308
|
+
this.fileDisplay.parentNode.removeChild(this.fileDisplay)
|
|
309
|
+
}
|
|
310
|
+
if (this.fileUploadGroup && this.fileUploadGroup.parentNode) this.fileUploadGroup.parentNode.removeChild(this.fileUploadGroup)
|
|
311
|
+
if (this.preview && this.preview.parentNode) this.preview.parentNode.removeChild(this.preview)
|
|
312
|
+
if (this.header && this.header.parentNode) this.header.parentNode.removeChild(this.header)
|
|
313
|
+
if (this.input && this.input.parentNode) this.input.parentNode.removeChild(this.input)
|
|
314
|
+
|
|
315
|
+
super.destroy()
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
isValidMimeType (mimeType, mimeTypesList) {
|
|
319
|
+
return mimeTypesList.reduce((a, v) => a || new RegExp(v.replace(/\*/g, '.*'), 'gi').test(mimeType), false)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StringEditor } from './string.js'
|
|
2
|
+
|
|
3
|
+
export class UuidEditor extends StringEditor {
|
|
4
|
+
preBuild () {
|
|
5
|
+
super.preBuild()
|
|
6
|
+
|
|
7
|
+
/* Use Schema "default" for setting autogenerated uuid */
|
|
8
|
+
this.schema.default = this.uuid = this.getUuid()
|
|
9
|
+
|
|
10
|
+
/* Set cleave options if no existing options is present */
|
|
11
|
+
if (!this.schema.options) this.schema.options = {}
|
|
12
|
+
if (!this.schema.options.cleave) {
|
|
13
|
+
this.schema.options.cleave = {
|
|
14
|
+
delimiters: ['-'],
|
|
15
|
+
blocks: [8, 4, 4, 4, 12]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
build () {
|
|
21
|
+
super.build()
|
|
22
|
+
/* Set field to readonly */
|
|
23
|
+
this.disable(true)
|
|
24
|
+
this.input.setAttribute('readonly', 'true')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
sanitize (value) {
|
|
28
|
+
if (!this.testUuid(value)) value = this.uuid
|
|
29
|
+
return value
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
setValue (value, initial, fromTemplate) {
|
|
33
|
+
if (!this.testUuid(value)) value = this.uuid
|
|
34
|
+
this.uuid = value
|
|
35
|
+
super.setValue(value, initial, fromTemplate)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getUuid () {
|
|
39
|
+
/* https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript */
|
|
40
|
+
let d = new Date().getTime()
|
|
41
|
+
|
|
42
|
+
if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
|
|
43
|
+
d += performance.now() /* use high-precision timer if available */
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
47
|
+
const r = (d + Math.random() * 16) % 16 | 0
|
|
48
|
+
d = Math.floor(d / 16)
|
|
49
|
+
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
testUuid (value) {
|
|
54
|
+
return (/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value))
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/iconlib.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
const defaultMapping = { collapse: '', expand: '', delete: '', edit: '', add: '', cancel: '', save: '', moveup: '', movedown: '' }
|
|
3
|
+
|
|
4
|
+
export class AbstractIconLib {
|
|
5
|
+
constructor (iconPrefix = '', mapping = defaultMapping) {
|
|
6
|
+
this.mapping = mapping
|
|
7
|
+
this.icon_prefix = iconPrefix
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
getIconClass (key) {
|
|
11
|
+
return this.mapping[key] ? this.icon_prefix + this.mapping[key] : null
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getIcon (key) {
|
|
15
|
+
const iconclass = this.getIconClass(key)
|
|
16
|
+
|
|
17
|
+
if (!iconclass) return null
|
|
18
|
+
|
|
19
|
+
const i = document.createElement('i')
|
|
20
|
+
i.classList.add(...iconclass.split(' '))
|
|
21
|
+
|
|
22
|
+
return i
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'icon-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'chevron-down',
|
|
6
|
+
expand: 'chevron-up',
|
|
7
|
+
delete: 'trash',
|
|
8
|
+
edit: 'pencil',
|
|
9
|
+
add: 'plus',
|
|
10
|
+
subtract: 'minus',
|
|
11
|
+
cancel: 'ban-circle',
|
|
12
|
+
save: 'ok',
|
|
13
|
+
moveup: 'arrow-up',
|
|
14
|
+
moveright: 'arrow-right',
|
|
15
|
+
movedown: 'arrow-down',
|
|
16
|
+
moveleft: 'arrow-left',
|
|
17
|
+
copy: 'copy',
|
|
18
|
+
clear: 'remove-circle',
|
|
19
|
+
time: 'time',
|
|
20
|
+
calendar: 'calendar',
|
|
21
|
+
edit_properties: 'list'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class bootstrap2Iconlib extends AbstractIconLib {
|
|
25
|
+
constructor () {
|
|
26
|
+
super(iconPrefix, mapping)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'glyphicon glyphicon-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'chevron-down',
|
|
6
|
+
expand: 'chevron-right',
|
|
7
|
+
delete: 'trash',
|
|
8
|
+
edit: 'pencil',
|
|
9
|
+
add: 'plus',
|
|
10
|
+
subtract: 'minus',
|
|
11
|
+
cancel: 'floppy-remove',
|
|
12
|
+
save: 'floppy-saved',
|
|
13
|
+
moveup: 'arrow-up',
|
|
14
|
+
moveright: 'arrow-right',
|
|
15
|
+
movedown: 'arrow-down',
|
|
16
|
+
moveleft: 'arrow-left',
|
|
17
|
+
copy: 'copy',
|
|
18
|
+
clear: 'remove-circle',
|
|
19
|
+
time: 'time',
|
|
20
|
+
calendar: 'calendar',
|
|
21
|
+
edit_properties: 'list'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class bootstrap3Iconlib extends AbstractIconLib {
|
|
25
|
+
constructor () {
|
|
26
|
+
super(iconPrefix, mapping)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'icon-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'chevron-down',
|
|
6
|
+
expand: 'chevron-right',
|
|
7
|
+
delete: 'trash',
|
|
8
|
+
edit: 'pencil',
|
|
9
|
+
add: 'plus',
|
|
10
|
+
subtract: 'minus',
|
|
11
|
+
cancel: 'ban-circle',
|
|
12
|
+
save: 'save',
|
|
13
|
+
moveup: 'arrow-up',
|
|
14
|
+
moveright: 'arrow-right',
|
|
15
|
+
movedown: 'arrow-down',
|
|
16
|
+
moveleft: 'arrow-left',
|
|
17
|
+
copy: 'copy',
|
|
18
|
+
clear: 'remove-circle',
|
|
19
|
+
time: 'time',
|
|
20
|
+
calendar: 'calendar',
|
|
21
|
+
edit_properties: 'list'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class fontawesome3Iconlib extends AbstractIconLib {
|
|
25
|
+
constructor () {
|
|
26
|
+
super(iconPrefix, mapping)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'fa fa-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'caret-square-o-down',
|
|
6
|
+
expand: 'caret-square-o-right',
|
|
7
|
+
delete: 'times',
|
|
8
|
+
edit: 'pencil',
|
|
9
|
+
add: 'plus',
|
|
10
|
+
subtract: 'minus',
|
|
11
|
+
cancel: 'ban',
|
|
12
|
+
save: 'save',
|
|
13
|
+
moveup: 'arrow-up',
|
|
14
|
+
moveright: 'arrow-right',
|
|
15
|
+
movedown: 'arrow-down',
|
|
16
|
+
moveleft: 'arrow-left',
|
|
17
|
+
copy: 'files-o',
|
|
18
|
+
clear: 'times-circle-o',
|
|
19
|
+
time: 'clock-o',
|
|
20
|
+
calendar: 'calendar',
|
|
21
|
+
edit_properties: 'list'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class fontawesome4Iconlib extends AbstractIconLib {
|
|
25
|
+
constructor () {
|
|
26
|
+
super(iconPrefix, mapping)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'fas fa-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'caret-down',
|
|
6
|
+
expand: 'caret-right',
|
|
7
|
+
delete: 'trash',
|
|
8
|
+
edit: 'pen',
|
|
9
|
+
add: 'plus',
|
|
10
|
+
subtract: 'minus',
|
|
11
|
+
cancel: 'ban',
|
|
12
|
+
save: 'save',
|
|
13
|
+
moveup: 'arrow-up',
|
|
14
|
+
moveright: 'arrow-right',
|
|
15
|
+
movedown: 'arrow-down',
|
|
16
|
+
moveleft: 'arrow-left',
|
|
17
|
+
copy: 'copy',
|
|
18
|
+
clear: 'times-circle',
|
|
19
|
+
time: 'clock',
|
|
20
|
+
calendar: 'calendar',
|
|
21
|
+
edit_properties: 'list'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class fontawesome5Iconlib extends AbstractIconLib {
|
|
25
|
+
constructor () {
|
|
26
|
+
super(iconPrefix, mapping)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'foundicon-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'minus',
|
|
6
|
+
expand: 'plus',
|
|
7
|
+
delete: 'remove',
|
|
8
|
+
edit: 'edit',
|
|
9
|
+
add: 'add-doc',
|
|
10
|
+
cancel: 'error',
|
|
11
|
+
save: 'checkmark',
|
|
12
|
+
moveup: 'up-arrow',
|
|
13
|
+
movedown: 'down-arrow',
|
|
14
|
+
copy: 'page-copy',
|
|
15
|
+
clear: 'remove',
|
|
16
|
+
time: 'clock',
|
|
17
|
+
calendar: 'calendar'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class foundation2Iconlib extends AbstractIconLib {
|
|
21
|
+
constructor () {
|
|
22
|
+
super(iconPrefix, mapping)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'fi-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'minus',
|
|
6
|
+
expand: 'plus',
|
|
7
|
+
delete: 'trash',
|
|
8
|
+
edit: 'pencil',
|
|
9
|
+
add: 'plus',
|
|
10
|
+
subtract: 'minus',
|
|
11
|
+
cancel: 'x-circle',
|
|
12
|
+
save: 'save',
|
|
13
|
+
moveup: 'arrow-up',
|
|
14
|
+
moveright: 'arrow-right',
|
|
15
|
+
movedown: 'arrow-down',
|
|
16
|
+
moveleft: 'arrow-left',
|
|
17
|
+
copy: 'page-copy',
|
|
18
|
+
clear: 'x-circle',
|
|
19
|
+
time: 'clock',
|
|
20
|
+
calendar: 'calendar',
|
|
21
|
+
edit_properties: 'list'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class foundation3Iconlib extends AbstractIconLib {
|
|
25
|
+
constructor () {
|
|
26
|
+
super(iconPrefix, mapping)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// import { bootstrap2Iconlib } from './bootstrap2.js'
|
|
2
|
+
import { bootstrap3Iconlib } from './bootstrap3.js'
|
|
3
|
+
import { fontawesome3Iconlib } from './fontawesome3.js'
|
|
4
|
+
import { fontawesome4Iconlib } from './fontawesome4.js'
|
|
5
|
+
import { fontawesome5Iconlib } from './fontawesome5.js'
|
|
6
|
+
// import { foundation2Iconlib } from './foundation2.js'
|
|
7
|
+
// import { foundation3Iconlib } from './foundation3.js'
|
|
8
|
+
import { jqueryuiIconlib } from './jqueryui.js'
|
|
9
|
+
// import { materialiconsIconlib } from './materialicons.js'
|
|
10
|
+
import { openiconicIconlib } from './openiconic.js'
|
|
11
|
+
import { spectreIconlib } from './spectre.js'
|
|
12
|
+
|
|
13
|
+
export const iconlibs = {
|
|
14
|
+
// bootstrap2: bootstrap2Iconlib,
|
|
15
|
+
bootstrap3: bootstrap3Iconlib,
|
|
16
|
+
fontawesome3: fontawesome3Iconlib,
|
|
17
|
+
fontawesome4: fontawesome4Iconlib,
|
|
18
|
+
fontawesome5: fontawesome5Iconlib,
|
|
19
|
+
// foundation2: foundation2Iconlib,
|
|
20
|
+
// foundation3: foundation3Iconlib,
|
|
21
|
+
jqueryui: jqueryuiIconlib,
|
|
22
|
+
// materialicons: materialiconsIconlib,
|
|
23
|
+
openiconic: openiconicIconlib,
|
|
24
|
+
spectre: spectreIconlib
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractIconLib } from '../iconlib.js'
|
|
2
|
+
|
|
3
|
+
const iconPrefix = 'ui-icon ui-icon-'
|
|
4
|
+
const mapping = {
|
|
5
|
+
collapse: 'triangle-1-s',
|
|
6
|
+
expand: 'triangle-1-e',
|
|
7
|
+
delete: 'trash',
|
|
8
|
+
edit: 'pencil',
|
|
9
|
+
add: 'plusthick',
|
|
10
|
+
subtract: 'minusthick',
|
|
11
|
+
cancel: 'closethick',
|
|
12
|
+
save: 'disk',
|
|
13
|
+
moveup: 'arrowthick-1-n',
|
|
14
|
+
moveright: 'arrowthick-1-e',
|
|
15
|
+
movedown: 'arrowthick-1-s',
|
|
16
|
+
moveleft: 'arrowthick-1-w',
|
|
17
|
+
copy: 'copy',
|
|
18
|
+
clear: 'circle-close',
|
|
19
|
+
time: 'time',
|
|
20
|
+
calendar: 'calendar',
|
|
21
|
+
edit_properties: 'note'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class jqueryuiIconlib extends AbstractIconLib {
|
|
25
|
+
constructor () {
|
|
26
|
+
super(iconPrefix, mapping)
|
|
27
|
+
}
|
|
28
|
+
}
|