Giter VIP home page Giter VIP logo

data-populator's Introduction

Data Populator

Data Populator

The documentation of the plugin has moved to datapopulator.com.

Get in touch

Join the conversation on the Data Populator Slack. Follow @datapopulator on Twitter for updates.

Please report bugs, observations, ideas & feature requests as issues or get in touch.

Contribute

If you have an idea or the need for a new feature for Data Populator, or run into a limitation you'd like to overcome – feel free to implement it and send us a Pull Request. We think the code architecture is understandable and modular enough to extend easily.

If you're a Designer and don't know how to code, kindly ask a Developer colleague or friend of yours – they'll kindly help you, as this is an investment in improving Designer's Data Literacy and Designer-Developer-Collaboration.

If you like, you can also contribute to the future development of Data Populator by buying us a coffee. Any kind of contribution is highly appreciated!

Development

Data Populator for Sketch

  1. cd sketch
  2. yarn
  3. yarn symlink
  4. yarn start (dev) or yarn build (production)

Data Populator for Adobe XD

  1. cd xd
  2. yarn
  3. yarn start (dev) or yarn build (production)

data-populator's People

Contributors

callmesh avatar dependabot[bot] avatar depfu[bot] avatar drosen-appneta avatar jakelin avatar lukasondre avatar maxfell avatar nikolasklein avatar nitrada avatar rengate avatar rezaarkan avatar rockitbaby avatar thierryc avatar zethussuen 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  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

data-populator's Issues

Ability to interpret nested data

Will there be an enhancement which enables Sketch to read nested data? Currently it ignores anything that is nested. For example:

[

    {
      "id": 1,
      "summary": "Willie",
      "image": "/images/_78419012.jpg",
      "items":[  
               {  
                  "type":"stuff",
                  "title":"stuff",
                  "summary":"stuff",
                  "stuff":false
                  },
      "headline": "stuff",
      "company": "stuff",
      "job": "stuff",
      "email": "stuff"
  ]

Thanks!

Map specific items in data to specific content variables

It would be great if we could map items in data to specific content variables? eg {firstname-0} = data[0].firstname

Use case:
Multiple modules (repeated elements) that are disconnected, across multiple artboards, or nested within different symbols but which share common data.

Thanks,

Open last active folder

When using "Populate with JSON" it would be helpful if the last active folder is opened and not the user's home folder.

I understand a folder must be authorized. But when you work on a project and have a specific json file located somewhere, it's quite tedious to always navigate to that specific folder, even if I may have placed it in the sidebar navigation or even though I can find it in the last used folders list.

creating grid with complex/nested JSON

Hi,

I need some help :)
Is there a way to add a 'need help' label to my issue? Couldn't find it...

I used a pretty complex JSON to populate a text in sketch. I successfully retrieved the title by naming the text layer: {sectionPage.primaryTeaserList[1].articleList[0].title}

Now I want to create a grid with the JSON populator. The grid should contain all titles from the 'articleList object'. So I need:
{sectionPage.primaryTeaserList[1].articleList[0].title}
{sectionPage.primaryTeaserList[1].articleList[1].title}
{sectionPage.primaryTeaserList[1].articleList[2].title}
...
{sectionPage.primaryTeaserList[1].articleList[6].title}

Any idea how to realize this in 1 'populate JSON command'?

thx!

Old Data Being Cached on a Per-Layer Basis?

It may be tricky to explain what's happening, but I'll try:

I created a JSON file from scratch, and ran it through jsonlint.com to validate it. I created the element in Sketch I wanted to populate, and ran the data file through Sketch Data Populator. The first time, it operated fine. But after some tweaking, I wanted to change some of the data - (specifically, shorten the names of some of the properties so I didn't have to have wide text boxes to accommodate them).

The new variable names weren't going through, however, and in fact I discovered that the entire value of the field was being overwritten with what had previously been put in by Sketch Data Populator. So for example, if the field was "Pencils, {var1}, and pens", and I changed it to, "!!! Pencils! {var1}, and pens!!!", Sketch Data Populator would parse the data with no apparent errors, but the field would read, "Pencils, crayons, and pens" instead of "!!! Pencils! crayons, and pens!!!"

I tried quitting Sketch and reopening it, and even uninstalling Sketch Data Populator and reinstalling, but nothing worked. But finally, I was able to circumvent the problem by creating entirely new objects instead of simply duplicating the old ones. This seemed to be a serviceable workaround.

Unfortunately I can't share the files since I'm under an NDA. I'd been working in the file for some time, and without knowing more about how the plug-in works, I can't offer much help on how to replicate, especially since I don't remember what all I did or how it happened.

Make Grid and Sketch 3.5

I can fill a single row but as soon as I try to make a grid placeholders aren't replaced anymore.

redo last command

it would be very handy to be able to do "populate again" and it will use exactly the same JSON file as last time

Multiline text box

How do I go about getting three or four lines of text in a box? I can't make the text box three or four lines tall so that it fills.

hierarchical data/layer structures

the data hierarchy

* group1
  * item1
  * item2
  * item3
* group2
  * item1
  * item2
  * item3
…

could be matched to the following layer hierarchy

* layergroupA
   * layergroup1
   * layergroup2
   * layergroup3
* layergroupB
   * layergroup1
   * layergroup2
   * layergroup3

meaning that {placeholders} will only be replaced on the respective level of the hierarchy

presets

have a "presets" folder in the plugin folder where you can move the JSON files. then, when running the plugin, it will give you a dialog to choose from those files (compare color palettes plugin)

it should still be possible to "import" any JSON from anywhere

Error parsing data

I've seen an error that reads, "There was an error parsing data. Please make sure it's valid."

Just wondering if you could help me understand what's triggering the error and how to fix it.

I've validated the JSON and it works with the plugin until it doesn't. Sometimes a new text box or a new document fixes the issue. The template I have is large so that's not ideal.

Help?

Image URL not populating.

Example JSON

[
  {
    "hero":"http://www.mountain.org/sites/default/files/image_assets/5920447977_f84dff5a33_o_cropped_0.jpg"
    }
]

It seems that it's not populating,
screen shot 2016-06-02 at 11 22 28

Any ideas? Sketch version is Version 3.8.3 (29802)

icon "placeholder"

scenario: in the data, you say eg. "icon": "email". in the sketch template you have a placeholder boundingBox with the desired size called "icon". the plugin looks up another sketch file and grabs a layer group (containing the mail icon as vector) called "email" and inserts the appropriate icon.

(i think it's not really possible technically, since generally speaking, this would be a great solution to "import" UI components/icons in a very meaningful way and somebody would have done that already ;-)

Images/image url issue

The textual contents are getting placed perfectly well, but the images remain the same. You can see if below that I have specified a different picture for each section but still in the end when I run the script in Sketch, it brings out only one of those images and on every "Populate again" command it just brings another picture but the same for everything.

I just started using this plugin so is there anything else I should be looking for ?

[
{
"course names" : "Cosmetic Dentistry",
"date" : "3 Mar 2016",
"price" : "Rs. 40,000",
"image" : "Informdoc iOS/images/File1.jpg"
},
{
"course names" : "State of the art Endodontics for the General Practitioner",
"date" : "NIL",
"price" : "Rs. 20,000",
"image" : "Informdoc iOS/images/File2.jpg"
},
{
"course names" : "Crown and Bridge",
"date" : "20 Feb 2016",
"price" : 15000,
"image" : "Informdoc iOS/images/File3.jpg"
},
{
"course names" : "Laser Dentistry",
"date" : "NIL",
"price" : 15000,
"image" : "Informdoc iOS/images/File4.jpg"
},
{
"course names" : "BPS Denture",
"date" : "13 Mar 2016",
"price" : 15000,
"image" : "Informdoc iOS/images/File5.jpg"
},
{
"course names" : "Certificate Program in Clinical Dentistry",
"date" : "09 Apr 2016",
"price" : 180000,
"image" : "Informdoc iOS/images/File6.png"
}
]

Writing out items in reverse order

Hi there,

I am using the populator to write out a list of sports in a text variable {sport}, these layers sit in a group that I have duplicated 27 times as there is other items in the group.

When I run the populator two things happen.

  1. The items write out in reverse order
  2. At the end of the loop it jumps to the next page in sketch (have to go back in the navigator)
    data-populator issue.zip

Iterating over a group

I was thinking if you took a layer group and allowed iterating inside of the group like a handlebars template would do:

{{#each dataObject }}
   {{name}}
{{/each}}

The layer group could be named {dataObject} and the text layer would be {name} that way you could iterate over an array of objects and then populate the data inside it. Does that make sense?

Error with commas in margins

This plugin is awesome, for starters. ;)

I'm on a Mac with German localization and therefore, the decimal separator is a comma and not a point. The grid options in certain situations come up with 0,0 by default, which causes an error if not corrected to 0 or 0.0 manually.

Maybe you can do some sort of parsing on the input, that would be great!

By the way…Sketch has the same problem, for instance when calculating widths etc.

margin

Creating data visualizations in Sketch

visualizing_data

I’ve used https://github.com/preciousforever/sketch-data-populator for Sketch and run into a blocker for me. I am parsing SVG graphics to points on the artboard and I was hoping to pass in a radius or W x H (in JSON) to the containers on the artboard that hold the svg’s in hopes to control their scale.

Currently the container on the artboard restricts the real proportions I need translated. Can Sketch layer properties be accessed in the JSON data import so I can control the SVG container size?

populate symbols with different images

Hi,

When sketching a blog archive page, I create a symbol for a blogpost. A blogpost generally contains a title, excerpt/description and an image.

I know it is possible in Sketch to 'exclude text value from symbol'. This way every post gets its own title. But is there also a way to exclude an image? I'm not sure if this is a feature missing in Sketch or a feature request for the plugin.

Do you see any options how to deal with this?

thx!

Unintended layer text is changing

What happened

When I populated a Sketch file with JSON, it is mysteriously also changes other text layers' content even though they are not variables.

The unintended text layers changed are being changed to text that it was before but written over and saved in Sketch.

What is expected

The layers with variables will change and the layers without variables will not change.

Steps to reproduce

  1. Select all layers
  2. Restore Placeholders (optional)
  3. Populate data with JSON
  4. Select the JSON file
  5. See all the layers change, not just the ones referenced in the JSON and the layers with variables

Files to reproduce and screencast of my repro: https://db.tt/vqDH6B74

Some other notes on the mysterious text layer

  1. When I select the layer and Restore Placeholders it doesn't do anything, confirming that it's not working as a variable.
  2. There is no text in the JSON file corresponding to the text that the mysterious layer is being replaced with.

Thanks!

randomise

we should think about a way to instead of use the order in the JSON, we can randomise it

handling empty fields (no data)

Currently, if a {placeholder} doesn't get data from populating, it says "undefined".

Would be great if his could be configured – a string (or strings) that could be used instead of "undefined" (not sure how and which granularity).

But also, imagine having {price} and {oldprice}. Some data rows don't have "oldprice" though because there's no price change to communicate. In this case it would be good if a placeholder could be omitted.

I'm not all clear how we could do this. Flag a {placeholder} as optional somehow?

Different type treatment with substitute

If a symbol has two fields in one text box, the type is styled differently if a substitute is used. With a substitute is the prefered styling. Without, the second word of the first field uses the second field's styling.

screenshot 2016-04-11 10 07 39

Correct manifest identifier

"identifier": "com.precious.sketch.datapopulator" should become "identifier": "com.precious-forever.sketch.datapopulator" as we do not own precious.com

truncate

a way to tell a (single line) text layer it's limited to N characters, then cut the text and insert an ellipsis (…)

Parsing Arrays containing Objects

Am I doing something wrong or is it currently not possible to parse arrays containing objects?

See example below:

[
  {
    "array": [
      {
        "id": 1,
        "details": "first details"
      },
      {
        "id": 2,
        "details": "more details"
      }
    ],
    "secondArray": [
      {
        "id": 3,
        "details": "just another object"
      }
    ]
  }
]

Multiple Images and multiple icons

Sketch crashes whenever I try to populate my field group with more than one image and with more than one svg. I have a product image, an image of ratings, and two svg's for two badges. Is there support or help for this? Thanks!

Symbols not working with images

I have my symbol on my Symbols page with placeholder text and image, then when I populate symbols on my page I'm designing on with JSON the text is populated, but the image remains as a grey box.

v1.6-beta.1: Can't save file after feeding symbols with JSON…

After creating a list of items in Sketch 3.7 (28169) from a (new 3.7 type) symbol by importing a (tested and error free) JSON file I cannot save the document. That makes Data Populator completely useless for symbols – which let's me stuck in Sketch 3.6.1 :/

Data Populator 1.6-beta.1 (with JSON import) only works with regular folders, not with symbols as far as I experienced it.
Unfortunately I cannot share the files since they are confidential.

Hope it helps,
Aki

Populate with JSON only uses text from 2nd data set

I have the json file below filled with different assets and text. When I use populate with JSON and say I need 1 column and 2 rows, I get two layer groups with two different avatars, but each layer group uses the same placeholder text from ID 2 only.

[
{
"id": 1,
"avatar" : "URL1",
"name": "NAME1",
"location": "LOCATION1"
},
{
"id": 2,
"avatar" : "URL2",
"name": "NAME2",
"location": "LOCATION2"

]

Request: Nested arrays

Thanks for this great plugin!
Is it possible to use nested arrays, for example:
[{ "name": { "firstname": "Jack", "lastname": "Black" } }]

Broken copy&paste

Fantastic app ! Just a note: The plugin seems to remember the blocks where a json variable was input and replaced. This prevents copying of any text block which contained a variable at some point of his history, even if you fill it up with a new variable. Lots of unatural manipulation needed to handle these blocks.

Sketch Crash on Populate With JSON when using SVG

It took me a few minutes to track down, but I am running into an issue where, if I use the SVG version of an icon, Sketch will crash upon clicking the "Populate" button. However, if I use a PNG version of the same icon, everything goes swimmingly.

The SVG in question was originally generated by Sketch. I also attempted re-saving it from Illustrator as an SVG. And, then, exporting it from Illustrator as a web-optimized SVG. Same results. I also tried a few different SVG icons in case it was specific to one odd/corrupt file. Below is the actual SVG text of the SVG generated by Sketch:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg width="21px" height="18px" viewBox="0 0 21 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 3.6.1 (26313) - http://www.bohemiancoding.com/sketch --> <title>icon_checkmark_green</title> <desc>Created with Sketch.</desc> <defs></defs> <g id="Response-States" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="UI-Components" transform="translate(-532.000000, -50.000000)" fill="#5BB55D"> <path d="M538.82094,67.1223958 L532,58.1380208 L535.024379,54.9479167 L538.82094,59.8307292 L550.725412,50 L552.205427,51.4973958 L538.82094,67.1223958 L538.82094,67.1223958 Z" id="icon_checkmark_green"></path> </g> </g> </svg>

Not recognising nested data

For some reason it no longer allows me to use nested JSON.

For example:

"categories": [
  {
    "id": 8,
    "name": "News",
  }
],

It would normally allow me to just use {categories.name}

Multiple Array ID's in JSON not working

Hey,
i'm trying out Sketch Data Populator, and struggled with the integration of different data sets inside the JSON file. It might be that i am doing sth wrong, so maybe you guys can help me. I attached the key screenshots from my setup:

json
layer
artboard

Thanks in advance, any hint is appreciated!

Images/Icons also not populating in Sketch 3.5.1

In addition to the Make Grid issue, the {image} and {{icon}} placeholders are also not working. You can see the behavior from the demo.sketch file. I'm sure you guys noticed this as well (hard to miss). But I wanted to mention it as another breaking change with Sketch 3.5.1.

"Populate again" improvement

When I click "Populate again", nothing happens, because my {tags} are all gone, and the plugin sees nothing to populate. I'd LOVE IT if the plugin could actually repopulate all the zones again, sorta like a shuffle.

It seems like a great way to test to strength of my layout, to just shuffle one random set after another into place. Currently it seems like I'd need to maintain a "source" set of artboards, where I keep the {title} and such in place, and duplicate each time I wanted to populate.

Any way for the plugin to repopulate the same fields it's already touched? Perhaps instead of looking for {title} in the text field content itself, we could name the actual layer {title}, so the plugin would know to continually target it? Even after it's been populated once?

"Restore placeholders" command

Populating a text layer stores the original content of the layer as meta data. This way, it's possible to "re-populate" easily.

It also means that once populated, a field now has its original content and placeholders forever. So entering new {placeholders} manually into the text layer doesn't work – it will always use the stored values.

a solution: a "Restore placeholders" command that inserts the initially used content/placeholders back into the text layer and gets rid of the meta data. now changing something should allow for a fresh start.

Populate data with Yaml

Just a bit of a feature request to have the ability to write in yaml to populate a sketch file.

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.