Coder Social home page Coder Social logo

anvil-extras's People

Contributors

akrog avatar alcarney avatar daviesian avatar hugetim avatar jshaffstall avatar lewysigns avatar meatballs avatar pre-commit-ci[bot] avatar rhurlbatt avatar s-cork avatar samgeens avatar stenci avatar theref avatar tiepies avatar yahiakala 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anvil-extras's Issues

Quill component

We could make this properly!

The quick start guide for anvil.js was nothing more than an intro.
Examples on the forum are mostly half baked

It'd be nice to have a Quill implementation that was more compatible with anvil.

quill = Quill()
quill.getText()
quill.setText()
quill.getContent()
## these are all the js methods
## We'd just need to override the __getattr__
## we could regex for snake to camel case if we like


quill.to_simpleobject() # this is very easy and means you can save it in the database as a simple object
quill.to_markdown() # I'm sure this must be possible! Then you can just display it in a rich text component


## to thing about
quill.readonly
quill.toolbar_options

Indeterminate Progress Bar Hit or Miss

I have the new indeterminate progress bar embedded in a popup alert (an app loading screen). I am finding that progress bar animation works maybe 50-60% of the time, where 40-50% of the time the progress bar is solid blue without the animation. Haven't changed any code on that loading screen in a while so can't find a reason for the intermittent animation success. Thanks for taking a look!

Quill Image Resize Module

Hi! Amazing and very useful tools so congrats and thanks for your work guys!!

One question.. How would I go about adding the Quill Resize module when using the extras? I managed to get it working when adding Quill by myself by adding the line below it to native libraries and making the necessary changes to the JS setup.

I tried adding the line to native libraries but it did nothing sadly as I guess I'd have to change the Quill setup on JS.

Native libraries line: <script src="https://cdn.jsdelivr.net/npm/[email protected]/image-resize.min.js" async></script>
Link to Quill image resize module: https://github.com/kensnyder/quill-image-resize-module

I don't know anything other than Python so sorry if this is easy, I just haven't found the way yet. Thanks!

Tags

I've written something similar before. A nice component for a lot of uis

Clone link for a demo?

I'm excited about the new installation instructions, but only installing it as a third-party dependency means I can't see and play with the demo code demonstrating the components. Maybe create a separate "Extras Demo" app that has Extras installed as a third-party dependency, and provide a clone link to the demo app?

examples gallery

Perhaps we should create an examples gallery
We already have examples for most things
e.g. popover, augment, hashrouting
It would be good if these could live in an appropriate place and linked to in the docs

Augment trigger('writeback')

just an idea based on this post
https://anvil.works/forum/t/why-no-refresh-data-bindings-for-write-back-data-binding/8211/

I can see an argument for adding a writeback feature only for textbox/textarea components to trigger writeback on change. The current way to do it is verbose and requires too much boiler plate.

I could potentially add the method to trigger method that already exists in the augment library.

from anvil_extras import augment

def textbox_change(self, sender, **event_args):
    sender.trigger('writeback') # all writeback properties get written back on this component

The writeback would be on the component rather than on the Form so it would be different to the feature request.
https://anvil.works/forum/t/please-support-refresh-data-bindings-for-write-back-as-well/8226

Thoughts?

Alternative apis

augment.writeback(sender)
augment.trigger_writeback(sender)

update noUiSlider

They just release a new version which adds an api that I contributed with anvil in mind ๐Ÿ˜‰

Internal Test suite

We should have a separate test suite that depends on anvil-extras

Especially if the user who depend on it grow.

And after #73 we're committing to backward compatibility/being very loud about breaking changes - until anvil supports versioning.

Happy to get this one started since I have a template written for testing anvil components internally.

I'm not sure what the best integration is here.
It shouldn't be part of the anvil-extras client_code since that'll massively bulk up what gets sent to the client for those depending on the app.

We also would want prs to include tests.
It might be least hassle to create a test suite app as a separate repo and make a note of how to add tests with a pr in the contributing docs.

Storage error (only) when running in development mode

When clicking the "Run" button to test an Anvil app in development mode (but not when running the app via its url), I get the following error when trying to import local_storage:

ExternalError: SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
at app/anvil_extras/storage.py, line 103
  called from StorageDemo, line 5
  called from Main, line 9

I suppose it's something to do with the iframe? This was not happening just 24 hours ago, but now it persistently is.

Clone link: https://anvil.works/build#clone:X32NITRHDRRHDOFO=OIDA3G3GQVMLMMT2LPC7BV3O

Remove get_uid from session

Probably no longer required and can be replaced with anvil.js.get_dom_node

This will affect the two progress bar components.

Fix margin on PageBreak component

The margin of -55px taken from the original css doesn't seem to work now that it's incorporated into a form.

Probably best to make it a property so it can be passed in.

LocalStorage - datetime storage

localstorage should be able to handle datetime objects

best to wait until strptime gets added to skulpt before attempting this

Navigation click_link(target="") method?

I would like to be able to emulate clicking a navigation menu link from code. The undocumented method 'open_form' gets me most of the way there but it doesn't show the menu link as selected.

Auto-refresher removes reference relationship

In the auto_refreshing Demo code, self.item is initialized like this:

self.item = self.default_item = dict(tally=100, counter=0,)

There are buttons to change item["tally"] and item["counter"], and the label components displaying these values are auto-refreshed. Then there is another button that resets the tally and counter to the default values via this line:

self.item = self.default_item

This works as intended, but the trouble is that this actually shouldn't work--and it indeed doesn't work without the auto-refreshing enabled. The reason is that self.item was initialized to be equal to self.default_item by reference, so any changes to self.item should also change self.default_item. The fact that it doesn't when auto-refreshing is triggered by changes to self.item seems to be a subtle bug (or undocumented side effect) in the auto-refreshing functionality.

Alternative "classic" navigation api?

I think I'd like to be able to put all the navigation configuration in one place, in the Main (or startup) module. Then the navigation module needn't even be imported in the content forms. Rather, everything could be configured in one place, which could look like:

from anvil_extras import navigation
from ...Components import Components
from ...MessagingDemo import MessagingDemo

menu = [
    dict(text="Components", name="components", form=Components, title="Component Demos"),
    dict(text="Messaging", name="messaging", form=MessagingDemo, title="Publish/Subscribe Messaging"),
]

class Main(MainTemplate):
    def __init__(self, **properties):
        navigation.build_menu(self.menu_panel, menu)

Then when I want to add a new content Form to the menu, I need only make changes here (importing the Form and adding the menu specification dict). For one thing, this approach eliminates to need to make sure a 'target' key matches the 'name' key in a separate module.

Workflow Engine

One common element in the many of the apps I write is the need for some sort of workflow. I would be good to write a module to make that easier.

I can imagine defining a series of actions and the logic between them as elements of a flow-chart encoded within a dict.

Standard actions available might be:

  • Execute a function
  • Open a form within an alert

Add upgrade instructions to Installation docs

It may be pretty simple, but it wasn't obvious to me beforehand that this would work without a hitch (as long as the component names and API for the features you're using are stable between versions):

  1. Clone the new version of Anvil Extras.
  2. Remove the dependency on the old version from your app.
  3. Add a dependency to the new version.

EditableCard docs/demo

I'm having trouble understanding what the EditableCard is intended to be. As far as I can tell, though, it's not working.

(What I was picturing, for the "text" datatype anyway, was a textbox with a pencil icon in the upper right (when editable=True) that allows editing it.)

Tabs card role

could be a little nicer - margin -2px top and bottom helps. (eliminates the slight border radius) and then removing the left right padding

AutoCompleter

What do you think about an autocompleter component?

Just a proof of concept for now:

upi9yX9yHn

autocomplete item not clickable on mobile devices

Hi anvil community,

I use the Autocomplete in my app and i have problems to get it working on mobile devices.
On mobile devices I was not able to select a suggested item by clicking or pressing enter:

grafik

I tested this on Galaxy S8 and Iphone 6S.

Open this sample app on your mobile device and type "A":
https://AUSGIWLXDFGUKBDZ.anvil.app/RAPVVK5WB4R3KSLG2ENC3JCV
or clone the app:
https://anvil.works/build#clone:AUSGIWLXDFGUKBDZ=YAB7DUIKKSQTEC2MWDS3R36C

We don't support IE

anvil still does.
anvil-extras definitely doesn't

we should make a note somewhere in our docs.

ChipsInput

Would love the ChipsInput to take an actual Chip component, can change the background color of the chip going in. Would love to show the colors showing where a chip is within a workflow process. Would this be possible now? Using ChipsInput ?

log to component text field - override sys.stdin to output to the .text property.

I've used this in client side test suite before - it's pretty nice - you can set any text component to the stdout!

import sys

class _Out:
    def __init__(component):
        self._out = component
    def write(self, x):
        try:
            self._out.text += x
        finally:
            sys.__stdout__.write(x)

def set_component_as_stdout(component):
    sys.stdout = _Out(component)

Validator

We should triage the validator for the orm and include similar syntax as a complementary set of functions/decorators here.

I've always found the anvil Library validator component a little tricky to use and a simpler api would be great.

This combined with auto_refreshing would work really well I think.

auto_refreshing triggers the refresh_data_bindings which in turn will trigger the event handler so the idea here would be that you can do your validation inside the event handler refreshing_databindings.

Data Grid Extras

I have some code patterns I use regularly to add sorting and filtering to a data grid.

I could turn those into Mixin classes, I suspect.

designer component bug

when adding a designer component onto the screen default values can disappear if the component hasn't had any values changed.

to reproduce add any designer component and put the cursor into the spacing above input.
Move the cursor to a different input.
The value disappears.

popup

Uising the popup client code for a zoom into image type situation, its in a repeating panel. Seems the popup stays only the size/width of the current column

Attached is example
image

autocomplete focus breaks functionality

I found an issue where using the autocomplete focus method (autocomplete_1.focus()) will correctly take focus on the autocomplete widget but will disable the functionality of the autocomplete dropdown when the user starts typing. Thanks for having a look!

designer components

In #60, #31 and #51 i ended up writing a heap of javascript that was only for the designer.

One thing that i'd like to explore is moving this code into its own javascript files.
Either as a folder in this library or as a separate library within anvil-extras

Reasons:

Size:

  • This code is for the designer only and isn't necessary when the app is being run.
  • But the live app will still pull in the html as text unnecessarily
  • (the javascript never runs because it gets discarded before the component is added to the page)

DRY

  • A lot of the javascript is the same so it would be worth pulling out the common routines to make future designer compatible components easier to write

Growth

  • Development in the js eco system build process ๐Ÿ˜จ

Editor

  • it's a pain working with anvil's html editor

The html would then look something like

<div class="anvil-slider"></div>
<script type="module">
  import { DesignerSlider } from 'https://jspm.dev/anvil-extras/designer-components';
  DesignSlider.init();
</script>

This would keep the html small so reduce the code size. The javascript would only be loaded in the designer since in the real app we remove the script element before the component is added to the screen.

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.