Code Monkey home page Code Monkey logo

arcgis-experience-builder-sdk-resources's Introduction

Overview - V1.14

This repository provides samples for widgets and themes built with ArcGIS Experience Builder. Learn more about ArcGIS Experience Builder SDK.

Features

Instructions

Clone the repo into the client/sdk-sample folder

cd client
git clone [email protected]:Esri/arcgis-experience-builder-sdk-resources.git sdk-sample

Requirements

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Licensing

Copyright 2023 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's License.txt file.

arcgis-experience-builder-sdk-resources's People

Contributors

blissvisitor avatar dmartine avatar esride-nik avatar gavinr avatar gavinr-maps avatar jptipton avatar qiqingjin avatar qlqllu avatar shawnmgoulet avatar stevboyd avatar sunshaoze avatar timwenmelo avatar wei8123 avatar weiy0415 avatar ziy13164 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcgis-experience-builder-sdk-resources's Issues

Translation Custom Widget

Hello,

i want to use the custom translation widget in this repo.
I followed all the steps in the description and i can add the custom to my experience builder app.

The problem:
Just the default key from the default.ts are showing up.
If i change the locale for example to "de" and yes i have a de.js file, where the keys are translated, i get just the noation within the brackets. For example for ${key1} i get just "key1".
In the manifest file i added the languages in translatedLocales..

In the developer tools i can find an error:

Capture

Do i need any requirements on my webserver where my files are saved to give acces for my portal?
For example does node.js has to be installed in IIS or on the webserver itself?
Can anybode help me to get this widget running?

[UC feedback] More explanatory and instructive comments in the custom widget sample code

It would really be helpful if there were more explanatory comments in the custom widget sample code. I have pretty much figured them all out already, but some of the more recent ones have been pretty abstract. (statistic-client-side-output, for example). I just thought I would mention it. I was taught to add lots of explanatory comments and have seen not only the value it provides for someone else who may have to work with my code, but also I have found that it really helped me when I had to go back and change things in my own code years later!

Dave Fullerton, City of Overland Park
[email protected]

Accessing ArcGISIdentityManager from @esri/arcgis-rest-request

Hello,

I have the latest version of Experience Builder Developer Edition installed locally (v1.13 – November 15, 2023) and I am developing a custom widget. I've installed Node.js version 16 and React.js version 18. In my custom widget I want to run an interpolation analysis. In one of the demos in the JS API documentation the following is imported:

import {
Job,
JOB_STATUSES,
ArcGISIdentityManager,
} from "@esri/arcgis-rest-request"

Pasting that in my implementation throws a error because Job, JOB_STATUSES and ArcGISIdentityManager are not exported by @esri/arcgis-rest-request. This is a version problem as my version 3.7.0 only exports requests and not Job, JOB_STATUSES or ArcGISIdentityManager. Is there a way that I can update my @esri/arcgis-rest-request in my experience builder client? I tried npm update @esri/arcgis-rest-request but I just get the following warnings and the problem remains
Screenshot 2024-02-01 at 11 27 32

Editor sample

Provide an example on how to style the css to allow the scroll bar like below.
.esri-editor__scroller {
overflow-y: auto;
padding-top: $cap-spacing--half;
padding-bottom: $cap-spacing;
}

react-data-grid dependency issue

When I try to add the react-data-grid widget to the developer version (rc3), this error shows:
image

It seems the import argument:
import * as ReactDataGrid from "react-data-grid";
in the widget.tsx is trying to look for the react-data-grid package under "client" rather than widget's own directory.

Problem with the DataSourceSelector and the FieldSelector

I'm trying to use the DataSourceSelector and the FieldSelector for a widget and it doesn't seem to work correctly for multiple data sources and fields. Here are the initial settings in the "setting.tsx" file :

            <div className="use-feature-layer-setting p-2">
              <DataSourceSelector
                
                disableAddData={true}
                types={this.supportedTypes}
                useDataSources={this.props.useDataSources}
                useDataSourcesEnabled={this.props.useDataSourcesEnabled}
                onToggleUseDataEnabled={this.onToggleUseDataEnabled}
                onChange={this.onDataSourceChange}
                mustUseDataSource={true}
                widgetId={this.props.id}
                isMultiple={true}

              />
              {
                this.props.useDataSources && this.props.useDataSources.length > 0 &&
                  <div className='mt-2'>
                    <FieldSelector
                      placeHolder={'Sélectionner les champs'}
                      useDropdown={false}
                      useDataSources={this.props.useDataSources}
                      onChange={this.onFieldChange}
                      isMultiple={true}
                      selectedFields={this.getSelectedFields() || Immutable([])}
                    />
                  </div>
              }

            </div>

Here are some of the functions that interact with the DataSource and the FieldSelector:

  onFieldChange = (allSelectedFields: IMFieldSchema[], ds: DataSource) => {
    let newDS: UseDataSource[] = [];
    let useDS = this.props.useDataSources;
    useDS.forEach((item) => {
      let estDataSourceCourant = item.dataSourceId === ds.id;
      let fields: string[];
      if (estDataSourceCourant) {
        fields = allSelectedFields.map(f => f.jimuName);
      }
      else {
        fields = [];
        item.fields?.forEach(f => {
          fields.push(f);
        });
      }
      let newItem: UseDataSource = { dataSourceId: item.dataSourceId, dataViewId: item.dataViewId, fields: fields, mainDataSourceId: item.mainDataSourceId, rootDataSourceId: item.rootDataSourceId };

      newDS.push(newItem);
    })
    const newDSSort: UseDataSource[] = [];
    const firstDS = newDS.find(d => d.dataSourceId === ds.id);
    if (firstDS) {
      newDSSort.push(firstDS);
    }

    newDS.sort((a, b) => a.dataSourceId.localeCompare(b.dataSourceId)).filter(d => d.dataSourceId !== ds.id).forEach(ds => {
      newDSSort.push(ds);
    });


    this.props.onSettingChange({
      id: this.props.id,
      useDataSources: newDSSort
    })
  }

 getSelectedFields = () => {
    let selectedFields: { [dataSourceId: string]: string[] } = {};
    this.props.useDataSources.forEach((item) => {
      let fields: string[] = [];
      item.fields?.forEach(f => {
        fields.push(f);
      })
      selectedFields[item.dataSourceId] = fields;
    })

    return Immutable(selectedFields);
  }

What I'm trying to do is a widget where I can choose multiple DataSources and for each DataSource, I want to select some fields. The problem that I have is when I select some fields for a DataSource and then I select another DataSource to change the fields, the fields for the first DataSource are reset. Here's an example:
Here I selected some field for a DataSource and then I switch to another DataSource by using the dropdown.

image

Then I select a field in the other DataSource and I switch back to the first DataSource.

image

Now all the fields that I selected are unselected except for the ObjectId. The problem is that when I use the dropdown to change the DataSource, the onFieldChange function is executed at the same time but with the wrong fields passed in parameter. I tried to find why and I found that the problem was in the "data-source-selector.js" file. In the " n.onSelectedUseDsChange" function, the value of selectedDs is changed by calling setState. However, when the function calls "n.getSelectedFields", the value of "n.state.selectedDs" is used as a parameter but it still has the old value assigned to it. The function then returns the wrong fields and they are passed to the "n.props.onChange" function. That's why the wrong fields are passed in parameters in my "onFieldChange" function.

image
image

I did a pretty-print of the file in "client/dist/jimu-ui/advanced/data-source-selector.js"and I tried to fix the problem by modifying it by changing the first parameter in the call to "getSelectedFields" in the "n.onSelectedUseDsChange" function. I then replaced the file with the new version that I created. After doing that, it started to work correctly.

image

Some jimu-ui components breaks testing

When some jimu-ui components are included in a component, the tests for that component always fails. I have not tried all of the jimu-ui components but the NumericInput and Popper components causes this behaviour. The Button and Select works as expected.

Some code
A few simple React components with jimu-ui components:

import { Button, NumericInput, Popper } from "jimu-ui";

type props = {
  onChange: () => void;
};
const TestComponentButton: React.FC<props> = ({ onChange }) => {
  return <Button data-testid={"test"} value={5} onChange={onChange}></Button>;
};

const TestComponentNumericInput: React.FC<props> = ({ onChange }) => {
  return (
    <NumericInput
      data-testid={"test"}
      value={5}
      onChange={onChange}
    ></NumericInput>
  );
};

const TestComponentPopper: React.FC = () => {
  const ref = React.useRef();
  return (
    <Popper reference={ref} open showArrow>
      test
    </Popper>
  );
};

export { TestComponentButton, TestComponentNumericInput, TestComponentPopper };

And some tests:

import { widgetRender } from "jimu-for-test";
import {
  TestComponentButton,
  TestComponentNumericInput,
  TestComponentPopper,
} from "../components/TestComponent";

const render = widgetRender();

describe("test storybook components", () => {
  it("button", async () => { // Fungerar
    const { findByTestId } = render(
      <TestComponentButton onChange={jest.fn()} />
    );
    expect(await findByTestId("test")).toBeDefined();
  });
  it("numericinput", async () => {
    const { findByTestId } = render(
      <TestComponentNumericInput onChange={jest.fn()} />
    );
    expect(await findByTestId("test")).toBeDefined();
  });
  it("popper", async () => {
    const { findByText } = render(<TestComponentPopper />);
    expect(await findByText("test")).toBeDefined();
  });
});

Tests result in exceptions like these:

TypeError: Cannot read property 'length' of undefined

  239 |       word-break: break-all;
  240 |       word-wrap: break-word;
> 241 |       span {
      |                       ^
  242 |         color: ${r};
  243 |         text-decoration: underline;
  244 |       }

  at zt (dist/jimu-ui/index.js:241:54352)

and

TypeError: Cannot read property 'toLowerCase' of undefined

  136 |               padding: ${m}; /* decided by shadow*/
  137 |               overflow-y: auto;
> 138 |
      | ^
  139 |               border: none;
  140 |               box-shadow: unset;
  141 |               background-color: transparent;

  at Df (dist/jimu-core/index.js:138:16261)

ArcGIS Experience Builder widget with Link component fails to run Jest tests

Cannot add the Link component from the jimu-ui package and then be able to write tests.

For example, if this is added to the simple-widget.test.tsx file:

render( <Link onClick={function dummyfunc() {}} title="custom title" to="?a=1"> Link to Click </Link> );

Getting the below error while running the test:

Exception has occurred: TypeError: Cannot read properties of null (reading 'dialogs') at C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\dist\jimu-ui\index.js:3186:1694 at C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\dist\jimu-core\index.js:46:168640 at e (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\dist\jimu-core\index.js:46:132667) at C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\dist\jimu-core\index.js:46:132872 at mountSyncExternalStore (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:16799:20) at Object.useSyncExternalStore (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:17727:14) at useSyncExternalStore (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react\cjs\react.development.js:1676:21) at t.useSyncExternalStoreWithSelector (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\dist\jimu-core\index.js:46:132942) at Module.<anonymous> (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\dist\jimu-core\index.js:46:168666) at C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\dist\jimu-ui\index.js:3186:1666 at renderWithHooks (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:16305:18) at updateForwardRef (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:19226:20) at beginWork (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:21636:16) at HTMLUnknownElement.callCallback (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:4164:14) at HTMLUnknownElement.callTheUserObjectsOperation (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\jsdom\lib\jsdom\living\generated\EventListener.js:26:30) at innerInvokeEventListeners (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:350:25) at invokeEventListeners (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:286:3) at HTMLUnknownElementImpl._dispatch (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:233:9) at HTMLUnknownElementImpl.dispatchEvent (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:104:17) at HTMLUnknownElement.dispatchEvent (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\jsdom\lib\jsdom\living\generated\EventTarget.js:241:34) at Object.invokeGuardedCallbackDev (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:4213:16) at invokeGuardedCallback (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:4277:31) at beginWork$1 (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:27451:7) at performUnitOfWork (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:26560:12) at workLoopSync (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:26466:5) at renderRootSync (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:26434:7) at performConcurrentWorkOnRoot (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react-dom\cjs\react-dom.development.js:25738:74) at flushActQueue (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react\cjs\react.development.js:2667:24) at recursivelyFlushAsyncActWork (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react\cjs\react.development.js:2633:9) at Immediate._onImmediate (C:\ESRI\arcgis-experience-builder\arcgis-experience-builder\client\node_modules\react\cjs\react.development.js:2641:13) at processImmediate (node:internal/timers:478:21) at process.callbackTrampoline (node:internal/async_hooks:130:17)

'test theme variable' fails

The referenced test is trying to overwrite a color value in the theme from '#000' to '#FFF' to render it to the widget UI. It fails because the method of overwriting a theme variable doesn't seem to work anymore.

The content of renderResult.baseElement.innerHTML is:
<div><div class="widget-show-unit-tests jimu-widget"><p>This widget shows how to unit test a widget.</p><div>Widget label:</div><div>Theme variable:#000</div><button>Click me</button><div>Count:0</div><button>Query features</button><div><div>Query Result count:</div></div></div></div>

As you can see, '#000' is still contained in the widget UI.

The test ouput is:
` test show-unit-tests widget › test theme variable

expect(received).toBeInTheDocument()

received value must be an HTMLElement or an SVGElement.
Received has value: null`

https://github.com/Esri/arcgis-experience-builder-sdk-resources/blame/d455a007e64fb99175ac7f959fe546f69c788465/widgets/show-unit-tests/tests/widget.test.tsx#L51

Dependency definition and registration

Issue

Registering or including 3rd parties not pre-packaged with jimu-core fails for absolute url and is missing some docs for DependencyDefine.

tl;dr - I've tried following the docs based on my assumptions of how it works and that's failing. How am I supposed to register a third party dependency for a widget? I want to use some tools I'm familiar with like the arcgis-rest-js library, axios, etc for the functionality of this tool. How do I idiomatically use these when writing a custom experience builder widget?

Context

The documentation says that to include dependencies for a widget, you can provide the absolute url to the library. Passing a CDN url to the manifest throws a 404 error. The minimum manifest to reproduce and the error message are below.

{
  "name": "test",
  "type": "widget",
  "version": "1.0.0",
  "dependency": ["jimu-arcgis", "https://unpkg.com/@esri/[email protected]/dist/umd/portal.umd.min.js"],
  "exbVersion": "1.0.0",
  "author": "Esri R&D Center Beijing",
  "description": "a widget",
  "copyright": "",
  "license": "http://www.apache.org/licenses/LICENSE-2.0",
  "properties": {},
  "translatedLocales": [
    "en"
  ],
  "defaultSize": {
    "width": 800,
    "height": 500
  }
}

Error:

Error: Fetch error: 404 Not Found
  Instantiating https://localhost:3001/experience/../@esri/arcgis-rest-request
  Loading https://unpkg.com/@esri/[email protected]/dist/umd/portal.umd.min.js
  Loading https://unpkg.com/@esri/[email protected]/dist/umd/portal.umd.min.js

Running an isAbsoluteUrl check on the provided CDN returns true, so I know the url is correct. If absolute url doesn't refer to the CDN, perhaps I'm missing something there.

DependencyDefine

The other method for this in the docs just says to provide an implementation of DependencyDefine, but doesn't say how, where this goes, or the purpose of the relevant interfaces.

The code seems to imply you need to provide an ExtensionProperties {point, name, label, uri} object passed to the manifest's "extensions" property, but the function of providing point, name, and label aren't clear.

Is point supposed to reference the kind of extension being registered (extensionSpec.ExtensionPoints.DependencyDefine) or is it meant to reference the Extension class itself? Are name and label significant for pointing the extension loading logic in the right direction or just my preference for the extension?

Also, when implementing an extension class, the purpose of the interface's methods are escaping me. For DependencyDefine, you're supposed to provide getDependencyKey and getResource. getResource seems to just be for returning a Resource {url, dependencies?} object that provides the url [meaning the cdn..?] for the library and an array of Resources for any of the resource's dependencies. getDependencyKey though returns a string, but I don't know what it's meant to provide - the name? label? id? something else?

Lastly, there's a set of class declarations at jimu-arcgis/dependency-extension.d.ts. Are we meant to use these for implementing DependencyDefine? There's undocumented props there, too - id and checkApiUrl.

I've read through a lot of code and still haven't found anything documenting how to use this approach. I've attempted the DependencyDefine implementation, but I'm stumbling in the dark on these props and interfaces, so I'm definitely doing it wrong and all the feedback I'm getting is:

Register widget extension error. test 1 index.js:16:100097
    registerWidgetExtension https://localhost:3001/experience/../jimu-core/index.js:16

jimu-icons not added to jest.config in latest version of ExB developer edition

If jimu-icons are used in your widget you cannot perform unit tests without updating the jest.config.js file.

I added:

"^jimu-icons/(.*)": "<rootDir>/jimu-icons/$1",

I also added the following for calcite-components:

"^calcite-components$": "<rootDir>/node_modules/@esri/calcite-components-react/dist/index.js",

The example used in use-calcite-components widget, did not work for me, because jest could not find calcite-components, and it referenced as @esri/calcite-components-react in the test script, so they don't match up.

Editor Widget 1.1

Hi,
I would like to report two issues with Editor widget.

  1. Editor widget doesn't honor editing settings of the layers in the web map. I have two layer web map and have disable the editing for one layer but when widget is used, it recognizes both the layers in the map are editable and on selection, select objects from both the layers for editing.

  2. Object on the map are left in selection mode. Editor widget's work flow is to select widget, click edit feature, select feature on the map, do edit & unselect the object by clicking back edit feature option in the widget. If someone closes the widget without hitting the back edit feature and if object was selected on the map, the object remain in the selected state. Now, if you, click on the widget and try to edit another object, the previous selection remain on the screen. Only way to get out of it is to refresh the map.

Is it possible to have work around as above issues are just preventing use of editor widget.

Regards,

Sunil

Query property not adequate for data sources that come from an array

widgetId={this.props.id} query={{ where: '1=1' } as QueryParams} onDataSourceInfoChange={this.onOutputDataSourceInfoChange}

The query property should be used for AGOL/portal items or remote databases, not for data sources from arrays. Query calls the load method which is not the right method for data sources that have an array as a source.

Update the translation widget

Hi,

i have the translation widget running and everything works fine so far.
I just want to know how to update it. Do i have to package it everytime i want to add a key with its translation to the widget?
Because when i change the es.js file on the webserver for example and i add a new key with its translation, the widget does not recognize the new key.
When i change it and i package it with npm and register it with the portal again it works.
But this cant be the right way?

Thanks in advance for your help.

Control the widget state: openness bug

The openness state prop is set when the widget actively opens or closes another widget within a controller. This fails however, in case

  1. the user changes the widget selection => in this case, the openness prop is not adjusted to the new selection and might reflect a wrong status
  2. the user closes a widget via it's own "X" button or opens/closes a widget via the controller widet

Because of (2), we have to check for openness live when handleToggleOpennessButton()

Translations in widgets

Hi!

First of all, thanks for this repo, it's very helpful to start with ExB Dev Edition!
I'm working on translations in widgets and I think that the demo widget is not working because the properties aren't translated. I tried it adding to URL locale=zh-cn and the menu updated but the properties defined in the widget are not.

Can you help me? Am I doing something wrong to test the translation?

image

This should appear:
image

Thanks for your help! 🤗

Can identify map in widget config

The "Show Extent" widget lacks a way to identify the map to link to. The tabs "Content" and "Action" are missing on the widget config.

Provide an example on how to add other data sources not yet supported by Experience builder

Hello,
My organization works a lot with WMS and OGC API Features. Those services are not (yet?) supported by Experience builder, but are supported by the ArcGIS JS API. So I guess it would be possible to modify jimu-core and/or jimu-arcgis to allow the app to render wms and ogc api features layers. I have successfully added a OGCFeatureLayer to a map by modifying your add-layer widget example, but some issues are still remaining (when the layer is added to the map, it creates thousands of requests to our geoserver, which slows a lot the display of the layer).
It would be great to have a guide or an exemple about the best practices to achieve that.
Thanks for your good work!

ArcGIS Experience Builder widget with ModalHeader component fails to run Jest tests

Cannot add the ModalHeader component from the jimu-ui package and then be able to write tests.

For example, if this is added to the simple-widget.test.tsx file:

import { Modal, ModalHeader } from 'jimu-ui'
...
render(<Modal isOpen={true}><ModalHeader></ModalHeader></Modal>);

This error is thrown:

 FAIL  your-extensions/widgets/simple/tests/simple-widget.test.tsx
  ● test simple widget › simple test

    TypeError: Cannot read properties of undefined (reading 'toLowerCase')

      44 |         .button-separator {
      45 |           height: 18px;
    > 46 |           border-right-width: 1px;
         |                                                                                     ^
      47 |           border-right-style: solid;
      48 |           border-right-color: ${e.colors.palette.light[700]};
      49 |         }

      at Mf (dist/jimu-core/index.js:46:367508)
      at sh (dist/jimu-core/index.js:46:377130)
      at yl.render (dist/jimu-ui/index.js:3113:8374)
      at finishClassComponent (node_modules/react-dom/cjs/react-dom.development.js:19752:31)
      at updateClassComponent (node_modules/react-dom/cjs/react-dom.development.js:19698:24)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:21611:16)
      at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:27426:14)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:26560:12)
      at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:26466:5)
      at renderRootSync (node_modules/react-dom/cjs/react-dom.development.js:26434:7)
      at recoverFromConcurrentError (node_modules/react-dom/cjs/react-dom.development.js:25850:20)
      at performSyncWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:26096:20)
      at flushSyncCallbacks (node_modules/react-dom/cjs/react-dom.development.js:12042:22)
      at commitRootImpl (node_modules/react-dom/cjs/react-dom.development.js:26959:3)
      at commitRoot (node_modules/react-dom/cjs/react-dom.development.js:26682:5)
      at finishConcurrentRender (node_modules/react-dom/cjs/react-dom.development.js:25981:9)
      at performConcurrentWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:25809:7)
      at flushActQueue (node_modules/react/cjs/react.development.js:2667:24)
      at act (node_modules/react/cjs/react.development.js:2582:11)
      at node_modules/@testing-library/react/dist/act-compat.js:46:25
      at renderRoot (node_modules/@testing-library/react/dist/pure.js:161:26)
      at render (node_modules/@testing-library/react/dist/pure.js:247:10)
      at render (jimu-for-test/lib/test-utils.tsx:19:17)
      at jimu-for-test/lib/test-utils.tsx:218:65
      at Object.<anonymous> (your-extensions/widgets/simple/tests/simple-widget.test.tsx:10:5)

Demo Widget Inconsistency?

On the demo widget, why does the setting.txs that is in the widget folder doesn't match what is described on the readme file?

[UC feedback] From Alejandro Mari, Fujitsu - (BC Hydro Project)

  • 1. He's having a hard time understanding how to use FeatureLayerDataSource from the map widget (for example, he has a checkbox in his widget that when it is checked should filter a layer on the map). Should we add a FeatureLayerDataSource sample? (@Junshan I think you and I discussed the idea of adding this sample at one point)

  • 2. The Out-of-the-box "Chart" widget uses some charting library. Is he able to use this same charting library in his custom widget? (Jianxia Song, Junshan Liu, or anyone here General is there a quick answer on this question?)

  • 3. He wants to have a custom widget that opens floting "child widgets" kindof like the controller widget. Is he able to do this in his custom widget? If so, we should add some documentation or examples around that.

custom widgets throws exception when no settings page is included

Custom widgets, e.g. demo-function throw an exception like the one below when a settings page is not included.

Could not load worker TypeError: e.split is not a function
    at ace.define.t.moduleUrl (json-editor-setting.js:2:20615)
    at ace.define.$createWorkerFromOldConfig (json-editor-setting.js:2:397438)
    at new l (json-editor-setting.js:2:397013)
    at u.createWorker (json-editor-setting.js:2:438662)
    at e.$startWorker (json-editor-setting.js:2:173014)
    at e.$onChangeMode (json-editor-setting.js:2:172398)
    at e.<anonymous> (json-editor-setting.js:2:172141)
    at l (json-editor-setting.js:2:21211)
    at ace.define.t.loadModule (json-editor-setting.js:2:21821)
    at e.setMode (json-editor-setting.js:2:171956)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.