playbook_ui 14.7.0.pre.alpha.PBNTR637quickpickdefaultdate4492 → 14.7.0.pre.alpha.PBNTR667railstypeaheadformintegration4454
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_card/docs/_card_light.md +1 -1
- data/app/pb_kits/playbook/pb_date/_date.scss +0 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +1 -17
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +63 -12
- data/app/pb_kits/playbook/pb_typeahead/index.ts +36 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +5 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +4 -0
- data/dist/chunks/{_typeahead-DZmYDBaL.js → _typeahead-B-juiSkw.js} +1 -1
- data/dist/chunks/{_weekday_stacked-CgPamJiY.js → _weekday_stacked-DPqQHJ1l.js} +1 -1
- data/dist/chunks/{lib-BC6ESsxG.js → lib-DpxYMiKe.js} +1 -1
- data/dist/chunks/{pb_form_validation-B_Z9rEbg.js → pb_form_validation-LqRlnmi6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/typeahead_field.rb +13 -0
- data/lib/playbook/version.rb +1 -1
- metadata +6 -21
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.html.erb +0 -42
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.jsx +0 -44
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.html.erb +0 -26
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +0 -38
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_draggable/draggable.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +0 -15
- data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +0 -7
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/index.js +0 -125
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba8b6ebdd4078924cdcecd475be6892960449af516b17143f79b6475a4f0162
|
4
|
+
data.tar.gz: ab99598eb62828f045a9f61622b5b0d036e07a410a410004b9ed0ca29ab1630c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 644594e1a5ff791f14904f59c7b959d9d22bb22f7ef5c148dd37449608a2b86248cdf452a1a6b3eecf3a826c0867f10709c5464588a61cec763c5fc1bf7acbd2
|
7
|
+
data.tar.gz: 2c26b39a37968e5cc44bd2bdb135bad81d67c624b9ae3b47bdcb2f58e76efbb965ae6d510bbec45f859c2a0a0401661dd3149a3a748a91a9b613eb98593a4408
|
@@ -1 +1 @@
|
|
1
|
-
Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">visual guidelines.</a>
|
1
|
+
Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">visual guidelines.</a>
|
@@ -143,7 +143,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
143
143
|
|
144
144
|
} else if (selectionType === "quickpick") {
|
145
145
|
//------- QUICKPICK VARIANT PLUGIN -------------//
|
146
|
-
pluginList.push(quickPickPlugin(thisRangesEndToday, customQuickPickDates
|
146
|
+
pluginList.push(quickPickPlugin(thisRangesEndToday, customQuickPickDates))
|
147
147
|
}
|
148
148
|
|
149
149
|
// time selection
|
@@ -12,7 +12,6 @@ examples:
|
|
12
12
|
- date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
|
13
13
|
- date_picker_quick_pick_custom: Custom Quick Pick Dates
|
14
14
|
- date_picker_quick_pick_custom_override: Custom Quick Pick Dates (append to defaults)
|
15
|
-
- date_picker_quick_pick_default_date: Range (Quick Pick w/ Default Date)
|
16
15
|
- date_picker_format: Format
|
17
16
|
- date_picker_disabled: Disabled Dates
|
18
17
|
- date_picker_min_max: Min Max
|
@@ -43,7 +42,6 @@ examples:
|
|
43
42
|
- date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
|
44
43
|
- date_picker_quick_pick_custom: Custom Quick Pick Dates
|
45
44
|
- date_picker_quick_pick_custom_override: Custom Quick Pick Dates (append to defaults)
|
46
|
-
- date_picker_quick_pick_default_date: Range (Quick Pick w/ Default Date)
|
47
45
|
- date_picker_format: Format
|
48
46
|
- date_picker_disabled: Disabled Dates
|
49
47
|
- date_picker_min_max: Min Max
|
@@ -25,4 +25,3 @@ export { default as DatePickerQuickPickRangeLimit } from './_date_picker_quick_p
|
|
25
25
|
export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
|
26
26
|
export { default as DatePickerQuickPickCustom } from './_date_picker_quick_pick_custom'
|
27
27
|
export { default as DatePickerQuickPickCustomOverride } from './_date_picker_quick_pick_custom_override'
|
28
|
-
export { default as DatePickerQuickPickDefaultDate } from './_date_picker_quick_pick_default_date'
|
@@ -26,7 +26,7 @@ type customQuickPickDatesType = {
|
|
26
26
|
|
27
27
|
let activeLabel = ""
|
28
28
|
|
29
|
-
const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: customQuickPickDatesType | undefined
|
29
|
+
const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: customQuickPickDatesType | undefined) => {
|
30
30
|
return function (fp: FpTypes & any): any {
|
31
31
|
const today = new Date()
|
32
32
|
const yesterday = DateTime.getYesterdayDate(new Date())
|
@@ -185,8 +185,6 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
|
|
185
185
|
return {
|
186
186
|
// onReady is a hook from flatpickr that runs when calendar is in a ready state
|
187
187
|
onReady(selectedDates: Array<Date>) {
|
188
|
-
let defaultDateRange
|
189
|
-
|
190
188
|
// loop through the ranges and create an anchor tag for each range and add an event listener to set the date when user clicks on a date range
|
191
189
|
for (const [label, range] of Object.entries(pluginData.ranges)) {
|
192
190
|
addRangeButton(label).addEventListener('click', function () {
|
@@ -203,14 +201,6 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
|
|
203
201
|
fp.close();
|
204
202
|
}
|
205
203
|
});
|
206
|
-
|
207
|
-
// check if there is a default date and set the default date range and label for quick pick
|
208
|
-
if (defaultDate) {
|
209
|
-
if (label.toLowerCase() === defaultDate.toLowerCase()) {
|
210
|
-
activeLabel = label
|
211
|
-
defaultDateRange = range
|
212
|
-
}
|
213
|
-
}
|
214
204
|
}
|
215
205
|
// conditional to check if there is a dropdown to add it to the calendar container and get it the classes it needs
|
216
206
|
if (pluginData.rangesNav.children.length > 0) {
|
@@ -226,12 +216,6 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
|
|
226
216
|
// function to give the active button the active class
|
227
217
|
selectActiveRangeButton(selectedDates);
|
228
218
|
}
|
229
|
-
|
230
|
-
// set the default date range if there is one and select the active button
|
231
|
-
if (defaultDateRange) {
|
232
|
-
fp.setDate(defaultDateRange, false);
|
233
|
-
selectActiveRangeButton(defaultDateRange);
|
234
|
-
}
|
235
219
|
},
|
236
220
|
onValueUpdate(selectedDates: Array<Date>) {
|
237
221
|
selectActiveRangeButton(selectedDates)
|
@@ -8,10 +8,4 @@ examples:
|
|
8
8
|
- draggable_with_cards: Draggable with Cards
|
9
9
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
10
10
|
|
11
|
-
rails:
|
12
|
-
- draggable_default_rails: Default
|
13
|
-
- draggable_with_list_rails: Draggable with List Kit
|
14
|
-
- draggable_with_cards_rails: Draggable with Cards
|
15
|
-
|
16
|
-
|
17
11
|
|
@@ -23,7 +23,7 @@
|
|
23
23
|
%>
|
24
24
|
|
25
25
|
<%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
|
26
|
-
<%= form.typeahead :
|
26
|
+
<%= form.typeahead :example_typeahead, props: { data: { typeahead_example1: true, user: {} }, label: true, placeholder: "Search for a user" } %>
|
27
27
|
<%= form.text_field :example_text_field, props: { label: true } %>
|
28
28
|
<%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
|
29
29
|
<%= form.email_field :example_email_field, props: { label: true } %>
|
@@ -92,7 +92,7 @@
|
|
92
92
|
const selectedUserData = JSON.parse(selectedUserJSON)
|
93
93
|
|
94
94
|
// set the input field's value
|
95
|
-
event.target.querySelector('input[name=
|
95
|
+
event.target.querySelector('input[name=example_typeahead]').value = selectedUserData.login
|
96
96
|
|
97
97
|
// log the selected option's dataset
|
98
98
|
console.log('The selected user data:')
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= pb_form_with(scope: :example, url: "", method: :get, loading: true) do |form| %>
|
2
|
-
<%= form.text_field :
|
2
|
+
<%= form.text_field :example_text_field_loading, props: { label: true } %>
|
3
3
|
|
4
4
|
<%= form.actions do |action| %>
|
5
5
|
<%= action.submit %>
|
@@ -22,23 +22,74 @@
|
|
22
22
|
%>
|
23
23
|
|
24
24
|
<%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
|
25
|
-
<%= form.
|
26
|
-
<%= form.
|
27
|
-
<%= form.
|
28
|
-
<%= form.
|
29
|
-
<%= form.
|
30
|
-
<%= form.
|
31
|
-
<%= form.
|
32
|
-
<%= form.
|
33
|
-
<%= form.
|
34
|
-
<%= form.
|
35
|
-
<%= form.
|
25
|
+
<%= form.typeahead :example_typeahead_validation, props: { data: { typeahead_example2: true, user: {} }, label: true, placeholder: "Search for a user", required: true, validation: { message: "Please select a user." } } %>
|
26
|
+
<%= form.text_field :example_text_field_validation, props: { label: true, required: true } %>
|
27
|
+
<%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field" } %>
|
28
|
+
<%= form.email_field :example_email_field_validation, props: { label: true, required: true } %>
|
29
|
+
<%= form.number_field :example_number_field_validation, props: { label: true, required: true } %>
|
30
|
+
<%= form.search_field :example_project_number_validation, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
|
31
|
+
<%= form.password_field :example_password_field_validation, props: { label: true, required: true } %>
|
32
|
+
<%= form.url_field :example_url_field_validation, props: { label: true, required: true } %>
|
33
|
+
<%= form.text_area :example_text_area_validation, props: { label: true, required: true } %>
|
34
|
+
<%= form.dropdown_field :example_dropdown_validation, props: { label: true, options: example_dropdown_options, required: true } %>
|
35
|
+
<%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true } %>
|
36
|
+
<%= form.collection_select :example_collection_select_validation, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
|
36
37
|
<%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
|
37
38
|
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
|
38
|
-
<%= form.star_rating_field :
|
39
|
+
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
39
40
|
|
40
41
|
<%= form.actions do |action| %>
|
41
42
|
<%= action.submit %>
|
42
43
|
<%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %>
|
43
44
|
<% end %>
|
44
45
|
<% end %>
|
46
|
+
|
47
|
+
<!-- form.typeahead user results example template -->
|
48
|
+
<template data-typeahead-example-result-option>
|
49
|
+
<%= pb_rails("user", props: {
|
50
|
+
name: tag(:slot, name: "name"),
|
51
|
+
orientation: "horizontal",
|
52
|
+
align: "left",
|
53
|
+
avatar_url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGP6zwAAAgcBApocMXEAAAAASUVORK5CYII=",
|
54
|
+
avatar: true
|
55
|
+
}) %>
|
56
|
+
</template>
|
57
|
+
|
58
|
+
<!-- form.typeahead JS example implementation -->
|
59
|
+
<%= javascript_tag defer: "defer" do %>
|
60
|
+
document.addEventListener("pb-typeahead-kit-search", function(event) {
|
61
|
+
if (!event.target.dataset || !event.target.dataset.typeaheadExample2) return
|
62
|
+
|
63
|
+
fetch(`https://api.github.com/search/users?q=${encodeURIComponent(event.detail.searchingFor)}`)
|
64
|
+
.then(response => response.json())
|
65
|
+
.then((result) => {
|
66
|
+
const resultOptionTemplate = document.querySelector("[data-typeahead-example-result-option]")
|
67
|
+
|
68
|
+
event.detail.setResults((result.items || []).map((user) => {
|
69
|
+
const wrapper = resultOptionTemplate.content.cloneNode(true)
|
70
|
+
wrapper.children[0].dataset.user = JSON.stringify(user)
|
71
|
+
wrapper.querySelector('slot[name="name"]').replaceWith(user.login)
|
72
|
+
wrapper.querySelector('img').dataset.src = user.avatar_url
|
73
|
+
return wrapper
|
74
|
+
}))
|
75
|
+
})
|
76
|
+
})
|
77
|
+
|
78
|
+
|
79
|
+
document.addEventListener("pb-typeahead-kit-result-option-selected", function(event) {
|
80
|
+
if (!event.target.dataset.typeaheadExample2) return
|
81
|
+
|
82
|
+
const selectedUserJSON = event.detail.selected.firstElementChild.dataset.user
|
83
|
+
const selectedUserData = JSON.parse(selectedUserJSON)
|
84
|
+
|
85
|
+
// set the input field's value
|
86
|
+
event.target.querySelector('input[name=example_typeahead_validation]').value = selectedUserData.login
|
87
|
+
|
88
|
+
// log the selected option's dataset
|
89
|
+
console.log('The selected user data:')
|
90
|
+
console.dir(selectedUserData)
|
91
|
+
|
92
|
+
// do even more with the data later - TBD
|
93
|
+
event.target.dataset.user = selectedUserJSON
|
94
|
+
})
|
95
|
+
<% end %>
|
@@ -4,11 +4,12 @@ import { debounce } from 'lodash'
|
|
4
4
|
export default class PbTypeahead extends PbEnhancedElement {
|
5
5
|
_searchInput: HTMLInputElement
|
6
6
|
_resultsElement: HTMLElement
|
7
|
-
_debouncedSearch:
|
7
|
+
_debouncedSearch: () => void
|
8
8
|
_resultsLoadingIndicator: HTMLElement
|
9
9
|
_resultOptionTemplate: HTMLElement
|
10
10
|
_resultsOptionCache: Map<string, Array<DocumentFragment>>
|
11
11
|
_searchContext: string
|
12
|
+
_validSelection: boolean
|
12
13
|
|
13
14
|
static get selector() {
|
14
15
|
return '[data-pb-typeahead-kit]'
|
@@ -19,6 +20,7 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
19
20
|
this.searchInput.addEventListener('focus', () => this.debouncedSearch())
|
20
21
|
this.searchInput.addEventListener('input', () => this.debouncedSearch())
|
21
22
|
this.resultsElement.addEventListener('click', (event: MouseEvent) => this.optionSelected(event))
|
23
|
+
this.element.closest('form')?.addEventListener('submit', (event) => this.handleFormSubmission(event))
|
22
24
|
}
|
23
25
|
|
24
26
|
handleKeydown(event: KeyboardEvent) {
|
@@ -86,6 +88,9 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
86
88
|
const resultOption = (event.target as Element).closest('[data-result-option-item]')
|
87
89
|
if (!resultOption) return
|
88
90
|
|
91
|
+
this._validSelection = true
|
92
|
+
this.removeValidationError()
|
93
|
+
|
89
94
|
this.resultsCacheClear()
|
90
95
|
this.searchInputClear()
|
91
96
|
this.clearResults()
|
@@ -93,6 +98,35 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
93
98
|
this.element.dispatchEvent(new CustomEvent('pb-typeahead-kit-result-option-selected', { bubbles: true, detail: { selected: resultOption, typeahead: this } }))
|
94
99
|
}
|
95
100
|
|
101
|
+
removeValidationError() {
|
102
|
+
const inputWrapper = this.searchInput.closest('.text_input_wrapper')
|
103
|
+
if (inputWrapper) {
|
104
|
+
const errorMessage = inputWrapper.querySelector('.pb_body_kit_negative') as HTMLElement
|
105
|
+
if (errorMessage) {
|
106
|
+
errorMessage.style.display = 'none'
|
107
|
+
}
|
108
|
+
this.searchInput.classList.remove('error')
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
showValidationError() {
|
113
|
+
const inputWrapper = this.searchInput.closest('.text_input_wrapper')
|
114
|
+
if (inputWrapper) {
|
115
|
+
const errorMessage = inputWrapper.querySelector('.pb_body_kit_negative') as HTMLElement
|
116
|
+
if (errorMessage) {
|
117
|
+
errorMessage.style.display = 'block'
|
118
|
+
}
|
119
|
+
this.searchInput.classList.add('error')
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
handleFormSubmission(event: Event) {
|
124
|
+
if (!this._validSelection) {
|
125
|
+
this.showValidationError()
|
126
|
+
event.preventDefault()
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
96
130
|
clearResults() {
|
97
131
|
this.resultsElement.innerHTML = ''
|
98
132
|
}
|
@@ -201,7 +235,7 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
201
235
|
}
|
202
236
|
|
203
237
|
toggleResultsLoadingIndicator(visible: boolean) {
|
204
|
-
|
238
|
+
let visibilityProperty = '0'
|
205
239
|
if (visible) visibilityProperty = '1'
|
206
240
|
this.resultsLoadingIndicator.style.opacity = visibilityProperty
|
207
241
|
}
|
@@ -17,11 +17,14 @@
|
|
17
17
|
<%= pb_rails("text_input", props: {
|
18
18
|
type: "search",
|
19
19
|
input_options: object.input_options,
|
20
|
-
label: object.label,
|
21
20
|
name: object.name,
|
22
21
|
value: object.value,
|
23
22
|
placeholder: object.placeholder,
|
24
23
|
margin_bottom: "none",
|
24
|
+
required: object.required,
|
25
|
+
validation: object.validation,
|
26
|
+
label: object.label,
|
27
|
+
id: object.input_options[:id],
|
25
28
|
}) %>
|
26
29
|
<%= pb_rails("list", props: { ordered: false, borderless: false, xpadding: true, role: "status", aria: { live: "polite" }, data: { pb_typeahead_kit_results: true } }) do %>
|
27
30
|
<% end %>
|
@@ -33,4 +36,4 @@
|
|
33
36
|
<% end %>
|
34
37
|
</template>
|
35
38
|
<% end %>
|
36
|
-
<% end %>
|
39
|
+
<% end %>
|
@@ -40,6 +40,10 @@ module Playbook
|
|
40
40
|
prop :pill_color, type: Playbook::Props::Enum,
|
41
41
|
values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
|
42
42
|
default: "primary"
|
43
|
+
prop :required, type: Playbook::Props::Boolean,
|
44
|
+
default: false
|
45
|
+
prop :validation, type: Playbook::Props::HashProp,
|
46
|
+
default: {}
|
43
47
|
|
44
48
|
def classname
|
45
49
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useState,useRef,forwardRef,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{q as getDefaultExportFromCjs,w as filter,x as omit,j as getAllIcons,y as get,n as commonjsGlobal,v as colors$1,s as highchartsTheme,z as merge,r as highchartsDarkTheme,A as useCollapsible,B as getAugmentedNamespace,C as createPopper,E as uniqueId,F as typography,G as cloneDeep,H as isString}from"./lib-
|
1
|
+
import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useState,useRef,forwardRef,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{q as getDefaultExportFromCjs,w as filter,x as omit,j as getAllIcons,y as get,n as commonjsGlobal,v as colors$1,s as highchartsTheme,z as merge,r as highchartsDarkTheme,A as useCollapsible,B as getAugmentedNamespace,C as createPopper,E as uniqueId,F as typography,G as cloneDeep,H as isString}from"./lib-DpxYMiKe.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return Object.assign(Object.assign({},state),{items:action.payload});case"SET_DRAG_DATA":return Object.assign(Object.assign({},state),{dragData:action.payload});case"SET_IS_DRAGGING":return Object.assign(Object.assign({},state),{isDragging:action.payload});case"SET_ACTIVE_CONTAINER":return Object.assign(Object.assign({},state),{activeContainer:action.payload});case"CHANGE_CATEGORY":return Object.assign(Object.assign({},state),{items:state.items.map((item=>item.id===action.payload.itemId?Object.assign(Object.assign({},item),{container:action.payload.container}):item))});case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return Object.assign(Object.assign({},state),{items:newItems})}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver})=>{const[state,dispatch]=useReducer(reducer,initialState);useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e2,container)=>{e2.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e2,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state]);return jsx$1(DragContext.Provider,Object.assign({value:contextValue},{children:children}),void 0)};var classnames$1={exports:{}};
|
2
2
|
/*!
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
4
4
|
Licensed under the MIT License (MIT), see
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{r as requireLazysizes}from"./lazysizes-B7xYodB-.js";import{jsx,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{useEffect,createContext,useContext,useState,useCallback,createElement,forwardRef,useRef,useImperativeHandle,Fragment as Fragment$1,useReducer,useMemo,useLayoutEffect,isValidElement}from"react";import{h as buildAriaProps,i as buildDataProps,j as buildHtmlProps,k as classnames,l as globalProps,m as buildCss,F as Flex,I as Icon,n as FlexItem,o as Body$1,p as Caption,A as Avatar,q as domSafeProps,r as Title,S as SectionSeparator,s as DialogContext,t as Modal,u as Draggable,v as TextInput,_ as __awaiter,w as __generator,x as __spread,y as PropTypes,z as Card,E as noop$3,H as PbReactPopover,J as CircleIconButton,K as Button,N as HighchartsReact,O as Badge,Q as joinPresent,U as titleize,V as IconCircle,W as Image,X as Checkbox,Y as Radio}from"./_typeahead-
|
1
|
+
import{r as requireLazysizes}from"./lazysizes-B7xYodB-.js";import{jsx,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{useEffect,createContext,useContext,useState,useCallback,createElement,forwardRef,useRef,useImperativeHandle,Fragment as Fragment$1,useReducer,useMemo,useLayoutEffect,isValidElement}from"react";import{h as buildAriaProps,i as buildDataProps,j as buildHtmlProps,k as classnames,l as globalProps,m as buildCss,F as Flex,I as Icon,n as FlexItem,o as Body$1,p as Caption,A as Avatar,q as domSafeProps,r as Title,S as SectionSeparator,s as DialogContext,t as Modal,u as Draggable,v as TextInput,_ as __awaiter,w as __generator,x as __spread,y as PropTypes,z as Card,E as noop$3,H as PbReactPopover,J as CircleIconButton,K as Button,N as HighchartsReact,O as Badge,Q as joinPresent,U as titleize,V as IconCircle,W as Image,X as Checkbox,Y as Radio}from"./_typeahead-B-juiSkw.js";import{h as PbTable,j as getAllIcons,D as DateTime$1,a as datePickerHelper,u as useDropdown,o as omitBy,k as isEmpty,m as map,p as partial,l as find$1,n as commonjsGlobal,q as getDefaultExportFromCjs,r as highchartsDarkTheme,s as highchartsTheme,t as noop$4,v as colors,i as PbTextarea}from"./lib-DpxYMiKe.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";var ls_attrchange={exports:{}};(function(module){(function(window2,factory){if(!window2){return}var globalInstall=function(){factory(window2.lazySizes);window2.removeEventListener("lazyunveilread",globalInstall,true)};factory=factory.bind(null,window2,window2.document);if(module.exports){factory(requireLazysizes())}else if(window2.lazySizes){globalInstall()}else{window2.addEventListener("lazyunveilread",globalInstall,true)}})(typeof window!="undefined"?window:0,(function(window2,document2,lazySizes){var addObserver=function(){var connect,disconnect,observer,connected;var lsCfg=lazySizes.cfg;var attributes={"data-bgset":1,"data-include":1,"data-poster":1,"data-bg":1,"data-script":1};var regClassTest="(\\s|^)("+lsCfg.loadedClass;var docElem=document2.documentElement;var setClass=function(target){lazySizes.rAF((function(){lazySizes.rC(target,lsCfg.loadedClass);if(lsCfg.unloadedClass){lazySizes.rC(target,lsCfg.unloadedClass)}lazySizes.aC(target,lsCfg.lazyClass);if(target.style.display=="none"||target.parentNode&&target.parentNode.style.display=="none"){setTimeout((function(){lazySizes.loader.unveil(target)}),0)}}))};var onMutation=function(mutations){var i,len,mutation,target;for(i=0,len=mutations.length;i<len;i++){mutation=mutations[i];target=mutation.target;if(!target.getAttribute(mutation.attributeName)){continue}if(target.localName=="source"&&target.parentNode){target=target.parentNode.querySelector("img")}if(target&®ClassTest.test(target.className)){setClass(target)}}};if(lsCfg.unloadedClass){regClassTest+="|"+lsCfg.unloadedClass}regClassTest+="|"+lsCfg.loadingClass+")(\\s|$)";regClassTest=new RegExp(regClassTest);attributes[lsCfg.srcAttr]=1;attributes[lsCfg.srcsetAttr]=1;if(window2.MutationObserver){observer=new MutationObserver(onMutation);connect=function(){if(!connected){connected=true;observer.observe(docElem,{subtree:true,attributes:true,attributeFilter:Object.keys(attributes)})}};disconnect=function(){if(connected){connected=false;observer.disconnect()}}}else{docElem.addEventListener("DOMAttrModified",function(){var runs;var modifications=[];var callMutations=function(){onMutation(modifications);modifications=[];runs=false};return function(e){if(connected&&attributes[e.attrName]&&e.newValue){modifications.push({target:e.target,attributeName:e.attrName});if(!runs){setTimeout(callMutations);runs=true}}}}(),true);connect=function(){connected=true};disconnect=function(){connected=false}}addEventListener("lazybeforeunveil",disconnect,true);addEventListener("lazybeforeunveil",connect);addEventListener("lazybeforesizes",disconnect,true);addEventListener("lazybeforesizes",connect);connect();removeEventListener("lazybeforeunveil",addObserver)};addEventListener("lazybeforeunveil",addObserver)}))})(ls_attrchange);
|
2
2
|
/**
|
3
3
|
* table-core
|
4
4
|
*
|