Copy (Clipboard Module) missing for ag-grid-vue - node-modules

I noticed that ag-grid-vue and #ag-grid-enterprise/all-modules does not include the Clipboard module. Copy, copy with headers, and paste are all missing in the context menu.
/* Package.json */
"dependencies": {
"#ag-grid-enterprise/all-modules": "^22.1.2",
"#ag-grid-enterprise/clipboard": "^22.1.0",
"ag-grid-community": "^22.1.1",
"ag-grid-vue": "^22.1.1"
context menu

you can try installing
"#ag-grid-enterprise/clipboard": "^22.1.1" in the package.json.
then add this in the app.component.ts file
import {ModuleRegistry} from 'ag-grid-community';
import {ClipboardModule} from '#ag-grid-enterprise/clipboard';
ModuleRegistry.register(ClipboardModule as any);
this worked for me. Let me know

You are currently mixing the two approaches of including AG Grid in your project.
You only need the following in your package.json file as these packages contain all the code you need following the AG Grid 'package' approach. The package ag-grid-enterprise contains the Clipboard functionality without the need to register modules.
/* Package.json */
"dependencies": {
"ag-grid-enterprise": "^22.1.2",
"ag-grid-community": "^22.1.1",
"ag-grid-vue": "^22.1.1"
From the docs
It is important that you do not mix packages and modules in the same
application as this will result in AG Grid being included twice and
doubling your bundle size! All modules are scoped by either
#ag-grid-community/* or #ag-grid-enterprise/* and should not be mixed
with the standalone packages of ag-grid-community and
ag-grid-enterprise.
Modules
Packages
#ag-grid-community/xxxxx
ag-grid-community
#ag-grid-enterprise/xxxxx
ag-grid-enterprise
I have written about this more in this blog post.

Related

genindex and modindex footer links don't work in readthedocs.io

I have a Python project using Sphinx for docs. I am building the docs remotely on readthedocs.io service.
I used sphinx-quickstart and it generated an index.rst file with these links in the footer:
Indices and tables
~~~~~~~~~~~~~~~~~~
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
When I push changes to readthedocs.io and build the docs, my build succeeds. Docs that I manually linked via toctree directive all work fine.
The search link works fine.
But the genindex link goes to an empty page, titled "Index"
And the modindex page links to py-modindex.html, which is a 404.
Following this guide: https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs I had run sphinx-apidoc -o api-docs/ ../myproject to generate the autodoc .rst files.
I linked the resulting api-docs/modules.rst in the toctree section at the top of my index.rst... That link works and if I click through the api-docs have been generated correctly.
Also generated by sphinx-autodoc were files for each package in my project, they contain directives like:
myproject.whatever module
-------------------------
.. automodule:: myproject.whatever
:members:
:undoc-members:
:show-inheritance:
If I browse directly to these pages they have content, but they don't appear in the index (only the tocs they are manually linked in).
I also have some manually authored pages, again linked via toc.
My docs/conf.py looks like:
import os
import sys
sys.path.insert(0, os.path.abspath("../"))
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
html_theme = "alabaster"
html_static_path = ["_static"]
I believe the fact that html generated from the autodoc .rst stub files are filled with modules and classes extracted from the .py files in my project indicates that the sys path fix and autodoc are basically working.
So my question is:
How to make :ref:`genindex` have some content?
How to fix :ref:`modindex` points to py-modindex.html which does not exist?
genindex and modindex are automatically managed by Sphinx. Two cases should be considered:
Any declaration in a .rst file will be inserted in those indexes. For example, if you declare a function from the Python domain:
Your rst file
-------------
.. py:function:: name(parameters)
It will be inserted in the indexes even if it doesn't have a corresponding function in any .py file.
Using autodoc directives, the same applies with a few more rules. The autodoc extension will substitute domain declarations (like above) depending if the object has a docstring and if you are using the :members: and or :undoc-members: options. So you have to verify you are using the correct option and directive for your case.
Your rst file
-------------
.. autoclass:: Your_Module.Your_Class
:members:
The above example will be substituted by a :py:class:: domain declaration if the corresponding class has a docstring, if not you need to add the :undoc-members: option.
The symptoms you are describing of having empty indexes happens when you haven't declared anything in the .rst files. With the nuance that the autodoc directives may or may not do those declarations for you depending if the objects have docstrings and you used the right options in the directives.
EDIT: You should also run make clean before your builds (e.g.make html) because inconsistencies between builds can break the index.
As I eventually worked out in the comments, thanks to help from #bad_coder, my problem was specific to building the docs in readthedocs.io
Building the docs locally worked fine.
The reason came down to use of sphinx.ext.autodoc, perhaps in conjunction with sphinx_autodoc_typehints, which seems to need to import my actual python code. Checking the logs of my apparently successful readthedocs build showed actually there were warnings like:
WARNING: autodoc: failed to import module 'whatever' from module 'myproject'; the following exception was raised:
No module named 'somelib'
i.e the docs had only partially built, it had skipped the parts it couldn't do.
The build worked locally because I was already in a virtualenv with all my project's dependencies installed.
(IMHO this seems like a bad design of the sphinx.ext.autodoc and/or sphinx_autodoc_typehints ...good static-analysis tools exist for Python which can build an AST or CST and extract structure and docstrings without importing any code.)
Well anyway, this meant that I needed to tell readthedocs.io how to install all my project deps. This is slightly complicated by the fact I'm using Poetry, which is not explicitly supported. This means I don't have a requirements.txt file to point to (and I don't want to manually create one that is a duplicate of everything in my pyproject.toml).
Fortunately the pyproject.toml file is understandable by pip, so we're able to use the pip install method described here for readthedocs.io to install both my project deps, plus extra deps that are only needed for building docs: https://github.com/readthedocs/readthedocs.org/issues/4912#issuecomment-664002569
To summarise:
Deleted my docs/requirements.txt
Added:
[tool.poetry.dependencies]
...
sphinx = {version = "^3.1.1", optional = true}
sphinx-autodoc-typehints ={version = "^1.11.1", optional = true}
and:
[tool.poetry.extras]
docs = [
"sphinx",
"sphinx-autodoc-typehints"
]
to my pyproject.toml
Updated my .readthedocs.yml to:
version: 2
sphinx:
configuration: docs/conf.py
python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
Pushed these changes to readthedocs.io ...voilĂ , now it works.

How to get npm module working locally on Laravel/Vue Project?

I know the question is broad but at this point I'm not necessarily sure how to specify it. I am currently working on a Laravel/Vue project, and I want to create an extracted module that will eventually be an NPM package. The reason I want to extract it is because I will use this chunk of code as a mixin within various Vue components.
I want to do this all locally so that I don't have to continuously mess with NPM, so I set up the link between my project and my module via the npm link command. I can confirm in my Project that there is a symbolic link directory in the node_modules directory, pointing to my Module.
In my Project, I have the code from the mixin executing a function inside another method of my Vue component, like so:
this.updateState(response.state);
I am importing and defining the mixin in that file like so:
import UpdatesState from 'module';
export default {
mixins: [UpdatesState],
This updateState method is defined in my Module. Inside my Module, here is what my module/src/mixins/UpdateState file looks like:
export default {
methods: {
updateState(state) {
this.$store.commit('state', state);
}
},
}
Also in the Module, I have an index.js file that looks like this:
import UpdatesState from './mixins/UpdatesState'
export default {
UpdatesState
}
My Module's package.json looks like this:
{
"name": "module",
"description": "Supporting modules",
"main": "src/index.js",
"author": "Hoolakoola",
"license": "MIT"
}
When I was running this code from within the actual source of the Project and just referencing it by its absolute path, it was working fine. But now that I am trying to extract it, it is not working properly. I am not getting any errors when compiling the Project, and there are no errors in the console. Any idea what is going wrong here and how I can fix it? Thank you.

webpack to allow import of all sass files? i.e #import 'components/**/*'

I'm currently using css-loader, node-sass, sass-loader and style-loader packages within webpack to compile my sass files, here is how my loader looks at the moment:
{
test: /\.scss$/,
loader: 'style!css!sass'
}
I want to use folder structure like this for my styles
styles
components/
main.sass
and somehow within main.sass I want to import everything from components folder so something like #import './components/**/*' is this possible via webpack?
You can prefix a Sass import with '~' to tell the Sass loader to use webpack's require() resolution on the import. Once webpack is in charge of the import you have some flexibility.
If you do a dynamic require, e.g. require('~./components/' + someVar + '.scss'), webpack can't evaluate the variable at build time and it bundles all the possible files in that directory, and the actual resolution of the require() happens at runtime (which can lead to errors at runtime if you've asked for something that doesn't exist). Not sure off the top of my head if that would give you what you need (all the files bundled) or if you would still need to explicitly require() each partial -- but if that's the case you could easily loop through all the files in the directory and require each one.
More on how you can leverage webpack's dynamic requires and loading context.

gulp, wiredep and custom sass file

So I made a library that I can bower install using a direct link. I can use this library from another internal application by adding the library name in the dependency of the bower.json file. When other internal application does a bower update, the changes I made on the library will be applied to their application. This part is working very well.
Now, I'd like the other software devs to have freedom to change the styles. They can create css file directly and that will work. However, it's a hackish route. I can provide them the same settings file that I use.
So i tried putting that file in the main section of the bower.json but wiredep is processing it. I put it in exclude and the error is gone when I run gulp.
"main": [
"dist/stylesheet.css",
"src/_settings.scss"
],
this is the code that prevented it from being parsed by wiredep
wiredep: {
directory: 'bower_components',
exclude: ['css/foundation.css','src/_settings.scss']
}
Am I right that I'll have to create a new gulp task and put 'src/_settings.scss' as gulp.src like this
gulp.task('sasstask2', function () {
return gulp.src('src/_settings.scss')
.pipe($.sass())
.pipe(gulp.dest('src/css'));
});
I also like the generate css to be injected to index.html but not sure how to do it? Will wiredep automatically inject it to index.html?

Auto compile SCSS files in Sublime Text 2

Ok, here is what I want:
I write .scss files, not .sass files
On saving the file, I get the corresponding .css file in the same folder
Now there are plenty of SASS plugins on Sublime Text2 but none seems to provide anything beyond syntax highlighting for me.
Any suggestions on how to get auto-compiling working on Sublime Text2.
I didn't find any existing plugins that did this, so here it is:
Assuming you've installed the SCSS plugin from Package Control, you can save this as Packages/User/SCSS.py.
import sublime_plugin
import subprocess
import os
from threading import Thread
def compile(input_file):
output_file = os.path.splitext(input_file)[0] + ".css"
cmd = "sass '{0}':'{1}'".format(input_file, output_file)
subprocess.call(cmd, shell=True)
class SCSS(sublime_plugin.EventListener):
def on_post_save(self, view):
scope = (view.syntax_name(view.sel()[0].b)).split().pop()
if scope == "source.scss":
input_file = view.file_name()
t = Thread(target=compile, args=(input_file,))
t.start()
Of course, this would be better as an official Package Control plugin with user configurable settings (where to save files, on/off, etc), but this meets your requirements and doesn't block the editor.
You should consider to use build system instead of dedicated plugin of it. It's very simple to do.
http://docs.sublimetext.info/en/latest/file_processing/build_systems.html
Something like this:
{
"cmd": ["sass","$file"],
"selector": "source.scss",
"path": "/usr/local/bin"
}
And just hit ctrl + b t build current file. If you have multiple builds for scss you can select one from build menu (Tools -> Build Systems).
You could use SublimeOnSaveBuild plugin.
And in plugin filter settings just leave .scss files!
It's works for just great!
I was looking for a sass/scss compiler plugin for Sublime Test, but I have my source folders separate from my css folders. So, going off the comments left on here I wrote SassBuilder that runs off a config file stored in your source folder. It has also been submitted to the Sublime Package Control repository. Once they pull the request, you can install it from there.
SassBuilder on github
Sass Builder is the new plugin which is available in Package Manager of sublime text.
This does not require any configuration. Just write your scss and hit cmd + b to compile.
Your css file will be generated in the same folder as scss.

Resources