Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-to-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Download Experience Builder
run: |
URL=$(curl -s 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.19.zip?f=json&folder=software%2FExperienceBuilder%2F1.19' | jq -r '.url')
URL=$(curl -s 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.20.zip?f=json&folder=software%2FExperienceBuilder%2F1.20' | jq -r '.url')
curl -L -o exb.zip "$URL"

- name: Unzip Experience Builder
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Download Experience Builder
shell: pwsh
run: |
$jsonResponse = Invoke-RestMethod -Uri 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.19.zip?f=json&folder=software%2FExperienceBuilder%2F1.19'
$jsonResponse = Invoke-RestMethod -Uri 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.20.zip?f=json&folder=software%2FExperienceBuilder%2F1.20'
Invoke-WebRequest -Uri $jsonResponse.url -OutFile exb.zip

- name: Unzip Experience Builder
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-widgets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Download Experience Builder
shell: pwsh
run: |
$jsonResponse = Invoke-RestMethod -Uri 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.19.zip?f=json&folder=software%2FExperienceBuilder%2F1.19'
$jsonResponse = Invoke-RestMethod -Uri 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.20.zip?f=json&folder=software%2FExperienceBuilder%2F1.20'
Invoke-WebRequest -Uri $jsonResponse.url -OutFile exb.zip

- name: Unzip Experience Builder
Expand Down
5 changes: 0 additions & 5 deletions ABLS/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"hasConfig": true
},
"dependency": [
"jimu-arcgis",
"jimu-core",
"@esri/calcite-components-react"
],
"settingDependency": [
"jimu-arcgis"
],
"translatedLocales": [
Expand Down
10 changes: 1 addition & 9 deletions ABLS/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "abls",
"version": "1.0.1",
"version": "1.0.2",
"description": "A Better Layer Switcher - A custom Experience Widget, to swith between sets of layers using a views navigation like interface.",
"keywords": [
"exb-widget",
Expand All @@ -13,14 +13,6 @@
"directories": {
"test": "tests"
},
"peerDependencies": {
"@esri/calcite-components": "5.0.1"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^4.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SunshineLuke90/widgets.git",
Expand Down
3 changes: 2 additions & 1 deletion ABLS/src/runtime/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { JimuMapViewComponent, type JimuMapView } from "jimu-arcgis"
import type { Config, ABLSView } from "../config"
import { Icon } from "jimu-ui"
import defaultMessages from "./translations/default"
// @ts-expect-error - No types available for this package
import "./style.css"
import TimeExtent from "@arcgis/core/time/TimeExtent"
import { useCallback } from "react"
import { CalciteButton } from "@esri/calcite-components-react"

export default function Widget(props: AllWidgetProps<Config>) {
export default function Widget (props: AllWidgetProps<Config>) {
const { config, useMapWidgetIds } = props
const [jimuMapView, setJimuMapView] = React.useState<JimuMapView>(null)
const [activeViewId, setActiveViewId] = React.useState<string>(null)
Expand Down
6 changes: 4 additions & 2 deletions ABLS/src/setting/setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import {
import { IconPicker } from "jimu-ui/advanced/resource-selector"
import { Button, TextInput, Checkbox, Switch, NumericInput } from "jimu-ui"
import { JimuMapViewComponent, type JimuMapView } from "jimu-arcgis"
import type Layer from "esri/layers/Layer"
import type { IMConfig, ABLSView } from "../config"
import defaultMessages from "./translations/default"
import { getLayersFromJimuMapView } from "./utils"
// @ts-expect-error - No types available for this package
import "./style.css"

export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
export default function Setting (props: AllWidgetSettingProps<IMConfig>) {
const { id, config, onSettingChange, useMapWidgetIds } = props
const [jimuMapView, setJimuMapView] = React.useState<JimuMapView>(null)
const [layers, setLayers] = React.useState<__esri.Layer[]>(null)
const [layers, setLayers] = React.useState<Layer[]>(null)

const onMapSelected = (useMapWidgetIds: string[]) => {
onSettingChange({
Expand Down
9 changes: 5 additions & 4 deletions ABLS/src/setting/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { JimuMapView } from 'jimu-arcgis'
import type Layer from 'esri/layers/Layer'


export function getLayersFromJimuMapView(jimuMapView: JimuMapView): __esri.Layer[] {
const layers = []
const collectLayers = (layerCollection) => {
layerCollection.forEach(layer => {
export function getLayersFromJimuMapView (jimuMapView: JimuMapView): Layer[] {
const layers: Layer[] = []
const collectLayers = (layerCollection: { forEach: (callback: (layer: any) => void) => void }) => {
layerCollection.forEach((layer: any) => {
layers.push(layer)
if (layer.layers) {
collectLayers(layer.layers)
Expand Down
3 changes: 2 additions & 1 deletion Calendar/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
],
"license": "MIT",
"publishMessages": [
"DATA_RECORDS_SELECTION_CHANGE"
"DATA_RECORDS_SELECTION_CHANGE",
"DATA_SOURCE_FILTER_CHANGE"
],
"translatedLocales": [
"en"
Expand Down
4 changes: 2 additions & 2 deletions Calendar/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Calendar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "exb-calendar",
"version": "1.1.1",
"version": "1.1.2",
"description": "A Calendar widget for Experience Builder Developer Edition",
"license": "MIT",
"author": "Lucius Creamer",
Expand Down
13 changes: 10 additions & 3 deletions Calendar/src/runtime/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import {
DataSourceStatus,
MessageManager,
DataRecordsSelectionChangeMessage,
DataSourceFilterChangeMessage,
type SqlQueryParams
} from "jimu-core"
import type { data, IMConfig } from "../config"
// @ts-expect-error - No types available for this package
import "./style.css"

import FullCalendar from "@fullcalendar/react"
Expand All @@ -20,7 +22,7 @@ import timeGridPlugin from "@fullcalendar/timegrid"
import type { ViewApi } from "@fullcalendar/core"
import { cssVar } from "polished"

export default function Widget(props: AllWidgetProps<IMConfig>) {
export default function Widget (props: AllWidgetProps<IMConfig>) {
const { config } = props
const [datasources, setDatasources] = React.useState<DataSource[]>([])
// Store events keyed by datasource ID to support multiple datasources
Expand Down Expand Up @@ -133,7 +135,7 @@ export default function Widget(props: AllWidgetProps<IMConfig>) {
}
}

const handleEventClick = (clickInfo) => {
const handleEventClick = (clickInfo: any) => {
const eventDs = clickInfo.event.extendedProps.dataSource as DataSource
const originalId = clickInfo.event.extendedProps.originalId as string
eventDs.selectRecordsByIds([originalId])
Expand Down Expand Up @@ -190,6 +192,11 @@ export default function Widget(props: AllWidgetProps<IMConfig>) {
...prev,
[matchedDataSource.dataSourceId]: queryParams.where
}))
const message = new DataSourceFilterChangeMessage(
props.widgetId,
[matchedDataSource.dataSourceId]
)
MessageManager.getInstance().publishMessage(message)
})
}

Expand Down Expand Up @@ -276,7 +283,7 @@ export default function Widget(props: AllWidgetProps<IMConfig>) {
return (
<DataSourceComponent
key={dsConfig.id}
useDataSource={Immutable(matchedDataSource)}
useDataSource={Immutable.from(matchedDataSource)}
query={
{
where: queryByDsId[matchedDataSource.dataSourceId] || "1=1",
Expand Down
64 changes: 39 additions & 25 deletions Calendar/src/setting/setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import {
CollapsablePanel,
NumericInput
} from "jimu-ui"
import type { IMConfig, colorset, data } from "../config"
import type { IMConfig, Config, colorset, data } from "../config"
import {
DataSourceSelector,
FieldSelector
} from "jimu-ui/advanced/data-source-selector"

export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
export default function Setting (props: AllWidgetSettingProps<IMConfig>) {
const { id, config } = props
const [activeTab, setActiveTab] = React.useState<string | undefined>(
config?.dataSets?.[0]?.id
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
return { ...rest, dataSourceId: legacyDataSource.dataSourceId }
})

const newConfig = (config || Immutable({})).set(
const newConfig = (config || Immutable.from({} as Config)).set(
"dataSets",
migratedDataSets
)
Expand All @@ -85,7 +85,10 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
)
if (datasetIndex === -1) return
datasets[datasetIndex] = { ...datasets[datasetIndex], ...newData }
const newConfig = (config || Immutable({})).set("dataSets", datasets)
const newConfig = (config || Immutable.from({} as Config)).set(
"dataSets",
datasets
)
props.onSettingChange({ id, config: newConfig })
}

Expand All @@ -97,7 +100,9 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
const oldDataSourceId = dataset.dataSourceId

// Remove old data source from widget-level useDataSources (if any)
let updatedWidgetDataSources = (props.useDataSources || []).filter(
let updatedWidgetDataSources: UseDataSource[] = [
...(props.useDataSources || [])
].filter(
(widgetDataSource) => widgetDataSource.dataSourceId !== oldDataSourceId
)

Expand All @@ -119,18 +124,21 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
datasets[datasetIndex] = {
...datasets[datasetIndex],
dataSourceId: newDataSource?.dataSourceId,
labelField: undefined,
startDateField: undefined,
endDateField: undefined,
allDayField: undefined,
descriptionField: undefined,
colorsetField: undefined,
labelField: undefined as string | undefined,
startDateField: undefined as string | undefined,
endDateField: undefined as string | undefined,
allDayField: undefined as string | undefined,
descriptionField: undefined as string | undefined,
colorsetField: undefined as string | undefined,
defaultEventColor: "#3788d8",
colorsets: []
}
}

const newConfig = (config || Immutable({})).set("dataSets", datasets)
const newConfig = (config || Immutable.from({} as Config)).set(
"dataSets",
datasets
)

props.onSettingChange({
id,
Expand All @@ -142,7 +150,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}

const addDataset = () => {
const newDataset = {
const newDataset: data = {
id: `ds_${utils.getUUID()}`,
labelField: undefined,
startDateField: undefined,
Expand All @@ -155,7 +163,10 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}
const datasets = getDataSets()
datasets.push(newDataset)
const newConfig = (config || Immutable({})).set("dataSets", datasets)
const newConfig = (config || Immutable.from({} as Config)).set(
"dataSets",
datasets
)
props.onSettingChange({ id, config: newConfig })
}

Expand All @@ -164,12 +175,13 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
const remainingDatasets = getDataSets().filter(
(dataset: any) => dataset.id !== datasetId
)
const newConfig = (config || Immutable({})).set(
const newConfig = (config || Immutable.from({} as Config)).set(
"dataSets",
remainingDatasets
)

let updatedWidgetDataSources = props.useDataSources || []
let updatedWidgetDataSources: UseDataSource[] = (props.useDataSources ||
[]) as UseDataSource[]
if (toRemove?.dataSourceId) {
const stillUsed = remainingDatasets.some(
(dataset) => dataset.dataSourceId === toRemove.dataSourceId
Expand Down Expand Up @@ -300,14 +312,14 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
(dataset: ImmutableObject<data>, datasetIndex: number) => {
// Key change!
const datasetUseDataSources = dataset.dataSourceId
? Immutable(
? Immutable.from(
(props.useDataSources || []).filter(
(widgetDataSource) =>
widgetDataSource.dataSourceId ===
dataset.dataSourceId
)
)
: Immutable([])
: Immutable.from([] as UseDataSource[])

return (
<Tab
Expand All @@ -318,7 +330,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
>
<SettingRow label={"Data Source"} level={1} flow={"wrap"}>
<DataSourceSelector
types={Immutable([DataSourceTypes.FeatureLayer])}
types={Immutable.from([DataSourceTypes.FeatureLayer])}
mustUseDataSource={true}
isMultiple={false}
useDataSources={datasetUseDataSources}
Expand Down Expand Up @@ -352,7 +364,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}}
selectedFields={
dataset?.labelField
? Immutable([dataset.labelField])
? Immutable.from([dataset.labelField])
: datasetUseDataSources?.[0]?.fields
}
/>
Expand All @@ -376,7 +388,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}}
selectedFields={
dataset?.startDateField
? Immutable([dataset.startDateField])
? Immutable.from([dataset.startDateField])
: datasetUseDataSources?.[0]?.fields
}
/>
Expand All @@ -400,7 +412,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}}
selectedFields={
dataset?.endDateField
? Immutable([dataset.endDateField])
? Immutable.from([dataset.endDateField])
: datasetUseDataSources?.[0]?.fields
}
/>
Expand All @@ -424,7 +436,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}}
selectedFields={
dataset?.allDayField
? Immutable([dataset.allDayField])
? Immutable.from([dataset.allDayField])
: datasetUseDataSources?.[0]?.fields
}
/>
Expand All @@ -449,7 +461,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}}
selectedFields={
dataset?.descriptionField
? Immutable([dataset.descriptionField])
? Immutable.from([dataset.descriptionField])
: datasetUseDataSources?.[0]?.fields
}
/>
Expand Down Expand Up @@ -500,7 +512,9 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
}}
selectedFields={
dataset?.colorsetField
? Immutable([dataset.colorsetField])
? Immutable.from([
dataset.colorsetField
])
: datasetUseDataSources?.[0]?.fields
}
/>
Expand Down
Loading
Loading