@teipublisher/pb-components 1.44.2 → 2.1.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 (78) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/dist/demo/demos.json +6 -1
  3. package/dist/demo/pb-browse-docs.html +2 -1
  4. package/dist/demo/pb-combo-box.html +1 -1
  5. package/dist/demo/pb-document.html +2 -2
  6. package/dist/demo/pb-image-strip-standalone.html +94 -0
  7. package/dist/demo/pb-image-strip-view.html +92 -0
  8. package/dist/demo/pb-load.html +2 -2
  9. package/dist/demo/pb-select-feature.html +1 -1
  10. package/dist/demo/pb-select-feature2.html +10 -3
  11. package/dist/demo/pb-select-feature3.html +1 -1
  12. package/dist/demo/pb-select-odd.html +1 -1
  13. package/dist/demo/pb-table-grid.html +1 -1
  14. package/dist/demo/pb-tabs.html +8 -2
  15. package/dist/demo/pb-toggle-feature.html +2 -2
  16. package/dist/demo/pb-toggle-feature2.html +2 -2
  17. package/dist/demo/pb-toggle-feature3.html +2 -2
  18. package/dist/demo/pb-view.html +1 -1
  19. package/dist/demo/pb-view4.html +86 -0
  20. package/dist/pb-code-editor.js +1 -1
  21. package/dist/pb-component-docs.js +33 -33
  22. package/dist/pb-components-bundle.js +271 -261
  23. package/dist/pb-edit-app.js +6 -6
  24. package/dist/pb-elements.json +248 -29
  25. package/dist/{pb-i18n-3963b098.js → pb-i18n-8a90c591.js} +1 -1
  26. package/dist/pb-leaflet-map.js +1 -1
  27. package/dist/pb-mixin-8a593923.js +158 -0
  28. package/dist/pb-odd-editor.js +47 -47
  29. package/dist/{vaadin-element-mixin-08cf11b5.js → vaadin-element-mixin-672938e3.js} +18 -18
  30. package/i18n/common/en.json +9 -1
  31. package/package.json +4 -3
  32. package/pb-elements.json +248 -29
  33. package/src/dts-client.js +14 -14
  34. package/src/dts-select-endpoint.js +5 -5
  35. package/src/pb-ajax.js +4 -4
  36. package/src/pb-authority-lookup.js +2 -2
  37. package/src/pb-autocomplete.js +9 -11
  38. package/src/pb-blacklab-highlight.js +3 -3
  39. package/src/pb-browse-docs.js +44 -27
  40. package/src/pb-browse.js +9 -3
  41. package/src/pb-combo-box.js +2 -2
  42. package/src/pb-components.js +1 -0
  43. package/src/pb-document.js +15 -1
  44. package/src/pb-download.js +2 -2
  45. package/src/pb-edit-app.js +2 -2
  46. package/src/pb-edit-xml.js +2 -2
  47. package/src/pb-events.js +26 -18
  48. package/src/pb-facs-link.js +33 -9
  49. package/src/pb-facsimile.js +34 -31
  50. package/src/pb-grid.js +55 -53
  51. package/src/pb-image-strip.js +97 -0
  52. package/src/pb-lang.js +2 -2
  53. package/src/pb-link.js +10 -16
  54. package/src/pb-load.js +35 -25
  55. package/src/pb-login.js +2 -2
  56. package/src/pb-manage-odds.js +2 -2
  57. package/src/pb-markdown.js +2 -2
  58. package/src/pb-mei.js +2 -2
  59. package/src/pb-mixin.js +103 -196
  60. package/src/pb-odd-editor.js +2 -2
  61. package/src/pb-page.js +30 -21
  62. package/src/pb-paginate.js +24 -19
  63. package/src/pb-print-preview.js +2 -2
  64. package/src/pb-repeat.js +2 -1
  65. package/src/pb-search.js +34 -8
  66. package/src/pb-select-feature.js +62 -39
  67. package/src/pb-select-odd.js +8 -7
  68. package/src/pb-select-template.js +5 -4
  69. package/src/pb-select.js +31 -28
  70. package/src/pb-split-list.js +18 -11
  71. package/src/pb-table-grid.js +9 -8
  72. package/src/pb-tabs.js +29 -12
  73. package/src/pb-toggle-feature.js +51 -55
  74. package/src/pb-upload.js +10 -3
  75. package/src/pb-view.js +118 -95
  76. package/src/theming.js +148 -149
  77. package/src/urls.js +233 -0
  78. package/dist/pb-mixin-88125cb2.js +0 -158
package/pb-elements.json CHANGED
@@ -3172,6 +3172,11 @@
3172
3172
  "type": "string",
3173
3173
  "default": "\"\""
3174
3174
  },
3175
+ {
3176
+ "name": "disable-history",
3177
+ "type": "boolean",
3178
+ "default": "false"
3179
+ },
3175
3180
  {
3176
3181
  "name": "subscribe",
3177
3182
  "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
@@ -3236,6 +3241,12 @@
3236
3241
  "type": "string",
3237
3242
  "default": "\"\""
3238
3243
  },
3244
+ {
3245
+ "name": "disableHistory",
3246
+ "attribute": "disable-history",
3247
+ "type": "boolean",
3248
+ "default": "false"
3249
+ },
3239
3250
  {
3240
3251
  "name": "subscribe",
3241
3252
  "attribute": "subscribe",
@@ -3901,6 +3912,16 @@
3901
3912
  "type": "string",
3902
3913
  "default": "\"mouseover\""
3903
3914
  },
3915
+ {
3916
+ "name": "label",
3917
+ "type": "string",
3918
+ "default": "\"\""
3919
+ },
3920
+ {
3921
+ "name": "order",
3922
+ "type": "number",
3923
+ "default": "\"POSITIVE_INFINITY\""
3924
+ },
3904
3925
  {
3905
3926
  "name": "subscribe",
3906
3927
  "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
@@ -3924,7 +3945,8 @@
3924
3945
  {
3925
3946
  "name": "wait-for",
3926
3947
  "description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
3927
- "type": "string"
3948
+ "type": "string",
3949
+ "default": "\"pb-facsimile,pb-image-strip\""
3928
3950
  },
3929
3951
  {
3930
3952
  "name": "disabled",
@@ -3959,6 +3981,23 @@
3959
3981
  "type": "string",
3960
3982
  "default": "\"mouseover\""
3961
3983
  },
3984
+ {
3985
+ "name": "label",
3986
+ "attribute": "label",
3987
+ "type": "string",
3988
+ "default": "\"\""
3989
+ },
3990
+ {
3991
+ "name": "order",
3992
+ "attribute": "order",
3993
+ "type": "number",
3994
+ "default": "\"POSITIVE_INFINITY\""
3995
+ },
3996
+ {
3997
+ "name": "default",
3998
+ "type": "string",
3999
+ "default": "\"\""
4000
+ },
3962
4001
  {
3963
4002
  "name": "subscribe",
3964
4003
  "attribute": "subscribe",
@@ -3987,7 +4026,8 @@
3987
4026
  "name": "waitFor",
3988
4027
  "attribute": "wait-for",
3989
4028
  "description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
3990
- "type": "string"
4029
+ "type": "string",
4030
+ "default": "\"pb-facsimile,pb-image-strip\""
3991
4031
  },
3992
4032
  {
3993
4033
  "name": "disabled",
@@ -4753,7 +4793,8 @@
4753
4793
  {
4754
4794
  "name": "panels",
4755
4795
  "description": "an array of panel items to display when the component is loaded. It should contain a\nnumber for each panel to show, indicating the ordinal position of the template within the `<pb-panel>`\nto initialize. For example, if you have two templates in `<pb-panel>`: \"transcription\" and \"translation\",\nsetting `panels=\"[0, 1]\"` will show two columns, one with the transcription, the other with the translation.\n\nPassing in a browser parameter `panels` with a comma-separated list will set this property as well.",
4756
- "type": "array"
4796
+ "type": "array",
4797
+ "default": "[]"
4757
4798
  },
4758
4799
  {
4759
4800
  "name": "direction",
@@ -4809,7 +4850,8 @@
4809
4850
  "name": "panels",
4810
4851
  "attribute": "panels",
4811
4852
  "description": "an array of panel items to display when the component is loaded. It should contain a\nnumber for each panel to show, indicating the ordinal position of the template within the `<pb-panel>`\nto initialize. For example, if you have two templates in `<pb-panel>`: \"transcription\" and \"translation\",\nsetting `panels=\"[0, 1]\"` will show two columns, one with the transcription, the other with the translation.\n\nPassing in a browser parameter `panels` with a comma-separated list will set this property as well.",
4812
- "type": "array"
4853
+ "type": "array",
4854
+ "default": "[]"
4813
4855
  },
4814
4856
  {
4815
4857
  "name": "direction",
@@ -5076,6 +5118,130 @@
5076
5118
  }
5077
5119
  ]
5078
5120
  },
5121
+ {
5122
+ "name": "pb-image-strip",
5123
+ "path": "./src/pb-image-strip.js",
5124
+ "attributes": [
5125
+ {
5126
+ "name": "base-uri",
5127
+ "type": "string"
5128
+ },
5129
+ {
5130
+ "name": "items",
5131
+ "description": "Array of image",
5132
+ "type": "array",
5133
+ "default": "[]"
5134
+ },
5135
+ {
5136
+ "name": "image-height",
5137
+ "type": "number",
5138
+ "default": "80"
5139
+ },
5140
+ {
5141
+ "name": "image-width",
5142
+ "type": "number",
5143
+ "default": "64"
5144
+ },
5145
+ {
5146
+ "name": "subscribe",
5147
+ "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
5148
+ "type": "string"
5149
+ },
5150
+ {
5151
+ "name": "subscribe-config",
5152
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
5153
+ "type": "object"
5154
+ },
5155
+ {
5156
+ "name": "emit",
5157
+ "description": "The name of the channel to send events to.",
5158
+ "type": "string"
5159
+ },
5160
+ {
5161
+ "name": "emit-config",
5162
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
5163
+ "type": "object"
5164
+ },
5165
+ {
5166
+ "name": "wait-for",
5167
+ "description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
5168
+ "type": "string"
5169
+ },
5170
+ {
5171
+ "name": "disabled",
5172
+ "description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
5173
+ "type": "boolean",
5174
+ "default": "false"
5175
+ }
5176
+ ],
5177
+ "properties": [
5178
+ {
5179
+ "name": "baseUri",
5180
+ "attribute": "base-uri",
5181
+ "type": "string"
5182
+ },
5183
+ {
5184
+ "name": "items",
5185
+ "attribute": "items",
5186
+ "description": "Array of image",
5187
+ "type": "array",
5188
+ "default": "[]"
5189
+ },
5190
+ {
5191
+ "name": "urls",
5192
+ "type": "Set<any>"
5193
+ },
5194
+ {
5195
+ "name": "imageHeight",
5196
+ "attribute": "image-height",
5197
+ "type": "number",
5198
+ "default": "80"
5199
+ },
5200
+ {
5201
+ "name": "imageWidth",
5202
+ "attribute": "image-width",
5203
+ "type": "number",
5204
+ "default": "64"
5205
+ },
5206
+ {
5207
+ "name": "subscribe",
5208
+ "attribute": "subscribe",
5209
+ "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
5210
+ "type": "string"
5211
+ },
5212
+ {
5213
+ "name": "subscribeConfig",
5214
+ "attribute": "subscribe-config",
5215
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to listen to.",
5216
+ "type": "object"
5217
+ },
5218
+ {
5219
+ "name": "emit",
5220
+ "attribute": "emit",
5221
+ "description": "The name of the channel to send events to.",
5222
+ "type": "string"
5223
+ },
5224
+ {
5225
+ "name": "emitConfig",
5226
+ "attribute": "emit-config",
5227
+ "description": "Configuration object to define a channel/event mapping. Every property\nin the object is interpreted as the name of a channel and its value should\nbe an array of event names to be dispatched.",
5228
+ "type": "object"
5229
+ },
5230
+ {
5231
+ "name": "waitFor",
5232
+ "attribute": "wait-for",
5233
+ "description": "A selector pointing to other components this component depends on.\nWhen method `wait` is called, it will wait until all referenced\ncomponents signal with a `pb-ready` event that they are ready and listening\nto events.",
5234
+ "type": "string"
5235
+ },
5236
+ {
5237
+ "name": "disabled",
5238
+ "attribute": "disabled",
5239
+ "description": "Common property to disable the functionality associated with a component.\n`pb-highlight` and `pb-popover` react to this.",
5240
+ "type": "boolean",
5241
+ "default": "false"
5242
+ }
5243
+ ]
5244
+ },
5079
5245
  {
5080
5246
  "name": "pb-lang",
5081
5247
  "path": "./src/pb-lang.js",
@@ -7996,6 +8162,11 @@
7996
8162
  "type": "string",
7997
8163
  "default": "\".\""
7998
8164
  },
8165
+ {
8166
+ "name": "url-path",
8167
+ "type": "string",
8168
+ "default": "\"path\""
8169
+ },
7999
8170
  {
8000
8171
  "name": "api-version",
8001
8172
  "type": "string",
@@ -8092,6 +8263,12 @@
8092
8263
  "type": "string",
8093
8264
  "default": "\".\""
8094
8265
  },
8266
+ {
8267
+ "name": "urlPath",
8268
+ "attribute": "url-path",
8269
+ "type": "string",
8270
+ "default": "\"path\""
8271
+ },
8095
8272
  {
8096
8273
  "name": "apiVersion",
8097
8274
  "attribute": "api-version",
@@ -9202,6 +9379,11 @@
9202
9379
  "name": "subforms",
9203
9380
  "type": "string"
9204
9381
  },
9382
+ {
9383
+ "name": "name",
9384
+ "type": "string",
9385
+ "default": "\"query\""
9386
+ },
9205
9387
  {
9206
9388
  "name": "value",
9207
9389
  "type": "string",
@@ -9227,6 +9409,11 @@
9227
9409
  "type": "boolean",
9228
9410
  "default": "false"
9229
9411
  },
9412
+ {
9413
+ "name": "start",
9414
+ "type": "number",
9415
+ "default": "1"
9416
+ },
9230
9417
  {
9231
9418
  "name": "subscribe",
9232
9419
  "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
@@ -9275,6 +9462,12 @@
9275
9462
  "attribute": "subforms",
9276
9463
  "type": "string"
9277
9464
  },
9465
+ {
9466
+ "name": "name",
9467
+ "attribute": "name",
9468
+ "type": "string",
9469
+ "default": "\"query\""
9470
+ },
9278
9471
  {
9279
9472
  "name": "value",
9280
9473
  "attribute": "value",
@@ -9305,6 +9498,12 @@
9305
9498
  "type": "boolean",
9306
9499
  "default": "false"
9307
9500
  },
9501
+ {
9502
+ "name": "start",
9503
+ "attribute": "start",
9504
+ "type": "number",
9505
+ "default": "1"
9506
+ },
9308
9507
  {
9309
9508
  "name": "subscribe",
9310
9509
  "attribute": "subscribe",
@@ -9385,7 +9584,7 @@
9385
9584
  {
9386
9585
  "name": "pb-select-feature",
9387
9586
  "path": "./src/pb-select-feature.js",
9388
- "description": "Similar to `pb-toggle-feature` but allows you to choose from a list of defined states instead of a simple\non/off toggle. Like `pb-toggle-feature` it can change state server-side as well as client-side. \n\nThe list of states is passed as a JSON array to property `items`:\n\n# Server-side\n\nProperties to be passed to the server are specified as follows:\n\n```javascript\n[\n {\"name\": \"Diplomatic View\", \"properties\": {\"mode\": \"diplomatic\", \"view\": \"page\"}},\n {\"name\": \"Normalized View\", \"properties\": {\"mode\": \"norm\", \"view\": \"single\"}}\n]\n```\n\n# Client-side\n\n```javascript\n[\n {\"name\": \"Diplomatic View\", \"selectors\": [{\"selector\": \".choice,.choice-alternate,br\", \"state\": false},{\"selector\": \".tei-foreign,pb-highlight,pb-popover\", \"command\": \"disable\"}]},\n {\"name\": \"Normalized View\", \"selectors\": [{\"selector\": \".choice,.choice-alternate,br\", \"state\": true},{\"selector\": \".tei-foreign,pb-highlight,pb-popover\", \"command\": \"disable\"}]},\n {\"name\": \"Plain Reading View\", \"selectors\": [{\"selector\": \".choice,.choice-alternate,br\", \"state\": true}, {\"selector\": \".tei-foreign,pb-highlight,pb-popover\", \"command\": \"disable\", \"state\": true}]}\n]\n```\n\nEach item in the `selectors` property above defines either a state or a command. *state* will simply add\na css class `.toggled` to the target element when true. If *command* is set to 'disable', it will entirely disable\nthe functionality of selected elements - provided that they are\npublisher components implementing the corresponding `command` method of `pb-mixin`.",
9587
+ "description": "Similar to `pb-toggle-feature` but allows you to choose from a list of defined states instead of a simple\non/off toggle. Like `pb-toggle-feature` it can change state server-side as well as client-side. \n\nThe list of states is passed as a JSON array to property `items`:\n\n# Server-side\n\nProperties to be passed to the server are specified as follows:\n\n```javascript\n[\n {\"name\": \"Diplomatic View\", \"properties\": {\"mode\": \"diplomatic\", \"view\": \"page\"}},\n {\"name\": \"Normalized View\", \"properties\": {\"mode\": \"norm\", \"view\": \"single\"}}\n]\n```\n\n# Client-side\n\n```javascript\n[\n {\"name\": \"Diplomatic View\", \"selectors\": [{\"selector\": \".choice,.choice-alternate,br\", \"state\": false},{\"selector\": \".tei-foreign,pb-highlight,pb-popover\", \"command\": \"disable\"}]},\n {\"name\": \"Normalized View\", \"selectors\": [{\"selector\": \".choice,.choice-alternate,br\", \"state\": true},{\"selector\": \".tei-foreign,pb-highlight,pb-popover\", \"command\": \"disable\"}]},\n {\"name\": \"Plain Reading View\", \"selectors\": [{\"selector\": \".choice,.choice-alternate,br\", \"state\": true}, {\"selector\": \".tei-foreign,pb-highlight,pb-popover\", \"command\": \"disable\", \"state\": true}]}\n]\n```\n\nEach item in the `selectors` property above defines either a state or a command. *state* will simply add\na css class `.toggle` to the target element when true. If *command* is set to 'disable', it will entirely disable\nthe functionality of selected elements - provided that they are\npublisher components implementing the corresponding `command` method of `pb-mixin`.\n\nClient-side you may also pass an optional property `\"global\": true` to toggle the state of elements which reside\nin the surrounding HTML context below `pb-page` (means: elements which are not inside a `pb-view` or `pb-load`).",
9389
9588
  "attributes": [
9390
9589
  {
9391
9590
  "name": "name",
@@ -9511,6 +9710,9 @@
9511
9710
  {
9512
9711
  "name": "pb-toggle",
9513
9712
  "description": "Fired when a feature is selected from the dropdown and sends the selected properties"
9713
+ },
9714
+ {
9715
+ "name": "pb-global-toggle"
9514
9716
  }
9515
9717
  ]
9516
9718
  },
@@ -10363,7 +10565,7 @@
10363
10565
  {
10364
10566
  "name": "selected",
10365
10567
  "type": "number",
10366
- "default": "\"_initial\""
10568
+ "default": "0"
10367
10569
  },
10368
10570
  {
10369
10571
  "name": "subscribe",
@@ -10402,7 +10604,7 @@
10402
10604
  "name": "selected",
10403
10605
  "attribute": "selected",
10404
10606
  "type": "number",
10405
- "default": "\"_initial\""
10607
+ "default": "0"
10406
10608
  },
10407
10609
  {
10408
10610
  "name": "subscribe",
@@ -10733,16 +10935,6 @@
10733
10935
  "description": "(optional) CSS selector: selects the elements to toggle client side (sets or unsets a \nCSS class `.toggled`). Setting this property will not trigger a reload as everything is\nhandled by javascript.",
10734
10936
  "type": "string"
10735
10937
  },
10736
- {
10737
- "name": "on",
10738
- "description": "Value to set the parameter to when the feature is enabled.",
10739
- "type": "string"
10740
- },
10741
- {
10742
- "name": "off",
10743
- "description": "Value to set the parameter to when the feature is disabled.",
10744
- "type": "string"
10745
- },
10746
10938
  {
10747
10939
  "name": "checked",
10748
10940
  "type": "boolean"
@@ -10753,6 +10945,18 @@
10753
10945
  "type": "string",
10754
10946
  "default": "\"on\""
10755
10947
  },
10948
+ {
10949
+ "name": "on",
10950
+ "description": "Value to set the parameter to when the feature is enabled.",
10951
+ "type": "string",
10952
+ "default": "\"on\""
10953
+ },
10954
+ {
10955
+ "name": "off",
10956
+ "description": "Value to set the parameter to when the feature is disabled.",
10957
+ "type": "string",
10958
+ "default": "\"off\""
10959
+ },
10756
10960
  {
10757
10961
  "name": "action",
10758
10962
  "description": "In combination with a selector specifies the action to be taken, currently one of\n`toggle` (default) or `disable`.",
@@ -10822,18 +11026,6 @@
10822
11026
  "description": "(optional) CSS selector: selects the elements to toggle client side (sets or unsets a \nCSS class `.toggled`). Setting this property will not trigger a reload as everything is\nhandled by javascript.",
10823
11027
  "type": "string"
10824
11028
  },
10825
- {
10826
- "name": "on",
10827
- "attribute": "on",
10828
- "description": "Value to set the parameter to when the feature is enabled.",
10829
- "type": "string"
10830
- },
10831
- {
10832
- "name": "off",
10833
- "attribute": "off",
10834
- "description": "Value to set the parameter to when the feature is disabled.",
10835
- "type": "string"
10836
- },
10837
11029
  {
10838
11030
  "name": "checked",
10839
11031
  "attribute": "checked",
@@ -10846,6 +11038,20 @@
10846
11038
  "type": "string",
10847
11039
  "default": "\"on\""
10848
11040
  },
11041
+ {
11042
+ "name": "on",
11043
+ "attribute": "on",
11044
+ "description": "Value to set the parameter to when the feature is enabled.",
11045
+ "type": "string",
11046
+ "default": "\"on\""
11047
+ },
11048
+ {
11049
+ "name": "off",
11050
+ "attribute": "off",
11051
+ "description": "Value to set the parameter to when the feature is disabled.",
11052
+ "type": "string",
11053
+ "default": "\"off\""
11054
+ },
10849
11055
  {
10850
11056
  "name": "action",
10851
11057
  "attribute": "action",
@@ -10938,6 +11144,12 @@
10938
11144
  "description": "a comma-separated list of file suffixes to accept for upload\n(by default: .xml,.tei,.odd,.docx)",
10939
11145
  "type": "string"
10940
11146
  },
11147
+ {
11148
+ "name": "event",
11149
+ "description": "the event to emit when the upload has completed (default: 'pb-load')",
11150
+ "type": "string",
11151
+ "default": "\"pb-load\""
11152
+ },
10941
11153
  {
10942
11154
  "name": "subscribe",
10943
11155
  "description": "The name of the channel to subscribe to. Only events on a channel corresponding\nto this property are listened to.",
@@ -10983,6 +11195,13 @@
10983
11195
  "description": "a comma-separated list of file suffixes to accept for upload\n(by default: .xml,.tei,.odd,.docx)",
10984
11196
  "type": "string"
10985
11197
  },
11198
+ {
11199
+ "name": "event",
11200
+ "attribute": "event",
11201
+ "description": "the event to emit when the upload has completed (default: 'pb-load')",
11202
+ "type": "string",
11203
+ "default": "\"pb-load\""
11204
+ },
10986
11205
  {
10987
11206
  "name": "subscribe",
10988
11207
  "attribute": "subscribe",
package/src/dts-client.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { pbMixin } from './pb-mixin.js';
3
- import { translate } from "./pb-i18n.js";
3
+ import { translate } from './pb-i18n.js';
4
+ import { registry } from './urls.js';
5
+
4
6
  import '@polymer/iron-ajax';
5
7
  import '@polymer/iron-icon';
6
8
  import '@polymer/iron-icons';
@@ -61,8 +63,8 @@ export class DtsClient extends pbMixin(LitElement) {
61
63
  connectedCallback() {
62
64
  super.connectedCallback();
63
65
 
64
- this.collection = this.getParameter('id');
65
- this.page = this.getParameter('page');
66
+ this.collection = registry.state.id;
67
+ this.page = registry.state.page;
66
68
 
67
69
  this.subscribeTo('dts-endpoint', (ev) => {
68
70
  this._setEndpoint(ev.detail.endpoint, ev.detail.collection, ev.detail.reload);
@@ -163,19 +165,16 @@ export class DtsClient extends pbMixin(LitElement) {
163
165
 
164
166
  _update() {
165
167
  this.emitTo('pb-start-update');
166
- const params = {};
168
+ const newState = {};
167
169
  if (this.collection) {
168
- params.id = this.collection;
169
-
170
- this.setParameter('id', this.collection);
171
- };
170
+ newState.id = this.collection;
171
+ }
172
172
  if (this.page) {
173
- params.page = this.page + 1;
174
- this.setParameter('page', this.page);
173
+ newState.page = this.page + 1;
175
174
  }
176
- this.pushHistory('dts-client-navigate');
175
+ registry.commit(this, newState);
177
176
 
178
- this.queryAPI.params = params;
177
+ this.queryAPI.params = newState;
179
178
  this.queryAPI.url = this._collectionEndpoint;
180
179
  this.queryAPI.generateRequest();
181
180
  }
@@ -205,7 +204,8 @@ export class DtsClient extends pbMixin(LitElement) {
205
204
  const json = this.documentsAPI.lastResponse;
206
205
  this.emitTo('pb-end-update');
207
206
  const url = new URL(json.path, window.location.href);
208
- window.location = url;
207
+ // use registry here?
208
+ window.location.replace(url);
209
209
  }
210
210
 
211
211
  _handleError(ev) {
@@ -284,7 +284,7 @@ export class DtsClient extends pbMixin(LitElement) {
284
284
  }
285
285
 
286
286
  _renderMember(member) {
287
- if (member['@type'] == 'Collection') {
287
+ if (member['@type'] === 'Collection') {
288
288
  return html`
289
289
  <iron-icon icon="icons:folder-open"></iron-icon>
290
290
  <div class="details">
@@ -1,6 +1,8 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { pbMixin } from './pb-mixin.js';
3
- import { translate } from "./pb-i18n.js";
3
+ import { translate } from './pb-i18n.js';
4
+ import { registry } from './urls.js';
5
+
4
6
  import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
5
7
  import '@polymer/paper-listbox';
6
8
  import '@polymer/paper-item';
@@ -53,8 +55,7 @@ export class DtsSelectEndpoint extends pbMixin(LitElement) {
53
55
 
54
56
  connectedCallback() {
55
57
  super.connectedCallback();
56
-
57
- this.endpoint = this.getParameter('endpoint');
58
+ this.endpoint = registry.state.endpoint;
58
59
  }
59
60
 
60
61
  updated(changedProperties) {
@@ -96,8 +97,7 @@ export class DtsSelectEndpoint extends pbMixin(LitElement) {
96
97
  return;
97
98
  }
98
99
  const endpoint = this.endpoints.find((endp) => endp.url === newEndpoint);
99
- this.setParameter('endpoint', endpoint.url);
100
- this.pushHistory('dts-endpoint');
100
+ registry.commit(this, { endpoint: endpoint.url });
101
101
  console.log('<dts-select-endpoint> Setting endpoint to %s', newEndpoint);
102
102
  this.emitTo('dts-endpoint', {
103
103
  endpoint: endpoint.url,
package/src/pb-ajax.js CHANGED
@@ -121,8 +121,8 @@ export class PbAjax extends pbMixin(LitElement) {
121
121
  if (this.confirm) {
122
122
  const dialog = this.shadowRoot.getElementById('confirmDialog');
123
123
  dialog.confirm(this._dialogTitle, i18n(this.confirm))
124
- .then(() => this.trigger())
125
- .catch(() => console.log('<pb-ajax> Action cancelled'));
124
+ .then(() => this.trigger())
125
+ .catch(() => console.log('<pb-ajax> Action cancelled'));
126
126
  } else {
127
127
  this.trigger();
128
128
  }
@@ -161,8 +161,8 @@ export class PbAjax extends pbMixin(LitElement) {
161
161
  } else {
162
162
  this._message = msg;
163
163
  }
164
- const dialog = this.shadowRoot.getElementById('messageDialog');
165
- dialog.open();
164
+ const dialog = this.shadowRoot.getElementById('confirmDialog');
165
+ dialog.show(i18n('dialogs.error'), this._message);
166
166
  this.emitTo('pb-end-update');
167
167
  }
168
168
 
@@ -1,6 +1,6 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
3
- import { pbMixin } from './pb-mixin.js';
3
+ import { pbMixin, waitOnce } from './pb-mixin.js';
4
4
  import { translate } from "./pb-i18n.js";
5
5
  import { createConnectors } from "./authority/connectors.js";
6
6
  import '@polymer/paper-input/paper-input';
@@ -66,7 +66,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
66
66
  this._query();
67
67
  });
68
68
 
69
- PbAuthorityLookup.waitOnce('pb-page-ready', () => {
69
+ waitOnce('pb-page-ready', () => {
70
70
  const connectors = createConnectors(this.getEndpoint(), this);
71
71
  connectors.forEach(connector => { this._authorities[connector.register] = connector });
72
72
  });
@@ -1,5 +1,5 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
- import { pbMixin } from './pb-mixin';
2
+ import { pbMixin, waitOnce } from './pb-mixin';
3
3
  import { translate } from './pb-i18n';
4
4
  import '@polymer/paper-input/paper-input.js';
5
5
  import '@polymer/iron-ajax';
@@ -140,12 +140,12 @@ export class PbAutocomplete extends pbMixin(LitElement) {
140
140
  if (this.substring) {
141
141
  autocomplete.queryFn = _query;
142
142
  }
143
- PbAutocomplete.waitOnce('pb-page-ready', () => {
143
+ waitOnce('pb-page-ready', () => {
144
144
  this._sendRequest();
145
145
  });
146
146
  } else if (this.value) {
147
147
  if (this.source) {
148
- PbAutocomplete.waitOnce('pb-page-ready', () => {
148
+ waitOnce('pb-page-ready', () => {
149
149
  //console.log('send autocomplete request for remote source %s on value %s', this.source, this.value);
150
150
  this._sendRequest(this.value);
151
151
  });
@@ -233,7 +233,7 @@ export class PbAutocomplete extends pbMixin(LitElement) {
233
233
  loader.url = this.toAbsoluteURL(this.source);
234
234
 
235
235
  const params = this._getParameters();
236
- params['query'] = query;
236
+ params.query = query;
237
237
  loader.params = params;
238
238
  //console.log('send request for %s with %o', loaderId, params);
239
239
 
@@ -286,18 +286,16 @@ export class PbAutocomplete extends pbMixin(LitElement) {
286
286
  }
287
287
 
288
288
  _autocompleteSelected(ev) {
289
- this.lastSelected = ev.detail.text;
289
+ const { text, value } = ev.detail;
290
+ this.lastSelected = text;
290
291
  const input = this.shadowRoot.getElementById('search');
291
- input.value = ev.detail.text;
292
- this.value = ev.detail.value;
292
+ input.value = text;
293
+ this.value = value;
293
294
  if (this._hiddenInput) {
294
295
  this._hiddenInput.value = this.value;
295
296
  }
296
297
 
297
- this.emitTo('pb-autocomplete-selected', {
298
- text: ev.detail.text,
299
- value: ev.detail.value
300
- });
298
+ this.emitTo('pb-autocomplete-selected', { text, value });
301
299
  }
302
300
 
303
301
  _setInput(ev) {
@@ -1,5 +1,5 @@
1
- import {LitElement, html, css} from 'lit-element';
2
- import {pbMixin} from './pb-mixin.js';
1
+ import { LitElement, html, css } from 'lit-element';
2
+ import { pbMixin, waitOnce } from './pb-mixin.js';
3
3
 
4
4
  /**
5
5
  * This component queries the blacklab API of TEI-Publisher for a list of text matches
@@ -108,7 +108,7 @@ export class PbBlacklabHighlight extends pbMixin(LitElement) {
108
108
  * waiting for the page to be ready before storing a reference to the shadowDOM of the view element this
109
109
  * component is attached to via the 'view' attribute.
110
110
  */
111
- PbBlacklabHighlight.waitOnce('pb-page-ready', () => {
111
+ waitOnce('pb-page-ready', () => {
112
112
  this.viewElement = document.getElementById(this.view);
113
113
  if (!this.viewElement) {
114
114
  console.error(`${this}: view element with id ${this.view} does not exist`);