formly-js / angular-formly-templates-lumx

LumX Templates for Angular-Formly
https://af-lumx.herokuapp.com/
MIT License
35 stars 14 forks source link

cant work with formly v7 and above? #16

Closed badoet closed 8 years ago

badoet commented 8 years ago
Error: angular-formly: formlyConfig.setType apiCheck failed! `value` at `Argument 1` cannot have extra properties: `validateOptions`.It is limited to `name`, `template`, `templateUrl`, `controller`, `link`, `defaultOptions`, `extends`, `wrapper`, `data`, `apiCheck`, `apiCheckInstance`, `apiCheckFunction`, `apiCheckOptions`, `overwriteOk`  settype-validation-failed

You passed:
{
  "name": "lx-checkbox",
  "templateUrl": "fields/formly-fields-lx-checkbox.html"
}

With the types:
{
  "name": "string",
  "templateUrl": "string",
  "validateOptions": "Function"
}

The API calls for:
{
  "__apiCheckData": {
    "strict": true,
    "optional": false,
    "type": "shape"
  },
  "shape": {
    "name": "String",
    "templateUrl": {
      "__apiCheckData": {
        "optional": true,
        "type": "ifNot",
        "description": "specified only if template is not specified"
      },
      "ifNot": {
        "__apiCheckData": {
          "optional": false,
          "type": "oneOfType"
        },
        "oneOfType": [
          "String",
          "Function"
        ]
      }
    }
  }
}
holtjonathan commented 8 years ago

Does Lumx really not work with formly v7?

kentcdodds commented 8 years ago

Looks like these templates need to update to handle some of the breaking changes in v7. https://github.com/formly-js/angular-formly/releases/tag/v7.0.0

Shouldn't be a huge deal. Anyone with slight knowledge of angular-formly should be able to do it.

kentcdodds commented 8 years ago

I'm pretty sure that the only necessary changes will be to change any instance of validateOptions and replace it with the new apiCheck api. Like so:

here:

{
  name: 'input',
  validateOptions: {
    label: apiCheck.string,
    icon: apiCheck.string,
    fixedLabel: apiCheck.boolean,
    disabled: apiCheck.boolean,
    className: apiCheck.string,
    theme: apiCheck.oneOf(['light', 'dark']),
    type: apiCheck.oneOf(['text', 'number', 'email', 'password', 'url', 'tel']),
    required: apiCheck.boolean
  }
}

Should be something like this:

{
  name: 'input',
  apiCheck: function(check) {
    return {
      templateOptions: {
        label: check.string,
        icon: check.string,
        fixedLabel: check.boolean,
        disabled: check.boolean,
        className: check.string,
        theme: check.oneOf(['light', 'dark']),
        type: check.oneOf(['text', 'number', 'email', 'password', 'url', 'tel']),
        required: check.boolean
      }
    };
  }
}
holtjonathan commented 8 years ago

@kentcdodds Looks like the last push of code for this was 4 months ago. Do you think I should even look into Lumx Formly? While it looks awesome and very modern...I don't want to get invested with something that isn't supported and updated.

kentcdodds commented 8 years ago

@holtjonathan, if you look at it, it's really not all that complicated. I don't know where @ShMcK stands on supporting the repository, but for the most part it's "done" aside from updating it for infrequent breaking changes in the formly core api. You could either fork it, or, if @ShMcK is ok with it, I could give you push access and you could take it over.

holtjonathan commented 8 years ago

@kentcdodds That makes sense (about it being 'done'). I am not quite ready to incorporate Lumx into my site, I was just doing some research on the cool things that Formly could do. When I get around to trying Lumx out and if it still isn't supported I would be okay with forking/taking over if @ShMcK doesn't want to do it any longer.

kentcdodds commented 8 years ago

Ping us here when you get to that point. I'm sure @ShMcK would be fine with you helping out. He'll need to add you to the collaborators on npm to publish on npm though.

ShMcK commented 8 years ago

I'm okay with letting someone else take over the project. I'm no longer using LumX in any projects, so I haven't kept up with changes.

Otherwise, I'll review and accept any needed pull requests and publish accordingly.

badoet commented 8 years ago

i end up rolling without using formly. more manageable with plain html

kentcdodds commented 8 years ago

more manageable with plain html

@badoet, heh, I'd be surprised if that's true

@ShMcK, let's wait for anyone else to chime in who wants to implement a fix to upgrade these templates, we'll see if they're keen on taking the project over or would prefer to just PR it. Thanks for staying open!

ShMcK commented 8 years ago

@kentcdodds, I'll make the proposed upgrade later today, as you've already pointed out the simple necessary changes. Thanks!

But again if someone is actively using the templates and interested in maintaining them, this would be a better future course of action.

kentcdodds commented 8 years ago

:+1:

ShMcK commented 8 years ago

Formly-Lumx is now updated to work with 7.1.2.

holtjonathan commented 8 years ago

Awesome! Thanks @shmck

holtjonathan commented 8 years ago

@ShMcK and @kentcdodds ,

I finally got around to looking into this library. I pulled down the latest and it still complains about the validateOptions issue:

ncaught Error: angular-formly: formlyConfig.setType apiCheck failed! `value` at `Argument 1` cannot have extra properties: `validateOptions`.It is limited to `name`, `template`, `templateUrl`, `controller`, `link`, `defaultOptions`, `extends`, `wrapper`, `data`, `apiCheck`, `apiCheckInstance`, `apiCheckFunction`, `apiCheckOptions`, `overwriteOk`  settype-validation-failed

You passed:
{
  "name": "lx-checkbox",
  "templateUrl": "fields/formly-fields-lx-checkbox.html"
}

Just a heads up as we thought this was resolved.

holtjonathan commented 8 years ago

And nevermind. I see the changes were done within the index.js file. I was including the formlyLumx.js file (where the changes have not been made).

ShMcK commented 8 years ago

Yes, that was my fault. I'm sorry for the trouble.

I had forgotten to run the webpack build after updating.

kentcdodds commented 8 years ago

I realize you probably don't care to take the time to set this up for this repo, but automating releases (<-- free egghead lesson) makes maintaining a library much easier :-)

ShMcK commented 8 years ago

semantic-release-cli. Very useful. I wish I read this earlier.

kentcdodds commented 8 years ago

:+1: It's incredible :-)